From 58a7a265cf9203795e718d12c074f103e6b27e73 Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Tue, 29 Jul 2008 17:47:36 +0000 Subject: Fix codegen of chained declarations - Killed useless CodeGenModule::EmitGlobalVarDeclarator, instead just recurse on any ScopedDecl. - Fix for git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54162 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/ModuleBuilder.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'lib/CodeGen/ModuleBuilder.cpp') diff --git a/lib/CodeGen/ModuleBuilder.cpp b/lib/CodeGen/ModuleBuilder.cpp index b37b8d3f01..3fa086fc6a 100644 --- a/lib/CodeGen/ModuleBuilder.cpp +++ b/lib/CodeGen/ModuleBuilder.cpp @@ -64,7 +64,7 @@ namespace { // semantic analysis (to ensure all warnings and errors are emitted). if (Diags.hasErrorOccurred()) return; - + if (FunctionDecl *FD = dyn_cast(D)) { Builder->EmitFunction(FD); } else if (isa(D)){ @@ -86,8 +86,7 @@ namespace { } else if (ObjCMethodDecl *OMD = dyn_cast(D)){ Builder->EmitObjCMethod(OMD); } else if (VarDecl *VD = dyn_cast(D)) { - if (VD->isFileVarDecl()) - Builder->EmitGlobalVarDeclarator(VD); + Builder->EmitGlobalVar(VD); } else if (isa(D) || isa(D)) { // Forward declaration. Only used for type checking. } else if (ObjCMethodDecl *OMD = dyn_cast(D)){ @@ -110,6 +109,12 @@ namespace { assert(isa(D) && "Unknown top level decl"); // TODO: handle debug info? } + + if (ScopedDecl *SD = dyn_cast(D)) { + SD = SD->getNextDeclarator(); + if (SD) + HandleTopLevelDecl(SD); + } } /// HandleTagDeclDefinition - This callback is invoked each time a TagDecl -- cgit v1.2.3