diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2014-12-04 08:22:09 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2014-12-04 08:22:09 +0100 |
commit | eff69c6b4c71332de2219288ed91bc1c7a280408 (patch) | |
tree | 49ca8bc87996e9530373920f9b08d6b9c5f49f5d /compilerplugins | |
parent | 4eb381147bd0c9c7a48f86de0e3ae1d4c3bbe12f (diff) |
Run loplugin:cstylecast on C++ and Ojbective C++ code
Change-Id: I4035318d35d468fa93d4dcfe56f9b0434fd1dfe7
Diffstat (limited to 'compilerplugins')
-rw-r--r-- | compilerplugins/clang/store/cstylecast.cxx | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/compilerplugins/clang/store/cstylecast.cxx b/compilerplugins/clang/store/cstylecast.cxx index c34a6bd7a95c..b8f732577251 100644 --- a/compilerplugins/clang/store/cstylecast.cxx +++ b/compilerplugins/clang/store/cstylecast.cxx @@ -23,7 +23,11 @@ class CStyleCast: public: explicit CStyleCast(InstantiationData const & data): Plugin(data) {} - virtual void run() override { TraverseDecl(compiler.getASTContext().getTranslationUnitDecl()); } + virtual void run() override { + if (compiler.getLangOpts().CPlusPlus) { + TraverseDecl(compiler.getASTContext().getTranslationUnitDecl()); + } + } bool VisitCStyleCastExpr(const CStyleCastExpr * expr); }; @@ -66,7 +70,7 @@ bool CStyleCast::VisitCStyleCastExpr(const CStyleCastExpr * expr) { expr->getLocStart()); StringRef filename = compiler.getSourceManager().getFilename(spellingLocation); // ignore C code - if ( filename.endswith(".h") || filename.endswith(".c") ) { + if ( filename.endswith(".h") ) { return true; } if ( compat::isInMainFile(compiler.getSourceManager(), spellingLocation) |