summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2012-03-07 01:51:17 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2012-03-07 01:51:17 +0000
commitbef35c91b594f66216f4aab303b71a6c5ab7abcf (patch)
treeaf935f170855c48b0417e6c0522da55e9a2873c0 /tools
parent4a90e1a8a296c30e94e34e19974d84fb8cfc2bd3 (diff)
[PCH] Mark a PCH file with a flag to indicate if the serialized AST had
compiler errors or not. -Control whether ASTReader should reject such a PCH by a boolean flag at ASTReader's creation time. By default, such a PCH file will be rejected with an error when trying to load it. [libclang] Allow clang_saveTranslationUnit to create a PCH file even if compiler errors occurred. -Have libclang API calls accept a PCH that had compiler errors. The general idea is that we want libclang to stay functional even if a PCH had a compiler error. rdar://10976363. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152192 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r--tools/libclang/CIndex.cpp7
-rw-r--r--tools/libclang/Indexing.cpp1
2 files changed, 6 insertions, 2 deletions
diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp
index 3b02595188..7e4a1ede74 100644
--- a/tools/libclang/CIndex.cpp
+++ b/tools/libclang/CIndex.cpp
@@ -2438,7 +2438,9 @@ CXTranslationUnit clang_createTranslationUnit(CXIndex CIdx,
IntrusiveRefCntPtr<DiagnosticsEngine> Diags;
ASTUnit *TU = ASTUnit::LoadFromASTFile(ast_filename, Diags, FileSystemOpts,
CXXIdx->getOnlyLocalDecls(),
- 0, 0, true);
+ 0, 0,
+ /*CaptureDiagnostics=*/true,
+ /*AllowPCHWithCompilerErrors=*/true);
return MakeCXTranslationUnit(TU);
}
@@ -2575,7 +2577,8 @@ static void clang_parseTranslationUnit_Impl(void *UserData) {
/*RemappedFilesKeepOriginalName=*/true,
PrecompilePreamble,
TUKind,
- CacheCodeCompetionResults));
+ CacheCodeCompetionResults,
+ /*AllowPCHWithCompilerErrors=*/true));
if (NumErrors != Diags->getClient()->getNumErrors()) {
// Make sure to check that 'Unit' is non-NULL.
diff --git a/tools/libclang/Indexing.cpp b/tools/libclang/Indexing.cpp
index 1475859e33..aad6e02fe9 100644
--- a/tools/libclang/Indexing.cpp
+++ b/tools/libclang/Indexing.cpp
@@ -369,6 +369,7 @@ static void clang_indexSourceFile_Impl(void *UserData) {
bool CacheCodeCompletionResults = false;
PreprocessorOptions &PPOpts = CInvok->getPreprocessorOpts();
PPOpts.DetailedRecord = false;
+ PPOpts.AllowPCHWithCompilerErrors = true;
if (requestedToGetTU) {
OnlyLocalDecls = CXXIdx->getOnlyLocalDecls();