r214792 - Remove separator parameter from static local naming code

Reid Kleckner reid at kleckner.net
Mon Aug 4 15:35:30 PDT 2014


Author: rnk
Date: Mon Aug  4 17:35:30 2014
New Revision: 214792

URL: http://llvm.org/viewvc/llvm-project?rev=214792&view=rev
Log:
Remove separator parameter from static local naming code

It was always set to ".", which was duplicated in a few places.

Modified:
    cfe/trunk/lib/CodeGen/CGDecl.cpp
    cfe/trunk/lib/CodeGen/CodeGenFunction.h

Modified: cfe/trunk/lib/CodeGen/CGDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDecl.cpp?rev=214792&r1=214791&r2=214792&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDecl.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDecl.cpp Mon Aug  4 17:35:30 2014
@@ -146,8 +146,7 @@ void CodeGenFunction::EmitVarDecl(const
   return EmitAutoVarDecl(D);
 }
 
-static std::string GetStaticDeclName(CodeGenFunction &CGF, const VarDecl &D,
-                                     const char *Separator) {
+static std::string GetStaticDeclName(CodeGenFunction &CGF, const VarDecl &D) {
   CodeGenModule &CGM = CGF.CGM;
 
   if (CGF.getLangOpts().CPlusPlus)
@@ -169,12 +168,11 @@ static std::string GetStaticDeclName(Cod
   else
     llvm_unreachable("Unknown context for static var decl");
 
-  return ContextName.str() + Separator + D.getNameAsString();
+  return ContextName.str() + "." + D.getNameAsString();
 }
 
 llvm::Constant *
 CodeGenFunction::CreateStaticVarDecl(const VarDecl &D,
-                                     const char *Separator,
                                      llvm::GlobalValue::LinkageTypes Linkage) {
   QualType Ty = D.getType();
   assert(Ty->isConstantSizeType() && "VLAs can't be static");
@@ -184,7 +182,7 @@ CodeGenFunction::CreateStaticVarDecl(con
   if (D.hasAttr<AsmLabelAttr>())
     Name = CGM.getMangledName(&D);
   else
-    Name = GetStaticDeclName(*this, D, Separator);
+    Name = GetStaticDeclName(*this, D);
 
   llvm::Type *LTy = CGM.getTypes().ConvertTypeForMem(Ty);
   unsigned AddrSpace =
@@ -302,7 +300,7 @@ void CodeGenFunction::EmitStaticVarDecl(
     CGM.getStaticLocalDeclAddress(&D);
 
   if (!addr)
-    addr = CreateStaticVarDecl(D, ".", Linkage);
+    addr = CreateStaticVarDecl(D, Linkage);
 
   // Store into LocalDeclMap before generating initializer to handle
   // circular references.
@@ -1129,7 +1127,7 @@ void CodeGenFunction::EmitAutoVarInit(co
   } else {
     // Otherwise, create a temporary global with the initializer then
     // memcpy from the global to the alloca.
-    std::string Name = GetStaticDeclName(*this, D, ".");
+    std::string Name = GetStaticDeclName(*this, D);
     llvm::GlobalVariable *GV =
       new llvm::GlobalVariable(CGM.getModule(), constant->getType(), true,
                                llvm::GlobalValue::PrivateLinkage,

Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.h?rev=214792&r1=214791&r2=214792&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenFunction.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.h Mon Aug  4 17:35:30 2014
@@ -2425,7 +2425,6 @@ public:
   /// CreateStaticVarDecl - Create a zero-initialized LLVM global for
   /// a static local variable.
   llvm::Constant *CreateStaticVarDecl(const VarDecl &D,
-                                      const char *Separator,
                                       llvm::GlobalValue::LinkageTypes Linkage);
 
   /// AddInitializerToStaticVarDecl - Add the initializer for 'D' to the





More information about the cfe-commits mailing list