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/Sema/SemaDeclAttr.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/Sema/SemaDeclAttr.cpp')
| -rw-r--r-- | clang/lib/Sema/SemaDeclAttr.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp index 09feb50bd30..682a430ee40 100644 --- a/clang/lib/Sema/SemaDeclAttr.cpp +++ b/clang/lib/Sema/SemaDeclAttr.cpp @@ -371,6 +371,19 @@ static void HandleNonNullAttr(Decl *d, const AttributeList &Attr, Sema &S) { QualType T = getFunctionOrMethodArgType(d, I); if (T->isAnyPointerType() || T->isBlockPointerType()) NonNullArgs.push_back(I); + else if (const RecordType *UT = T->getAsUnionType()) { + if (UT && UT->getDecl()->hasAttr<TransparentUnionAttr>()) { + RecordDecl *UD = UT->getDecl(); + for (RecordDecl::field_iterator it = UD->field_begin(), + itend = UD->field_end(); it != itend; ++it) { + T = it->getType(); + if (T->isAnyPointerType() || T->isBlockPointerType()) { + NonNullArgs.push_back(I); + break; + } + } + } + } } // No pointer arguments? The attribute in this case is |

