[PATCH] D50824: [CFG] [analyzer] pr37769: Disable argument construction contexts for variadic functions.
Phabricator via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 29 14:51:50 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL340975: [CFG] [analyzer] Disable argument construction contexts for variadic functions. (authored by dergachev, committed by ).
Herald added a subscriber: llvm-commits.
Changed prior to commit:
https://reviews.llvm.org/D50824?vs=160946&id=163200#toc
Repository:
rL LLVM
https://reviews.llvm.org/D50824
Files:
cfe/trunk/lib/Analysis/CFG.cpp
cfe/trunk/test/Analysis/cfg-rich-constructors.cpp
Index: cfe/trunk/test/Analysis/cfg-rich-constructors.cpp
===================================================================
--- cfe/trunk/test/Analysis/cfg-rich-constructors.cpp
+++ cfe/trunk/test/Analysis/cfg-rich-constructors.cpp
@@ -1028,3 +1028,18 @@
C(1) + C(2);
}
} // namespace operators
+
+namespace variadic_function_arguments {
+class C {
+ public:
+ C(int);
+};
+
+int variadic(...);
+
+// This code is quite exotic, so let's not test the CFG for it,
+// but only make sure we don't crash.
+void testCrashOnVariadicArgument() {
+ C c(variadic(0 ? c : 0)); // no-crash
+}
+} // namespace variadic_function_arguments
Index: cfe/trunk/lib/Analysis/CFG.cpp
===================================================================
--- cfe/trunk/lib/Analysis/CFG.cpp
+++ cfe/trunk/lib/Analysis/CFG.cpp
@@ -2421,8 +2421,6 @@
if (!boundType.isNull()) calleeType = boundType;
}
- findConstructionContextsForArguments(C);
-
// If this is a call to a no-return function, this stops the block here.
bool NoReturn = getFunctionExtInfo(*calleeType).getNoReturn();
@@ -2439,6 +2437,13 @@
bool OmitArguments = false;
if (FunctionDecl *FD = C->getDirectCallee()) {
+ // TODO: Support construction contexts for variadic function arguments.
+ // These are a bit problematic and not very useful because passing
+ // C++ objects as C-style variadic arguments doesn't work in general
+ // (see [expr.call]).
+ if (!FD->isVariadic())
+ findConstructionContextsForArguments(C);
+
if (FD->isNoReturn() || C->isBuiltinAssumeFalse(*Context))
NoReturn = true;
if (FD->hasAttr<NoThrowAttr>())
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50824.163200.patch
Type: text/x-patch
Size: 1642 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180829/908bf1c8/attachment.bin>
More information about the cfe-commits
mailing list