[cfe-commits] r89015 - in /cfe/trunk: lib/CodeGen/CGCXXExpr.cpp test/CodeGenCXX/rtti.cpp

Mike Stump mrs at apple.com
Mon Nov 16 16:45:21 PST 2009


Author: mrs
Date: Mon Nov 16 18:45:21 2009
New Revision: 89015

URL: http://llvm.org/viewvc/llvm-project?rev=89015&view=rev
Log:
Ensure we peer through () when handling typeid(*p).

Modified:
    cfe/trunk/lib/CodeGen/CGCXXExpr.cpp
    cfe/trunk/test/CodeGenCXX/rtti.cpp

Modified: cfe/trunk/lib/CodeGen/CGCXXExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCXXExpr.cpp?rev=89015&r1=89014&r2=89015&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGCXXExpr.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCXXExpr.cpp Mon Nov 16 18:45:21 2009
@@ -372,7 +372,7 @@
       // We need to do a zero check for *p, unless it has NonNullAttr.
       // FIXME: PointerType->hasAttr<NonNullAttr>()
       bool CanBeZero = false;
-      if (UnaryOperator *UO = dyn_cast<UnaryOperator>(subE))
+      if (UnaryOperator *UO = dyn_cast<UnaryOperator>(subE->IgnoreParens()))
         if (UO->getOpcode() == UnaryOperator::Deref)
           CanBeZero = true;
       if (CanBeZero) {

Modified: cfe/trunk/test/CodeGenCXX/rtti.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/rtti.cpp?rev=89015&r1=89014&r2=89015&view=diff

==============================================================================
--- cfe/trunk/test/CodeGenCXX/rtti.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/rtti.cpp Mon Nov 16 18:45:21 2009
@@ -102,7 +102,7 @@
     test2_1();
   if (typeid(NP) == typeid(test1_D))
     test2_1();
-  if (typeid(*dp) == typeid(test1_D))
+  if (typeid(((*(dp)))) == typeid(test1_D))
     test2_1();
 }
 





More information about the cfe-commits mailing list