[PATCH] D33537: [clang-tidy] Exception Escape Checker

Alexander Kornienko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 23 07:34:04 PDT 2018


alexfh requested changes to this revision.
alexfh added inline comments.
This revision now requires changes to proceed.


================
Comment at: clang-tidy/bugprone/ExceptionEscapeCheck.cpp:24-25
+
+const TypeVec _throws(const FunctionDecl *Func);
+const TypeVec _throws(const Stmt *St, const TypeVec &Caught);
+} // namespace
----------------
Function names should follow llvm conventions http://llvm.org/docs/CodingStandards.html#name-types-functions-variables-and-enumerators-properly


================
Comment at: clang-tidy/bugprone/ExceptionEscapeCheck.cpp:24-25
+
+const TypeVec _throws(const FunctionDecl *Func);
+const TypeVec _throws(const Stmt *St, const TypeVec &Caught);
+} // namespace
----------------
alexfh wrote:
> Function names should follow llvm conventions http://llvm.org/docs/CodingStandards.html#name-types-functions-variables-and-enumerators-properly
If there's no need to pass nullptr to these functions, the arguments can be const references.


================
Comment at: clang-tidy/bugprone/ExceptionEscapeCheck.cpp:115
+    return Result;
+  } else {
+    TypeVec Result;
----------------
No `else` after `return`.


================
Comment at: clang-tidy/bugprone/ExceptionEscapeCheck.cpp:142
+      if (const auto *TD = ThrownType->getAsTagDecl()) {
+        if (TD->getNameAsString() == "bad_alloc")
+          return Results;
----------------
Don't use getNameAsString when not necessary. `if (TD->getDeclName().isIdentifier() && TD->getName() == "bad_alloc")` will work as good, but without unnecessary string copies.


https://reviews.llvm.org/D33537





More information about the cfe-commits mailing list