Skip to content

Commit 596821f

Browse files
committed
fix type
Created using spr 1.3.4
2 parents 8df3e4f + 89f692a commit 596821f

File tree

772 files changed

+21969
-10104
lines changed

Some content is hidden

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

772 files changed

+21969
-10104
lines changed

bolt/lib/Profile/DataAggregator.cpp

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,12 @@ FilterMemProfile("filter-mem-profile",
6161
cl::init(true),
6262
cl::cat(AggregatorCategory));
6363

64+
static cl::opt<bool> ParseMemProfile(
65+
"parse-mem-profile",
66+
cl::desc("enable memory profile parsing if it's present in the input data, "
67+
"on by default unless `--itrace` is set."),
68+
cl::init(true), cl::cat(AggregatorCategory));
69+
6470
static cl::opt<unsigned long long>
6571
FilterPID("pid",
6672
cl::desc("only use samples from process with specified PID"),
@@ -181,6 +187,10 @@ void DataAggregator::start() {
181187
"script -F pid,event,ip",
182188
/*Wait = */false);
183189
} else if (!opts::ITraceAggregation.empty()) {
190+
// Disable parsing memory profile from trace data, unless requested by user.
191+
if (!opts::ParseMemProfile.getNumOccurrences())
192+
opts::ParseMemProfile = false;
193+
184194
std::string ItracePerfScriptArgs = llvm::formatv(
185195
"script -F pid,brstack --itrace={0}", opts::ITraceAggregation);
186196
launchPerfProcess("branch events with itrace", MainEventsPPI,
@@ -191,12 +201,9 @@ void DataAggregator::start() {
191201
/*Wait = */ false);
192202
}
193203

194-
// Note: we launch script for mem events regardless of the option, as the
195-
// command fails fairly fast if mem events were not collected.
196-
launchPerfProcess("mem events",
197-
MemEventsPPI,
198-
"script -F pid,event,addr,ip",
199-
/*Wait = */false);
204+
if (opts::ParseMemProfile)
205+
launchPerfProcess("mem events", MemEventsPPI, "script -F pid,event,addr,ip",
206+
/*Wait = */ false);
200207

201208
launchPerfProcess("process events", MMapEventsPPI,
202209
"script --show-mmap-events --no-itrace",
@@ -217,7 +224,8 @@ void DataAggregator::abort() {
217224
sys::Wait(TaskEventsPPI.PI, 1, &Error);
218225
sys::Wait(MMapEventsPPI.PI, 1, &Error);
219226
sys::Wait(MainEventsPPI.PI, 1, &Error);
220-
sys::Wait(MemEventsPPI.PI, 1, &Error);
227+
if (opts::ParseMemProfile)
228+
sys::Wait(MemEventsPPI.PI, 1, &Error);
221229

222230
deleteTempFiles();
223231

@@ -506,7 +514,8 @@ Error DataAggregator::preprocessProfile(BinaryContext &BC) {
506514
errs() << "PERF2BOLT: failed to parse samples\n";
507515

508516
// Special handling for memory events
509-
if (!prepareToParse("mem events", MemEventsPPI, MemEventsErrorCallback))
517+
if (opts::ParseMemProfile &&
518+
!prepareToParse("mem events", MemEventsPPI, MemEventsErrorCallback))
510519
if (const std::error_code EC = parseMemEvents())
511520
errs() << "PERF2BOLT: failed to parse memory events: " << EC.message()
512521
<< '\n';
@@ -1294,7 +1303,7 @@ std::error_code DataAggregator::parseAggregatedLBREntry() {
12941303
Addr[0] = Location(Type == FT ? Trace::FT_ONLY : Trace::FT_EXTERNAL_ORIGIN);
12951304
}
12961305

1297-
/// For legacy branch type, mark Trace To to differential from a full trace.
1306+
/// For legacy branch type, mark Trace To to differentite from a full trace.
12981307
if (Type == BRANCH) {
12991308
Addr[2] = Location(Trace::BR_ONLY);
13001309
}

clang-tools-extra/clang-doc/BitcodeReader.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,8 @@ static llvm::Error decodeRecord(const Record &R, AccessSpecifier &Field,
5454
case AS_none:
5555
Field = (AccessSpecifier)R[0];
5656
return llvm::Error::success();
57-
default:
58-
return llvm::createStringError(llvm::inconvertibleErrorCode(),
59-
"invalid value for AccessSpecifier");
6057
}
58+
llvm_unreachable("invalid value for AccessSpecifier");
6159
}
6260

6361
static llvm::Error decodeRecord(const Record &R, TagTypeKind &Field,

clang-tools-extra/clang-doc/BitcodeWriter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,7 @@ bool ClangDocBitcodeWriter::dispatchInfoForWrite(Info *I) {
664664
case InfoType::IT_typedef:
665665
emitBlock(*static_cast<clang::doc::TypedefInfo *>(I));
666666
break;
667-
default:
667+
case InfoType::IT_default:
668668
llvm::errs() << "Unexpected info, unable to write.\n";
669669
return true;
670670
}

clang-tools-extra/clang-doc/Representation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ mergeInfos(std::vector<std::unique_ptr<Info>> &Values) {
143143
return reduce<FunctionInfo>(Values);
144144
case InfoType::IT_typedef:
145145
return reduce<TypedefInfo>(Values);
146-
default:
146+
case InfoType::IT_default:
147147
return llvm::createStringError(llvm::inconvertibleErrorCode(),
148148
"unexpected info type");
149149
}

clang-tools-extra/clang-doc/Serialize.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,8 @@ std::string serialize(std::unique_ptr<Info> &I) {
388388
return serialize(*static_cast<EnumInfo *>(I.get()));
389389
case InfoType::IT_function:
390390
return serialize(*static_cast<FunctionInfo *>(I.get()));
391-
default:
391+
case InfoType::IT_typedef:
392+
case InfoType::IT_default:
392393
return "";
393394
}
394395
}
@@ -525,9 +526,13 @@ static std::unique_ptr<Info> makeAndInsertIntoParent(ChildType Child) {
525526
InsertChild(ParentRec->Children, std::forward<ChildType>(Child));
526527
return ParentRec;
527528
}
528-
default:
529-
llvm_unreachable("Invalid reference type for parent namespace");
529+
case InfoType::IT_default:
530+
case InfoType::IT_enum:
531+
case InfoType::IT_function:
532+
case InfoType::IT_typedef:
533+
break;
530534
}
535+
llvm_unreachable("Invalid reference type for parent namespace");
531536
}
532537

533538
// There are two uses for this function.

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

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -702,17 +702,16 @@ void NotNullTerminatedResultCheck::registerMatchers(MatchFinder *Finder) {
702702
return hasArgument(
703703
CC.LengthPos,
704704
allOf(
705-
anyOf(
706-
ignoringImpCasts(integerLiteral().bind(WrongLengthExprName)),
707-
allOf(unless(hasDefinition(SizeOfCharExpr)),
708-
allOf(CC.WithIncrease
709-
? ignoringImpCasts(hasDefinition(HasIncOp))
710-
: ignoringImpCasts(allOf(
711-
unless(hasDefinition(HasIncOp)),
712-
anyOf(hasDefinition(binaryOperator().bind(
713-
UnknownLengthName)),
714-
hasDefinition(anything())))),
715-
AnyOfWrongLengthInit))),
705+
anyOf(ignoringImpCasts(integerLiteral().bind(WrongLengthExprName)),
706+
allOf(unless(hasDefinition(SizeOfCharExpr)),
707+
allOf(CC.WithIncrease
708+
? ignoringImpCasts(hasDefinition(HasIncOp))
709+
: ignoringImpCasts(
710+
allOf(unless(hasDefinition(HasIncOp)),
711+
hasDefinition(optionally(
712+
binaryOperator().bind(
713+
UnknownLengthName))))),
714+
AnyOfWrongLengthInit))),
716715
expr().bind(LengthExprName)));
717716
};
718717

clang-tools-extra/clang-tidy/hicpp/ExceptionBaseclassCheck.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,12 @@ void ExceptionBaseclassCheck::registerMatchers(MatchFinder *Finder) {
2424
isSameOrDerivedFrom(hasName("::std::exception")))))))))),
2525
// This condition is always true, but will bind to the
2626
// template value if the thrown type is templated.
27-
anyOf(has(expr(
28-
hasType(substTemplateTypeParmType().bind("templ_type")))),
29-
anything()),
27+
optionally(has(
28+
expr(hasType(substTemplateTypeParmType().bind("templ_type"))))),
3029
// Bind to the declaration of the type of the value that
31-
// is thrown. 'anything()' is necessary to always succeed
32-
// in the 'eachOf' because builtin types are not
33-
// 'namedDecl'.
34-
eachOf(has(expr(hasType(namedDecl().bind("decl")))), anything()))
30+
// is thrown. 'optionally' is necessary because builtin types
31+
// are not 'namedDecl'.
32+
optionally(has(expr(hasType(namedDecl().bind("decl"))))))
3533
.bind("bad_throw"),
3634
this);
3735
}

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

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ void StaticAssertCheck::registerMatchers(MatchFinder *Finder) {
3838
binaryOperator(
3939
hasAnyOperatorName("&&", "=="),
4040
hasEitherOperand(ignoringImpCasts(stringLiteral().bind("assertMSG"))),
41-
anyOf(binaryOperator(hasEitherOperand(IsAlwaysFalseWithCast)),
42-
anything()))
41+
optionally(binaryOperator(hasEitherOperand(IsAlwaysFalseWithCast))))
4342
.bind("assertExprRoot"),
4443
IsAlwaysFalse);
4544
auto NonConstexprFunctionCall =
@@ -52,12 +51,10 @@ void StaticAssertCheck::registerMatchers(MatchFinder *Finder) {
5251
auto NonConstexprCode =
5352
expr(anyOf(NonConstexprFunctionCall, NonConstexprVariableReference));
5453
auto AssertCondition =
55-
expr(
56-
anyOf(expr(ignoringParenCasts(anyOf(
57-
AssertExprRoot, unaryOperator(hasUnaryOperand(
58-
ignoringParenCasts(AssertExprRoot)))))),
59-
anything()),
60-
unless(NonConstexprCode), unless(hasDescendant(NonConstexprCode)))
54+
expr(optionally(expr(ignoringParenCasts(anyOf(
55+
AssertExprRoot, unaryOperator(hasUnaryOperand(
56+
ignoringParenCasts(AssertExprRoot))))))),
57+
unless(NonConstexprCode), unless(hasDescendant(NonConstexprCode)))
6158
.bind("condition");
6259
auto Condition =
6360
anyOf(ignoringParenImpCasts(callExpr(

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

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,12 @@ void UseBoolLiteralsCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {
2626

2727
void UseBoolLiteralsCheck::registerMatchers(MatchFinder *Finder) {
2828
Finder->addMatcher(
29-
traverse(
30-
TK_AsIs,
31-
implicitCastExpr(
32-
has(ignoringParenImpCasts(integerLiteral().bind("literal"))),
33-
hasImplicitDestinationType(qualType(booleanType())),
34-
unless(isInTemplateInstantiation()),
35-
anyOf(hasParent(explicitCastExpr().bind("cast")), anything()))),
29+
traverse(TK_AsIs,
30+
implicitCastExpr(
31+
has(ignoringParenImpCasts(integerLiteral().bind("literal"))),
32+
hasImplicitDestinationType(qualType(booleanType())),
33+
unless(isInTemplateInstantiation()),
34+
optionally(hasParent(explicitCastExpr().bind("cast"))))),
3635
this);
3736

3837
Finder->addMatcher(

clang-tools-extra/clang-tidy/readability/ImplicitBoolConversionCheck.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,8 +348,8 @@ void ImplicitBoolConversionCheck::registerMatchers(MatchFinder *Finder) {
348348
implicitCastExpr().bind("implicitCastFromBool"),
349349
unless(hasParent(BitfieldConstruct)),
350350
// Check also for nested casts, for example: bool -> int -> float.
351-
anyOf(hasParent(implicitCastExpr().bind("furtherImplicitCast")),
352-
anything()),
351+
optionally(
352+
hasParent(implicitCastExpr().bind("furtherImplicitCast"))),
353353
unless(isInTemplateInstantiation()),
354354
unless(IsInCompilerGeneratedFunction))),
355355
this);

0 commit comments

Comments
 (0)