[PATCH] D38844: [analyzer] Make issue hash related tests more concise

Gábor Horváth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 31 03:29:40 PDT 2017


xazax.hun added inline comments.


================
Comment at: lib/StaticAnalyzer/Checkers/ExprInspectionChecker.cpp:68
   // (globals should not be invalidated, etc), hence the use of evalCall.
-  FnCheck Handler = llvm::StringSwitch<FnCheck>(C.getCalleeName(CE))
-    .Case("clang_analyzer_eval", &ExprInspectionChecker::analyzerEval)
-    .Case("clang_analyzer_checkInlined",
-          &ExprInspectionChecker::analyzerCheckInlined)
-    .Case("clang_analyzer_crash", &ExprInspectionChecker::analyzerCrash)
-    .Case("clang_analyzer_warnIfReached",
-          &ExprInspectionChecker::analyzerWarnIfReached)
-    .Case("clang_analyzer_warnOnDeadSymbol",
-          &ExprInspectionChecker::analyzerWarnOnDeadSymbol)
-    .StartsWith("clang_analyzer_explain", &ExprInspectionChecker::analyzerExplain)
-    .StartsWith("clang_analyzer_dump", &ExprInspectionChecker::analyzerDump)
-    .Case("clang_analyzer_getExtent", &ExprInspectionChecker::analyzerGetExtent)
-    .Case("clang_analyzer_printState",
-          &ExprInspectionChecker::analyzerPrintState)
-    .Case("clang_analyzer_numTimesReached",
-          &ExprInspectionChecker::analyzerNumTimesReached)
-    .Default(nullptr);
+  FnCheck Handler =
+      llvm::StringSwitch<FnCheck>(C.getCalleeName(CE))
----------------
zaks.anna wrote:
> xazax.hun wrote:
> > zaks.anna wrote:
> > > Unrelated change?
> > Since I touched this snippet I reformatted it using clang-format. Apart from adding a new case before the default all other changes are formatting changes. I will revert the formatting changes. So in general, we prefer to minimize the diffs over converging to be clang-formatted?
> It's much easier to review when the diff does not contain formatting changes intermixed with functional changes. Looks like you can configure clang-format to only format the diff.
I see. Unfortunately, formatting only the diff is not always a solution. The clang-format tool cannot format arbitrary source regions, it will extend the formatted region to certain units of the language, in this case to the whole variable definition which spans across multiple lines. Fortunately, it wasn't a big deal to do formatting by hand in this case. 


Repository:
  rL LLVM

https://reviews.llvm.org/D38844





More information about the cfe-commits mailing list