diff options
Diffstat (limited to 'compilerplugins/clang/check.hxx')
-rw-r--r-- | compilerplugins/clang/check.hxx | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/compilerplugins/clang/check.hxx b/compilerplugins/clang/check.hxx index d69acc264243..0c2c1bb3031f 100644 --- a/compilerplugins/clang/check.hxx +++ b/compilerplugins/clang/check.hxx @@ -48,6 +48,11 @@ public: template<std::size_t N> inline ContextCheck Class(char const (& id)[N]) const; + TypeCheck Typedef() const; + + template<std::size_t N> inline ContextCheck Typedef(char const (& id)[N]) + const; + TypeCheck NotSubstTemplateTypeParmType() const; private: @@ -152,6 +157,22 @@ template<std::size_t N> ContextCheck TypeCheck::Class(char const (& id)[N]) return ContextCheck(); } +template<std::size_t N> ContextCheck TypeCheck::Typedef(char const (& id)[N]) + const +{ + if (!type_.isNull()) { + if (auto const t = type_->getAs<clang::TypedefType>()) { + auto const d = t->getDecl(); + auto const i = d->getIdentifier(); + assert(i != nullptr); + if (i->isStr(id)) { + return ContextCheck(d->getDeclContext()); + } + } + } + return ContextCheck(); +} + template<std::size_t N> ContextCheck DeclCheck::Class(char const (& id)[N]) const { |