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 b610d3e..4bf4b86 100644
--- a/CodeGen/CodeGenModule.cpp
+++ b/CodeGen/CodeGenModule.cpp
@@ -88,6 +88,12 @@
}
}
+/// EmitGlobalVarDeclarator - Emit all the global vars attached to the specified
+/// declarator chain.
+void CodeGenModule::EmitGlobalVarDeclarator(const FileVarDecl *D) {
+ for (; D; D = cast_or_null<FileVarDecl>(D->getNextDeclarator()))
+ EmitGlobalVar(D);
+}
llvm::Function *CodeGenModule::getMemCpyFn() {
if (MemCpyFn) return MemCpyFn;
diff --git a/CodeGen/CodeGenModule.h b/CodeGen/CodeGenModule.h
index 9d85470..fbebdcf 100644
--- a/CodeGen/CodeGenModule.h
+++ b/CodeGen/CodeGenModule.h
@@ -53,6 +53,7 @@
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 e525514..4a5a470 100644
--- a/CodeGen/ModuleBuilder.cpp
+++ b/CodeGen/ModuleBuilder.cpp
@@ -34,7 +34,7 @@
/// CodeGenGlobalVar - Emit the specified global variable to LLVM.
void clang::CodeGen::CodeGenGlobalVar(BuilderTy *Builder, FileVarDecl *D) {
- static_cast<CodeGenModule*>(Builder)->EmitGlobalVar(D);
+ static_cast<CodeGenModule*>(Builder)->EmitGlobalVarDeclarator(D);
}