Skip to content

Commit f030004

Browse files
committed
Merge from 'main' to 'sycl-web' (125 commits)
CONFLICT (content): Merge conflict in clang/lib/Driver/Driver.cpp
2 parents bae4464 + ae23be8 commit f030004

File tree

704 files changed

+21968
-9835
lines changed

Some content is hidden

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

704 files changed

+21968
-9835
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,11 @@ class ClangTidyCheck : public ast_matchers::MatchFinder::MatchCallback {
417417
StringRef getCurrentMainFile() const { return Context->getCurrentFile(); }
418418
/// Returns the language options from the context.
419419
const LangOptions &getLangOpts() const { return Context->getLangOpts(); }
420+
/// Returns true when the check is run in a use case when only 1 fix will be
421+
/// applied at a time.
422+
bool areDiagsSelfContained() const {
423+
return Context->areDiagsSelfContained();
424+
}
420425
};
421426

422427
/// Read a named option from the ``Context`` and parse it as a bool.

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,8 @@ ClangTidyContext::ClangTidyContext(
162162
bool AllowEnablingAnalyzerAlphaCheckers)
163163
: DiagEngine(nullptr), OptionsProvider(std::move(OptionsProvider)),
164164
Profile(false),
165-
AllowEnablingAnalyzerAlphaCheckers(AllowEnablingAnalyzerAlphaCheckers) {
165+
AllowEnablingAnalyzerAlphaCheckers(AllowEnablingAnalyzerAlphaCheckers),
166+
SelfContainedDiags(false) {
166167
// Before the first translation unit we can get errors related to command-line
167168
// parsing, use empty string for the file name in this case.
168169
setCurrentFile("");

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,10 @@ class ClangTidyContext {
187187
return AllowEnablingAnalyzerAlphaCheckers;
188188
}
189189

190+
void setSelfContainedDiags(bool Value) { SelfContainedDiags = Value; }
191+
192+
bool areDiagsSelfContained() const { return SelfContainedDiags; }
193+
190194
using DiagLevelAndFormatString = std::pair<DiagnosticIDs::Level, std::string>;
191195
DiagLevelAndFormatString getDiagLevelAndFormatString(unsigned DiagnosticID,
192196
SourceLocation Loc) {
@@ -223,6 +227,8 @@ class ClangTidyContext {
223227

224228
bool AllowEnablingAnalyzerAlphaCheckers;
225229

230+
bool SelfContainedDiags;
231+
226232
NoLintDirectiveHandler NoLintHandler;
227233
};
228234

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ StringFindStartswithCheck::StringFindStartswithCheck(StringRef Name,
2727
StringLikeClasses(utils::options::parseStringList(
2828
Options.get("StringLikeClasses", "::std::basic_string"))),
2929
IncludeInserter(Options.getLocalOrGlobal("IncludeStyle",
30-
utils::IncludeSorter::IS_LLVM)),
30+
utils::IncludeSorter::IS_LLVM),
31+
areDiagsSelfContained()),
3132
AbseilStringsMatchHeader(
3233
Options.get("AbseilStringsMatchHeader", "absl/strings/match.h")) {}
3334

clang-tools-extra/clang-tidy/bugprone/ImplicitWideningOfMultiplicationResultCheck.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ ImplicitWideningOfMultiplicationResultCheck::
4343
Options.get("UseCXXStaticCastsInCppSources", true)),
4444
UseCXXHeadersInCppSources(Options.get("UseCXXHeadersInCppSources", true)),
4545
IncludeInserter(Options.getLocalOrGlobal("IncludeStyle",
46-
utils::IncludeSorter::IS_LLVM)) {
47-
}
46+
utils::IncludeSorter::IS_LLVM),
47+
areDiagsSelfContained()) {}
4848

4949
void ImplicitWideningOfMultiplicationResultCheck::registerPPCallbacks(
5050
const SourceManager &SM, Preprocessor *PP, Preprocessor *ModuleExpanderPP) {

clang-tools-extra/clang-tidy/cppcoreguidelines/InitVariablesCheck.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ InitVariablesCheck::InitVariablesCheck(StringRef Name,
2727
ClangTidyContext *Context)
2828
: ClangTidyCheck(Name, Context),
2929
IncludeInserter(Options.getLocalOrGlobal("IncludeStyle",
30-
utils::IncludeSorter::IS_LLVM)),
30+
utils::IncludeSorter::IS_LLVM),
31+
areDiagsSelfContained()),
3132
MathHeader(Options.get("MathHeader", "<math.h>")) {}
3233

3334
void InitVariablesCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {

clang-tools-extra/clang-tidy/cppcoreguidelines/PreferMemberInitializerCheck.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,10 +306,10 @@ void PreferMemberInitializerCheck::check(
306306
NewInit, AddComma ? "), " : ")"});
307307
Diag << FixItHint::CreateInsertion(InsertPos, Insertion,
308308
FirstToCtorInits);
309+
FirstToCtorInits = areDiagsSelfContained();
309310
}
310311
Diag << FixItHint::CreateRemoval(
311312
CharSourceRange::getCharRange(S->getBeginLoc(), SemiColonEnd));
312-
FirstToCtorInits = false;
313313
}
314314
}
315315
}

clang-tools-extra/clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ ProBoundsConstantArrayIndexCheck::ProBoundsConstantArrayIndexCheck(
2222
StringRef Name, ClangTidyContext *Context)
2323
: ClangTidyCheck(Name, Context), GslHeader(Options.get("GslHeader", "")),
2424
Inserter(Options.getLocalOrGlobal("IncludeStyle",
25-
utils::IncludeSorter::IS_LLVM)) {}
25+
utils::IncludeSorter::IS_LLVM),
26+
areDiagsSelfContained()) {}
2627

2728
void ProBoundsConstantArrayIndexCheck::storeOptions(
2829
ClangTidyOptions::OptionMap &Opts) {

clang-tools-extra/clang-tidy/misc/UniqueptrResetReleaseCheck.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ UniqueptrResetReleaseCheck::UniqueptrResetReleaseCheck(
2020
StringRef Name, ClangTidyContext *Context)
2121
: ClangTidyCheck(Name, Context),
2222
Inserter(Options.getLocalOrGlobal("IncludeStyle",
23-
utils::IncludeSorter::IS_LLVM)) {}
23+
utils::IncludeSorter::IS_LLVM),
24+
areDiagsSelfContained()) {}
2425

2526
void UniqueptrResetReleaseCheck::storeOptions(
2627
ClangTidyOptions::OptionMap &Opts) {

clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,8 @@ LoopConvertCheck::LoopConvertCheck(StringRef Name, ClangTidyContext *Context)
463463
MinConfidence(Options.get("MinConfidence", Confidence::CL_Reasonable)),
464464
NamingStyle(Options.get("NamingStyle", VariableNamer::NS_CamelCase)),
465465
Inserter(Options.getLocalOrGlobal("IncludeStyle",
466-
utils::IncludeSorter::IS_LLVM)),
466+
utils::IncludeSorter::IS_LLVM),
467+
areDiagsSelfContained()),
467468
UseCxx20IfAvailable(Options.get("UseCxx20ReverseRanges", true)),
468469
ReverseFunction(Options.get("MakeReverseRangeFunction", "")),
469470
ReverseHeader(Options.get("MakeReverseRangeHeader", "")) {
@@ -800,9 +801,12 @@ bool LoopConvertCheck::isConvertible(ASTContext *Context,
800801
const ast_matchers::BoundNodes &Nodes,
801802
const ForStmt *Loop,
802803
LoopFixerKind FixerKind) {
803-
// If we already modified the range of this for loop, don't do any further
804-
// updates on this iteration.
805-
if (TUInfo->getReplacedVars().count(Loop))
804+
// In self contained diagnosics mode we don't want dependancies on other
805+
// loops, otherwise, If we already modified the range of this for loop, don't
806+
// do any further updates on this iteration.
807+
if (areDiagsSelfContained())
808+
TUInfo = std::make_unique<TUTrackingInfo>();
809+
else if (TUInfo->getReplacedVars().count(Loop))
806810
return false;
807811

808812
// Check that we have exactly one index variable and at most one end variable.

0 commit comments

Comments
 (0)