steakhal added a comment.

Speaking of the `StaticAnalyzer`, I think setting some default value is a fair 
point, and I think it's a good practice.
In our case, we initialized that field from the registration function, like 
this:

  void ento::registerMoveChecker(CheckerManager &mgr) {
    MoveChecker *chk = mgr.registerChecker<MoveChecker>();
    chk->setAggressiveness(
        mgr.getAnalyzerOptions().getCheckerStringOption(chk, "WarnOn"), mgr); 
// <--- initialized here
  }



================
Comment at: clang/lib/StaticAnalyzer/Checkers/MoveChecker.cpp:187
 
-  AggressivenessKind Aggressiveness;
+  AggressivenessKind Aggressiveness = AK_Invalid;
 
----------------
By looking at the default value of the `Move.WarnOn` checker option [[ 
https://github.com/llvm/llvm-project/blob/main/clang/include/clang/StaticAnalyzer/Checkers/Checkers.td#L668
 | here ]], we should probably initialize this field to the default value 
matching the default value of the config.


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

https://reviews.llvm.org/D150744

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

Reply via email to