[dragonegg] r174820 - Extract the name once rather than many times.
Duncan Sands
baldrick at free.fr
Sat Feb 9 13:38:38 PST 2013
Author: baldrick
Date: Sat Feb 9 15:38:38 2013
New Revision: 174820
URL: http://llvm.org/viewvc/llvm-project?rev=174820&view=rev
Log:
Extract the name once rather than many times.
Modified:
dragonegg/trunk/src/Backend.cpp
Modified: dragonegg/trunk/src/Backend.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Backend.cpp?rev=174820&r1=174819&r2=174820&view=diff
==============================================================================
--- dragonegg/trunk/src/Backend.cpp (original)
+++ dragonegg/trunk/src/Backend.cpp Sat Feb 9 15:38:38 2013
@@ -902,11 +902,12 @@ static void emit_alias(tree decl, tree t
GlobalValue *Aliasee = 0;
if (isa<IDENTIFIER_NODE>(target)) {
+ StringRef AliaseeName(IDENTIFIER_POINTER(target), IDENTIFIER_LENGTH(target));
if (!lookup_attribute("weakref", DECL_ATTRIBUTES(decl))) {
- Aliasee = TheModule->getNamedValue(IDENTIFIER_POINTER(target));
+ Aliasee = TheModule->getNamedValue(AliaseeName);
if (!Aliasee || Aliasee->hasLocalLinkage()) {
error("%q+D aliased to undefined symbol %qs", decl,
- IDENTIFIER_POINTER(target));
+ AliaseeName.str().c_str());
return;
}
} else {
@@ -915,11 +916,11 @@ static void emit_alias(tree decl, tree t
Aliasee = new GlobalVariable(
*TheModule, GV->getType()->getElementType(),
GV->isConstant(), GlobalVariable::ExternalWeakLinkage,
- NULL, IDENTIFIER_POINTER(target));
+ NULL, AliaseeName);
else if (Function *F = dyn_cast<Function>(V))
Aliasee = Function::Create(F->getFunctionType(),
Function::ExternalWeakLinkage,
- IDENTIFIER_POINTER(target), TheModule);
+ AliaseeName, TheModule);
else
llvm_unreachable("Unsuported global value");
}
More information about the llvm-commits
mailing list