[PATCH] D137818: Add support for querying SubstTemplateTypeParm types
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 16 12:30:05 PST 2022
aaron.ballman added a comment.
Thanks for this! You should also add a release note about the new functionality.
================
Comment at: clang/include/clang-c/Index.h:2793-2794
+ CXType_BTFTagAttributed = 178,
+ /* Represents a type that as been substituted for a template type parameter */
+ CXType_SubstTemplateTypeParm = 179
};
----------------
================
Comment at: clang/tools/libclang/CXType.cpp:129-130
+static CXTypeKind GetSubstTemplateTypeParmTypeKind(const SubstTemplateTypeParmType* TP) {
+ const QualType RT = TP->getReplacementType();
+ return GetTypeKind(RT);
+}
----------------
================
Comment at: clang/tools/libclang/CXType.cpp:1368-1372
+ if (T.isNull() || T->getTypeClass() != Type::SubstTemplateTypeParm)
+ return MakeCXType(QualType(), GetTU(CT));
+
+ const auto *ST = T->castAs<SubstTemplateTypeParmType>();
+ return MakeCXType(ST->getReplacementType(), GetTU(CT));
----------------
================
Comment at: clang/tools/libclang/CXType.cpp:1374
+}
\ No newline at end of file
----------------
Can you add the newline back?
================
Comment at: clang/tools/libclang/libclang.map:170
clang_Type_getValueType;
+ clang_Type_getReplacementType;
clang_Type_isTransparentTagTypedef;
----------------
You should keep this in alphabetical order.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D137818/new/
https://reviews.llvm.org/D137818
More information about the cfe-commits
mailing list