[llvm-branch-commits] [cfe-branch] r143932 - in /cfe/branches/release_30: ./ include/clang/Driver/CC1Options.td lib/Driver/ToolChains.cpp lib/Frontend/CompilerInvocation.cpp
Chandler Carruth
chandlerc at gmail.com
Mon Nov 7 02:19:48 PST 2011
Author: chandlerc
Date: Mon Nov 7 04:19:48 2011
New Revision: 143932
URL: http://llvm.org/viewvc/llvm-project?rev=143932&view=rev
Log:
Merging r143801:
------------------------------------------------------------------------
r143801 | chandlerc | 2011-11-05 02:24:44 -0700 (Sat, 05 Nov 2011) | 20 lines
Fix a significant oversight in my move of MSVC includes to the driver:
actually manage the builtin header file includes as well as the system
ones.
This one is actually debatable whether it belongs in the driver or not,
as the builtin includes are really an internal bit of implementation
goop for Clang. However, they must be included at *exactly* the right
point in the sequence of header files, which makes it essentially
impossible to have this be managed by the Frontend and the rest by the
Driver. I have terrible ideas that would "work", but I think they're
worse than putting this in the driver and making the Frontend library
even more ignorant of the environment and system on which it is being
run.
Also fix the fact that we weren't properly respecting the flags which
suppress standard system include directories.
Note that this still leaves all of the Clang tests which run CC1
directly and include builtin header files broken on Windows. I'm working
on a followup patch to address that.
------------------------------------------------------------------------
Modified:
cfe/branches/release_30/ (props changed)
cfe/branches/release_30/include/clang/Driver/CC1Options.td
cfe/branches/release_30/lib/Driver/ToolChains.cpp
cfe/branches/release_30/lib/Frontend/CompilerInvocation.cpp
Propchange: cfe/branches/release_30/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Nov 7 04:19:48 2011
@@ -1,3 +1,3 @@
/cfe/branches/type-system-rewrite:134693-134817
-/cfe/trunk:142113,142133-142134,142187,142349,142474,142476,142918,143344-143345,143684,143686-143687,143751-143752,143798
+/cfe/trunk:142113,142133-142134,142187,142349,142474,142476,142918,143344-143345,143684,143686-143687,143751-143752,143798,143801
/cfe/trunk/test/SemaTemplate:126920
Modified: cfe/branches/release_30/include/clang/Driver/CC1Options.td
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_30/include/clang/Driver/CC1Options.td?rev=143932&r1=143931&r2=143932&view=diff
==============================================================================
--- cfe/branches/release_30/include/clang/Driver/CC1Options.td (original)
+++ cfe/branches/release_30/include/clang/Driver/CC1Options.td Mon Nov 7 04:19:48 2011
@@ -653,6 +653,12 @@
"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/branches/release_30/lib/Driver/ToolChains.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_30/lib/Driver/ToolChains.cpp?rev=143932&r1=143931&r2=143932&view=diff
==============================================================================
--- cfe/branches/release_30/lib/Driver/ToolChains.cpp (original)
+++ cfe/branches/release_30/lib/Driver/ToolChains.cpp Mon Nov 7 04:19:48 2011
@@ -2261,6 +2261,21 @@
void Windows::AddClangSystemIncludeArgs(const ArgList &DriverArgs,
ArgStringList &CC1Args) const {
+ if (DriverArgs.hasArg(options::OPT_nostdinc))
+ 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()));
+ }
+
+ if (DriverArgs.hasArg(options::OPT_nostdlibinc))
+ return;
+
std::string VSDir;
std::string WindowsSDKDir;
Modified: cfe/branches/release_30/lib/Frontend/CompilerInvocation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_30/lib/Frontend/CompilerInvocation.cpp?rev=143932&r1=143931&r2=143932&view=diff
==============================================================================
--- cfe/branches/release_30/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/branches/release_30/lib/Frontend/CompilerInvocation.cpp Mon Nov 7 04:19:48 2011
@@ -571,8 +571,12 @@
} else {
if (E.IsInternal) {
assert(E.Group == frontend::System && "Unexpected header search group");
- Res.push_back(E.ImplicitExternC ? "-internal-externc-isystem"
- : "-internal-isystem");
+ if (E.IgnoreSysRoot)
+ Res.push_back("-internal-nosysroot-isystem");
+ else if (E.ImplicitExternC)
+ Res.push_back("-internal-externc-isystem");
+ else
+ Res.push_back("-internal-isystem");
} else {
if (E.Group != frontend::Angled && E.Group != frontend::System)
llvm::report_fatal_error("Invalid option set!");
@@ -1471,11 +1475,14 @@
// 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_externc_isystem,
+ OPT_internal_nosysroot_isystem),
E = Args.filtered_end();
I != E; ++I)
Opts.AddPath((*I)->getValue(Args), frontend::System,
- false, false, false, /*IsInternal=*/true,
+ false, false,
+ (*I)->getOption().matches(OPT_internal_nosysroot_isystem),
+ /*IsInternal=*/true,
(*I)->getOption().matches(OPT_internal_externc_isystem));
}
More information about the llvm-branch-commits
mailing list