[PATCH] D13169: [ELF2] - Implemented --allow-multiple-definition flag

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 25 14:05:04 PDT 2015


ruiu added inline comments.

================
Comment at: ELF/SymbolTable.cpp:140-142
@@ -139,3 +139,5 @@
 
-  error(Twine("duplicate symbol: ") + Old.getName() + " in " +
-        OldFile->getName() + " and " + NewFile->getName());
+  const std::string Message = "duplicate symbol: " + Old.getName().str() +
+                              " in " + OldFile->getName().str() + " and " +
+                              NewFile->getName().str();
+  if (Config->AllowMultipleDefinition)
----------------
Usually when we concatenate strings, we use Twine. The new code uses String::operator+ instead, which is less preferred way to do the same thing. This would be better.

  std::string Msg = (Twine("duplicate symbol: ") + Old.getName() + ...).str();

I also dropped "const" since it's obvious (and that use is more consistent with other code in LLD).


http://reviews.llvm.org/D13169





More information about the llvm-commits mailing list