[PATCH] D57883: [clang-tidy] refactor ExceptionAnalyzer further to give ternary answer

Jonas Toth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 20 11:34:37 PST 2019


JonasToth marked 3 inline comments as done.
JonasToth added a comment.

all comments resolved. I will land this now.



================
Comment at: clang-tidy/utils/ExceptionAnalyzer.h:26-31
+  enum class State : std::int8_t {
+    Throwing,    ///< The function can definitly throw given an AST.
+    NotThrowing, ///< This function can not throw, given an AST.
+    Unknown,     ///< This can happen for extern functions without available
+                 ///< definition.
+  };
----------------
lebedev.ri wrote:
> Since this is later used in a bit field, it might be better to be explicit 
> ```
>   enum class State : std::int8_t {
>     Throwing = 0,    ///< The function can definitly throw given an AST.
>     NotThrowing = 1, ///< This function can not throw, given an AST.
>     Unknown = 2,     ///< This can happen for extern functions without available
>                  ///< definition.
>   };
> ```
> and indeed, only 2 bits needed.
Done.


================
Comment at: clang-tidy/utils/ExceptionAnalyzer.h:128
+    /// throw, if it's unknown or if it won't throw.
+    enum State Behaviour : 4;
+
----------------
baloghadamsoftware wrote:
> Why 4 bits, not just 2? Can we expect additional states?
True, math not so strong in me :D


Repository:
  rCTE Clang Tools Extra

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

https://reviews.llvm.org/D57883





More information about the cfe-commits mailing list