r236011 - Implemented support for testing the ASTImporter's
Sean Callanan
scallanan at apple.com
Tue Apr 28 11:24:12 PDT 2015
Author: spyffe
Date: Tue Apr 28 13:24:12 2015
New Revision: 236011
URL: http://llvm.org/viewvc/llvm-project?rev=236011&view=rev
Log:
Implemented support for testing the ASTImporter's
ability to generate code that CodeGen likes. Test
cases can use this functionality by calling
// RUN: %clang_cc1 -emit-obj -o /dev/null -ast-merge %t.1.ast -ast-merge %t.2.ast %s
Modified:
cfe/trunk/lib/CodeGen/CodeGenAction.cpp
cfe/trunk/lib/Frontend/ASTMerge.cpp
Modified: cfe/trunk/lib/CodeGen/CodeGenAction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenAction.cpp?rev=236011&r1=236010&r2=236011&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenAction.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenAction.cpp Tue Apr 28 13:24:12 2015
@@ -79,6 +79,11 @@ namespace clang {
}
void Initialize(ASTContext &Ctx) override {
+ if (Context) {
+ assert(Context == &Ctx);
+ return;
+ }
+
Context = &Ctx;
if (llvm::TimePassesIsEnabled)
Modified: cfe/trunk/lib/Frontend/ASTMerge.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/ASTMerge.cpp?rev=236011&r1=236010&r2=236011&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/ASTMerge.cpp (original)
+++ cfe/trunk/lib/Frontend/ASTMerge.cpp Tue Apr 28 13:24:12 2015
@@ -57,6 +57,7 @@ void ASTMergeAction::ExecuteAction() {
/*MinimalImport=*/false);
TranslationUnitDecl *TU = Unit->getASTContext().getTranslationUnitDecl();
+ CI.getASTConsumer().Initialize(CI.getASTContext());
for (auto *D : TU->decls()) {
// Don't re-import __va_list_tag, __builtin_va_list.
if (const auto *ND = dyn_cast<NamedDecl>(D))
@@ -64,7 +65,12 @@ void ASTMergeAction::ExecuteAction() {
if (II->isStr("__va_list_tag") || II->isStr("__builtin_va_list"))
continue;
- Importer.Import(D);
+ Decl *ToD = Importer.Import(D);
+
+ if (ToD) {
+ DeclGroupRef DGR(ToD);
+ CI.getASTConsumer().HandleTopLevelDecl(DGR);
+ }
}
}
More information about the cfe-commits
mailing list