[llvm-commits] CVS: llvm/lib/AsmParser/llvmAsmParser.y

Andrew Lenharth alenhar2 at cs.uiuc.edu
Sat Jun 18 20:54:07 PDT 2005



Changes in directory llvm/lib/AsmParser:

llvmAsmParser.y updated: 1.226 -> 1.227
---
Log message:

add a check for the mixing of vaarg and vanext with va_arg

---
Diffs of the changes:  (+9 -0)

 llvmAsmParser.y |    9 +++++++++
 1 files changed, 9 insertions(+)


Index: llvm/lib/AsmParser/llvmAsmParser.y
diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.226 llvm/lib/AsmParser/llvmAsmParser.y:1.227
--- llvm/lib/AsmParser/llvmAsmParser.y:1.226	Sat Jun 18 13:34:51 2005
+++ llvm/lib/AsmParser/llvmAsmParser.y	Sat Jun 18 22:53:56 2005
@@ -48,6 +48,7 @@
 #define YYERROR_VERBOSE 1
 
 static bool ObsoleteVarArgs;
+static bool NewVarArgs;
 static BasicBlock* CurBB;
 
 
@@ -728,6 +729,7 @@
 
   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 @@
   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 @@
     $$ = new SelectInst($2, $4, $6);
   }
   | VAARG ResolvedVal ',' Types {
+    NewVarArgs = true;
     $$ = new VAArgInst($2, *$4);
     delete $4;
   }






More information about the llvm-commits mailing list