Unqualify the parameter type.
This fixes a regression from 168895.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171519 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/clang/Sema/Initialization.h b/include/clang/Sema/Initialization.h
index b4c41d4..778b70b 100644
--- a/include/clang/Sema/Initialization.h
+++ b/include/clang/Sema/Initialization.h
@@ -177,8 +177,7 @@
/// \brief Create the initialization entity for a parameter.
static InitializedEntity InitializeParameter(ASTContext &Context,
ParmVarDecl *Parm) {
- return InitializeParameter(Context, Parm,
- Parm->getType().getUnqualifiedType());
+ return InitializeParameter(Context, Parm, Parm->getType());
}
/// \brief Create the initialization entity for a parameter, but use
@@ -191,7 +190,8 @@
InitializedEntity Entity;
Entity.Kind = EK_Parameter;
- Entity.Type = Context.getVariableArrayDecayedType(Type);
+ Entity.Type =
+ Context.getVariableArrayDecayedType(Type.getUnqualifiedType());
Entity.Parent = 0;
Entity.Parameter
= (static_cast<uintptr_t>(Consumed) | reinterpret_cast<uintptr_t>(Parm));
diff --git a/test/Sema/implicit-cast-dump.c b/test/Sema/implicit-cast-dump.c
new file mode 100644
index 0000000..f2e208d
--- /dev/null
+++ b/test/Sema/implicit-cast-dump.c
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -ast-dump %s | FileCheck %s
+
+void foo1(void*);
+void foo2(void* const);
+
+
+void bar() {
+ // CHECK: (FunctionDecl {{.*}} <line:{{.*}}, line:{{.*}}> bar 'void ()'
+
+ foo1(0);
+ // CHECK: (ImplicitCastExpr {{.*}} <col:{{.*}}> 'void *' <NullToPointer>
+
+ foo2(0);
+ // CHECK: (ImplicitCastExpr {{.*}} <col:{{.*}}> 'void *' <NullToPointer>
+}