Browse Source

Use StringRef instead of calling c_str and doing pointer math before eventually creating a StringRef. NFC

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@250902 91177308-0d34-0410-b5e6-96231b3b80d8
Craig Topper 9 years ago
parent
commit
a7c8109d53
1 changed files with 2 additions and 2 deletions
  1. 2 2
      lib/Basic/TargetInfo.cpp

+ 2 - 2
lib/Basic/TargetInfo.cpp

@@ -316,10 +316,10 @@ bool TargetInfo::initFeatureMap(
     llvm::StringMap<bool> &Features, DiagnosticsEngine &Diags, StringRef CPU,
     llvm::StringMap<bool> &Features, DiagnosticsEngine &Diags, StringRef CPU,
     const std::vector<std::string> &FeatureVec) const {
     const std::vector<std::string> &FeatureVec) const {
   for (const auto &F : FeatureVec) {
   for (const auto &F : FeatureVec) {
-    const char *Name = F.c_str();
+    StringRef Name = F;
     // Apply the feature via the target.
     // Apply the feature via the target.
     bool Enabled = Name[0] == '+';
     bool Enabled = Name[0] == '+';
-    setFeatureEnabled(Features, Name + 1, Enabled);
+    setFeatureEnabled(Features, Name.substr(1), Enabled);
   }
   }
   return true;
   return true;
 }
 }