[PATCH] D141907: [CMake] Ensure `CLANG_RESOURCE_DIR` is respected

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 31 13:41:42 PST 2023


MaskRay added a comment.

edeaf16f2c2f02d6e43312d48d26d354d87913f3 (2011) added the CMake variable `CLANG_RESOURCE_DIR` but did not explain why. 
The patch introduced conditions in C++ code like

  std::string path_to_clang_dir = std::string(CLANG_RESOURCE_DIR).empty()
                                      ? "/foo/bar/" LLDB_INSTALL_LIBDIR_BASENAME
                                        "/clang/" CLANG_VERSION_MAJOR_STRING
                                      : "/foo/bar/bin/" CLANG_RESOURCE_DIR;

which makes me uncomfortable.

I wish that we can just replace all places that construct `CLANG_INSTALL_LIBDIR_BASENAME "/clang/" CLANG_VERSION_MAJOR_STRING` manually with a simple `CLANG_RESOURCE_DIR` which is guaranteed to be non-empty.

In the long term, the CMake variable `CLANG_RESOURCE_DIR` probably should be removed.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D141907/new/

https://reviews.llvm.org/D141907



More information about the llvm-commits mailing list