Simplify some uses of Value::getName()
authorDaniel Dunbar <daniel@zuster.org>
Wed, 22 Jul 2009 21:10:12 +0000 (21:10 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Wed, 22 Jul 2009 21:10:12 +0000 (21:10 +0000)
llvm-svn: 76786

llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
llvm/lib/Target/CBackend/CBackend.cpp
llvm/lib/Target/CppBackend/CPPBackend.cpp

index 12d54ae..86d1e16 100644 (file)
@@ -103,8 +103,8 @@ static ExFunc lookupFunction(const Function *F) {
   if (FnPtr == 0)
     FnPtr = FuncNames["lle_X_"+F->getName()];
   if (FnPtr == 0)  // Try calling a generic function... if it exists...
-    FnPtr = (ExFunc)(intptr_t)sys::DynamicLibrary::SearchForAddressOfSymbol(
-            ("lle_X_"+F->getName()).c_str());
+    FnPtr = (ExFunc)(intptr_t)
+      sys::DynamicLibrary::SearchForAddressOfSymbol("lle_X_"+F->getName());
   if (FnPtr != 0)
     ExportedFunctions->insert(std::make_pair(F, FnPtr));  // Cache for later
   return FnPtr;
index 4f0a5a8..d49a023 100644 (file)
@@ -1924,7 +1924,7 @@ bool CWriter::doInitialization(Module &M) {
         Out << " __HIDDEN__";
       
       if (I->hasName() && I->getName()[0] == 1)
-        Out << " LLVM_ASM(\"" << I->getName().c_str()+1 << "\")";
+        Out << " LLVM_ASM(\"" << I->getName().substr(1) << "\")";
           
       Out << ";\n";
     }
index 71af8a9..7c5d09e 100644 (file)
@@ -430,7 +430,10 @@ namespace {
     } else {
       name = getTypePrefix(val->getType());
     }
-    name += (val->hasName() ? val->getName() : utostr(uniqueNum++));
+    if (val->hasName())
+      name += val->getName();
+    else
+      name += utostr(uniqueNum++);
     sanitize(name);
     NameSet::iterator NI = UsedNames.find(name);
     if (NI != UsedNames.end())