[PATCH] D76653: [clang] Allow -DDEFAULT_SYSROOT to be a relative path

Petr Hosek via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 23 18:32:04 PDT 2020


phosek added inline comments.


================
Comment at: clang/lib/Driver/Driver.cpp:140
+  if (llvm::sys::path::is_relative(SysRoot)) {
+    SysRoot = GetResourcesPath(ClangExecutable, SysRoot);
+  }
----------------
I don't think this is an intended use for `GetResourcesPath` since this is not a resource path. Since you set custom resource dir, this is equivalent to:

```
llvm::sys::path::append(llvm::sys::path::parent_path(ClangExecutable), SysRoot)
```

On line 144 we already set `Dir = llvm::sys::path::parent_path(ClangExecutable)`, so if you move this below you can just use `SysRoot = llvm::sys::path::append(Dir, SysRoot)` which should be sufficient.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76653





More information about the cfe-commits mailing list