From: Mike Stump Date: Tue, 17 Nov 2009 00:45:21 +0000 (+0000) Subject: Ensure we peer through () when handling typeid(*p). X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=db519a4bb2082b98e03162ac1a4399978833643b;p=clang Ensure we peer through () when handling typeid(*p). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89015 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGCXXExpr.cpp b/lib/CodeGen/CGCXXExpr.cpp index eff432a05c..75740af074 100644 --- a/lib/CodeGen/CGCXXExpr.cpp +++ b/lib/CodeGen/CGCXXExpr.cpp @@ -372,7 +372,7 @@ llvm::Value * CodeGenFunction::EmitCXXTypeidExpr(const CXXTypeidExpr *E) { // We need to do a zero check for *p, unless it has NonNullAttr. // FIXME: PointerType->hasAttr() bool CanBeZero = false; - if (UnaryOperator *UO = dyn_cast(subE)) + if (UnaryOperator *UO = dyn_cast(subE->IgnoreParens())) if (UO->getOpcode() == UnaryOperator::Deref) CanBeZero = true; if (CanBeZero) { diff --git a/test/CodeGenCXX/rtti.cpp b/test/CodeGenCXX/rtti.cpp index 49dcbe3f77..76f571ede2 100644 --- a/test/CodeGenCXX/rtti.cpp +++ b/test/CodeGenCXX/rtti.cpp @@ -102,7 +102,7 @@ void test2_2(test1_D *dp) { test2_1(); if (typeid(NP) == typeid(test1_D)) test2_1(); - if (typeid(*dp) == typeid(test1_D)) + if (typeid(((*(dp)))) == typeid(test1_D)) test2_1(); }