aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/Sema.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-04-14 16:27:31 +0000
committerDouglas Gregor <dgregor@apple.com>2009-04-14 16:27:31 +0000
commitf807fe0d1a865f4c6ba7e494cf4ae360c4173521 (patch)
treef0bbaf88dd034f90d941b171e3c6b3a7cf9fcf68 /lib/Sema/Sema.cpp
parentd824c9c281c163ba86f3cc10c5572120234a2454 (diff)
When building a PCH file, don't perform end-of-translation-unit
wrap-up (e.g., turning tentative definitions into definitions). Also, very that, when we actually use the PCH file, we get the ride code generation for tentative definitions and definitions that show up in the PCH file. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69043 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/Sema.cpp')
-rw-r--r--lib/Sema/Sema.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/Sema/Sema.cpp b/lib/Sema/Sema.cpp
index f11ce2043a..403e8f60f5 100644
--- a/lib/Sema/Sema.cpp
+++ b/lib/Sema/Sema.cpp
@@ -151,12 +151,14 @@ void Sema::ActOnTranslationUnitScope(SourceLocation Loc, Scope *S) {
Context.setObjCIdType(IdTypedef);
}
-Sema::Sema(Preprocessor &pp, ASTContext &ctxt, ASTConsumer &consumer)
+Sema::Sema(Preprocessor &pp, ASTContext &ctxt, ASTConsumer &consumer,
+ bool CompleteTranslationUnit)
: LangOpts(pp.getLangOptions()), PP(pp), Context(ctxt), Consumer(consumer),
Diags(PP.getDiagnostics()),
SourceMgr(PP.getSourceManager()), CurContext(0), PreDeclaratorDC(0),
CurBlock(0), PackContext(0), IdResolver(pp.getLangOptions()),
- GlobalNewDeleteDeclared(false) {
+ GlobalNewDeleteDeclared(false),
+ CompleteTranslationUnit(CompleteTranslationUnit) {
// Get IdentifierInfo objects for known functions for which we
// do extra checking.
@@ -216,6 +218,9 @@ void Sema::DeleteStmt(StmtTy *S) {
/// translation unit when EOF is reached and all but the top-level scope is
/// popped.
void Sema::ActOnEndOfTranslationUnit() {
+ if (!CompleteTranslationUnit)
+ return;
+
// C99 6.9.2p2:
// A declaration of an identifier for an object that has file
// scope without an initializer, and without a storage-class