aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaDeclCXX.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2010-09-21 10:47:20 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2010-09-21 10:47:20 +0000
commitff8819be64c53d71dcc0200ece9b2738041c80e2 (patch)
tree06b2a1f19a8b2cdf3da026575161d3ab9b21d751 /lib/Sema/SemaDeclCXX.cpp
parent1cff132e48e0ccc253c34e5a2fb12718bd4e7d2e (diff)
Do not warn with -Wuninitialized when the member is used in a sizeof or address-of expression.
Fixes rdar://8331312. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114426 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDeclCXX.cpp')
-rw-r--r--lib/Sema/SemaDeclCXX.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp
index 4efb62a9d4..00f71a2bd4 100644
--- a/lib/Sema/SemaDeclCXX.cpp
+++ b/lib/Sema/SemaDeclCXX.cpp
@@ -1246,6 +1246,14 @@ static bool InitExprContainsUninitializedFields(const Stmt *S,
*L = ME->getMemberLoc();
return true;
}
+ } else if (isa<SizeOfAlignOfExpr>(S)) {
+ // sizeof/alignof doesn't reference contents, do not warn.
+ return false;
+ } else if (const UnaryOperator *UOE = dyn_cast<UnaryOperator>(S)) {
+ // address-of doesn't reference contents (the pointer may be dereferenced
+ // in the same expression but it would be rare; and weird).
+ if (UOE->getOpcode() == UO_AddrOf)
+ return false;
}
for (Stmt::const_child_iterator it = S->child_begin(), e = S->child_end();
it != e; ++it) {