Skip to content

Commit 5a27cc5

Browse files
authored
Merge branch 'main' into users/ojhunt/webkit-refptr-binding
2 parents 39602d1 + e42ab4c commit 5a27cc5

File tree

143 files changed

+2250
-1608
lines changed

Some content is hidden

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

143 files changed

+2250
-1608
lines changed

bolt/test/X86/Inputs/define_bar.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Mocks a vtable object weak def in the C++ stdlib.
2-
.data.rel.ro
2+
.section .data.rel.ro,"aw"
33
.weak bar
44
.type bar, %object
55
bar:

clang-tools-extra/docs/ReleaseNotes.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,8 @@ Changes in existing checks
122122
- Improved :doc:`misc-const-correctness
123123
<clang-tidy/checks/misc/const-correctness>` check by adding the option
124124
`AllowedTypes`, that excludes specified types from const-correctness
125-
checking.
125+
checking and fixing false positives when modifying variant by ``operator[]``
126+
with template in parameters.
126127

127128
- Improved :doc:`misc-redundant-expression
128129
<clang-tidy/checks/misc/redundant-expression>` check by providing additional

clang-tools-extra/test/clang-tidy/checkers/misc/const-correctness-values.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -998,3 +998,11 @@ void member_pointer_const(Value &x, PointerToConstMemberFunction m) {
998998
// CHECK-MESSAGES:[[@LINE-1]]:3: warning: variable 'member_pointer_tmp' of type 'Value &' can be declared 'const'
999999
(member_pointer_tmp.*m)();
10001000
}
1001+
1002+
namespace gh127776_false_positive {
1003+
template <class T> struct vector { T &operator[](int t); };
1004+
template <typename T> void f() {
1005+
vector<int> x;
1006+
x[T{}] = 3;
1007+
}
1008+
} // namespace gh127776_false_positive

clang/cmake/caches/BOLT.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
set(CMAKE_BUILD_TYPE Release CACHE STRING "")
22
set(CLANG_BOLT "INSTRUMENT" CACHE STRING "")
33
set(CMAKE_EXE_LINKER_FLAGS "-Wl,--emit-relocs,-znow" CACHE STRING "")
4+
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--emit-relocs,-znow" CACHE STRING "")
45

56
set(LLVM_ENABLE_PROJECTS "bolt;clang" CACHE STRING "")
67
set(LLVM_TARGETS_TO_BUILD Native CACHE STRING "")

clang/docs/ReleaseNotes.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ Non-comprehensive list of changes in this release
114114
New Compiler Flags
115115
------------------
116116

117+
- New option ``-Wundef-true`` added and enabled by default to warn when `true` is used in the C preprocessor without being defined before C23.
118+
117119
- New option ``-fprofile-continuous`` added to enable continuous profile syncing to file (#GH124353, `docs <https://clang.llvm.org/docs/UsersManual.html#cmdoption-fprofile-continuous>`_).
118120
The feature has `existed <https://clang.llvm.org/docs/SourceBasedCodeCoverage.html#running-the-instrumented-program>`_)
119121
for a while and this is just a user facing option.

clang/include/clang/Basic/DiagnosticGroups.td

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -791,6 +791,8 @@ def ReservedIdAsMacroAlias : DiagGroup<"reserved-id-macro", [ReservedIdAsMacro]>
791791
def ReservedAttributeIdentifier : DiagGroup<"reserved-attribute-identifier">;
792792
def RestrictExpansionMacro : DiagGroup<"restrict-expansion">;
793793
def FinalMacro : DiagGroup<"final-macro">;
794+
def UndefinedTrueIdentifier : DiagGroup<"undef-true">;
795+
def UndefinedIdentifier : DiagGroup<"undef", [UndefinedTrueIdentifier]>;
794796

795797
// Just silence warnings about -Wstrict-aliasing for now.
796798
def : DiagGroup<"strict-aliasing=0">;

clang/include/clang/Basic/DiagnosticLexKinds.td

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,10 @@ def pp_macro_not_used : Warning<"macro is not used">, DefaultIgnore,
392392
InGroup<DiagGroup<"unused-macros">>;
393393
def warn_pp_undef_identifier : Warning<
394394
"%0 is not defined, evaluates to 0">,
395-
InGroup<DiagGroup<"undef">>, DefaultIgnore;
395+
InGroup<UndefinedIdentifier>, DefaultIgnore;
396+
def warn_pp_undef_true_identifier : Warning<
397+
"'true' is not defined, evaluates to 0">,
398+
InGroup<UndefinedTrueIdentifier>;
396399
def warn_pp_undef_prefix : Warning<
397400
"%0 is not defined, evaluates to 0">,
398401
InGroup<DiagGroup<"undef-prefix">>, DefaultIgnore;

clang/lib/AST/ByteCode/Descriptor.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,10 +367,12 @@ Descriptor::Descriptor(const DeclTy &D, PrimType Type, MetadataSize MD,
367367
}
368368

369369
/// Arrays of composite elements.
370-
Descriptor::Descriptor(const DeclTy &D, const Descriptor *Elem, MetadataSize MD,
370+
Descriptor::Descriptor(const DeclTy &D, const Type *SourceTy,
371+
const Descriptor *Elem, MetadataSize MD,
371372
unsigned NumElems, bool IsConst, bool IsTemporary,
372373
bool IsMutable)
373-
: Source(D), ElemSize(Elem->getAllocSize() + sizeof(InlineDescriptor)),
374+
: Source(D), SourceType(SourceTy),
375+
ElemSize(Elem->getAllocSize() + sizeof(InlineDescriptor)),
374376
Size(ElemSize * NumElems), MDSize(MD.value_or(0)),
375377
AllocSize(std::max<size_t>(alignof(void *), Size) + MDSize),
376378
ElemDesc(Elem), IsConst(IsConst), IsMutable(IsMutable),
@@ -410,6 +412,8 @@ Descriptor::Descriptor(const DeclTy &D)
410412
}
411413

412414
QualType Descriptor::getType() const {
415+
if (SourceType)
416+
return QualType(SourceType, 0);
413417
if (const auto *D = asValueDecl())
414418
return D->getType();
415419
if (const auto *T = dyn_cast_if_present<TypeDecl>(asDecl()))

clang/lib/AST/ByteCode/Descriptor.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ struct Descriptor final {
124124
private:
125125
/// Original declaration, used to emit the error message.
126126
const DeclTy Source;
127+
const Type *SourceType = nullptr;
127128
/// Size of an element, in host bytes.
128129
const unsigned ElemSize;
129130
/// Size of the storage, in host bytes.
@@ -186,8 +187,9 @@ struct Descriptor final {
186187
bool IsTemporary, UnknownSize);
187188

188189
/// Allocates a descriptor for an array of composites.
189-
Descriptor(const DeclTy &D, const Descriptor *Elem, MetadataSize MD,
190-
unsigned NumElems, bool IsConst, bool IsTemporary, bool IsMutable);
190+
Descriptor(const DeclTy &D, const Type *SourceTy, const Descriptor *Elem,
191+
MetadataSize MD, unsigned NumElems, bool IsConst, bool IsTemporary,
192+
bool IsMutable);
191193

192194
/// Allocates a descriptor for an array of composites of unknown size.
193195
Descriptor(const DeclTy &D, const Descriptor *Elem, MetadataSize MD,

clang/lib/AST/ByteCode/DynamicAllocator.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,10 @@ Block *DynamicAllocator::allocate(const Descriptor *ElementDesc,
5757
assert(ElementDesc->getMetadataSize() == 0);
5858
// Create a new descriptor for an array of the specified size and
5959
// element type.
60+
// FIXME: Pass proper element type.
6061
const Descriptor *D = allocateDescriptor(
61-
ElementDesc->asExpr(), ElementDesc, Descriptor::InlineDescMD, NumElements,
62+
ElementDesc->asExpr(), nullptr, ElementDesc, Descriptor::InlineDescMD,
63+
NumElements,
6264
/*IsConst=*/false, /*IsTemporary=*/false, /*IsMutable=*/false);
6365
return allocate(D, EvalID, AllocForm);
6466
}

0 commit comments

Comments
 (0)