diff options
author | Craig Topper <craig.topper@intel.com> | 2018-09-25 20:13:55 +0000 |
---|---|---|
committer | Craig Topper <craig.topper@intel.com> | 2018-09-25 20:13:55 +0000 |
commit | d2aab83fa6ff3b5b3de7212456a32eb54dce7354 (patch) | |
tree | 5c661c6eb2e89c2c7fc68e25a1a7148949534c4c /llvm/lib | |
parent | 321d5d4802d4247d3c03a4f18d42ba0dbba41f27 (diff) | |
download | bcm5719-llvm-d2aab83fa6ff3b5b3de7212456a32eb54dce7354.tar.gz bcm5719-llvm-d2aab83fa6ff3b5b3de7212456a32eb54dce7354.zip |
[MC] Return a std::string instead of taking it as an out parameter. Make two parser methods into static functions at file scope. NFC
llvm-svn: 343020
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/MC/MCParser/AsmParser.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/llvm/lib/MC/MCParser/AsmParser.cpp b/llvm/lib/MC/MCParser/AsmParser.cpp index 25bd480eedb..df4e2333d1d 100644 --- a/llvm/lib/MC/MCParser/AsmParser.cpp +++ b/llvm/lib/MC/MCParser/AsmParser.cpp @@ -260,8 +260,6 @@ public: /// } private: - bool isAltmacroString(SMLoc &StrLoc, SMLoc &EndLoc); - void altMacroString(StringRef AltMacroStr, std::string &Res); bool parseStatement(ParseStatementInfo &Info, MCAsmParserSemaCallback *SI); bool parseCurlyBlockScope(SmallVectorImpl<AsmRewrite>& AsmStrRewrites); @@ -1327,7 +1325,7 @@ AsmParser::applyModifierToExpr(const MCExpr *E, /// implementation. GCC does not fully support this feature and so we will not /// support it. /// TODO: Adding single quote as a string. -bool AsmParser::isAltmacroString(SMLoc &StrLoc, SMLoc &EndLoc) { +static bool isAltmacroString(SMLoc &StrLoc, SMLoc &EndLoc) { assert((StrLoc.getPointer() != nullptr) && "Argument to the function cannot be a NULL value"); const char *CharPtr = StrLoc.getPointer(); @@ -1345,12 +1343,14 @@ bool AsmParser::isAltmacroString(SMLoc &StrLoc, SMLoc &EndLoc) { } /// creating a string without the escape characters '!'. -void AsmParser::altMacroString(StringRef AltMacroStr,std::string &Res) { +static std::string altMacroString(StringRef AltMacroStr) { + std::string Res; for (size_t Pos = 0; Pos < AltMacroStr.size(); Pos++) { if (AltMacroStr[Pos] == '!') Pos++; Res += AltMacroStr[Pos]; } + return Res; } /// Parse an expression and return it. @@ -2452,9 +2452,7 @@ bool AsmParser::expandMacro(raw_svector_ostream &OS, StringRef Body, else if (Lexer.IsaAltMacroMode() && Token.getString().front() == '<' && Token.is(AsmToken::String)) { - std::string Res; - altMacroString(Token.getStringContents(), Res); - OS << Res; + OS << altMacroString(Token.getStringContents()); } // We expect no quotes around the string's contents when // parsing for varargs. |