Skip to content

Commit 80ed4b5

Browse files
author
iclsrc
committed
Merge from 'master' to 'sycl-web'
2 parents 9b2364e + da036b4 commit 80ed4b5

File tree

411 files changed

+392607
-4150
lines changed

Some content is hidden

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

411 files changed

+392607
-4150
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ void StringFindStartswithCheck::check(const MatchFinder::MatchResult &Result) {
106106
// Create a preprocessor #include FixIt hint (CreateIncludeInsertion checks
107107
// whether this already exists).
108108
Diagnostic << IncludeInserter.createIncludeInsertion(
109-
Source.getFileID(ComparisonExpr->getBeginLoc()), AbseilStringsMatchHeader,
110-
false);
109+
Source.getFileID(ComparisonExpr->getBeginLoc()),
110+
AbseilStringsMatchHeader);
111111
}
112112

113113
void StringFindStartswithCheck::registerPPCallbacks(

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ InitVariablesCheck::InitVariablesCheck(StringRef Name,
2828
: ClangTidyCheck(Name, Context),
2929
IncludeInserter(Options.getLocalOrGlobal("IncludeStyle",
3030
utils::IncludeSorter::IS_LLVM)),
31-
MathHeader(Options.get("MathHeader", "math.h")) {}
31+
MathHeader(Options.get("MathHeader", "<math.h>")) {}
3232

3333
void InitVariablesCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {
3434
Options.store(Opts, "IncludeStyle", IncludeInserter.getStyle());
@@ -103,7 +103,7 @@ void InitVariablesCheck::check(const MatchFinder::MatchResult &Result) {
103103
InitializationString);
104104
if (AddMathInclude) {
105105
Diagnostic << IncludeInserter.createIncludeInsertion(
106-
Source.getFileID(MatchedDecl->getBeginLoc()), MathHeader, false);
106+
Source.getFileID(MatchedDecl->getBeginLoc()), MathHeader);
107107
}
108108
}
109109
}

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,7 @@ void ProBoundsConstantArrayIndexCheck::check(
8585
IndexRange.getBegin().getLocWithOffset(-1)),
8686
", ")
8787
<< FixItHint::CreateReplacement(Matched->getEndLoc(), ")")
88-
<< Inserter.createMainFileIncludeInsertion(GslHeader,
89-
/*IsAngled=*/false);
88+
<< Inserter.createMainFileIncludeInsertion(GslHeader);
9089
}
9190
return;
9291
}

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ namespace modernize {
1919

2020
namespace {
2121

22-
constexpr char StdMemoryHeader[] = "memory";
2322
constexpr char ConstructorCall[] = "constructorCall";
2423
constexpr char ResetCall[] = "resetCall";
2524
constexpr char NewExpression[] = "newExpression";
@@ -47,7 +46,7 @@ MakeSmartPtrCheck::MakeSmartPtrCheck(StringRef Name, ClangTidyContext *Context,
4746
Inserter(Options.getLocalOrGlobal("IncludeStyle",
4847
utils::IncludeSorter::IS_LLVM)),
4948
MakeSmartPtrFunctionHeader(
50-
Options.get("MakeSmartPtrFunctionHeader", StdMemoryHeader)),
49+
Options.get("MakeSmartPtrFunctionHeader", "<memory>")),
5150
MakeSmartPtrFunctionName(
5251
Options.get("MakeSmartPtrFunction", MakeSmartPtrFunctionName)),
5352
IgnoreMacros(Options.getLocalOrGlobal("IgnoreMacros", true)) {}
@@ -430,9 +429,7 @@ void MakeSmartPtrCheck::insertHeader(DiagnosticBuilder &Diag, FileID FD) {
430429
if (MakeSmartPtrFunctionHeader.empty()) {
431430
return;
432431
}
433-
Diag << Inserter.createIncludeInsertion(
434-
FD, MakeSmartPtrFunctionHeader,
435-
/*IsAngled=*/MakeSmartPtrFunctionHeader == StdMemoryHeader);
432+
Diag << Inserter.createIncludeInsertion(FD, MakeSmartPtrFunctionHeader);
436433
}
437434

438435
} // namespace modernize

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,7 @@ void PassByValueCheck::check(const MatchFinder::MatchResult &Result) {
216216
Initializer->getLParenLoc().getLocWithOffset(1), "std::move(")
217217
<< Inserter.createIncludeInsertion(
218218
Result.SourceManager->getFileID(Initializer->getSourceLocation()),
219-
"utility",
220-
/*IsAngled=*/true);
219+
"<utility>");
221220
}
222221

223222
} // namespace modernize

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,7 @@ void ReplaceAutoPtrCheck::check(const MatchFinder::MatchResult &Result) {
147147
auto Diag = diag(Range.getBegin(), "use std::move to transfer ownership")
148148
<< FixItHint::CreateInsertion(Range.getBegin(), "std::move(")
149149
<< FixItHint::CreateInsertion(Range.getEnd(), ")")
150-
<< Inserter.createMainFileIncludeInsertion("utility",
151-
/*IsAngled=*/true);
150+
<< Inserter.createMainFileIncludeInsertion("<utility>");
152151

153152
return;
154153
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ void ReplaceRandomShuffleCheck::check(const MatchFinder::MatchResult &Result) {
9494
Diag << IncludeInserter.createIncludeInsertion(
9595
Result.Context->getSourceManager().getFileID(
9696
MatchedCallExpr->getBeginLoc()),
97-
"random", /*IsAngled=*/true);
97+
"<random>");
9898
}
9999

100100
} // namespace modernize

clang-tools-extra/clang-tidy/performance/TypePromotionInMathFnCheck.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ void TypePromotionInMathFnCheck::check(const MatchFinder::MatchResult &Result) {
192192
if (FnInCmath)
193193
Diag << IncludeInserter.createIncludeInsertion(
194194
Result.Context->getSourceManager().getFileID(Call->getBeginLoc()),
195-
"cmath", /*IsAngled=*/true);
195+
"<cmath>");
196196
}
197197

198198
} // namespace performance

clang-tools-extra/clang-tidy/performance/UnnecessaryValueParamCheck.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,7 @@ void UnnecessaryValueParamCheck::handleMoveFix(const ParmVarDecl &Var,
203203
Diag << FixItHint::CreateInsertion(CopyArgument.getBeginLoc(), "std::move(")
204204
<< FixItHint::CreateInsertion(EndLoc, ")")
205205
<< Inserter.createIncludeInsertion(
206-
SM.getFileID(CopyArgument.getBeginLoc()), "utility",
207-
/*IsAngled=*/true);
206+
SM.getFileID(CopyArgument.getBeginLoc()), "<utility>");
208207
}
209208

210209
} // namespace performance

clang-tools-extra/clang-tidy/utils/IncludeInserter.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,14 @@ IncludeInserter::createIncludeInsertion(FileID FileID, StringRef Header,
7777
return getOrCreate(FileID).CreateIncludeInsertion(Header, IsAngled);
7878
}
7979

80+
llvm::Optional<FixItHint>
81+
IncludeInserter::createIncludeInsertion(FileID FileID, llvm::StringRef Header) {
82+
bool IsAngled = Header.consume_front("<");
83+
if (IsAngled != Header.consume_back(">"))
84+
return llvm::None;
85+
return createIncludeInsertion(FileID, Header, IsAngled);
86+
}
87+
8088
llvm::Optional<FixItHint>
8189
IncludeInserter::createMainFileIncludeInsertion(StringRef Header,
8290
bool IsAngled) {
@@ -85,6 +93,13 @@ IncludeInserter::createMainFileIncludeInsertion(StringRef Header,
8593
return createIncludeInsertion(SourceMgr->getMainFileID(), Header, IsAngled);
8694
}
8795

96+
llvm::Optional<FixItHint>
97+
IncludeInserter::createMainFileIncludeInsertion(StringRef Header) {
98+
assert(SourceMgr && "SourceMgr shouldn't be null; did you remember to call "
99+
"registerPreprocessor()?");
100+
return createIncludeInsertion(SourceMgr->getMainFileID(), Header);
101+
}
102+
88103
void IncludeInserter::addInclude(StringRef FileName, bool IsAngled,
89104
SourceLocation HashLocation,
90105
SourceLocation EndLocation) {

0 commit comments

Comments
 (0)