mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-05 12:31:33 +00:00
Add a comment about the mechanisms used to rid AsmParser of exceptions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29769 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
bd4b758d2d
commit
e4f4759857
File diff suppressed because it is too large
Load Diff
@ -237,7 +237,7 @@
|
||||
|
||||
|
||||
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
|
||||
#line 897 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
|
||||
#line 907 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
|
||||
typedef union YYSTYPE {
|
||||
llvm::Module *ModuleVal;
|
||||
llvm::Function *FunctionVal;
|
||||
|
@ -27,9 +27,19 @@
|
||||
#include <list>
|
||||
#include <utility>
|
||||
|
||||
// The following is a gross hack. In order to rid the libAsmParser library of
|
||||
// exceptions, we have to have a way of getting the yyparse function to go into
|
||||
// an error situation. So, whenever we want an error to occur, the GenerateError
|
||||
// function (see bottom of file) sets TriggerError. Then, at the end of each
|
||||
// production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR
|
||||
// (a goto) to put YACC in error state. Furthermore, several calls to
|
||||
// GenerateError are made from inside productions and they must simulate the
|
||||
// previous exception behavior by exiting the production immediately. We have
|
||||
// replaced these with the GEN_ERROR macro which calls GeneratError and then
|
||||
// immediately invokes YYERROR. This would be so much cleaner if it was a
|
||||
// recursive descent parser.
|
||||
static bool TriggerError = false;
|
||||
#define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYERROR; } }
|
||||
|
||||
#define GEN_ERROR(msg) { GenerateError(msg); YYERROR; }
|
||||
|
||||
int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
|
||||
|
@ -27,9 +27,19 @@
|
||||
#include <list>
|
||||
#include <utility>
|
||||
|
||||
// The following is a gross hack. In order to rid the libAsmParser library of
|
||||
// exceptions, we have to have a way of getting the yyparse function to go into
|
||||
// an error situation. So, whenever we want an error to occur, the GenerateError
|
||||
// function (see bottom of file) sets TriggerError. Then, at the end of each
|
||||
// production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR
|
||||
// (a goto) to put YACC in error state. Furthermore, several calls to
|
||||
// GenerateError are made from inside productions and they must simulate the
|
||||
// previous exception behavior by exiting the production immediately. We have
|
||||
// replaced these with the GEN_ERROR macro which calls GeneratError and then
|
||||
// immediately invokes YYERROR. This would be so much cleaner if it was a
|
||||
// recursive descent parser.
|
||||
static bool TriggerError = false;
|
||||
#define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYERROR; } }
|
||||
|
||||
#define GEN_ERROR(msg) { GenerateError(msg); YYERROR; }
|
||||
|
||||
int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
|
||||
|
Loading…
Reference in New Issue
Block a user