================
@@ -601,10 +591,25 @@ ExceptionAnalyzer::throwsException(const Stmt *St,
       Results.merge(Excs);
     }
   } else {
+    // Check whether any of this node's subexpressions throws.
     for (const Stmt *Child : St->children()) {
       ExceptionInfo Excs = throwsException(Child, Caught, CallStack);
       Results.merge(Excs);
     }
+
+    // If this node is a call to a function or constructor, also check
+    // whether the call itself throws.
+    if (const auto *Call = dyn_cast<CallExpr>(St)) {
+      if (const FunctionDecl *Func = Call->getDirectCallee()) {
+        ExceptionInfo Excs =
+            throwsException(Func, Caught, CallStack, Call->getBeginLoc());
+        Results.merge(Excs);
+      }
+    } else if (const auto *Construct = dyn_cast<CXXConstructExpr>(St)) {
----------------
localspook wrote:

Hmm, I guess I'm just not really bothered by this nesting in the `else` branch, 
so I don't see the benefit, and at the same time I see some downsides: this 
would introduce a bit of duplication (3 repetitions of the 
`Results.merge(CheckChildren(St));` line), and I think having to jump to 
another function would make the code harder to understand in this case. I can 
understand where you're coming from though, so if you find that unconvincing, 
I'm happy to change it.

https://github.com/llvm/llvm-project/pull/165955
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to