[PATCH] D154270: [clang][CodeGen] Fix global variables initialized with an inheriting constructor.

Eli Friedman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Jul 2 11:10:06 PDT 2023


efriedma added inline comments.


================
Comment at: clang/lib/CodeGen/CGDecl.cpp:2459
+  if (!isa<llvm::GlobalValue>(Arg.getAnyValue()))
+    Arg.getAnyValue()->setName(D.getName());
 
----------------
rsmith wrote:
> Is it feasible to only set the name if the value doesn't already have a name, or do we give values bad names often enough that it's better to overwrite an existing name here?
Outside the EmitInlinedInheritingCXXConstructorCall case, the arguments are generally either llvm::Argument, or llvm::Instruction generated by calling convention code.  It might make sense to just make the calling convention code name the values itself (it already names some of the values it generates).

But I'll stick with the conservative fix here, and leave that for a followup.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D154270/new/

https://reviews.llvm.org/D154270



More information about the cfe-commits mailing list