@@ -830,23 +830,32 @@ namespace {
830
830
return { mappedType, underlyingResult.Hint };
831
831
}
832
832
833
- #define SUGAR_TYPE (KIND ) \
834
- ImportResult Visit##KIND##Type(const clang::KIND##Type *type) { \
835
- return Visit (type->desugar ()); \
836
- }
837
- SUGAR_TYPE (TypeOfExpr)
838
- SUGAR_TYPE (TypeOf)
839
- SUGAR_TYPE (Decltype)
840
- SUGAR_TYPE (UnaryTransform)
841
- SUGAR_TYPE (Elaborated)
842
- SUGAR_TYPE (SubstTemplateTypeParm)
843
- SUGAR_TYPE (TemplateSpecialization)
844
- SUGAR_TYPE (Auto)
845
- SUGAR_TYPE (DeducedTemplateSpecialization)
846
- SUGAR_TYPE (Adjusted)
847
- SUGAR_TYPE (PackExpansion)
848
- SUGAR_TYPE (Attributed)
833
+ // TODO: add custom visitors for these types.
834
+ #define MAYBE_SUGAR_TYPE (KIND ) \
835
+ ImportResult Visit##KIND##Type(const clang::KIND##Type *type) { \
836
+ if (type->isSugared ()) \
837
+ return Visit (type->desugar ()); \
838
+ return Type (); \
839
+ }
840
+ MAYBE_SUGAR_TYPE (TypeOfExpr)
841
+ MAYBE_SUGAR_TYPE (TypeOf)
842
+ MAYBE_SUGAR_TYPE (Decltype)
843
+ MAYBE_SUGAR_TYPE (UnaryTransform)
844
+ MAYBE_SUGAR_TYPE (TemplateSpecialization)
845
+ MAYBE_SUGAR_TYPE (Auto)
846
+ MAYBE_SUGAR_TYPE (DeducedTemplateSpecialization)
847
+ MAYBE_SUGAR_TYPE (PackExpansion)
848
+
849
+ // These types are ALWAYS sugared.
850
+ #define SUGAR_TYPE (KIND ) \
851
+ ImportResult Visit##KIND##Type(const clang::KIND##Type *type) { \
852
+ return Visit (type->desugar ()); \
853
+ }
849
854
SUGAR_TYPE (MacroQualified)
855
+ SUGAR_TYPE (Attributed)
856
+ SUGAR_TYPE (Adjusted)
857
+ SUGAR_TYPE (SubstTemplateTypeParm)
858
+ SUGAR_TYPE (Elaborated)
850
859
851
860
ImportResult VisitDecayedType (const clang::DecayedType *type) {
852
861
clang::ASTContext &clangCtx = Impl.getClangASTContext ();
0 commit comments