Skip to content

Commit 3337936

Browse files
committed
Merge remote-tracking branch 'upstream/release/21.x' into rustc/21.1-2025-08-01
2 parents 19f0a49 + 5a86dc9 commit 3337936

File tree

97 files changed

+5794
-2360
lines changed

Some content is hidden

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

97 files changed

+5794
-2360
lines changed

clang/cmake/caches/PGO.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ set(LLVM_ENABLE_PROJECTS "clang;lld" CACHE STRING "")
55
set(LLVM_ENABLE_RUNTIMES "compiler-rt;libcxx;libcxxabi;libunwind" CACHE STRING "")
66

77
set(LLVM_TARGETS_TO_BUILD Native CACHE STRING "")
8-
set(BOOTSTRAP_LLVM_BUILD_INSTRUMENTED ON CACHE BOOL "")
8+
set(BOOTSTRAP_LLVM_BUILD_INSTRUMENTED IR CACHE BOOL "")
99
set(CLANG_BOOTSTRAP_TARGETS
1010
generate-profdata
1111
stage2

clang/docs/ReleaseNotes.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -677,8 +677,8 @@ Improvements to Clang's diagnostics
677677
trigger a ``'Blue' is deprecated`` warning, which can be turned off with
678678
``-Wno-deprecated-declarations-switch-case``.
679679

680-
- Split diagnosis of implicit integer comparison on negation to a new
681-
diagnostic group ``-Wimplicit-int-comparison-on-negation``, grouped under
680+
- Split diagnosis of implicit integer conversion on negation to a new
681+
diagnostic group ``-Wimplicit-int-conversion-on-negation``, grouped under
682682
``-Wimplicit-int-conversion``, so user can turn it off independently.
683683

684684
- Improved the FixIts for unused lambda captures.

clang/docs/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ Using Clang as a Compiler
4545
BoundsSafetyImplPlans
4646
ControlFlowIntegrity
4747
LTOVisibility
48+
PointerAuthentication
4849
SafeStack
4950
ShadowCallStack
5051
SourceBasedCodeCoverage

clang/include/clang/AST/ASTContext.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -648,8 +648,7 @@ class ASTContext : public RefCountedBase<ASTContext> {
648648
bool containsNonRelocatablePointerAuth(QualType T) {
649649
if (!isPointerAuthenticationAvailable())
650650
return false;
651-
return findPointerAuthContent(T) ==
652-
PointerAuthContent::AddressDiscriminatedData;
651+
return findPointerAuthContent(T) != PointerAuthContent::None;
653652
}
654653

655654
private:

clang/lib/AST/ASTContext.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3032,7 +3032,7 @@ bool ASTContext::hasUniqueObjectRepresentations(
30323032
return true;
30333033
}
30343034

3035-
// All other pointers (except __ptrauth pointers) are unique.
3035+
// All other pointers are unique.
30363036
if (Ty->isPointerType())
30373037
return !Ty.hasAddressDiscriminatedPointerAuth();
30383038

clang/lib/AST/DeclCXX.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1448,6 +1448,13 @@ void CXXRecordDecl::addedMember(Decl *D) {
14481448
data().StructuralIfLiteral = false;
14491449
}
14501450

1451+
// If this type contains any address discriminated values we should
1452+
// have already indicated that the only special member functions that
1453+
// can possibly be trivial are the default constructor and destructor.
1454+
if (T.hasAddressDiscriminatedPointerAuth())
1455+
data().HasTrivialSpecialMembers &=
1456+
SMF_DefaultConstructor | SMF_Destructor;
1457+
14511458
// C++14 [meta.unary.prop]p4:
14521459
// T is a class type [...] with [...] no non-static data members other
14531460
// than subobjects of zero size

clang/lib/AST/ExprConstant.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7909,8 +7909,9 @@ static bool checkBitCastConstexprEligibilityType(SourceLocation Loc,
79097909
// so its layout is unspecified. For now, we'll simply treat these cases
79107910
// as unsupported (this should only be possible with OpenCL bool vectors
79117911
// whose element count isn't a multiple of the byte size).
7912-
Info->FFDiag(Loc, diag::note_constexpr_bit_cast_invalid_vector)
7913-
<< QualType(VTy, 0) << EltSize << NElts << Ctx.getCharWidth();
7912+
if (Info)
7913+
Info->FFDiag(Loc, diag::note_constexpr_bit_cast_invalid_vector)
7914+
<< QualType(VTy, 0) << EltSize << NElts << Ctx.getCharWidth();
79147915
return false;
79157916
}
79167917

@@ -7919,8 +7920,9 @@ static bool checkBitCastConstexprEligibilityType(SourceLocation Loc,
79197920
// The layout for x86_fp80 vectors seems to be handled very inconsistently
79207921
// by both clang and LLVM, so for now we won't allow bit_casts involving
79217922
// it in a constexpr context.
7922-
Info->FFDiag(Loc, diag::note_constexpr_bit_cast_unsupported_type)
7923-
<< EltTy;
7923+
if (Info)
7924+
Info->FFDiag(Loc, diag::note_constexpr_bit_cast_unsupported_type)
7925+
<< EltTy;
79247926
return false;
79257927
}
79267928
}

clang/lib/AST/Type.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2715,6 +2715,11 @@ bool QualType::isCXX98PODType(const ASTContext &Context) const {
27152715
return false;
27162716

27172717
QualType CanonicalType = getTypePtr()->CanonicalType;
2718+
2719+
// Any type that is, or contains, address discriminated data is never POD.
2720+
if (const_cast<ASTContext&>(Context).containsAddressDiscriminatedPointerAuth(CanonicalType))
2721+
return false;
2722+
27182723
switch (CanonicalType->getTypeClass()) {
27192724
// Everything not explicitly mentioned is not POD.
27202725
default:
@@ -2773,6 +2778,11 @@ bool QualType::isTrivialType(const ASTContext &Context) const {
27732778
if (CanonicalType->isDependentType())
27742779
return false;
27752780

2781+
// Any type that is, or contains, address discriminated data is never a
2782+
// trivial type.
2783+
if (const_cast<ASTContext&>(Context).containsAddressDiscriminatedPointerAuth(CanonicalType))
2784+
return false;
2785+
27762786
// C++0x [basic.types]p9:
27772787
// Scalar types, trivial class types, arrays of such types, and
27782788
// cv-qualified versions of these types are collectively called trivial
@@ -2870,6 +2880,12 @@ bool QualType::isBitwiseCloneableType(const ASTContext &Context) const {
28702880

28712881
if (CanonicalType->isIncompleteType())
28722882
return false;
2883+
2884+
// Any type that is, or contains, address discriminated data is never
2885+
// bitwise clonable.
2886+
if (const_cast<ASTContext&>(Context).containsAddressDiscriminatedPointerAuth(CanonicalType))
2887+
return false;
2888+
28732889
const auto *RD = CanonicalType->getAsRecordDecl(); // struct/union/class
28742890
if (!RD)
28752891
return true;
@@ -3115,6 +3131,10 @@ bool QualType::isCXX11PODType(const ASTContext &Context) const {
31153131
if (BaseTy->isIncompleteType())
31163132
return false;
31173133

3134+
// Any type that is, or contains, address discriminated data is non-POD.
3135+
if (const_cast<ASTContext&>(Context).containsAddressDiscriminatedPointerAuth(*this))
3136+
return false;
3137+
31183138
// As an extension, Clang treats vector types as Scalar types.
31193139
if (BaseTy->isScalarType() || BaseTy->isVectorType())
31203140
return true;

clang/lib/CodeGen/CGCall.cpp

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4787,19 +4787,6 @@ struct DestroyUnpassedArg final : EHScopeStack::Cleanup {
47874787
}
47884788
};
47894789

4790-
struct DisableDebugLocationUpdates {
4791-
CodeGenFunction &CGF;
4792-
bool disabledDebugInfo;
4793-
DisableDebugLocationUpdates(CodeGenFunction &CGF, const Expr *E) : CGF(CGF) {
4794-
if ((disabledDebugInfo = isa<CXXDefaultArgExpr>(E) && CGF.getDebugInfo()))
4795-
CGF.disableDebugInfo();
4796-
}
4797-
~DisableDebugLocationUpdates() {
4798-
if (disabledDebugInfo)
4799-
CGF.enableDebugInfo();
4800-
}
4801-
};
4802-
48034790
} // end anonymous namespace
48044791

48054792
RValue CallArg::getRValue(CodeGenFunction &CGF) const {
@@ -4836,7 +4823,9 @@ void CodeGenFunction::EmitWritebacks(const CallArgList &args) {
48364823

48374824
void CodeGenFunction::EmitCallArg(CallArgList &args, const Expr *E,
48384825
QualType type) {
4839-
DisableDebugLocationUpdates Dis(*this, E);
4826+
std::optional<DisableDebugLocationUpdates> Dis;
4827+
if (isa<CXXDefaultArgExpr>(E))
4828+
Dis.emplace(*this);
48404829
if (const ObjCIndirectCopyRestoreExpr *CRE =
48414830
dyn_cast<ObjCIndirectCopyRestoreExpr>(E)) {
48424831
assert(getLangOpts().ObjCAutoRefCount);
@@ -6229,3 +6218,12 @@ RValue CodeGenFunction::EmitVAArg(VAArgExpr *VE, Address &VAListAddr,
62296218
return CGM.getABIInfo().EmitMSVAArg(*this, VAListAddr, Ty, Slot);
62306219
return CGM.getABIInfo().EmitVAArg(*this, VAListAddr, Ty, Slot);
62316220
}
6221+
6222+
DisableDebugLocationUpdates::DisableDebugLocationUpdates(CodeGenFunction &CGF)
6223+
: CGF(CGF) {
6224+
CGF.disableDebugInfo();
6225+
}
6226+
6227+
DisableDebugLocationUpdates::~DisableDebugLocationUpdates() {
6228+
CGF.enableDebugInfo();
6229+
}

clang/lib/CodeGen/CGCall.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,12 @@ inline FnInfoOpts &operator&=(FnInfoOpts &A, FnInfoOpts B) {
457457
return A;
458458
}
459459

460+
struct DisableDebugLocationUpdates {
461+
CodeGenFunction &CGF;
462+
DisableDebugLocationUpdates(CodeGenFunction &CGF);
463+
~DisableDebugLocationUpdates();
464+
};
465+
460466
} // end namespace CodeGen
461467
} // end namespace clang
462468

0 commit comments

Comments
 (0)