Teach -Wuninitialized-experimental about sizeof().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124076 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/UninitializedValuesV2.cpp b/lib/Analysis/UninitializedValuesV2.cpp
index dfaff31..4c54885 100644
--- a/lib/Analysis/UninitializedValuesV2.cpp
+++ b/lib/Analysis/UninitializedValuesV2.cpp
@@ -302,6 +302,7 @@
void VisitUnaryOperator(UnaryOperator *uo);
void VisitBinaryOperator(BinaryOperator *bo);
void VisitCastExpr(CastExpr *ce);
+ void VisitSizeOfAlignOfExpr(SizeOfAlignOfExpr *se);
};
}
@@ -435,6 +436,15 @@
Visit(ce->getSubExpr());
}
+void TransferFunctions::VisitSizeOfAlignOfExpr(SizeOfAlignOfExpr *se) {
+ if (se->isSizeOf()) {
+ if (se->getType()->isConstantSizeType())
+ return;
+ // Handle VLAs.
+ Visit(se->getArgumentExpr());
+ }
+}
+
//------------------------------------------------------------------------====//
// High-level "driver" logic for uninitialized values analysis.
//====------------------------------------------------------------------------//