isuckatcs added inline comments.

================
Comment at: clang-tools-extra/clang-tidy/utils/ExceptionAnalyzer.cpp:319
 
+static bool cannotThrow(const FunctionDecl *Func) {
+  const auto *FunProto = Func->getType()->getAs<FunctionProtoType>();
----------------
Put this in the anonymous namespace above please to remain consistent.


================
Comment at: clang-tools-extra/clang-tidy/utils/ExceptionAnalyzer.cpp:446
+  if (!Func || CallStack.count(Func) ||
+      (!CallStack.empty() && cannotThrow(Func)))
     return ExceptionInfo::createNonThrowing();
----------------
Is `cannotThrow(Func)` really needed here? Isn't it possible to bail out after 
the body of the function has been analyzed? 

I understand that you want to prevent some recursive calls and bail out early, 
but I don't think that it worths adding some additional logic, which is not 
needed anyway. 

If you really want to optimize this or you're worried about stack overflows, 
consider rewriting the recursive solution to an iterative one.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D153458/new/

https://reviews.llvm.org/D153458

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to