diff options
author | Chris Lattner <sabre@nondot.org> | 2008-08-04 07:31:14 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-08-04 07:31:14 +0000 |
commit | 7adf07608847865d47fa50640c3b18007953c4aa (patch) | |
tree | 263f2ca4985a4e008e230fee9d2e6c4794075625 /clang/lib/CodeGen/CGDebugInfo.cpp | |
parent | a01ede2f1105780926d58af04d0e4db09140221f (diff) | |
download | bcm5719-llvm-7adf07608847865d47fa50640c3b18007953c4aa.tar.gz bcm5719-llvm-7adf07608847865d47fa50640c3b18007953c4aa.zip |
Finally fix PR2189. This makes a fairly invasive but important change to
move getAsArrayType into ASTContext instead of being a method on type.
This is required because getAsArrayType(const AT), where AT is a typedef
for "int[10]" needs to return ArrayType(const int, 10).
Fixing this greatly simplifies getArrayDecayedType, which is a good sign.
llvm-svn: 54317
Diffstat (limited to 'clang/lib/CodeGen/CGDebugInfo.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGDebugInfo.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index d232fd95601..0b63463d1f7 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -108,10 +108,8 @@ CGDebugInfo::~CGDebugInfo() delete GlobalVariableAnchor; } -void CGDebugInfo::setLocation(SourceLocation loc) -{ - SourceManager &SM = M->getContext().getSourceManager(); - CurLoc = SM.getLogicalLoc(loc); +void CGDebugInfo::setLocation(SourceLocation loc) { + CurLoc = M->getContext().getSourceManager().getLogicalLoc(loc); } /// getCastValueFor - Return a llvm representation for a given debug information @@ -481,20 +479,20 @@ CGDebugInfo::getOrCreateArrayType(QualType type, llvm::CompileUnitDesc *Unit) // Add the dimensions of the array. std::vector<llvm::DebugInfoDesc *> &Elements = ArrayTy->getElements(); do { + const ArrayType *AT = M->getContext().getAsArrayType(type); llvm::SubrangeDesc *Subrange = new llvm::SubrangeDesc(); // push it back on the subrange desc list so that we can free it later. SubrangeDescList.push_back(Subrange); uint64_t Upper = 0; - if (type->getTypeClass() == Type::ConstantArray) { - const ConstantArrayType *ConstArrTy = type->getAsConstantArrayType(); + if (const ConstantArrayType *ConstArrTy = dyn_cast<ConstantArrayType>(AT)) { Upper = ConstArrTy->getSize().getZExtValue() - 1; } Subrange->setLo(0); Subrange->setHi(Upper); Elements.push_back(Subrange); - type = type->getAsArrayType()->getElementType(); + type = AT->getElementType(); } while (type->isArrayType()); ArrayTy->setFromType(getOrCreateType(type, Unit)); |