diff options
| author | Fariborz Jahanian <fjahanian@apple.com> | 2010-09-27 22:42:37 +0000 |
|---|---|---|
| committer | Fariborz Jahanian <fjahanian@apple.com> | 2010-09-27 22:42:37 +0000 |
| commit | 3567c426c4f3a79a41ab976afb16c5c5848f7dcd (patch) | |
| tree | 524501dbadbea46b06d94d44ab338db38f7ca669 /clang/lib/AST/Expr.cpp | |
| parent | ec3bec0c7abd07bb9b372008e6870c44b1f5b318 (diff) | |
| download | bcm5719-llvm-3567c426c4f3a79a41ab976afb16c5c5848f7dcd.tar.gz bcm5719-llvm-3567c426c4f3a79a41ab976afb16c5c5848f7dcd.zip | |
Patch to support transparent_union arguments
passed to nonnull attributed functions. Implements radar
6857843.
llvm-svn: 114917
Diffstat (limited to 'clang/lib/AST/Expr.cpp')
| -rw-r--r-- | clang/lib/AST/Expr.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp index 9536b9bf245..708512ce461 100644 --- a/clang/lib/AST/Expr.cpp +++ b/clang/lib/AST/Expr.cpp @@ -1862,6 +1862,13 @@ bool Expr::isNullPointerConstant(ASTContext &Ctx, if (getType()->isNullPtrType()) return true; + if (const RecordType *UT = getType()->getAsUnionType()) + if (UT && UT->getDecl()->hasAttr<TransparentUnionAttr>()) + if (const CompoundLiteralExpr *CLE = dyn_cast<CompoundLiteralExpr>(this)){ + const Expr *InitExpr = CLE->getInitializer(); + if (const InitListExpr *ILE = dyn_cast<InitListExpr>(InitExpr)) + return ILE->getInit(0)->isNullPointerConstant(Ctx, NPC); + } // This expression must be an integer type. if (!getType()->isIntegerType() || (Ctx.getLangOptions().CPlusPlus && getType()->isEnumeralType())) |

