From e8453b0d883fc95c3d80bd8ba835e9dd69c1a163 Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Sun, 17 Jan 2016 08:47:02 +0000 Subject: [PATCH] [TableGen] Use a StringRef instead of creating a new std::string. It gets passed to a function that takes a StringRef anyway. NFC llvm-svn: 258007 --- llvm/utils/TableGen/AsmWriterInst.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/llvm/utils/TableGen/AsmWriterInst.cpp b/llvm/utils/TableGen/AsmWriterInst.cpp index 7d0cdf47de9f..f83b632cfd8f 100644 --- a/llvm/utils/TableGen/AsmWriterInst.cpp +++ b/llvm/utils/TableGen/AsmWriterInst.cpp @@ -120,8 +120,7 @@ AsmWriterInst::AsmWriterInst(const CodeGenInstruction &CGI, unsigned CGIIndex, while (VarEnd < AsmString.size() && isIdentChar(AsmString[VarEnd])) ++VarEnd; - std::string VarName(AsmString.begin()+DollarPos+1, - AsmString.begin()+VarEnd); + StringRef VarName(AsmString.data()+DollarPos+1, VarEnd-DollarPos-1); // Modifier - Support ${foo:modifier} syntax, where "modifier" is passed // into printOperand. Also support ${:feature}, which is passed into @@ -143,7 +142,7 @@ AsmWriterInst::AsmWriterInst(const CodeGenInstruction &CGI, unsigned CGIIndex, PrintFatalError("Reached end of string before terminating curly brace in '" + CGI.TheDef->getName() + "'"); - unsigned ModifierStart = VarEnd; + std::string::size_type ModifierStart = VarEnd; while (VarEnd < AsmString.size() && isIdentChar(AsmString[VarEnd])) ++VarEnd; Modifier = std::string(AsmString.begin()+ModifierStart,