[llvm] r309092 - Follow up for r307085: a better fix for a dangling StringRef.
Alexander Kornienko via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 26 03:14:55 PDT 2017
Author: alexfh
Date: Wed Jul 26 03:14:55 2017
New Revision: 309092
URL: http://llvm.org/viewvc/llvm-project?rev=309092&view=rev
Log:
Follow up for r307085: a better fix for a dangling StringRef.
Modified:
llvm/trunk/tools/llvm-readobj/COFFDumper.cpp
Modified: llvm/trunk/tools/llvm-readobj/COFFDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/COFFDumper.cpp?rev=309092&r1=309091&r2=309092&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-readobj/COFFDumper.cpp (original)
+++ llvm/trunk/tools/llvm-readobj/COFFDumper.cpp Wed Jul 26 03:14:55 2017
@@ -1627,7 +1627,7 @@ void COFFDumper::printCOFFDirectives() {
}
}
-static StringRef getBaseRelocTypeName(uint8_t Type) {
+static std::string getBaseRelocTypeName(uint8_t Type) {
switch (Type) {
case COFF::IMAGE_REL_BASED_ABSOLUTE: return "ABSOLUTE";
case COFF::IMAGE_REL_BASED_HIGH: return "HIGH";
@@ -1636,11 +1636,7 @@ static StringRef getBaseRelocTypeName(ui
case COFF::IMAGE_REL_BASED_HIGHADJ: return "HIGHADJ";
case COFF::IMAGE_REL_BASED_ARM_MOV32T: return "ARM_MOV32(T)";
case COFF::IMAGE_REL_BASED_DIR64: return "DIR64";
- default: {
- static std::string Result;
- Result = "unknown (" + llvm::utostr(Type) + ")";
- return Result;
- }
+ default: return "unknown (" + llvm::utostr(Type) + ")";
}
}
More information about the llvm-commits
mailing list