Skip to content

Commit 7912f6f

Browse files
author
Simon Moll
committed
Merge remote-tracking branch 'rwth/aurora-offloading-prototype' into feature/sotoc_merge
2 parents af1eaad + f9b55f8 commit 7912f6f

File tree

12,117 files changed

+998339
-349529
lines changed

Some content is hidden

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

12,117 files changed

+998339
-349529
lines changed

.arcconfig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
"repository.callsign" : "G",
44
"conduit_uri" : "https://reviews.llvm.org/",
55
"base": "git:HEAD^",
6-
"arc.land.onto.default": "main"
6+
"arc.land.onto.default": "main",
7+
"arc.land.onto": ["main"]
78
}

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@ bool HelpQuery::run(llvm::raw_ostream &OS, QuerySession &QS) const {
4848
" AsIs "
4949
"Print and match the AST as clang sees it. This mode is the "
5050
"default.\n"
51-
" IgnoreImplicitCastsAndParentheses "
52-
"Omit implicit casts and parens in matching and dumping.\n"
5351
" IgnoreUnlessSpelledInSource "
5452
"Omit AST nodes unless spelled in the source.\n"
5553
" set output <feature> "
@@ -156,8 +154,7 @@ bool MatchQuery::run(llvm::raw_ostream &OS, QuerySession &QS) const {
156154
if (QS.DetailedASTOutput) {
157155
OS << "Binding for \"" << BI->first << "\":\n";
158156
const ASTContext &Ctx = AST->getASTContext();
159-
const SourceManager &SM = Ctx.getSourceManager();
160-
ASTDumper Dumper(OS, Ctx, SM.getDiagnostics().getShowColors());
157+
ASTDumper Dumper(OS, Ctx, AST->getDiagnostics().getShowColors());
161158
Dumper.SetTraversalKind(QS.TK);
162159
Dumper.Visit(BI->second);
163160
OS << "\n";

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

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@
3333
#include "clang/Tooling/Tooling.h"
3434
#include "llvm/LineEditor/LineEditor.h"
3535
#include "llvm/Support/CommandLine.h"
36+
#include "llvm/Support/Error.h"
3637
#include "llvm/Support/MemoryBuffer.h"
3738
#include "llvm/Support/Signals.h"
3839
#include "llvm/Support/WithColor.h"
39-
#include <fstream>
4040
#include <string>
4141

4242
using namespace clang;
@@ -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));
@@ -65,16 +73,15 @@ static cl::opt<std::string> PreloadFile(
6573

6674
bool runCommandsInFile(const char *ExeName, std::string const &FileName,
6775
QuerySession &QS) {
68-
std::ifstream Input(FileName.c_str());
69-
if (!Input.is_open()) {
70-
llvm::errs() << ExeName << ": cannot open " << FileName << "\n";
71-
return 1;
76+
auto Buffer = llvm::MemoryBuffer::getFile(FileName);
77+
if (!Buffer) {
78+
llvm::errs() << ExeName << ": cannot open " << FileName << ": "
79+
<< Buffer.getError().message() << "\n";
80+
return true;
7281
}
7382

74-
std::string FileContent((std::istreambuf_iterator<char>(Input)),
75-
std::istreambuf_iterator<char>());
83+
StringRef FileContentRef(Buffer.get()->getBuffer());
7684

77-
StringRef FileContentRef(FileContent);
7885
while (!FileContentRef.empty()) {
7986
QueryRef Q = QueryParser::parse(FileContentRef, QS);
8087
if (!Q->run(llvm::outs(), QS))
@@ -109,6 +116,19 @@ int main(int argc, const char **argv) {
109116

110117
ClangTool Tool(OptionsParser->getCompilations(),
111118
OptionsParser->getSourcePathList());
119+
120+
if (UseColor.getNumOccurrences() > 0) {
121+
ArgumentsAdjuster colorAdjustor = [](const CommandLineArguments &Args, StringRef /*unused*/) {
122+
CommandLineArguments AdjustedArgs = Args;
123+
if (UseColor)
124+
AdjustedArgs.push_back("-fdiagnostics-color");
125+
else
126+
AdjustedArgs.push_back("-fno-diagnostics-color");
127+
return AdjustedArgs;
128+
};
129+
Tool.appendArgumentsAdjuster(colorAdjustor);
130+
}
131+
112132
std::vector<std::unique_ptr<ASTUnit>> ASTs;
113133
int ASTStatus = 0;
114134
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: 17 additions & 13 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();
@@ -95,7 +95,7 @@ class AnalyzerDiagnosticConsumer : public ento::PathDiagnosticConsumer {
9595

9696
class ErrorReporter {
9797
public:
98-
ErrorReporter(ClangTidyContext &Context, bool ApplyFixes,
98+
ErrorReporter(ClangTidyContext &Context, FixBehaviour ApplyFixes,
9999
llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> BaseFS)
100100
: Files(FileSystemOptions(), std::move(BaseFS)),
101101
DiagOpts(new DiagnosticOptions()),
@@ -133,8 +133,9 @@ class ErrorReporter {
133133
auto Diag = Diags.Report(Loc, Diags.getCustomDiagID(Level, "%0 [%1]"))
134134
<< Message.Message << Name;
135135
// FIXME: explore options to support interactive fix selection.
136-
const llvm::StringMap<Replacements> *ChosenFix = selectFirstFix(Error);
137-
if (ApplyFixes && ChosenFix) {
136+
const llvm::StringMap<Replacements> *ChosenFix;
137+
if (ApplyFixes != FB_NoFix &&
138+
(ChosenFix = getFixIt(Error, ApplyFixes == FB_FixNotes))) {
138139
for (const auto &FileAndReplacements : *ChosenFix) {
139140
for (const auto &Repl : FileAndReplacements.second) {
140141
++TotalFixes;
@@ -186,8 +187,8 @@ class ErrorReporter {
186187
reportNote(Note);
187188
}
188189

189-
void Finish() {
190-
if (ApplyFixes && TotalFixes > 0) {
190+
void finish() {
191+
if (TotalFixes > 0) {
191192
Rewriter Rewrite(SourceMgr, LangOpts);
192193
for (const auto &FileAndReplacements : FileReplacements) {
193194
StringRef File = FileAndReplacements.first();
@@ -287,7 +288,7 @@ class ErrorReporter {
287288
SourceManager SourceMgr;
288289
llvm::StringMap<Replacements> FileReplacements;
289290
ClangTidyContext &Context;
290-
bool ApplyFixes;
291+
FixBehaviour ApplyFixes;
291292
unsigned TotalFixes;
292293
unsigned AppliedFixes;
293294
unsigned WarningsAsErrors;
@@ -392,6 +393,10 @@ ClangTidyASTConsumerFactory::CreateASTConsumer(
392393
std::vector<std::unique_ptr<ClangTidyCheck>> Checks =
393394
CheckFactories->createChecks(&Context);
394395

396+
llvm::erase_if(Checks, [&](std::unique_ptr<ClangTidyCheck> &Check) {
397+
return !Check->isLanguageVersionSupported(Context.getLangOpts());
398+
});
399+
395400
ast_matchers::MatchFinder::MatchFinderOptions FinderOptions;
396401

397402
std::unique_ptr<ClangTidyProfiling> Profiling;
@@ -415,8 +420,6 @@ ClangTidyASTConsumerFactory::CreateASTConsumer(
415420
}
416421

417422
for (auto &Check : Checks) {
418-
if (!Check->isLanguageVersionSupported(Context.getLangOpts()))
419-
continue;
420423
Check->registerMatchers(&*Finder);
421424
Check->registerPPCallbacks(*SM, PP, ModuleExpanderPP);
422425
}
@@ -500,7 +503,8 @@ runClangTidy(clang::tidy::ClangTidyContext &Context,
500503
const CompilationDatabase &Compilations,
501504
ArrayRef<std::string> InputFiles,
502505
llvm::IntrusiveRefCntPtr<llvm::vfs::OverlayFileSystem> BaseFS,
503-
bool EnableCheckProfile, llvm::StringRef StoreCheckProfile) {
506+
bool ApplyAnyFix, bool EnableCheckProfile,
507+
llvm::StringRef StoreCheckProfile) {
504508
ClangTool Tool(Compilations, InputFiles,
505509
std::make_shared<PCHContainerOperations>(), BaseFS);
506510

@@ -527,7 +531,7 @@ runClangTidy(clang::tidy::ClangTidyContext &Context,
527531
Context.setEnableProfiling(EnableCheckProfile);
528532
Context.setProfileStoragePrefix(StoreCheckProfile);
529533

530-
ClangTidyDiagnosticConsumer DiagConsumer(Context);
534+
ClangTidyDiagnosticConsumer DiagConsumer(Context, nullptr, true, ApplyAnyFix);
531535
DiagnosticsEngine DE(new DiagnosticIDs(), new DiagnosticOptions(),
532536
&DiagConsumer, /*ShouldOwnClient=*/false);
533537
Context.setDiagnosticsEngine(&DE);
@@ -574,7 +578,7 @@ runClangTidy(clang::tidy::ClangTidyContext &Context,
574578
}
575579

576580
void handleErrors(llvm::ArrayRef<ClangTidyError> Errors,
577-
ClangTidyContext &Context, bool Fix,
581+
ClangTidyContext &Context, FixBehaviour Fix,
578582
unsigned &WarningsAsErrorsCount,
579583
llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> BaseFS) {
580584
ErrorReporter Reporter(Context, Fix, std::move(BaseFS));
@@ -596,7 +600,7 @@ void handleErrors(llvm::ArrayRef<ClangTidyError> Errors,
596600
// Return to the initial directory to correctly resolve next Error.
597601
FileSystem.setCurrentWorkingDirectory(InitialWorkingDir.get());
598602
}
599-
Reporter.Finish();
603+
Reporter.finish();
600604
WarningsAsErrorsCount += Reporter.getWarningsAsErrorsCount();
601605
}
602606

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

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,17 +79,28 @@ runClangTidy(clang::tidy::ClangTidyContext &Context,
7979
const tooling::CompilationDatabase &Compilations,
8080
ArrayRef<std::string> InputFiles,
8181
llvm::IntrusiveRefCntPtr<llvm::vfs::OverlayFileSystem> BaseFS,
82-
bool EnableCheckProfile = false,
82+
bool ApplyAnyFix, bool EnableCheckProfile = false,
8383
llvm::StringRef StoreCheckProfile = StringRef());
8484

85+
/// Controls what kind of fixes clang-tidy is allowed to apply.
86+
enum FixBehaviour {
87+
/// Don't try to apply any fix.
88+
FB_NoFix,
89+
/// Only apply fixes added to warnings.
90+
FB_Fix,
91+
/// Apply fixes found in notes.
92+
FB_FixNotes
93+
};
94+
8595
// FIXME: This interface will need to be significantly extended to be useful.
8696
// FIXME: Implement confidence levels for displaying/fixing errors.
8797
//
88-
/// Displays the found \p Errors to the users. If \p Fix is true, \p
89-
/// Errors containing fixes are automatically applied and reformatted. If no
90-
/// clang-format configuration file is found, the given \P FormatStyle is used.
98+
/// Displays the found \p Errors to the users. If \p Fix is \ref FB_Fix or \ref
99+
/// FB_FixNotes, \p Errors containing fixes are automatically applied and
100+
/// reformatted. If no clang-format configuration file is found, the given \P
101+
/// FormatStyle is used.
91102
void handleErrors(llvm::ArrayRef<ClangTidyError> Errors,
92-
ClangTidyContext &Context, bool Fix,
103+
ClangTidyContext &Context, FixBehaviour Fix,
93104
unsigned &WarningsAsErrorsCount,
94105
llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> BaseFS);
95106

0 commit comments

Comments
 (0)