Eugene.Zelenko added inline comments.

================
Comment at: clang-tools-extra/clang-tidy/misc/InitLocalVariablesCheck.cpp:8
+//===----------------------------------------------------------------------===//
+#include "InitLocalVariablesCheck.h"
+#include "clang/AST/ASTContext.h"
----------------
Please separate header from include files with empty line.


================
Comment at: clang-tools-extra/clang-tidy/misc/InitLocalVariablesCheck.cpp:31
+
+  auto varName = MatchedDecl->getName();
+  if(varName.empty() || varName.front() == '_') {
----------------
Please don't use auto when type could not be deduced from same statement.


================
Comment at: clang-tools-extra/clang-tidy/misc/InitLocalVariablesCheck.cpp:41
+  if(typePtr->isIntegerType()) {
+    replacement = "=0";
+  } else if(typePtr->isFloatingType()) {
----------------
lebedev.ri wrote:
> should be `var = <init>;`
May be spaces should be created around =? Same in other places.


================
Comment at: clang-tools-extra/clang-tidy/misc/InitLocalVariablesCheck.cpp:56
+    diag(MatchedDecl->getLocation(), "insert initial value", 
DiagnosticIDs::Note)
+      << 
FixItHint::CreateInsertion(MatchedDecl->getLocation().getLocWithOffset(varName.size()),
 replacement);
+  }
----------------
Please run Clang-format.


================
Comment at: clang-tools-extra/clang-tidy/misc/InitLocalVariablesCheck.h:28
+  void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
+
+};
----------------
Unnecessary empty line.


================
Comment at: 
clang-tools-extra/docs/clang-tidy/checks/misc-init-local-variables.rst:6
+
+Finds local variables that are declared without an initial
+value. These may lead to unexpected behaviour if there is a code path
----------------
Please synchronize first statement with description in Release Notes.


================
Comment at: 
clang-tools-extra/docs/clang-tidy/checks/misc-init-local-variables.rst:31
+   void function() {
+     int x=0;
+     char *txt=nullptr;
----------------
Spaces around =. Same in other places.


Repository:
  rCTE Clang Tools Extra

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

https://reviews.llvm.org/D64671



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

Reply via email to