Skip to content

Commit 15e4811

Browse files
committed
ARROW-2531: [C++] Update clang bits to 6.0
Author: Korn, Uwe <[email protected]> Closes #1977 from xhochy/ARROW-2531 and squashes the following commits: cd18d57 <Korn, Uwe> Update llvm install command cbe94bc <Korn, Uwe> Support non-standard homebrew location 651c7e2 <Korn, Uwe> ARROW-2531: Update clang bits to 6.0
1 parent 4cc9157 commit 15e4811

File tree

9 files changed

+40
-22
lines changed

9 files changed

+40
-22
lines changed

.travis.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ matrix:
4141
allow_failures:
4242
- jdk: oraclejdk9
4343
include:
44-
# C++ & Python w/ clang 5.0
44+
# C++ & Python w/ clang 6.0
4545
- compiler: gcc
4646
language: cpp
4747
os: linux
@@ -55,8 +55,8 @@ matrix:
5555
- ARROW_TRAVIS_PYTHON_BENCHMARKS=1
5656
- ARROW_TRAVIS_PYTHON_DOCS=1
5757
- ARROW_BUILD_WARNING_LEVEL=CHECKIN
58-
- CC="clang-5.0"
59-
- CXX="clang++-5.0"
58+
- CC="clang-6.0"
59+
- CXX="clang++-6.0"
6060
before_script:
6161
# Always run RAT checks, in case another build in matrix breaks RAT
6262
- $TRAVIS_BUILD_DIR/ci/travis_release_audit.sh
@@ -127,8 +127,8 @@ matrix:
127127
env: ARROW_TEST_GROUP=integration
128128
jdk: openjdk8
129129
env:
130-
- CC="clang-5.0"
131-
- CXX="clang++-5.0"
130+
- CC="clang-6.0"
131+
- CXX="clang++-6.0"
132132
before_script:
133133
- if [ $ARROW_CI_INTEGRATION_AFFECTED != "1" ]; then exit; fi
134134
- $TRAVIS_BUILD_DIR/ci/travis_install_linux.sh

ci/travis_install_clang_tools.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@
1919

2020
wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key|sudo apt-key add -
2121
sudo apt-add-repository -y \
22-
"deb http://llvm.org/apt/trusty/ llvm-toolchain-trusty-5.0 main"
22+
"deb http://llvm.org/apt/trusty/ llvm-toolchain-trusty-6.0 main"
2323
sudo apt-get update -qq
24-
sudo apt-get install -q clang-5.0 clang-format-5.0 clang-tidy-5.0
24+
sudo apt-get install -q clang-6.0 clang-format-6.0 clang-tidy-6.0

cpp/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ set(ARROW_ABI_VERSION "${ARROW_SO_VERSION}.0.0")
4848

4949
set(BUILD_SUPPORT_DIR "${CMAKE_SOURCE_DIR}/build-support")
5050

51-
set(CLANG_FORMAT_VERSION "5.0")
51+
set(CLANG_FORMAT_VERSION "6.0")
5252
find_package(ClangTools)
5353
if ("$ENV{CMAKE_EXPORT_COMPILE_COMMANDS}" STREQUAL "1" OR CLANG_TIDY_FOUND)
5454
# Generate a Clang compile_commands.json "compilation database" file for use

cpp/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,10 +320,10 @@ You can also fix any formatting errors automatically:
320320

321321
make format
322322

323-
These commands require `clang-format-5.0` (and not any other version).
323+
These commands require `clang-format-6.0` (and not any other version).
324324
You may find the required packages at http://releases.llvm.org/download.html
325325
or use the Debian/Ubuntu APT repositories on https://apt.llvm.org/. On macOS
326-
with [Homebrew][1] you can get it via `brew install llvm@5`.
326+
with [Homebrew][1] you can get it via `brew install llvm@6`.
327327

328328
## Checking for ABI and API stability
329329

cpp/cmake_modules/FindClangTools.cmake

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,20 @@
3030
# CLANG_FORMAT_BIN, The path to the clang format binary
3131
# CLANG_TIDY_FOUND, Whether clang format was found
3232

33+
if (DEFINED ENV{HOMEBREW_PREFIX})
34+
set(HOMEBREW_PREFIX "${ENV{HOMEBREW_PREFIX}")
35+
else()
36+
set(HOMEBREW_PREFIX "/usr/local")
37+
endif()
38+
3339
find_program(CLANG_TIDY_BIN
3440
NAMES clang-tidy-4.0
3541
clang-tidy-3.9
3642
clang-tidy-3.8
3743
clang-tidy-3.7
3844
clang-tidy-3.6
3945
clang-tidy
40-
PATHS ${ClangTools_PATH} $ENV{CLANG_TOOLS_PATH} /usr/local/bin /usr/bin
46+
PATHS ${ClangTools_PATH} $ENV{CLANG_TOOLS_PATH} /usr/local/bin /usr/bin "${HOMEBREW_PREFIX}/bin"
4147
NO_DEFAULT_PATH
4248
)
4349

@@ -55,7 +61,7 @@ if (CLANG_FORMAT_VERSION)
5561
PATHS
5662
${ClangTools_PATH}
5763
$ENV{CLANG_TOOLS_PATH}
58-
/usr/local/bin /usr/bin
64+
/usr/local/bin /usr/bin "${HOMEBREW_PREFIX}/bin"
5965
NO_DEFAULT_PATH
6066
)
6167

@@ -67,16 +73,28 @@ if (CLANG_FORMAT_VERSION)
6773
if ("${CLANG_FORMAT_MINOR_VERSION}" STREQUAL "0")
6874
find_program(CLANG_FORMAT_BIN
6975
NAMES clang-format
70-
PATHS /usr/local/opt/llvm@${CLANG_FORMAT_MAJOR_VERSION}/bin
76+
PATHS "${HOMEBREW_PREFIX}/opt/llvm@${CLANG_FORMAT_MAJOR_VERSION}/bin"
7177
NO_DEFAULT_PATH
7278
)
7379
else()
7480
find_program(CLANG_FORMAT_BIN
7581
NAMES clang-format
76-
PATHS /usr/local/opt/llvm@${CLANG_FORMAT_VERSION}/bin
82+
PATHS "${HOMEBREW_PREFIX}/opt/llvm@${CLANG_FORMAT_VERSION}/bin"
7783
NO_DEFAULT_PATH
7884
)
7985
endif()
86+
87+
if ("${CLANG_FORMAT_BIN}" STREQUAL "CLANG_FORMAT_BIN-NOTFOUND")
88+
# binary was still not found, look into Cellar
89+
# TODO: This currently only works for '.0' patch releases as
90+
# find_program does not support regular expressions
91+
# in the paths.
92+
find_program(CLANG_FORMAT_BIN
93+
NAMES clang-format
94+
PATHS "${HOMEBREW_PREFIX}/Cellar/llvm/${CLANG_FORMAT_VERSION}.0/bin"
95+
NO_DEFAULT_PATH
96+
)
97+
endif()
8098
endif()
8199
else()
82100
find_program(CLANG_FORMAT_BIN
@@ -86,7 +104,7 @@ else()
86104
clang-format-3.7
87105
clang-format-3.6
88106
clang-format
89-
PATHS ${ClangTools_PATH} $ENV{CLANG_TOOLS_PATH} /usr/local/bin /usr/bin
107+
PATHS ${ClangTools_PATH} $ENV{CLANG_TOOLS_PATH} /usr/local/bin /usr/bin "${HOMEBREW_PREFIX}/bin"
90108
NO_DEFAULT_PATH
91109
)
92110
endif()

cpp/src/arrow/builder.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1626,8 +1626,8 @@ Status StructBuilder::FinishInternal(std::shared_ptr<ArrayData>* out) {
16261626
return Status::OK();
16271627
}
16281628

1629-
// ----------------------------------------------------------------------
1630-
// Helper functions
1629+
// ----------------------------------------------------------------------
1630+
// Helper functions
16311631

16321632
#define BUILDER_CASE(ENUM, BuilderType) \
16331633
case Type::ENUM: \

cpp/src/arrow/io/io-buffered-test.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class TestBufferedOutputStream : public FileTestFixture {
7272
ASSERT_OK(FileOutputStream::Open(path_, append, &file));
7373
fd_ = file->file_descriptor();
7474
if (append) {
75-
// Workaround for ARROW-2466 ("append" flag doesn't set file pos)
75+
// Workaround for ARROW-2466 ("append" flag doesn't set file pos)
7676
#if defined(_MSC_VER)
7777
_lseeki64(fd_, 0, SEEK_END);
7878
#else

cpp/src/arrow/python/numpy_convert.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ bool is_contiguous(PyObject* array) {
4646
}
4747

4848
int cast_npy_type_compat(int type_num) {
49-
// Both LONGLONG and INT64 can be observed in the wild, which is buggy. We set
50-
// U/LONGLONG to U/INT64 so things work properly.
49+
// Both LONGLONG and INT64 can be observed in the wild, which is buggy. We set
50+
// U/LONGLONG to U/INT64 so things work properly.
5151

5252
#if (NPY_INT64 == NPY_LONGLONG) && (NPY_SIZEOF_LONGLONG == 8)
5353
if (type_num == NPY_LONGLONG) {

cpp/src/arrow/type.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,8 +367,8 @@ std::shared_ptr<Schema> schema(std::vector<std::shared_ptr<Field>>&& fields,
367367
return std::make_shared<Schema>(std::move(fields), metadata);
368368
}
369369

370-
// ----------------------------------------------------------------------
371-
// Visitors and factory functions
370+
// ----------------------------------------------------------------------
371+
// Visitors and factory functions
372372

373373
#define ACCEPT_VISITOR(TYPE) \
374374
Status TYPE::Accept(TypeVisitor* visitor) const { return visitor->Visit(*this); }

0 commit comments

Comments
 (0)