Skip to content

Commit 82a70bf

Browse files
committed
Merge branch 'users/rpatel321/lit-report-failures-only-option' of https://github.com/rpatel321/llvm-project into users/rpatel321/lit-report-failures-only-option
2 parents 6793a94 + f18430a commit 82a70bf

File tree

1,794 files changed

+157684
-146984
lines changed

Some content is hidden

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

1,794 files changed

+157684
-146984
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@
141141
/clang/tools/clang-installapi/ @cyndyishida
142142

143143
# ExtractAPI
144-
/clang/**/ExtractAPI @daniel-grumberg
144+
/clang/**/ExtractAPI @daniel-grumberg @QuietMisdreavus
145145

146146
# DWARFLinker, dwarfutil, dsymutil
147147
/llvm/**/DWARFLinker/ @JDevlieghere

bolt/include/bolt/Profile/YAMLProfileReader.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ class YAMLProfileReader : public ProfileReaderBase {
105105
yaml::bolt::BinaryProfile YamlBP;
106106

107107
/// Map a function ID from a YAML profile to a BinaryFunction object.
108-
std::vector<BinaryFunction *> YamlProfileToFunction;
108+
DenseMap<uint32_t, BinaryFunction *> YamlProfileToFunction;
109109

110110
using FunctionSet = std::unordered_set<const BinaryFunction *>;
111111
/// To keep track of functions that have a matched profile before the profile
@@ -162,8 +162,6 @@ class YAMLProfileReader : public ProfileReaderBase {
162162
/// Update matched YAML -> BinaryFunction pair.
163163
void matchProfileToFunction(yaml::bolt::BinaryFunctionProfile &YamlBF,
164164
BinaryFunction &BF) {
165-
if (YamlBF.Id >= YamlProfileToFunction.size())
166-
YamlProfileToFunction.resize(YamlBF.Id + 1);
167165
YamlProfileToFunction[YamlBF.Id] = &BF;
168166
YamlBF.Used = true;
169167

bolt/lib/Core/BinaryFunction.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2580,6 +2580,7 @@ struct CFISnapshot {
25802580
case MCCFIInstruction::OpNegateRAStateWithPC:
25812581
case MCCFIInstruction::OpLLVMDefAspaceCfa:
25822582
case MCCFIInstruction::OpLabel:
2583+
case MCCFIInstruction::OpValOffset:
25832584
llvm_unreachable("unsupported CFI opcode");
25842585
break;
25852586
case MCCFIInstruction::OpRememberState:
@@ -2719,6 +2720,7 @@ struct CFISnapshotDiff : public CFISnapshot {
27192720
case MCCFIInstruction::OpNegateRAStateWithPC:
27202721
case MCCFIInstruction::OpLLVMDefAspaceCfa:
27212722
case MCCFIInstruction::OpLabel:
2723+
case MCCFIInstruction::OpValOffset:
27222724
llvm_unreachable("unsupported CFI opcode");
27232725
return false;
27242726
case MCCFIInstruction::OpRememberState:
@@ -2869,6 +2871,7 @@ BinaryFunction::unwindCFIState(int32_t FromState, int32_t ToState,
28692871
case MCCFIInstruction::OpNegateRAStateWithPC:
28702872
case MCCFIInstruction::OpLLVMDefAspaceCfa:
28712873
case MCCFIInstruction::OpLabel:
2874+
case MCCFIInstruction::OpValOffset:
28722875
llvm_unreachable("unsupported CFI opcode");
28732876
break;
28742877
case MCCFIInstruction::OpGnuArgsSize:

bolt/lib/Profile/YAMLProfileReader.cpp

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -238,9 +238,7 @@ bool YAMLProfileReader::parseFunctionProfile(
238238
BB.setExecutionCount(YamlBB.ExecCount);
239239

240240
for (const yaml::bolt::CallSiteInfo &YamlCSI : YamlBB.CallSites) {
241-
BinaryFunction *Callee = YamlCSI.DestId < YamlProfileToFunction.size()
242-
? YamlProfileToFunction[YamlCSI.DestId]
243-
: nullptr;
241+
BinaryFunction *Callee = YamlProfileToFunction.lookup(YamlCSI.DestId);
244242
bool IsFunction = Callee ? true : false;
245243
MCSymbol *CalleeSymbol = nullptr;
246244
if (IsFunction)
@@ -703,7 +701,7 @@ Error YAMLProfileReader::readProfile(BinaryContext &BC) {
703701
break;
704702
}
705703
}
706-
YamlProfileToFunction.resize(YamlBP.Functions.size() + 1);
704+
YamlProfileToFunction.reserve(YamlBP.Functions.size());
707705

708706
// Computes hash for binary functions.
709707
if (opts::MatchProfileWithFunctionHash) {
@@ -756,12 +754,7 @@ Error YAMLProfileReader::readProfile(BinaryContext &BC) {
756754
NormalizeByCalls = usesEvent("branches");
757755
uint64_t NumUnused = 0;
758756
for (yaml::bolt::BinaryFunctionProfile &YamlBF : YamlBP.Functions) {
759-
if (YamlBF.Id >= YamlProfileToFunction.size()) {
760-
// Such profile was ignored.
761-
++NumUnused;
762-
continue;
763-
}
764-
if (BinaryFunction *BF = YamlProfileToFunction[YamlBF.Id])
757+
if (BinaryFunction *BF = YamlProfileToFunction.lookup(YamlBF.Id))
765758
parseFunctionProfile(*BF, YamlBF);
766759
else
767760
++NumUnused;

bolt/lib/Rewrite/PseudoProbeRewriter.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,8 @@ void PseudoProbeRewriter::parsePseudoProbe(bool ProfiledOnly) {
127127

128128
StringRef Contents = PseudoProbeDescSection->getContents();
129129
if (!ProbeDecoder.buildGUID2FuncDescMap(
130-
reinterpret_cast<const uint8_t *>(Contents.data()),
131-
Contents.size())) {
130+
reinterpret_cast<const uint8_t *>(Contents.data()), Contents.size(),
131+
/*IsMMapped*/ true)) {
132132
errs() << "BOLT-WARNING: fail in building GUID2FuncDescMap\n";
133133
return;
134134
}

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,9 @@ void SizeofExpressionCheck::check(const MatchFinder::MatchResult &Result) {
400400
"suspicious usage of 'sizeof(array)/sizeof(...)';"
401401
" denominator differs from the size of array elements")
402402
<< E->getLHS()->getSourceRange() << E->getRHS()->getSourceRange();
403-
} else if (NumTy && DenomTy && NumTy == DenomTy) {
403+
} else if (NumTy && DenomTy && NumTy == DenomTy &&
404+
!NumTy->isDependentType()) {
405+
// Dependent type should not be compared.
404406
diag(E->getOperatorLoc(),
405407
"suspicious usage of 'sizeof(...)/sizeof(...)'; both expressions "
406408
"have the same type")

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ using namespace clang::ast_matchers;
1515
namespace clang::tidy::bugprone {
1616

1717
void ThrowKeywordMissingCheck::registerMatchers(MatchFinder *Finder) {
18-
auto CtorInitializerList =
19-
cxxConstructorDecl(hasAnyConstructorInitializer(anything()));
20-
2118
Finder->addMatcher(
2219
cxxConstructExpr(
2320
hasType(cxxRecordDecl(
@@ -27,7 +24,7 @@ void ThrowKeywordMissingCheck::registerMatchers(MatchFinder *Finder) {
2724
stmt(anyOf(cxxThrowExpr(), callExpr(), returnStmt()))),
2825
hasAncestor(decl(anyOf(varDecl(), fieldDecl()))),
2926
hasAncestor(expr(cxxNewExpr(hasAnyPlacementArg(anything())))),
30-
allOf(hasAncestor(CtorInitializerList),
27+
allOf(hasAncestor(cxxConstructorDecl()),
3128
unless(hasAncestor(cxxCatchStmt()))))))
3229
.bind("temporary-exception-not-thrown"),
3330
this);

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@
88

99
#include "InitVariablesCheck.h"
1010

11+
#include "../utils/LexerUtils.h"
1112
#include "clang/AST/ASTContext.h"
13+
#include "clang/AST/Type.h"
1214
#include "clang/ASTMatchers/ASTMatchFinder.h"
13-
#include "clang/Lex/PPCallbacks.h"
1415
#include "clang/Lex/Preprocessor.h"
1516
#include <optional>
1617

@@ -107,8 +108,9 @@ void InitVariablesCheck::check(const MatchFinder::MatchResult &Result) {
107108
<< MatchedDecl;
108109
if (*InitializationString != nullptr)
109110
Diagnostic << FixItHint::CreateInsertion(
110-
MatchedDecl->getLocation().getLocWithOffset(
111-
MatchedDecl->getName().size()),
111+
utils::lexer::findNextTerminator(MatchedDecl->getLocation(),
112+
*Result.SourceManager,
113+
Result.Context->getLangOpts()),
112114
*InitializationString);
113115
if (AddMathInclude) {
114116
Diagnostic << IncludeInserter.createIncludeInsertion(

clang-tools-extra/docs/ReleaseNotes.rst

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,12 @@ Changes in existing checks
175175
- Improved :doc:`bugprone-sizeof-expression
176176
<clang-tidy/checks/bugprone/sizeof-expression>` check to find suspicious
177177
usages of ``sizeof()``, ``alignof()``, and ``offsetof()`` when adding or
178-
subtracting from a pointer directly or when used to scale a numeric value.
178+
subtracting from a pointer directly or when used to scale a numeric value and
179+
fix false positive when sizeof expression with template types.
180+
181+
- Improved :doc:`bugprone-throw-keyword-missing
182+
<clang-tidy/checks/bugprone/throw-keyword-missing>` by fixing a false positive
183+
when using non-static member initializers and a constructor.
179184

180185
- Improved :doc:`bugprone-unchecked-optional-access
181186
<clang-tidy/checks/bugprone/unchecked-optional-access>` to support
@@ -190,6 +195,10 @@ Changes in existing checks
190195
fix false positive that floating point variable is only used in increment
191196
expression.
192197

198+
- Improved :doc:`cppcoreguidelines-init-variables
199+
<clang-tidy/checks/cppcoreguidelines/init-variables>` check by fixing the
200+
insertion location for function pointers.
201+
193202
- Improved :doc:`cppcoreguidelines-prefer-member-initializer
194203
<clang-tidy/checks/cppcoreguidelines/prefer-member-initializer>` check to
195204
avoid false positive when member initialization depends on a structured
@@ -208,9 +217,9 @@ Changes in existing checks
208217
false positive for C++23 deducing this.
209218

210219
- Improved :doc:`modernize-avoid-c-arrays
211-
<clang-tidy/checks/modernize/avoid-c-arrays>` check to suggest using ``std::span``
212-
as a replacement for parameters of incomplete C array type in C++20 and
213-
``std::array`` or ``std::vector`` before C++20.
220+
<clang-tidy/checks/modernize/avoid-c-arrays>` check to suggest using
221+
``std::span`` as a replacement for parameters of incomplete C array type in
222+
C++20 and ``std::array`` or ``std::vector`` before C++20.
214223

215224
- Improved :doc:`modernize-loop-convert
216225
<clang-tidy/checks/modernize/loop-convert>` check to fix false positive when

clang-tools-extra/test/clang-tidy/checkers/bugprone/sizeof-expression.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,3 +385,10 @@ int ValidExpressions() {
385385
sum += sizeof(PtrArray) / sizeof(A[0]);
386386
return sum;
387387
}
388+
389+
namespace gh115175 {
390+
template<class T>
391+
int ValidateTemplateTypeExpressions(T t) {
392+
return sizeof(t.val) / sizeof(t.val[0]);
393+
}
394+
} // namespace gh115175

0 commit comments

Comments
 (0)