[PATCH] D45964: [Driver] Fix implicit config files from prefixed symlinks
Martin Storsjö via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 25 14:29:17 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL330871: [Driver] Fix implicit config files from prefixed symlinks (authored by mstorsjo, committed by ).
Herald added a subscriber: llvm-commits.
Changed prior to commit:
https://reviews.llvm.org/D45964?vs=143794&id=144007#toc
Repository:
rL LLVM
https://reviews.llvm.org/D45964
Files:
cfe/trunk/include/clang/Driver/ToolChain.h
cfe/trunk/lib/Driver/Driver.cpp
cfe/trunk/test/Driver/config-file3.c
Index: cfe/trunk/include/clang/Driver/ToolChain.h
===================================================================
--- cfe/trunk/include/clang/Driver/ToolChain.h
+++ cfe/trunk/include/clang/Driver/ToolChain.h
@@ -78,6 +78,10 @@
bool IsRegistered)
: TargetPrefix(Target), ModeSuffix(Suffix), DriverMode(Mode),
TargetIsValid(IsRegistered) {}
+
+ bool isEmpty() const {
+ return TargetPrefix.empty() && ModeSuffix.empty() && DriverMode == nullptr;
+ }
};
/// ToolChain - Access to tools for a single platform.
Index: cfe/trunk/test/Driver/config-file3.c
===================================================================
--- cfe/trunk/test/Driver/config-file3.c
+++ cfe/trunk/test/Driver/config-file3.c
@@ -27,6 +27,14 @@
// FULL-NAME: -Wundefined-func-template
// FULL-NAME-NOT: -Werror
//
+//--- Invocation qqq-clang-g++ tries to find config file qqq-clang-g++.cfg even without -no-canonical-prefixes.
+// (As the clang executable and symlink are in different directories, this
+// requires specifying the path via --config-*-dir= though.)
+//
+// RUN: %T/testdmode/qqq-clang-g++ --config-system-dir= --config-user-dir=%T/testdmode -c %s -### 2>&1 | FileCheck %s -check-prefix SYMLINK
+//
+// SYMLINK: Configuration file: {{.*}}/testdmode/qqq-clang-g++.cfg
+//
//--- File specified by --config overrides config inferred from clang executable.
//
// RUN: %T/testdmode/qqq-clang-g++ --config-system-dir=%S/Inputs/config --config-user-dir= --config i386-qqq -c -no-canonical-prefixes %s -### 2>&1 | FileCheck %s -check-prefix CHECK-EXPLICIT
Index: cfe/trunk/lib/Driver/Driver.cpp
===================================================================
--- cfe/trunk/lib/Driver/Driver.cpp
+++ cfe/trunk/lib/Driver/Driver.cpp
@@ -129,7 +129,8 @@
void Driver::ParseDriverMode(StringRef ProgramName,
ArrayRef<const char *> Args) {
- ClangNameParts = ToolChain::getTargetAndModeFromProgramName(ProgramName);
+ if (ClangNameParts.isEmpty())
+ ClangNameParts = ToolChain::getTargetAndModeFromProgramName(ProgramName);
setDriverModeFromOption(ClangNameParts.DriverMode);
for (const char *ArgPtr : Args) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45964.144007.patch
Type: text/x-patch
Size: 2189 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180425/dd4bcffa/attachment.bin>
More information about the llvm-commits
mailing list