Skip to content

Commit dd4dc47

Browse files
authored
Merge pull request #32 from sx-aurora-dev/feature/merge-upstream-20210131
Feature/merge upstream 20210131
2 parents bcdc528 + c481a57 commit dd4dc47

File tree

4,157 files changed

+1121843
-144990
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,157 files changed

+1121843
-144990
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.

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
#OS X specific files.
2222
.DS_store
2323

24+
# Ignore the user specified CMake presets in subproject directories.
25+
/*/CMakeUserPresets.json
26+
2427
# Nested build directory
2528
/build*
2629

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/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-query/Query.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,7 @@ bool MatchQuery::run(llvm::raw_ostream &OS, QuerySession &QS) const {
156156
if (QS.DetailedASTOutput) {
157157
OS << "Binding for \"" << BI->first << "\":\n";
158158
const ASTContext &Ctx = AST->getASTContext();
159-
const SourceManager &SM = Ctx.getSourceManager();
160-
ASTDumper Dumper(OS, Ctx, SM.getDiagnostics().getShowColors());
159+
ASTDumper Dumper(OS, Ctx, AST->getDiagnostics().getShowColors());
161160
Dumper.SetTraversalKind(QS.TK);
162161
Dumper.Visit(BI->second);
163162
OS << "\n";

clang-tools-extra/clang-query/tool/ClangQuery.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,14 @@ using namespace llvm;
4949
static cl::extrahelp CommonHelp(CommonOptionsParser::HelpMessage);
5050
static cl::OptionCategory ClangQueryCategory("clang-query options");
5151

52+
static cl::opt<bool>
53+
UseColor("use-color",
54+
cl::desc(
55+
R"(Use colors in detailed AST output. If not set, colors
56+
will be used if the terminal connected to
57+
standard output supports colors.)"),
58+
cl::init(false), cl::cat(ClangQueryCategory));
59+
5260
static cl::list<std::string> Commands("c", cl::desc("Specify command to run"),
5361
cl::value_desc("command"),
5462
cl::cat(ClangQueryCategory));
@@ -109,6 +117,19 @@ int main(int argc, const char **argv) {
109117

110118
ClangTool Tool(OptionsParser->getCompilations(),
111119
OptionsParser->getSourcePathList());
120+
121+
if (UseColor.getNumOccurrences() > 0) {
122+
ArgumentsAdjuster colorAdjustor = [](const CommandLineArguments &Args, StringRef /*unused*/) {
123+
CommandLineArguments AdjustedArgs = Args;
124+
if (UseColor)
125+
AdjustedArgs.push_back("-fdiagnostics-color");
126+
else
127+
AdjustedArgs.push_back("-fno-diagnostics-color");
128+
return AdjustedArgs;
129+
};
130+
Tool.appendArgumentsAdjuster(colorAdjustor);
131+
}
132+
112133
std::vector<std::unique_ptr<ASTUnit>> ASTs;
113134
int ASTStatus = 0;
114135
switch (Tool.buildASTs(ASTs)) {

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:

0 commit comments

Comments
 (0)