r206644 - Don't read CompilerInstance fields that don't exist in ASTUnit
Ben Langmuir
blangmuir at apple.com
Fri Apr 18 13:39:48 PDT 2014
Author: benlangmuir
Date: Fri Apr 18 15:39:48 2014
New Revision: 206644
URL: http://llvm.org/viewvc/llvm-project?rev=206644&view=rev
Log:
Don't read CompilerInstance fields that don't exist in ASTUnit
When transferring data from a CompilerInstance in an error path we need
to consider cases where the various fields are uninitialized.
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=206644&r1=206643&r2=206644&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/ASTUnit.cpp (original)
+++ cfe/trunk/lib/Frontend/ASTUnit.cpp Fri Apr 18 15:39:48 2014
@@ -1717,11 +1717,14 @@ void ASTUnit::transferASTDataFromCompile
// Steal the created target, context, and preprocessor.
TheSema.reset(CI.takeSema());
Consumer.reset(CI.takeASTConsumer());
- Ctx = &CI.getASTContext();
- PP = &CI.getPreprocessor();
+ if (CI.hasASTContext())
+ Ctx = &CI.getASTContext();
+ if (CI.hasPreprocessor())
+ PP = &CI.getPreprocessor();
CI.setSourceManager(0);
CI.setFileManager(0);
- Target = &CI.getTarget();
+ if (CI.hasTarget())
+ Target = &CI.getTarget();
Reader = CI.getModuleManager();
HadModuleLoaderFatalFailure = CI.hadModuleLoaderFatalFailure();
}
More information about the cfe-commits
mailing list