From: Craig Topper Date: Wed, 21 Oct 2015 16:31:31 +0000 (+0000) Subject: Use StringRef instead of calling c_str and doing pointer math before eventually creat... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a7c8109d5312ecd8839ff241b848fe29301b808a;p=clang 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 --- diff --git a/lib/Basic/TargetInfo.cpp b/lib/Basic/TargetInfo.cpp index 062b12bc2d..1648a27d8b 100644 --- a/lib/Basic/TargetInfo.cpp +++ b/lib/Basic/TargetInfo.cpp @@ -316,10 +316,10 @@ bool TargetInfo::initFeatureMap( llvm::StringMap &Features, DiagnosticsEngine &Diags, StringRef CPU, const std::vector &FeatureVec) const { for (const auto &F : FeatureVec) { - const char *Name = F.c_str(); + StringRef Name = F; // Apply the feature via the target. bool Enabled = Name[0] == '+'; - setFeatureEnabled(Features, Name + 1, Enabled); + setFeatureEnabled(Features, Name.substr(1), Enabled); } return true; }