[cfe-commits] r106549 - in /cfe/trunk/lib/CodeGen: CGCXX.cpp CGDebugInfo.cpp CGDecl.cpp CodeGenModule.cpp CodeGenModule.h
Anders Carlsson
andersca at mac.com
Tue Jun 22 09:16:50 PDT 2010
Author: andersca
Date: Tue Jun 22 11:16:50 2010
New Revision: 106549
URL: http://llvm.org/viewvc/llvm-project?rev=106549&view=rev
Log:
Switch over to the new caching version of getMangledName.
Modified:
cfe/trunk/lib/CodeGen/CGCXX.cpp
cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
cfe/trunk/lib/CodeGen/CGDecl.cpp
cfe/trunk/lib/CodeGen/CodeGenModule.cpp
cfe/trunk/lib/CodeGen/CodeGenModule.h
Modified: cfe/trunk/lib/CodeGen/CGCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCXX.cpp?rev=106549&r1=106548&r2=106549&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGCXX.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCXX.cpp Tue Jun 22 11:16:50 2010
@@ -166,8 +166,7 @@
new llvm::GlobalAlias(AliasType, Linkage, "", Aliasee, &getModule());
// Switch any previous uses to the alias.
- MangleBuffer MangledName;
- getMangledName(MangledName, AliasDecl);
+ llvm::StringRef MangledName = getMangledName(AliasDecl);
llvm::GlobalValue *Entry = GetGlobalValue(MangledName);
if (Entry) {
assert(Entry->isDeclaration() && "definition already exists for alias");
@@ -177,7 +176,7 @@
Entry->replaceAllUsesWith(Alias);
Entry->eraseFromParent();
} else {
- Alias->setName(MangledName.getString());
+ Alias->setName(MangledName);
}
// Finally, set up the alias with its proper name and attributes.
@@ -220,8 +219,7 @@
CXXCtorType Type) {
GlobalDecl GD(D, Type);
- MangleBuffer Name;
- getMangledName(Name, GD);
+ llvm::StringRef Name = getMangledName(GD);
if (llvm::GlobalValue *V = GetGlobalValue(Name))
return V;
@@ -279,8 +277,7 @@
CXXDtorType Type) {
GlobalDecl GD(D, Type);
- MangleBuffer Name;
- getMangledName(Name, GD);
+ llvm::StringRef Name = getMangledName(GD);
if (llvm::GlobalValue *V = GetGlobalValue(Name))
return V;
Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=106549&r1=106548&r2=106549&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Tue Jun 22 11:16:50 2010
@@ -567,9 +567,9 @@
// Since a single ctor/dtor corresponds to multiple functions, it doesn't
// make sense to give a single ctor/dtor a linkage name.
- MangleBuffer MethodLinkageName;
+ llvm::StringRef MethodLinkageName;
if (!IsCtorOrDtor)
- CGM.getMangledName(MethodLinkageName, Method);
+ MethodLinkageName = CGM.getMangledName(Method);
// Get the location for the method.
llvm::DIFile MethodDefUnit = getOrCreateFile(Method->getLocation());
@@ -1289,7 +1289,7 @@
CGBuilderTy &Builder) {
llvm::StringRef Name;
- MangleBuffer LinkageName;
+ llvm::StringRef LinkageName;
const Decl *D = GD.getDecl();
if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
@@ -1307,11 +1307,11 @@
}
Name = getFunctionName(FD);
// Use mangled name as linkage name for c/c++ functions.
- CGM.getMangledName(LinkageName, GD);
+ LinkageName = CGM.getMangledName(GD);
} else {
// Use llvm function name as linkage name.
Name = Fn->getName();
- LinkageName.setString(Name);
+ LinkageName = Name;
}
if (!Name.empty() && Name[0] == '\01')
Name = Name.substr(1);
Modified: cfe/trunk/lib/CodeGen/CGDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDecl.cpp?rev=106549&r1=106548&r2=106549&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDecl.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDecl.cpp Tue Jun 22 11:16:50 2010
@@ -139,16 +139,14 @@
const char *Separator) {
CodeGenModule &CGM = CGF.CGM;
if (CGF.getContext().getLangOptions().CPlusPlus) {
- MangleBuffer Name;
- CGM.getMangledName(Name, &D);
- return Name.getString().str();
+ llvm::StringRef Name = CGM.getMangledName(&D);
+ return Name.str();
}
std::string ContextName;
if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(CGF.CurFuncDecl)) {
- MangleBuffer Name;
- CGM.getMangledName(Name, FD);
- ContextName = Name.getString().str();
+ llvm::StringRef Name = CGM.getMangledName(FD);
+ ContextName = Name.str();
} else if (isa<ObjCMethodDecl>(CGF.CurFuncDecl))
ContextName = CGF.CurFn->getName();
else
Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=106549&r1=106548&r2=106549&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Tue Jun 22 11:16:50 2010
@@ -245,25 +245,6 @@
return Str;
}
-void CodeGenModule::getMangledName(MangleBuffer &Buffer, GlobalDecl GD) {
- const NamedDecl *ND = cast<NamedDecl>(GD.getDecl());
-
- if (const CXXConstructorDecl *D = dyn_cast<CXXConstructorDecl>(ND))
- return getMangleContext().mangleCXXCtor(D, GD.getCtorType(),
- Buffer.getBuffer());
- if (const CXXDestructorDecl *D = dyn_cast<CXXDestructorDecl>(ND))
- return getMangleContext().mangleCXXDtor(D, GD.getDtorType(),
- Buffer.getBuffer());
-
- if (!getMangleContext().shouldMangleDeclName(ND)) {
- assert(ND->getIdentifier() && "Attempt to mangle unnamed decl.");
- Buffer.setString(ND->getNameAsCString());
- return;
- }
-
- getMangleContext().mangleName(ND, Buffer.getBuffer());
-}
-
void CodeGenModule::getMangledName(MangleBuffer &Buffer, const BlockDecl *BD) {
getMangleContext().mangleBlock(BD, Buffer.getBuffer());
}
@@ -585,8 +566,7 @@
// ignore these cases.
//
// TODO: That said, looking this up multiple times is very wasteful.
- MangleBuffer Name;
- getMangledName(Name, D);
+ llvm::StringRef Name = getMangledName(D);
llvm::GlobalValue *CGRef = GetGlobalValue(Name);
assert(CGRef && "Deferred decl wasn't referenced?");
@@ -807,8 +787,7 @@
// If the value has already been used, add it directly to the
// DeferredDeclsToEmit list.
- MangleBuffer MangledName;
- getMangledName(MangledName, GD);
+ llvm::StringRef MangledName = getMangledName(GD);
if (GetGlobalValue(MangledName))
DeferredDeclsToEmit.push_back(GD);
else {
@@ -948,8 +927,7 @@
// If there was no specific requested type, just convert it now.
if (!Ty)
Ty = getTypes().ConvertType(cast<ValueDecl>(GD.getDecl())->getType());
- MangleBuffer MangledName;
- getMangledName(MangledName, GD);
+ llvm::StringRef MangledName = getMangledName(GD);
return GetOrCreateLLVMFunction(MangledName, Ty, GD);
}
@@ -1052,8 +1030,7 @@
const llvm::PointerType *PTy =
llvm::PointerType::get(Ty, ASTTy.getAddressSpace());
- MangleBuffer MangledName;
- getMangledName(MangledName, D);
+ llvm::StringRef MangledName = getMangledName(D);
return GetOrCreateLLVMGlobal(MangledName, PTy, D);
}
@@ -1072,8 +1049,7 @@
// If we have not seen a reference to this variable yet, place it
// into the deferred declarations table to be emitted if needed
// later.
- MangleBuffer MangledName;
- getMangledName(MangledName, D);
+ llvm::StringRef MangledName = getMangledName(D);
if (!GetGlobalValue(MangledName)) {
DeferredDecls[MangledName] = D;
return;
@@ -1417,8 +1393,7 @@
const AliasAttr *AA = D->getAttr<AliasAttr>();
assert(AA && "Not an alias?");
- MangleBuffer MangledName;
- getMangledName(MangledName, GD);
+ llvm::StringRef MangledName = getMangledName(GD);
// If there is a definition in the module, then it wins over the alias.
// This is dubious, but allow it to be safe. Just ignore the alias.
@@ -1459,7 +1434,7 @@
Entry->getType()));
Entry->eraseFromParent();
} else {
- GA->setName(MangledName.getString());
+ GA->setName(MangledName);
}
// Set attributes which are particular to an alias; this is a
Modified: cfe/trunk/lib/CodeGen/CodeGenModule.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.h?rev=106549&r1=106548&r2=106549&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.h Tue Jun 22 11:16:50 2010
@@ -465,7 +465,6 @@
unsigned &CallingConv);
llvm::StringRef getMangledName(GlobalDecl GD);
- void getMangledName(MangleBuffer &Buffer, GlobalDecl D);
void getMangledName(MangleBuffer &Buffer, const BlockDecl *BD);
void EmitTentativeDefinition(const VarDecl *D);
More information about the cfe-commits
mailing list