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 <clang/AST/Type.h>
11 #include <clang/AST/Decl.h>
12 #include <clang/AST/DeclCXX.h>
13 #include <string>
14 
15 namespace clangcms {
16 
17 namespace support {
18 
19 
20 // The three cases
21 //
22 // const int var;
23 // int const& var;
24 // int const* var;
25 //
26 // have to be handled slightly different. This function implements the functionality to check
27 // for const qualifier for all of them.
28 //
29 inline bool isConst( clang::QualType const& qt )
30 {
31  if ( qt->isReferenceType() )
32  {
33  // remove only the surounding reference type
34  return qt.getNonReferenceType().isConstQualified();
35  }
36  if ( qt->isPointerType() )
37  {
38  clang::PointerType const* pt = qt->getAs<clang::PointerType>();
39  return pt->getPointeeType().isConstQualified();
40  }
41 
42  // regular type
43  return qt.isConstQualified();
44 }
45 
46 bool isCmsLocalFile(const char* file);
47 std::string getQualifiedName(const clang::NamedDecl &d);
48 bool isSafeClassName(const std::string &d);
49 bool isDataClass(const std::string &d);
52 void writeLog(const std::string &ostring,const std::string &tfstring);
53 }
54 }
55 
56 #endif
bool isKnownThrUnsafeFunc(const std::string &name)
bool isConst(clang::QualType const &qt)
Definition: CmsSupport.h:29
bool isInterestingLocation(const std::string &d)
bool isSafeClassName(const std::string &d)
tuple d
Definition: ztail.py:151
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)