summaryrefslogtreecommitdiff
path: root/compilerplugins/clang/plugin.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'compilerplugins/clang/plugin.cxx')
-rw-r--r--compilerplugins/clang/plugin.cxx16
1 files changed, 14 insertions, 2 deletions
diff --git a/compilerplugins/clang/plugin.cxx b/compilerplugins/clang/plugin.cxx
index c68eceb67c32..6f7c464aa161 100644
--- a/compilerplugins/clang/plugin.cxx
+++ b/compilerplugins/clang/plugin.cxx
@@ -11,6 +11,7 @@
#include "plugin.hxx"
+#include <iostream>
#include <cassert>
#include <cstddef>
#include <string>
@@ -736,8 +737,19 @@ bool hasCLanguageLinkageType(FunctionDecl const * decl) {
static const CXXRecordDecl* stripTypeSugar(QualType qt)
{
const clang::Type* t = qt.getTypePtr();
- while (auto elaboratedType = dyn_cast<ElaboratedType>(t))
- t = elaboratedType->desugar().getTypePtr();
+ do
+ {
+ if (auto elaboratedType = dyn_cast<ElaboratedType>(t))
+ t = elaboratedType->desugar().getTypePtr();
+ else if (auto tsType = dyn_cast<TemplateSpecializationType>(t))
+ t = tsType->desugar().getTypePtr();
+ else if (auto sttpType = dyn_cast<SubstTemplateTypeParmType>(t))
+ t = sttpType->desugar().getTypePtr();
+ else if (auto tdType = dyn_cast<TypedefType>(t))
+ t = tdType->desugar().getTypePtr();
+ else
+ break;
+ } while(true);
auto recordType = dyn_cast<RecordType>(t);
if (!recordType)
return nullptr;