diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2011-04-23 20:05:38 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2011-04-23 20:05:38 +0000 |
commit | 0d2d1bcef51993ca3fd957e45fb7ec85e45016e5 (patch) | |
tree | fc03665cb0fb3be23b74303d43b0a6b5c2d2aef3 | |
parent | c69a505cfa318d571ce8a0cd038c8d958585a735 (diff) |
Teach the AST reader and writer to preserve the __DEPRECATED bit in
language options, and warn when reading an AST with a different value
for the bit.
There doesn't appear to be a good way to test this (commenting out
similar other language options doesn't break anything) but if folks have
suggestions on tests I'm happy to add them.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130071 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/clang/Basic/DiagnosticFrontendKinds.td | 3 | ||||
-rw-r--r-- | lib/Serialization/ASTReader.cpp | 2 | ||||
-rw-r--r-- | lib/Serialization/ASTWriter.cpp | 1 |
3 files changed, 6 insertions, 0 deletions
diff --git a/include/clang/Basic/DiagnosticFrontendKinds.td b/include/clang/Basic/DiagnosticFrontendKinds.td index ebd42b329a..67fc22e410 100644 --- a/include/clang/Basic/DiagnosticFrontendKinds.td +++ b/include/clang/Basic/DiagnosticFrontendKinds.td @@ -235,6 +235,9 @@ def warn_pch_gnu_inline : Error< def warn_pch_no_inline : Error< "the macro '__NO_INLINE__' was %select{not defined|defined}0 in " "the PCH file but is currently %select{undefined|defined}1">; +def warn_pch_deprecated : Error< + "the macro '__DEPRECATED' was %select{not defined|defined}0 in " + "the PCH file but is currently %select{undefined|defined}1">; def warn_pch_gc_mode : Error< "the PCH file was built with %select{no||hybrid}0 garbage collection but " "the current translation unit will compiled with %select{no||hybrid}1 " diff --git a/lib/Serialization/ASTReader.cpp b/lib/Serialization/ASTReader.cpp index dafce43a5d..3525c70207 100644 --- a/lib/Serialization/ASTReader.cpp +++ b/lib/Serialization/ASTReader.cpp @@ -129,6 +129,7 @@ PCHValidator::ReadLanguageOptions(const LangOptions &LangOpts) { PARSE_LANGOPT_IMPORTANT(PICLevel, diag::warn_pch_pic_level); PARSE_LANGOPT_IMPORTANT(GNUInline, diag::warn_pch_gnu_inline); PARSE_LANGOPT_IMPORTANT(NoInline, diag::warn_pch_no_inline); + PARSE_LANGOPT_IMPORTANT(Deprecated, diag::warn_pch_deprecated); PARSE_LANGOPT_IMPORTANT(AccessControl, diag::warn_pch_access_control); PARSE_LANGOPT_IMPORTANT(CharIsSigned, diag::warn_pch_char_signed); PARSE_LANGOPT_IMPORTANT(ShortWChar, diag::warn_pch_short_wchar); @@ -2838,6 +2839,7 @@ bool ASTReader::ParseLanguageOptions( PARSE_LANGOPT(PICLevel); PARSE_LANGOPT(GNUInline); PARSE_LANGOPT(NoInline); + PARSE_LANGOPT(Deprecated); PARSE_LANGOPT(AccessControl); PARSE_LANGOPT(CharIsSigned); PARSE_LANGOPT(ShortWChar); diff --git a/lib/Serialization/ASTWriter.cpp b/lib/Serialization/ASTWriter.cpp index 97b0a2f8ab..05078cc012 100644 --- a/lib/Serialization/ASTWriter.cpp +++ b/lib/Serialization/ASTWriter.cpp @@ -1063,6 +1063,7 @@ void ASTWriter::WriteLanguageOptions(const LangOptions &LangOpts) { Record.push_back(LangOpts.GNUInline); // Should GNU inline semantics be // used (instead of C99 semantics). Record.push_back(LangOpts.NoInline); // Should __NO_INLINE__ be defined. + Record.push_back(LangOpts.Deprecated); // Should __DEPRECATED be defined. Record.push_back(LangOpts.AccessControl); // Whether C++ access control should // be enabled. Record.push_back(LangOpts.CharIsSigned); // Whether char is a signed or |