[llvm-branch-commits] [cfe-branch] r116042 - /cfe/branches/Apple/whitney/lib/Frontend/ASTUnit.cpp
Daniel Dunbar
daniel at zuster.org
Thu Oct 7 21:13:44 PDT 2010
Author: ddunbar
Date: Thu Oct 7 23:13:44 2010
New Revision: 116042
URL: http://llvm.org/viewvc/llvm-project?rev=116042&view=rev
Log:
Merge r116041:
--
Author: Douglas Gregor <dgregor at apple.com>
Date: Fri Oct 8 04:03:57 2010 +0000
Fix three related, wily issues with the recompilation of precompiled
preambles:
- When we rebuild a precompiled preamble, make sure to disable
skipping anything in the main file; we may have had leftover
preamble-skipping values in the lexer, which leads to very empty
preamble. This is a correctness issue.
- When we rebuild a precompiled preamble, clear out any prior state
in the Diagnostic object. Otherwise, we might think that there
were errors when we were building the preamble itself, and
therefore reject the resulting preamble. This is mainly a
performance issue.
- Don't remove old remappings when digging out the remapping for the
main file. Having the old mappings around does not hurt in the
common case (later remappings will just overwrite them), and is
important when we fail to find a preamble: we don't want to have
removed the remapping, because we'll need it later.
Modified:
cfe/branches/Apple/whitney/lib/Frontend/ASTUnit.cpp
Modified: cfe/branches/Apple/whitney/lib/Frontend/ASTUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/lib/Frontend/ASTUnit.cpp?rev=116042&r1=116041&r2=116042&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/lib/Frontend/ASTUnit.cpp (original)
+++ cfe/branches/Apple/whitney/lib/Frontend/ASTUnit.cpp Thu Oct 7 23:13:44 2010
@@ -798,7 +798,7 @@
// results yet, do so now.
if (ShouldCacheCodeCompletionResults && CachedCompletionResults.empty())
CacheCodeCompletionResults();
-
+
return false;
error:
@@ -889,12 +889,6 @@
return std::make_pair((llvm::MemoryBuffer*)0,
std::make_pair(0, true));
CreatedBuffer = true;
-
- // Remove this remapping. We've captured the buffer already.
- M = PreprocessorOpts.eraseRemappedFile(M);
- E = PreprocessorOpts.remapped_file_end();
- if (M == E)
- break;
}
}
}
@@ -916,12 +910,6 @@
}
Buffer = const_cast<llvm::MemoryBuffer *>(M->second);
-
- // Remove this remapping. We've captured the buffer already.
- M = PreprocessorOpts.eraseRemappedFile(M);
- E = PreprocessorOpts.remapped_file_buffer_end();
- if (M == E)
- break;
}
}
}
@@ -1101,7 +1089,7 @@
// return now.
if (!AllowRebuild)
return 0;
-
+
// We can't reuse the previously-computed preamble. Build a new one.
Preamble.clear();
llvm::sys::Path(PreambleFile).eraseFromDisk();
@@ -1173,6 +1161,8 @@
FrontendOpts.ChainedPCH = true;
// FIXME: Generate the precompiled header into memory?
FrontendOpts.OutputFile = PreamblePCHPath;
+ PreprocessorOpts.PrecompiledPreambleBytes.first = 0;
+ PreprocessorOpts.PrecompiledPreambleBytes.second = false;
// Create the compiler instance to use for building the precompiled preamble.
CompilerInstance Clang;
@@ -1215,6 +1205,7 @@
"IR inputs not support here!");
// Clear out old caches and data.
+ getDiagnostics().Reset();
StoredDiagnostics.clear();
TopLevelDecls.clear();
TopLevelDeclsInPreamble.clear();
More information about the llvm-branch-commits
mailing list