summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/ASTUnit.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-08-20 00:02:33 +0000
committerDouglas Gregor <dgregor@apple.com>2010-08-20 00:02:33 +0000
commit7b02b583b23fac6f31e0645dc1c11340291ea4a3 (patch)
treedf2606c5765947f3221a58483cf894624e1bb7c1 /clang/lib/Frontend/ASTUnit.cpp
parenta6480c124eb1e2fd2703a0c5951db9dcec07be43 (diff)
downloadbcm5719-llvm-7b02b583b23fac6f31e0645dc1c11340291ea4a3.tar.gz
bcm5719-llvm-7b02b583b23fac6f31e0645dc1c11340291ea4a3.zip
When we decide not to reuse a precompiled preamble, clear out the
previous precompiled preamble completely. Fixes <rdar://problem/8330950>. llvm-svn: 111590
Diffstat (limited to 'clang/lib/Frontend/ASTUnit.cpp')
-rw-r--r--clang/lib/Frontend/ASTUnit.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/clang/lib/Frontend/ASTUnit.cpp b/clang/lib/Frontend/ASTUnit.cpp
index 4395246f493..9c5fea4717a 100644
--- a/clang/lib/Frontend/ASTUnit.cpp
+++ b/clang/lib/Frontend/ASTUnit.cpp
@@ -698,9 +698,11 @@ bool ASTUnit::Parse(llvm::MemoryBuffer *OverrideMainBuffer) {
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 @@ bool ASTUnit::Parse(llvm::MemoryBuffer *OverrideMainBuffer) {
getSourceManager());
StoredDiagnostics[I].setLocation(Loc);
}
+ } else {
+ PreprocessorOpts.PrecompiledPreambleBytes.first = 0;
+ PreprocessorOpts.PrecompiledPreambleBytes.second = false;
}
llvm::OwningPtr<TopLevelDeclTrackerAction> Act;
@@ -1415,6 +1420,14 @@ bool ASTUnit::Reparse(RemappedFile *RemappedFiles, unsigned NumRemappedFiles) {
}
// 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 @@ void ASTUnit::CodeComplete(llvm::StringRef File, unsigned Line, unsigned Column,
FullSourceLoc Loc(StoredDiagnostics[I].getLocation(), SourceMgr);
StoredDiagnostics[I].setLocation(Loc);
}
+ } else {
+ PreprocessorOpts.PrecompiledPreambleBytes.first = 0;
+ PreprocessorOpts.PrecompiledPreambleBytes.second = false;
}
llvm::OwningPtr<SyntaxOnlyAction> Act;
OpenPOWER on IntegriCloud