Skip to content
Commit b4bae3fd authored by Eli Friedman's avatar Eli Friedman
Browse files

[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
parent 6954cb54
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment