diff options
author | Chris Lattner <sabre@nondot.org> | 2009-01-26 06:19:46 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-01-26 06:19:46 +0000 |
commit | 478a18ec47fdb7e0e580a2635648456e9db9ad4f (patch) | |
tree | 97aa889c0818b4d84610e8b133176e62a6c894fd /include | |
parent | 8ee74d50501f66c55b68e2b9cb2ab75b9690eb7b (diff) |
add parsing and constraint enforcement for GNU line marker directives.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63003 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/clang/Basic/DiagnosticKinds.def | 6 | ||||
-rw-r--r-- | include/clang/Lex/Preprocessor.h | 11 |
2 files changed, 12 insertions, 5 deletions
diff --git a/include/clang/Basic/DiagnosticKinds.def b/include/clang/Basic/DiagnosticKinds.def index 09b24ad818..5ff6728283 100644 --- a/include/clang/Basic/DiagnosticKinds.def +++ b/include/clang/Basic/DiagnosticKinds.def @@ -204,6 +204,12 @@ DIAG(err_pp_line_requires_integer, ERROR, "#line directive requires a positive integer argument") DIAG(err_pp_line_invalid_filename, ERROR, "invalid filename for #line directive") +DIAG(err_pp_linemarker_requires_integer, ERROR, + "line marker directive requires a positive integer argument") +DIAG(err_pp_linemarker_invalid_filename, ERROR, + "invalid filename for line marker directive") +DIAG(err_pp_linemarker_invalid_flag, ERROR, + "invalid flag line marker directive") DIAG(ext_pp_line_too_big, EXTENSION, "C requires #line number to be less than %0, allowed as extension") diff --git a/include/clang/Lex/Preprocessor.h b/include/clang/Lex/Preprocessor.h index 8081759e96..bf47bab295 100644 --- a/include/clang/Lex/Preprocessor.h +++ b/include/clang/Lex/Preprocessor.h @@ -532,6 +532,11 @@ public: /// CheckEndOfDirective - Ensure that the next token is a tok::eom token. If /// not, emit a diagnostic and consume up until the eom. void CheckEndOfDirective(const char *Directive); + + /// DiscardUntilEndOfDirective - Read and discard all tokens remaining on the + /// current line until the tok::eom token is found. + void DiscardUntilEndOfDirective(); + private: void PushIncludeMacroStack() { @@ -566,10 +571,6 @@ private: /// #include. bool isInPrimaryFile() const; - /// DiscardUntilEndOfDirective - Read and discard all tokens remaining on the - /// current line until the tok::eom token is found. - void DiscardUntilEndOfDirective(); - /// ReadMacroName - Lex and validate a macro name, which occurs after a /// #define or #undef. This emits a diagnostic, sets the token kind to eom, /// and discards the rest of the macro line if the macro name is invalid. @@ -690,8 +691,8 @@ private: /// Handle*Directive - implement the various preprocessor directives. These /// should side-effect the current preprocessor object so that the next call /// to Lex() will return the appropriate token next. - void HandleLineDirective(Token &Tok); + void HandleDigitDirective(Token &Tok); void HandleUserDiagnosticDirective(Token &Tok, bool isWarning); void HandleIdentSCCSDirective(Token &Tok); |