[PATCH] D54055: CGDecl::emitStoresForConstant fix synthesized constant's name

Duncan P. N. Exon Smith via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 14 12:55:33 PST 2018


dexonsmith 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(
----------------
Can you just kill `Name` entirely, throwing this inline, to avoid the malloc?


Repository:
  rC Clang

https://reviews.llvm.org/D54055





More information about the cfe-commits mailing list