[PATCH] D54055: CGDecl::emitStoresForConstant fix synthesized constant's name
    JF Bastien via Phabricator via cfe-commits 
    cfe-commits at lists.llvm.org
       
    Wed Nov 14 13:15:40 PST 2018
    
    
  
jfb marked an inline comment as done.
jfb added inline comments.
================
Comment at: lib/CodeGen/CGDecl.cpp:990-998
+  std::string Name = ("__const." + FunctionName(D.getParentFunctionOrMethod()) +
+                      "." + D.getName())
+                         .str();
+  llvm::GlobalVariable *InsertBefore = nullptr;
+  unsigned AS = CGM.getContext().getTargetAddressSpace(
+      CGM.getStringLiteralAddressSpace());
+  llvm::GlobalVariable *GV = new llvm::GlobalVariable(
----------------
dexonsmith wrote:
> Can you just kill `Name` entirely, throwing this inline, to avoid the malloc?
Sure. It seems less readable, but since the function is already factored out it's not that bad.
Repository:
  rC Clang
https://reviews.llvm.org/D54055
    
    
More information about the cfe-commits
mailing list