summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGExprCXX.cpp
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2014-07-18 19:53:25 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2014-07-18 19:53:25 +0000
commit5dd5ea422ac51b81b1b05d6d969f723caafb6501 (patch)
tree424fcae191050885457e720426428966e0bbbd93 /clang/lib/CodeGen/CGExprCXX.cpp
parente04c470afa508e15dcddacb45393dc6d2cbf4cdd (diff)
downloadbcm5719-llvm-5dd5ea422ac51b81b1b05d6d969f723caafb6501.tar.gz
bcm5719-llvm-5dd5ea422ac51b81b1b05d6d969f723caafb6501.zip
Address Richard's latest feedback.
llvm-svn: 213404
Diffstat (limited to 'clang/lib/CodeGen/CGExprCXX.cpp')
-rw-r--r--clang/lib/CodeGen/CGExprCXX.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/clang/lib/CodeGen/CGExprCXX.cpp b/clang/lib/CodeGen/CGExprCXX.cpp
index 768fab726b0..5c4e1f1266d 100644
--- a/clang/lib/CodeGen/CGExprCXX.cpp
+++ b/clang/lib/CodeGen/CGExprCXX.cpp
@@ -1628,14 +1628,9 @@ static bool isGLValueFromPointerDeref(const Expr *E) {
if (BO->getOpcode() == BO_Comma)
return isGLValueFromPointerDeref(BO->getRHS());
- if (const auto *CO = dyn_cast<ConditionalOperator>(E))
- return isGLValueFromPointerDeref(CO->getTrueExpr()) ||
- isGLValueFromPointerDeref(CO->getFalseExpr());
-
- if (const auto *BCO = dyn_cast<BinaryConditionalOperator>(E))
- if (const auto *OVE = dyn_cast<OpaqueValueExpr>(BCO->getTrueExpr()))
- return isGLValueFromPointerDeref(OVE->getSourceExpr()) ||
- isGLValueFromPointerDeref(BCO->getFalseExpr());
+ if (const auto *ACO = dyn_cast<AbstractConditionalOperator>(E))
+ return isGLValueFromPointerDeref(ACO->getTrueExpr()) ||
+ isGLValueFromPointerDeref(ACO->getFalseExpr());
// C++11 [expr.sub]p1:
// The expression E1[E2] is identical (by definition) to *((E1)+(E2))
@@ -1658,6 +1653,10 @@ static llvm::Value *EmitTypeidFromVTable(CodeGenFunction &CGF, const Expr *E,
// If the glvalue expression is obtained by applying the unary * operator to
// a pointer and the pointer is a null pointer value, the typeid expression
// throws the std::bad_typeid exception.
+ //
+ // However, this paragraph's intent is not clear. We choose a very generous
+ // interpretation which implores us to consider comma operators, conditional
+ // operators, parentheses and other such constructs.
QualType SrcRecordTy = E->getType();
if (CGF.CGM.getCXXABI().shouldTypeidBeNullChecked(
isGLValueFromPointerDeref(E), SrcRecordTy)) {
OpenPOWER on IntegriCloud