diff options
author | Bill Wendling <isanbard@gmail.com> | 2012-11-28 08:41:48 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2012-11-28 08:41:48 +0000 |
commit | 3defc0bfa600cc253f0cba0fe781aa49435d968a (patch) | |
tree | 518884295520bfcff3a0838d8c53c48d85efe9d4 /lib/AsmParser | |
parent | 8b1496c922b6a21296f7d42172df45bf205d5419 (diff) | |
download | external_llvm-3defc0bfa600cc253f0cba0fe781aa49435d968a.zip external_llvm-3defc0bfa600cc253f0cba0fe781aa49435d968a.tar.gz external_llvm-3defc0bfa600cc253f0cba0fe781aa49435d968a.tar.bz2 |
Add back support for reading and parsing 'deplibs'.
This is for backwards compatibility for pre-3.x bc files. The code reads the
code, but does nothing with it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168779 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AsmParser')
-rw-r--r-- | lib/AsmParser/LLLexer.cpp | 1 | ||||
-rw-r--r-- | lib/AsmParser/LLParser.cpp | 23 | ||||
-rw-r--r-- | lib/AsmParser/LLParser.h | 1 | ||||
-rw-r--r-- | lib/AsmParser/LLToken.h | 1 |
4 files changed, 26 insertions, 0 deletions
diff --git a/lib/AsmParser/LLLexer.cpp b/lib/AsmParser/LLLexer.cpp index c498da7..1f772a9 100644 --- a/lib/AsmParser/LLLexer.cpp +++ b/lib/AsmParser/LLLexer.cpp @@ -486,6 +486,7 @@ lltok::Kind LLLexer::LexIdentifier() { KEYWORD(target); KEYWORD(triple); KEYWORD(unwind); + KEYWORD(deplibs); // FIXME: Remove in 4.0. KEYWORD(datalayout); KEYWORD(volatile); KEYWORD(atomic); diff --git a/lib/AsmParser/LLParser.cpp b/lib/AsmParser/LLParser.cpp index 8a9f951..57b67fe 100644 --- a/lib/AsmParser/LLParser.cpp +++ b/lib/AsmParser/LLParser.cpp @@ -168,6 +168,7 @@ 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_deplibs: if (ParseDepLibs()) return true; break; case lltok::LocalVarID: if (ParseUnnamedType()) return true; break; case lltok::LocalVar: if (ParseNamedType()) return true; break; case lltok::GlobalID: if (ParseUnnamedGlobal()) return true; break; @@ -263,6 +264,28 @@ bool LLParser::ParseTargetDefinition() { } } +/// toplevelentity +/// ::= 'deplibs' '=' '[' ']' +/// ::= 'deplibs' '=' '[' STRINGCONSTANT (',' STRINGCONSTANT)* ']' +/// FIXME: Remove in 4.0. Currently parse, but ignore. +bool LLParser::ParseDepLibs() { + assert(Lex.getKind() == lltok::kw_deplibs); + Lex.Lex(); + if (ParseToken(lltok::equal, "expected '=' after deplibs") || + ParseToken(lltok::lsquare, "expected '=' after deplibs")) + return true; + + if (EatIfPresent(lltok::rsquare)) + return false; + + do { + std::string Str; + if (ParseStringConstant(Str)) return true; + } while (EatIfPresent(lltok::comma)); + + return ParseToken(lltok::rsquare, "expected ']' at end of list"); +} + /// ParseUnnamedType: /// ::= LocalVarID '=' 'type' type bool LLParser::ParseUnnamedType() { diff --git a/lib/AsmParser/LLParser.h b/lib/AsmParser/LLParser.h index 5cebd97..e481283 100644 --- a/lib/AsmParser/LLParser.h +++ b/lib/AsmParser/LLParser.h @@ -217,6 +217,7 @@ namespace llvm { bool ValidateEndOfModule(); bool ParseTargetDefinition(); bool ParseModuleAsm(); + bool ParseDepLibs(); // FIXME: Remove in 4.0. bool ParseUnnamedType(); bool ParseNamedType(); bool ParseDeclare(); diff --git a/lib/AsmParser/LLToken.h b/lib/AsmParser/LLToken.h index d102d91..2ed2c22 100644 --- a/lib/AsmParser/LLToken.h +++ b/lib/AsmParser/LLToken.h @@ -54,6 +54,7 @@ namespace lltok { kw_target, kw_triple, kw_unwind, + kw_deplibs, // FIXME: Remove in 4.0 kw_datalayout, kw_volatile, kw_atomic, |