From: Chris Lattner Date: Sat, 14 Jul 2007 00:16:50 +0000 (+0000) Subject: In "int X,Y;", compile both X and Y. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=32b266cff60737fedff00e8e721f3474533835ef;p=clang In "int X,Y;", compile both X and Y. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39848 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/CodeGen/CodeGenModule.cpp b/CodeGen/CodeGenModule.cpp index b610d3eb27..4bf4b86bcb 100644 --- a/CodeGen/CodeGenModule.cpp +++ b/CodeGen/CodeGenModule.cpp @@ -88,6 +88,12 @@ void CodeGenModule::EmitGlobalVar(const FileVarDecl *D) { } } +/// EmitGlobalVarDeclarator - Emit all the global vars attached to the specified +/// declarator chain. +void CodeGenModule::EmitGlobalVarDeclarator(const FileVarDecl *D) { + for (; D; D = cast_or_null(D->getNextDeclarator())) + EmitGlobalVar(D); +} llvm::Function *CodeGenModule::getMemCpyFn() { if (MemCpyFn) return MemCpyFn; diff --git a/CodeGen/CodeGenModule.h b/CodeGen/CodeGenModule.h index 9d8547030e..fbebdcfcf5 100644 --- a/CodeGen/CodeGenModule.h +++ b/CodeGen/CodeGenModule.h @@ -53,6 +53,7 @@ public: void EmitFunction(const FunctionDecl *FD); void EmitGlobalVar(const FileVarDecl *D); + void EmitGlobalVarDeclarator(const FileVarDecl *D); void PrintStats() {} }; diff --git a/CodeGen/ModuleBuilder.cpp b/CodeGen/ModuleBuilder.cpp index e525514df5..4a5a470563 100644 --- a/CodeGen/ModuleBuilder.cpp +++ b/CodeGen/ModuleBuilder.cpp @@ -34,7 +34,7 @@ void clang::CodeGen::CodeGenFunction(BuilderTy *B, FunctionDecl *D) { /// CodeGenGlobalVar - Emit the specified global variable to LLVM. void clang::CodeGen::CodeGenGlobalVar(BuilderTy *Builder, FileVarDecl *D) { - static_cast(Builder)->EmitGlobalVar(D); + static_cast(Builder)->EmitGlobalVarDeclarator(D); }