[clang][CodeGen] Fix global variables initialized with an inheriting constructor.
For inheriting constructors which have to be emitted inline, we use CodeGenFunction::EmitInlinedInheritingCXXConstructorCall to emit the required code. This code uses EmitParmDecl to emit the "this" argument of the call. EmitParmDecl then helpfully calls llvm::Value::setName to name the parameter... which renames the global variable to "this". To fix the issue, skip the setName call on globals. The renaming still has slightly weird results in other cases (it renames all local variables initialized with an inlined inheriting constructor to "this"), but the result isn't actually wrong in those cases, so I'm just going to leave it for now. Fixes https://github.com/llvm/llvm-project/issues/63618 Differential Revision: https://reviews.llvm.org/D154270
Loading
Please sign in to comment