Skip to content

Commit ef5bb1a

Browse files
committed
[𝘀𝗽𝗿] landed version
Created using spr 1.3.6-beta.1
2 parents 1c579a5 + 3d864c4 commit ef5bb1a

File tree

336 files changed

+9032
-5077
lines changed

Some content is hidden

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

336 files changed

+9032
-5077
lines changed

clang-tools-extra/clangd/TidyProvider.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ TidyProvider disableUnusableChecks(llvm::ArrayRef<std::string> ExtraBadChecks) {
210210
// Check relies on seeing ifndef/define/endif directives,
211211
// clangd doesn't replay those when using a preamble.
212212
"-llvm-header-guard", "-modernize-macro-to-enum",
213+
"-cppcoreguidelines-macro-to-enum",
213214

214215
// ----- Crashing Checks -----
215216

clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -823,6 +823,21 @@ TEST(DiagnosticTest, ClangTidyNoLiteralDataInMacroToken) {
823823
EXPECT_THAT(TU.build().getDiagnostics(), UnorderedElementsAre()); // no-crash
824824
}
825825

826+
TEST(DiagnosticTest, ClangTidyMacroToEnumCheck) {
827+
Annotations Main(R"cpp(
828+
#if 1
829+
auto foo();
830+
#endif
831+
)cpp");
832+
TestTU TU = TestTU::withCode(Main.code());
833+
std::vector<TidyProvider> Providers;
834+
Providers.push_back(
835+
addTidyChecks("cppcoreguidelines-macro-to-enum,modernize-macro-to-enum"));
836+
Providers.push_back(disableUnusableChecks());
837+
TU.ClangTidyProvider = combine(std::move(Providers));
838+
EXPECT_THAT(TU.build().getDiagnostics(), UnorderedElementsAre()); // no-crash
839+
}
840+
826841
TEST(DiagnosticTest, ElseAfterReturnRange) {
827842
Annotations Main(R"cpp(
828843
int foo(int cond) {

clang/docs/ReleaseNotes.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ Potentially Breaking Changes
3535
============================
3636

3737
- The Objective-C ARC migrator (ARCMigrate) has been removed.
38+
- Fix missing diagnostics for uses of declarations when performing typename access,
39+
such as when performing member access on a '[[deprecated]]' type alias.
40+
(#GH58547)
3841

3942
C/C++ Language Potentially Breaking Changes
4043
-------------------------------------------
@@ -308,6 +311,8 @@ Android Support
308311
Windows Support
309312
^^^^^^^^^^^^^^^
310313

314+
- Clang now supports MSVC vector deleting destructors (GH19772).
315+
311316
LoongArch Support
312317
^^^^^^^^^^^^^^^^^
313318

clang/include/clang/AST/VTableBuilder.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ class VTableComponent {
150150

151151
bool isRTTIKind() const { return isRTTIKind(getKind()); }
152152

153-
GlobalDecl getGlobalDecl() const {
153+
GlobalDecl getGlobalDecl(bool HasVectorDeletingDtors) const {
154154
assert(isUsedFunctionPointerKind() &&
155155
"GlobalDecl can be created only from virtual function");
156156

@@ -161,7 +161,9 @@ class VTableComponent {
161161
case CK_CompleteDtorPointer:
162162
return GlobalDecl(DtorDecl, CXXDtorType::Dtor_Complete);
163163
case CK_DeletingDtorPointer:
164-
return GlobalDecl(DtorDecl, CXXDtorType::Dtor_Deleting);
164+
return GlobalDecl(DtorDecl, (HasVectorDeletingDtors)
165+
? CXXDtorType::Dtor_VectorDeleting
166+
: CXXDtorType::Dtor_Deleting);
165167
case CK_VCallOffset:
166168
case CK_VBaseOffset:
167169
case CK_OffsetToTop:

clang/include/clang/Basic/ABI.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,11 @@ enum CXXCtorType {
3131

3232
/// C++ destructor types.
3333
enum CXXDtorType {
34-
Dtor_Deleting, ///< Deleting dtor
35-
Dtor_Complete, ///< Complete object dtor
36-
Dtor_Base, ///< Base object dtor
37-
Dtor_Comdat ///< The COMDAT used for dtors
34+
Dtor_Deleting, ///< Deleting dtor
35+
Dtor_Complete, ///< Complete object dtor
36+
Dtor_Base, ///< Base object dtor
37+
Dtor_Comdat, ///< The COMDAT used for dtors
38+
Dtor_VectorDeleting ///< Vector deleting dtor
3839
};
3940

4041
} // end namespace clang

clang/include/clang/Sema/Sema.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3168,6 +3168,13 @@ class Sema final : public SemaBase {
31683168

31693169
DeclGroupPtrTy ConvertDeclToDeclGroup(Decl *Ptr, Decl *OwnedType = nullptr);
31703170

3171+
enum class DiagCtorKind { None, Implicit, Typename };
3172+
/// Returns the TypeDeclType for the given type declaration,
3173+
/// as ASTContext::getTypeDeclType would, but
3174+
/// performs the required semantic checks for name lookup of said entity.
3175+
QualType getTypeDeclType(DeclContext *LookupCtx, DiagCtorKind DCK,
3176+
TypeDecl *TD, SourceLocation NameLoc);
3177+
31713178
/// If the identifier refers to a type name within this scope,
31723179
/// return the declaration of that type.
31733180
///

clang/lib/AST/ByteCode/Compiler.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2843,6 +2843,8 @@ bool Compiler<Emitter>::VisitLambdaExpr(const LambdaExpr *E) {
28432843

28442844
assert(Initializing);
28452845
const Record *R = P.getOrCreateRecord(E->getLambdaClass());
2846+
if (!R)
2847+
return false;
28462848

28472849
auto *CaptureInitIt = E->capture_init_begin();
28482850
// Initialize all fields (which represent lambda captures) of the
@@ -4087,9 +4089,8 @@ bool Compiler<Emitter>::visitZeroRecordInitializer(const Record *R,
40874089
} else if (D->isRecord()) {
40884090
if (!this->visitZeroRecordInitializer(D->ElemRecord, E))
40894091
return false;
4090-
} else {
4091-
assert(false);
4092-
}
4092+
} else
4093+
return false;
40934094

40944095
if (!this->emitFinishInitPop(E))
40954096
return false;

clang/lib/AST/ByteCode/Descriptor.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -404,10 +404,10 @@ Descriptor::Descriptor(const DeclTy &D, const Record *R, MetadataSize MD,
404404
}
405405

406406
/// Dummy.
407-
Descriptor::Descriptor(const DeclTy &D)
408-
: Source(D), ElemSize(1), Size(1), MDSize(0), AllocSize(MDSize),
409-
ElemRecord(nullptr), IsConst(true), IsMutable(false), IsTemporary(false),
410-
IsDummy(true) {
407+
Descriptor::Descriptor(const DeclTy &D, MetadataSize MD)
408+
: Source(D), ElemSize(1), Size(1), MDSize(MD.value_or(0)),
409+
AllocSize(MDSize), ElemRecord(nullptr), IsConst(true), IsMutable(false),
410+
IsTemporary(false), IsDummy(true) {
411411
assert(Source && "Missing source");
412412
}
413413

clang/lib/AST/ByteCode/Descriptor.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ struct Descriptor final {
200200
bool IsTemporary, bool IsMutable);
201201

202202
/// Allocates a dummy descriptor.
203-
Descriptor(const DeclTy &D);
203+
Descriptor(const DeclTy &D, MetadataSize MD = std::nullopt);
204204

205205
/// Make this descriptor a dummy descriptor.
206206
void makeDummy() { IsDummy = true; }
@@ -263,7 +263,7 @@ struct Descriptor final {
263263
bool isUnknownSizeArray() const { return Size == UnknownSizeMark; }
264264

265265
/// Checks if the descriptor is of a primitive.
266-
bool isPrimitive() const { return !IsArray && !ElemRecord; }
266+
bool isPrimitive() const { return !IsArray && !ElemRecord && !IsDummy; }
267267

268268
/// Checks if the descriptor is of an array.
269269
bool isArray() const { return IsArray; }

clang/lib/AST/ByteCode/Interp.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -551,8 +551,8 @@ bool CheckInitialized(InterpState &S, CodePtr OpPC, const Pointer &Ptr,
551551

552552
if (const auto *VD = Ptr.getDeclDesc()->asVarDecl();
553553
VD && (VD->isConstexpr() || VD->hasGlobalStorage())) {
554-
const SourceInfo &Loc = S.Current->getSource(OpPC);
555554
if (VD->getAnyInitializer()) {
555+
const SourceInfo &Loc = S.Current->getSource(OpPC);
556556
S.FFDiag(Loc, diag::note_constexpr_var_init_non_constant, 1) << VD;
557557
S.Note(VD->getLocation(), diag::note_declared_at);
558558
} else {
@@ -722,7 +722,6 @@ bool CheckCallable(InterpState &S, CodePtr OpPC, const Function *F) {
722722
if (F->isLambdaStaticInvoker())
723723
return true;
724724

725-
const SourceLocation &Loc = S.Current->getLocation(OpPC);
726725
if (S.getLangOpts().CPlusPlus11) {
727726
const FunctionDecl *DiagDecl = F->getDecl();
728727

@@ -748,7 +747,8 @@ bool CheckCallable(InterpState &S, CodePtr OpPC, const Function *F) {
748747
// or an inheriting constructor, we should be much more explicit about why
749748
// it's not constexpr.
750749
if (CD && CD->isInheritingConstructor()) {
751-
S.FFDiag(Loc, diag::note_constexpr_invalid_inhctor, 1)
750+
S.FFDiag(S.Current->getLocation(OpPC),
751+
diag::note_constexpr_invalid_inhctor, 1)
752752
<< CD->getInheritedConstructor().getConstructor()->getParent();
753753
S.Note(DiagDecl->getLocation(), diag::note_declared_at);
754754
} else {
@@ -766,7 +766,8 @@ bool CheckCallable(InterpState &S, CodePtr OpPC, const Function *F) {
766766
DiagDecl->hasBody())
767767
return false;
768768

769-
S.FFDiag(Loc, diag::note_constexpr_invalid_function, 1)
769+
S.FFDiag(S.Current->getLocation(OpPC),
770+
diag::note_constexpr_invalid_function, 1)
770771
<< DiagDecl->isConstexpr() << (bool)CD << DiagDecl;
771772

772773
if (DiagDecl->getDefinition())
@@ -776,7 +777,8 @@ bool CheckCallable(InterpState &S, CodePtr OpPC, const Function *F) {
776777
S.Note(DiagDecl->getLocation(), diag::note_declared_at);
777778
}
778779
} else {
779-
S.FFDiag(Loc, diag::note_invalid_subexpr_in_const_expr);
780+
S.FFDiag(S.Current->getLocation(OpPC),
781+
diag::note_invalid_subexpr_in_const_expr);
780782
}
781783

782784
return false;
@@ -980,11 +982,6 @@ bool CheckNonNullArgs(InterpState &S, CodePtr OpPC, const Function *F,
980982
return true;
981983
}
982984

983-
// FIXME: This is similar to code we already have in Compiler.cpp.
984-
// I think it makes sense to instead add the field and base destruction stuff
985-
// to the destructor Function itself. Then destroying a record would really
986-
// _just_ be calling its destructor. That would also help with the diagnostic
987-
// difference when the destructor or a field/base fails.
988985
static bool runRecordDestructor(InterpState &S, CodePtr OpPC,
989986
const Pointer &BasePtr,
990987
const Descriptor *Desc) {
@@ -1095,8 +1092,8 @@ bool Free(InterpState &S, CodePtr OpPC, bool DeleteIsArrayForm,
10951092

10961093
// For a class type with a virtual destructor, the selected operator delete
10971094
// is the one looked up when building the destructor.
1098-
QualType AllocType = Ptr.getType();
10991095
if (!DeleteIsArrayForm && !IsGlobalDelete) {
1096+
QualType AllocType = Ptr.getType();
11001097
auto getVirtualOperatorDelete = [](QualType T) -> const FunctionDecl * {
11011098
if (const CXXRecordDecl *RD = T->getAsCXXRecordDecl())
11021099
if (const CXXDestructorDecl *DD = RD->getDestructor())
@@ -1344,6 +1341,9 @@ bool Call(InterpState &S, CodePtr OpPC, const Function *Func,
13441341
} else {
13451342
if (!CheckInvoke(S, OpPC, ThisPtr))
13461343
return cleanup();
1344+
if (!Func->isConstructor() &&
1345+
!CheckActive(S, OpPC, ThisPtr, AK_MemberCall))
1346+
return false;
13471347
}
13481348

13491349
if (Func->isConstructor() && !checkConstructor(S, OpPC, Func, ThisPtr))
@@ -1515,7 +1515,7 @@ bool CallPtr(InterpState &S, CodePtr OpPC, uint32_t ArgSize,
15151515
// This happens when the call expression has been cast to
15161516
// something else, but we don't support that.
15171517
if (S.Ctx.classify(F->getDecl()->getReturnType()) !=
1518-
S.Ctx.classify(CE->getType()))
1518+
S.Ctx.classify(CE->getCallReturnType(S.getASTContext())))
15191519
return false;
15201520

15211521
// Check argument nullability state.

0 commit comments

Comments
 (0)