[PATCH] D134337: [clang] [Driver] More flexible rules for loading default configs

Serge Pavlov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 28 02:45:30 PDT 2022


sepavloff added inline comments.


================
Comment at: clang/lib/Driver/Driver.cpp:1098
+  // Try loading separate config for the target (variants 3. and 4.)
+  CfgFileName = RealTriple.str() + ".cfg";
+  if (searchForFile(CfgFilePath, CfgFileSearchDirs, CfgFileName, getVFS()) &&
----------------
Loading driver-mode config should take place before loading target config, it allows to override default settings set by driver mode config in target config. Also a test is need for such case.


================
Comment at: clang/test/Driver/config-file3.c:27
 
-//--- Invocation qqq-clang-g++ tries to find config file qqq-clang-g++.cfg first.
+//--- Invocation x86_64-unknown-linux-gnu-clang-g++ tries x86_64-unknown-linux-gnu-clang++.cfg first.
 //
----------------
Tests must check the case when target prefix is not a real triple as in the original test (qqq-clang).


================
Comment at: clang/test/Driver/config-file3.c:60
+//
+// RUN: %t/testdmode/x86_64-unknown-linux-gnu-clang-g++ --target=i386-unknown-linux-gnu --config-system-dir= --config-user-dir= -no-canonical-prefixes --version 2>&1 | FileCheck %s -check-prefix FULL1-I386
+
----------------
We also need a test that checks that in the case of `--target=i386-unknown-linux-gnu` and absence of `i386-unknown-linux-gnu-clang++.cfg` clang does not load `x86_64-unknown-linux-gnu-clang-g++.cfg`.


================
Comment at: clang/test/Driver/config-file3.c:168-170
+// FULL4: Configuration file: {{.*}}/testdmode/x86_64-unknown-linux-gnu.cfg
+// FULL4-NOT: Configuration file:
+// FULL4: Configuration file: {{.*}}/testdmode/clang-g++.cfg
----------------
target and driver mode configs should be in reverse order.


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

https://reviews.llvm.org/D134337



More information about the cfe-commits mailing list