[cfe-commits] r143917 - in /cfe/trunk: include/clang/Driver/CC1Options.td lib/Driver/ToolChains.cpp lib/Frontend/CompilerInvocation.cpp test/lit.cfg

Chandler Carruth chandlerc at gmail.com
Mon Nov 7 01:17:32 PST 2011


Author: chandlerc
Date: Mon Nov  7 03:17:31 2011
New Revision: 143917

URL: http://llvm.org/viewvc/llvm-project?rev=143917&view=rev
Log:
Rip out one of the features I added for the driver-include-management.
We don't actually need a separate flag for non-sysrooted paths as the
driver has to manage the sysroot anyways. The driver is not infrequently
adding paths to the header search based on their existence on the
filesystem. For that, it has to add the sysroot anyways, we should pass
it on down to CC1 already joined. More importantly, the driver cannot in
all cases distinguish between sysrooted paths and paths that are
relative to the Clang binary's installation directory. Essentially, we
always need to ignore the system root for these internal header search
options. It turns out in most of the places we were already providing
the system root in the driver, and then another one in CC1 so this fixes
several bugs.

Modified:
    cfe/trunk/include/clang/Driver/CC1Options.td
    cfe/trunk/lib/Driver/ToolChains.cpp
    cfe/trunk/lib/Frontend/CompilerInvocation.cpp
    cfe/trunk/test/lit.cfg

Modified: cfe/trunk/include/clang/Driver/CC1Options.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CC1Options.td?rev=143917&r1=143916&r2=143917&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/CC1Options.td (original)
+++ cfe/trunk/include/clang/Driver/CC1Options.td Mon Nov  7 03:17:31 2011
@@ -670,12 +670,6 @@
            "implicit extern \"C\" semantics; these are assumed to not be "
            "user-provided and are used to model system and standard headers' "
            "paths.">;
-def internal_nosysroot_isystem : JoinedOrSeparate<"-internal-nosysroot-isystem">,
-  MetaVarName<"<directory>">,
-  HelpText<"Add directory to the internal system include search path without "
-           "applying a sysroot to it; these are assumed to not be "
-           "user-provided and are used to model system and standard headers' "
-           "paths.">;
 def iprefix : JoinedOrSeparate<"-iprefix">, MetaVarName<"<prefix>">,
   HelpText<"Set the -iwithprefix/-iwithprefixbefore prefix">;
 def iwithprefix : JoinedOrSeparate<"-iwithprefix">, MetaVarName<"<dir>">,

Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=143917&r1=143916&r2=143917&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Mon Nov  7 03:17:31 2011
@@ -1920,12 +1920,9 @@
     addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/usr/local/include");
 
   if (!DriverArgs.hasArg(options::OPT_nobuiltininc)) {
-    // Ignore the sysroot, we *always* look for clang headers relative to
-    // supplied path.
     llvm::sys::Path P(D.ResourceDir);
     P.appendComponent("include");
-    CC1Args.push_back("-internal-nosysroot-isystem");
-    CC1Args.push_back(DriverArgs.MakeArgString(P.str()));
+    addSystemInclude(DriverArgs, CC1Args, P.str());
   }
 
   if (DriverArgs.hasArg(options::OPT_nostdlibinc))
@@ -2381,12 +2378,9 @@
     return;
 
   if (!DriverArgs.hasArg(options::OPT_nobuiltininc)) {
-    // Ignore the sysroot, we *always* look for clang headers relative to
-    // supplied path.
     llvm::sys::Path P(getDriver().ResourceDir);
     P.appendComponent("include");
-    CC1Args.push_back("-internal-nosysroot-isystem");
-    CC1Args.push_back(DriverArgs.MakeArgString(P.str()));
+    addSystemInclude(DriverArgs, CC1Args, P.str());
   }
 
   if (DriverArgs.hasArg(options::OPT_nostdlibinc))

Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=143917&r1=143916&r2=143917&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Mon Nov  7 03:17:31 2011
@@ -577,9 +577,7 @@
     } else {
       if (E.IsInternal) {
         assert(E.Group == frontend::System && "Unexpected header search group");
-        if (E.IgnoreSysRoot)
-          Res.push_back("-internal-nosysroot-isystem");
-        else if (E.ImplicitExternC)
+        if (E.ImplicitExternC)
           Res.push_back("-internal-externc-isystem");
         else
           Res.push_back("-internal-isystem");
@@ -1496,14 +1494,11 @@
 
   // Add the internal paths from a driver that detects standard include paths.
   for (arg_iterator I = Args.filtered_begin(OPT_internal_isystem,
-                                            OPT_internal_externc_isystem,
-                                            OPT_internal_nosysroot_isystem),
+                                            OPT_internal_externc_isystem),
                     E = Args.filtered_end();
        I != E; ++I)
     Opts.AddPath((*I)->getValue(Args), frontend::System,
-                 false, false,
-                 (*I)->getOption().matches(OPT_internal_nosysroot_isystem),
-                 /*IsInternal=*/true,
+                 false, false, /*IgnoreSysRoot=*/true, /*IsInternal=*/true,
                  (*I)->getOption().matches(OPT_internal_externc_isystem));
 }
 

Modified: cfe/trunk/test/lit.cfg
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/lit.cfg?rev=143917&r1=143916&r2=143917&view=diff
==============================================================================
--- cfe/trunk/test/lit.cfg (original)
+++ cfe/trunk/test/lit.cfg Mon Nov  7 03:17:31 2011
@@ -157,8 +157,7 @@
       lit.fatal("Couldn't find the include dir for Clang ('%s')" % clang)
     return cmd.stdout.read().strip()
 
-config.substitutions.append( ('%clang_cc1',
-                              '%s -cc1 -internal-nosysroot-isystem %s'
+config.substitutions.append( ('%clang_cc1', '%s -cc1 -internal-isystem %s'
                               % (config.clang,
                                  getClangBuiltinIncludeDir(config.clang))) )
 





More information about the cfe-commits mailing list