Skip to content

Commit 34b5f42

Browse files
authored
LLVM and SPIRV-LLVM-Translator pulldown (WW07-08) with disabled NewPM by default
LLVM: llvm/llvm-project@715dc55 SPIRV-LLVM-Translator: KhronosGroup/SPIRV-LLVM-Translator@b89b25f
2 parents 103d706 + 2c3861b commit 34b5f42

File tree

4,987 files changed

+180709
-104778
lines changed

Some content is hidden

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

4,987 files changed

+180709
-104778
lines changed

.github/workflows/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Github action workflows should be stored in this directrory.

.github/workflows/main-branch-sync.yml

Lines changed: 0 additions & 25 deletions
This file was deleted.

clang-tools-extra/clang-change-namespace/tool/ClangChangeNamespace.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,13 @@ llvm::ErrorOr<std::vector<std::string>> GetAllowedSymbolPatterns() {
9999

100100
int main(int argc, const char **argv) {
101101
llvm::sys::PrintStackTraceOnErrorSignal(argv[0]);
102-
tooling::CommonOptionsParser OptionsParser(argc, argv,
103-
ChangeNamespaceCategory);
102+
auto ExpectedParser =
103+
tooling::CommonOptionsParser::create(argc, argv, ChangeNamespaceCategory);
104+
if (!ExpectedParser) {
105+
llvm::errs() << ExpectedParser.takeError();
106+
return 1;
107+
}
108+
tooling::CommonOptionsParser &OptionsParser = ExpectedParser.get();
104109
const auto &Files = OptionsParser.getSourcePathList();
105110
tooling::RefactoringTool Tool(OptionsParser.getCompilations(), Files);
106111
llvm::ErrorOr<std::vector<std::string>> AllowedPatterns =

clang-tools-extra/clang-include-fixer/SymbolIndexManager.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ SymbolIndexManager::search(llvm::StringRef Identifier,
149149
rank(MatchedSymbols, FileName);
150150
// Strip signals, they are no longer needed.
151151
std::vector<SymbolInfo> Res;
152+
Res.reserve(MatchedSymbols.size());
152153
for (auto &SymAndSig : MatchedSymbols)
153154
Res.push_back(std::move(SymAndSig.Symbol));
154155
return Res;

clang-tools-extra/clang-include-fixer/find-all-symbols/tool/FindAllSymbolsMain.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,14 @@ bool Merge(llvm::StringRef MergeDir, llvm::StringRef OutputFile) {
128128
} // namespace find_all_symbols
129129

130130
int main(int argc, const char **argv) {
131-
CommonOptionsParser OptionsParser(argc, argv, FindAllSymbolsCategory);
131+
auto ExpectedParser =
132+
CommonOptionsParser::create(argc, argv, FindAllSymbolsCategory);
133+
if (!ExpectedParser) {
134+
llvm::errs() << ExpectedParser.takeError();
135+
return 1;
136+
}
137+
138+
CommonOptionsParser &OptionsParser = ExpectedParser.get();
132139
ClangTool Tool(OptionsParser.getCompilations(),
133140
OptionsParser.getSourcePathList());
134141

clang-tools-extra/clang-include-fixer/tool/ClangIncludeFixer.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,13 @@ void writeToJson(llvm::raw_ostream &OS, const IncludeFixerContext& Context) {
263263
}
264264

265265
int includeFixerMain(int argc, const char **argv) {
266-
tooling::CommonOptionsParser options(argc, argv, IncludeFixerCategory);
266+
auto ExpectedParser =
267+
tooling::CommonOptionsParser::create(argc, argv, IncludeFixerCategory);
268+
if (!ExpectedParser) {
269+
llvm::errs() << ExpectedParser.takeError();
270+
return 1;
271+
}
272+
tooling::CommonOptionsParser &options = ExpectedParser.get();
267273
tooling::ClangTool tool(options.getCompilations(),
268274
options.getSourcePathList());
269275

clang-tools-extra/clang-move/tool/ClangMove.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,13 @@ cl::opt<bool> DumpDecls(
9595

9696
int main(int argc, const char **argv) {
9797
llvm::sys::PrintStackTraceOnErrorSignal(argv[0]);
98-
tooling::CommonOptionsParser OptionsParser(argc, argv, ClangMoveCategory);
98+
auto ExpectedParser =
99+
tooling::CommonOptionsParser::create(argc, argv, ClangMoveCategory);
100+
if (!ExpectedParser) {
101+
llvm::errs() << ExpectedParser.takeError();
102+
return 1;
103+
}
104+
tooling::CommonOptionsParser &OptionsParser = ExpectedParser.get();
99105

100106
if (OldDependOnNew && NewDependOnOld) {
101107
llvm::errs() << "Provide either --old_depend_on_new or "

clang-tools-extra/clang-reorder-fields/tool/ClangReorderFields.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,14 @@ static cl::opt<bool> Inplace("i", cl::desc("Overwrite edited files."),
5050
const char Usage[] = "A tool to reorder fields in C/C++ structs/classes.\n";
5151

5252
int main(int argc, const char **argv) {
53-
tooling::CommonOptionsParser OP(argc, argv, ClangReorderFieldsCategory,
54-
Usage);
53+
auto ExpectedParser = tooling::CommonOptionsParser::create(
54+
argc, argv, ClangReorderFieldsCategory, cl::OneOrMore, Usage);
55+
if (!ExpectedParser) {
56+
llvm::errs() << ExpectedParser.takeError();
57+
return 1;
58+
}
59+
60+
tooling::CommonOptionsParser &OP = ExpectedParser.get();
5561

5662
auto Files = OP.getSourcePathList();
5763
tooling::RefactoringTool Tool(OP.getCompilations(), Files);

clang-tools-extra/clang-tidy/ClangTidy.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class AnalyzerDiagnosticConsumer : public ento::PathDiagnosticConsumer {
6767
AnalyzerDiagnosticConsumer(ClangTidyContext &Context) : Context(Context) {}
6868

6969
void FlushDiagnosticsImpl(std::vector<const ento::PathDiagnostic *> &Diags,
70-
FilesMade *filesMade) override {
70+
FilesMade *FilesMade) override {
7171
for (const ento::PathDiagnostic *PD : Diags) {
7272
SmallString<64> CheckName(AnalyzerCheckNamePrefix);
7373
CheckName += PD->getCheckerName();
@@ -186,7 +186,7 @@ class ErrorReporter {
186186
reportNote(Note);
187187
}
188188

189-
void Finish() {
189+
void finish() {
190190
if (ApplyFixes && TotalFixes > 0) {
191191
Rewriter Rewrite(SourceMgr, LangOpts);
192192
for (const auto &FileAndReplacements : FileReplacements) {
@@ -596,7 +596,7 @@ void handleErrors(llvm::ArrayRef<ClangTidyError> Errors,
596596
// Return to the initial directory to correctly resolve next Error.
597597
FileSystem.setCurrentWorkingDirectory(InitialWorkingDir.get());
598598
}
599-
Reporter.Finish();
599+
Reporter.finish();
600600
WarningsAsErrorsCount += Reporter.getWarningsAsErrorsCount();
601601
}
602602

clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,6 @@
3737
using namespace clang;
3838
using namespace tidy;
3939

40-
#ifdef LLVM_CLANG_AST_ATTR_H
41-
//#error
42-
#endif
43-
4440
namespace {
4541
class ClangTidyDiagnosticRenderer : public DiagnosticRenderer {
4642
public:

clang-tools-extra/clang-tidy/ClangTidyOptions.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ template <> struct MappingTraits<FileFilter> {
4747
IO.mapRequired("name", File.Name);
4848
IO.mapOptional("lines", File.LineRanges);
4949
}
50-
static std::string validate(IO &io, FileFilter &File) {
50+
static std::string validate(IO &Io, FileFilter &File) {
5151
if (File.Name.empty())
5252
return "No file name specified";
5353
for (const FileFilter::LineRange &Range : File.LineRanges) {

clang-tools-extra/clang-tidy/ExpandModularHeadersPPCallbacks.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ void ExpandModularHeadersPPCallbacks::handleModuleFile(
125125
Recorder->addNecessaryFile(IF.getFile());
126126
});
127127
// Recursively handle all transitively imported modules.
128-
for (auto Import : MF->Imports)
128+
for (auto *Import : MF->Imports)
129129
handleModuleFile(Import);
130130
}
131131

clang-tools-extra/clang-tidy/GlobList.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ using namespace tidy;
1414

1515
// Returns true if GlobList starts with the negative indicator ('-'), removes it
1616
// from the GlobList.
17-
static bool ConsumeNegativeIndicator(StringRef &GlobList) {
17+
static bool consumeNegativeIndicator(StringRef &GlobList) {
1818
GlobList = GlobList.trim(" \r\n");
1919
if (GlobList.startswith("-")) {
2020
GlobList = GlobList.substr(1);
@@ -25,7 +25,7 @@ static bool ConsumeNegativeIndicator(StringRef &GlobList) {
2525

2626
// Converts first glob from the comma-separated list of globs to Regex and
2727
// removes it and the trailing comma from the GlobList.
28-
static llvm::Regex ConsumeGlob(StringRef &GlobList) {
28+
static llvm::Regex consumeGlob(StringRef &GlobList) {
2929
StringRef UntrimmedGlob = GlobList.substr(0, GlobList.find(','));
3030
StringRef Glob = UntrimmedGlob.trim(' ');
3131
GlobList = GlobList.substr(UntrimmedGlob.size() + 1);
@@ -46,8 +46,8 @@ GlobList::GlobList(StringRef Globs) {
4646
Items.reserve(Globs.count(',') + 1);
4747
do {
4848
GlobListItem Item;
49-
Item.IsPositive = !ConsumeNegativeIndicator(Globs);
50-
Item.Regex = ConsumeGlob(Globs);
49+
Item.IsPositive = !consumeNegativeIndicator(Globs);
50+
Item.Regex = consumeGlob(Globs);
5151
Items.push_back(std::move(Item));
5252
} while (!Globs.empty());
5353
}

clang-tools-extra/clang-tidy/abseil/DurationDivisionCheck.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ namespace abseil {
1717

1818
using namespace clang::ast_matchers;
1919

20-
void DurationDivisionCheck::registerMatchers(MatchFinder *finder) {
20+
void DurationDivisionCheck::registerMatchers(MatchFinder *Finder) {
2121
const auto DurationExpr =
2222
expr(hasType(cxxRecordDecl(hasName("::absl::Duration"))));
23-
finder->addMatcher(
23+
Finder->addMatcher(
2424
traverse(TK_AsIs,
2525
implicitCastExpr(
2626
hasSourceExpression(ignoringParenCasts(
@@ -35,8 +35,8 @@ void DurationDivisionCheck::registerMatchers(MatchFinder *finder) {
3535
this);
3636
}
3737

38-
void DurationDivisionCheck::check(const MatchFinder::MatchResult &result) {
39-
const auto *OpCall = result.Nodes.getNodeAs<CXXOperatorCallExpr>("OpCall");
38+
void DurationDivisionCheck::check(const MatchFinder::MatchResult &Result) {
39+
const auto *OpCall = Result.Nodes.getNodeAs<CXXOperatorCallExpr>("OpCall");
4040
diag(OpCall->getOperatorLoc(),
4141
"operator/ on absl::Duration objects performs integer division; "
4242
"did you mean to use FDivDuration()?")
@@ -47,8 +47,8 @@ void DurationDivisionCheck::check(const MatchFinder::MatchResult &result) {
4747
", ")
4848
<< FixItHint::CreateInsertion(
4949
Lexer::getLocForEndOfToken(
50-
result.SourceManager->getSpellingLoc(OpCall->getEndLoc()), 0,
51-
*result.SourceManager, result.Context->getLangOpts()),
50+
Result.SourceManager->getSpellingLoc(OpCall->getEndLoc()), 0,
51+
*Result.SourceManager, Result.Context->getLangOpts()),
5252
")");
5353
}
5454

clang-tools-extra/clang-tidy/abseil/DurationFactoryFloatCheck.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ namespace tidy {
2020
namespace abseil {
2121

2222
// Returns `true` if `Range` is inside a macro definition.
23-
static bool InsideMacroDefinition(const MatchFinder::MatchResult &Result,
23+
static bool insideMacroDefinition(const MatchFinder::MatchResult &Result,
2424
SourceRange Range) {
2525
return !clang::Lexer::makeFileCharRange(
2626
clang::CharSourceRange::getCharRange(Range),
@@ -46,7 +46,7 @@ void DurationFactoryFloatCheck::check(const MatchFinder::MatchResult &Result) {
4646
const auto *MatchedCall = Result.Nodes.getNodeAs<CallExpr>("call");
4747

4848
// Don't try and replace things inside of macro definitions.
49-
if (InsideMacroDefinition(Result, MatchedCall->getSourceRange()))
49+
if (insideMacroDefinition(Result, MatchedCall->getSourceRange()))
5050
return;
5151

5252
const Expr *Arg = MatchedCall->getArg(0)->IgnoreImpCasts();

clang-tools-extra/clang-tidy/abseil/DurationFactoryScaleCheck.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ getScaleForFactory(llvm::StringRef FactoryName) {
3535

3636
// Given either an integer or float literal, return its value.
3737
// One and only one of `IntLit` and `FloatLit` should be provided.
38-
static double GetValue(const IntegerLiteral *IntLit,
38+
static double getValue(const IntegerLiteral *IntLit,
3939
const FloatingLiteral *FloatLit) {
4040
if (IntLit)
4141
return IntLit->getValue().getLimitedValue();
@@ -48,7 +48,7 @@ static double GetValue(const IntegerLiteral *IntLit,
4848
// would produce a new scale. If so, return a tuple containing the new scale
4949
// and a suitable Multiplier for that scale, otherwise `None`.
5050
static llvm::Optional<std::tuple<DurationScale, double>>
51-
GetNewScaleSingleStep(DurationScale OldScale, double Multiplier) {
51+
getNewScaleSingleStep(DurationScale OldScale, double Multiplier) {
5252
switch (OldScale) {
5353
case DurationScale::Hours:
5454
if (Multiplier <= 1.0 / 60.0)
@@ -94,17 +94,17 @@ GetNewScaleSingleStep(DurationScale OldScale, double Multiplier) {
9494

9595
// Given the scale of a duration and a `Multiplier`, determine if `Multiplier`
9696
// would produce a new scale. If so, return it, otherwise `None`.
97-
static llvm::Optional<DurationScale> GetNewScale(DurationScale OldScale,
97+
static llvm::Optional<DurationScale> getNewScale(DurationScale OldScale,
9898
double Multiplier) {
9999
while (Multiplier != 1.0) {
100-
llvm::Optional<std::tuple<DurationScale, double>> result =
101-
GetNewScaleSingleStep(OldScale, Multiplier);
102-
if (!result)
100+
llvm::Optional<std::tuple<DurationScale, double>> Result =
101+
getNewScaleSingleStep(OldScale, Multiplier);
102+
if (!Result)
103103
break;
104-
if (std::get<1>(*result) == 1.0)
105-
return std::get<0>(*result);
106-
Multiplier = std::get<1>(*result);
107-
OldScale = std::get<0>(*result);
104+
if (std::get<1>(*Result) == 1.0)
105+
return std::get<0>(*Result);
106+
Multiplier = std::get<1>(*Result);
107+
OldScale = std::get<0>(*Result);
108108
}
109109

110110
return llvm::None;
@@ -173,7 +173,7 @@ void DurationFactoryScaleCheck::check(const MatchFinder::MatchResult &Result) {
173173
const auto *IntLit = llvm::dyn_cast<IntegerLiteral>(MultBinOp->getLHS());
174174
const auto *FloatLit = llvm::dyn_cast<FloatingLiteral>(MultBinOp->getLHS());
175175
if (IntLit || FloatLit) {
176-
NewScale = GetNewScale(Scale, GetValue(IntLit, FloatLit));
176+
NewScale = getNewScale(Scale, getValue(IntLit, FloatLit));
177177
if (NewScale)
178178
Remainder = MultBinOp->getRHS();
179179
}
@@ -183,7 +183,7 @@ void DurationFactoryScaleCheck::check(const MatchFinder::MatchResult &Result) {
183183
IntLit = llvm::dyn_cast<IntegerLiteral>(MultBinOp->getRHS());
184184
FloatLit = llvm::dyn_cast<FloatingLiteral>(MultBinOp->getRHS());
185185
if (IntLit || FloatLit) {
186-
NewScale = GetNewScale(Scale, GetValue(IntLit, FloatLit));
186+
NewScale = getNewScale(Scale, getValue(IntLit, FloatLit));
187187
if (NewScale)
188188
Remainder = MultBinOp->getLHS();
189189
}
@@ -195,7 +195,7 @@ void DurationFactoryScaleCheck::check(const MatchFinder::MatchResult &Result) {
195195
const auto *FloatLit = llvm::dyn_cast<FloatingLiteral>(DivBinOp->getRHS());
196196

197197
llvm::Optional<DurationScale> NewScale =
198-
GetNewScale(Scale, 1.0 / FloatLit->getValueAsApproximateDouble());
198+
getNewScale(Scale, 1.0 / FloatLit->getValueAsApproximateDouble());
199199
if (NewScale) {
200200
const Expr *Remainder = DivBinOp->getLHS();
201201

clang-tools-extra/clang-tidy/abseil/DurationRewriter.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,8 @@ llvm::StringRef getTimeFactoryForScale(DurationScale Scale) {
138138
}
139139

140140
/// Returns the Time factory function name for a given `Scale`.
141-
llvm::StringRef getTimeInverseForScale(DurationScale scale) {
142-
switch (scale) {
141+
llvm::StringRef getTimeInverseForScale(DurationScale Scale) {
142+
switch (Scale) {
143143
case DurationScale::Hours:
144144
return "absl::ToUnixHours";
145145
case DurationScale::Minutes:

clang-tools-extra/clang-tidy/abseil/DurationUnnecessaryConversionCheck.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,31 +30,31 @@ void DurationUnnecessaryConversionCheck::registerMatchers(MatchFinder *Finder) {
3030

3131
// Matcher which matches the current scale's factory with a `1` argument,
3232
// e.g. `absl::Seconds(1)`.
33-
auto factory_matcher = ignoringElidableConstructorCall(
33+
auto FactoryMatcher = ignoringElidableConstructorCall(
3434
callExpr(callee(functionDecl(hasName(DurationFactory))),
3535
hasArgument(0, ignoringImpCasts(integerLiteral(equals(1))))));
3636

3737
// Matcher which matches either inverse function and binds its argument,
3838
// e.g. `absl::ToDoubleSeconds(dur)`.
39-
auto inverse_function_matcher = callExpr(
39+
auto InverseFunctionMatcher = callExpr(
4040
callee(functionDecl(hasAnyName(FloatConversion, IntegerConversion))),
4141
hasArgument(0, expr().bind("arg")));
4242

4343
// Matcher which matches a duration divided by the factory_matcher above,
4444
// e.g. `dur / absl::Seconds(1)`.
45-
auto division_operator_matcher = cxxOperatorCallExpr(
45+
auto DivisionOperatorMatcher = cxxOperatorCallExpr(
4646
hasOverloadedOperatorName("/"), hasArgument(0, expr().bind("arg")),
47-
hasArgument(1, factory_matcher));
47+
hasArgument(1, FactoryMatcher));
4848

4949
// Matcher which matches a duration argument to `FDivDuration`,
5050
// e.g. `absl::FDivDuration(dur, absl::Seconds(1))`
51-
auto fdiv_matcher = callExpr(
51+
auto FdivMatcher = callExpr(
5252
callee(functionDecl(hasName("::absl::FDivDuration"))),
53-
hasArgument(0, expr().bind("arg")), hasArgument(1, factory_matcher));
53+
hasArgument(0, expr().bind("arg")), hasArgument(1, FactoryMatcher));
5454

5555
// Matcher which matches a duration argument being scaled,
5656
// e.g. `absl::ToDoubleSeconds(dur) * 2`
57-
auto scalar_matcher = ignoringImpCasts(
57+
auto ScalarMatcher = ignoringImpCasts(
5858
binaryOperator(hasOperatorName("*"),
5959
hasEitherOperand(expr(ignoringParenImpCasts(
6060
callExpr(callee(functionDecl(hasAnyName(
@@ -65,9 +65,9 @@ void DurationUnnecessaryConversionCheck::registerMatchers(MatchFinder *Finder) {
6565

6666
Finder->addMatcher(
6767
callExpr(callee(functionDecl(hasName(DurationFactory))),
68-
hasArgument(0, anyOf(inverse_function_matcher,
69-
division_operator_matcher, fdiv_matcher,
70-
scalar_matcher)))
68+
hasArgument(0, anyOf(InverseFunctionMatcher,
69+
DivisionOperatorMatcher, FdivMatcher,
70+
ScalarMatcher)))
7171
.bind("call"),
7272
this);
7373
}

clang-tools-extra/clang-tidy/abseil/NoNamespaceCheck.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ void NoNamespaceCheck::registerMatchers(MatchFinder *Finder) {
2525
}
2626

2727
void NoNamespaceCheck::check(const MatchFinder::MatchResult &Result) {
28-
const auto *abslNamespaceDecl =
28+
const auto *AbslNamespaceDecl =
2929
Result.Nodes.getNodeAs<NamespaceDecl>("abslNamespace");
3030

31-
diag(abslNamespaceDecl->getLocation(),
31+
diag(AbslNamespaceDecl->getLocation(),
3232
"namespace 'absl' is reserved for implementation of the Abseil library "
3333
"and should not be opened in user code");
3434
}

0 commit comments

Comments
 (0)