[Libreoffice-commits] core.git: compilerplugins/clang

Stephan Bergmann sbergman at redhat.com
Wed Dec 3 23:22:44 PST 2014


 compilerplugins/clang/store/cstylecast.cxx |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

New commits:
commit eff69c6b4c71332de2219288ed91bc1c7a280408
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Dec 4 08:22:09 2014 +0100

    Run loplugin:cstylecast on C++ and Ojbective C++ code
    
    Change-Id: I4035318d35d468fa93d4dcfe56f9b0434fd1dfe7

diff --git a/compilerplugins/clang/store/cstylecast.cxx b/compilerplugins/clang/store/cstylecast.cxx
index c34a6bd..b8f7325 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)


More information about the Libreoffice-commits mailing list