[PATCH] D23409: Make clang-tidy work with clang-cl

Alexander Kornienko via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 12 10:16:30 PDT 2016


alexfh added a comment.

The changes in Driver LGTM (though I'd prefer someone who knows Driver to look).

Could you move lib/Tooling/JSONCompilationDatabase.cpp to a separate patch? It seems like an orthogonal change.

As for a clang-cl-mode test for clang-tidy, clang-tidy-run-with-database.cpp is only tangentially related. We probably need two tests: one with a JSON compilation database and the other with a fixed compilation database (passing compiler arguments after `--`). In both cases I'd use flags like `/D` to verify correct parsing of the command line. Something along the lines of:

  // RUN: clang-tidy -checks=-*,modernize-use-nullptr %s -- clang-cl /DTEST1 /DFOO=foo /DBAR#bar | FileCheck -implicit-check-not="{{warning|error}}:" %s
  int *a = 0;
  // CHECK: :[[@LINE-1]]:10: warning: use nullptr
  #ifdef TEST1
  int *b = 0;
  // CHECK: :[[@LINE-1]]:10: warning: use nullptr
  #endif
  #define foo 1
  #define bar 1
  #if FOO
  int *c = 0;
  // CHECK: :[[@LINE-1]]:10: warning: use nullptr
  #endif
  #if BAR
  int *d = 0;
  // CHECK: :[[@LINE-1]]:10: warning: use nullptr
  #endif

Maybe some other aspects of clang-cl mode options parsing can be tested this way as well.


https://reviews.llvm.org/D23409





More information about the cfe-commits mailing list