eandrews added inline comments.

Comment at: lib/CodeGen/CodeGenModule.cpp:2434
+    // Emit section information for extern variables.
+    if (D->hasExternalStorage() && !D->isThisDeclarationADefinition()) {
+      if (const SectionAttr *SA = D->getAttr<SectionAttr>())
efriedma wrote:
> Why do you specifically check "D->hasExternalStorage() && 
> !D->isThisDeclarationADefinition()", instead of just setting the section 
> unconditionally?
I noticed that you enter GetOrCreateLLVMGlobal( ) whenever the extern variable 
is declared as well as when it is defined. The flow of the program is different 
in each case. When the variable is defined, it also enters 
EmitGlobalVarDefinition( ). There is existing code handling section information 
here. I added the check in GetOrCreateLLVMGlobal( ) so the block gets skipped 
for variable definition, since its already handled elsewhere.


cfe-commits mailing list

Reply via email to