diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-11-03 20:28:19 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-11-03 20:28:19 +0000 |
commit | e6825d39e89362105171c013f4018c4d1134ad6f (patch) | |
tree | 3b33674d3ae95a039b67acb6ad575e69dd1d621b /lib/Frontend/ASTUnit.cpp | |
parent | 2c628646b8c0f5f285a38bf9a97900ee7e34e6c5 (diff) |
[libclang] Fix crash when a #pragma diagnostic is included in the preamble.
A PCH file keeps track of #pragma diagnostics state; when loading the preamble, they conflicted
with the #pragma diagnostic state already present in the DiagnosticsEngine object due to
parsing the preamble.
Fix this by clearing the state of the DiagnosticsEngine object.
Fixes rdar://10363572 && http://llvm.org/PR11254.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143644 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/ASTUnit.cpp')
-rw-r--r-- | lib/Frontend/ASTUnit.cpp | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/lib/Frontend/ASTUnit.cpp b/lib/Frontend/ASTUnit.cpp index 015e92dfcd..0dd3a38da4 100644 --- a/lib/Frontend/ASTUnit.cpp +++ b/lib/Frontend/ASTUnit.cpp @@ -1388,8 +1388,6 @@ llvm::MemoryBuffer *ASTUnit::getMainBufferWithPrecompiledPreamble( // Set the state of the diagnostic object to mimic its state // after parsing the preamble. - // FIXME: This won't catch any #pragma push warning changes that - // have occurred in the preamble. getDiagnostics().Reset(); ProcessWarningOptions(getDiagnostics(), PreambleInvocation->getDiagnosticOpts()); @@ -1940,11 +1938,9 @@ bool ASTUnit::Reparse(RemappedFile *RemappedFiles, unsigned NumRemappedFiles) { OverrideMainBuffer = getMainBufferWithPrecompiledPreamble(*Invocation); // Clear out the diagnostics state. - if (!OverrideMainBuffer) { - getDiagnostics().Reset(); - ProcessWarningOptions(getDiagnostics(), Invocation->getDiagnosticOpts()); - } - + getDiagnostics().Reset(); + ProcessWarningOptions(getDiagnostics(), Invocation->getDiagnosticOpts()); + // Parse the sources bool Result = Parse(OverrideMainBuffer); |