[PATCH] D66565: [analyzer] pr43036: Fix support for operator `sizeof...'.
Phabricator via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 28 11:45:09 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL370245: [analyzer] pr43036: Fix support for operator 'sizeof...'. (authored by dergachev, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Changed prior to commit:
https://reviews.llvm.org/D66565?vs=216517&id=217697#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D66565/new/
https://reviews.llvm.org/D66565
Files:
cfe/trunk/lib/StaticAnalyzer/Core/Environment.cpp
cfe/trunk/test/Analysis/sizeofpack.cpp
Index: cfe/trunk/test/Analysis/sizeofpack.cpp
===================================================================
--- cfe/trunk/test/Analysis/sizeofpack.cpp
+++ cfe/trunk/test/Analysis/sizeofpack.cpp
@@ -0,0 +1,15 @@
+// RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.ExprInspection \
+// RUN: -verify %s
+
+typedef __typeof(sizeof(int)) size_t;
+
+void clang_analyzer_eval(bool);
+
+template <int... N> size_t foo() {
+ return sizeof...(N);
+}
+
+void bar() {
+ clang_analyzer_eval(foo<>() == 0); // expected-warning{{TRUE}}
+ clang_analyzer_eval(foo<1, 2, 3>() == 3); // expected-warning{{TRUE}}
+}
Index: cfe/trunk/lib/StaticAnalyzer/Core/Environment.cpp
===================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/Environment.cpp
+++ cfe/trunk/lib/StaticAnalyzer/Core/Environment.cpp
@@ -108,6 +108,7 @@
case Stmt::ObjCStringLiteralClass:
case Stmt::StringLiteralClass:
case Stmt::TypeTraitExprClass:
+ case Stmt::SizeOfPackExprClass:
// Known constants; defer to SValBuilder.
return svalBuilder.getConstantVal(cast<Expr>(S)).getValue();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66565.217697.patch
Type: text/x-patch
Size: 1138 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190828/69ed6bfd/attachment-0001.bin>
More information about the cfe-commits
mailing list