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  assert(pt);
36  return pt->getPointeeType().isConstQualified();
37  }
38 
39  // regular type
40  return qt.isConstQualified();
41  }
42 
43  bool isCmsLocalFile(const char *file);
44  std::string getQualifiedName(const clang::NamedDecl &d);
45  bool isSafeClassName(const std::string &d);
46  bool isDataClass(const std::string &d);
47  bool isInterestingLocation(const std::string &d);
49  void writeLog(const std::string &ostring, const std::string &tfstring);
50  void fixAnonNS(std::string &name, const char *fname);
51  } // namespace support
52 } // namespace clangcms
53 
54 #endif
bool isKnownThrUnsafeFunc(const std::string &name)
bool isConst(clang::QualType const &qt)
Definition: CmsSupport.h:28
bool isInterestingLocation(const std::string &d)
assert(be >=bs)
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)