23 #include "llvm/Support/raw_ostream.h" 25 using namespace clang;
41 if (
const ParenType *PT = dyn_cast<ParenType>(Ty)) {
47 dyn_cast<SubstTemplateTypeParmType>(Ty)) {
57 if (
const AdjustedType *AT = dyn_cast<AdjustedType>(Ty)) {
62 if (
const AutoType *AT = dyn_cast<AutoType>(Ty)) {
71 if (
const FunctionType *FT = dyn_cast<FunctionType>(Ty)) {
72 bool DesugarReturn =
false;
73 QualType SugarRT = FT->getReturnType();
80 bool DesugarArgument =
false;
86 if (
auto nullability =
95 if (DesugarReturn || DesugarArgument) {
106 dyn_cast<TemplateSpecializationType>(Ty)) {
107 if (!TST->isTypeAlias()) {
108 bool DesugarArgument =
false;
110 for (
unsigned I = 0, N = TST->getNumArgs(); I != N; ++I) {
118 if (DesugarArgument) {
121 TST->getTemplateName(), Args, QT);
141 bool IsSugar =
false;
143 #define ABSTRACT_TYPE(Class, Base) 144 #define TYPE(Class, Base) \ 145 case Type::Class: { \ 146 const Class##Type *CTy = cast<Class##Type>(Ty); \ 147 if (CTy->isSugared()) { \ 149 Underlying = CTy->desugar(); \ 153 #include "clang/AST/TypeNodes.def" 162 if (isa<VectorType>(Underlying))
167 if (
const TypedefType *QTT = dyn_cast<TypedefType>(QT))
168 if (UTT->getDecl()->getTypedefNameForAnonDecl() == QTT->getDecl())
191 if (Ty->getBaseType().getTypePtr() != Ty && !ShouldAKA) {
194 llvm::makeArrayRef(Ty->qual_begin(),
195 Ty->getNumProtocols()),
196 Ty->isKindOfTypeAsWritten());
200 return QC.
apply(Context, QT);
232 bool ForceAKA =
false;
237 for (
unsigned I = 0, E = QualTypeVals.size(); I != E; ++I) {
245 if (CompareCanTy == CanTy)
248 bool ShouldAKA =
false;
250 std::string CompareDesugarStr =
252 if (CompareS != S && CompareDesugarStr != S)
255 std::string CompareCanS =
258 if (CompareCanS == CanS)
267 bool Repeated =
false;
268 for (
unsigned i = 0, e = PrevArgs.size(); i != e; ++i) {
271 void *Ptr = (
void*)PrevArgs[i].second;
283 bool ShouldAKA =
false;
285 if (ShouldAKA || ForceAKA) {
286 if (DesugaredTy == Ty) {
291 S =
"'" + S +
"' (aka '" + akaStr +
"')";
301 std::string DecoratedString;
302 llvm::raw_string_ostream OS(DecoratedString);
303 const char *Values = VTy->
getNumElements() > 1 ?
"values" :
"value";
304 OS <<
"'" << S <<
"' (vector of " << VTy->
getNumElements() <<
" '" 306 <<
"' " << Values <<
")";
317 bool PrintFromType,
bool ElideType,
318 bool ShowColors, raw_ostream &OS);
331 size_t OldEnd = Output.size();
332 llvm::raw_svector_ostream OS(Output);
333 bool NeedQuotes =
true;
336 default: llvm_unreachable(
"unknown ArgumentKind");
360 Modifier = StringRef();
361 Argument = StringRef();
366 assert(Modifier.empty() && Argument.empty() &&
367 "Invalid modifier for QualType argument");
375 if (Modifier ==
"objcclass" && Argument.empty())
377 else if (Modifier ==
"objcinstance" && Argument.empty())
380 assert(Modifier.empty() && Argument.empty() &&
381 "Invalid modifier for DeclarationName argument");
388 if (Modifier ==
"q" && Argument.empty())
391 assert(Modifier.empty() && Argument.empty() &&
392 "Invalid modifier for NamedDecl* argument");
407 assert(DC &&
"Should never have a null declaration context");
413 OS <<
"the global namespace";
415 OS <<
"the global scope";
417 OS <<
"block literal";
419 OS <<
"lambda expression";
423 PrevArgs, QualTypeVals);
425 assert(isa<NamedDecl>(DC) &&
"Expected a NamedDecl");
427 if (isa<NamespaceDecl>(ND))
429 else if (isa<ObjCMethodDecl>(ND))
431 else if (isa<FunctionDecl>(ND))
441 const Attr *At =
reinterpret_cast<Attr *
>(Val);
442 assert(At &&
"Received null Attr object!");
450 Output.insert(Output.begin()+OldEnd,
'\'');
451 Output.push_back(
'\'');
516 FromIntegerAndToDeclaration,
517 FromDeclarationAndToInteger
524 struct TemplateArgumentInfo {
528 bool IsValidInt =
false;
529 Expr *ArgExpr =
nullptr;
532 bool NeedAddressOf =
false;
533 bool IsNullPtr =
false;
534 bool IsDefault =
false;
541 DiffKind
Kind = Invalid;
544 unsigned NextNode = 0;
547 unsigned ChildNode = 0;
550 unsigned ParentNode = 0;
552 TemplateArgumentInfo FromArgInfo, ToArgInfo;
557 DiffNode(
unsigned ParentNode = 0) : ParentNode(ParentNode) {}
564 unsigned CurrentNode;
568 unsigned NextFreeNode;
575 CurrentNode(0), NextFreeNode(1) {
576 FlatTree.push_back(DiffNode());
582 bool FromDefault,
bool ToDefault) {
583 assert(FlatTree[CurrentNode].
Kind == Invalid &&
"Node is not empty.");
584 FlatTree[CurrentNode].Kind = Template;
585 FlatTree[CurrentNode].FromArgInfo.TD = FromTD;
586 FlatTree[CurrentNode].ToArgInfo.TD = ToTD;
587 FlatTree[CurrentNode].FromArgInfo.Qual = FromQual;
588 FlatTree[CurrentNode].ToArgInfo.Qual = ToQual;
589 SetDefault(FromDefault, ToDefault);
594 assert(FlatTree[CurrentNode].
Kind == Invalid &&
"Node is not empty.");
595 FlatTree[CurrentNode].Kind =
Type;
596 FlatTree[CurrentNode].FromArgInfo.ArgType = FromType;
597 FlatTree[CurrentNode].ToArgInfo.ArgType = ToType;
598 SetDefault(FromDefault, ToDefault);
601 void SetExpressionDiff(
Expr *FromExpr,
Expr *ToExpr,
bool FromDefault,
603 assert(FlatTree[CurrentNode].
Kind == Invalid &&
"Node is not empty.");
604 FlatTree[CurrentNode].Kind = Expression;
605 FlatTree[CurrentNode].FromArgInfo.ArgExpr = FromExpr;
606 FlatTree[CurrentNode].ToArgInfo.ArgExpr = ToExpr;
607 SetDefault(FromDefault, ToDefault);
611 bool FromDefault,
bool ToDefault) {
612 assert(FlatTree[CurrentNode].
Kind == Invalid &&
"Node is not empty.");
613 FlatTree[CurrentNode].Kind = TemplateTemplate;
614 FlatTree[CurrentNode].FromArgInfo.TD = FromTD;
615 FlatTree[CurrentNode].ToArgInfo.TD = ToTD;
616 SetDefault(FromDefault, ToDefault);
619 void SetIntegerDiff(
const llvm::APSInt &FromInt,
const llvm::APSInt &ToInt,
620 bool IsValidFromInt,
bool IsValidToInt,
622 Expr *FromExpr,
Expr *ToExpr,
bool FromDefault,
624 assert(FlatTree[CurrentNode].
Kind == Invalid &&
"Node is not empty.");
625 FlatTree[CurrentNode].Kind = Integer;
626 FlatTree[CurrentNode].FromArgInfo.Val = FromInt;
627 FlatTree[CurrentNode].ToArgInfo.Val = ToInt;
628 FlatTree[CurrentNode].FromArgInfo.IsValidInt = IsValidFromInt;
629 FlatTree[CurrentNode].ToArgInfo.IsValidInt = IsValidToInt;
630 FlatTree[CurrentNode].FromArgInfo.ArgType = FromIntType;
631 FlatTree[CurrentNode].ToArgInfo.ArgType = ToIntType;
632 FlatTree[CurrentNode].FromArgInfo.ArgExpr = FromExpr;
633 FlatTree[CurrentNode].ToArgInfo.ArgExpr = ToExpr;
634 SetDefault(FromDefault, ToDefault);
638 bool FromAddressOf,
bool ToAddressOf,
639 bool FromNullPtr,
bool ToNullPtr,
Expr *FromExpr,
640 Expr *ToExpr,
bool FromDefault,
bool ToDefault) {
641 assert(FlatTree[CurrentNode].
Kind == Invalid &&
"Node is not empty.");
642 FlatTree[CurrentNode].Kind = Declaration;
643 FlatTree[CurrentNode].FromArgInfo.VD = FromValueDecl;
644 FlatTree[CurrentNode].ToArgInfo.VD = ToValueDecl;
645 FlatTree[CurrentNode].FromArgInfo.NeedAddressOf = FromAddressOf;
646 FlatTree[CurrentNode].ToArgInfo.NeedAddressOf = ToAddressOf;
647 FlatTree[CurrentNode].FromArgInfo.IsNullPtr = FromNullPtr;
648 FlatTree[CurrentNode].ToArgInfo.IsNullPtr = ToNullPtr;
649 FlatTree[CurrentNode].FromArgInfo.ArgExpr = FromExpr;
650 FlatTree[CurrentNode].ToArgInfo.ArgExpr = ToExpr;
651 SetDefault(FromDefault, ToDefault);
654 void SetFromDeclarationAndToIntegerDiff(
655 ValueDecl *FromValueDecl,
bool FromAddressOf,
bool FromNullPtr,
656 Expr *FromExpr,
const llvm::APSInt &ToInt,
bool IsValidToInt,
657 QualType ToIntType,
Expr *ToExpr,
bool FromDefault,
bool ToDefault) {
658 assert(FlatTree[CurrentNode].
Kind == Invalid &&
"Node is not empty.");
659 FlatTree[CurrentNode].Kind = FromDeclarationAndToInteger;
660 FlatTree[CurrentNode].FromArgInfo.VD = FromValueDecl;
661 FlatTree[CurrentNode].FromArgInfo.NeedAddressOf = FromAddressOf;
662 FlatTree[CurrentNode].FromArgInfo.IsNullPtr = FromNullPtr;
663 FlatTree[CurrentNode].FromArgInfo.ArgExpr = FromExpr;
664 FlatTree[CurrentNode].ToArgInfo.Val = ToInt;
665 FlatTree[CurrentNode].ToArgInfo.IsValidInt = IsValidToInt;
666 FlatTree[CurrentNode].ToArgInfo.ArgType = ToIntType;
667 FlatTree[CurrentNode].ToArgInfo.ArgExpr = ToExpr;
668 SetDefault(FromDefault, ToDefault);
671 void SetFromIntegerAndToDeclarationDiff(
672 const llvm::APSInt &FromInt,
bool IsValidFromInt,
QualType FromIntType,
674 bool ToNullPtr,
Expr *ToExpr,
bool FromDefault,
bool ToDefault) {
675 assert(FlatTree[CurrentNode].
Kind == Invalid &&
"Node is not empty.");
676 FlatTree[CurrentNode].Kind = FromIntegerAndToDeclaration;
677 FlatTree[CurrentNode].FromArgInfo.Val = FromInt;
678 FlatTree[CurrentNode].FromArgInfo.IsValidInt = IsValidFromInt;
679 FlatTree[CurrentNode].FromArgInfo.ArgType = FromIntType;
680 FlatTree[CurrentNode].FromArgInfo.ArgExpr = FromExpr;
681 FlatTree[CurrentNode].ToArgInfo.VD = ToValueDecl;
682 FlatTree[CurrentNode].ToArgInfo.NeedAddressOf = ToAddressOf;
683 FlatTree[CurrentNode].ToArgInfo.IsNullPtr = ToNullPtr;
684 FlatTree[CurrentNode].ToArgInfo.ArgExpr = ToExpr;
685 SetDefault(FromDefault, ToDefault);
689 void SetDefault(
bool FromDefault,
bool ToDefault) {
690 assert((!FromDefault || !ToDefault) &&
"Both arguments cannot be default.");
691 FlatTree[CurrentNode].FromArgInfo.IsDefault = FromDefault;
692 FlatTree[CurrentNode].ToArgInfo.IsDefault = ToDefault;
696 void SetSame(
bool Same) {
697 FlatTree[CurrentNode].Same = Same;
701 void SetKind(DiffKind
Kind) {
702 FlatTree[CurrentNode].Kind =
Kind;
707 assert(FlatTree[CurrentNode].Kind != Invalid &&
708 "Cannot exit node before setting node information.");
709 CurrentNode = FlatTree[CurrentNode].ParentNode;
715 assert(FlatTree[CurrentNode].Kind == Template &&
716 "Only Template nodes can have children nodes.");
717 FlatTree.push_back(DiffNode(CurrentNode));
718 DiffNode &
Node = FlatTree[CurrentNode];
719 if (Node.ChildNode == 0) {
721 Node.ChildNode = NextFreeNode;
726 for (i = Node.ChildNode; FlatTree[i].NextNode != 0;
727 i = FlatTree[i].NextNode) {
729 FlatTree[i].NextNode = NextFreeNode;
731 CurrentNode = NextFreeNode;
737 void StartTraverse() {
739 CurrentNode = NextFreeNode;
745 ReadNode = FlatTree[ReadNode].ParentNode;
750 assert(FlatTree[ReadNode].Kind == Template &&
"Unexpected kind.");
751 FromTD = FlatTree[ReadNode].FromArgInfo.TD;
752 ToTD = FlatTree[ReadNode].ToArgInfo.TD;
753 FromQual = FlatTree[ReadNode].FromArgInfo.Qual;
754 ToQual = FlatTree[ReadNode].ToArgInfo.Qual;
758 assert(FlatTree[ReadNode].Kind ==
Type &&
"Unexpected kind");
759 FromType = FlatTree[ReadNode].FromArgInfo.ArgType;
760 ToType = FlatTree[ReadNode].ToArgInfo.ArgType;
763 void GetExpressionDiff(
Expr *&FromExpr,
Expr *&ToExpr) {
764 assert(FlatTree[ReadNode].Kind == Expression &&
"Unexpected kind");
765 FromExpr = FlatTree[ReadNode].FromArgInfo.ArgExpr;
766 ToExpr = FlatTree[ReadNode].ToArgInfo.ArgExpr;
770 assert(FlatTree[ReadNode].Kind == TemplateTemplate &&
"Unexpected kind.");
771 FromTD = FlatTree[ReadNode].FromArgInfo.TD;
772 ToTD = FlatTree[ReadNode].ToArgInfo.TD;
775 void GetIntegerDiff(llvm::APSInt &FromInt, llvm::APSInt &ToInt,
776 bool &IsValidFromInt,
bool &IsValidToInt,
779 assert(FlatTree[ReadNode].Kind == Integer &&
"Unexpected kind.");
780 FromInt = FlatTree[ReadNode].FromArgInfo.Val;
781 ToInt = FlatTree[ReadNode].ToArgInfo.Val;
782 IsValidFromInt = FlatTree[ReadNode].FromArgInfo.IsValidInt;
783 IsValidToInt = FlatTree[ReadNode].ToArgInfo.IsValidInt;
784 FromIntType = FlatTree[ReadNode].FromArgInfo.ArgType;
785 ToIntType = FlatTree[ReadNode].ToArgInfo.ArgType;
786 FromExpr = FlatTree[ReadNode].FromArgInfo.ArgExpr;
787 ToExpr = FlatTree[ReadNode].ToArgInfo.ArgExpr;
791 bool &FromAddressOf,
bool &ToAddressOf,
792 bool &FromNullPtr,
bool &ToNullPtr,
Expr *&FromExpr,
794 assert(FlatTree[ReadNode].Kind == Declaration &&
"Unexpected kind.");
795 FromValueDecl = FlatTree[ReadNode].FromArgInfo.VD;
796 ToValueDecl = FlatTree[ReadNode].ToArgInfo.VD;
797 FromAddressOf = FlatTree[ReadNode].FromArgInfo.NeedAddressOf;
798 ToAddressOf = FlatTree[ReadNode].ToArgInfo.NeedAddressOf;
799 FromNullPtr = FlatTree[ReadNode].FromArgInfo.IsNullPtr;
800 ToNullPtr = FlatTree[ReadNode].ToArgInfo.IsNullPtr;
801 FromExpr = FlatTree[ReadNode].FromArgInfo.ArgExpr;
802 ToExpr = FlatTree[ReadNode].ToArgInfo.ArgExpr;
805 void GetFromDeclarationAndToIntegerDiff(
806 ValueDecl *&FromValueDecl,
bool &FromAddressOf,
bool &FromNullPtr,
807 Expr *&FromExpr, llvm::APSInt &ToInt,
bool &IsValidToInt,
809 assert(FlatTree[ReadNode].Kind == FromDeclarationAndToInteger &&
811 FromValueDecl = FlatTree[ReadNode].FromArgInfo.VD;
812 FromAddressOf = FlatTree[ReadNode].FromArgInfo.NeedAddressOf;
813 FromNullPtr = FlatTree[ReadNode].FromArgInfo.IsNullPtr;
814 FromExpr = FlatTree[ReadNode].FromArgInfo.ArgExpr;
815 ToInt = FlatTree[ReadNode].ToArgInfo.Val;
816 IsValidToInt = FlatTree[ReadNode].ToArgInfo.IsValidInt;
817 ToIntType = FlatTree[ReadNode].ToArgInfo.ArgType;
818 ToExpr = FlatTree[ReadNode].ToArgInfo.ArgExpr;
821 void GetFromIntegerAndToDeclarationDiff(
822 llvm::APSInt &FromInt,
bool &IsValidFromInt,
QualType &FromIntType,
824 bool &ToNullPtr,
Expr *&ToExpr) {
825 assert(FlatTree[ReadNode].Kind == FromIntegerAndToDeclaration &&
827 FromInt = FlatTree[ReadNode].FromArgInfo.Val;
828 IsValidFromInt = FlatTree[ReadNode].FromArgInfo.IsValidInt;
829 FromIntType = FlatTree[ReadNode].FromArgInfo.ArgType;
830 FromExpr = FlatTree[ReadNode].FromArgInfo.ArgExpr;
831 ToValueDecl = FlatTree[ReadNode].ToArgInfo.VD;
832 ToAddressOf = FlatTree[ReadNode].ToArgInfo.NeedAddressOf;
833 ToNullPtr = FlatTree[ReadNode].ToArgInfo.IsNullPtr;
834 ToExpr = FlatTree[ReadNode].ToArgInfo.ArgExpr;
839 return FlatTree[ReadNode].FromArgInfo.IsDefault;
844 return FlatTree[ReadNode].ToArgInfo.IsDefault;
849 return FlatTree[ReadNode].Same;
854 return FlatTree[ReadNode].ChildNode != 0;
859 ReadNode = FlatTree[ReadNode].ChildNode;
864 bool AdvanceSibling() {
865 if (FlatTree[ReadNode].NextNode == 0)
868 ReadNode = FlatTree[ReadNode].NextNode;
873 bool HasNextSibling() {
874 return FlatTree[ReadNode].NextNode != 0;
879 return GetKind() == Invalid;
884 return FlatTree[ReadNode].Kind;
901 struct InternalIterator {
919 : TST(TST), Index(0), CurrentTA(
nullptr), EndTA(
nullptr) {
933 if (CurrentTA != EndTA)
return;
941 bool isValid()
const {
return TST; }
945 assert(TST &&
"InternalIterator is invalid with a null TST.");
950 InternalIterator &operator++() {
951 assert(TST &&
"InternalIterator is invalid with a null TST.");
957 if (CurrentTA != EndTA) {
959 if (CurrentTA != EndTA)
979 if (CurrentTA != EndTA)
987 assert(TST &&
"InternalIterator is invalid with a null TST.");
988 assert(!isEnd() &&
"Index exceeds number of arguments.");
989 if (CurrentTA == EndTA)
990 return TST->
getArg(Index);
996 pointer operator->()
const {
997 assert(TST &&
"InternalIterator is invalid with a null TST.");
1002 InternalIterator SugaredIterator;
1003 InternalIterator DesugaredIterator;
1007 : SugaredIterator(TST),
1010 ? GetTemplateSpecializationType(Context, TST->
desugar())
1014 TSTiterator &operator++() {
1016 if (DesugaredIterator.isValid())
1017 ++DesugaredIterator;
1023 return *SugaredIterator;
1027 pointer operator->()
const {
1032 bool isEnd()
const {
1033 return SugaredIterator.isEnd();
1038 bool hasDesugaredTA()
const {
1039 return DesugaredIterator.isValid() && !DesugaredIterator.isEnd();
1043 reference getDesugaredTA()
const {
1044 assert(DesugaredIterator.isValid() &&
1045 "Desugared TemplateArgument should not be used.");
1046 return *DesugaredIterator;
1089 FromArgTST = GetTemplateSpecializationType(Context, FromType);
1090 ToArgTST = GetTemplateSpecializationType(Context, ToType);
1092 if (!FromArgTST || !ToArgTST)
1095 if (!hasSameTemplate(FromArgTST, ToArgTST))
1102 void DiffTypes(
const TSTiterator &FromIter,
const TSTiterator &ToIter) {
1103 QualType FromType = GetType(FromIter);
1106 bool FromDefault = FromIter.isEnd() && !FromType.
isNull();
1107 bool ToDefault = ToIter.isEnd() && !ToType.
isNull();
1111 if (OnlyPerformTypeDiff(Context, FromType, ToType, FromArgTST, ToArgTST)) {
1112 Tree.SetTypeDiff(FromType, ToType, FromDefault, ToDefault);
1116 assert(FromArgTST && ToArgTST &&
1117 "Both template specializations need to be valid.");
1124 FromQual, ToQual, FromDefault, ToDefault);
1125 DiffTemplate(FromArgTST, ToArgTST);
1131 void DiffTemplateTemplates(
const TSTiterator &FromIter,
1132 const TSTiterator &ToIter) {
1135 Tree.SetTemplateTemplateDiff(FromDecl, ToDecl, FromIter.isEnd() &&
FromDecl,
1136 ToIter.isEnd() && ToDecl);
1137 Tree.SetSame(FromDecl && ToDecl &&
1142 static void InitializeNonTypeDiffVariables(
ASTContext &Context,
1143 const TSTiterator &Iter,
1145 llvm::APSInt &
Value,
bool &HasInt,
1146 QualType &IntType,
bool &IsNullPtr,
1148 bool &NeedAddressOf) {
1149 if (!Iter.isEnd()) {
1150 switch (Iter->getKind()) {
1152 llvm_unreachable(
"unknown ArgumentKind");
1154 Value = Iter->getAsIntegral();
1156 IntType = Iter->getIntegralType();
1159 VD = Iter->getAsDecl();
1160 QualType ArgType = Iter->getParamTypeForDecl();
1164 NeedAddressOf =
true;
1171 E = Iter->getAsExpr();
1177 if (!Iter.hasDesugaredTA())
return;
1182 llvm_unreachable(
"unknown ArgumentKind");
1194 NeedAddressOf =
true;
1212 void DiffNonTypes(
const TSTiterator &FromIter,
const TSTiterator &ToIter,
1215 Expr *FromExpr =
nullptr, *ToExpr =
nullptr;
1216 llvm::APSInt FromInt, ToInt;
1218 ValueDecl *FromValueDecl =
nullptr, *ToValueDecl =
nullptr;
1219 bool HasFromInt =
false, HasToInt =
false, FromNullPtr =
false,
1220 ToNullPtr =
false, NeedFromAddressOf =
false, NeedToAddressOf =
false;
1221 InitializeNonTypeDiffVariables(
1222 Context, FromIter, FromDefaultNonTypeDecl, FromInt, HasFromInt,
1223 FromIntType, FromNullPtr, FromExpr, FromValueDecl, NeedFromAddressOf);
1224 InitializeNonTypeDiffVariables(Context, ToIter, ToDefaultNonTypeDecl, ToInt,
1225 HasToInt, ToIntType, ToNullPtr, ToExpr,
1226 ToValueDecl, NeedToAddressOf);
1228 bool FromDefault = FromIter.isEnd() &&
1229 (FromExpr || FromValueDecl || HasFromInt || FromNullPtr);
1230 bool ToDefault = ToIter.isEnd() &&
1231 (ToExpr || ToValueDecl || HasToInt || ToNullPtr);
1233 bool FromDeclaration = FromValueDecl || FromNullPtr;
1234 bool ToDeclaration = ToValueDecl || ToNullPtr;
1236 if (FromDeclaration && HasToInt) {
1237 Tree.SetFromDeclarationAndToIntegerDiff(
1238 FromValueDecl, NeedFromAddressOf, FromNullPtr, FromExpr, ToInt,
1239 HasToInt, ToIntType, ToExpr, FromDefault, ToDefault);
1240 Tree.SetSame(
false);
1245 if (HasFromInt && ToDeclaration) {
1246 Tree.SetFromIntegerAndToDeclarationDiff(
1247 FromInt, HasFromInt, FromIntType, FromExpr, ToValueDecl,
1248 NeedToAddressOf, ToNullPtr, ToExpr, FromDefault, ToDefault);
1249 Tree.SetSame(
false);
1253 if (HasFromInt || HasToInt) {
1254 Tree.SetIntegerDiff(FromInt, ToInt, HasFromInt, HasToInt, FromIntType,
1255 ToIntType, FromExpr, ToExpr, FromDefault, ToDefault);
1256 if (HasFromInt && HasToInt) {
1257 Tree.SetSame(Context.
hasSameType(FromIntType, ToIntType) &&
1263 if (FromDeclaration || ToDeclaration) {
1264 Tree.SetDeclarationDiff(FromValueDecl, ToValueDecl, NeedFromAddressOf,
1265 NeedToAddressOf, FromNullPtr, ToNullPtr, FromExpr,
1266 ToExpr, FromDefault, ToDefault);
1267 bool BothNull = FromNullPtr && ToNullPtr;
1268 bool SameValueDecl =
1269 FromValueDecl && ToValueDecl &&
1270 NeedFromAddressOf == NeedToAddressOf &&
1272 Tree.SetSame(BothNull || SameValueDecl);
1276 assert((FromExpr || ToExpr) &&
"Both template arguments cannot be empty.");
1277 Tree.SetExpressionDiff(FromExpr, ToExpr, FromDefault, ToDefault);
1278 Tree.SetSame(IsEqualExpr(Context, FromExpr, ToExpr));
1290 unsigned TotalArgs = 0;
1291 for (TSTiterator FromIter(Context, FromTST), ToIter(Context, ToTST);
1292 !FromIter.isEnd() || !ToIter.isEnd(); ++TotalArgs) {
1298 unsigned FromParamIndex =
std::min(TotalArgs, ParamsFrom->
size() - 1);
1299 unsigned ToParamIndex =
std::min(TotalArgs, ParamsTo->
size() - 1);
1303 assert(FromParamND->getKind() == ToParamND->
getKind() &&
1304 "Parameter Decl are not the same kind.");
1306 if (isa<TemplateTypeParmDecl>(FromParamND)) {
1307 DiffTypes(FromIter, ToIter);
1308 }
else if (isa<TemplateTemplateParmDecl>(FromParamND)) {
1309 DiffTemplateTemplates(FromIter, ToIter);
1310 }
else if (isa<NonTypeTemplateParmDecl>(FromParamND)) {
1312 cast<NonTypeTemplateParmDecl>(FromParamND);
1314 cast<NonTypeTemplateParmDecl>(ToParamND);
1315 DiffNonTypes(FromIter, ToIter, FromDefaultNonTypeDecl,
1316 ToDefaultNonTypeDecl);
1318 llvm_unreachable(
"Unexpected Decl type.");
1328 static void makeTemplateList(
1332 TemplateList.push_back(TST);
1354 if (hasSameBaseTemplate(FromTST, ToTST))
1361 makeTemplateList(FromTemplateList, FromTST);
1362 makeTemplateList(ToTemplateList, ToTST);
1365 FromIter = FromTemplateList.rbegin(), FromEnd = FromTemplateList.rend(),
1366 ToIter = ToTemplateList.rbegin(), ToEnd = ToTemplateList.rend();
1369 if (!hasSameBaseTemplate(*FromIter, *ToIter))
1375 for (; FromIter != FromEnd && ToIter != ToEnd; ++FromIter, ++ToIter) {
1376 if (!hasSameBaseTemplate(*FromIter, *ToIter))
1380 FromTST = FromIter[-1];
1388 static QualType GetType(
const TSTiterator &Iter) {
1390 return Iter->getAsType();
1391 if (Iter.hasDesugaredTA())
1392 return Iter.getDesugaredTA().getAsType();
1398 static TemplateDecl *GetTemplateDecl(
const TSTiterator &Iter) {
1400 return Iter->getAsTemplate().getAsTemplateDecl();
1401 if (Iter.hasDesugaredTA())
1402 return Iter.getDesugaredTA().getAsTemplate().getAsTemplateDecl();
1410 if (FromExpr == ToExpr)
1413 if (!FromExpr || !ToExpr)
1416 llvm::FoldingSetNodeID FromID, ToID;
1417 FromExpr->
Profile(FromID, Context,
true);
1418 ToExpr->
Profile(ToID, Context,
true);
1419 return FromID == ToID;
1427 void TreeToString(
int Indent = 1) {
1430 OS.indent(2 * Indent);
1436 switch (Tree.GetKind()) {
1437 case DiffTree::Invalid:
1438 llvm_unreachable(
"Template diffing failed with bad DiffNode");
1439 case DiffTree::Type: {
1441 Tree.GetTypeDiff(FromType, ToType);
1442 PrintTypeNames(FromType, ToType, Tree.FromDefault(), Tree.ToDefault(),
1446 case DiffTree::Expression: {
1447 Expr *FromExpr, *ToExpr;
1448 Tree.GetExpressionDiff(FromExpr, ToExpr);
1449 PrintExpr(FromExpr, ToExpr, Tree.FromDefault(), Tree.ToDefault(),
1453 case DiffTree::TemplateTemplate: {
1455 Tree.GetTemplateTemplateDiff(FromTD, ToTD);
1456 PrintTemplateTemplate(FromTD, ToTD, Tree.FromDefault(),
1457 Tree.ToDefault(), Tree.NodeIsSame());
1460 case DiffTree::Integer: {
1461 llvm::APSInt FromInt, ToInt;
1462 Expr *FromExpr, *ToExpr;
1463 bool IsValidFromInt, IsValidToInt;
1465 Tree.GetIntegerDiff(FromInt, ToInt, IsValidFromInt, IsValidToInt,
1466 FromIntType, ToIntType, FromExpr, ToExpr);
1467 PrintAPSInt(FromInt, ToInt, IsValidFromInt, IsValidToInt, FromIntType,
1468 ToIntType, FromExpr, ToExpr, Tree.FromDefault(),
1469 Tree.ToDefault(), Tree.NodeIsSame());
1472 case DiffTree::Declaration: {
1474 bool FromAddressOf, ToAddressOf;
1475 bool FromNullPtr, ToNullPtr;
1476 Expr *FromExpr, *ToExpr;
1477 Tree.GetDeclarationDiff(FromValueDecl, ToValueDecl, FromAddressOf,
1478 ToAddressOf, FromNullPtr, ToNullPtr, FromExpr,
1480 PrintValueDecl(FromValueDecl, ToValueDecl, FromAddressOf, ToAddressOf,
1481 FromNullPtr, ToNullPtr, FromExpr, ToExpr,
1482 Tree.FromDefault(), Tree.ToDefault(), Tree.NodeIsSame());
1485 case DiffTree::FromDeclarationAndToInteger: {
1494 Tree.GetFromDeclarationAndToIntegerDiff(
1495 FromValueDecl, FromAddressOf, FromNullPtr, FromExpr, ToInt,
1496 IsValidToInt, ToIntType, ToExpr);
1497 assert((FromValueDecl || FromNullPtr) && IsValidToInt);
1498 PrintValueDeclAndInteger(FromValueDecl, FromAddressOf, FromNullPtr,
1499 FromExpr, Tree.FromDefault(), ToInt, ToIntType,
1500 ToExpr, Tree.ToDefault());
1503 case DiffTree::FromIntegerAndToDeclaration: {
1504 llvm::APSInt FromInt;
1505 bool IsValidFromInt;
1512 Tree.GetFromIntegerAndToDeclarationDiff(
1513 FromInt, IsValidFromInt, FromIntType, FromExpr, ToValueDecl,
1514 ToAddressOf, ToNullPtr, ToExpr);
1515 assert(IsValidFromInt && (ToValueDecl || ToNullPtr));
1516 PrintIntegerAndValueDecl(FromInt, FromIntType, FromExpr,
1517 Tree.FromDefault(), ToValueDecl, ToAddressOf,
1518 ToNullPtr, ToExpr, Tree.ToDefault());
1521 case DiffTree::Template: {
1525 Tree.GetTemplateDiff(FromTD, ToTD, FromQual, ToQual);
1527 PrintQualifiers(FromQual, ToQual);
1529 if (!Tree.HasChildren()) {
1538 unsigned NumElideArgs = 0;
1539 bool AllArgsElided =
true;
1542 if (Tree.NodeIsSame()) {
1546 AllArgsElided =
false;
1547 if (NumElideArgs > 0) {
1548 PrintElideArgs(NumElideArgs, Indent);
1553 TreeToString(Indent);
1554 if (Tree.HasNextSibling())
1556 }
while (Tree.AdvanceSibling());
1557 if (NumElideArgs > 0) {
1561 PrintElideArgs(NumElideArgs, Indent);
1577 assert(!IsBold &&
"Attempting to bold text that is already bold.");
1585 assert(IsBold &&
"Attempting to remove bold from unbold text.");
1597 bool FromDefault,
bool ToDefault,
bool Same) {
1599 "Only one template argument may be missing.");
1611 PrintQualifiers(FromQual, ToQual);
1616 std::string FromTypeStr = FromType.
isNull() ?
"(no argument)" 1618 std::string ToTypeStr = ToType.
isNull() ?
"(no argument)" 1622 if (FromTypeStr == ToTypeStr) {
1623 std::string FromCanTypeStr =
1626 if (FromCanTypeStr != ToCanTypeStr) {
1627 FromTypeStr = FromCanTypeStr;
1628 ToTypeStr = ToCanTypeStr;
1632 if (PrintTree) OS <<
'[';
1633 OS << (FromDefault ?
"(default) " :
"");
1638 OS <<
" != " << (ToDefault ?
"(default) " :
"");
1648 void PrintExpr(
const Expr *FromExpr,
const Expr *ToExpr,
bool FromDefault,
1649 bool ToDefault,
bool Same) {
1650 assert((FromExpr || ToExpr) &&
1651 "Only one template argument may be missing.");
1653 PrintExpr(FromExpr);
1654 }
else if (!PrintTree) {
1655 OS << (FromDefault ?
"(default) " :
"");
1657 PrintExpr(FromExpr);
1660 OS << (FromDefault ?
"[(default) " :
"[");
1662 PrintExpr(FromExpr);
1664 OS <<
" != " << (ToDefault ?
"(default) " :
"");
1673 void PrintExpr(
const Expr *E) {
1678 OS <<
"(no argument)";
1684 bool FromDefault,
bool ToDefault,
bool Same) {
1685 assert((FromTD || ToTD) &&
"Only one template argument may be missing.");
1687 std::string FromName = FromTD ? FromTD->
getName() :
"(no argument)";
1688 std::string ToName = ToTD ? ToTD->
getName() :
"(no argument)";
1689 if (FromTD && ToTD && FromName == ToName) {
1696 }
else if (!PrintTree) {
1697 OS << (FromDefault ?
"(default) template " :
"template ");
1702 OS << (FromDefault ?
"[(default) template " :
"[template ");
1706 OS <<
" != " << (ToDefault ?
"(default) template " :
"template ");
1716 void PrintAPSInt(
const llvm::APSInt &FromInt,
const llvm::APSInt &ToInt,
1717 bool IsValidFromInt,
bool IsValidToInt,
QualType FromIntType,
1719 bool FromDefault,
bool ToDefault,
bool Same) {
1720 assert((IsValidFromInt || IsValidToInt) &&
1721 "Only one integral argument may be missing.");
1725 OS << ((FromInt == 0) ?
"false" :
"true");
1727 OS << FromInt.toString(10);
1732 bool PrintType = IsValidFromInt && IsValidToInt &&
1736 OS << (FromDefault ?
"(default) " :
"");
1737 PrintAPSInt(FromInt, FromExpr, IsValidFromInt, FromIntType, PrintType);
1739 OS << (FromDefault ?
"[(default) " :
"[");
1740 PrintAPSInt(FromInt, FromExpr, IsValidFromInt, FromIntType, PrintType);
1741 OS <<
" != " << (ToDefault ?
"(default) " :
"");
1742 PrintAPSInt(ToInt, ToExpr, IsValidToInt, ToIntType, PrintType);
1749 void PrintAPSInt(
const llvm::APSInt &Val,
Expr *E,
bool Valid,
1750 QualType IntType,
bool PrintType) {
1753 if (HasExtraInfo(E)) {
1769 OS << ((Val == 0) ?
"false" :
"true");
1771 OS << Val.toString(10);
1776 OS <<
"(no argument)";
1783 bool HasExtraInfo(
Expr *E) {
1784 if (!E)
return false;
1788 if (isa<IntegerLiteral>(E))
return false;
1791 if (UO->getOpcode() == UO_Minus)
1792 if (isa<IntegerLiteral>(UO->getSubExpr()))
1795 if (isa<CXXBoolLiteralExpr>(E))
1801 void PrintValueDecl(
ValueDecl *VD,
bool AddressOf,
Expr *E,
bool NullPtr) {
1810 if (E && !isa<CXXNullPtrLiteralExpr>(E)) {
1825 OS <<
"(no argument)";
1831 bool FromAddressOf,
bool ToAddressOf,
bool FromNullPtr,
1832 bool ToNullPtr,
Expr *FromExpr,
Expr *ToExpr,
1833 bool FromDefault,
bool ToDefault,
bool Same) {
1834 assert((FromValueDecl || FromNullPtr || ToValueDecl || ToNullPtr) &&
1835 "Only one Decl argument may be NULL");
1838 PrintValueDecl(FromValueDecl, FromAddressOf, FromExpr, FromNullPtr);
1839 }
else if (!PrintTree) {
1840 OS << (FromDefault ?
"(default) " :
"");
1842 PrintValueDecl(FromValueDecl, FromAddressOf, FromExpr, FromNullPtr);
1845 OS << (FromDefault ?
"[(default) " :
"[");
1847 PrintValueDecl(FromValueDecl, FromAddressOf, FromExpr, FromNullPtr);
1849 OS <<
" != " << (ToDefault ?
"(default) " :
"");
1851 PrintValueDecl(ToValueDecl, ToAddressOf, ToExpr, ToNullPtr);
1859 void PrintValueDeclAndInteger(
ValueDecl *VD,
bool NeedAddressOf,
1860 bool IsNullPtr,
Expr *VDExpr,
bool DefaultDecl,
1861 const llvm::APSInt &Val,
QualType IntType,
1862 Expr *IntExpr,
bool DefaultInt) {
1864 OS << (DefaultDecl ?
"(default) " :
"");
1866 PrintValueDecl(VD, NeedAddressOf, VDExpr, IsNullPtr);
1869 OS << (DefaultDecl ?
"[(default) " :
"[");
1871 PrintValueDecl(VD, NeedAddressOf, VDExpr, IsNullPtr);
1873 OS <<
" != " << (DefaultInt ?
"(default) " :
"");
1874 PrintAPSInt(Val, IntExpr,
true , IntType,
false );
1881 void PrintIntegerAndValueDecl(
const llvm::APSInt &Val,
QualType IntType,
1883 bool NeedAddressOf,
bool IsNullPtr,
1884 Expr *VDExpr,
bool DefaultDecl) {
1886 OS << (DefaultInt ?
"(default) " :
"");
1887 PrintAPSInt(Val, IntExpr,
true , IntType,
false );
1889 OS << (DefaultInt ?
"[(default) " :
"[");
1890 PrintAPSInt(Val, IntExpr,
true , IntType,
false );
1891 OS <<
" != " << (DefaultDecl ?
"(default) " :
"");
1893 PrintValueDecl(VD, NeedAddressOf, VDExpr, IsNullPtr);
1900 void PrintElideArgs(
unsigned NumElideArgs,
unsigned Indent) {
1903 for (
unsigned i = 0; i < Indent; ++i)
1906 if (NumElideArgs == 0)
return;
1907 if (NumElideArgs == 1)
1910 OS <<
"[" << NumElideArgs <<
" * ...]";
1920 if (FromQual == ToQual) {
1921 PrintQualifier(FromQual,
false);
1941 if (CommonQual.
empty() && FromQual.
empty()) {
1943 OS <<
"(no qualifiers) ";
1946 PrintQualifier(CommonQual,
false);
1947 PrintQualifier(FromQual,
true);
1952 OS <<
"(no qualifiers)";
1955 PrintQualifier(CommonQual,
false,
1957 PrintQualifier(ToQual,
true,
1962 PrintQualifier(CommonQual,
false);
1963 PrintQualifier(FromQual,
true);
1967 void PrintQualifier(
Qualifiers Q,
bool ApplyBold,
1968 bool AppendSpaceIfNonEmpty =
true) {
1969 if (Q.
empty())
return;
1970 if (ApplyBold) Bold();
1971 Q.
print(OS, Policy, AppendSpaceIfNonEmpty);
1972 if (ApplyBold) Unbold();
1978 QualType ToType,
bool PrintTree,
bool PrintFromType,
1979 bool ElideType,
bool ShowColor)
1982 ElideType(ElideType),
1983 PrintTree(PrintTree),
1984 ShowColor(ShowColor),
1986 FromTemplateType(PrintFromType ? FromType : ToType),
1987 ToTemplateType(PrintFromType ? ToType : FromType),
1993 void DiffTemplate() {
1998 GetTemplateSpecializationType(Context, FromTemplateType);
2000 GetTemplateSpecializationType(Context, ToTemplateType);
2003 if (!FromOrigTST || !ToOrigTST)
2007 if (!hasSameTemplate(FromOrigTST, ToOrigTST)) {
2017 FromQual, ToQual,
false ,
2020 DiffTemplate(FromOrigTST, ToOrigTST);
2027 Tree.StartTraverse();
2032 assert(!IsBold &&
"Bold is applied to end of string.");
2043 bool PrintFromType,
bool ElideType,
2044 bool ShowColors, raw_ostream &OS) {
2046 PrintFromType =
true;
2047 TemplateDiff TD(OS, Context, FromType, ToType, PrintTree, PrintFromType,
2048 ElideType, ShowColors);
Defines the clang::ASTContext interface.
Represents a type that was referred to using an elaborated type keyword, e.g., struct S...
QualType getObjCObjectType(QualType Base, ObjCProtocolDecl *const *Protocols, unsigned NumProtocols) const
Legacy interface: cannot provide type arguments or __kindof.
const char * getSpelling() const
QualType getObjCIdType() const
Represents the Objective-CC id type.
PointerType - C99 6.7.5.1 - Pointer Declarators.
A (possibly-)qualified type.
QualType getBuiltinVaListType() const
Retrieve the type of the __builtin_va_list type.
void print(raw_ostream &OS, const PrintingPolicy &Policy, const Twine &PlaceHolder=Twine(), unsigned Indentation=0) const
FunctionType - C99 6.7.5.3 - Function Declarators.
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee...
C Language Family Type Representation.
The template argument is an expression, and we've not resolved it to one of the other forms yet...
QualType getLValueReferenceType(QualType T, bool SpelledAsLValue=true) const
Return the uniqued reference to the type for an lvalue reference to the specified type...
Defines the C++ template declaration subclasses.
Represents a C++11 auto or C++14 decltype(auto) type.
The base class of the type hierarchy.
The template argument is a declaration that was provided for a pointer, reference, or pointer to member non-type template parameter.
NamedDecl * getParam(unsigned Idx)
This file provides some common utility functions for processing Lambda related AST Constructs...
const T * getAs() const
Member-template getAs<specific type>'.
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context, bool Canonical) const
Produce a unique representation of the given statement.
QualType getObjCClassType() const
Represents the Objective-C Class type.
Stores a list of template parameters for a TemplateDecl and its derived classes.
Describes how types, statements, expressions, and declarations should be printed. ...
Represents the result of substituting a type for a template type parameter.
QualType getLocalUnqualifiedType() const
Return this type with all of the instance-specific qualifiers removed, but without removing any quali...
Defines the clang::Expr interface and subclasses for C++ expressions.
QualType getIntegralType() const
Retrieve the type of the integral value.
The collection of all-type qualifiers we support.
Expr * IgnoreImpCasts() LLVM_READONLY
IgnoreImpCasts - Skip past any implicit casts which might surround this expression.
const TemplateArgumentList & getTemplateArgs() const
Retrieve the template arguments of the class template specialization.
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. ...
Represents a class template specialization, which refers to a class template with a given set of temp...
Represents a class type in Objective C.
Expr * getAsExpr() const
Retrieve the template argument as an expression.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
The template argument is an integral value stored in an llvm::APSInt that was provided for an integra...
TemplateDecl * getAsTemplateDecl() const
Retrieve the underlying template declaration that this template name refers to, if known...
TemplateName getTemplateName() const
Retrieve the name of the template that we are specializing.
clang::CharUnits operator*(clang::CharUnits::QuantityType Scale, const clang::CharUnits &CU)
QualType getParamTypeForDecl() const
Qualifiers getLocalQualifiers() const
Retrieve the set of qualifiers local to this particular QualType instance, not including any qualifie...
An rvalue reference type, per C++11 [dcl.ref].
bool isTypeAlias() const
Determine if this template specialization type is for a type alias template that has been substituted...
const clang::PrintingPolicy & getPrintingPolicy() const
TypeDecl - Represents a declaration of a type.
void printPretty(raw_ostream &OS, PrinterHelper *Helper, const PrintingPolicy &Policy, unsigned Indentation=0, const ASTContext *Context=nullptr) const
static Qualifiers removeCommonQualifiers(Qualifiers &L, Qualifiers &R)
Returns the common set of qualifiers while removing them from the given sets.
__INTPTR_TYPE__ intptr_t
A signed integer type with the property that any valid pointer to void can be converted to this type...
bool isLambdaCallOperator(const CXXMethodDecl *MD)
QualType getObjCProtoType() const
Retrieve the type of the Objective-C Protocol class.
virtual Decl * getCanonicalDecl()
Retrieves the "canonical" declaration of the given declaration.
Represents a prototype with parameter type info, e.g.
bool isParameterPack() const
Whether this parameter is a non-type template parameter pack.
ValueDecl * getAsDecl() const
Retrieve the declaration for a declaration non-type template argument.
void print(raw_ostream &OS, const PrintingPolicy &Policy) const
Print this nested name specifier to the given output stream.
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
ValueDecl - Represent the declaration of a variable (in which case it is an lvalue) a function (in wh...
Expr - This represents one expression.
static Kind getNullabilityAttrKind(NullabilityKind kind)
Retrieve the attribute kind corresponding to the given nullability kind.
The template argument is a null pointer or null pointer to member that was provided for a non-type te...
void print(raw_ostream &OS, const PrintingPolicy &Policy, bool appendSpaceIfNonEmpty=false) const
unsigned TemplateDiffUsed
ClassTemplateDecl * getSpecializedTemplate() const
Retrieve the template that this specialization specializes.
ArrayRef< TemplateArgument > asArray() const
Produce this as an array ref.
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
Represents a C++ template name within the type system.
static DeclarationName getFromOpaqueInteger(uintptr_t P)
char __ovld __cnfn min(char x, char y)
Returns y if y < x, otherwise it returns x.
static Optional< NullabilityKind > stripOuterNullability(QualType &T)
Strip off the top-level nullability annotation on the given type, if it's there.
UnaryOperator - This represents the unary-expression's (except sizeof and alignof), the postinc/postdec operators from postfix-expression, and various extensions.
QualType getFunctionType(QualType ResultTy, ArrayRef< QualType > Args, const FunctionProtoType::ExtProtoInfo &EPI) const
Return a normal function type with a typed argument list.
Represents a GCC generic vector type.
An lvalue reference type, per C++11 [dcl.ref].
QualType getTypeDeclType(const TypeDecl *Decl, const TypeDecl *PrevDecl=nullptr) const
Return the unique reference to the type for the specified type declaration.
static QualType Desugar(ASTContext &Context, QualType QT, bool &ShouldAKA)
bool isNull() const
Return true if this QualType doesn't point to a type yet.
const NamedDecl * FromDecl
RecordDecl * getDecl() const
QualType getBuiltinMSVaListType() const
Retrieve the type of the __builtin_ms_va_list type.
QualType getCanonicalType() const
param_type_range param_types() const
ExtProtoInfo getExtProtoInfo() const
Sugar for parentheses used when specifying types.
std::string getNameAsString() const
getNameAsString - Get a human-readable name for the declaration, even if it is one of the special kin...
QualType getElementType() const
QualType getObjCSelType() const
Retrieve the type that corresponds to the predefined Objective-C 'SEL' type.
const char ToggleHighlight
Special character that the diagnostic printer will use to toggle the bold attribute.
OpenMPLinearClauseKind Modifier
Modifier of 'linear' clause.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
TypeClass getTypeClass() const
QualType getAttributedType(AttributedType::Kind attrKind, QualType modifiedType, QualType equivalentType)
llvm::APSInt getAsIntegral() const
Retrieve the template argument as an integral value.
bool isVectorType() const
static QualType getFromOpaquePtr(const void *Ptr)
ast_type_traits::DynTypedNode Node
Represents a template argument.
QualType getTemplateSpecializationType(TemplateName T, ArrayRef< TemplateArgument > Args, QualType Canon=QualType()) const
Represents a type which was implicitly adjusted by the semantic engine for arbitrary reasons...
Dataflow Directional Tag Classes.
virtual void getNameForDiagnostic(raw_ostream &OS, const PrintingPolicy &Policy, bool Qualified) const
Appends a human-readable name for this declaration into the given stream.
A qualifier set is used to build a set of qualifiers.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
The base class of all kinds of template declarations (e.g., class, function, etc.).
static std::string getAsString(SplitQualType split, const PrintingPolicy &Policy)
bool isBooleanType() const
const Type * strip(QualType type)
Collect any qualifiers on the given type and return an unqualified type.
QualType getFunctionNoProtoType(QualType ResultTy, const FunctionType::ExtInfo &Info) const
Return a K&R style C function type like 'int()'.
Expr * getDefaultArgument() const
Retrieve the default argument, if any.
QualType apply(const ASTContext &Context, QualType QT) const
Apply the collected qualifiers to the given type.
pack_iterator pack_begin() const
Iterator referencing the first argument of a template argument pack.
Represents a pointer to an Objective C object.
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
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.
unsigned getNumArgs() const
Retrieve the number of template arguments.
const TemplateArgument & getArg(unsigned Idx) const
Retrieve a specific template argument as a type.
bool hasSameType(QualType T1, QualType T2) const
Determine whether the given types T1 and T2 are equivalent.
The template argument is a type.
The template argument is actually a parameter pack.
pack_iterator pack_end() const
Iterator referencing one past the last argument of a template argument pack.
ArgKind getKind() const
Return the kind of stored template argument.
An attributed type is a type to which a type attribute has been applied.
QualType getAliasedType() const
Get the aliased type, if this is a specialization of a type alias template.
QualType getRValueReferenceType(QualType T) const
Return the uniqued reference to the type for an rvalue reference to the specified type...
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.
QualType getPointerType(QualType T) const
Return the uniqued reference to the type for a pointer to the specified type.
StringRef getName() const
getName - Get the name of identifier for this declaration as a StringRef.
std::string getQualifiedNameAsString() const
unsigned getNumElements() const
QualType getAsType() const
Retrieve the type for a type template argument.
Represents a type template specialization; the template must be a class template, a type alias templa...
bool isPointerType() const
NamedDecl - This represents a decl with a name.
QualType getObjCObjectPointerType(QualType OIT) const
Return a ObjCObjectPointerType type for the given ObjCObjectType.
bool isTranslationUnit() const
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 ...
const LangOptions & getLangOpts() const
Attr - This represents one attribute.