Skip to content

Commit 971f2e2

Browse files
committed
Merge remote-tracking branch 'origin/sycl' into compiling_error_for_recursive
2 parents 68c5111 + d45ca27 commit 971f2e2

File tree

9,342 files changed

+782892
-927386
lines changed

Some content is hidden

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

9,342 files changed

+782892
-927386
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/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
* @bader
22

33
# Front-end compiler
4-
clang/ @premanandrao @elizabethandrews
4+
clang/ @premanandrao @elizabethandrews @AaronBallman
55

66
# Driver
77
clang/**/Driver @mdtoguchi @AGindinson

.github/workflows/linux_post_commit.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ jobs:
2727
;;
2828
SharedLibs)
2929
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
30-
sudo add-apt-repository "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic main"
30+
sudo add-apt-repository "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-12 main"
3131
sudo apt-get update
32-
sudo apt-get install -y clang-13
32+
sudo apt-get install -y clang-12
3333
export ARGS="--shared-libs"
34-
export CC="clang-13"
35-
export CXX="clang++-13"
34+
export CC="clang-12"
35+
export CXX="clang++-12"
3636
;;
3737
NoAssertions)
3838
export ARGS="--no-assertions"

buildbot/configure.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@ def do_configure(args):
1313
if not os.path.isdir(abs_obj_dir):
1414
os.makedirs(abs_obj_dir)
1515

16-
llvm_external_projects = 'sycl;llvm-spirv;opencl-aot;libdevice'
17-
if not args.use_libcxx:
18-
llvm_external_projects += ';xpti;xptifw'
16+
llvm_external_projects = 'sycl;llvm-spirv;opencl-aot;libdevice;xpti;xptifw'
1917

2018
llvm_dir = os.path.join(abs_src_dir, "llvm")
2119
sycl_dir = os.path.join(abs_src_dir, "sycl")
@@ -34,8 +32,8 @@ def do_configure(args):
3432
llvm_enable_doxygen = 'OFF'
3533
llvm_enable_sphinx = 'OFF'
3634
llvm_build_shared_libs = 'OFF'
37-
sycl_enable_xpti_tracing = 'OFF' if args.use_libcxx else 'ON'
3835

36+
sycl_enable_xpti_tracing = 'ON'
3937
icd_loader_lib = os.path.join(icd_loader_lib, "libOpenCL.so" if platform.system() == 'Linux' else "OpenCL.lib")
4038

4139
# replace not append, so ARM ^ X86

clang-tools-extra/clang-query/Query.cpp

Lines changed: 0 additions & 2 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> "

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

Lines changed: 7 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;
@@ -73,16 +73,15 @@ static cl::opt<std::string> PreloadFile(
7373

7474
bool runCommandsInFile(const char *ExeName, std::string const &FileName,
7575
QuerySession &QS) {
76-
std::ifstream Input(FileName.c_str());
77-
if (!Input.is_open()) {
78-
llvm::errs() << ExeName << ": cannot open " << FileName << "\n";
79-
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;
8081
}
8182

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

85-
StringRef FileContentRef(FileContent);
8685
while (!FileContentRef.empty()) {
8786
QueryRef Q = QueryParser::parse(FileContentRef, QS);
8887
if (!Q->run(llvm::outs(), QS))

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

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -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;
@@ -187,7 +188,7 @@ class ErrorReporter {
187188
}
188189

189190
void finish() {
190-
if (ApplyFixes && TotalFixes > 0) {
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));

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)