]> granicus.if.org Git - clang/commitdiff
Unqualify the parameter type.
authorRafael Espindola <rafael.espindola@gmail.com>
Fri, 4 Jan 2013 20:34:32 +0000 (20:34 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Fri, 4 Jan 2013 20:34:32 +0000 (20:34 +0000)
This fixes a regression from 168895.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171519 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Sema/Initialization.h
test/Sema/implicit-cast-dump.c [new file with mode: 0644]

index b4c41d479ea595ee5bbf64298398417613ffdd12..778b70b0ec12b5d577ad0a081d907cf43c4e78d3 100644 (file)
@@ -177,8 +177,7 @@ public:
   /// \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 @@ public:
 
     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 (file)
index 0000000..f2e208d
--- /dev/null
@@ -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>
+}