Skip to content

Commit 0a61228

Browse files
authored
LLVM and SPIRV-LLVM-Translator pulldown (WW51)
LLVM: llvm/llvm-project@a500a43 SPIRV-LLVM-Translator: KhronosGroup/SPIRV-LLVM-Translator@ff9babe
2 parents 94d2158 + a0f67bc commit 0a61228

File tree

2,768 files changed

+174979
-45923
lines changed

Some content is hidden

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

2,768 files changed

+174979
-45923
lines changed

.arcconfig

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

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: main branch sync
33
on:
44
push:
55
branches:
6-
- 'master'
6+
- 'main'
77

88
jobs:
99
branch_sync:
@@ -22,4 +22,4 @@ jobs:
2222
env:
2323
LLVMBOT_TOKEN: ${{ secrets.LLVMBOT_MAIN_SYNC }}
2424
run: |
25-
git push https://$LLVMBOT_TOKEN@github.com/${{ github.repository }} HEAD:main
25+
git push https://$LLVMBOT_TOKEN@github.com/${{ github.repository }} HEAD:master

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ template <> struct SetQueryKind<OutputKind> {
120120
static const QueryKind value = QK_SetOutputKind;
121121
};
122122

123-
template <> struct SetQueryKind<ast_type_traits::TraversalKind> {
123+
template <> struct SetQueryKind<TraversalKind> {
124124
static const QueryKind value = QK_SetTraversalKind;
125125
};
126126

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

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -128,20 +128,17 @@ template <typename QueryType> QueryRef QueryParser::parseSetOutputKind() {
128128
llvm_unreachable("Invalid output kind");
129129
}
130130

131-
QueryRef QueryParser::parseSetTraversalKind(
132-
ast_type_traits::TraversalKind QuerySession::*Var) {
131+
QueryRef QueryParser::parseSetTraversalKind(TraversalKind QuerySession::*Var) {
133132
StringRef ValStr;
134133
unsigned Value =
135134
LexOrCompleteWord<unsigned>(this, ValStr)
136-
.Case("AsIs", ast_type_traits::TK_AsIs)
137-
.Case("IgnoreUnlessSpelledInSource",
138-
ast_type_traits::TK_IgnoreUnlessSpelledInSource)
135+
.Case("AsIs", TK_AsIs)
136+
.Case("IgnoreUnlessSpelledInSource", TK_IgnoreUnlessSpelledInSource)
139137
.Default(~0u);
140138
if (Value == ~0u) {
141139
return new InvalidQuery("expected traversal kind, got '" + ValStr + "'");
142140
}
143-
return new SetQuery<ast_type_traits::TraversalKind>(
144-
Var, static_cast<ast_type_traits::TraversalKind>(Value));
141+
return new SetQuery<TraversalKind>(Var, static_cast<TraversalKind>(Value));
145142
}
146143

147144
QueryRef QueryParser::endQuery(QueryRef Q) {

clang-tools-extra/clang-query/QueryParser.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ class QueryParser {
4343
template <typename T> struct LexOrCompleteWord;
4444

4545
QueryRef parseSetBool(bool QuerySession::*Var);
46-
QueryRef
47-
parseSetTraversalKind(ast_type_traits::TraversalKind QuerySession::*Var);
46+
QueryRef parseSetTraversalKind(TraversalKind QuerySession::*Var);
4847
template <typename QueryType> QueryRef parseSetOutputKind();
4948
QueryRef completeMatcherExpression();
5049

clang-tools-extra/clang-query/QuerySession.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class QuerySession {
2626
QuerySession(llvm::ArrayRef<std::unique_ptr<ASTUnit>> ASTs)
2727
: ASTs(ASTs), PrintOutput(false), DiagOutput(true),
2828
DetailedASTOutput(false), BindRoot(true), PrintMatcher(false),
29-
Terminate(false), TK(ast_type_traits::TK_AsIs) {}
29+
Terminate(false), TK(TK_AsIs) {}
3030

3131
llvm::ArrayRef<std::unique_ptr<ASTUnit>> ASTs;
3232

@@ -38,7 +38,7 @@ class QuerySession {
3838
bool PrintMatcher;
3939
bool Terminate;
4040

41-
ast_type_traits::TraversalKind TK;
41+
TraversalKind TK;
4242
llvm::StringMap<ast_matchers::dynamic::VariantValue> NamedValues;
4343
};
4444

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

Lines changed: 29 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -21,34 +21,28 @@ char UnparseableEnumOptionError::ID;
2121
char UnparseableIntegerOptionError::ID;
2222

2323
std::string MissingOptionError::message() const {
24-
llvm::SmallString<128> Buffer;
25-
llvm::raw_svector_ostream Output(Buffer);
26-
Output << "option not found '" << OptionName << '\'';
24+
llvm::SmallString<128> Buffer({"option not found '", OptionName, "'"});
2725
return std::string(Buffer);
2826
}
2927

3028
std::string UnparseableEnumOptionError::message() const {
31-
llvm::SmallString<128> Buffer;
32-
llvm::raw_svector_ostream Output(Buffer);
33-
Output << "invalid configuration value '" << LookupValue << "' for option '"
34-
<< LookupName << '\'';
29+
llvm::SmallString<256> Buffer({"invalid configuration value '", LookupValue,
30+
"' for option '", LookupName, "'"});
3531
if (SuggestedValue)
36-
Output << "; did you mean '" << *SuggestedValue << "'?";
32+
Buffer.append({"; did you mean '", *SuggestedValue, "'?"});
3733
return std::string(Buffer);
3834
}
3935

4036
std::string UnparseableIntegerOptionError::message() const {
41-
llvm::SmallString<128> Buffer;
42-
llvm::raw_svector_ostream Output(Buffer);
43-
Output << "invalid configuration value '" << LookupValue << "' for option '"
44-
<< LookupName << "'; expected "
45-
<< (IsBoolean ? "a bool" : "an integer value");
37+
llvm::SmallString<256> Buffer({"invalid configuration value '", LookupValue,
38+
"' for option '", LookupName, "'; expected ",
39+
(IsBoolean ? "a bool" : "an integer value")});
4640
return std::string(Buffer);
4741
}
4842

4943
ClangTidyCheck::ClangTidyCheck(StringRef CheckName, ClangTidyContext *Context)
5044
: CheckName(CheckName), Context(Context),
51-
Options(CheckName, Context->getOptions().CheckOptions) {
45+
Options(CheckName, Context->getOptions().CheckOptions, Context) {
5246
assert(Context != nullptr);
5347
assert(!CheckName.empty());
5448
}
@@ -58,16 +52,29 @@ DiagnosticBuilder ClangTidyCheck::diag(SourceLocation Loc, StringRef Message,
5852
return Context->diag(CheckName, Loc, Message, Level);
5953
}
6054

55+
DiagnosticBuilder ClangTidyCheck::diag(StringRef Message,
56+
DiagnosticIDs::Level Level) {
57+
return Context->diag(CheckName, Message, Level);
58+
}
59+
60+
DiagnosticBuilder
61+
ClangTidyCheck::configurationDiag(StringRef Description,
62+
DiagnosticIDs::Level Level) {
63+
return Context->configurationDiag(Description, Level);
64+
}
65+
6166
void ClangTidyCheck::run(const ast_matchers::MatchFinder::MatchResult &Result) {
6267
// For historical reasons, checks don't implement the MatchFinder run()
6368
// callback directly. We keep the run()/check() distinction to avoid interface
6469
// churn, and to allow us to add cross-cutting logic in the future.
6570
check(Result);
6671
}
6772

68-
ClangTidyCheck::OptionsView::OptionsView(StringRef CheckName,
69-
const ClangTidyOptions::OptionMap &CheckOptions)
70-
: NamePrefix(CheckName.str() + "."), CheckOptions(CheckOptions) {}
73+
ClangTidyCheck::OptionsView::OptionsView(
74+
StringRef CheckName, const ClangTidyOptions::OptionMap &CheckOptions,
75+
ClangTidyContext *Context)
76+
: NamePrefix(CheckName.str() + "."), CheckOptions(CheckOptions),
77+
Context(Context) {}
7178

7279
llvm::Expected<std::string>
7380
ClangTidyCheck::OptionsView::get(StringRef LocalName) const {
@@ -127,7 +134,7 @@ bool ClangTidyCheck::OptionsView::get<bool>(StringRef LocalName,
127134
llvm::Expected<bool> ValueOr = get<bool>(LocalName);
128135
if (ValueOr)
129136
return *ValueOr;
130-
logIfOptionParsingError(ValueOr.takeError());
137+
reportOptionParsingError(ValueOr.takeError());
131138
return Default;
132139
}
133140

@@ -146,7 +153,7 @@ bool ClangTidyCheck::OptionsView::getLocalOrGlobal<bool>(StringRef LocalName,
146153
llvm::Expected<bool> ValueOr = getLocalOrGlobal<bool>(LocalName);
147154
if (ValueOr)
148155
return *ValueOr;
149-
logIfOptionParsingError(ValueOr.takeError());
156+
reportOptionParsingError(ValueOr.takeError());
150157
return Default;
151158
}
152159

@@ -205,11 +212,11 @@ llvm::Expected<int64_t> ClangTidyCheck::OptionsView::getEnumInt(
205212
Iter->getValue().Value);
206213
}
207214

208-
void ClangTidyCheck::OptionsView::logIfOptionParsingError(llvm::Error &&Err) {
215+
void ClangTidyCheck::OptionsView::reportOptionParsingError(
216+
llvm::Error &&Err) const {
209217
if (auto RemainingErrors =
210218
llvm::handleErrors(std::move(Err), [](const MissingOptionError &) {}))
211-
llvm::logAllUnhandledErrors(std::move(RemainingErrors),
212-
llvm::WithColor::warning());
219+
Context->configurationDiag(llvm::toString(std::move(RemainingErrors)));
213220
}
214221

215222
template <>

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

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,15 @@ class ClangTidyCheck : public ast_matchers::MatchFinder::MatchCallback {
176176
DiagnosticBuilder diag(SourceLocation Loc, StringRef Description,
177177
DiagnosticIDs::Level Level = DiagnosticIDs::Warning);
178178

179+
/// Add a diagnostic with the check's name.
180+
DiagnosticBuilder diag(StringRef Description,
181+
DiagnosticIDs::Level Level = DiagnosticIDs::Warning);
182+
183+
/// Adds a diagnostic to report errors in the check's configuration.
184+
DiagnosticBuilder
185+
configurationDiag(StringRef Description,
186+
DiagnosticIDs::Level Level = DiagnosticIDs::Warning);
187+
179188
/// Should store all options supported by this check with their
180189
/// current values or default values for options that haven't been overridden.
181190
///
@@ -192,7 +201,8 @@ class ClangTidyCheck : public ast_matchers::MatchFinder::MatchCallback {
192201
public:
193202
/// Initializes the instance using \p CheckName + "." as a prefix.
194203
OptionsView(StringRef CheckName,
195-
const ClangTidyOptions::OptionMap &CheckOptions);
204+
const ClangTidyOptions::OptionMap &CheckOptions,
205+
ClangTidyContext *Context);
196206

197207
/// Read a named option from the ``Context``.
198208
///
@@ -268,7 +278,7 @@ class ClangTidyCheck : public ast_matchers::MatchFinder::MatchCallback {
268278
if (llvm::Expected<T> ValueOr = get<T>(LocalName))
269279
return *ValueOr;
270280
else
271-
logIfOptionParsingError(ValueOr.takeError());
281+
reportOptionParsingError(ValueOr.takeError());
272282
return Default;
273283
}
274284

@@ -314,7 +324,7 @@ class ClangTidyCheck : public ast_matchers::MatchFinder::MatchCallback {
314324
if (llvm::Expected<T> ValueOr = getLocalOrGlobal<T>(LocalName))
315325
return *ValueOr;
316326
else
317-
logIfOptionParsingError(ValueOr.takeError());
327+
reportOptionParsingError(ValueOr.takeError());
318328
return Default;
319329
}
320330

@@ -353,7 +363,7 @@ class ClangTidyCheck : public ast_matchers::MatchFinder::MatchCallback {
353363
if (auto ValueOr = get<T>(LocalName, IgnoreCase))
354364
return *ValueOr;
355365
else
356-
logIfOptionParsingError(ValueOr.takeError());
366+
reportOptionParsingError(ValueOr.takeError());
357367
return Default;
358368
}
359369

@@ -395,7 +405,7 @@ class ClangTidyCheck : public ast_matchers::MatchFinder::MatchCallback {
395405
if (auto ValueOr = getLocalOrGlobal<T>(LocalName, IgnoreCase))
396406
return *ValueOr;
397407
else
398-
logIfOptionParsingError(ValueOr.takeError());
408+
reportOptionParsingError(ValueOr.takeError());
399409
return Default;
400410
}
401411

@@ -407,7 +417,7 @@ class ClangTidyCheck : public ast_matchers::MatchFinder::MatchCallback {
407417
if (auto ValueOr = get<T>(LocalName))
408418
return *ValueOr;
409419
else
410-
logIfOptionParsingError(ValueOr.takeError());
420+
reportOptionParsingError(ValueOr.takeError());
411421
return llvm::None;
412422
}
413423

@@ -420,7 +430,7 @@ class ClangTidyCheck : public ast_matchers::MatchFinder::MatchCallback {
420430
if (auto ValueOr = getLocalOrGlobal<T>(LocalName))
421431
return *ValueOr;
422432
else
423-
logIfOptionParsingError(ValueOr.takeError());
433+
reportOptionParsingError(ValueOr.takeError());
424434
return llvm::None;
425435
}
426436

@@ -481,11 +491,12 @@ class ClangTidyCheck : public ast_matchers::MatchFinder::MatchCallback {
481491
void storeInt(ClangTidyOptions::OptionMap &Options, StringRef LocalName,
482492
int64_t Value) const;
483493

484-
/// Logs an Error to stderr if a \p Err is not a MissingOptionError.
485-
static void logIfOptionParsingError(llvm::Error &&Err);
494+
/// Emits a diagnostic if \p Err is not a MissingOptionError.
495+
void reportOptionParsingError(llvm::Error &&Err) const;
486496

487497
std::string NamePrefix;
488498
const ClangTidyOptions::OptionMap &CheckOptions;
499+
ClangTidyContext *Context;
489500
};
490501

491502
private:

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

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,21 @@ DiagnosticBuilder ClangTidyContext::diag(
177177
return DiagEngine->Report(Loc, ID);
178178
}
179179

180+
DiagnosticBuilder ClangTidyContext::diag(
181+
StringRef CheckName, StringRef Description,
182+
DiagnosticIDs::Level Level /* = DiagnosticIDs::Warning*/) {
183+
unsigned ID = DiagEngine->getDiagnosticIDs()->getCustomDiagID(
184+
Level, (Description + " [" + CheckName + "]").str());
185+
CheckNamesByDiagnosticID.try_emplace(ID, CheckName);
186+
return DiagEngine->Report(ID);
187+
}
188+
189+
DiagnosticBuilder ClangTidyContext::configurationDiag(
190+
StringRef Message,
191+
DiagnosticIDs::Level Level /* = DiagnosticIDs::Warning*/) {
192+
return diag("clang-tidy-config", Message, Level);
193+
}
194+
180195
void ClangTidyContext::setSourceManager(SourceManager *SourceMgr) {
181196
DiagEngine->setSourceManager(SourceMgr);
182197
}
@@ -256,8 +271,10 @@ ClangTidyDiagnosticConsumer::ClangTidyDiagnosticConsumer(
256271
void ClangTidyDiagnosticConsumer::finalizeLastError() {
257272
if (!Errors.empty()) {
258273
ClangTidyError &Error = Errors.back();
259-
if (!Context.isCheckEnabled(Error.DiagnosticName) &&
260-
Error.DiagLevel != ClangTidyError::Error) {
274+
if (Error.DiagnosticName == "clang-tidy-config") {
275+
// Never ignore these.
276+
} else if (!Context.isCheckEnabled(Error.DiagnosticName) &&
277+
Error.DiagLevel != ClangTidyError::Error) {
261278
++Context.Stats.ErrorsIgnoredCheckFilter;
262279
Errors.pop_back();
263280
} else if (!LastErrorRelatesToUserCode) {

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,14 @@ class ClangTidyContext {
9696
StringRef Message,
9797
DiagnosticIDs::Level Level = DiagnosticIDs::Warning);
9898

99+
DiagnosticBuilder diag(StringRef CheckName, StringRef Message,
100+
DiagnosticIDs::Level Level = DiagnosticIDs::Warning);
101+
102+
/// Report any errors to do with reading the configuration using this method.
103+
DiagnosticBuilder
104+
configurationDiag(StringRef Message,
105+
DiagnosticIDs::Level Level = DiagnosticIDs::Warning);
106+
99107
/// Sets the \c SourceManager of the used \c DiagnosticsEngine.
100108
///
101109
/// This is called from the \c ClangTidyCheck base class.

0 commit comments

Comments
 (0)