[clang] a83a6c2 - [clang] [Objective C] Inclusive language: use objcmt-allowlist-dir-path=<arg> instead of objcmt-white-list-dir-path=<arg>
Zarko Todorovski via cfe-commits
cfe-commits at lists.llvm.org
Fri Nov 5 09:27:09 PDT 2021
Author: Zarko Todorovski
Date: 2021-11-05T12:27:05-04:00
New Revision: a83a6c22e63ad84e9c210c71b36413bed72ac23c
URL: https://github.com/llvm/llvm-project/commit/a83a6c22e63ad84e9c210c71b36413bed72ac23c
DIFF: https://github.com/llvm/llvm-project/commit/a83a6c22e63ad84e9c210c71b36413bed72ac23c.diff
LOG: [clang] [Objective C] Inclusive language: use objcmt-allowlist-dir-path=<arg> instead of objcmt-white-list-dir-path=<arg>
Trying to update some options that don't at least have an inclusive language version.
This patch adds `objcmt-allowlist-dir-path` as a default alternative.
Reviewed By: akyrtzi
Differential Revision: https://reviews.llvm.org/D112591
Added:
clang/test/ARCMT/allowlisted/Inputs/header1.h
clang/test/ARCMT/allowlisted/header1.h
clang/test/ARCMT/allowlisted/header1.h.result
clang/test/ARCMT/allowlisted/header2.h
clang/test/ARCMT/allowlisted/header2.h.result
clang/test/ARCMT/allowlisted/objcmt-with-allowlist-impl.m
clang/test/ARCMT/allowlisted/objcmt-with-allowlist-impl.m.result
clang/test/ARCMT/allowlisted/objcmt-with-allowlist.m
Modified:
clang/docs/ClangCommandLineReference.rst
clang/include/clang/Driver/Options.td
clang/include/clang/Frontend/FrontendOptions.h
clang/lib/ARCMigrate/ObjCMT.cpp
clang/lib/Driver/ToolChains/Clang.cpp
clang/test/SemaObjC/method-conflict-1.m
clang/test/SemaObjC/method-conflict-2.m
clang/test/SemaObjC/method-typecheck-3.m
Removed:
clang/test/ARCMT/whitelisted/Inputs/header1.h
clang/test/ARCMT/whitelisted/header1.h
clang/test/ARCMT/whitelisted/header1.h.result
clang/test/ARCMT/whitelisted/header2.h
clang/test/ARCMT/whitelisted/header2.h.result
clang/test/ARCMT/whitelisted/objcmt-with-whitelist-impl.m
clang/test/ARCMT/whitelisted/objcmt-with-whitelist-impl.m.result
clang/test/ARCMT/whitelisted/objcmt-with-whitelist.m
################################################################################
diff --git a/clang/docs/ClangCommandLineReference.rst b/clang/docs/ClangCommandLineReference.rst
index 31e7cd342c267..94eb3fec8a23c 100644
--- a/clang/docs/ClangCommandLineReference.rst
+++ b/clang/docs/ClangCommandLineReference.rst
@@ -483,7 +483,7 @@ Enable migration to use NS\_NONATOMIC\_IOSONLY macro for setting property's 'ato
Enable migration to annotate property with NS\_RETURNS\_INNER\_POINTER
-.. option:: -objcmt-whitelist-dir-path=<arg>, -objcmt-white-list-dir-path=<arg>
+.. option:: -objcmpt-allowlist-dir-path=<arg>, -objcmt-whitelist-dir-path=<arg>, -objcmt-white-list-dir-path=<arg>
Only modify files with a filename contained in the provided directory path
diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index b4a2411fa5c5c..9a657e948e33e 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -617,12 +617,15 @@ def objcmt_migrate_designated_init : Flag<["-"], "objcmt-migrate-designated-init
HelpText<"Enable migration to infer NS_DESIGNATED_INITIALIZER for initializer methods">,
MarshallingInfoBitfieldFlag<FrontendOpts<"ObjCMTAction">, "FrontendOptions::ObjCMT_DesignatedInitializer">;
-def objcmt_whitelist_dir_path: Joined<["-"], "objcmt-whitelist-dir-path=">, Flags<[CC1Option]>,
+def objcmt_allowlist_dir_path: Joined<["-"], "objcmt-allowlist-dir-path=">, Flags<[CC1Option]>,
HelpText<"Only modify files with a filename contained in the provided directory path">,
- MarshallingInfoString<FrontendOpts<"ObjCMTWhiteListPath">>;
+ MarshallingInfoString<FrontendOpts<"ObjCMTAllowListPath">>;
+def : Joined<["-"], "objcmt-whitelist-dir-path=">, Flags<[CC1Option]>,
+ HelpText<"Alias for -objcmt-allowlist-dir-path">,
+ Alias<objcmt_allowlist_dir_path>;
// The misspelt "white-list" [sic] alias is due for removal.
def : Joined<["-"], "objcmt-white-list-dir-path=">, Flags<[CC1Option]>,
- Alias<objcmt_whitelist_dir_path>;
+ Alias<objcmt_allowlist_dir_path>;
// Make sure all other -ccc- options are rejected.
def ccc_ : Joined<["-"], "ccc-">, Group<internal_Group>, Flags<[Unsupported]>;
diff --git a/clang/include/clang/Frontend/FrontendOptions.h b/clang/include/clang/Frontend/FrontendOptions.h
index 41ea45ca0b103..1d9d89a28c6c4 100644
--- a/clang/include/clang/Frontend/FrontendOptions.h
+++ b/clang/include/clang/Frontend/FrontendOptions.h
@@ -373,7 +373,7 @@ class FrontendOptions {
ObjCMT_MigrateDecls | ObjCMT_PropertyDotSyntax)
};
unsigned ObjCMTAction = ObjCMT_None;
- std::string ObjCMTWhiteListPath;
+ std::string ObjCMTAllowListPath;
std::string MTMigrateDir;
std::string ARCMTMigrateReportOut;
diff --git a/clang/lib/ARCMigrate/ObjCMT.cpp b/clang/lib/ARCMigrate/ObjCMT.cpp
index e99c6435062fb..3dfa9a0218a73 100644
--- a/clang/lib/ARCMigrate/ObjCMT.cpp
+++ b/clang/lib/ARCMigrate/ObjCMT.cpp
@@ -104,7 +104,7 @@ class ObjCMigrateASTConsumer : public ASTConsumer {
bool FoundationIncluded;
llvm::SmallPtrSet<ObjCProtocolDecl *, 32> ObjCProtocolDecls;
llvm::SmallVector<const Decl *, 8> CFFunctionIBCandidates;
- llvm::StringSet<> WhiteListFilenames;
+ llvm::StringSet<> AllowListFilenames;
RetainSummaryManager &getSummaryManager(ASTContext &Ctx) {
if (!Summaries)
@@ -118,14 +118,14 @@ class ObjCMigrateASTConsumer : public ASTConsumer {
FileRemapper &remapper, FileManager &fileMgr,
const PPConditionalDirectiveRecord *PPRec,
Preprocessor &PP, bool isOutputFile,
- ArrayRef<std::string> WhiteList)
+ ArrayRef<std::string> AllowList)
: MigrateDir(migrateDir), ASTMigrateActions(astMigrateActions),
NSIntegerTypedefed(nullptr), NSUIntegerTypedefed(nullptr),
Remapper(remapper), FileMgr(fileMgr), PPRec(PPRec), PP(PP),
IsOutputFile(isOutputFile), FoundationIncluded(false) {
// FIXME: StringSet should have insert(iter, iter) to use here.
- for (const std::string &Val : WhiteList)
- WhiteListFilenames.insert(Val);
+ for (const std::string &Val : AllowList)
+ AllowListFilenames.insert(Val);
}
protected:
@@ -151,10 +151,10 @@ class ObjCMigrateASTConsumer : public ASTConsumer {
void HandleTranslationUnit(ASTContext &Ctx) override;
bool canModifyFile(StringRef Path) {
- if (WhiteListFilenames.empty())
+ if (AllowListFilenames.empty())
return true;
- return WhiteListFilenames.find(llvm::sys::path::filename(Path))
- != WhiteListFilenames.end();
+ return AllowListFilenames.find(llvm::sys::path::filename(Path)) !=
+ AllowListFilenames.end();
}
bool canModifyFile(Optional<FileEntryRef> FE) {
if (!FE)
@@ -1986,7 +1986,7 @@ bool MigrateSourceAction::BeginInvocation(CompilerInstance &CI) {
return true;
}
-static std::vector<std::string> getWhiteListFilenames(StringRef DirPath) {
+static std::vector<std::string> getAllowListFilenames(StringRef DirPath) {
using namespace llvm::sys::fs;
using namespace llvm::sys::path;
@@ -2017,16 +2017,16 @@ MigrateSourceAction::CreateASTConsumer(CompilerInstance &CI, StringRef InFile) {
if (ObjCMTOpts == FrontendOptions::ObjCMT_None) {
// If no specific option was given, enable literals+subscripting transforms
// by default.
- ObjCMTAction |= FrontendOptions::ObjCMT_Literals |
- FrontendOptions::ObjCMT_Subscripting;
+ ObjCMTAction |=
+ FrontendOptions::ObjCMT_Literals | FrontendOptions::ObjCMT_Subscripting;
}
CI.getPreprocessor().addPPCallbacks(std::unique_ptr<PPCallbacks>(PPRec));
- std::vector<std::string> WhiteList =
- getWhiteListFilenames(CI.getFrontendOpts().ObjCMTWhiteListPath);
+ std::vector<std::string> AllowList =
+ getAllowListFilenames(CI.getFrontendOpts().ObjCMTAllowListPath);
return std::make_unique<ObjCMigrateASTConsumer>(
CI.getFrontendOpts().OutputFile, ObjCMTAction, Remapper,
CI.getFileManager(), PPRec, CI.getPreprocessor(),
- /*isOutputFile=*/true, WhiteList);
+ /*isOutputFile=*/true, AllowList);
}
namespace {
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index 2dd10a7b31061..56fe3ca59988c 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -3388,7 +3388,7 @@ static void RenderARCMigrateToolOptions(const Driver &D, const ArgList &Args,
Args.AddLastArg(CmdArgs, options::OPT_objcmt_returns_innerpointer_property);
Args.AddLastArg(CmdArgs, options::OPT_objcmt_ns_nonatomic_iosonly);
Args.AddLastArg(CmdArgs, options::OPT_objcmt_migrate_designated_init);
- Args.AddLastArg(CmdArgs, options::OPT_objcmt_whitelist_dir_path);
+ Args.AddLastArg(CmdArgs, options::OPT_objcmt_allowlist_dir_path);
}
}
diff --git a/clang/test/ARCMT/whitelisted/Inputs/header1.h b/clang/test/ARCMT/allowlisted/Inputs/header1.h
similarity index 100%
rename from clang/test/ARCMT/whitelisted/Inputs/header1.h
rename to clang/test/ARCMT/allowlisted/Inputs/header1.h
diff --git a/clang/test/ARCMT/whitelisted/header1.h b/clang/test/ARCMT/allowlisted/header1.h
similarity index 100%
rename from clang/test/ARCMT/whitelisted/header1.h
rename to clang/test/ARCMT/allowlisted/header1.h
diff --git a/clang/test/ARCMT/whitelisted/header1.h.result b/clang/test/ARCMT/allowlisted/header1.h.result
similarity index 100%
rename from clang/test/ARCMT/whitelisted/header1.h.result
rename to clang/test/ARCMT/allowlisted/header1.h.result
diff --git a/clang/test/ARCMT/whitelisted/header2.h b/clang/test/ARCMT/allowlisted/header2.h
similarity index 100%
rename from clang/test/ARCMT/whitelisted/header2.h
rename to clang/test/ARCMT/allowlisted/header2.h
diff --git a/clang/test/ARCMT/whitelisted/header2.h.result b/clang/test/ARCMT/allowlisted/header2.h.result
similarity index 100%
rename from clang/test/ARCMT/whitelisted/header2.h.result
rename to clang/test/ARCMT/allowlisted/header2.h.result
diff --git a/clang/test/ARCMT/whitelisted/objcmt-with-whitelist-impl.m b/clang/test/ARCMT/allowlisted/objcmt-with-allowlist-impl.m
similarity index 75%
rename from clang/test/ARCMT/whitelisted/objcmt-with-whitelist-impl.m
rename to clang/test/ARCMT/allowlisted/objcmt-with-allowlist-impl.m
index d734eaa10bdfd..36797eb1c843b 100644
--- a/clang/test/ARCMT/whitelisted/objcmt-with-whitelist-impl.m
+++ b/clang/test/ARCMT/allowlisted/objcmt-with-allowlist-impl.m
@@ -1,5 +1,5 @@
// RUN: rm -rf %t
-// RUN: %clang_cc1 -objcmt-migrate-readwrite-property -objcmt-migrate-instancetype -objcmt-white-list-dir-path=%S/Inputs %s -triple x86_64-apple-darwin11 -migrate -o %t.remap
+// RUN: %clang_cc1 -objcmt-migrate-readwrite-property -objcmt-migrate-instancetype -objcmt-allowlist-dir-path=%S/Inputs %s -triple x86_64-apple-darwin11 -migrate -o %t.remap
// RUN: c-arcmt-test %t.remap | arcmt-test -verify-transformed-files %S/header1.h.result %s.result
@interface NSObject
diff --git a/clang/test/ARCMT/whitelisted/objcmt-with-whitelist-impl.m.result b/clang/test/ARCMT/allowlisted/objcmt-with-allowlist-impl.m.result
similarity index 75%
rename from clang/test/ARCMT/whitelisted/objcmt-with-whitelist-impl.m.result
rename to clang/test/ARCMT/allowlisted/objcmt-with-allowlist-impl.m.result
index b936b52b729b1..69e7b767ef2b7 100644
--- a/clang/test/ARCMT/whitelisted/objcmt-with-whitelist-impl.m.result
+++ b/clang/test/ARCMT/allowlisted/objcmt-with-allowlist-impl.m.result
@@ -1,5 +1,5 @@
// RUN: rm -rf %t
-// RUN: %clang_cc1 -objcmt-migrate-readwrite-property -objcmt-migrate-instancetype -objcmt-white-list-dir-path=%S/Inputs %s -triple x86_64-apple-darwin11 -migrate -o %t.remap
+// RUN: %clang_cc1 -objcmt-migrate-readwrite-property -objcmt-migrate-instancetype -objcmt-allowlist-dir-path=%S/Inputs %s -triple x86_64-apple-darwin11 -migrate -o %t.remap
// RUN: c-arcmt-test %t.remap | arcmt-test -verify-transformed-files %S/header1.h.result %s.result
@interface NSObject
diff --git a/clang/test/ARCMT/whitelisted/objcmt-with-whitelist.m b/clang/test/ARCMT/allowlisted/objcmt-with-allowlist.m
similarity index 79%
rename from clang/test/ARCMT/whitelisted/objcmt-with-whitelist.m
rename to clang/test/ARCMT/allowlisted/objcmt-with-allowlist.m
index 0ea714fe59374..c22c02d3bf2e4 100644
--- a/clang/test/ARCMT/whitelisted/objcmt-with-whitelist.m
+++ b/clang/test/ARCMT/allowlisted/objcmt-with-allowlist.m
@@ -1,7 +1,7 @@
// RUN: rm -rf %t
// RUN: %clang_cc1 -objcmt-migrate-readwrite-property -objcmt-migrate-instancetype -objcmt-migrate-ns-macros %s -triple x86_64-apple-darwin11 -migrate -o %t.remap
// RUN: c-arcmt-test %t.remap | arcmt-test -verify-transformed-files %S/header1.h.result %S/header2.h.result
-// RUN: %clang_cc1 -objcmt-migrate-readwrite-property -objcmt-migrate-instancetype -objcmt-migrate-ns-macros -objcmt-white-list-dir-path=%S/Inputs %s -triple x86_64-apple-darwin11 -migrate -o %t.remap
+// RUN: %clang_cc1 -objcmt-migrate-readwrite-property -objcmt-migrate-instancetype -objcmt-migrate-ns-macros -objcmt-allowlist-dir-path=%S/Inputs %s -triple x86_64-apple-darwin11 -migrate -o %t.remap
// RUN: c-arcmt-test %t.remap | arcmt-test -verify-transformed-files %S/header1.h.result
@interface NSObject
diff --git a/clang/test/SemaObjC/method-conflict-1.m b/clang/test/SemaObjC/method-conflict-1.m
index 654cd0166fb50..03178fcada3ec 100644
--- a/clang/test/SemaObjC/method-conflict-1.m
+++ b/clang/test/SemaObjC/method-conflict-1.m
@@ -73,7 +73,7 @@ - (B*) test1 { return 0; }
- (A*) test2 { return 0; } // broken-warning {{conflicting return type in implementation of 'test2': 'B *' vs 'A *'}}
@end
-// The particular case of overriding with an id return is white-listed.
+// The particular case of overriding with an id return is permitted.
@interface Test4 {}
- (id) test1;
- (A*) test2;
diff --git a/clang/test/SemaObjC/method-conflict-2.m b/clang/test/SemaObjC/method-conflict-2.m
index 47c3d6c2c23ca..65f0d5534e076 100644
--- a/clang/test/SemaObjC/method-conflict-2.m
+++ b/clang/test/SemaObjC/method-conflict-2.m
@@ -34,7 +34,7 @@ - (B*) test1 { return 0; }
- (A*) test2 { return 0; } // expected-warning {{conflicting return type in implementation of 'test2': 'B *' vs 'A *'}}
@end
-// The particular case of overriding with an id return is white-listed.
+// The particular case of overriding with an id return is permitted.
@interface Test4 {}
- (id) test1;
- (A*) test2;
diff --git a/clang/test/SemaObjC/method-typecheck-3.m b/clang/test/SemaObjC/method-typecheck-3.m
index 1999b7d47702e..a9e1f7a4f80b9 100644
--- a/clang/test/SemaObjC/method-typecheck-3.m
+++ b/clang/test/SemaObjC/method-typecheck-3.m
@@ -13,7 +13,7 @@ @interface B : A
@end
@implementation B
-- (id)obj {return self;} // 'id' overrides are white-listed?
+- (id)obj {return self;} // 'id' overrides are permitted?
- (A*)a { return self;} // expected-warning {{conflicting return type in implementation of 'a'}}
- (void)takesA: (B*)a // expected-warning {{conflicting parameter types in implementation of 'takesA:'}}
{}
More information about the cfe-commits
mailing list