Skip to content

Commit 86ac3f0

Browse files

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+119
-106
lines changed

clang-tools-extra/clang-tidy/bugprone/UnsafeFunctionsCheck.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ static StringRef getReplacementFor(StringRef FunctionName,
4949
// Try to find a better replacement from Annex K first.
5050
StringRef AnnexKReplacementFunction =
5151
StringSwitch<StringRef>(FunctionName)
52-
.Cases("asctime", "asctime_r", "asctime_s")
52+
.Cases({"asctime", "asctime_r"}, "asctime_s")
5353
.Case("gets", "gets_s")
5454
.Default({});
5555
if (!AnnexKReplacementFunction.empty())
@@ -59,7 +59,7 @@ static StringRef getReplacementFor(StringRef FunctionName,
5959
// FIXME: Some of these functions are available in C++ under "std::", and
6060
// should be matched and suggested.
6161
return StringSwitch<StringRef>(FunctionName)
62-
.Cases("asctime", "asctime_r", "strftime")
62+
.Cases({"asctime", "asctime_r"}, "strftime")
6363
.Case("gets", "fgets")
6464
.Case("rewind", "fseek")
6565
.Case("setbuf", "setvbuf");
@@ -90,13 +90,13 @@ static StringRef getReplacementForAdditional(StringRef FunctionName,
9090
/// safer alternative.
9191
static StringRef getRationaleFor(StringRef FunctionName) {
9292
return StringSwitch<StringRef>(FunctionName)
93-
.Cases("asctime", "asctime_r", "ctime",
93+
.Cases({"asctime", "asctime_r", "ctime"},
9494
"is not bounds-checking and non-reentrant")
95-
.Cases("bcmp", "bcopy", "bzero", "is deprecated")
96-
.Cases("fopen", "freopen", "has no exclusive access to the opened file")
95+
.Cases({"bcmp", "bcopy", "bzero"}, "is deprecated")
96+
.Cases({"fopen", "freopen"}, "has no exclusive access to the opened file")
9797
.Case("gets", "is insecure, was deprecated and removed in C11 and C++14")
9898
.Case("getpw", "is dangerous as it may overflow the provided buffer")
99-
.Cases("rewind", "setbuf", "has no error detection")
99+
.Cases({"rewind", "setbuf"}, "has no error detection")
100100
.Case("vfork", "is insecure as it can lead to denial of service "
101101
"situations in the parent process")
102102
.Default("is not bounds-checking");

clang/lib/AST/CommentSema.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1061,8 +1061,8 @@ InlineCommandRenderKind Sema::getInlineCommandRenderKind(StringRef Name) const {
10611061

10621062
return llvm::StringSwitch<InlineCommandRenderKind>(Name)
10631063
.Case("b", InlineCommandRenderKind::Bold)
1064-
.Cases("c", "p", InlineCommandRenderKind::Monospaced)
1065-
.Cases("a", "e", "em", InlineCommandRenderKind::Emphasized)
1064+
.Cases({"c", "p"}, InlineCommandRenderKind::Monospaced)
1065+
.Cases({"a", "e", "em"}, InlineCommandRenderKind::Emphasized)
10661066
.Case("anchor", InlineCommandRenderKind::Anchor)
10671067
.Default(InlineCommandRenderKind::Normal);
10681068
}

clang/lib/Driver/ToolChains/Arch/Mips.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -502,8 +502,8 @@ bool mips::shouldUseFPXX(const ArgList &Args, const llvm::Triple &Triple,
502502
if (Arg *A = Args.getLastArg(options::OPT_mmsa))
503503
if (A->getOption().matches(options::OPT_mmsa))
504504
UseFPXX = llvm::StringSwitch<bool>(CPUName)
505-
.Cases("mips32r2", "mips32r3", "mips32r5", false)
506-
.Cases("mips64r2", "mips64r3", "mips64r5", false)
505+
.Cases({"mips32r2", "mips32r3", "mips32r5"}, false)
506+
.Cases({"mips64r2", "mips64r3", "mips64r5"}, false)
507507
.Default(UseFPXX);
508508

509509
return UseFPXX;

clang/lib/Driver/ToolChains/CommonArgs.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -687,11 +687,11 @@ static std::string getAMDGPUTargetGPU(const llvm::Triple &T,
687687
if (A) {
688688
auto GPUName = getProcessorFromTargetID(T, A->getValue());
689689
return llvm::StringSwitch<std::string>(GPUName)
690-
.Cases("rv630", "rv635", "r600")
691-
.Cases("rv610", "rv620", "rs780", "rs880")
690+
.Cases({"rv630", "rv635"}, "r600")
691+
.Cases({"rv610", "rv620", "rs780"}, "rs880")
692692
.Case("rv740", "rv770")
693693
.Case("palm", "cedar")
694-
.Cases("sumo", "sumo2", "sumo")
694+
.Cases({"sumo", "sumo2"}, "sumo")
695695
.Case("hemlock", "cypress")
696696
.Case("aruba", "cayman")
697697
.Default(GPUName.str());

clang/lib/StaticAnalyzer/Checkers/MacOSXAPIChecker.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -151,12 +151,10 @@ void MacOSXAPIChecker::checkPreStmt(const CallExpr *CE,
151151
return;
152152

153153
SubChecker SC =
154-
llvm::StringSwitch<SubChecker>(Name)
155-
.Cases("dispatch_once",
156-
"_dispatch_once",
157-
"dispatch_once_f",
158-
&MacOSXAPIChecker::CheckDispatchOnce)
159-
.Default(nullptr);
154+
llvm::StringSwitch<SubChecker>(Name)
155+
.Cases({"dispatch_once", "_dispatch_once", "dispatch_once_f"},
156+
&MacOSXAPIChecker::CheckDispatchOnce)
157+
.Default(nullptr);
160158

161159
if (SC)
162160
(this->*SC)(C, CE, Name);

clang/unittests/Driver/MultilibBuilderTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ TEST(MultilibBuilderTest, Construction3) {
6161
MultilibBuilder().flag("-f1").flag("-f2").flag("-f3", /*Disallow=*/true);
6262
for (const std::string &A : M.flags()) {
6363
ASSERT_TRUE(llvm::StringSwitch<bool>(A)
64-
.Cases("-f1", "-f2", "!f3", true)
64+
.Cases({"-f1", "-f2", "!f3"}, true)
6565
.Default(false));
6666
}
6767
}

clang/unittests/Driver/MultilibTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ TEST(MultilibTest, Construction3) {
131131
E = M.flags().end();
132132
I != E; ++I) {
133133
ASSERT_TRUE(llvm::StringSwitch<bool>(*I)
134-
.Cases("+f1", "+f2", "-f3", true)
134+
.Cases({"+f1", "+f2", "-f3"}, true)
135135
.Default(false));
136136
}
137137
}

lld/Common/DriverDispatcher.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ static void err(const Twine &s) { llvm::errs() << s << "\n"; }
3030

3131
static Flavor getFlavor(StringRef s) {
3232
return StringSwitch<Flavor>(s)
33-
.CasesLower("ld", "ld.lld", "gnu", Gnu)
34-
.CasesLower("wasm", "ld-wasm", Wasm)
33+
.CasesLower({"ld", "ld.lld", "gnu"}, Gnu)
34+
.CasesLower({"wasm", "ld-wasm"}, Wasm)
3535
.CaseLower("link", WinLink)
36-
.CasesLower("ld64", "ld64.lld", "darwin", Darwin)
36+
.CasesLower({"ld64", "ld64.lld", "darwin"}, Darwin)
3737
.Default(Invalid);
3838
}
3939

lldb/cmake/modules/FindLuaAndSwig.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ else()
3434
FOUND_VAR
3535
LUAANDSWIG_FOUND
3636
REQUIRED_VARS
37+
LUA_EXECUTABLE
3738
LUA_LIBRARIES
3839
LUA_INCLUDE_DIR
3940
LUA_VERSION_MINOR

lldb/source/Host/common/File.cpp

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -81,18 +81,17 @@ File::GetStreamOpenModeFromOptions(File::OpenOptions options) {
8181
Expected<File::OpenOptions> File::GetOptionsFromMode(llvm::StringRef mode) {
8282
OpenOptions opts =
8383
llvm::StringSwitch<OpenOptions>(mode)
84-
.Cases("r", "rb", eOpenOptionReadOnly)
85-
.Cases("w", "wb", eOpenOptionWriteOnly)
86-
.Cases("a", "ab",
87-
eOpenOptionWriteOnly | eOpenOptionAppend |
88-
eOpenOptionCanCreate)
89-
.Cases("r+", "rb+", "r+b", eOpenOptionReadWrite)
90-
.Cases("w+", "wb+", "w+b",
91-
eOpenOptionReadWrite | eOpenOptionCanCreate |
92-
eOpenOptionTruncate)
93-
.Cases("a+", "ab+", "a+b",
94-
eOpenOptionReadWrite | eOpenOptionAppend |
95-
eOpenOptionCanCreate)
84+
.Cases({"r", "rb"}, eOpenOptionReadOnly)
85+
.Cases({"w", "wb"}, eOpenOptionWriteOnly)
86+
.Cases({"a", "ab"}, eOpenOptionWriteOnly | eOpenOptionAppend |
87+
eOpenOptionCanCreate)
88+
.Cases({"r+", "rb+", "r+b"}, eOpenOptionReadWrite)
89+
.Cases({"w+", "wb+", "w+b"}, eOpenOptionReadWrite |
90+
eOpenOptionCanCreate |
91+
eOpenOptionTruncate)
92+
.Cases({"a+", "ab+", "a+b"}, eOpenOptionReadWrite |
93+
eOpenOptionAppend |
94+
eOpenOptionCanCreate)
9695
.Default(eOpenOptionInvalid);
9796
if (opts != eOpenOptionInvalid)
9897
return opts;

0 commit comments

Comments
 (0)