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 | 5bcbd73c38e2413e16465219bbdff0fb992d68a0 (patch) | |
| tree | fec21fa3fe65b94e3656ab213c5e68074a0372c7 /llvm/lib/AsmParser | |
| parent | 4d8a3a173ff7dc362ade93eab926ef14e68eb829 (diff) | |
| download | bcm5719-llvm-5bcbd73c38e2413e16465219bbdff0fb992d68a0.tar.gz bcm5719-llvm-5bcbd73c38e2413e16465219bbdff0fb992d68a0.zip | |
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.
llvm-svn: 133050
Diffstat (limited to 'llvm/lib/AsmParser')
| -rw-r--r-- | llvm/lib/AsmParser/LLLexer.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/AsmParser/LLLexer.cpp b/llvm/lib/AsmParser/LLLexer.cpp index 014e81602d6..a363a653b21 100644 --- a/llvm/lib/AsmParser/LLLexer.cpp +++ b/llvm/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; |

