diff options
author | Anders Carlsson <andersca@mac.com> | 2008-12-21 03:44:36 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2008-12-21 03:44:36 +0000 |
commit | 6183a99b064b397d98297904fbd6cf00fe1f453d (patch) | |
tree | f38e16a713dceccb5c4cd68cce66cb2340fc65b3 /lib/AST/ASTContext.cpp | |
parent | 0269709723e4cb0836a1a50964949e96dc0d1173 (diff) |
Add ASTContext::getBaseElementType and use it in CodeGenFunction::EmitArraySubscriptExpr.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61303 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/ASTContext.cpp')
-rw-r--r-- | lib/AST/ASTContext.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index 791e38633b..f81d41aa61 100644 --- a/lib/AST/ASTContext.cpp +++ b/lib/AST/ASTContext.cpp @@ -1394,6 +1394,16 @@ QualType ASTContext::getArrayDecayedType(QualType Ty) { return PtrTy.getQualifiedType(PrettyArrayType->getIndexTypeQualifier()); } +QualType ASTContext::getBaseElementType(const VariableArrayType *VAT) +{ + QualType ElemTy = VAT->getElementType(); + + if (const VariableArrayType *VAT = getAsVariableArrayType(ElemTy)) + return getBaseElementType(VAT); + + return ElemTy; +} + /// getFloatingRank - Return a relative rank for floating point types. /// This routine will assert if passed a built-in type that isn't a float. static FloatingRank getFloatingRank(QualType T) { |