我使用自制软件在 MacOS 10.13 上安装了 LLVM:
brew install --with-toolchain llvm
然后我根据本指南导出了所需的变量。
export PATH="/usr/local/opt/llvm/bin:$PATH"
export CC=/usr/local/opt/llvm/bin/clang
export CXX=/usr/local/opt/llvm/bin/clang++
export LLVM_OPTIONS="-L/usr/local/opt/llvm/lib -Wl,-rpath,/usr/local/opt/llvm/lib "\
"-I/usr/local/opt/llvm/include -I/usr/local/opt/llvm/include/c++/v1/"
运行 clang-tidy 时:
clang-tidy myheaderlib.h -- $LLVM_OPTIONS
我收到错误,所有这些都与标准文件有关:
/usr/local/opt/llvm/include/c++/v1/iosfwd:96:1: error: unknown type name '_LIBCPP_BEGIN_NAMESPACE_STD'
/usr/local/opt/llvm/include/c++/v1/iosfwd:100:1: error: unknown type name 'template'
...
可能是什么原因?