diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2016-07-08 16:46:57 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2016-07-08 16:47:31 +0200 |
commit | 9d80c032febaaf72b0991ea7add30af506af820a (patch) | |
tree | eedc2fd2ea68b85f96d2400312f43af57a28a922 /compilerplugins/clang/check.hxx | |
parent | 1257344e89e80715c35e621b7693f401f147bdf1 (diff) |
loplugin:redundantcast: redundant static_casts
Change-Id: I4d50b77745d68a23136221ef06f327137e89fa7e
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 { |