[cfe-commits] r171519 - in /cfe/trunk: include/clang/Sema/Initialization.h test/Sema/implicit-cast-dump.c

Rafael Espindola rafael.espindola at gmail.com
Fri Jan 4 12:34:32 PST 2013


Author: rafael
Date: Fri Jan  4 14:34:32 2013
New Revision: 171519

URL: http://llvm.org/viewvc/llvm-project?rev=171519&view=rev
Log:
Unqualify the parameter type.
This fixes a regression from 168895.

Added:
    cfe/trunk/test/Sema/implicit-cast-dump.c
Modified:
    cfe/trunk/include/clang/Sema/Initialization.h

Modified: cfe/trunk/include/clang/Sema/Initialization.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Initialization.h?rev=171519&r1=171518&r2=171519&view=diff
==============================================================================
--- cfe/trunk/include/clang/Sema/Initialization.h (original)
+++ cfe/trunk/include/clang/Sema/Initialization.h Fri Jan  4 14:34:32 2013
@@ -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));

Added: cfe/trunk/test/Sema/implicit-cast-dump.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/implicit-cast-dump.c?rev=171519&view=auto
==============================================================================
--- cfe/trunk/test/Sema/implicit-cast-dump.c (added)
+++ cfe/trunk/test/Sema/implicit-cast-dump.c Fri Jan  4 14:34:32 2013
@@ -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>
+}





More information about the cfe-commits mailing list