[cfe-commits] r111590 - in /cfe/trunk: lib/Frontend/ASTUnit.cpp test/Index/Inputs/preamble-reparse-1.c test/Index/Inputs/preamble-reparse-2.c test/Index/preamble-reparse.c
Douglas Gregor
dgregor at apple.com
Thu Aug 19 17:02:33 PDT 2010
Author: dgregor
Date: Thu Aug 19 19:02:33 2010
New Revision: 111590
URL: http://llvm.org/viewvc/llvm-project?rev=111590&view=rev
Log:
When we decide not to reuse a precompiled preamble, clear out the
previous precompiled preamble completely. Fixes <rdar://problem/8330950>.
Added:
cfe/trunk/test/Index/Inputs/preamble-reparse-1.c
cfe/trunk/test/Index/Inputs/preamble-reparse-2.c
cfe/trunk/test/Index/preamble-reparse.c
Modified:
cfe/trunk/lib/Frontend/ASTUnit.cpp
Modified: cfe/trunk/lib/Frontend/ASTUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/ASTUnit.cpp?rev=111590&r1=111589&r2=111590&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/ASTUnit.cpp (original)
+++ cfe/trunk/lib/Frontend/ASTUnit.cpp Thu Aug 19 19:02:33 2010
@@ -698,9 +698,11 @@
CleanTemporaryFiles();
PreprocessedEntitiesByFile.clear();
- if (!OverrideMainBuffer)
+ if (!OverrideMainBuffer) {
StoredDiagnostics.clear();
-
+ TopLevelDeclsInPreamble.clear();
+ }
+
// Create a file manager object to provide access to and cache the filesystem.
Clang.setFileManager(&getFileManager());
@@ -733,6 +735,9 @@
getSourceManager());
StoredDiagnostics[I].setLocation(Loc);
}
+ } else {
+ PreprocessorOpts.PrecompiledPreambleBytes.first = 0;
+ PreprocessorOpts.PrecompiledPreambleBytes.second = false;
}
llvm::OwningPtr<TopLevelDeclTrackerAction> Act;
@@ -1415,6 +1420,14 @@
}
// Remap files.
+ PreprocessorOptions &PPOpts = Invocation->getPreprocessorOpts();
+ for (PreprocessorOptions::remapped_file_buffer_iterator
+ R = PPOpts.remapped_file_buffer_begin(),
+ REnd = PPOpts.remapped_file_buffer_end();
+ R != REnd;
+ ++R) {
+ delete R->second;
+ }
Invocation->getPreprocessorOpts().clearRemappedFiles();
for (unsigned I = 0; I != NumRemappedFiles; ++I)
Invocation->getPreprocessorOpts().addRemappedFile(RemappedFiles[I].first,
@@ -1772,6 +1785,9 @@
FullSourceLoc Loc(StoredDiagnostics[I].getLocation(), SourceMgr);
StoredDiagnostics[I].setLocation(Loc);
}
+ } else {
+ PreprocessorOpts.PrecompiledPreambleBytes.first = 0;
+ PreprocessorOpts.PrecompiledPreambleBytes.second = false;
}
llvm::OwningPtr<SyntaxOnlyAction> Act;
Added: cfe/trunk/test/Index/Inputs/preamble-reparse-1.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/Inputs/preamble-reparse-1.c?rev=111590&view=auto
==============================================================================
--- cfe/trunk/test/Index/Inputs/preamble-reparse-1.c (added)
+++ cfe/trunk/test/Index/Inputs/preamble-reparse-1.c Thu Aug 19 19:02:33 2010
@@ -0,0 +1,2 @@
+
+
Added: cfe/trunk/test/Index/Inputs/preamble-reparse-2.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/Inputs/preamble-reparse-2.c?rev=111590&view=auto
==============================================================================
--- cfe/trunk/test/Index/Inputs/preamble-reparse-2.c (added)
+++ cfe/trunk/test/Index/Inputs/preamble-reparse-2.c Thu Aug 19 19:02:33 2010
@@ -0,0 +1 @@
+int x;
Added: cfe/trunk/test/Index/preamble-reparse.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/preamble-reparse.c?rev=111590&view=auto
==============================================================================
--- cfe/trunk/test/Index/preamble-reparse.c (added)
+++ cfe/trunk/test/Index/preamble-reparse.c Thu Aug 19 19:02:33 2010
@@ -0,0 +1,2 @@
+// RUN: env CINDEXTEST_EDITING=1 c-index-test -test-load-source-reparse 5 local "-remap-file=%S/Inputs/preamble-reparse-1.c;%S/Inputs/preamble-reparse-2.c" %S/Inputs/preamble-reparse-1.c | FileCheck %s
+// CHECK: preamble-reparse-1.c:1:5: VarDecl=x:1:5 Extent=[1:1 - 1:6]
More information about the cfe-commits
mailing list