diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/clang/Basic/DiagnosticLexKinds.td | 2 | ||||
-rw-r--r-- | include/clang/Lex/Preprocessor.h | 8 |
2 files changed, 10 insertions, 0 deletions
diff --git a/include/clang/Basic/DiagnosticLexKinds.td b/include/clang/Basic/DiagnosticLexKinds.td index b9dbaf2e9e..59c6ce77fd 100644 --- a/include/clang/Basic/DiagnosticLexKinds.td +++ b/include/clang/Basic/DiagnosticLexKinds.td @@ -285,6 +285,8 @@ def warn_cxx98_compat_empty_fnmacro_arg : Warning< def note_macro_here : Note<"macro %0 defined here">; def err_pp_invalid_directive : Error<"invalid preprocessing directive">; +def err_pp_directive_required : Error< + "%0 must be used within a preprocessing directive">; def err_pp_file_not_found : Error<"'%0' file not found">, DefaultFatal; def err_pp_file_not_found_not_fatal : Error< "'%0' file not found with <angled> include; use \"quotes\" instead">; diff --git a/include/clang/Lex/Preprocessor.h b/include/clang/Lex/Preprocessor.h index e7bd0dfeec..faaec3517d 100644 --- a/include/clang/Lex/Preprocessor.h +++ b/include/clang/Lex/Preprocessor.h @@ -160,6 +160,9 @@ class Preprocessor : public RefCountedBase<Preprocessor> { /// \brief True if pragmas are enabled. bool PragmasEnabled : 1; + /// \brief True if we are currently preprocessing a #if or #elif directive + bool ParsingIfOrElifDirective; + /// \brief True if we are pre-expanding macro arguments. bool InMacroArgPreExpansion; @@ -446,6 +449,11 @@ public: /// \brief Retrieve the module loader associated with this preprocessor. ModuleLoader &getModuleLoader() const { return TheModuleLoader; } + /// \brief True if we are currently preprocessing a #if or #elif directive + bool isParsingIfOrElifDirective() const { + return ParsingIfOrElifDirective; + } + /// SetCommentRetentionState - Control whether or not the preprocessor retains /// comments in output. void SetCommentRetentionState(bool KeepComments, bool KeepMacroComments) { |