mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-16 00:33:10 +00:00
add a check for the mixing of vaarg and vanext with va_arg
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22260 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
825e6f4d9b
commit
e78f50deea
@ -48,6 +48,7 @@ static Module *ParserResult;
|
|||||||
#define YYERROR_VERBOSE 1
|
#define YYERROR_VERBOSE 1
|
||||||
|
|
||||||
static bool ObsoleteVarArgs;
|
static bool ObsoleteVarArgs;
|
||||||
|
static bool NewVarArgs;
|
||||||
static BasicBlock* CurBB;
|
static BasicBlock* CurBB;
|
||||||
|
|
||||||
|
|
||||||
@ -728,6 +729,7 @@ static PATypeHolder HandleUpRefs(const Type *ty) {
|
|||||||
|
|
||||||
llvmAsmlineno = 1; // Reset the current line number...
|
llvmAsmlineno = 1; // Reset the current line number...
|
||||||
ObsoleteVarArgs = false;
|
ObsoleteVarArgs = false;
|
||||||
|
NewVarArgs = false;
|
||||||
|
|
||||||
CurModule.CurrentModule = M;
|
CurModule.CurrentModule = M;
|
||||||
yyparse(); // Parse the file, potentially throwing exception
|
yyparse(); // Parse the file, potentially throwing exception
|
||||||
@ -735,6 +737,12 @@ static PATypeHolder HandleUpRefs(const Type *ty) {
|
|||||||
Module *Result = ParserResult;
|
Module *Result = ParserResult;
|
||||||
ParserResult = 0;
|
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(ObsoleteVarArgs) {
|
||||||
if(Function* F = Result->getNamedFunction("llvm.va_start")) {
|
if(Function* F = Result->getNamedFunction("llvm.va_start")) {
|
||||||
assert(F->arg_size() == 0 && "Obsolete va_start takes 0 argument!");
|
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);
|
$$ = new SelectInst($2, $4, $6);
|
||||||
}
|
}
|
||||||
| VAARG ResolvedVal ',' Types {
|
| VAARG ResolvedVal ',' Types {
|
||||||
|
NewVarArgs = true;
|
||||||
$$ = new VAArgInst($2, *$4);
|
$$ = new VAArgInst($2, *$4);
|
||||||
delete $4;
|
delete $4;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user