Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 //===--- CmsSupport.h - Provides support functions ------------*- C++ -*-===//
0002 //
0003 // by Thomas Hauth [ Thomas.Hauth@cern.ch ] and Patrick Gartung
0004 //
0005 //===----------------------------------------------------------------------===//
0006 
0007 #ifndef LLVM_CLANG_STATICANALYZER_CMS_SUPPORT_H
0008 #define LLVM_CLANG_STATICANALYZER_CMS_SUPPORT_H
0009 
0010 #include <clang/AST/Type.h>
0011 #include <clang/AST/Decl.h>
0012 #include <clang/AST/DeclCXX.h>
0013 #include <string>
0014 
0015 namespace clangcms {
0016 
0017   namespace support {
0018 
0019     // The three cases
0020     //
0021     // const int var;
0022     // int const& var;
0023     // int const* var;
0024     //
0025     // have to be handled slightly different. This function implements the functionality to check
0026     // for const qualifier for all of them.
0027     //
0028     inline bool isConst(clang::QualType const &qt) {
0029       if (qt->isReferenceType()) {
0030         // remove only the surounding reference type
0031         return qt.getNonReferenceType().isConstQualified();
0032       }
0033       if (qt->isPointerType()) {
0034         clang::PointerType const *pt = qt->getAs<clang::PointerType>();
0035         return pt->getPointeeType().isConstQualified();
0036       }
0037 
0038       // regular type
0039       return qt.isConstQualified();
0040     }
0041 
0042     bool isCmsLocalFile(const char *file);
0043     std::string getQualifiedName(const clang::NamedDecl &d);
0044     bool isSafeClassName(const std::string &d);
0045     bool isDataClass(const std::string &d);
0046     bool isInterestingLocation(const std::string &d);
0047     bool isKnownThrUnsafeFunc(const std::string &name);
0048     void writeLog(const std::string &ostring, const std::string &tfstring);
0049     void fixAnonNS(std::string &name, const char *fname);
0050   }  // namespace support
0051 }  // namespace clangcms
0052 
0053 #endif