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 eff432a..75740af 100644
--- a/lib/CodeGen/CGCXXExpr.cpp
+++ b/lib/CodeGen/CGCXXExpr.cpp
@@ -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) {
diff --git a/test/CodeGenCXX/rtti.cpp b/test/CodeGenCXX/rtti.cpp
index 49dcbe3..76f571e 100644
--- a/test/CodeGenCXX/rtti.cpp
+++ b/test/CodeGenCXX/rtti.cpp
@@ -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();
}