CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CmsSupport.h
Go to the documentation of this file.
1 //===--- CmsSupport.h - Provides support functions ------------*- C++ -*-===//
2 //
3 // by Thomas Hauth [ Thomas.Hauth@cern.ch ] and Patrick Gartung
4 //
5 //===----------------------------------------------------------------------===//
6 
7 #ifndef LLVM_CLANG_STATICANALYZER_CMS_SUPPORT_H
8 #define LLVM_CLANG_STATICANALYZER_CMS_SUPPORT_H
9 
10 #include <llvm/Support/Regex.h>
11 
12 #include <clang/AST/Type.h>
13 #include <clang/AST/Decl.h>
14 #include <clang/AST/DeclCXX.h>
15 
16 namespace clangcms {
17 
18 namespace support {
19 
20 
21 // The three cases
22 //
23 // const int var;
24 // int const& var;
25 // int const* var;
26 //
27 // have to be handled slightly different. This function implements the functionality to check
28 // for const qualifier for all of them.
29 //
30 inline bool isConst( clang::QualType const& qt )
31 {
32  if ( qt->isReferenceType() )
33  {
34  // remove only the surounding reference type
35  return qt.getNonReferenceType().isConstQualified();
36  }
37  if ( qt->isPointerType() )
38  {
39  clang::PointerType const* pt = qt->getAs<clang::PointerType>();
40  return pt->getPointeeType().isConstQualified();
41  }
42 
43  // regular type
44  return qt.isConstQualified();
45 }
46 
47 bool isCmsLocalFile(const char* file);
48 std::string getQualifiedName(const clang::NamedDecl &d);
49 bool isSafeClassName(const std::string &d);
50 bool isDataClass(const std::string &d);
51 bool isInterestingLocation(const std::string &d);
53 void writeLog(const std::string &ostring,const std::string &tfstring);
54 }
55 }
56 
57 #endif
bool isKnownThrUnsafeFunc(const std::string &name)
bool isConst(clang::QualType const &qt)
Definition: CmsSupport.h:30
bool isInterestingLocation(const std::string &d)
bool isSafeClassName(const std::string &d)
std::string getQualifiedName(const clang::NamedDecl &d)
bool isDataClass(const std::string &d)
bool isCmsLocalFile(const char *file)
void writeLog(const std::string &ostring, const std::string &tfstring)