r316127 - [Driver] Fix use after free in Hexagon toolchain code.
Benjamin Kramer via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 18 14:43:42 PDT 2017
Author: d0k
Date: Wed Oct 18 14:43:42 2017
New Revision: 316127
URL: http://llvm.org/viewvc/llvm-project?rev=316127&view=rev
Log:
[Driver] Fix use after free in Hexagon toolchain code.
No functionality change intended.
Modified:
cfe/trunk/lib/Driver/ToolChains/Hexagon.cpp
Modified: cfe/trunk/lib/Driver/ToolChains/Hexagon.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Hexagon.cpp?rev=316127&r1=316126&r2=316127&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains/Hexagon.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Hexagon.cpp Wed Oct 18 14:43:42 2017
@@ -28,8 +28,8 @@ using namespace clang;
using namespace llvm::opt;
// Default hvx-length for various versions.
-static std::string getDefaultHvxLength(const StringRef &Cpu) {
- return llvm::StringSwitch<std::string>(Cpu)
+static StringRef getDefaultHvxLength(StringRef Cpu) {
+ return llvm::StringSwitch<StringRef>(Cpu)
.Case("v60", "64b")
.Case("v62", "64b")
.Default("128b");
@@ -93,7 +93,7 @@ static void handleHVXTargetFeatures(cons
}
// Default hvx-length based on Cpu.
else if (HasHVX)
- HVXLength = StringRef(getDefaultHvxLength(Cpu));
+ HVXLength = getDefaultHvxLength(Cpu);
if (!HVXLength.empty()) {
HVXFeature =
More information about the cfe-commits
mailing list