forked from OSchip/llvm-project
When we load the first module, make sure that we wire up the ASTConsumer to the newly-created ASTReader. This makes sure that CodeGen sees the declarations it is interested in
llvm-svn: 139824
This commit is contained in:
parent
c2ff27446d
commit
6137d32c1b
|
@ -756,6 +756,8 @@ ModuleKey CompilerInstance::loadModule(SourceLocation ImportLoc,
|
|||
getASTContext().setExternalSource(Source);
|
||||
if (hasSema())
|
||||
ModuleManager->InitializeSema(getSema());
|
||||
if (hasASTConsumer())
|
||||
ModuleManager->StartTranslationUnit(&getASTConsumer());
|
||||
}
|
||||
|
||||
// Try to load the module we found.
|
||||
|
|
|
@ -4092,6 +4092,7 @@ void ASTReader::StartTranslationUnit(ASTConsumer *Consumer) {
|
|||
// passing to the consumer.
|
||||
GetDecl(ExternalDefinitions[I]);
|
||||
}
|
||||
ExternalDefinitions.clear();
|
||||
|
||||
PassInterestingDeclsToConsumer();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
// RUN: %clang_cc1 -emit-module -triple x86_64-apple-darwin10 -o %t/module.pcm -DBUILD_MODULE %s
|
||||
// RUN: %clang_cc1 -fmodule-cache-path %t -triple x86_64-apple-darwin10 -fdisable-module-hash -emit-llvm -o - %s | FileCheck %s
|
||||
|
||||
#ifdef BUILD_MODULE
|
||||
static inline int triple(int x) { return x * 3; }
|
||||
#else
|
||||
__import_module__ module;
|
||||
|
||||
// CHECK: define void @triple_value
|
||||
void triple_value(int *px) {
|
||||
*px = triple(*px);
|
||||
}
|
||||
|
||||
// CHECK: define internal i32 @triple(i32
|
||||
#endif
|
Loading…
Reference in New Issue