aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/AsmParser/LLParser.cpp
diff options
context:
space:
mode:
authorTeresa Johnson <tejohnson@google.com>2016-03-30 18:15:08 +0000
committerTeresa Johnson <tejohnson@google.com>2016-03-30 18:15:08 +0000
commit83c517c44eb3087b284ee73c49decb7aaf38e273 (patch)
tree057d5dfded82a215d44efe9296e81b6d4f4bf731 /llvm/lib/AsmParser/LLParser.cpp
parenta7c5e1922dd290336849cb59377b92150e700331 (diff)
downloadllvm-83c517c44eb3087b284ee73c49decb7aaf38e273.zip
llvm-83c517c44eb3087b284ee73c49decb7aaf38e273.tar.gz
llvm-83c517c44eb3087b284ee73c49decb7aaf38e273.tar.bz2
Restore "[ThinLTO] Serialize the Module SourceFileName to/from LLVM assembly"
This restores commit 264869, with a fix for windows bots to properly escape '\' in the path when serializing out. Added test. llvm-svn: 264884
Diffstat (limited to 'llvm/lib/AsmParser/LLParser.cpp')
-rw-r--r--llvm/lib/AsmParser/LLParser.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp
index 76bd99e..39c6135 100644
--- a/llvm/lib/AsmParser/LLParser.cpp
+++ b/llvm/lib/AsmParser/LLParser.cpp
@@ -239,6 +239,10 @@ bool LLParser::ParseTopLevelEntities() {
case lltok::kw_define: if (ParseDefine()) return true; break;
case lltok::kw_module: if (ParseModuleAsm()) return true; break;
case lltok::kw_target: if (ParseTargetDefinition()) return true; break;
+ case lltok::kw_source_filename:
+ if (ParseSourceFileName())
+ return true;
+ break;
case lltok::kw_deplibs: if (ParseDepLibs()) return true; break;
case lltok::LocalVarID: if (ParseUnnamedType()) return true; break;
case lltok::LocalVar: if (ParseNamedType()) return true; break;
@@ -336,6 +340,19 @@ bool LLParser::ParseTargetDefinition() {
}
/// toplevelentity
+/// ::= 'source_filename' '=' STRINGCONSTANT
+bool LLParser::ParseSourceFileName() {
+ assert(Lex.getKind() == lltok::kw_source_filename);
+ std::string Str;
+ Lex.Lex();
+ if (ParseToken(lltok::equal, "expected '=' after source_filename") ||
+ ParseStringConstant(Str))
+ return true;
+ M->setSourceFileName(Str);
+ return false;
+}
+
+/// toplevelentity
/// ::= 'deplibs' '=' '[' ']'
/// ::= 'deplibs' '=' '[' STRINGCONSTANT (',' STRINGCONSTANT)* ']'
/// FIXME: Remove in 4.0. Currently parse, but ignore.