Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-12-19 04:04:57

0001 //== CmsException.cpp -                             --------------*- C++ -*--==//
0002 //
0003 // by Thomas Hauth [ Thomas.Hauth@cern.ch ] and Patrick Gartung
0004 //
0005 //===----------------------------------------------------------------------===//
0006 
0007 #include "CmsException.h"
0008 #include "CmsSupport.h"
0009 
0010 namespace clangcms {
0011 
0012   bool CmsException::reportGeneral(clang::ento::PathDiagnosticLocation const& path,
0013                                    clang::ento::BugReporter& BR) const {
0014     const auto Loc = path.asLocation();
0015     if (!Loc.isValid()) {
0016       return false;
0017     }
0018     const char* sfile = BR.getSourceManager().getPresumedLoc(Loc).getFilename();
0019     if ((!sfile) || (!support::isCmsLocalFile(sfile)))
0020       return false;
0021     return true;
0022   }
0023 
0024   bool CmsException::reportConstCast(const clang::ento::BugReport& R, clang::ento::CheckerContext& C) const {
0025     clang::ento::BugReporter& BR = C.getBugReporter();
0026     const clang::SourceManager& SM = BR.getSourceManager();
0027     clang::ento::PathDiagnosticLocation const& path = R.getLocation();
0028     return reportGeneral(path, BR);
0029   }
0030 
0031   bool CmsException::reportConstCastAway(const clang::ento::BugReport& R, clang::ento::CheckerContext& C) const {
0032     clang::ento::BugReporter& BR = C.getBugReporter();
0033     const clang::SourceManager& SM = BR.getSourceManager();
0034     clang::ento::PathDiagnosticLocation const& path = R.getLocation();
0035     return reportGeneral(path, BR);
0036   }
0037 
0038   bool CmsException::reportGlobalStatic(clang::QualType const& t,
0039                                         clang::ento::PathDiagnosticLocation const& path,
0040                                         clang::ento::BugReporter& BR) const {
0041     return reportGeneral(path, BR);
0042   }
0043 
0044   bool CmsException::reportMutableMember(/*clang::QualType const& t,*/
0045                                          clang::ento::PathDiagnosticLocation const& path,
0046                                          clang::ento::BugReporter& BR) const {
0047     return reportGeneral(path, BR);
0048   }
0049 
0050   bool CmsException::reportClass(clang::ento::PathDiagnosticLocation const& path, clang::ento::BugReporter& BR) const {
0051     return reportGeneral(path, BR);
0052   }
0053 
0054   bool CmsException::reportGlobalStaticForType(clang::QualType const& t,
0055                                                clang::ento::PathDiagnosticLocation const& path,
0056                                                clang::ento::BugReporter& BR) const {
0057     return reportGeneral(path, BR);
0058   }
0059 }  // namespace clangcms