================
@@ -136,6 +136,40 @@ template <typename F> static bool usesInput(const ArgList 
&Args, F &&Fn) {
   });
 }
 
+static StringRef getCXXStdlibName(const ToolChain &TC, const ArgList &Args) {
+  if (TC.getTriple().isWindowsMSVCEnvironment() &&
+      !Args.hasArg(options::OPT_stdlib_EQ))
+    return "msvcstl";
+
+  switch (TC.GetCXXStdlibType(Args)) {
+  case ToolChain::CST_Libcxx:
+    return "libc++";
+  case ToolChain::CST_Libstdcxx:
+    return "libstdc++";
+  }
+  llvm_unreachable("unknown C++ standard library type");
+}
+
+static bool isIncludeDirArg(StringRef Arg) {
+  return Arg == "-internal-isystem" || Arg == "-internal-externc-isystem" ||
+         Arg == "-isystem" || Arg == "-cxx-isystem" || Arg == "-idirafter";
+}
+
+static void printCXXStdlibIncludeDirs(const ToolChain &TC,
+                                      const ArgList &Args) {
+  ArgStringList CC1Args;
+  if (Args.hasArg(options::OPT_stdlibxx_isystem))
+    TC.AddClangCXXStdlibIsystemArgs(Args, CC1Args);
+  else
+    TC.AddClangCXXStdlibIncludeArgs(Args, CC1Args);
----------------
Artem-B wrote:

This also seems to assume that this is the only way standard library includes 
are specified.  
  
What exactly is `--print-cxx-stdlib-include-dirs` supposed to print? The 
include paths that the driver would inject based on "standard" options like 
`-stdlib=...` ? Or does it need to somehow work if the user relies on 
out-of-tree standard library and specifies the include paths manually. 

I guess the former is the best we can do,  as it's hard to tell which 
user-supplied include paths belong to the standard library, and which ones are 
for something else.  
  
But that brings the question -- what would the standard library paths be 
used/useful for? In my experience, they proably will not be particularly useful 
for the end user, as standard library include order is extremely fragile and 
hard to arrange outside of the driver (generally it requires arranging _all_ 
include paths.  
  
Perhaps what we really want to print is the standard library location and let 
the user derive whatever else they want from that path.

https://github.com/llvm/llvm-project/pull/207798
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to