CMS 3D CMS Logo

ConstCastAwayChecker.h
Go to the documentation of this file.
1 //== ConstCastAwayChecker.h - Checks for removed const qualfiers --------------*- C++ -*--==//
2 //
3 // Check in a generic way if an explicit cast removes a const qualifier.
4 //
5 // by Thomas Hauth [ Thomas.Hauth@cern.ch ]
6 //
7 //===----------------------------------------------------------------------===//
8 #ifndef Utilities_StaticAnalyzers_ConstCastAwayChecker_h
9 #define Utilities_StaticAnalyzers_ConstCastAwayChecker_h
10 
11 #include <clang/StaticAnalyzer/Core/Checker.h>
12 #include <clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h>
13 #include <clang/StaticAnalyzer/Core/BugReporter/BugType.h>
15 #include "CmsException.h"
16 
17 namespace clangcms {
18 
19  class ConstCastAwayChecker : public clang::ento::Checker<clang::ento::check::PreStmt<clang::ExplicitCastExpr> > {
20  public:
21  CMS_SA_ALLOW mutable std::unique_ptr<clang::ento::BugType> BT;
22  void checkPreStmt(const clang::ExplicitCastExpr *CE, clang::ento::CheckerContext &C) const;
23 
24  private:
26  };
27 
28 } // namespace clangcms
29 
30 #endif
#define CMS_SA_ALLOW
void checkPreStmt(const clang::ExplicitCastExpr *CE, clang::ento::CheckerContext &C) const
std::unique_ptr< clang::ento::BugType > BT