CMS 3D CMS Logo

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