diff options
author | Chris Lattner <sabre@nondot.org> | 2009-01-05 18:34:07 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-01-05 18:34:07 +0000 |
commit | dfd19ddcfa7568d2118fbc3c6da612295200c31c (patch) | |
tree | 9eb07fac8c02a501dbdfdbe61d9456ac51d45689 /lib/AsmParser | |
parent | 68afdc3ab08975569e59cc8c04c2db9e9478a996 (diff) | |
download | external_llvm-dfd19ddcfa7568d2118fbc3c6da612295200c31c.zip external_llvm-dfd19ddcfa7568d2118fbc3c6da612295200c31c.tar.gz external_llvm-dfd19ddcfa7568d2118fbc3c6da612295200c31c.tar.bz2 |
Reject PR3281:accepted03.ll with:
llvm-as: accepted03.ll:1:35: invalid unresolved type up reference
declare void @r({ \7, opaque, \10 } %su)
^
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61725 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AsmParser')
-rw-r--r-- | lib/AsmParser/LLParser.cpp | 15 | ||||
-rw-r--r-- | lib/AsmParser/LLParser.h | 2 |
2 files changed, 11 insertions, 6 deletions
diff --git a/lib/AsmParser/LLParser.cpp b/lib/AsmParser/LLParser.cpp index a9f8e19..0708b79 100644 --- a/lib/AsmParser/LLParser.cpp +++ b/lib/AsmParser/LLParser.cpp @@ -1075,15 +1075,17 @@ bool LLParser::ParseParameterList(SmallVectorImpl<ParamInfo> &ArgList, -/// ParseArgumentList +/// ParseArgumentList - Parse the argument list for a function type or function +/// prototype. If 'inType' is true then we are parsing a FunctionType. /// ::= '(' ArgTypeListI ')' /// ArgTypeListI /// ::= /*empty*/ /// ::= '...' /// ::= ArgTypeList ',' '...' /// ::= ArgType (',' ArgType)* +/// bool LLParser::ParseArgumentList(std::vector<ArgInfo> &ArgList, - bool &isVarArg) { + bool &isVarArg, bool inType) { isVarArg = false; assert(Lex.getKind() == lltok::lparen); Lex.Lex(); // eat the (. @@ -1099,7 +1101,10 @@ bool LLParser::ParseArgumentList(std::vector<ArgInfo> &ArgList, unsigned Attrs; std::string Name; - if (ParseTypeRec(ArgTy) || + // If we're parsing a type, use ParseTypeRec, because we allow recursive + // types (such as a function returning a pointer to itself). If parsing a + // function prototype, we require fully resolved types. + if ((inType ? ParseTypeRec(ArgTy) : ParseType(ArgTy)) || ParseOptionalAttrs(Attrs, 0)) return true; if (Lex.getKind() == lltok::LocalVar || @@ -1154,7 +1159,7 @@ bool LLParser::ParseFunctionType(PATypeHolder &Result) { std::vector<ArgInfo> ArgList; bool isVarArg; unsigned Attrs; - if (ParseArgumentList(ArgList, isVarArg) || + if (ParseArgumentList(ArgList, isVarArg, true) || // FIXME: Allow, but ignore attributes on function types! // FIXME: Remove in LLVM 3.0 ParseOptionalAttrs(Attrs, 2)) @@ -2087,7 +2092,7 @@ bool LLParser::ParseFunctionHeader(Function *&Fn, bool isDefine) { unsigned Alignment; std::string GC; - if (ParseArgumentList(ArgList, isVarArg) || + if (ParseArgumentList(ArgList, isVarArg, false) || ParseOptionalAttrs(FuncAttrs, 2) || (EatIfPresent(lltok::kw_section) && ParseStringConstant(Section)) || diff --git a/lib/AsmParser/LLParser.h b/lib/AsmParser/LLParser.h index f2c3187..f013c63 100644 --- a/lib/AsmParser/LLParser.h +++ b/lib/AsmParser/LLParser.h @@ -232,7 +232,7 @@ namespace llvm { : Loc(L), Type(Ty), Attrs(Attr), Name(N) {} }; bool ParseArgumentList(std::vector<ArgInfo> &ArgList, - bool &isVarArg); + bool &isVarArg, bool inType); bool ParseFunctionHeader(Function *&Fn, bool isDefine); bool ParseFunctionBody(Function &Fn); bool ParseBasicBlock(PerFunctionState &PFS); |