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 | ff3a078d2a67db9ae6ff4cc0f799a209f85a4e91 (patch) | |
tree | 76015f35050cfa68dc7f1329bfce561b690e82db /lib/Sema/SemaDeclAttr.cpp | |
parent | 3e9438b5251a547253d64169863c2909b9b2772a (diff) |
Patch to support transparent_union arguments
passed to nonnull attributed functions. Implements radar
6857843.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114917 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDeclAttr.cpp')
-rw-r--r-- | lib/Sema/SemaDeclAttr.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp index 09feb50bd3..682a430ee4 100644 --- a/lib/Sema/SemaDeclAttr.cpp +++ b/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 |