[PATCH] [clang-tidy] Add a checker that suggests replacing short/long/long long with fixed-size types.

Samuel Benzaquen sbenza at google.com
Fri Aug 29 08:43:30 PDT 2014


REPOSITORY
  rL LLVM

================
Comment at: clang-tools-extra/trunk/clang-tidy/google/GoogleTidyModule.cpp:45
@@ -43,1 +44,3 @@
     CheckFactories.addCheckFactory(
+        "google-runtime-int",
+        new ClangTidyCheckFactory<runtime::IntegerTypesCheck>());
----------------
The name should be more explicit.

================
Comment at: clang-tools-extra/trunk/clang-tidy/google/IntegerTypesCheck.cpp:20
@@ +19,3 @@
+namespace ast_matchers {
+const internal::VariadicDynCastAllOfMatcher<Decl, TypedefDecl> typedefDecl;
+} // namespace ast_matchers
----------------
Move this to ASTMatchers.h

================
Comment at: clang-tools-extra/trunk/test/clang-tidy/google-runtime-int.cpp:4
@@ +3,3 @@
+long a();
+// CHECK: [[@LINE-1]]:1: warning: consider replacing 'long' with 'int64'
+
----------------
This will fail on some platforms, right? "long" is not 64 bits everywhere (which is the point of this clang-tidy check).

http://reviews.llvm.org/D5119






More information about the cfe-commits mailing list