diff options
author | Nick Lewycky <nicholas@mxc.ca> | 2011-06-15 06:37:58 +0000 |
---|---|---|
committer | Nick Lewycky <nicholas@mxc.ca> | 2011-06-15 06:37:58 +0000 |
commit | 9100a78bce4e1d34d8ffd5efa2cc79ed864dd1c0 (patch) | |
tree | cdc744ac8a554e94e7e133a0d4aa4ba96f750052 /lib/AsmParser/LLLexer.cpp | |
parent | 7a10ab7d6f50b59580cc8ab1eb52d562e81f28d8 (diff) | |
download | external_llvm-9100a78bce4e1d34d8ffd5efa2cc79ed864dd1c0.zip external_llvm-9100a78bce4e1d34d8ffd5efa2cc79ed864dd1c0.tar.gz external_llvm-9100a78bce4e1d34d8ffd5efa2cc79ed864dd1c0.tar.bz2 |
Teach the .ll parser to handle named metadata with non-simple names.
Unfortunately we can't follow what the rest of the language does (wrapping it
in double-quotes) because that would cause an ambiguity with metadata strings,
so instead we escape any unusual characters with \xx escaping.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133050 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AsmParser/LLLexer.cpp')
-rw-r--r-- | lib/AsmParser/LLLexer.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/AsmParser/LLLexer.cpp b/lib/AsmParser/LLLexer.cpp index 014e816..a363a65 100644 --- a/lib/AsmParser/LLLexer.cpp +++ b/lib/AsmParser/LLLexer.cpp @@ -422,13 +422,15 @@ static bool JustWhitespaceNewLine(const char *&Ptr) { /// ! lltok::Kind LLLexer::LexExclaim() { // Lex a metadata name as a MetadataVar. - if (isalpha(CurPtr[0])) { + if (isalpha(CurPtr[0]) || CurPtr[0] == '-' || CurPtr[0] == '$' || + CurPtr[0] == '.' || CurPtr[0] == '_' || CurPtr[0] == '\\') { ++CurPtr; while (isalnum(CurPtr[0]) || CurPtr[0] == '-' || CurPtr[0] == '$' || - CurPtr[0] == '.' || CurPtr[0] == '_') + CurPtr[0] == '.' || CurPtr[0] == '_' || CurPtr[0] == '\\') ++CurPtr; StrVal.assign(TokStart+1, CurPtr); // Skip ! + UnEscapeLexed(StrVal); return lltok::MetadataVar; } return lltok::exclaim; |