summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-04-02 05:18:44 +0000
committerChris Lattner <sabre@nondot.org>2008-04-02 05:18:44 +0000
commita21ad8058a8189bfde375f68a6d04f37df0e8460 (patch)
treebafa8ad703cd80d71e1d92fde67aeb0d19c0f81d /clang/lib/Sema/SemaDecl.cpp
parent2c71d5151353887c74af9ecbf4aa83b66114252f (diff)
downloadbcm5719-llvm-a21ad8058a8189bfde375f68a6d04f37df0e8460.tar.gz
bcm5719-llvm-a21ad8058a8189bfde375f68a6d04f37df0e8460.zip
Fix several bugs in array -> pointer decomposition.
First, we got several CVR propagation cases wrong, which Eli pointed out in PR2039. Second, we didn't propagate address space qualifiers correctly, leading to incorrect lowering of code in CodeGen/address-space.c. Third, we didn't uniformly propagate the specifier in the array to the pointer ("int[restrict 4]" -> "int *restrict"). This adds an ASTContext::getArrayDecayedType member that handles the non-trivial logic for this seemingly simple operation. llvm-svn: 49078
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 2d0251cc144..e247e2a52c5 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -1014,10 +1014,9 @@ Sema::ActOnParamDeclarator(struct DeclaratorChunk::ParamInfo &PI,
// we need to consider storing both types (in ParmVarDecl)...
//
QualType parmDeclType = QualType::getFromOpaquePtr(PI.TypeInfo);
- if (const ArrayType *AT = parmDeclType->getAsArrayType()) {
+ if (parmDeclType->isArrayType()) {
// int x[restrict 4] -> int *restrict
- parmDeclType = Context.getPointerType(AT->getElementType());
- parmDeclType = parmDeclType.getQualifiedType(AT->getIndexTypeQualifier());
+ parmDeclType = Context.getArrayDecayedType(parmDeclType);
} else if (parmDeclType->isFunctionType())
parmDeclType = Context.getPointerType(parmDeclType);
OpenPOWER on IntegriCloud