Skip to content

Commit ade6cda

Browse files
debug: Add printer for TemplateSpecializationKind (#288)
1 parent e719b1e commit ade6cda

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

indexer/DebugHelpers.cc

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,21 @@ std::string formatTemplateNameKind(const clang::TemplateName::NameKind kind) {
183183
#undef HANDLE_KIND
184184
}
185185

186+
std::string
187+
formatTemplateSpecializationKind(clang::TemplateSpecializationKind kind) {
188+
#define HANDLE_KIND(kind_) \
189+
case clang::TemplateSpecializationKind::TSK_##kind_: \
190+
return #kind_;
191+
switch (kind) {
192+
HANDLE_KIND(Undeclared)
193+
HANDLE_KIND(ImplicitInstantiation)
194+
HANDLE_KIND(ExplicitSpecialization)
195+
HANDLE_KIND(ExplicitInstantiationDeclaration)
196+
HANDLE_KIND(ExplicitInstantiationDefinition)
197+
}
198+
#undef HANDLE_KIND
199+
}
200+
186201
std::string formatTypeInternals(const clang::QualType &qualType,
187202
const clang::ASTContext &astContext) {
188203
if (qualType.isNull()) {

indexer/DebugHelpers.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include "clang/AST/TemplateName.h"
77
#include "clang/Basic/FileEntry.h"
88
#include "clang/Basic/SourceManager.h"
9+
#include "clang/Basic/Specifiers.h"
910
#include "clang/Lex/PPCallbacks.h"
1011
#include "llvm/ADT/StringRef.h"
1112

@@ -36,6 +37,8 @@ std::string formatDecl(const clang::Decl *);
3637

3738
std::string formatTemplateNameKind(clang::TemplateName::NameKind);
3839

40+
std::string formatTemplateSpecializationKind(clang::TemplateSpecializationKind);
41+
3942
std::string formatTypeInternals(const clang::QualType &,
4043
const clang::ASTContext &);
4144

0 commit comments

Comments
 (0)