Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:32:06

0001 //==-- UsingNamespace.h - Checks for using namespace and using std:: in headers --------------*- C++ -*--==//
0002 //
0003 // by Shahzad Malik MUZAFFAR [ Shahzad.Malik.MUZAFFAR@cern.ch ]
0004 //
0005 //===----------------------------------------------------------------------===//
0006 #ifndef Utilities_StaticAnalyzers_UsingNamespace_h
0007 #define Utilities_StaticAnalyzers_UsingNamespace_h
0008 
0009 #include <clang/StaticAnalyzer/Core/Checker.h>
0010 #include <clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h>
0011 #include <clang/AST/DeclCXX.h>
0012 #include <llvm/Support/raw_ostream.h>
0013 
0014 namespace clangcms {
0015   class UsingNamespace : public clang::ento::Checker<clang::ento::check::ASTDecl<clang::UsingDirectiveDecl>,
0016                                                      clang::ento::check::ASTDecl<clang::UsingDecl> > {
0017   public:
0018     void checkASTDecl(const clang::UsingDirectiveDecl *D,
0019                       clang::ento::AnalysisManager &Mgr,
0020                       clang::ento::BugReporter &BR) const;
0021     void checkASTDecl(const clang::UsingDecl *D, clang::ento::AnalysisManager &Mgr, clang::ento::BugReporter &BR) const;
0022 
0023   private:
0024     bool isDeclOK(const clang::NamedDecl *D, clang::ento::BugReporter &BR) const;
0025     void reportBug(const char *bug, const clang::Decl *D, clang::ento::BugReporter &BR) const;
0026   };
0027 }  // namespace clangcms
0028 #endif