diff options
| author | Sriraman Tallam <tmsriram@google.com> | 2021-03-11 20:05:37 -0800 |
|---|---|---|
| committer | Sriraman Tallam <tmsriram@google.com> | 2021-03-11 20:59:30 -0800 |
| commit | cdb42a4cc4239c0b592fc82021c945ce02ebe5cc (patch) | |
| tree | 29240d8c2eae67f1cf6c56b83f3efbc78e015d33 /clang/lib/CodeGen/CodeGenModule.cpp | |
| parent | fafbdfe63bb0a24c39268c02778eccef71fb1d76 (diff) | |
Disable unique linkage suffixes ifor global vars until demanglers can be fixed.
D96109 added support for unique internal linkage names for both internal
linkage functions and global variables. There was a lot of discussion on how to
get the demangling right for functions but I completely missed the point that
demanglers do not support suffixes for global vars. For example:
$ c++filt _ZL3foo
foo
$ c++filt _ZL3foo.uniq.123
_ZL3foo.uniq.123
The demangling for functions works as expected.
I am not sure of the impact of this. I don't understand how debuggers and other
tools depend on the correctness of global variable demangling so I am
pre-emptively disabling it until we can get the demangling support added.
Importantly, uniquefying global variables is not needed right now as we do not
do profile attribution to global vars based on sampling. It was added for
completeness and so this feature is not exactly missed.
Differential Revision: https://reviews.llvm.org/D98392
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
| -rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 4bf339786d42..250946bd56dd 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -1175,18 +1175,13 @@ static void AppendTargetMangling(const CodeGenModule &CGM, } } -// Returns true if GD is a function/var decl with internal linkage and +// Returns true if GD is a function decl with internal linkage and // needs a unique suffix after the mangled name. static bool isUniqueInternalLinkageDecl(GlobalDecl GD, CodeGenModule &CGM) { const Decl *D = GD.getDecl(); - if (!CGM.getModuleNameHash().empty() && - ((isa<FunctionDecl>(D) && - CGM.getFunctionLinkage(GD) == llvm::GlobalValue::InternalLinkage) || - (isa<VarDecl>(D) && CGM.getContext().GetGVALinkageForVariable( - cast<VarDecl>(D)) == GVA_Internal))) - return true; - return false; + return !CGM.getModuleNameHash().empty() && isa<FunctionDecl>(D) && + (CGM.getFunctionLinkage(GD) == llvm::GlobalValue::InternalLinkage); } static std::string getMangledNameImpl(CodeGenModule &CGM, GlobalDecl GD, |
