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
clangcms::support::isConst
bool isConst(clang::QualType const &qt)
Definition: CmsSupport.h:28
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
clangcms::support::isKnownThrUnsafeFunc
bool isKnownThrUnsafeFunc(const std::string &name)
clangcms::support::isSafeClassName
bool isSafeClassName(const std::string &d)
clangcms
Definition: ArgSizeChecker.h:10
clangcms::support::isInterestingLocation
bool isInterestingLocation(const std::string &d)
geometryDiff.file
file
Definition: geometryDiff.py:13
clangcms::support::getQualifiedName
std::string getQualifiedName(const clang::NamedDecl &d)
clangcms::support::writeLog
void writeLog(const std::string &ostring, const std::string &tfstring)
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
alignmentValidation.fname
string fname
main script
Definition: alignmentValidation.py:959
clangcms::support::fixAnonNS
void fixAnonNS(std::string &name, const char *fname)
clangcms::support::isCmsLocalFile
bool isCmsLocalFile(const char *file)
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
clangcms::support::isDataClass
bool isDataClass(const std::string &d)
ztail.d
d
Definition: ztail.py:151