Internal Jenkins has submitted this change and it was merged. Change subject: IMPALA-3676: Use clang as a static analysis tool ......................................................................
IMPALA-3676: Use clang as a static analysis tool This patch adds a script to run clang-tidy over the whole code base. It is a first step towards running clang-tidy over patches as a tool to help users spot bugs before code review. Because of the number of clang-tidy checks, this patch only addresses some of them. In particular, only checks starting with 'clang' are considered. Many of them which are flaky or not part of our style are excluded from the analysis. This patch also exlcudes some checks which are part of our current style but which would be too laborious to fix over the entire codebase, like using nullptr rather than NULL. This patch also fixes a number of small bugs found by clang-tidy. Finally, this patch adds the class AlignedNew, the purpose of which is to provide correct alignment on heap-allocated data. The global new operator only guarantees 16-byte alignment. A class that includes a member variable that must be aligned on a k-byte boundary for k>16 can inherit from AlignedNew<k> to ensure correct alignment on the heap, quieting clang's -Wover-aligned warning. (Static and stack allocation are required by the standard to respect the alignment of the type and its member variables, so no extra code is needed for allocation in those places.) Change-Id: I4ed168488cb30ddeccd0087f3840541d858f9c06 Reviewed-on: http://gerrit.cloudera.org:8080/4758 Reviewed-by: Jim Apple <[email protected]> Tested-by: Internal Jenkins --- A .clang-tidy M CMakeLists.txt M be/CMakeLists.txt M be/src/benchmarks/bloom-filter-benchmark.cc M be/src/benchmarks/in-predicate-benchmark.cc M be/src/benchmarks/parse-timestamp-benchmark.cc M be/src/catalog/catalog-server.cc M be/src/catalog/catalog-server.h M be/src/codegen/codegen-anyval.cc M be/src/codegen/impala-ir.cc M be/src/codegen/llvm-codegen.cc M be/src/common/compiler-util.h M be/src/common/init.cc M be/src/common/logging.h M be/src/common/status.h M be/src/exec/delimited-text-parser.cc M be/src/exec/delimited-text-parser.h M be/src/exec/exec-node.h M be/src/exec/external-data-source-executor.h M be/src/exec/hash-table-test.cc M be/src/exec/hbase-scan-node.h M be/src/exec/hdfs-avro-scanner.cc M be/src/exec/hdfs-parquet-scanner.h M be/src/exec/hdfs-scan-node.cc M be/src/exec/hdfs-scan-node.h M be/src/exec/hdfs-table-writer.h M be/src/exec/parquet-column-readers.h M be/src/exec/partitioned-hash-join-builder-ir.cc M be/src/exec/partitioned-hash-join-builder.cc M be/src/exec/scanner-context.inline.h M be/src/exec/write-stream.h M be/src/experiments/bit-stream-utils.8byte.inline.h M be/src/experiments/tuple-splitter-test.cc M be/src/exprs/aggregate-functions-ir.cc M be/src/exprs/aggregate-functions.h M be/src/exprs/compound-predicates.h M be/src/exprs/expr-test.cc M be/src/exprs/slot-ref.cc M be/src/exprs/string-functions-ir.cc M be/src/rpc/TAcceptQueueServer.h M be/src/rpc/authentication.cc M be/src/rpc/authentication.h M be/src/rpc/thrift-server.h M be/src/runtime/buffered-block-mgr.h M be/src/runtime/buffered-tuple-stream.cc M be/src/runtime/buffered-tuple-stream.h M be/src/runtime/coordinator.cc M be/src/runtime/coordinator.h M be/src/runtime/data-stream-sender.cc M be/src/runtime/data-stream-sender.h M be/src/runtime/descriptors.cc M be/src/runtime/descriptors.h M be/src/runtime/exec-env.h M be/src/runtime/free-pool-test.cc M be/src/runtime/hbase-table.cc M be/src/runtime/hdfs-fs-cache.h M be/src/runtime/multi-precision-test.cc M be/src/runtime/runtime-filter-bank.h M be/src/runtime/runtime-filter.h M be/src/runtime/scoped-buffer.h M be/src/runtime/string-buffer.h M be/src/runtime/timestamp-parse-util.cc M be/src/runtime/timestamp-value.cc M be/src/runtime/tmp-file-mgr.cc M be/src/runtime/tmp-file-mgr.h M be/src/scheduling/simple-scheduler-test.cc M be/src/service/fe-support.cc M be/src/service/impala-beeswax-server.cc M be/src/service/impala-server.cc M be/src/service/impala-server.h M be/src/service/query-exec-state.h M be/src/service/query-result-set.cc M be/src/statestore/failure-detector.h M be/src/statestore/statestore-subscriber.h M be/src/statestore/statestore.cc M be/src/statestore/statestore.h M be/src/testutil/test-udas.cc M be/src/testutil/test-udas.h M be/src/transport/TSasl.h M be/src/transport/TSaslClientTransport.h M be/src/transport/TSaslServerTransport.h M be/src/transport/TSaslTransport.h M be/src/udf/uda-test-harness.h M be/src/udf/uda-test.cc M be/src/udf/udf-ir.cc M be/src/udf/udf.cc M be/src/udf/udf.h M be/src/udf_samples/uda-sample.cc A be/src/util/aligned-new.h M be/src/util/benchmark-test.cc M be/src/util/bit-stream-utils.inline.h M be/src/util/bit-util-test.cc M be/src/util/blocking-queue-test.cc M be/src/util/blocking-queue.h M be/src/util/bloom-filter-test.cc M be/src/util/buffer-builder.h M be/src/util/compress.cc M be/src/util/decompress.cc M be/src/util/metrics.h M be/src/util/minidump.cc M be/src/util/network-util.cc M be/src/util/parquet-reader.cc M be/src/util/periodic-counter-updater.h M be/src/util/pprof-path-handlers.cc M be/src/util/progress-updater.cc M be/src/util/rle-test.cc M be/src/util/runtime-profile.h M be/src/util/thread-pool.h M be/src/util/webserver.cc M bin/make_impala.sh A bin/run_clang_tidy.sh M buildall.sh R cmake_modules/clang_toolchain.cmake M fe/src/main/java/org/apache/impala/catalog/BuiltinsDb.java 114 files changed, 565 insertions(+), 323 deletions(-) Approvals: Jim Apple: Looks good to me, approved Internal Jenkins: Verified -- To view, visit http://gerrit.cloudera.org:8080/4758 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-MessageType: merged Gerrit-Change-Id: I4ed168488cb30ddeccd0087f3840541d858f9c06 Gerrit-PatchSet: 13 Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-Owner: Jim Apple <[email protected]> Gerrit-Reviewer: Dan Hecht <[email protected]> Gerrit-Reviewer: Henry Robinson <[email protected]> Gerrit-Reviewer: Internal Jenkins Gerrit-Reviewer: Jim Apple <[email protected]> Gerrit-Reviewer: Tim Armstrong <[email protected]>
