From: Fariborz Jahanian Date: Fri, 7 Jan 2011 18:59:25 +0000 (+0000) Subject: Update AST reader/writer to handle new AppleKext. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f84109ee6aeffb09366bd70c8593ce1b7818b1ad;p=clang Update AST reader/writer to handle new AppleKext. Fix an unexpected hickup caused by exceeding size of generated table (and a misleading comment). Improve on help message for -fapple-kext. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123003 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Basic/DiagnosticFrontendKinds.td b/include/clang/Basic/DiagnosticFrontendKinds.td index 8ea904130c..263a6b1e3d 100644 --- a/include/clang/Basic/DiagnosticFrontendKinds.td +++ b/include/clang/Basic/DiagnosticFrontendKinds.td @@ -129,6 +129,9 @@ def warn_pch_nonfragile_abi2 : Error< "PCH file was compiled with the %select{32-bit|enhanced non-fragile}0 " "Objective-C ABI but the %select{32-bit|enhanced non-fragile}1 " "Objective-C ABI is selected">; +def warn_pch_apple_kext : Error< + "PCH file was compiled %select{with|without}0 support for Apple's kernel " + "extensions ABI but it is currently %select{disabled|enabled}1">; def warn_pch_objc_auto_properties : Error< "PCH file was compiled %select{with|without}0 support for auto-synthesized " "@properties but it is currently %select{disabled|enabled}1">; diff --git a/include/clang/Basic/DiagnosticIDs.h b/include/clang/Basic/DiagnosticIDs.h index eede94b2c5..9d18b0f9e9 100644 --- a/include/clang/Basic/DiagnosticIDs.h +++ b/include/clang/Basic/DiagnosticIDs.h @@ -27,7 +27,7 @@ namespace clang { enum { DIAG_START_DRIVER = 300, DIAG_START_FRONTEND = DIAG_START_DRIVER + 100, - DIAG_START_LEX = DIAG_START_FRONTEND + 100, + DIAG_START_LEX = DIAG_START_FRONTEND + 120, DIAG_START_PARSE = DIAG_START_LEX + 300, DIAG_START_AST = DIAG_START_PARSE + 300, DIAG_START_SEMA = DIAG_START_AST + 100, diff --git a/include/clang/Driver/CC1Options.td b/include/clang/Driver/CC1Options.td index 955ca72a2c..58353f11b9 100644 --- a/include/clang/Driver/CC1Options.td +++ b/include/clang/Driver/CC1Options.td @@ -462,7 +462,7 @@ def fobjc_gc : Flag<"-fobjc-gc">, def fobjc_gc_only : Flag<"-fobjc-gc-only">, HelpText<"Use GC exclusively for Objective-C related memory management">; def fapple_kext : Flag<"-fapple-kext">, - HelpText<"Use apple's kext abi">; + HelpText<"Use Apple's kernel extensions ABI">; def fobjc_dispatch_method_EQ : Joined<"-fobjc-dispatch-method=">, HelpText<"Objective-C dispatch method to use">; def fobjc_default_synthesize_properties : Flag<"-fobjc-default-synthesize-properties">, diff --git a/lib/Basic/DiagnosticIDs.cpp b/lib/Basic/DiagnosticIDs.cpp index 29a8d9270a..df32c31ea9 100644 --- a/lib/Basic/DiagnosticIDs.cpp +++ b/lib/Basic/DiagnosticIDs.cpp @@ -82,7 +82,7 @@ static const StaticDiagInfoRec *GetDiagInfo(unsigned DiagID) { for (unsigned i = 1; i != NumDiagEntries; ++i) { assert(StaticDiagInfo[i-1].DiagID != StaticDiagInfo[i].DiagID && "Diag ID conflict, the enums at the start of clang::diag (in " - "Diagnostic.h) probably need to be increased"); + "DiagnosticIDs.h) probably need to be increased"); assert(StaticDiagInfo[i-1] < StaticDiagInfo[i] && "Improperly sorted diag info"); diff --git a/lib/Serialization/ASTReader.cpp b/lib/Serialization/ASTReader.cpp index 7c8415a295..d0edd71cd1 100644 --- a/lib/Serialization/ASTReader.cpp +++ b/lib/Serialization/ASTReader.cpp @@ -84,6 +84,7 @@ PCHValidator::ReadLanguageOptions(const LangOptions &LangOpts) { PARSE_LANGOPT_IMPORTANT(ObjC2, diag::warn_pch_objective_c2); PARSE_LANGOPT_IMPORTANT(ObjCNonFragileABI, diag::warn_pch_nonfragile_abi); PARSE_LANGOPT_IMPORTANT(ObjCNonFragileABI2, diag::warn_pch_nonfragile_abi2); + PARSE_LANGOPT_IMPORTANT(AppleKext, diag::warn_pch_apple_kext); PARSE_LANGOPT_IMPORTANT(ObjCDefaultSynthProperties, diag::warn_pch_objc_auto_properties); PARSE_LANGOPT_IMPORTANT(NoConstantCFStrings, @@ -2600,6 +2601,7 @@ bool ASTReader::ParseLanguageOptions( PARSE_LANGOPT(ObjC2); PARSE_LANGOPT(ObjCNonFragileABI); PARSE_LANGOPT(ObjCNonFragileABI2); + PARSE_LANGOPT(AppleKext); PARSE_LANGOPT(ObjCDefaultSynthProperties); PARSE_LANGOPT(NoConstantCFStrings); PARSE_LANGOPT(PascalStrings); diff --git a/lib/Serialization/ASTWriter.cpp b/lib/Serialization/ASTWriter.cpp index eb312522c7..52415b0d51 100644 --- a/lib/Serialization/ASTWriter.cpp +++ b/lib/Serialization/ASTWriter.cpp @@ -882,6 +882,7 @@ void ASTWriter::WriteLanguageOptions(const LangOptions &LangOpts) { // modern abi enabled. Record.push_back(LangOpts.ObjCNonFragileABI2); // Objective-C enhanced // modern abi enabled. + Record.push_back(LangOpts.AppleKext); // Apple's kernel extensions ABI Record.push_back(LangOpts.ObjCDefaultSynthProperties); // Objective-C auto-synthesized // properties enabled. Record.push_back(LangOpts.NoConstantCFStrings); // non cfstring generation enabled..