Remove the isImplicitlyPrivate argument of getNameWithPrefix.

getSymbolWithGlobalValueBase use is to create a name of a new symbol based
on the name of an existing GV. Assert that and then remove the last call
to pass true to isImplicitlyPrivate.

This gives the mangler API a 1:1 mapping from GV to names, which is what we
need to drop the mangler dependency on the target (and use an extended
datalayout instead).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196472 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola
2013-12-05 05:53:12 +00:00
parent 087ab613f4
commit fac7a9e644
8 changed files with 19 additions and 13 deletions

View File

@ -18,6 +18,7 @@
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/GlobalVariable.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCStreamer.h"
@ -102,14 +103,21 @@ static bool IsNullTerminatedString(const Constant *C) {
MCSymbol *TargetLoweringObjectFile::getSymbol(Mangler &M,
const GlobalValue *GV) const {
SmallString<60> NameStr;
M.getNameWithPrefix(NameStr, GV, false);
M.getNameWithPrefix(NameStr, GV);
return Ctx->GetOrCreateSymbol(NameStr.str());
}
MCSymbol *TargetLoweringObjectFile::getSymbolWithGlobalValueBase(
Mangler &M, const GlobalValue *GV, StringRef Suffix) const {
assert(!Suffix.empty());
assert(!GV->hasPrivateLinkage());
assert(!GV->hasLinkerPrivateLinkage());
assert(!GV->hasLinkerPrivateWeakLinkage());
const MCAsmInfo *MAI = Ctx->getAsmInfo();
SmallString<60> NameStr;
M.getNameWithPrefix(NameStr, GV, true);
NameStr += MAI->getPrivateGlobalPrefix();
M.getNameWithPrefix(NameStr, GV);
NameStr.append(Suffix.begin(), Suffix.end());
return Ctx->GetOrCreateSymbol(NameStr.str());
}