summaryrefslogtreecommitdiffstats
path: root/llvm/lib/AsmParser
diff options
context:
space:
mode:
authorAndrew Lenharth <andrewl@lenharth.org>2005-06-19 03:53:56 +0000
committerAndrew Lenharth <andrewl@lenharth.org>2005-06-19 03:53:56 +0000
commitaa1d9996824875972395ce617eb8bf9e0dbab6f3 (patch)
treeb7f028e848360835d1e116910d79404a820d0311 /llvm/lib/AsmParser
parentda180831e4b2f9f27d46a47761431aa6e2994984 (diff)
downloadbcm5719-llvm-aa1d9996824875972395ce617eb8bf9e0dbab6f3.tar.gz
bcm5719-llvm-aa1d9996824875972395ce617eb8bf9e0dbab6f3.zip
add a check for the mixing of vaarg and vanext with va_arg
llvm-svn: 22260
Diffstat (limited to 'llvm/lib/AsmParser')
-rw-r--r--llvm/lib/AsmParser/llvmAsmParser.y9
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/AsmParser/llvmAsmParser.y b/llvm/lib/AsmParser/llvmAsmParser.y
index f59475cd130..46dd988bd34 100644
--- a/llvm/lib/AsmParser/llvmAsmParser.y
+++ b/llvm/lib/AsmParser/llvmAsmParser.y
@@ -48,6 +48,7 @@ static Module *ParserResult;
#define YYERROR_VERBOSE 1
static bool ObsoleteVarArgs;
+static bool NewVarArgs;
static BasicBlock* CurBB;
@@ -728,6 +729,7 @@ static PATypeHolder HandleUpRefs(const Type *ty) {
llvmAsmlineno = 1; // Reset the current line number...
ObsoleteVarArgs = false;
+ NewVarArgs = false;
CurModule.CurrentModule = M;
yyparse(); // Parse the file, potentially throwing exception
@@ -735,6 +737,12 @@ static PATypeHolder HandleUpRefs(const Type *ty) {
Module *Result = ParserResult;
ParserResult = 0;
+ if (ObsoleteVarArgs && NewVarArgs)
+ {
+ std::cerr << "This file is corrupt in that it uses both new and old style varargs\n";
+ abort();
+ }
+
if(ObsoleteVarArgs) {
if(Function* F = Result->getNamedFunction("llvm.va_start")) {
assert(F->arg_size() == 0 && "Obsolete va_start takes 0 argument!");
@@ -2041,6 +2049,7 @@ InstVal : ArithmeticOps Types ValueRef ',' ValueRef {
$$ = new SelectInst($2, $4, $6);
}
| VAARG ResolvedVal ',' Types {
+ NewVarArgs = true;
$$ = new VAArgInst($2, *$4);
delete $4;
}
OpenPOWER on IntegriCloud