Skip to content

Commit d6f7526

Browse files
authored
Merge branch 'main' into main
2 parents 4250c1d + cccc9d3 commit d6f7526

File tree

373 files changed

+57371
-48323
lines changed

Some content is hidden

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

373 files changed

+57371
-48323
lines changed

bolt/lib/Core/GDBIndex.cpp

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,19 @@ void GDBIndex::updateGdbIndexSection(
100100
Data += SymbolTableOffset - CUTypesOffset;
101101

102102
// Calculate the size of the new address table.
103+
const auto IsValidAddressRange = [](const DebugAddressRange &Range) {
104+
return Range.HighPC > Range.LowPC;
105+
};
106+
103107
uint32_t NewAddressTableSize = 0;
104108
for (const auto &CURangesPair : ARangesSectionWriter.getCUAddressRanges()) {
105109
const SmallVector<DebugAddressRange, 2> &Ranges = CURangesPair.second;
106-
NewAddressTableSize += Ranges.size() * 20;
110+
NewAddressTableSize +=
111+
llvm::count_if(Ranges,
112+
[&IsValidAddressRange](const DebugAddressRange &Range) {
113+
return IsValidAddressRange(Range);
114+
}) *
115+
20;
107116
}
108117

109118
// Difference between old and new table (and section) sizes.
@@ -201,10 +210,15 @@ void GDBIndex::updateGdbIndexSection(
201210
const uint32_t UpdatedCUIndex = RemapCUIndex(OriginalCUIndex);
202211
const DebugAddressRangesVector &Ranges = CURangesPair.second;
203212
for (const DebugAddressRange &Range : Ranges) {
204-
write64le(Buffer, Range.LowPC);
205-
write64le(Buffer + 8, Range.HighPC);
206-
write32le(Buffer + 16, UpdatedCUIndex);
207-
Buffer += 20;
213+
// Don't emit ranges that break gdb,
214+
// https://sourceware.org/bugzilla/show_bug.cgi?id=33247.
215+
// We've seen [0, 0) ranges here, for instance.
216+
if (IsValidAddressRange(Range)) {
217+
write64le(Buffer, Range.LowPC);
218+
write64le(Buffer + 8, Range.HighPC);
219+
write32le(Buffer + 16, UpdatedCUIndex);
220+
Buffer += 20;
221+
}
208222
}
209223
}
210224

bolt/lib/Target/AArch64/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ add_llvm_library(LLVMBOLTTargetAArch64
2828
AArch64CommonTableGen
2929
)
3030

31-
target_link_libraries(LLVMBOLTTargetAArch64 PRIVATE LLVMBOLTCore)
31+
target_link_libraries(LLVMBOLTTargetAArch64 PRIVATE LLVMBOLTCore LLVMBOLTUtils)
3232

3333
include_directories(
3434
${LLVM_MAIN_SRC_DIR}/lib/Target/AArch64

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ void ThrowKeywordMissingCheck::registerMatchers(MatchFinder *Finder) {
2020
hasType(cxxRecordDecl(anyOf(
2121
matchesName("[Ee]xception|EXCEPTION"),
2222
hasAnyBase(hasType(hasCanonicalType(recordType(hasDeclaration(
23-
cxxRecordDecl(matchesName("[Ee]xception|EXCEPTION")))))))))),
23+
cxxRecordDecl(matchesName("[Ee]xception|EXCEPTION"))
24+
.bind("base"))))))))),
2425
unless(anyOf(
2526
hasAncestor(
2627
stmt(anyOf(cxxThrowExpr(), callExpr(), returnStmt()))),
@@ -39,6 +40,11 @@ void ThrowKeywordMissingCheck::check(const MatchFinder::MatchResult &Result) {
3940
diag(TemporaryExpr->getBeginLoc(), "suspicious exception object created but "
4041
"not thrown; did you mean 'throw %0'?")
4142
<< TemporaryExpr->getType().getBaseTypeIdentifier()->getName();
43+
44+
if (const auto *BaseDecl = Result.Nodes.getNodeAs<Decl>("base"))
45+
diag(BaseDecl->getLocation(),
46+
"object type inherits from base class declared here",
47+
DiagnosticIDs::Note);
4248
}
4349

4450
} // namespace clang::tidy::bugprone

clang-tools-extra/docs/ReleaseNotes.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,8 @@ Changes in existing checks
272272

273273
- Improved :doc:`bugprone-throw-keyword-missing
274274
<clang-tidy/checks/bugprone/throw-keyword-missing>` check by only considering
275-
the canonical types of base classes as written.
275+
the canonical types of base classes as written and adding a note on the base
276+
class that triggered the warning.
276277

277278
- Improved :doc:`bugprone-unchecked-optional-access
278279
<clang-tidy/checks/bugprone/unchecked-optional-access>` check by supporting

clang-tools-extra/docs/clang-tidy/Contributing.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ in the release notes, as the first sentence in the doxygen comments in the heade
436436
for your check class and as the first sentence of the check documentation. Avoid the
437437
phrase "this check" in your check summary and check documentation.
438438

439-
If your check relates to a published coding guideline (C++ Core Guidelines, MISRA, etc.)
439+
If your check relates to a published coding guideline (C++ Core Guidelines, SEI CERT, etc.)
440440
or style guide, provide links to the relevant guideline or style guide sections in your
441441
check documentation.
442442

clang-tools-extra/test/clang-tidy/checkers/bugprone/throw-keyword-missing.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ typedef basic_string<char> string;
2020
typedef basic_string<wchar_t> wstring;
2121

2222
// std::exception and std::runtime_error declaration.
23+
// CHECK-MESSAGES-DAG: [[#EXCEPTION_LINE:@LINE + 1]]:8
2324
struct exception {
2425
exception();
2526
exception(const exception &other);
@@ -50,12 +51,13 @@ struct RegularException {
5051

5152
void stdExceptionNotTrownTest(int i) {
5253
if (i < 0)
53-
// CHECK-MESSAGES: :[[@LINE+1]]:5: warning: suspicious exception object created but not thrown; did you mean 'throw {{.*}}'? [bugprone-throw-keyword-missing]
54+
// CHECK-MESSAGES-DAG: :[[@LINE+1]]:5: warning: suspicious exception object created but not thrown; did you mean 'throw {{.*}}'? [bugprone-throw-keyword-missing]
5455
std::exception();
5556

5657
if (i > 0)
57-
// CHECK-MESSAGES: :[[@LINE+1]]:5: warning: suspicious exception
58+
// CHECK-MESSAGES-DAG: :[[@LINE+1]]:5: warning: suspicious exception
5859
std::runtime_error("Unexpected argument");
60+
// CHECK-MESSAGES: note: object type inherits from base class declared here
5961
}
6062

6163
void stdExceptionThrownTest(int i) {
@@ -181,6 +183,7 @@ class RegularError : public ERROR_BASE {};
181183
void typedefTest() {
182184
// CHECK-MESSAGES: :[[@LINE+1]]:3: warning: suspicious exception
183185
RegularError();
186+
// CHECK-MESSAGES: :[[#EXCEPTION_LINE]]:8: note: object type inherits from base class declared here
184187
}
185188

186189
struct ExceptionRAII {

clang/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,12 @@ if(CLANG_BUILT_STANDALONE)
8080
include(GetErrcMessages)
8181
include(LLVMDistributionSupport)
8282

83+
if(CMAKE_CROSSCOMPILING)
84+
set(LLVM_USE_HOST_TOOLS ON)
85+
include(CrossCompile)
86+
llvm_create_cross_target(Clang NATIVE "" Release)
87+
endif()
88+
8389
set(PACKAGE_VERSION "${LLVM_PACKAGE_VERSION}")
8490
set(BUG_REPORT_URL "${LLVM_PACKAGE_BUGREPORT}" CACHE STRING
8591
"Default URL where bug reports are to be submitted.")

clang/docs/ReleaseNotes.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,7 @@ Crash and bug fixes
566566
- Fixed a crash in the static analyzer that when the expression in an
567567
``[[assume(expr)]]`` attribute was enclosed in parentheses. (#GH151529)
568568
- Fixed a crash when parsing ``#embed`` parameters with unmatched closing brackets. (#GH152829)
569+
- Fixed a crash when compiling ``__real__`` or ``__imag__`` unary operator on scalar value with type promotion. (#GH160583)
569570

570571
Improvements
571572
^^^^^^^^^^^^

clang/include/clang/AST/ASTContext.h

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,12 @@
2525
#include "clang/AST/RawCommentList.h"
2626
#include "clang/AST/SYCLKernelInfo.h"
2727
#include "clang/AST/TemplateName.h"
28+
#include "clang/AST/TypeOrdering.h"
2829
#include "clang/Basic/LLVM.h"
2930
#include "clang/Basic/PartialDiagnostic.h"
3031
#include "clang/Basic/SourceLocation.h"
3132
#include "llvm/ADT/DenseMap.h"
33+
#include "llvm/ADT/DenseMapInfo.h"
3234
#include "llvm/ADT/DenseSet.h"
3335
#include "llvm/ADT/FoldingSet.h"
3436
#include "llvm/ADT/IntrusiveRefCntPtr.h"
@@ -51,6 +53,36 @@ class FixedPointSemantics;
5153
struct fltSemantics;
5254
template <typename T, unsigned N> class SmallPtrSet;
5355

56+
struct ScalableVecTyKey {
57+
clang::QualType EltTy;
58+
unsigned NumElts;
59+
unsigned NumFields;
60+
61+
bool operator==(const ScalableVecTyKey &RHS) const {
62+
return EltTy == RHS.EltTy && NumElts == RHS.NumElts &&
63+
NumFields == RHS.NumFields;
64+
}
65+
};
66+
67+
// Provide a DenseMapInfo specialization so that ScalableVecTyKey can be used
68+
// as a key in DenseMap.
69+
template <> struct DenseMapInfo<ScalableVecTyKey> {
70+
static inline ScalableVecTyKey getEmptyKey() {
71+
return {DenseMapInfo<clang::QualType>::getEmptyKey(), ~0U, ~0U};
72+
}
73+
static inline ScalableVecTyKey getTombstoneKey() {
74+
return {DenseMapInfo<clang::QualType>::getTombstoneKey(), ~0U, ~0U};
75+
}
76+
static unsigned getHashValue(const ScalableVecTyKey &Val) {
77+
return hash_combine(DenseMapInfo<clang::QualType>::getHashValue(Val.EltTy),
78+
Val.NumElts, Val.NumFields);
79+
}
80+
static bool isEqual(const ScalableVecTyKey &LHS,
81+
const ScalableVecTyKey &RHS) {
82+
return LHS == RHS;
83+
}
84+
};
85+
5486
} // namespace llvm
5587

5688
namespace clang {
@@ -505,6 +537,9 @@ class ASTContext : public RefCountedBase<ASTContext> {
505537
SmallVector<const ObjCInterfaceDecl *, 4>>
506538
ObjCSubClasses;
507539

540+
// A mapping from Scalable Vector Type keys to their corresponding QualType.
541+
mutable llvm::DenseMap<llvm::ScalableVecTyKey, QualType> ScalableVecTyMap;
542+
508543
ASTContext &this_() { return *this; }
509544

510545
public:

clang/include/clang/Basic/DiagnosticCommonKinds.td

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,12 @@ def err_omp_more_one_clause : Error<
433433
"directive '#pragma omp %0' cannot contain more than one '%1' clause%select{| with '%3' name modifier| with 'source' dependence}2">;
434434
def err_omp_required_clause : Error<
435435
"directive '#pragma omp %0' requires the '%1' clause">;
436+
def warn_omp_gpu_unsupported_clause: Warning<
437+
"clause '%0' is currently not supported on a GPU; clause ignored">,
438+
InGroup<OpenMPClauses>;
439+
def warn_omp_gpu_unsupported_modifier_for_clause: Warning<
440+
"modifier '%0' is currently not supported on a GPU for the '%1' clause; modifier ignored">,
441+
InGroup<OpenMPClauses>;
436442

437443
// Static Analyzer Core
438444
def err_unknown_analyzer_checker_or_package : Error<

0 commit comments

Comments
 (0)