Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:31:50

0001 //== ConstCastAwayChecker.h - Checks for removed const qualfiers --------------*- C++ -*--==//
0002 //
0003 // Check in a generic way if an explicit cast removes a const qualifier.
0004 //
0005 // by Thomas Hauth [ Thomas.Hauth@cern.ch ]
0006 //
0007 //===----------------------------------------------------------------------===//
0008 #ifndef Utilities_StaticAnalyzers_ConstCastAwayChecker_h
0009 #define Utilities_StaticAnalyzers_ConstCastAwayChecker_h
0010 
0011 #include <clang/StaticAnalyzer/Core/Checker.h>
0012 #include <clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h>
0013 #include <clang/StaticAnalyzer/Core/BugReporter/BugType.h>
0014 #include "FWCore/Utilities/interface/thread_safety_macros.h"
0015 #include "CmsException.h"
0016 
0017 namespace clangcms {
0018 
0019   class ConstCastAwayChecker : public clang::ento::Checker<clang::ento::check::PreStmt<clang::ExplicitCastExpr> > {
0020   public:
0021     CMS_SA_ALLOW mutable std::unique_ptr<clang::ento::BugType> BT;
0022     void checkPreStmt(const clang::ExplicitCastExpr *CE, clang::ento::CheckerContext &C) const;
0023 
0024   private:
0025     CmsException m_exception;
0026   };
0027 
0028 }  // namespace clangcms
0029 
0030 #endif