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 
14 namespace clangcms {
15 
16 namespace support {
17 
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 {
30  if ( qt->isReferenceType() )
31  {
32  // remove only the surounding reference type
33  return qt.getNonReferenceType().isConstQualified();
34  }
35  if ( qt->isPointerType() )
36  {
37  clang::PointerType const* pt = qt->getAs<clang::PointerType>();
38  return pt->getPointeeType().isConstQualified();
39  }
40 
41  // regular type
42  return qt.isConstQualified();
43 }
44 
45 bool isCmsLocalFile(const char* file);
46 
47 }
48 }
49 
50 #endif
bool isConst(clang::QualType const &qt)
Definition: CmsSupport.h:28
bool isCmsLocalFile(const char *file)