aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Sema
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r--clang/lib/Sema/CheckExprLifetime.cpp16
-rw-r--r--clang/lib/Sema/SemaAvailability.cpp4
-rw-r--r--clang/lib/Sema/SemaBPF.cpp2
-rw-r--r--clang/lib/Sema/SemaCXXScopeSpec.cpp5
-rw-r--r--clang/lib/Sema/SemaCast.cpp6
-rw-r--r--clang/lib/Sema/SemaChecking.cpp9
-rw-r--r--clang/lib/Sema/SemaCodeComplete.cpp2
-rw-r--r--clang/lib/Sema/SemaConcept.cpp13
-rw-r--r--clang/lib/Sema/SemaCoroutine.cpp7
-rw-r--r--clang/lib/Sema/SemaDeclAttr.cpp18
-rw-r--r--clang/lib/Sema/SemaDeclCXX.cpp9
-rw-r--r--clang/lib/Sema/SemaDeclObjC.cpp6
-rw-r--r--clang/lib/Sema/SemaExpr.cpp18
-rw-r--r--clang/lib/Sema/SemaExprCXX.cpp5
-rw-r--r--clang/lib/Sema/SemaExprObjC.cpp3
-rw-r--r--clang/lib/Sema/SemaHLSL.cpp4
-rw-r--r--clang/lib/Sema/SemaInit.cpp11
-rw-r--r--clang/lib/Sema/SemaLookup.cpp11
-rw-r--r--clang/lib/Sema/SemaObjC.cpp4
-rw-r--r--clang/lib/Sema/SemaOpenACCClause.cpp2
-rw-r--r--clang/lib/Sema/SemaOverload.cpp12
-rw-r--r--clang/lib/Sema/SemaSYCL.cpp4
-rw-r--r--clang/lib/Sema/SemaStmt.cpp12
-rw-r--r--clang/lib/Sema/SemaStmtAsm.cpp2
-rw-r--r--clang/lib/Sema/SemaTemplate.cpp30
-rw-r--r--clang/lib/Sema/SemaTemplateDeduction.cpp8
-rw-r--r--clang/lib/Sema/SemaTemplateDeductionGuide.cpp7
-rw-r--r--clang/lib/Sema/SemaTemplateInstantiate.cpp4
-rw-r--r--clang/lib/Sema/SemaTemplateInstantiateDecl.cpp8
-rw-r--r--clang/lib/Sema/SemaType.cpp8
-rw-r--r--clang/lib/Sema/SemaTypeTraits.cpp42
-rw-r--r--clang/lib/Sema/TreeTransform.h4
32 files changed, 143 insertions, 153 deletions
diff --git a/clang/lib/Sema/CheckExprLifetime.cpp b/clang/lib/Sema/CheckExprLifetime.cpp
index db14349..e797400 100644
--- a/clang/lib/Sema/CheckExprLifetime.cpp
+++ b/clang/lib/Sema/CheckExprLifetime.cpp
@@ -361,11 +361,11 @@ static bool shouldTrackImplicitObjectArg(const CXXMethodDecl *Callee) {
if (!Callee->getIdentifier())
return false;
return llvm::StringSwitch<bool>(Callee->getName())
- .Cases("begin", "rbegin", "cbegin", "crbegin", true)
- .Cases("end", "rend", "cend", "crend", true)
- .Cases("c_str", "data", "get", true)
+ .Cases({"begin", "rbegin", "cbegin", "crbegin"}, true)
+ .Cases({"end", "rend", "cend", "crend"}, true)
+ .Cases({"c_str", "data", "get"}, true)
// Map and set types.
- .Cases("find", "equal_range", "lower_bound", "upper_bound", true)
+ .Cases({"find", "equal_range", "lower_bound", "upper_bound"}, true)
.Default(false);
}
if (Callee->getReturnType()->isReferenceType()) {
@@ -377,7 +377,7 @@ static bool shouldTrackImplicitObjectArg(const CXXMethodDecl *Callee) {
OO == OverloadedOperatorKind::OO_Star;
}
return llvm::StringSwitch<bool>(Callee->getName())
- .Cases("front", "back", "at", "top", "value", true)
+ .Cases({"front", "back", "at", "top", "value"}, true)
.Default(false);
}
return false;
@@ -394,14 +394,14 @@ static bool shouldTrackFirstArgument(const FunctionDecl *FD) {
if (FD->getReturnType()->isPointerType() ||
isRecordWithAttr<PointerAttr>(FD->getReturnType())) {
return llvm::StringSwitch<bool>(FD->getName())
- .Cases("begin", "rbegin", "cbegin", "crbegin", true)
- .Cases("end", "rend", "cend", "crend", true)
+ .Cases({"begin", "rbegin", "cbegin", "crbegin"}, true)
+ .Cases({"end", "rend", "cend", "crend"}, true)
.Case("data", true)
.Default(false);
}
if (FD->getReturnType()->isReferenceType()) {
return llvm::StringSwitch<bool>(FD->getName())
- .Cases("get", "any_cast", true)
+ .Cases({"get", "any_cast"}, true)
.Default(false);
}
return false;
diff --git a/clang/lib/Sema/SemaAvailability.cpp b/clang/lib/Sema/SemaAvailability.cpp
index f8d61d9..b09e168 100644
--- a/clang/lib/Sema/SemaAvailability.cpp
+++ b/clang/lib/Sema/SemaAvailability.cpp
@@ -102,7 +102,7 @@ Sema::ShouldDiagnoseAvailabilityOfDecl(const NamedDecl *D, std::string *Message,
break;
for (const Type *T = TD->getUnderlyingType().getTypePtr(); /**/; /**/) {
if (auto *TT = dyn_cast<TagType>(T)) {
- D = TT->getOriginalDecl()->getDefinitionOrSelf();
+ D = TT->getDecl()->getDefinitionOrSelf();
} else if (isa<SubstTemplateTypeParmType>(T)) {
// A Subst* node represents a use through a template.
// Any uses of the underlying declaration happened through it's template
@@ -1019,7 +1019,7 @@ bool DiagnoseUnguardedAvailability::VisitTypeLoc(TypeLoc Ty) {
return true;
if (const auto *TT = dyn_cast<TagType>(TyPtr)) {
- TagDecl *TD = TT->getOriginalDecl()->getDefinitionOrSelf();
+ TagDecl *TD = TT->getDecl()->getDefinitionOrSelf();
DiagnoseDeclAvailability(TD, Range);
} else if (const auto *TD = dyn_cast<TypedefType>(TyPtr)) {
diff --git a/clang/lib/Sema/SemaBPF.cpp b/clang/lib/Sema/SemaBPF.cpp
index be890ab..a9761764 100644
--- a/clang/lib/Sema/SemaBPF.cpp
+++ b/clang/lib/Sema/SemaBPF.cpp
@@ -57,7 +57,7 @@ static bool isValidPreserveTypeInfoArg(Expr *Arg) {
// Record type or Enum type.
if (const auto *RT = ArgType->getAsCanonical<TagType>())
- if (!RT->getOriginalDecl()->getDeclName().isEmpty())
+ if (!RT->getDecl()->getDeclName().isEmpty())
return true;
return false;
diff --git a/clang/lib/Sema/SemaCXXScopeSpec.cpp b/clang/lib/Sema/SemaCXXScopeSpec.cpp
index 97ba1a51..c52fc5b 100644
--- a/clang/lib/Sema/SemaCXXScopeSpec.cpp
+++ b/clang/lib/Sema/SemaCXXScopeSpec.cpp
@@ -31,8 +31,7 @@ static CXXRecordDecl *getCurrentInstantiationOf(QualType T,
const TagType *TagTy = dyn_cast<TagType>(T->getCanonicalTypeInternal());
if (!isa_and_present<RecordType, InjectedClassNameType>(TagTy))
return nullptr;
- auto *RD =
- cast<CXXRecordDecl>(TagTy->getOriginalDecl())->getDefinitionOrSelf();
+ auto *RD = cast<CXXRecordDecl>(TagTy->getDecl())->getDefinitionOrSelf();
if (isa<InjectedClassNameType>(TagTy) ||
RD->isCurrentInstantiation(CurContext))
return RD;
@@ -121,7 +120,7 @@ DeclContext *Sema::computeDeclContext(const CXXScopeSpec &SS,
}
} else if (const auto *RecordT = dyn_cast<RecordType>(NNSType)) {
// The nested name specifier refers to a member of a class template.
- return RecordT->getOriginalDecl()->getDefinitionOrSelf();
+ return RecordT->getDecl()->getDefinitionOrSelf();
}
}
diff --git a/clang/lib/Sema/SemaCast.cpp b/clang/lib/Sema/SemaCast.cpp
index d986e3b..ddf17d8 100644
--- a/clang/lib/Sema/SemaCast.cpp
+++ b/clang/lib/Sema/SemaCast.cpp
@@ -962,7 +962,7 @@ void CastOperation::CheckDynamicCast() {
}
// C++ 5.2.7p6: Otherwise, v shall be [polymorphic].
- const RecordDecl *SrcDecl = SrcRecord->getOriginalDecl()->getDefinition();
+ const RecordDecl *SrcDecl = SrcRecord->getDecl()->getDefinition();
assert(SrcDecl && "Definition missing");
if (!cast<CXXRecordDecl>(SrcDecl)->isPolymorphic()) {
Self.Diag(OpRange.getBegin(), diag::err_bad_dynamic_cast_not_polymorphic)
@@ -1453,7 +1453,7 @@ static TryCastResult TryStaticCast(Sema &Self, ExprResult &SrcExpr,
// converted to an integral type. [...] A value of a scoped enumeration type
// can also be explicitly converted to a floating-point type [...].
if (const EnumType *Enum = dyn_cast<EnumType>(SrcType)) {
- if (Enum->getOriginalDecl()->isScoped()) {
+ if (Enum->getDecl()->isScoped()) {
if (DestType->isBooleanType()) {
Kind = CK_IntegralToBoolean;
return TC_Success;
@@ -3105,7 +3105,7 @@ void CastOperation::CheckCStyleCast() {
}
// GCC's cast to union extension.
- if (RecordDecl *RD = DestRecordTy->getOriginalDecl(); RD->isUnion()) {
+ if (RecordDecl *RD = DestRecordTy->getDecl(); RD->isUnion()) {
if (CastExpr::getTargetFieldForToUnionCast(RD->getDefinitionOrSelf(),
SrcType)) {
Self.Diag(OpRange.getBegin(), diag::ext_typecheck_cast_to_union)
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index 063db05..4f409ca 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -3580,9 +3580,8 @@ static bool CheckNonNullExpr(Sema &S, const Expr *Expr) {
// As a special case, transparent unions initialized with zero are
// considered null for the purposes of the nonnull attribute.
if (const RecordType *UT = Expr->getType()->getAsUnionType();
- UT && UT->getOriginalDecl()
- ->getMostRecentDecl()
- ->hasAttr<TransparentUnionAttr>()) {
+ UT &&
+ UT->getDecl()->getMostRecentDecl()->hasAttr<TransparentUnionAttr>()) {
if (const auto *CLE = dyn_cast<CompoundLiteralExpr>(Expr))
if (const auto *ILE = dyn_cast<InitListExpr>(CLE->getInitializer()))
Expr = ILE->getInit(0);
@@ -12879,8 +12878,8 @@ void Sema::CheckImplicitConversion(Expr *E, QualType T, SourceLocation CC,
if (const EnumType *SourceEnum = Source->getAsCanonical<EnumType>())
if (const EnumType *TargetEnum = Target->getAsCanonical<EnumType>())
- if (SourceEnum->getOriginalDecl()->hasNameForLinkage() &&
- TargetEnum->getOriginalDecl()->hasNameForLinkage() &&
+ if (SourceEnum->getDecl()->hasNameForLinkage() &&
+ TargetEnum->getDecl()->hasNameForLinkage() &&
SourceEnum != TargetEnum) {
if (SourceMgr.isInSystemMacro(CC))
return;
diff --git a/clang/lib/Sema/SemaCodeComplete.cpp b/clang/lib/Sema/SemaCodeComplete.cpp
index 5dd4949..0514d10 100644
--- a/clang/lib/Sema/SemaCodeComplete.cpp
+++ b/clang/lib/Sema/SemaCodeComplete.cpp
@@ -2070,7 +2070,7 @@ static const char *GetCompletionTypeString(QualType T, ASTContext &Context,
// Anonymous tag types are constant strings.
if (const TagType *TagT = dyn_cast<TagType>(T))
- if (TagDecl *Tag = TagT->getOriginalDecl())
+ if (TagDecl *Tag = TagT->getDecl())
if (!Tag->hasNameForLinkage()) {
switch (Tag->getTagKind()) {
case TagTypeKind::Struct:
diff --git a/clang/lib/Sema/SemaConcept.cpp b/clang/lib/Sema/SemaConcept.cpp
index 9cbd1bd..87dd682 100644
--- a/clang/lib/Sema/SemaConcept.cpp
+++ b/clang/lib/Sema/SemaConcept.cpp
@@ -606,10 +606,9 @@ ConstraintSatisfactionChecker::SubstitutionInTemplateArguments(
Constraint.mappingOccurenceList();
// The empty MLTAL situation should only occur when evaluating non-dependent
// constraints.
- if (!MLTAL.getNumSubstitutedLevels())
- MLTAL.addOuterTemplateArguments(TD, {}, /*Final=*/false);
- SubstitutedOuterMost =
- llvm::to_vector_of<TemplateArgument>(MLTAL.getOutermost());
+ if (MLTAL.getNumSubstitutedLevels())
+ SubstitutedOuterMost =
+ llvm::to_vector_of<TemplateArgument>(MLTAL.getOutermost());
unsigned Offset = 0;
for (unsigned I = 0, MappedIndex = 0; I < Used.size(); I++) {
TemplateArgument Arg;
@@ -627,8 +626,10 @@ ConstraintSatisfactionChecker::SubstitutionInTemplateArguments(
if (Offset < SubstitutedOuterMost.size())
SubstitutedOuterMost.erase(SubstitutedOuterMost.begin() + Offset);
- MLTAL.replaceOutermostTemplateArguments(TD, SubstitutedOuterMost);
- return std::move(MLTAL);
+ MultiLevelTemplateArgumentList SubstitutedTemplateArgs;
+ SubstitutedTemplateArgs.addOuterTemplateArguments(TD, SubstitutedOuterMost,
+ /*Final=*/false);
+ return std::move(SubstitutedTemplateArgs);
}
ExprResult ConstraintSatisfactionChecker::EvaluateSlow(
diff --git a/clang/lib/Sema/SemaCoroutine.cpp b/clang/lib/Sema/SemaCoroutine.cpp
index 229e91e..c0aba83 100644
--- a/clang/lib/Sema/SemaCoroutine.cpp
+++ b/clang/lib/Sema/SemaCoroutine.cpp
@@ -640,10 +640,9 @@ static void checkNoThrow(Sema &S, const Stmt *E,
QualType::DestructionKind::DK_cxx_destructor) {
const auto *T =
cast<RecordType>(ReturnType.getCanonicalType().getTypePtr());
- checkDeclNoexcept(cast<CXXRecordDecl>(T->getOriginalDecl())
- ->getDefinition()
- ->getDestructor(),
- /*IsDtor=*/true);
+ checkDeclNoexcept(
+ cast<CXXRecordDecl>(T->getDecl())->getDefinition()->getDestructor(),
+ /*IsDtor=*/true);
}
} else
for (const auto *Child : E->children()) {
diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp
index 3107876..e6f8748 100644
--- a/clang/lib/Sema/SemaDeclAttr.cpp
+++ b/clang/lib/Sema/SemaDeclAttr.cpp
@@ -1255,7 +1255,7 @@ bool Sema::isValidPointerAttrType(QualType T, bool RefOkay) {
// The nonnull attribute, and other similar attributes, can be applied to a
// transparent union that contains a pointer type.
if (const RecordType *UT = T->getAsUnionType()) {
- RecordDecl *UD = UT->getOriginalDecl()->getDefinitionOrSelf();
+ RecordDecl *UD = UT->getDecl()->getDefinitionOrSelf();
if (UD->hasAttr<TransparentUnionAttr>()) {
for (const auto *I : UD->fields()) {
QualType QT = I->getType();
@@ -3629,18 +3629,20 @@ static FormatAttrKind getFormatAttrKind(StringRef Format) {
// Check for formats that get handled specially.
.Case("NSString", NSStringFormat)
.Case("CFString", CFStringFormat)
- .Cases("gnu_strftime", "strftime", StrftimeFormat)
+ .Cases({"gnu_strftime", "strftime"}, StrftimeFormat)
// Otherwise, check for supported formats.
- .Cases("gnu_scanf", "scanf", "gnu_printf", "printf", "printf0",
- "gnu_strfmon", "strfmon", SupportedFormat)
- .Cases("cmn_err", "vcmn_err", "zcmn_err", SupportedFormat)
- .Cases("kprintf", "syslog", SupportedFormat) // OpenBSD.
- .Case("freebsd_kprintf", SupportedFormat) // FreeBSD.
+ .Cases({"gnu_scanf", "scanf", "gnu_printf", "printf", "printf0",
+ "gnu_strfmon", "strfmon"},
+ SupportedFormat)
+ .Cases({"cmn_err", "vcmn_err", "zcmn_err"}, SupportedFormat)
+ .Cases({"kprintf", "syslog"}, SupportedFormat) // OpenBSD.
+ .Case("freebsd_kprintf", SupportedFormat) // FreeBSD.
.Case("os_trace", SupportedFormat)
.Case("os_log", SupportedFormat)
- .Cases("gcc_diag", "gcc_cdiag", "gcc_cxxdiag", "gcc_tdiag", IgnoredFormat)
+ .Cases({"gcc_diag", "gcc_cdiag", "gcc_cxxdiag", "gcc_tdiag"},
+ IgnoredFormat)
.Default(InvalidFormat);
}
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
index 215431c..d41ab12 100644
--- a/clang/lib/Sema/SemaDeclCXX.cpp
+++ b/clang/lib/Sema/SemaDeclCXX.cpp
@@ -5630,7 +5630,7 @@ bool Sema::SetCtorInitializers(CXXConstructorDecl *Constructor, bool AnyErrors,
static void PopulateKeysForFields(FieldDecl *Field, SmallVectorImpl<const void*> &IdealInits) {
if (const RecordType *RT = Field->getType()->getAsCanonical<RecordType>()) {
- const RecordDecl *RD = RT->getOriginalDecl();
+ const RecordDecl *RD = RT->getDecl();
if (RD->isAnonymousStructOrUnion()) {
for (auto *Field : RD->getDefinitionOrSelf()->fields())
PopulateKeysForFields(Field, IdealInits);
@@ -7630,9 +7630,8 @@ static bool defaultedSpecialMemberIsConstexpr(
continue;
QualType BaseType = S.Context.getBaseElementType(F->getType());
if (const RecordType *RecordTy = BaseType->getAsCanonical<RecordType>()) {
- CXXRecordDecl *FieldRecDecl =
- cast<CXXRecordDecl>(RecordTy->getOriginalDecl())
- ->getDefinitionOrSelf();
+ auto *FieldRecDecl =
+ cast<CXXRecordDecl>(RecordTy->getDecl())->getDefinitionOrSelf();
if (!specialMemberIsConstexpr(S, FieldRecDecl, CSM,
BaseType.getCVRQualifiers(),
ConstArg && !F->isMutable()))
@@ -10645,7 +10644,7 @@ void Sema::checkIllFormedTrivialABIStruct(CXXRecordDecl &RD) {
if (const auto *RT =
FT->getBaseElementTypeUnsafe()->getAsCanonical<RecordType>())
if (!RT->isDependentType() &&
- !cast<CXXRecordDecl>(RT->getOriginalDecl()->getDefinitionOrSelf())
+ !cast<CXXRecordDecl>(RT->getDecl()->getDefinitionOrSelf())
->canPassInRegisters()) {
PrintDiagAndRemoveAttr(5);
return;
diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp
index 98eb5af..3df9f9c 100644
--- a/clang/lib/Sema/SemaDeclObjC.cpp
+++ b/clang/lib/Sema/SemaDeclObjC.cpp
@@ -3232,10 +3232,8 @@ static bool tryMatchRecordTypes(ASTContext &Context,
assert(lt && rt && lt != rt);
if (!isa<RecordType>(lt) || !isa<RecordType>(rt)) return false;
- RecordDecl *left =
- cast<RecordType>(lt)->getOriginalDecl()->getDefinitionOrSelf();
- RecordDecl *right =
- cast<RecordType>(rt)->getOriginalDecl()->getDefinitionOrSelf();
+ RecordDecl *left = cast<RecordType>(lt)->getDecl()->getDefinitionOrSelf();
+ RecordDecl *right = cast<RecordType>(rt)->getDecl()->getDefinitionOrSelf();
// Require union-hood to match.
if (left->isUnion() != right->isUnion()) return false;
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 01abc1f..3e0e9bb 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -1535,12 +1535,8 @@ void Sema::checkEnumArithmeticConversions(Expr *LHS, Expr *RHS,
// are ill-formed.
if (getLangOpts().CPlusPlus26)
DiagID = diag::warn_conv_mixed_enum_types_cxx26;
- else if (!L->castAsCanonical<EnumType>()
- ->getOriginalDecl()
- ->hasNameForLinkage() ||
- !R->castAsCanonical<EnumType>()
- ->getOriginalDecl()
- ->hasNameForLinkage()) {
+ else if (!L->castAsCanonical<EnumType>()->getDecl()->hasNameForLinkage() ||
+ !R->castAsCanonical<EnumType>()->getDecl()->hasNameForLinkage()) {
// If either enumeration type is unnamed, it's less likely that the
// user cares about this, but this situation is still deprecated in
// C++2a. Use a different warning group.
@@ -7095,7 +7091,7 @@ ExprResult Sema::BuildResolvedCallExpr(Expr *Fn, NamedDecl *NDecl,
for (unsigned i = 0, e = Args.size(); i != e; i++) {
if (const auto *RT =
dyn_cast<RecordType>(Args[i]->getType().getCanonicalType())) {
- if (RT->getOriginalDecl()->isOrContainsUnion())
+ if (RT->getDecl()->isOrContainsUnion())
Diag(Args[i]->getBeginLoc(), diag::warn_cmse_nonsecure_union)
<< 0 << i;
}
@@ -9748,7 +9744,7 @@ Sema::CheckTransparentUnionArgumentConstraints(QualType ArgType,
if (!UT)
return AssignConvertType::Incompatible;
- RecordDecl *UD = UT->getOriginalDecl()->getDefinitionOrSelf();
+ RecordDecl *UD = UT->getDecl()->getDefinitionOrSelf();
if (!UD->hasAttr<TransparentUnionAttr>())
return AssignConvertType::Incompatible;
@@ -10844,7 +10840,7 @@ static void diagnoseScopedEnums(Sema &S, const SourceLocation Loc,
auto DiagnosticHelper = [&S](const Expr *expr, const QualType type) {
SourceLocation BeginLoc = expr->getBeginLoc();
QualType IntType = type->castAs<EnumType>()
- ->getOriginalDecl()
+ ->getDecl()
->getDefinitionOrSelf()
->getIntegerType();
std::string InsertionString = "static_cast<" + IntType.getAsString() + ">(";
@@ -11533,7 +11529,7 @@ QualType Sema::CheckSubtractionOperands(ExprResult &LHS, ExprResult &RHS,
static bool isScopedEnumerationType(QualType T) {
if (const EnumType *ET = T->getAsCanonical<EnumType>())
- return ET->getOriginalDecl()->isScoped();
+ return ET->getDecl()->isScoped();
return false;
}
@@ -13839,7 +13835,7 @@ static void DiagnoseRecursiveConstFields(Sema &S, const ValueDecl *VD,
while (RecordTypeList.size() > NextToCheckIndex) {
bool IsNested = NextToCheckIndex > 0;
for (const FieldDecl *Field : RecordTypeList[NextToCheckIndex]
- ->getOriginalDecl()
+ ->getDecl()
->getDefinitionOrSelf()
->fields()) {
// First, check every field for constness.
diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp
index 0fe242dce..fe1f89b 100644
--- a/clang/lib/Sema/SemaExprCXX.cpp
+++ b/clang/lib/Sema/SemaExprCXX.cpp
@@ -1988,7 +1988,7 @@ static bool doesUsualArrayDeleteWantSize(Sema &S, SourceLocation loc,
DeclarationName deleteName =
S.Context.DeclarationNames.getCXXOperatorName(OO_Array_Delete);
LookupResult ops(S, deleteName, loc, Sema::LookupOrdinaryName);
- S.LookupQualifiedName(ops, record->getOriginalDecl()->getDefinitionOrSelf());
+ S.LookupQualifiedName(ops, record->getDecl()->getDefinitionOrSelf());
// We're just doing this for information.
ops.suppressDiagnostics();
@@ -6667,8 +6667,7 @@ ExprResult Sema::MaybeBindToTemporary(Expr *E) {
// That should be enough to guarantee that this type is complete, if we're
// not processing a decltype expression.
- CXXRecordDecl *RD =
- cast<CXXRecordDecl>(RT->getOriginalDecl())->getDefinitionOrSelf();
+ auto *RD = cast<CXXRecordDecl>(RT->getDecl())->getDefinitionOrSelf();
if (RD->isInvalidDecl() || RD->isDependentContext())
return E;
diff --git a/clang/lib/Sema/SemaExprObjC.cpp b/clang/lib/Sema/SemaExprObjC.cpp
index 331f6e5..4daf0170 100644
--- a/clang/lib/Sema/SemaExprObjC.cpp
+++ b/clang/lib/Sema/SemaExprObjC.cpp
@@ -3846,8 +3846,7 @@ static inline T *getObjCBridgeAttr(const TypedefType *TD) {
if (QT->isPointerType()) {
QT = QT->getPointeeType();
if (const RecordType *RT = QT->getAsCanonical<RecordType>()) {
- for (auto *Redecl :
- RT->getOriginalDecl()->getMostRecentDecl()->redecls()) {
+ for (auto *Redecl : RT->getDecl()->getMostRecentDecl()->redecls()) {
if (auto *attr = Redecl->getAttr<T>())
return attr;
}
diff --git a/clang/lib/Sema/SemaHLSL.cpp b/clang/lib/Sema/SemaHLSL.cpp
index 72b2ac9..f347066 100644
--- a/clang/lib/Sema/SemaHLSL.cpp
+++ b/clang/lib/Sema/SemaHLSL.cpp
@@ -782,7 +782,7 @@ bool SemaHLSL::isSemanticValid(FunctionDecl *FD, DeclaratorDecl *D) {
if (!RT)
return false;
- const RecordDecl *RD = RT->getOriginalDecl();
+ const RecordDecl *RD = RT->getDecl();
for (FieldDecl *Field : RD->fields()) {
if (!isSemanticValid(FD, Field))
return false;
@@ -1986,7 +1986,7 @@ SemaHLSL::TakeLocForHLSLAttribute(const HLSLAttributedResourceType *RT) {
// requirements and adds them to Bindings
void SemaHLSL::collectResourceBindingsOnUserRecordDecl(const VarDecl *VD,
const RecordType *RT) {
- const RecordDecl *RD = RT->getOriginalDecl()->getDefinitionOrSelf();
+ const RecordDecl *RD = RT->getDecl()->getDefinitionOrSelf();
for (FieldDecl *FD : RD->fields()) {
const Type *Ty = FD->getType()->getUnqualifiedDesugaredType();
diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp
index 543db46..f7974eb 100644
--- a/clang/lib/Sema/SemaInit.cpp
+++ b/clang/lib/Sema/SemaInit.cpp
@@ -775,7 +775,7 @@ void InitListChecker::FillInEmptyInitForField(unsigned Init, FieldDecl *Field,
if (Init >= NumInits || !ILE->getInit(Init)) {
if (const RecordType *RType = ILE->getType()->getAsCanonical<RecordType>())
- if (!RType->getOriginalDecl()->isUnion())
+ if (!RType->getDecl()->isUnion())
assert((Init < NumInits || VerifyOnly) &&
"This ILE should have been expanded");
@@ -9186,9 +9186,8 @@ bool InitializationSequence::Diagnose(Sema &S,
diag::note_member_declared_at);
if (const auto *Record = Entity.getType()->getAs<RecordType>())
- S.Diag(Record->getOriginalDecl()->getLocation(),
- diag::note_previous_decl)
- << S.Context.getCanonicalTagType(Record->getOriginalDecl());
+ S.Diag(Record->getDecl()->getLocation(), diag::note_previous_decl)
+ << S.Context.getCanonicalTagType(Record->getDecl());
}
break;
}
@@ -9974,8 +9973,8 @@ QualType Sema::DeduceTemplateSpecializationFromInitializer(
// Cases where template arguments in the RHS of the alias are not
// dependent. e.g.
// using AliasFoo = Foo<bool>;
- if (const auto *CTSD = llvm::dyn_cast<ClassTemplateSpecializationDecl>(
- RT->getOriginalDecl()))
+ if (const auto *CTSD =
+ llvm::dyn_cast<ClassTemplateSpecializationDecl>(RT->getDecl()))
Template = CTSD->getSpecializedTemplate();
}
}
diff --git a/clang/lib/Sema/SemaLookup.cpp b/clang/lib/Sema/SemaLookup.cpp
index 25728de..5915d6e 100644
--- a/clang/lib/Sema/SemaLookup.cpp
+++ b/clang/lib/Sema/SemaLookup.cpp
@@ -2727,9 +2727,7 @@ bool Sema::LookupParsedName(LookupResult &R, Scope *S, CXXScopeSpec *SS,
IsDependent = !DC && ObjectType->isDependentType();
assert(((!DC && ObjectType->isDependentType()) ||
!ObjectType->isIncompleteType() || !ObjectType->getAs<TagType>() ||
- ObjectType->castAs<TagType>()
- ->getOriginalDecl()
- ->isEntityBeingDefined()) &&
+ ObjectType->castAs<TagType>()->getDecl()->isEntityBeingDefined()) &&
"Caller should have completed object type");
} else if (SS && SS->isNotEmpty()) {
// This nested-name-specifier occurs after another nested-name-specifier,
@@ -3191,9 +3189,8 @@ addAssociatedClassesAndNamespaces(AssociatedLookup &Result, QualType Ty) {
// namespaces of its associated classes.
case Type::Record: {
// FIXME: This should use the original decl.
- CXXRecordDecl *Class =
- cast<CXXRecordDecl>(cast<RecordType>(T)->getOriginalDecl())
- ->getDefinitionOrSelf();
+ auto *Class = cast<CXXRecordDecl>(cast<RecordType>(T)->getDecl())
+ ->getDefinitionOrSelf();
addAssociatedClassesAndNamespaces(Result, Class);
break;
}
@@ -4606,7 +4603,7 @@ static void getNestedNameSpecifierIdentifiers(
case Type::InjectedClassName: {
auto *TT = cast<TagType>(T);
getNestedNameSpecifierIdentifiers(TT->getQualifier(), Identifiers);
- Identifiers.push_back(TT->getOriginalDecl()->getIdentifier());
+ Identifiers.push_back(TT->getDecl()->getIdentifier());
return;
}
case Type::Typedef: {
diff --git a/clang/lib/Sema/SemaObjC.cpp b/clang/lib/Sema/SemaObjC.cpp
index 4f9470a..7aaa56e 100644
--- a/clang/lib/Sema/SemaObjC.cpp
+++ b/clang/lib/Sema/SemaObjC.cpp
@@ -1407,7 +1407,7 @@ SemaObjC::ObjCSubscriptKind SemaObjC::CheckSubscriptingKind(Expr *FromE) {
int NoIntegrals = 0, NoObjCIdPointers = 0;
SmallVector<CXXConversionDecl *, 4> ConversionDecls;
- for (NamedDecl *D : cast<CXXRecordDecl>(RecordTy->getOriginalDecl())
+ for (NamedDecl *D : cast<CXXRecordDecl>(RecordTy->getDecl())
->getDefinitionOrSelf()
->getVisibleConversionFunctions()) {
if (CXXConversionDecl *Conversion =
@@ -1511,7 +1511,7 @@ bool SemaObjC::isCFStringType(QualType T) {
if (!RT)
return false;
- const RecordDecl *RD = RT->getOriginalDecl();
+ const RecordDecl *RD = RT->getDecl();
if (RD->getTagKind() != TagTypeKind::Struct)
return false;
diff --git a/clang/lib/Sema/SemaOpenACCClause.cpp b/clang/lib/Sema/SemaOpenACCClause.cpp
index ead9781..17078e8 100644
--- a/clang/lib/Sema/SemaOpenACCClause.cpp
+++ b/clang/lib/Sema/SemaOpenACCClause.cpp
@@ -1924,7 +1924,7 @@ bool SemaOpenACC::CheckReductionVarType(Expr *VarExpr) {
// off here. This will result in CurType being the actual 'type' of the
// expression, which is what we are looking to check.
QualType CurType = isa<ArraySectionExpr>(VarExpr)
- ? ArraySectionExpr::getBaseOriginalType(VarExpr)
+ ? cast<ArraySectionExpr>(VarExpr)->getElementType()
: VarExpr->getType();
// This can happen when we have a dependent type in an array element that the
diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp
index 8339bb1..7da09e8 100644
--- a/clang/lib/Sema/SemaOverload.cpp
+++ b/clang/lib/Sema/SemaOverload.cpp
@@ -2594,7 +2594,7 @@ IsTransparentUnionStandardConversion(Sema &S, Expr* From,
if (!UT)
return false;
// The field to initialize within the transparent union.
- const RecordDecl *UD = UT->getOriginalDecl()->getDefinitionOrSelf();
+ const RecordDecl *UD = UT->getDecl()->getDefinitionOrSelf();
if (!UD->hasAttr<TransparentUnionAttr>())
return false;
// It's compatible if the expression matches any of the fields.
@@ -3973,7 +3973,7 @@ IsUserDefinedConversion(Sema &S, Expr *From, QualType ToType,
if (!S.isCompleteType(From->getExprLoc(), ToType)) {
// We're not going to find any constructors.
} else if (auto *ToRecordDecl =
- dyn_cast<CXXRecordDecl>(ToRecordType->getOriginalDecl())) {
+ dyn_cast<CXXRecordDecl>(ToRecordType->getDecl())) {
ToRecordDecl = ToRecordDecl->getDefinitionOrSelf();
Expr **Args = &From;
@@ -4048,7 +4048,7 @@ IsUserDefinedConversion(Sema &S, Expr *From, QualType ToType,
} else if (const RecordType *FromRecordType =
From->getType()->getAsCanonical<RecordType>()) {
if (auto *FromRecordDecl =
- dyn_cast<CXXRecordDecl>(FromRecordType->getOriginalDecl())) {
+ dyn_cast<CXXRecordDecl>(FromRecordType->getDecl())) {
FromRecordDecl = FromRecordDecl->getDefinitionOrSelf();
// Add all of the conversion functions as candidates.
const auto &Conversions = FromRecordDecl->getVisibleConversionFunctions();
@@ -6840,7 +6840,7 @@ ExprResult Sema::PerformContextualImplicitConversion(
UnresolvedSet<4>
ViableConversions; // These are *potentially* viable in C++1y.
UnresolvedSet<4> ExplicitConversions;
- const auto &Conversions = cast<CXXRecordDecl>(RecordTy->getOriginalDecl())
+ const auto &Conversions = cast<CXXRecordDecl>(RecordTy->getDecl())
->getDefinitionOrSelf()
->getVisibleConversionFunctions();
@@ -10194,9 +10194,7 @@ public:
if (S.getLangOpts().CPlusPlus11) {
for (QualType EnumTy : CandidateTypes[ArgIdx].enumeration_types()) {
- if (!EnumTy->castAsCanonical<EnumType>()
- ->getOriginalDecl()
- ->isScoped())
+ if (!EnumTy->castAsCanonical<EnumType>()->getDecl()->isScoped())
continue;
if (!AddedTypes.insert(S.Context.getCanonicalType(EnumTy)).second)
diff --git a/clang/lib/Sema/SemaSYCL.cpp b/clang/lib/Sema/SemaSYCL.cpp
index b981c35..67f3856 100644
--- a/clang/lib/Sema/SemaSYCL.cpp
+++ b/clang/lib/Sema/SemaSYCL.cpp
@@ -221,8 +221,8 @@ static SourceLocation SourceLocationForUserDeclaredType(QualType QT) {
SourceLocation Loc;
const Type *T = QT->getUnqualifiedDesugaredType();
if (const TagType *TT = dyn_cast<TagType>(T))
- Loc = TT->getOriginalDecl()->getLocation();
- else if (const ObjCInterfaceType *ObjCIT = dyn_cast<ObjCInterfaceType>(T))
+ Loc = TT->getDecl()->getLocation();
+ else if (const auto *ObjCIT = dyn_cast<ObjCInterfaceType>(T))
Loc = ObjCIT->getDecl()->getLocation();
return Loc;
}
diff --git a/clang/lib/Sema/SemaStmt.cpp b/clang/lib/Sema/SemaStmt.cpp
index ae0bb616..f398963 100644
--- a/clang/lib/Sema/SemaStmt.cpp
+++ b/clang/lib/Sema/SemaStmt.cpp
@@ -1277,11 +1277,11 @@ static void checkEnumTypesInSwitchStmt(Sema &S, const Expr *Cond,
return;
// Ignore anonymous enums.
- if (!CondEnumType->getOriginalDecl()->getIdentifier() &&
- !CondEnumType->getOriginalDecl()->getTypedefNameForAnonDecl())
+ if (!CondEnumType->getDecl()->getIdentifier() &&
+ !CondEnumType->getDecl()->getTypedefNameForAnonDecl())
return;
- if (!CaseEnumType->getOriginalDecl()->getIdentifier() &&
- !CaseEnumType->getOriginalDecl()->getTypedefNameForAnonDecl())
+ if (!CaseEnumType->getDecl()->getIdentifier() &&
+ !CaseEnumType->getDecl()->getTypedefNameForAnonDecl())
return;
if (S.Context.hasSameUnqualifiedType(CondType, CaseType))
@@ -3760,7 +3760,7 @@ private:
Sema &S;
};
bool LocalTypedefNameReferencer::VisitRecordType(RecordType *RT) {
- auto *R = dyn_cast<CXXRecordDecl>(RT->getOriginalDecl());
+ auto *R = dyn_cast<CXXRecordDecl>(RT->getDecl());
if (!R || !R->isLocalClass() || !R->isLocalClass()->isExternallyVisible() ||
R->isDependentType())
return true;
@@ -3979,7 +3979,7 @@ StmtResult Sema::BuildReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp,
<< RetValExp->getSourceRange();
if (FD->hasAttr<CmseNSEntryAttr>() && RetValExp) {
if (const auto *RT = dyn_cast<RecordType>(FnRetType.getCanonicalType())) {
- if (RT->getOriginalDecl()->isOrContainsUnion())
+ if (RT->getDecl()->isOrContainsUnion())
Diag(RetValExp->getBeginLoc(), diag::warn_cmse_nonsecure_union) << 1;
}
}
diff --git a/clang/lib/Sema/SemaStmtAsm.cpp b/clang/lib/Sema/SemaStmtAsm.cpp
index 0438af7..f957bdf 100644
--- a/clang/lib/Sema/SemaStmtAsm.cpp
+++ b/clang/lib/Sema/SemaStmtAsm.cpp
@@ -908,7 +908,7 @@ bool Sema::LookupInlineAsmField(StringRef Base, StringRef Member,
LookupResult FieldResult(*this, &Context.Idents.get(NextMember),
SourceLocation(), LookupMemberName);
- RecordDecl *RD = RT->getOriginalDecl()->getDefinitionOrSelf();
+ RecordDecl *RD = RT->getDecl()->getDefinitionOrSelf();
if (!LookupQualifiedName(FieldResult, RD))
return true;
diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp
index 3a6ff99..2cc6593 100644
--- a/clang/lib/Sema/SemaTemplate.cpp
+++ b/clang/lib/Sema/SemaTemplate.cpp
@@ -408,9 +408,7 @@ bool Sema::LookupTemplateName(LookupResult &Found, Scope *S, CXXScopeSpec &SS,
IsDependent = !LookupCtx && ObjectType->isDependentType();
assert((IsDependent || !ObjectType->isIncompleteType() ||
!ObjectType->getAs<TagType>() ||
- ObjectType->castAs<TagType>()
- ->getOriginalDecl()
- ->isEntityBeingDefined()) &&
+ ObjectType->castAs<TagType>()->getDecl()->isEntityBeingDefined()) &&
"Caller should have completed object type");
// Template names cannot appear inside an Objective-C class or object type
@@ -1819,7 +1817,7 @@ public:
}
bool VisitTagType(const TagType *T) override {
- return TraverseDecl(T->getOriginalDecl());
+ return TraverseDecl(T->getDecl());
}
bool TraverseDecl(const Decl *D) override {
@@ -2790,7 +2788,7 @@ struct DependencyChecker : DynamicRecursiveASTVisitor {
// An InjectedClassNameType will never have a dependent template name,
// so no need to traverse it.
return TraverseTemplateArguments(
- T->getTemplateArgs(T->getOriginalDecl()->getASTContext()));
+ T->getTemplateArgs(T->getDecl()->getASTContext()));
}
};
} // end anonymous namespace
@@ -2914,7 +2912,7 @@ TemplateParameterList *Sema::MatchTemplateParametersToScopeSpecifier(
if (const EnumType *EnumT = T->getAsCanonical<EnumType>()) {
// FIXME: Forward-declared enums require a TSK_ExplicitSpecialization
// check here.
- EnumDecl *Enum = EnumT->getOriginalDecl();
+ EnumDecl *Enum = EnumT->getDecl();
// Get to the parent type.
if (TypeDecl *Parent = dyn_cast<TypeDecl>(Enum->getParent()))
@@ -3352,7 +3350,7 @@ static QualType builtinCommonTypeImpl(Sema &S, ElaboratedTypeKeyword Keyword,
}
static bool isInVkNamespace(const RecordType *RT) {
- DeclContext *DC = RT->getOriginalDecl()->getDeclContext();
+ DeclContext *DC = RT->getDecl()->getDeclContext();
if (!DC)
return false;
@@ -3369,9 +3367,8 @@ static SpirvOperand checkHLSLSpirvTypeOperand(Sema &SemaRef,
if (auto *RT = OperandArg->getAsCanonical<RecordType>()) {
bool Literal = false;
SourceLocation LiteralLoc;
- if (isInVkNamespace(RT) && RT->getOriginalDecl()->getName() == "Literal") {
- auto SpecDecl =
- dyn_cast<ClassTemplateSpecializationDecl>(RT->getOriginalDecl());
+ if (isInVkNamespace(RT) && RT->getDecl()->getName() == "Literal") {
+ auto SpecDecl = dyn_cast<ClassTemplateSpecializationDecl>(RT->getDecl());
assert(SpecDecl);
const TemplateArgumentList &LiteralArgs = SpecDecl->getTemplateArgs();
@@ -3382,9 +3379,8 @@ static SpirvOperand checkHLSLSpirvTypeOperand(Sema &SemaRef,
}
if (RT && isInVkNamespace(RT) &&
- RT->getOriginalDecl()->getName() == "integral_constant") {
- auto SpecDecl =
- dyn_cast<ClassTemplateSpecializationDecl>(RT->getOriginalDecl());
+ RT->getDecl()->getName() == "integral_constant") {
+ auto SpecDecl = dyn_cast<ClassTemplateSpecializationDecl>(RT->getDecl());
assert(SpecDecl);
const TemplateArgumentList &ConstantArgs = SpecDecl->getTemplateArgs();
@@ -4110,7 +4106,7 @@ TypeResult Sema::ActOnTagTemplateIdType(TagUseKind TUK,
// Check the tag kind
if (const RecordType *RT = Result->getAs<RecordType>()) {
- RecordDecl *D = RT->getOriginalDecl();
+ RecordDecl *D = RT->getDecl();
IdentifierInfo *Id = D->getIdentifier();
assert(Id && "templated class must have an identifier");
@@ -6383,11 +6379,11 @@ bool UnnamedLocalNoLinkageFinder::VisitDeducedTemplateSpecializationType(
}
bool UnnamedLocalNoLinkageFinder::VisitRecordType(const RecordType* T) {
- return VisitTagDecl(T->getOriginalDecl()->getDefinitionOrSelf());
+ return VisitTagDecl(T->getDecl()->getDefinitionOrSelf());
}
bool UnnamedLocalNoLinkageFinder::VisitEnumType(const EnumType* T) {
- return VisitTagDecl(T->getOriginalDecl()->getDefinitionOrSelf());
+ return VisitTagDecl(T->getDecl()->getDefinitionOrSelf());
}
bool UnnamedLocalNoLinkageFinder::VisitTemplateTypeParmType(
@@ -6412,7 +6408,7 @@ bool UnnamedLocalNoLinkageFinder::VisitTemplateSpecializationType(
bool UnnamedLocalNoLinkageFinder::VisitInjectedClassNameType(
const InjectedClassNameType* T) {
- return VisitTagDecl(T->getOriginalDecl()->getDefinitionOrSelf());
+ return VisitTagDecl(T->getDecl()->getDefinitionOrSelf());
}
bool UnnamedLocalNoLinkageFinder::VisitDependentNameType(
diff --git a/clang/lib/Sema/SemaTemplateDeduction.cpp b/clang/lib/Sema/SemaTemplateDeduction.cpp
index 3baa977..6964242 100644
--- a/clang/lib/Sema/SemaTemplateDeduction.cpp
+++ b/clang/lib/Sema/SemaTemplateDeduction.cpp
@@ -5577,7 +5577,7 @@ static TemplateDeductionResult CheckDeductionConsistency(
bool IsDeductionGuide = isa<CXXDeductionGuideDecl>(FTD->getTemplatedDecl());
if (IsDeductionGuide) {
if (auto *Injected = P->getAsCanonical<InjectedClassNameType>())
- P = Injected->getOriginalDecl()->getCanonicalTemplateSpecializationType(
+ P = Injected->getDecl()->getCanonicalTemplateSpecializationType(
S.Context);
}
QualType InstP = S.SubstType(P.getCanonicalType(), MLTAL, FTD->getLocation(),
@@ -5598,10 +5598,10 @@ static TemplateDeductionResult CheckDeductionConsistency(
auto T2 = S.Context.getUnqualifiedArrayType(A.getNonReferenceType());
if (IsDeductionGuide) {
if (auto *Injected = T1->getAsCanonical<InjectedClassNameType>())
- T1 = Injected->getOriginalDecl()->getCanonicalTemplateSpecializationType(
+ T1 = Injected->getDecl()->getCanonicalTemplateSpecializationType(
S.Context);
if (auto *Injected = T2->getAsCanonical<InjectedClassNameType>())
- T2 = Injected->getOriginalDecl()->getCanonicalTemplateSpecializationType(
+ T2 = Injected->getDecl()->getCanonicalTemplateSpecializationType(
S.Context);
}
if (!S.Context.hasSameType(T1, T2))
@@ -6973,7 +6973,7 @@ MarkUsedTemplateParameters(ASTContext &Ctx, QualType T,
case Type::InjectedClassName:
T = cast<InjectedClassNameType>(T)
- ->getOriginalDecl()
+ ->getDecl()
->getCanonicalTemplateSpecializationType(Ctx);
[[fallthrough]];
diff --git a/clang/lib/Sema/SemaTemplateDeductionGuide.cpp b/clang/lib/Sema/SemaTemplateDeductionGuide.cpp
index 8ba23aa..ad50600 100644
--- a/clang/lib/Sema/SemaTemplateDeductionGuide.cpp
+++ b/clang/lib/Sema/SemaTemplateDeductionGuide.cpp
@@ -996,7 +996,7 @@ getRHSTemplateDeclAndArgs(Sema &SemaRef, TypeAliasTemplateDecl *AliasTemplate) {
// dependent. e.g.
// using AliasFoo = Foo<bool>;
if (const auto *CTSD =
- dyn_cast<ClassTemplateSpecializationDecl>(RT->getOriginalDecl())) {
+ dyn_cast<ClassTemplateSpecializationDecl>(RT->getDecl())) {
Template = CTSD->getSpecializedTemplate();
AliasRhsTemplateArgs = CTSD->getTemplateArgs().asArray();
}
@@ -1054,12 +1054,11 @@ BuildDeductionGuideForTypeAlias(Sema &SemaRef,
// such that T can be deduced as U.
auto RType = F->getTemplatedDecl()->getReturnType();
// The (trailing) return type of the deduction guide.
- const TemplateSpecializationType *FReturnType =
- RType->getAs<TemplateSpecializationType>();
+ const auto *FReturnType = RType->getAs<TemplateSpecializationType>();
if (const auto *ICNT = RType->getAsCanonical<InjectedClassNameType>())
// implicitly-generated deduction guide.
FReturnType = cast<TemplateSpecializationType>(
- ICNT->getOriginalDecl()->getCanonicalTemplateSpecializationType(
+ ICNT->getDecl()->getCanonicalTemplateSpecializationType(
SemaRef.Context));
assert(FReturnType && "expected to see a return type");
// Deduce template arguments of the deduction guide f from the RHS of
diff --git a/clang/lib/Sema/SemaTemplateInstantiate.cpp b/clang/lib/Sema/SemaTemplateInstantiate.cpp
index 7b05e4c..bec2820 100644
--- a/clang/lib/Sema/SemaTemplateInstantiate.cpp
+++ b/clang/lib/Sema/SemaTemplateInstantiate.cpp
@@ -1681,7 +1681,7 @@ namespace {
ICNT && SemaRef.CodeSynthesisContexts.back().Kind ==
Sema::CodeSynthesisContext::BuildingDeductionGuides) {
Type = inherited::TransformType(
- ICNT->getOriginalDecl()->getCanonicalTemplateSpecializationType(
+ ICNT->getDecl()->getCanonicalTemplateSpecializationType(
SemaRef.Context));
TLB.pushTrivial(SemaRef.Context, Type, TL.getNameLoc());
}
@@ -2105,7 +2105,7 @@ TemplateInstantiator::TransformFirstQualifierInScope(NamedDecl *D,
return cast_or_null<NamedDecl>(TransformDecl(Loc, D));
if (const TagType *Tag = T->getAs<TagType>())
- return Tag->getOriginalDecl();
+ return Tag->getDecl();
// The resulting type is not a tag; complain.
getSema().Diag(Loc, diag::err_nested_name_spec_non_tag) << T;
diff --git a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
index 85e3d20..468bc1d 100644
--- a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -1522,9 +1522,9 @@ Decl *TemplateDeclInstantiator::InstantiateTypedefNameDecl(TypedefNameDecl *D,
// If the old typedef was the name for linkage purposes of an anonymous
// tag decl, re-establish that relationship for the new typedef.
if (const TagType *oldTagType = D->getUnderlyingType()->getAs<TagType>()) {
- TagDecl *oldTag = oldTagType->getOriginalDecl();
+ TagDecl *oldTag = oldTagType->getDecl();
if (oldTag->getTypedefNameForAnonDecl() == D && !Invalid) {
- TagDecl *newTag = DI->getType()->castAs<TagType>()->getOriginalDecl();
+ TagDecl *newTag = DI->getType()->castAs<TagType>()->getDecl();
assert(!newTag->hasNameForLinkage());
newTag->setTypedefNameForAnonDecl(Typedef);
}
@@ -5727,7 +5727,7 @@ void Sema::InstantiateFunctionDefinition(SourceLocation PointOfInstantiation,
Function->setDeclarationNameLoc(NameLocPointsToPattern());
EnterExpressionEvaluationContextForFunction EvalContext(
- *this, Sema::ExpressionEvaluationContext::PotentiallyEvaluated);
+ *this, Sema::ExpressionEvaluationContext::PotentiallyEvaluated, Function);
Qualifiers ThisTypeQuals;
CXXRecordDecl *ThisContext = nullptr;
@@ -5791,7 +5791,7 @@ void Sema::InstantiateFunctionDefinition(SourceLocation PointOfInstantiation,
QualType TransformRecordType(TypeLocBuilder &TLB, RecordTypeLoc TL) {
const RecordType *T = TL.getTypePtr();
RecordDecl *Record = cast_or_null<RecordDecl>(
- getDerived().TransformDecl(TL.getNameLoc(), T->getOriginalDecl()));
+ getDerived().TransformDecl(TL.getNameLoc(), T->getDecl()));
if (Record != OldDecl)
return Base::TransformRecordType(TLB, TL);
diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp
index a9e7c34..638904d 100644
--- a/clang/lib/Sema/SemaType.cpp
+++ b/clang/lib/Sema/SemaType.cpp
@@ -1238,8 +1238,8 @@ static QualType ConvertDeclSpecToType(TypeProcessingState &state) {
Result = S.GetTypeFromParser(DS.getRepAsType());
assert(!Result.isNull() && "Didn't get a type for typeof?");
if (!Result->isDependentType())
- if (const TagType *TT = Result->getAs<TagType>())
- S.DiagnoseUseOfDecl(TT->getOriginalDecl(), DS.getTypeSpecTypeLoc());
+ if (const auto *TT = Result->getAs<TagType>())
+ S.DiagnoseUseOfDecl(TT->getDecl(), DS.getTypeSpecTypeLoc());
// TypeQuals handled by caller.
Result = Context.getTypeOfType(
Result, DS.getTypeSpecType() == DeclSpec::TST_typeof_unqualType
@@ -9699,7 +9699,7 @@ QualType Sema::BuildTypeofExprType(Expr *E, TypeOfKind Kind) {
if (!E->isTypeDependent()) {
QualType T = E->getType();
if (const TagType *TT = T->getAs<TagType>())
- DiagnoseUseOfDecl(TT->getOriginalDecl(), E->getExprLoc());
+ DiagnoseUseOfDecl(TT->getDecl(), E->getExprLoc());
}
return Context.getTypeOfExprType(E, Kind);
}
@@ -9865,7 +9865,7 @@ QualType Sema::BuildPackIndexingType(QualType Pattern, Expr *IndexExpr,
static QualType GetEnumUnderlyingType(Sema &S, QualType BaseType,
SourceLocation Loc) {
assert(BaseType->isEnumeralType());
- EnumDecl *ED = BaseType->castAs<EnumType>()->getOriginalDecl();
+ EnumDecl *ED = BaseType->castAs<EnumType>()->getDecl();
S.DiagnoseUseOfDecl(ED, Loc);
diff --git a/clang/lib/Sema/SemaTypeTraits.cpp b/clang/lib/Sema/SemaTypeTraits.cpp
index 3e34675..3887796 100644
--- a/clang/lib/Sema/SemaTypeTraits.cpp
+++ b/clang/lib/Sema/SemaTypeTraits.cpp
@@ -1076,8 +1076,7 @@ static bool EvaluateUnaryTypeTrait(Sema &Self, TypeTrait UTT,
if (T.isPODType(C) || T->isObjCLifetimeType())
return true;
if (CXXRecordDecl *RD = C.getBaseElementType(T)->getAsCXXRecordDecl()) {
- if (RD->hasTrivialDefaultConstructor() &&
- !RD->hasNonTrivialDefaultConstructor())
+ if (RD->hasTrivialDefaultConstructor())
return true;
bool FoundConstructor = false;
@@ -1165,14 +1164,26 @@ static bool EvaluateUnaryTypeTrait(Sema &Self, TypeTrait UTT,
const CXXDestructorDecl *Dtor = RD->getDestructor();
if (UnqualT->isAggregateType() && (!Dtor || !Dtor->isUserProvided()))
return true;
- if (RD->hasTrivialDestructor() && (!Dtor || !Dtor->isDeleted())) {
- for (CXXConstructorDecl *Ctr : RD->ctors()) {
- if (Ctr->isIneligibleOrNotSelected() || Ctr->isDeleted())
- continue;
- if (Ctr->isTrivial())
- return true;
- }
+ bool HasTrivialNonDeletedDtr =
+ RD->hasTrivialDestructor() && (!Dtor || !Dtor->isDeleted());
+ if (!HasTrivialNonDeletedDtr)
+ return false;
+ for (CXXConstructorDecl *Ctr : RD->ctors()) {
+ if (Ctr->isIneligibleOrNotSelected() || Ctr->isDeleted())
+ continue;
+ if (Ctr->isTrivial())
+ return true;
}
+ if (RD->needsImplicitDefaultConstructor() &&
+ RD->hasTrivialDefaultConstructor() &&
+ !RD->hasNonTrivialDefaultConstructor())
+ return true;
+ if (RD->needsImplicitCopyConstructor() && RD->hasTrivialCopyConstructor() &&
+ !RD->defaultedCopyConstructorIsDeleted())
+ return true;
+ if (RD->needsImplicitMoveConstructor() && RD->hasTrivialMoveConstructor() &&
+ !RD->defaultedMoveConstructorIsDeleted())
+ return true;
return false;
}
case UTT_IsIntangibleType:
@@ -1613,9 +1624,9 @@ bool Sema::BuiltinIsBaseOf(SourceLocation RhsTLoc, QualType LhsT,
// Unions are never base classes, and never have base classes.
// It doesn't matter if they are complete or not. See PR#41843
- if (lhsRecord && lhsRecord->getOriginalDecl()->isUnion())
+ if (lhsRecord && lhsRecord->getDecl()->isUnion())
return false;
- if (rhsRecord && rhsRecord->getOriginalDecl()->isUnion())
+ if (rhsRecord && rhsRecord->getDecl()->isUnion())
return false;
if (lhsRecord == rhsRecord)
@@ -1629,8 +1640,8 @@ bool Sema::BuiltinIsBaseOf(SourceLocation RhsTLoc, QualType LhsT,
diag::err_incomplete_type_used_in_type_trait_expr))
return false;
- return cast<CXXRecordDecl>(rhsRecord->getOriginalDecl())
- ->isDerivedFrom(cast<CXXRecordDecl>(lhsRecord->getOriginalDecl()));
+ return cast<CXXRecordDecl>(rhsRecord->getDecl())
+ ->isDerivedFrom(cast<CXXRecordDecl>(lhsRecord->getDecl()));
}
static bool EvaluateBinaryTypeTrait(Sema &Self, TypeTrait BTT,
@@ -1670,9 +1681,8 @@ static bool EvaluateBinaryTypeTrait(Sema &Self, TypeTrait BTT,
diag::err_incomplete_type))
return false;
- return cast<CXXRecordDecl>(DerivedRecord->getOriginalDecl())
- ->isVirtuallyDerivedFrom(
- cast<CXXRecordDecl>(BaseRecord->getOriginalDecl()));
+ return cast<CXXRecordDecl>(DerivedRecord->getDecl())
+ ->isVirtuallyDerivedFrom(cast<CXXRecordDecl>(BaseRecord->getDecl()));
}
case BTT_IsSame:
return Self.Context.hasSameType(LhsT, RhsT);
diff --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h
index 04a5e4b..86896ab 100644
--- a/clang/lib/Sema/TreeTransform.h
+++ b/clang/lib/Sema/TreeTransform.h
@@ -7160,13 +7160,13 @@ QualType TreeTransform<Derived>::TransformTagType(TypeLocBuilder &TLB,
}
auto *TD = cast_or_null<TagDecl>(
- getDerived().TransformDecl(TL.getNameLoc(), T->getOriginalDecl()));
+ getDerived().TransformDecl(TL.getNameLoc(), T->getDecl()));
if (!TD)
return QualType();
QualType Result = TL.getType();
if (getDerived().AlwaysRebuild() || QualifierLoc != TL.getQualifierLoc() ||
- TD != T->getOriginalDecl()) {
+ TD != T->getDecl()) {
if (T->isCanonicalUnqualified())
Result = getDerived().RebuildCanonicalTagType(TD);
else