;
43 if(
const UsingType*UT = dyn_cast<UsingType>(Ty)) {
48 if(
const ParenType*PT = dyn_cast<ParenType>(Ty)) {
59dyn_cast<SubstTemplateTypeParmType>(Ty)) {
69 if(
const AdjustedType*AT = dyn_cast<AdjustedType>(Ty)) {
74 if(
const AutoType*AT = dyn_cast<AutoType>(Ty)) {
83 if(
const FunctionType*FT = dyn_cast<FunctionType>(Ty)) {
84 boolDesugarReturn =
false;
85 QualTypeSugarRT = FT->getReturnType();
91 boolDesugarArgument =
false;
97 if(
autonullability =
105 if(DesugarReturn || DesugarArgument) {
116dyn_cast<TemplateSpecializationType>(Ty)) {
117 if(!TST->isTypeAlias()) {
118 boolDesugarArgument =
false;
128 if(DesugarArgument) {
131TST->getTemplateName(), Args, QT);
137 if(
const auto*AT = dyn_cast<ArrayType>(Ty)) {
140 if(
const auto*CAT = dyn_cast<ConstantArrayType>(AT))
142ElementTy, CAT->getSize(), CAT->getSizeExpr(),
143CAT->getSizeModifier(), CAT->getIndexTypeCVRQualifiers());
144 else if(
const auto*VAT = dyn_cast<VariableArrayType>(AT))
146ElementTy, VAT->getSizeExpr(), VAT->getSizeModifier(),
147VAT->getIndexTypeCVRQualifiers(), VAT->getBracketsRange());
148 else if(
const auto*DSAT = dyn_cast<DependentSizedArrayType>(AT))
150ElementTy, DSAT->getSizeExpr(), DSAT->getSizeModifier(),
151DSAT->getIndexTypeCVRQualifiers(), DSAT->getBracketsRange());
152 else if(
const auto*IAT = dyn_cast<IncompleteArrayType>(AT))
154IAT->getIndexTypeCVRQualifiers());
156llvm_unreachable(
"Unhandled array type");
174 boolIsSugar =
false;
176#define ABSTRACT_TYPE(Class, Base) 177#define TYPE(Class, Base) \ 179const Class##Type *CTy = cast<Class##Type>(Ty); \ 180if (CTy->isSugared()) { \ 182Underlying = CTy->desugar(); \ 186#include "clang/AST/TypeNodes.inc" 195 if(isa<VectorType>(Underlying))
200 if(
const TypedefType*QTT = dyn_cast<TypedefType>(QT))
201 if(UTT->getDecl()->getTypedefNameForAnonDecl() == QTT->getDecl())
224 if(Ty->getBaseType().getTypePtr() != Ty && !ShouldAKA) {
228BaseType, Ty->getTypeArgsAsWritten(),
230Ty->isKindOfTypeAsWritten());
234 returnQC.
apply(Context, QT);
266 boolForceAKA =
false;
271 for(
const intptr_t&QualTypeVal : QualTypeVals) {
279 if(CompareCanTy == CanTy)
282 boolShouldAKA =
false;
285std::string CompareDesugarStr =
287 if(CompareS != S && CompareDesugarStr != S)
290std::string CompareCanS =
293 if(CompareCanS == CanS)
302 boolRepeated =
false;
303 for(
const auto&PrevArg : PrevArgs) {
318 boolShouldAKA =
false;
320 if(ShouldAKA || ForceAKA) {
321 if(DesugaredTy == Ty) {
326S =
"'"+ S +
"' (aka '"+ akaStr +
"')";
335std::string DecoratedString;
336llvm::raw_string_ostream OS(DecoratedString);
337 const char*Values = VTy->getNumElements() > 1 ?
"values":
"value";
338OS <<
"'"<< S <<
"' (vector of "<< VTy->getNumElements() <<
" '" 340<<
"' "<< Values <<
")";
341 returnDecoratedString;
351 boolPrintFromType,
boolElideType,
365 size_tOldEnd = Output.size();
366llvm::raw_svector_ostream OS(Output);
367 boolNeedQuotes =
true;
370 default: llvm_unreachable(
"unknown ArgumentKind");
372assert(Modifier.empty() && Argument.empty() &&
373 "Invalid modifier for Qualifiers argument");
377OS << (Context.
getLangOpts().OpenCL ?
"default":
"generic");
378OS <<
" address space";
380OS <<
"address space";
381OS <<
" '"<< S <<
"'";
387assert(Modifier.empty() && Argument.empty() &&
388 "Invalid modifier for Qualifiers argument");
393OS <<
"unqualified";
423Modifier = StringRef();
424Argument = StringRef();
429assert(Modifier.empty() && Argument.empty() &&
430 "Invalid modifier for QualType argument");
438 if(Modifier ==
"objcclass"&& Argument.empty())
440 else if(Modifier ==
"objcinstance"&& Argument.empty())
443assert(Modifier.empty() && Argument.empty() &&
444 "Invalid modifier for DeclarationName argument");
451 if(Modifier ==
"q"&& Argument.empty())
454assert(Modifier.empty() && Argument.empty() &&
455 "Invalid modifier for NamedDecl* argument");
470assert(DC &&
"Should never have a null declaration context");
476OS <<
"the global namespace";
478OS <<
"the global scope";
480OS <<
"block literal";
482OS <<
"lambda expression";
486PrevArgs, QualTypeVals);
488assert(isa<NamedDecl>(DC) &&
"Expected a NamedDecl");
490 if(isa<NamespaceDecl>(ND))
492 else if(isa<ObjCMethodDecl>(ND))
494 else if(isa<FunctionDecl>(ND))
504 const Attr*At =
reinterpret_cast<Attr*
>(Val);
505assert(At &&
"Received null Attr object!");
513Output.insert(Output.begin()+OldEnd,
'\'');
514Output.push_back(
'\'');
579FromIntegerAndToDeclaration,
580FromDeclarationAndToInteger
587 structTemplateArgumentInfo {
591 boolIsValidInt =
false;
592 Expr*ArgExpr =
nullptr;
595 boolNeedAddressOf =
false;
596 boolIsNullPtr =
false;
597 boolIsDefault =
false;
607 unsignedNextNode = 0;
610 unsignedChildNode = 0;
613 unsignedParentNode = 0;
615TemplateArgumentInfo FromArgInfo, ToArgInfo;
620DiffNode(
unsignedParentNode = 0) : ParentNode(ParentNode) {}
627 unsignedCurrentNode;
631 unsignedNextFreeNode;
637DiffTree() : CurrentNode(0), NextFreeNode(1), ReadNode(0) {
638FlatTree.push_back(DiffNode());
644 boolFromDefault,
boolToDefault) {
645assert(FlatTree[CurrentNode].Kind == Invalid &&
"Node is not empty.");
646FlatTree[CurrentNode].Kind = Template;
647FlatTree[CurrentNode].FromArgInfo.TD = FromTD;
648FlatTree[CurrentNode].ToArgInfo.TD = ToTD;
649FlatTree[CurrentNode].FromArgInfo.Qual = FromQual;
650FlatTree[CurrentNode].ToArgInfo.Qual = ToQual;
651SetDefault(FromDefault, ToDefault);
656assert(FlatTree[CurrentNode].Kind == Invalid &&
"Node is not empty.");
657FlatTree[CurrentNode].Kind =
Type;
658FlatTree[CurrentNode].FromArgInfo.ArgType = FromType;
659FlatTree[CurrentNode].ToArgInfo.ArgType = ToType;
660SetDefault(FromDefault, ToDefault);
663 voidSetExpressionDiff(
Expr*FromExpr,
Expr*ToExpr,
boolFromDefault,
665assert(FlatTree[CurrentNode].Kind == Invalid &&
"Node is not empty.");
667FlatTree[CurrentNode].FromArgInfo.ArgExpr = FromExpr;
668FlatTree[CurrentNode].ToArgInfo.ArgExpr = ToExpr;
669SetDefault(FromDefault, ToDefault);
673 boolFromDefault,
boolToDefault) {
674assert(FlatTree[CurrentNode].Kind == Invalid &&
"Node is not empty.");
675FlatTree[CurrentNode].Kind = TemplateTemplate;
676FlatTree[CurrentNode].FromArgInfo.TD = FromTD;
677FlatTree[CurrentNode].ToArgInfo.TD = ToTD;
678SetDefault(FromDefault, ToDefault);
681 voidSetIntegerDiff(
constllvm::APSInt &FromInt,
constllvm::APSInt &ToInt,
682 boolIsValidFromInt,
boolIsValidToInt,
684 Expr*FromExpr,
Expr*ToExpr,
boolFromDefault,
686assert(FlatTree[CurrentNode].Kind == Invalid &&
"Node is not empty.");
687FlatTree[CurrentNode].Kind =
Integer;
688FlatTree[CurrentNode].FromArgInfo.Val = FromInt;
689FlatTree[CurrentNode].ToArgInfo.Val = ToInt;
690FlatTree[CurrentNode].FromArgInfo.IsValidInt = IsValidFromInt;
691FlatTree[CurrentNode].ToArgInfo.IsValidInt = IsValidToInt;
692FlatTree[CurrentNode].FromArgInfo.ArgType = FromIntType;
693FlatTree[CurrentNode].ToArgInfo.ArgType = ToIntType;
694FlatTree[CurrentNode].FromArgInfo.ArgExpr = FromExpr;
695FlatTree[CurrentNode].ToArgInfo.ArgExpr = ToExpr;
696SetDefault(FromDefault, ToDefault);
700 boolFromAddressOf,
boolToAddressOf,
701 boolFromNullPtr,
boolToNullPtr,
Expr*FromExpr,
702 Expr*ToExpr,
boolFromDefault,
boolToDefault) {
703assert(FlatTree[CurrentNode].Kind == Invalid &&
"Node is not empty.");
705FlatTree[CurrentNode].FromArgInfo.VD = FromValueDecl;
706FlatTree[CurrentNode].ToArgInfo.VD = ToValueDecl;
707FlatTree[CurrentNode].FromArgInfo.NeedAddressOf = FromAddressOf;
708FlatTree[CurrentNode].ToArgInfo.NeedAddressOf = ToAddressOf;
709FlatTree[CurrentNode].FromArgInfo.IsNullPtr = FromNullPtr;
710FlatTree[CurrentNode].ToArgInfo.IsNullPtr = ToNullPtr;
711FlatTree[CurrentNode].FromArgInfo.ArgExpr = FromExpr;
712FlatTree[CurrentNode].ToArgInfo.ArgExpr = ToExpr;
713SetDefault(FromDefault, ToDefault);
716 voidSetFromDeclarationAndToIntegerDiff(
717 ValueDecl*FromValueDecl,
boolFromAddressOf,
boolFromNullPtr,
718 Expr*FromExpr,
constllvm::APSInt &ToInt,
boolIsValidToInt,
719 QualTypeToIntType,
Expr*ToExpr,
boolFromDefault,
boolToDefault) {
720assert(FlatTree[CurrentNode].Kind == Invalid &&
"Node is not empty.");
721FlatTree[CurrentNode].Kind = FromDeclarationAndToInteger;
722FlatTree[CurrentNode].FromArgInfo.VD = FromValueDecl;
723FlatTree[CurrentNode].FromArgInfo.NeedAddressOf = FromAddressOf;
724FlatTree[CurrentNode].FromArgInfo.IsNullPtr = FromNullPtr;
725FlatTree[CurrentNode].FromArgInfo.ArgExpr = FromExpr;
726FlatTree[CurrentNode].ToArgInfo.Val = ToInt;
727FlatTree[CurrentNode].ToArgInfo.IsValidInt = IsValidToInt;
728FlatTree[CurrentNode].ToArgInfo.ArgType = ToIntType;
729FlatTree[CurrentNode].ToArgInfo.ArgExpr = ToExpr;
730SetDefault(FromDefault, ToDefault);
733 voidSetFromIntegerAndToDeclarationDiff(
734 constllvm::APSInt &FromInt,
boolIsValidFromInt,
QualTypeFromIntType,
736 boolToNullPtr,
Expr*ToExpr,
boolFromDefault,
boolToDefault) {
737assert(FlatTree[CurrentNode].Kind == Invalid &&
"Node is not empty.");
738FlatTree[CurrentNode].Kind = FromIntegerAndToDeclaration;
739FlatTree[CurrentNode].FromArgInfo.Val = FromInt;
740FlatTree[CurrentNode].FromArgInfo.IsValidInt = IsValidFromInt;
741FlatTree[CurrentNode].FromArgInfo.ArgType = FromIntType;
742FlatTree[CurrentNode].FromArgInfo.ArgExpr = FromExpr;
743FlatTree[CurrentNode].ToArgInfo.VD = ToValueDecl;
744FlatTree[CurrentNode].ToArgInfo.NeedAddressOf = ToAddressOf;
745FlatTree[CurrentNode].ToArgInfo.IsNullPtr = ToNullPtr;
746FlatTree[CurrentNode].ToArgInfo.ArgExpr = ToExpr;
747SetDefault(FromDefault, ToDefault);
751 voidSetDefault(
boolFromDefault,
boolToDefault) {
752assert((!FromDefault || !ToDefault) &&
"Both arguments cannot be default.");
753FlatTree[CurrentNode].FromArgInfo.IsDefault = FromDefault;
754FlatTree[CurrentNode].ToArgInfo.IsDefault = ToDefault;
758 voidSetSame(
boolSame) {
759FlatTree[CurrentNode].Same =
Same;
763 voidSetKind(DiffKind Kind) {
764FlatTree[CurrentNode].Kind =
Kind;
769assert(FlatTree[CurrentNode].Kind != Invalid &&
770 "Cannot exit node before setting node information.");
771CurrentNode = FlatTree[CurrentNode].ParentNode;
777assert(FlatTree[CurrentNode].Kind == Template &&
778 "Only Template nodes can have children nodes.");
779FlatTree.push_back(DiffNode(CurrentNode));
780DiffNode &
Node= FlatTree[CurrentNode];
781 if(
Node.ChildNode == 0) {
783 Node.ChildNode = NextFreeNode;
788 for(i =
Node.ChildNode; FlatTree[i].NextNode != 0;
789i = FlatTree[i].NextNode) {
791FlatTree[i].NextNode = NextFreeNode;
793CurrentNode = NextFreeNode;
799 voidStartTraverse() {
801CurrentNode = NextFreeNode;
807ReadNode = FlatTree[ReadNode].ParentNode;
812assert(FlatTree[ReadNode].Kind == Template &&
"Unexpected kind.");
813FromTD = FlatTree[ReadNode].FromArgInfo.TD;
814ToTD = FlatTree[ReadNode].ToArgInfo.TD;
815FromQual = FlatTree[ReadNode].FromArgInfo.Qual;
816ToQual = FlatTree[ReadNode].ToArgInfo.Qual;
820assert(FlatTree[ReadNode].Kind ==
Type&&
"Unexpected kind");
821FromType = FlatTree[ReadNode].FromArgInfo.ArgType;
822ToType = FlatTree[ReadNode].ToArgInfo.ArgType;
825 voidGetExpressionDiff(
Expr*&FromExpr,
Expr*&ToExpr) {
826assert(FlatTree[ReadNode].Kind ==
Expression&&
"Unexpected kind");
827FromExpr = FlatTree[ReadNode].FromArgInfo.ArgExpr;
828ToExpr = FlatTree[ReadNode].ToArgInfo.ArgExpr;
832assert(FlatTree[ReadNode].Kind == TemplateTemplate &&
"Unexpected kind.");
833FromTD = FlatTree[ReadNode].FromArgInfo.TD;
834ToTD = FlatTree[ReadNode].ToArgInfo.TD;
837 voidGetIntegerDiff(llvm::APSInt &FromInt, llvm::APSInt &ToInt,
838 bool&IsValidFromInt,
bool&IsValidToInt,
841assert(FlatTree[ReadNode].Kind == Integer &&
"Unexpected kind.");
842FromInt = FlatTree[ReadNode].FromArgInfo.Val;
843ToInt = FlatTree[ReadNode].ToArgInfo.Val;
844IsValidFromInt = FlatTree[ReadNode].FromArgInfo.IsValidInt;
845IsValidToInt = FlatTree[ReadNode].ToArgInfo.IsValidInt;
846FromIntType = FlatTree[ReadNode].FromArgInfo.ArgType;
847ToIntType = FlatTree[ReadNode].ToArgInfo.ArgType;
848FromExpr = FlatTree[ReadNode].FromArgInfo.ArgExpr;
849ToExpr = FlatTree[ReadNode].ToArgInfo.ArgExpr;
853 bool&FromAddressOf,
bool&ToAddressOf,
854 bool&FromNullPtr,
bool&ToNullPtr,
Expr*&FromExpr,
856assert(FlatTree[ReadNode].Kind == Declaration &&
"Unexpected kind.");
857FromValueDecl = FlatTree[ReadNode].FromArgInfo.VD;
858ToValueDecl = FlatTree[ReadNode].ToArgInfo.VD;
859FromAddressOf = FlatTree[ReadNode].FromArgInfo.NeedAddressOf;
860ToAddressOf = FlatTree[ReadNode].ToArgInfo.NeedAddressOf;
861FromNullPtr = FlatTree[ReadNode].FromArgInfo.IsNullPtr;
862ToNullPtr = FlatTree[ReadNode].ToArgInfo.IsNullPtr;
863FromExpr = FlatTree[ReadNode].FromArgInfo.ArgExpr;
864ToExpr = FlatTree[ReadNode].ToArgInfo.ArgExpr;
867 voidGetFromDeclarationAndToIntegerDiff(
868 ValueDecl*&FromValueDecl,
bool&FromAddressOf,
bool&FromNullPtr,
869 Expr*&FromExpr, llvm::APSInt &ToInt,
bool&IsValidToInt,
871assert(FlatTree[ReadNode].Kind == FromDeclarationAndToInteger &&
872 "Unexpected kind.");
873FromValueDecl = FlatTree[ReadNode].FromArgInfo.VD;
874FromAddressOf = FlatTree[ReadNode].FromArgInfo.NeedAddressOf;
875FromNullPtr = FlatTree[ReadNode].FromArgInfo.IsNullPtr;
876FromExpr = FlatTree[ReadNode].FromArgInfo.ArgExpr;
877ToInt = FlatTree[ReadNode].ToArgInfo.Val;
878IsValidToInt = FlatTree[ReadNode].ToArgInfo.IsValidInt;
879ToIntType = FlatTree[ReadNode].ToArgInfo.ArgType;
880ToExpr = FlatTree[ReadNode].ToArgInfo.ArgExpr;
883 voidGetFromIntegerAndToDeclarationDiff(
884llvm::APSInt &FromInt,
bool&IsValidFromInt,
QualType&FromIntType,
886 bool&ToNullPtr,
Expr*&ToExpr) {
887assert(FlatTree[ReadNode].Kind == FromIntegerAndToDeclaration &&
888 "Unexpected kind.");
889FromInt = FlatTree[ReadNode].FromArgInfo.Val;
890IsValidFromInt = FlatTree[ReadNode].FromArgInfo.IsValidInt;
891FromIntType = FlatTree[ReadNode].FromArgInfo.ArgType;
892FromExpr = FlatTree[ReadNode].FromArgInfo.ArgExpr;
893ToValueDecl = FlatTree[ReadNode].ToArgInfo.VD;
894ToAddressOf = FlatTree[ReadNode].ToArgInfo.NeedAddressOf;
895ToNullPtr = FlatTree[ReadNode].ToArgInfo.IsNullPtr;
896ToExpr = FlatTree[ReadNode].ToArgInfo.ArgExpr;
901 returnFlatTree[ReadNode].FromArgInfo.IsDefault;
906 returnFlatTree[ReadNode].ToArgInfo.IsDefault;
911 returnFlatTree[ReadNode].Same;
916 returnFlatTree[ReadNode].ChildNode != 0;
921ReadNode = FlatTree[ReadNode].ChildNode;
926 boolAdvanceSibling() {
927 if(FlatTree[ReadNode].NextNode == 0)
930ReadNode = FlatTree[ReadNode].NextNode;
935 boolHasNextSibling() {
936 returnFlatTree[ReadNode].NextNode != 0;
946 returnFlatTree[ReadNode].Kind;
963 structInternalIterator {
981: TST(TST), Index(0), CurrentTA(nullptr), EndTA(nullptr) {
984 if(isEnd())
return;
995 if(CurrentTA != EndTA)
return;
1003 boolisValid()
const{
returnTST; }
1006 boolisEnd()
const{
1007assert(TST &&
"InternalIterator is invalid with a null TST.");
1012InternalIterator &operator++() {
1013assert(TST &&
"InternalIterator is invalid with a null TST.");
1019 if(CurrentTA != EndTA) {
1021 if(CurrentTA != EndTA)
1041 if(CurrentTA != EndTA)
1049assert(TST &&
"InternalIterator is invalid with a null TST.");
1050assert(!isEnd() &&
"Index exceeds number of arguments.");
1051 if(CurrentTA == EndTA)
1058pointer operator->()
const{
1059assert(TST &&
"InternalIterator is invalid with a null TST.");
1064InternalIterator SugaredIterator;
1065InternalIterator DesugaredIterator;
1069: SugaredIterator(TST),
1071(TST->isSugared() && !TST->isTypeAlias())
1072? GetTemplateSpecializationType(Context, TST->desugar())
1076TSTiterator &operator++() {
1078 if(DesugaredIterator.isValid())
1079++DesugaredIterator;
1085 return*SugaredIterator;
1089pointer operator->()
const{
1094 boolisEnd()
const{
1095 returnSugaredIterator.isEnd();
1100 boolhasDesugaredTA()
const{
1101 returnDesugaredIterator.isValid() && !DesugaredIterator.isEnd();
1105reference getDesugaredTA()
const{
1106assert(DesugaredIterator.isValid() &&
1107 "Desugared TemplateArgument should not be used.");
1108 return*DesugaredIterator;
1122Ty = SubstType->getReplacementType();
1130dyn_cast<ClassTemplateSpecializationDecl>(RT->
getDecl());
1154FromArgTST = GetTemplateSpecializationType(Context, FromType);
1155ToArgTST = GetTemplateSpecializationType(Context, ToType);
1157 if(!FromArgTST || !ToArgTST)
1160 if(!hasSameTemplate(Context, FromArgTST, ToArgTST))
1167 voidDiffTypes(
constTSTiterator &FromIter,
constTSTiterator &ToIter) {
1168 QualTypeFromType = GetType(FromIter);
1171 boolFromDefault = FromIter.isEnd() && !FromType.
isNull();
1172 boolToDefault = ToIter.isEnd() && !ToType.
isNull();
1176 if(OnlyPerformTypeDiff(Context, FromType, ToType, FromArgTST, ToArgTST)) {
1177 Tree.SetTypeDiff(FromType, ToType, FromDefault, ToDefault);
1181assert(FromArgTST && ToArgTST &&
1182 "Both template specializations need to be valid.");
1189FromQual, ToQual, FromDefault, ToDefault);
1190DiffTemplate(FromArgTST, ToArgTST);
1196 voidDiffTemplateTemplates(
constTSTiterator &FromIter,
1197 constTSTiterator &ToIter) {
1201ToIter.isEnd() && ToDecl);
1207 static voidInitializeNonTypeDiffVariables(
ASTContext&Context,
1208 constTSTiterator &
Iter,
1210llvm::APSInt &
Value,
bool&HasInt,
1211 QualType&IntType,
bool&IsNullPtr,
1213 bool&NeedAddressOf) {
1214 if(!
Iter.isEnd()) {
1215 switch(
Iter->getKind()) {
1224IntType =
Iter->getIntegralType();
1227VD =
Iter->getAsDecl();
1232NeedAddressOf =
true;
1239 E=
Iter->getAsExpr();
1245llvm_unreachable(
"TemplateArgument kind is not expected for NTTP");
1247llvm_unreachable(
"TemplateArgument kind should be handled elsewhere");
1249}
else if(!
Default->isParameterPack()) {
1250 E=
Default->getDefaultArgument().getArgument().getAsExpr();
1253 if(!
Iter.hasDesugaredTA())
1273NeedAddressOf =
true;
1290llvm_unreachable(
"TemplateArgument kind is not expected for NTTP");
1292llvm_unreachable(
"TemplateArgument kind should be handled elsewhere");
1294llvm_unreachable(
"Unexpected TemplateArgument kind");
1299 voidDiffNonTypes(
constTSTiterator &FromIter,
constTSTiterator &ToIter,
1302 Expr*FromExpr =
nullptr, *ToExpr =
nullptr;
1303llvm::APSInt FromInt, ToInt;
1305 ValueDecl*FromValueDecl =
nullptr, *ToValueDecl =
nullptr;
1306 boolHasFromInt =
false, HasToInt =
false, FromNullPtr =
false,
1307ToNullPtr =
false, NeedFromAddressOf =
false, NeedToAddressOf =
false;
1308InitializeNonTypeDiffVariables(
1309Context, FromIter, FromDefaultNonTypeDecl, FromInt, HasFromInt,
1310FromIntType, FromNullPtr, FromExpr, FromValueDecl, NeedFromAddressOf);
1311InitializeNonTypeDiffVariables(Context, ToIter, ToDefaultNonTypeDecl, ToInt,
1312HasToInt, ToIntType, ToNullPtr, ToExpr,
1313ToValueDecl, NeedToAddressOf);
1315 boolFromDefault = FromIter.isEnd() &&
1316(FromExpr || FromValueDecl || HasFromInt || FromNullPtr);
1317 boolToDefault = ToIter.isEnd() &&
1318(ToExpr || ToValueDecl || HasToInt || ToNullPtr);
1320 boolFromDeclaration = FromValueDecl || FromNullPtr;
1321 boolToDeclaration = ToValueDecl || ToNullPtr;
1323 if(FromDeclaration && HasToInt) {
1324 Tree.SetFromDeclarationAndToIntegerDiff(
1325FromValueDecl, NeedFromAddressOf, FromNullPtr, FromExpr, ToInt,
1326HasToInt, ToIntType, ToExpr, FromDefault, ToDefault);
1327 Tree.SetSame(
false);
1332 if(HasFromInt && ToDeclaration) {
1333 Tree.SetFromIntegerAndToDeclarationDiff(
1334FromInt, HasFromInt, FromIntType, FromExpr, ToValueDecl,
1335NeedToAddressOf, ToNullPtr, ToExpr, FromDefault, ToDefault);
1336 Tree.SetSame(
false);
1340 if(HasFromInt || HasToInt) {
1341 Tree.SetIntegerDiff(FromInt, ToInt, HasFromInt, HasToInt, FromIntType,
1342ToIntType, FromExpr, ToExpr, FromDefault, ToDefault);
1343 if(HasFromInt && HasToInt) {
1350 if(FromDeclaration || ToDeclaration) {
1351 Tree.SetDeclarationDiff(FromValueDecl, ToValueDecl, NeedFromAddressOf,
1352NeedToAddressOf, FromNullPtr, ToNullPtr, FromExpr,
1353ToExpr, FromDefault, ToDefault);
1354 boolBothNull = FromNullPtr && ToNullPtr;
1355 boolSameValueDecl =
1356FromValueDecl && ToValueDecl &&
1357NeedFromAddressOf == NeedToAddressOf &&
1359 Tree.SetSame(BothNull || SameValueDecl);
1363assert((FromExpr || ToExpr) &&
"Both template arguments cannot be empty.");
1364 Tree.SetExpressionDiff(FromExpr, ToExpr, FromDefault, ToDefault);
1365 Tree.SetSame(IsEqualExpr(Context, FromExpr, ToExpr));
1383 unsignedTotalArgs = 0;
1384 for(TSTiterator FromIter(Context, FromTST), ToIter(Context, ToTST);
1385!FromIter.isEnd() || !ToIter.isEnd(); ++TotalArgs) {
1391 unsignedFromParamIndex = std::min(TotalArgs, ParamsFrom->
size() - 1);
1392 unsignedToParamIndex = std::min(TotalArgs, ParamsTo->
size() - 1);
1397 "Parameter Decl are not the same kind.");
1399 if(isa<TemplateTypeParmDecl>(FromParamND)) {
1400DiffTypes(FromIter, ToIter);
1401}
else if(isa<TemplateTemplateParmDecl>(FromParamND)) {
1402DiffTemplateTemplates(FromIter, ToIter);
1403}
else if(isa<NonTypeTemplateParmDecl>(FromParamND)) {
1405cast<NonTypeTemplateParmDecl>(FromParamND);
1407cast<NonTypeTemplateParmDecl>(ToParamND);
1408DiffNonTypes(FromIter, ToIter, FromDefaultNonTypeDecl,
1409ToDefaultNonTypeDecl);
1411llvm_unreachable(
"Unexpected Decl type.");
1421 static voidmakeTemplateList(
1425TemplateList.push_back(TST);
1434 static boolhasSameBaseTemplate(
ASTContext&Context,
1447 static boolhasSameTemplate(
ASTContext&Context,
1451 if(hasSameBaseTemplate(Context, FromTST, ToTST))
1458makeTemplateList(FromTemplateList, FromTST);
1459makeTemplateList(ToTemplateList, ToTST);
1462FromIter = FromTemplateList.rbegin(), FromEnd = FromTemplateList.rend(),
1463ToIter = ToTemplateList.rbegin(), ToEnd = ToTemplateList.rend();
1466 if(!hasSameBaseTemplate(Context, *FromIter, *ToIter))
1472 for(; FromIter != FromEnd && ToIter != ToEnd; ++FromIter, ++ToIter) {
1473 if(!hasSameBaseTemplate(Context, *FromIter, *ToIter))
1477FromTST = FromIter[-1];
1486 if(!
Iter.isEnd())
1487 return Iter->getAsType();
1488 if(
Iter.hasDesugaredTA())
1489 return Iter.getDesugaredTA().getAsType();
1496 if(!
Iter.isEnd())
1497 return Iter->getAsTemplate().getAsTemplateDecl();
1498 if(
Iter.hasDesugaredTA())
1499 return Iter.getDesugaredTA().getAsTemplate().getAsTemplateDecl();
1507 if(FromExpr == ToExpr)
1510 if(!FromExpr || !ToExpr)
1513llvm::FoldingSetNodeID FromID, ToID;
1514FromExpr->
Profile(FromID, Context,
true);
1515ToExpr->
Profile(ToID, Context,
true);
1516 returnFromID == ToID;
1524 voidTreeToString(
intIndent = 1) {
1527OS.indent(2 * Indent);
1533 switch(
Tree.GetKind()) {
1534 caseDiffTree::Invalid:
1535llvm_unreachable(
"Template diffing failed with bad DiffNode");
1536 caseDiffTree::Type: {
1538 Tree.GetTypeDiff(FromType, ToType);
1539PrintTypeNames(FromType, ToType,
Tree.FromDefault(),
Tree.ToDefault(),
1540 Tree.NodeIsSame());
1543 caseDiffTree::Expression: {
1544 Expr*FromExpr, *ToExpr;
1545 Tree.GetExpressionDiff(FromExpr, ToExpr);
1546PrintExpr(FromExpr, ToExpr,
Tree.FromDefault(),
Tree.ToDefault(),
1547 Tree.NodeIsSame());
1550 caseDiffTree::TemplateTemplate: {
1552 Tree.GetTemplateTemplateDiff(FromTD, ToTD);
1553PrintTemplateTemplate(FromTD, ToTD,
Tree.FromDefault(),
1554 Tree.ToDefault(),
Tree.NodeIsSame());
1557 caseDiffTree::Integer: {
1558llvm::APSInt FromInt, ToInt;
1559 Expr*FromExpr, *ToExpr;
1560 boolIsValidFromInt, IsValidToInt;
1562 Tree.GetIntegerDiff(FromInt, ToInt, IsValidFromInt, IsValidToInt,
1563FromIntType, ToIntType, FromExpr, ToExpr);
1564PrintAPSInt(FromInt, ToInt, IsValidFromInt, IsValidToInt, FromIntType,
1565ToIntType, FromExpr, ToExpr,
Tree.FromDefault(),
1566 Tree.ToDefault(),
Tree.NodeIsSame());
1569 caseDiffTree::Declaration: {
1571 boolFromAddressOf, ToAddressOf;
1572 boolFromNullPtr, ToNullPtr;
1573 Expr*FromExpr, *ToExpr;
1574 Tree.GetDeclarationDiff(FromValueDecl, ToValueDecl, FromAddressOf,
1575ToAddressOf, FromNullPtr, ToNullPtr, FromExpr,
1577PrintValueDecl(FromValueDecl, ToValueDecl, FromAddressOf, ToAddressOf,
1578FromNullPtr, ToNullPtr, FromExpr, ToExpr,
1579 Tree.FromDefault(),
Tree.ToDefault(),
Tree.NodeIsSame());
1582 caseDiffTree::FromDeclarationAndToInteger: {
1591 Tree.GetFromDeclarationAndToIntegerDiff(
1592FromValueDecl, FromAddressOf, FromNullPtr, FromExpr, ToInt,
1593IsValidToInt, ToIntType, ToExpr);
1594assert((FromValueDecl || FromNullPtr) && IsValidToInt);
1595PrintValueDeclAndInteger(FromValueDecl, FromAddressOf, FromNullPtr,
1596FromExpr,
Tree.FromDefault(), ToInt, ToIntType,
1597ToExpr,
Tree.ToDefault());
1600 caseDiffTree::FromIntegerAndToDeclaration: {
1601llvm::APSInt FromInt;
1602 boolIsValidFromInt;
1609 Tree.GetFromIntegerAndToDeclarationDiff(
1610FromInt, IsValidFromInt, FromIntType, FromExpr, ToValueDecl,
1611ToAddressOf, ToNullPtr, ToExpr);
1612assert(IsValidFromInt && (ToValueDecl || ToNullPtr));
1613PrintIntegerAndValueDecl(FromInt, FromIntType, FromExpr,
1614 Tree.FromDefault(), ToValueDecl, ToAddressOf,
1615ToNullPtr, ToExpr,
Tree.ToDefault());
1618 caseDiffTree::Template: {
1622 Tree.GetTemplateDiff(FromTD, ToTD, FromQual, ToQual);
1624PrintQualifiers(FromQual, ToQual);
1626 if(!
Tree.HasChildren()) {
1634 Tree.MoveToChild();
1635 unsignedNumElideArgs = 0;
1636 boolAllArgsElided =
true;
1639 if(
Tree.NodeIsSame()) {
1643AllArgsElided =
false;
1644 if(NumElideArgs > 0) {
1645PrintElideArgs(NumElideArgs, Indent);
1650TreeToString(Indent);
1651 if(
Tree.HasNextSibling())
1653}
while(
Tree.AdvanceSibling());
1654 if(NumElideArgs > 0) {
1658PrintElideArgs(NumElideArgs, Indent);
1674assert(!IsBold &&
"Attempting to bold text that is already bold.");
1682assert(IsBold &&
"Attempting to remove bold from unbold text.");
1694 boolFromDefault,
boolToDefault,
boolSame) {
1696 "Only one template argument may be missing.");
1708PrintQualifiers(FromQual, ToQual);
1713std::string FromTypeStr = FromType.
isNull() ?
"(no argument)" 1715std::string ToTypeStr = ToType.
isNull() ?
"(no argument)" 1719 if(FromTypeStr == ToTypeStr) {
1720 const auto*FromElTy = dyn_cast<ElaboratedType>(FromType),
1721*ToElTy = dyn_cast<ElaboratedType>(ToType);
1722 if(FromElTy || ToElTy) {
1723std::string FromNamedTypeStr =
1724FromElTy ? FromElTy->getNamedType().getAsString(Policy)
1726std::string ToNamedTypeStr =
1727ToElTy ? ToElTy->getNamedType().getAsString(Policy) : ToTypeStr;
1728 if(FromNamedTypeStr != ToNamedTypeStr) {
1729FromTypeStr = FromNamedTypeStr;
1730ToTypeStr = ToNamedTypeStr;
1735std::string FromCanTypeStr =
1738 if(FromCanTypeStr != ToCanTypeStr) {
1739FromTypeStr = FromCanTypeStr;
1740ToTypeStr = ToCanTypeStr;
1745 if(PrintTree) OS <<
'[';
1746OS << (FromDefault ?
"(default) ":
"");
1751OS <<
" != "<< (ToDefault ?
"(default) ":
"");
1761 voidPrintExpr(
const Expr*FromExpr,
const Expr*ToExpr,
boolFromDefault,
1762 boolToDefault,
boolSame) {
1763assert((FromExpr || ToExpr) &&
1764 "Only one template argument may be missing.");
1766PrintExpr(FromExpr);
1767}
else if(!PrintTree) {
1768OS << (FromDefault ?
"(default) ":
"");
1770PrintExpr(FromExpr);
1773OS << (FromDefault ?
"[(default) ":
"[");
1775PrintExpr(FromExpr);
1777OS <<
" != "<< (ToDefault ?
"(default) ":
"");
1786 voidPrintExpr(
const Expr*
E) {
1791OS <<
"(no argument)";
1797 boolFromDefault,
boolToDefault,
boolSame) {
1798assert((FromTD || ToTD) &&
"Only one template argument may be missing.");
1800std::string FromName =
1801std::string(FromTD ? FromTD->
getName() :
"(no argument)");
1802std::string ToName = std::string(ToTD ? ToTD->
getName() :
"(no argument)");
1803 if(FromTD && ToTD && FromName == ToName) {
1810}
else if(!PrintTree) {
1811OS << (FromDefault ?
"(default) template ":
"template ");
1816OS << (FromDefault ?
"[(default) template ":
"[template ");
1820OS <<
" != "<< (ToDefault ?
"(default) template ":
"template ");
1830 voidPrintAPSInt(
constllvm::APSInt &FromInt,
constllvm::APSInt &ToInt,
1831 boolIsValidFromInt,
boolIsValidToInt,
QualTypeFromIntType,
1833 boolFromDefault,
boolToDefault,
boolSame) {
1834assert((IsValidFromInt || IsValidToInt) &&
1835 "Only one integral argument may be missing.");
1839OS << ((FromInt == 0) ?
"false":
"true");
1846 boolPrintType = IsValidFromInt && IsValidToInt &&
1850OS << (FromDefault ?
"(default) ":
"");
1851PrintAPSInt(FromInt, FromExpr, IsValidFromInt, FromIntType, PrintType);
1853OS << (FromDefault ?
"[(default) ":
"[");
1854PrintAPSInt(FromInt, FromExpr, IsValidFromInt, FromIntType, PrintType);
1855OS <<
" != "<< (ToDefault ?
"(default) ":
"");
1856PrintAPSInt(ToInt, ToExpr, IsValidToInt, ToIntType, PrintType);
1863 voidPrintAPSInt(
constllvm::APSInt &Val,
Expr*
E,
boolValid,
1864 QualTypeIntType,
boolPrintType) {
1867 if(HasExtraInfo(
E)) {
1883OS << ((Val == 0) ?
"false":
"true");
1890OS <<
"(no argument)";
1897 boolHasExtraInfo(
Expr*
E) {
1898 if(!
E)
return false;
1902 autoCheckIntegerLiteral = [](
Expr*
E) {
1903 if(
auto*TemplateExpr = dyn_cast<SubstNonTypeTemplateParmExpr>(
E))
1904 E= TemplateExpr->getReplacement();
1905 returnisa<IntegerLiteral>(
E);
1908 if(CheckIntegerLiteral(
E))
return false;
1911 if(UO->getOpcode() == UO_Minus)
1912 if(CheckIntegerLiteral(UO->getSubExpr()))
1915 if(isa<CXXBoolLiteralExpr>(
E))
1921 voidPrintValueDecl(
ValueDecl*VD,
boolAddressOf,
Expr*
E,
boolNullPtr) {
1925 else if(
auto*TPO = dyn_cast<TemplateParamObjectDecl>(VD)) {
1929TPO->getType().getUnqualifiedType().print(OS, Policy);
1930TPO->printAsInit(OS, Policy);
1938 if(
E&& !isa<CXXNullPtrLiteralExpr>(
E)) {
1958OS <<
"(no argument)";
1964 boolFromAddressOf,
boolToAddressOf,
boolFromNullPtr,
1965 boolToNullPtr,
Expr*FromExpr,
Expr*ToExpr,
1966 boolFromDefault,
boolToDefault,
boolSame) {
1967assert((FromValueDecl || FromNullPtr || ToValueDecl || ToNullPtr) &&
1968 "Only one Decl argument may be NULL");
1971PrintValueDecl(FromValueDecl, FromAddressOf, FromExpr, FromNullPtr);
1972}
else if(!PrintTree) {
1973OS << (FromDefault ?
"(default) ":
"");
1975PrintValueDecl(FromValueDecl, FromAddressOf, FromExpr, FromNullPtr);
1978OS << (FromDefault ?
"[(default) ":
"[");
1980PrintValueDecl(FromValueDecl, FromAddressOf, FromExpr, FromNullPtr);
1982OS <<
" != "<< (ToDefault ?
"(default) ":
"");
1984PrintValueDecl(ToValueDecl, ToAddressOf, ToExpr, ToNullPtr);
1992 voidPrintValueDeclAndInteger(
ValueDecl*VD,
boolNeedAddressOf,
1993 boolIsNullPtr,
Expr*VDExpr,
boolDefaultDecl,
1994 constllvm::APSInt &Val,
QualTypeIntType,
1995 Expr*IntExpr,
boolDefaultInt) {
1997OS << (DefaultDecl ?
"(default) ":
"");
1999PrintValueDecl(VD, NeedAddressOf, VDExpr, IsNullPtr);
2002OS << (DefaultDecl ?
"[(default) ":
"[");
2004PrintValueDecl(VD, NeedAddressOf, VDExpr, IsNullPtr);
2006OS <<
" != "<< (DefaultInt ?
"(default) ":
"");
2007PrintAPSInt(Val, IntExpr,
true, IntType,
false);
2014 voidPrintIntegerAndValueDecl(
constllvm::APSInt &Val,
QualTypeIntType,
2016 boolNeedAddressOf,
boolIsNullPtr,
2017 Expr*VDExpr,
boolDefaultDecl) {
2019OS << (DefaultInt ?
"(default) ":
"");
2020PrintAPSInt(Val, IntExpr,
true, IntType,
false);
2022OS << (DefaultInt ?
"[(default) ":
"[");
2023PrintAPSInt(Val, IntExpr,
true, IntType,
false);
2024OS <<
" != "<< (DefaultDecl ?
"(default) ":
"");
2026PrintValueDecl(VD, NeedAddressOf, VDExpr, IsNullPtr);
2033 voidPrintElideArgs(
unsignedNumElideArgs,
unsignedIndent) {
2036 for(
unsignedi = 0; i < Indent; ++i)
2039 if(NumElideArgs == 0)
return;
2040 if(NumElideArgs == 1)
2043OS <<
"["<< NumElideArgs <<
" * ...]";
2053 if(FromQual == ToQual) {
2054PrintQualifier(FromQual,
false);
2074 if(CommonQual.
empty() && FromQual.
empty()) {
2076OS <<
"(no qualifiers) ";
2079PrintQualifier(CommonQual,
false);
2080PrintQualifier(FromQual,
true);
2083 if(CommonQual.
empty() && ToQual.
empty()) {
2085OS <<
"(no qualifiers)";
2088PrintQualifier(CommonQual,
false,
2090PrintQualifier(ToQual,
true,
2095PrintQualifier(CommonQual,
false);
2096PrintQualifier(FromQual,
true);
2100 voidPrintQualifier(
QualifiersQ,
boolApplyBold,
2101 boolAppendSpaceIfNonEmpty =
true) {
2102 if(Q.
empty())
return;
2103 if(ApplyBold)
Bold();
2104Q.
print(OS, Policy, AppendSpaceIfNonEmpty);
2105 if(ApplyBold) Unbold();
2111 QualTypeToType,
boolPrintTree,
boolPrintFromType,
2112 boolElideType,
boolShowColor)
2114Policy(Context.getLangOpts()),
2115ElideType(ElideType),
2116PrintTree(PrintTree),
2117ShowColor(ShowColor),
2119FromTemplateType(PrintFromType ? FromType : ToType),
2120ToTemplateType(PrintFromType ? ToType : FromType),
2126 voidDiffTemplate() {
2131GetTemplateSpecializationType(Context, FromTemplateType);
2133GetTemplateSpecializationType(Context, ToTemplateType);
2136 if(!FromOrigTST || !ToOrigTST)
2140 if(!hasSameTemplate(Context, FromOrigTST, ToOrigTST)) {
2148 Tree.SetTemplateDiff(
2152FromQual, ToQual,
false,
false);
2154DiffTemplate(FromOrigTST, ToOrigTST);
2161 Tree.StartTraverse();
2166assert(!IsBold &&
"Bold is applied to end of string.");
2177 boolPrintFromType,
boolElideType,
2180PrintFromType =
true;
2181TemplateDiff TD(OS, Context, FromType, ToType, PrintTree, PrintFromType,
Defines the clang::ASTContext interface.
static bool FormatTemplateTypeDiff(ASTContext &Context, QualType FromType, QualType ToType, bool PrintTree, bool PrintFromType, bool ElideType, bool ShowColors, raw_ostream &OS)
FormatTemplateTypeDiff - A helper static function to start the template diff and return the properly ...
static std::string ConvertTypeToDiagnosticString(ASTContext &Context, QualType Ty, ArrayRef< DiagnosticsEngine::ArgumentValue > PrevArgs, ArrayRef< intptr_t > QualTypeVals)
Convert the given type to a string suitable for printing as part of a diagnostic.
This file provides some common utility functions for processing Lambda related AST Constructs.
clang::CharUnits operator*(clang::CharUnits::QuantityType Scale, const clang::CharUnits &CU)
Defines the C++ template declaration subclasses.
Defines the clang::Expr interface and subclasses for C++ expressions.
static std::string toString(const clang::SanitizerSet &Sanitizers)
Produce a string containing comma-separated names of sanitizers in Sanitizers set.
C Language Family Type Representation.
const NamedDecl * FromDecl
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
QualType getRValueReferenceType(QualType T) const
Return the uniqued reference to the type for an rvalue reference to the specified type.
QualType getBuiltinVaListType() const
Retrieve the type of the __builtin_va_list type.
QualType getObjCClassType() const
Represents the Objective-C Class type.
QualType getAttributedType(attr::Kind attrKind, QualType modifiedType, QualType equivalentType, const Attr *attr=nullptr) const
QualType getTemplateSpecializationType(TemplateName T, ArrayRef< TemplateArgument > Args, QualType Canon=QualType()) const
QualType getBuiltinMSVaListType() const
Retrieve the type of the __builtin_ms_va_list type.
QualType getVariableArrayType(QualType EltTy, Expr *NumElts, ArraySizeModifier ASM, unsigned IndexTypeQuals, SourceRange Brackets) const
Return a non-unique reference to the type for a variable array of the specified element type.
QualType getFunctionNoProtoType(QualType ResultTy, const FunctionType::ExtInfo &Info) const
Return a K&R style C function type like 'int()'.
bool hasSameType(QualType T1, QualType T2) const
Determine whether the given types T1 and T2 are equivalent.
TemplateName getCanonicalTemplateName(TemplateName Name, bool IgnoreDeduced=false) const
Retrieves the "canonical" template name that refers to a given template.
QualType getPointerType(QualType T) const
Return the uniqued reference to the type for a pointer to the specified type.
QualType getLValueReferenceType(QualType T, bool SpelledAsLValue=true) const
Return the uniqued reference to the type for an lvalue reference to the specified type.
QualType getTypeDeclType(const TypeDecl *Decl, const TypeDecl *PrevDecl=nullptr) const
Return the unique reference to the type for the specified type declaration.
QualType getConstantArrayType(QualType EltTy, const llvm::APInt &ArySize, const Expr *SizeExpr, ArraySizeModifier ASM, unsigned IndexTypeQuals) const
Return the unique reference to the type for a constant array of the specified element type.
const LangOptions & getLangOpts() const
QualType getObjCProtoType() const
Retrieve the type of the Objective-C Protocol class.
QualType getObjCSelType() const
Retrieve the type that corresponds to the predefined Objective-C 'SEL' type.
QualType getObjCObjectPointerType(QualType OIT) const
Return a ObjCObjectPointerType type for the given ObjCObjectType.
QualType getObjCObjectType(QualType Base, ObjCProtocolDecl *const *Protocols, unsigned NumProtocols) const
Legacy interface: cannot provide type arguments or __kindof.
const clang::PrintingPolicy & getPrintingPolicy() const
QualType getDependentSizedArrayType(QualType EltTy, Expr *NumElts, ArraySizeModifier ASM, unsigned IndexTypeQuals, SourceRange Brackets) const
Return a non-unique reference to the type for a dependently-sized array of the specified element type...
QualType getObjCIdType() const
Represents the Objective-CC id type.
QualType getFunctionType(QualType ResultTy, ArrayRef< QualType > Args, const FunctionProtoType::ExtProtoInfo &EPI) const
Return a normal function type with a typed argument list.
QualType getIncompleteArrayType(QualType EltTy, ArraySizeModifier ASM, unsigned IndexTypeQuals) const
Return a unique reference to the type for an incomplete array of the specified element type.
Represents a type which was implicitly adjusted by the semantic engine for arbitrary reasons.
Attr - This represents one attribute.
const char * getSpelling() const
An attributed type is a type to which a type attribute has been applied.
static std::optional< NullabilityKind > stripOuterNullability(QualType &T)
Strip off the top-level nullability annotation on the given type, if it's there.
Represents a C++11 auto or C++14 decltype(auto) type, possibly constrained by a type-constraint.
Represents a class template specialization, which refers to a class template with a given set of temp...
ClassTemplateDecl * getSpecializedTemplate() const
Retrieve the template that this specialization specializes.
const TemplateArgumentList & getTemplateArgs() const
Retrieve the template arguments of the class template specialization.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
bool isTranslationUnit() const
virtual Decl * getCanonicalDecl()
Retrieves the "canonical" declaration of the given declaration.
static DeclarationName getFromOpaqueInteger(uintptr_t P)
Get a declaration name from an opaque integer returned by getAsOpaqueInteger.
@ ak_nameddecl
NamedDecl *.
@ ak_declcontext
DeclContext *.
@ ak_addrspace
address space
@ ak_qualtype_pair
pair<QualType, QualType>
@ ak_declarationname
DeclarationName.
@ ak_nestednamespec
NestedNameSpecifier *.
Represents a type that was referred to using an elaborated type keyword, e.g., struct S,...
This represents one expression.
Expr * IgnoreImpCasts() LLVM_READONLY
Skip past any implicit casts which might surround this expression until reaching a fixed point.
Represents a prototype with parameter type info, e.g.
ExtProtoInfo getExtProtoInfo() const
ArrayRef< QualType > param_types() const
FunctionType - C99 6.7.5.3 - Function Declarators.
An lvalue reference type, per C++11 [dcl.ref].
Sugar type that represents a type that was qualified by a qualifier written as a macro invocation.
This represents a decl that may have a name.
StringRef getName() const
Get the name of identifier for this declaration as a StringRef.
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
std::string getQualifiedNameAsString() const
virtual void getNameForDiagnostic(raw_ostream &OS, const PrintingPolicy &Policy, bool Qualified) const
Appends a human-readable name for this declaration into the given stream.
virtual void printName(raw_ostream &OS, const PrintingPolicy &Policy) const
Pretty-print the unqualified name of this declaration.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
void print(raw_ostream &OS, const PrintingPolicy &Policy, bool ResolveTemplateArguments=false) const
Print this nested name specifier to the given output stream.
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
Represents a pointer to an Objective C object.
Represents a class type in Objective C.
Sugar for parentheses used when specifying types.
PointerType - C99 6.7.5.1 - Pointer Declarators.
A (possibly-)qualified type.
QualType getLocalUnqualifiedType() const
Return this type with all of the instance-specific qualifiers removed, but without removing any quali...
bool isNull() const
Return true if this QualType doesn't point to a type yet.
static QualType getFromOpaquePtr(const void *Ptr)
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.
void print(raw_ostream &OS, const PrintingPolicy &Policy, const Twine &PlaceHolder=Twine(), unsigned Indentation=0) const
QualType getCanonicalType() const
static std::string getAsString(SplitQualType split, const PrintingPolicy &Policy)
Qualifiers getLocalQualifiers() const
Retrieve the set of qualifiers local to this particular QualType instance, not including any qualifie...
A qualifier set is used to build a set of qualifiers.
const Type * strip(QualType type)
Collect any qualifiers on the given type and return an unqualified type.
QualType apply(const ASTContext &Context, QualType QT) const
Apply the collected qualifiers to the given type.
The collection of all-type qualifiers we support.
static Qualifiers removeCommonQualifiers(Qualifiers &L, Qualifiers &R)
Returns the common set of qualifiers while removing them from the given sets.
void print(raw_ostream &OS, const PrintingPolicy &Policy, bool appendSpaceIfNonEmpty=false) const
std::string getAsString() const
static Qualifiers fromOpaqueValue(uint64_t opaque)
static std::string getAddrSpaceAsString(LangAS AS)
An rvalue reference type, per C++11 [dcl.ref].
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
RecordDecl * getDecl() const
void printPretty(raw_ostream &OS, PrinterHelper *Helper, const PrintingPolicy &Policy, unsigned Indentation=0, StringRef NewlineSymbol="\n", const ASTContext *Context=nullptr) const
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context, bool Canonical, bool ProfileLambdaExpr=false) const
Produce a unique representation of the given statement.
Represents the result of substituting a type for a template type parameter.
ArrayRef< TemplateArgument > asArray() const
Produce this as an array ref.
Represents a template argument.
QualType getParamTypeForDecl() const
Expr * getAsExpr() const
Retrieve the template argument as an expression.
pack_iterator pack_end() const
Iterator referencing one past the last argument of a template argument pack.
pack_iterator pack_begin() const
Iterator referencing the first argument of a template argument pack.
llvm::APSInt getAsIntegral() const
Retrieve the template argument as an integral value.
QualType getIntegralType() const
Retrieve the type of the integral value.
ValueDecl * getAsDecl() const
Retrieve the declaration for a declaration non-type template argument.
@ Declaration
The template argument is a declaration that was provided for a pointer, reference,...
@ Template
The template argument is a template name that was provided for a template template parameter.
@ StructuralValue
The template argument is a non-type template argument that can't be represented by the special-case D...
@ Pack
The template argument is actually a parameter pack.
@ TemplateExpansion
The template argument is a pack expansion of a template name that was provided for a template templat...
@ NullPtr
The template argument is a null pointer or null pointer to member that was provided for a non-type te...
@ Type
The template argument is a type.
@ Null
Represents an empty template argument, e.g., one that has not been deduced.
@ Integral
The template argument is an integral value stored in an llvm::APSInt that was provided for an integra...
@ Expression
The template argument is an expression, and we've not resolved it to one of the other forms yet,...
ArgKind getKind() const
Return the kind of stored template argument.
The base class of all kinds of template declarations (e.g., class, function, etc.).
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
Represents a C++ template name within the type system.
TemplateDecl * getAsTemplateDecl(bool IgnoreDeduced=false) const
Retrieve the underlying template declaration that this template name refers to, if known.
Stores a list of template parameters for a TemplateDecl and its derived classes.
NamedDecl * getParam(unsigned Idx)
Represents a type template specialization; the template must be a class template, a type alias templa...
QualType getAliasedType() const
Get the aliased type, if this is a specialization of a type alias template.
ArrayRef< TemplateArgument > template_arguments() const
TemplateName getTemplateName() const
Retrieve the name of the template that we are specializing.
bool isTypeAlias() const
Determine if this template specialization type is for a type alias template that has been substituted...
Represents a declaration of a type.
The base class of the type hierarchy.
bool isBooleanType() const
bool isPointerType() const
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
TypeClass getTypeClass() const
const T * getAs() const
Member-template getAs<specific type>'.
UnaryOperator - This represents the unary-expression's (except sizeof and alignof),...
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
Represents a GCC generic vector type.
The JSON file list parser is used to communicate input to InstallAPI.
QualType desugarForDiagnostic(ASTContext &Context, QualType QT, bool &ShouldAKA)
Returns a desugared version of the QualType, and marks ShouldAKA as true whenever we remove significa...
bool isLambdaCallOperator(const CXXMethodDecl *MD)
LangAS
Defines the address space values used by the address space qualifier of QualType.
const char ToggleHighlight
Special character that the diagnostic printer will use to toggle the bold attribute.
void FormatASTNodeDiagnosticArgument(DiagnosticsEngine::ArgumentKind Kind, intptr_t Val, StringRef Modifier, StringRef Argument, ArrayRef< DiagnosticsEngine::ArgumentValue > PrevArgs, SmallVectorImpl< char > &Output, void *Cookie, ArrayRef< intptr_t > QualTypeVals)
DiagnosticsEngine argument formatting function for diagnostics that involve AST nodes.
__INTPTR_TYPE__ intptr_t
A signed integer type with the property that any valid pointer to void can be converted to this type,...
Describes how types, statements, expressions, and declarations should be printed.
unsigned TemplateDiffUsed
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4