From: Eric Christopher Date: Tue, 20 Sep 2016 16:05:02 +0000 (+0000) Subject: Remove more guts of TargetMachine::getNameWithPrefix and migrate one check to the... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=663e1b0cfc2fd7f25a05206c605014801b8c9738;p=llvm Remove more guts of TargetMachine::getNameWithPrefix and migrate one check to the TLOF mach-o version. NFC intended. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281983 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/lib/CodeGen/TargetLoweringObjectFileImpl.cpp index b92ffde2319..218b45c9e74 100644 --- a/lib/CodeGen/TargetLoweringObjectFileImpl.cpp +++ b/lib/CodeGen/TargetLoweringObjectFileImpl.cpp @@ -812,6 +812,13 @@ static bool canUsePrivateLabel(const MCAsmInfo &AsmInfo, void TargetLoweringObjectFileMachO::getNameWithPrefix( SmallVectorImpl &OutName, const GlobalValue *GV, const TargetMachine &TM) const { + if (!GV->hasPrivateLinkage()) { + // Simple case: If GV is not private, it is not important to find out if + // private labels are legal in this case or not. + getMangler().getNameWithPrefix(OutName, GV, false); + return; + } + SectionKind GVKind = TargetLoweringObjectFile::getKindForGlobal(GV, TM); const MCSection *TheSection = SectionForGlobal(GV, GVKind, TM); bool CannotUsePrivateLabel = diff --git a/lib/Target/TargetMachine.cpp b/lib/Target/TargetMachine.cpp index 47c5a56ce09..aa1916bb2eb 100644 --- a/lib/Target/TargetMachine.cpp +++ b/lib/Target/TargetMachine.cpp @@ -200,14 +200,7 @@ TargetIRAnalysis TargetMachine::getTargetIRAnalysis() { void TargetMachine::getNameWithPrefix(SmallVectorImpl &Name, const GlobalValue *GV, Mangler &Mang) const { - if (!GV->hasPrivateLinkage()) { - // Simple case: If GV is not private, it is not important to find out if - // private labels are legal in this case or not. - Mang.getNameWithPrefix(Name, GV, false); - return; - } - const TargetLoweringObjectFile *TLOF = getObjFileLowering(); - TLOF->getNameWithPrefix(Name, GV, *this); + getObjFileLowering()->getNameWithPrefix(Name, GV, *this); } MCSymbol *TargetMachine::getSymbol(const GlobalValue *GV, Mangler &Mang) const {