[lld] r218088 - Fixes wrong Twine uses in FileNode::errStr() and in LayoutPass.cpp

Rui Ueyama ruiu at google.com
Thu Sep 18 16:21:39 PDT 2014


Author: ruiu
Date: Thu Sep 18 18:21:39 2014
New Revision: 218088

URL: http://llvm.org/viewvc/llvm-project?rev=218088&view=rev
Log:
Fixes wrong Twine uses in FileNode::errStr() and in LayoutPass.cpp

Patch from Rafael Auler!

Modified:
    lld/trunk/include/lld/Core/InputGraph.h
    lld/trunk/lib/Passes/LayoutPass.cpp

Modified: lld/trunk/include/lld/Core/InputGraph.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/InputGraph.h?rev=218088&r1=218087&r2=218088&view=diff
==============================================================================
--- lld/trunk/include/lld/Core/InputGraph.h (original)
+++ lld/trunk/include/lld/Core/InputGraph.h Thu Sep 18 18:21:39 2014
@@ -242,8 +242,7 @@ public:
   /// \brief create an error string for printing purposes
   virtual std::string errStr(std::error_code errc) {
     std::string msg = errc.message();
-    Twine twine = Twine("Cannot open ") + _path + ": " + msg;
-    return twine.str();
+    return (Twine("Cannot open ") + _path + ": " + msg).str();
   }
 
   /// \brief Get the list of files

Modified: lld/trunk/lib/Passes/LayoutPass.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Passes/LayoutPass.cpp?rev=218088&r1=218087&r2=218088&view=diff
==============================================================================
--- lld/trunk/lib/Passes/LayoutPass.cpp (original)
+++ lld/trunk/lib/Passes/LayoutPass.cpp Thu Sep 18 18:21:39 2014
@@ -26,9 +26,8 @@ static bool compareAtoms(const LayoutPas
 #ifndef NDEBUG
 // Return "reason (leftval, rightval)"
 static std::string formatReason(StringRef reason, int leftVal, int rightVal) {
-  Twine msg =
-      Twine(reason) + " (" + Twine(leftVal) + ", " + Twine(rightVal) + ")";
-  return msg.str();
+  return (Twine(reason) + " (" + Twine(leftVal) + ", " + Twine(rightVal) + ")")
+      .str();
 }
 
 // Less-than relationship of two atoms must be transitive, which is, if a < b
@@ -107,17 +106,19 @@ static void checkReachabilityFromRoot(At
   if (!atom) return;
   auto i = followOnRoots.find(atom);
   if (i == followOnRoots.end()) {
-    Twine msg(Twine("Atom <") + atomToDebugString(atom)
-              + "> has no follow-on root!");
-    llvm_unreachable(msg.str().c_str());
+    llvm_unreachable(((Twine("Atom <") + atomToDebugString(atom) +
+                       "> has no follow-on root!"))
+                         .str()
+                         .c_str());
   }
   const DefinedAtom *ap = i->second;
   while (true) {
     const DefinedAtom *next = followOnRoots[ap];
     if (!next) {
-      Twine msg(Twine("Atom <" + atomToDebugString(atom)
-                      + "> is not reachable from its root!"));
-      llvm_unreachable(msg.str().c_str());
+      llvm_unreachable((Twine("Atom <" + atomToDebugString(atom) +
+                              "> is not reachable from its root!"))
+                           .str()
+                           .c_str());
     }
     if (next == ap)
       return;





More information about the llvm-commits mailing list