Switch to run-clang-tidy for parallelism (#629)

Not sure why this affects include ordering, but it makes execution a _lot_ faster.
This commit is contained in:
Jon Meow
2021-07-16 10:48:20 -07:00
committed by GitHub
parent e932b7dcc3
commit c94ff74ea2
14 changed files with 44 additions and 24 deletions
+1 -1
View File
@@ -79,7 +79,7 @@ class _Workflow(object):
with open(self._data_file("clang_tidy.yaml")) as f:
config = f.read()
subprocess.run(
["clang-tidy", "--fix", "--config", config] + self._cpp_files,
["run-clang-tidy.py", "-fix", "-config", config],
check=True,
)
@@ -9,10 +9,11 @@
#ifndef WOFF2_WOFF2_DEC_H_
#define WOFF2_WOFF2_DEC_H_
#include <cstddef>
#include <cinttypes>
#include <woff2/output.h>
#include <cinttypes>
#include <cstddef>
namespace woff2 {
// Compute the size of the final uncompressed font, or 0 on error.
@@ -9,8 +9,8 @@
#ifndef WOFF2_WOFF2_ENC_H_
#define WOFF2_WOFF2_ENC_H_
#include <cstddef>
#include <cinttypes>
#include <cstddef>
#include <string>
namespace woff2 {
+1
View File
@@ -26,6 +26,7 @@ typedef unsigned __int64 uint64_t;
#define htons(x) _byteswap_ushort (x)
#else
#include <arpa/inet.h>
#include <cstdint>
#endif
@@ -1,8 +1,8 @@
#include <woff2/decode.h>
#include <cstddef>
#include <cstdint>
#include <woff2/decode.h>
// Entry point for LibFuzzer.
extern "C" fn LLVMFuzzerTestOneInput(data: const uint8_t*, size: size_t) -> int {
var buf: std::string;
+1 -1
View File
@@ -10,8 +10,8 @@
#ifndef WOFF2_FONT_H_
#define WOFF2_FONT_H_
#include <cstddef>
#include <cinttypes>
#include <cstddef>
#include <map>
#include <vector>
+1 -1
View File
@@ -10,8 +10,8 @@
#ifndef WOFF2_GLYPH_H_
#define WOFF2_GLYPH_H_
#include <cstddef>
#include <cinttypes>
#include <cstddef>
#include <vector>
namespace woff2 {
@@ -10,6 +10,7 @@
#include <cstdlib>
#include <limits>
#include "./buffer.h"
#include "./store_bytes.h"
@@ -12,9 +12,9 @@
#include <cstddef>
#include "./buffer.h"
#include "./port.h"
#include "./font.h"
#include "./glyph.h"
#include "./port.h"
#include "./round.h"
#include "./store_bytes.h"
#include "./table_tags.h"
@@ -11,6 +11,7 @@
#include <cinttypes>
#include <vector>
#include "./buffer.h"
namespace woff2 {
+1 -2
View File
@@ -9,9 +9,8 @@
#ifndef WOFF2_WOFF2_COMMON_H_
#define WOFF2_WOFF2_COMMON_H_
#include <cstddef>
#include <cinttypes>
#include <cstddef>
#include <string>
namespace woff2 {
@@ -6,21 +6,20 @@
/* Library for converting WOFF2 format font files to their TTF versions. */
#include <brotli/decode.h>
#include <woff2/decode.h>
#include <cstdlib>
#include <algorithm>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <limits>
#include <memory>
#include <string>
#include <vector>
#include <map>
#include <memory>
#include <string>
#include <utility>
#include <vector>
#include <brotli/decode.h>
#include "./buffer.h"
#include "./port.h"
#include "./round.h"
@@ -6,16 +6,16 @@
/* Library for converting TTF format font files to their WOFF2 versions. */
#include <brotli/encode.h>
#include <woff2/encode.h>
#include <cstdlib>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <limits>
#include <string>
#include <vector>
#include <brotli/encode.h>
#include "./buffer.h"
#include "./font.h"
#include "./normalize.h"
+24 -6
View File
@@ -9,7 +9,7 @@
# cd to the carbon-lang root.
cd "$(dirname "$0")/../../.."
EXAMPLE=third_party/examples/woff2
EXAMPLE="${PWD}/third_party/examples/woff2"
# Remove any previous conversion. Each time this is run, it should demonstrate
# on a fresh copy of woff2.
@@ -26,18 +26,36 @@ cp "${EXAMPLE}/BUILD.original" \
"${EXAMPLE}/carbon/BUILD"
cp "${EXAMPLE}/WORKSPACE.original" \
"${EXAMPLE}/carbon/WORKSPACE"
cp "${EXAMPLE}/compile_flags.carbon.txt" \
"${EXAMPLE}/carbon/compile_flags.txt"
# Kludge for adding LLVM include paths into the compile flags.
# TODO: Find better solution.
COMPILE_FLAGS=($(cat "${EXAMPLE}/compile_flags.carbon.txt" | sed 's/"/\\"/g'))
for x in $(
clang++ -Wp,-v -xc++ -stdlib=libc++ - -fsyntax-only < /dev/null 2>&1 |
grep /llvm/); do
echo "-isystem" >> "${EXAMPLE}/carbon/compile_flags.txt"
echo "${x}" >> "${EXAMPLE}/carbon/compile_flags.txt"
COMPILE_FLAGS+=("-isystem")
COMPILE_FLAGS+=("${x}")
done
# Construct a compilation database for use by run-clang-tidy.py.
COMPDB="${EXAMPLE}/carbon/compile_commands.json"
echo "[" > "${COMPDB}"
for f in $(find "${EXAMPLE}/carbon" -regex ".*\.\(cc\|h\)"); do
echo "{ \"file\": \"$(realpath --relative-to "${EXAMPLE}/carbon" ${f})\"," >> "${COMPDB}"
echo " \"directory\": \"${EXAMPLE}/carbon\"," >> "${COMPDB}"
echo " \"arguments\": [" >> "${COMPDB}"
echo " \"clang++\"," >> "${COMPDB}"
for index in ${!COMPILE_FLAGS[@]}; do
echo " \"${COMPILE_FLAGS[$index]}\"," >> "${COMPDB}"
done
echo " \"${f}\"" >> "${COMPDB}"
echo " ]" >> "${COMPDB}"
echo "}," >> "${COMPDB}"
done
# Remove the last comma, for JSON syntax correctness.
sed -i '$ s/,$//' "${COMPDB}"
echo "]" >> "${EXAMPLE}/carbon/compile_commands.json"
# Run the migration tool.
bazel build -c opt //migrate_cpp
# Not sure why, but execution of cpp_refactoring fails while saving refactorings
@@ -48,4 +66,4 @@ pushd "${EXAMPLE}/carbon"
popd
# Don't save the compile flags.
rm "${EXAMPLE}/carbon/compile_flags.txt"
rm "${EXAMPLE}/carbon/compile_commands.json"