diff options
author | Nuno Lopes <nunoplopes@sapo.pt> | 2008-09-01 11:33:04 +0000 |
---|---|---|
committer | Nuno Lopes <nunoplopes@sapo.pt> | 2008-09-01 11:33:04 +0000 |
commit | b381aac9bae6d608c72267dd0ed08ec6369e94e4 (patch) | |
tree | d59bc7d025c0f0dfdfdec0ad4e7017b6e4917172 /lib/AST/Type.cpp | |
parent | cc1b8532a113fa3216096757b3b4e203867bd5e0 (diff) |
codegen constant data as such. add QualType::isConstant()
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55603 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/Type.cpp')
-rw-r--r-- | lib/AST/Type.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/AST/Type.cpp b/lib/AST/Type.cpp index 2c5a3f41bf..41cd828f01 100644 --- a/lib/AST/Type.cpp +++ b/lib/AST/Type.cpp @@ -11,6 +11,7 @@ // //===----------------------------------------------------------------------===// +#include "clang/AST/ASTContext.h" #include "clang/AST/Type.h" #include "clang/AST/DeclCXX.h" #include "clang/AST/DeclObjC.h" @@ -19,6 +20,16 @@ #include <sstream> using namespace clang; +bool QualType::isConstant(ASTContext& Ctx) const { + if (isConstQualified()) + return true; + + if (getTypePtr()->isArrayType()) + return Ctx.getAsArrayType(*this)->getElementType().isConstant(Ctx); + + return false; +} + void Type::Destroy(ASTContext& C) { delete this; } void FunctionTypeProto::Destroy(ASTContext& C) { |