summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2011-11-05 08:30:29 +0000
committerChandler Carruth <chandlerc@gmail.com>2011-11-05 08:30:29 +0000
commit611cb6445343a27f710100b1d2b11fd375d9e26f (patch)
treed60eb2edc440cbd7cb78b0f095c999d54ea3c49e /clang/lib/Frontend/CompilerInvocation.cpp
parent977e30d1c4343abe7b29aa85f699b217e38caa19 (diff)
downloadbcm5719-llvm-611cb6445343a27f710100b1d2b11fd375d9e26f.tar.gz
bcm5719-llvm-611cb6445343a27f710100b1d2b11fd375d9e26f.zip
Add two flags to the CC1 layer that I was hoping to avoid. We need to
encode the *exact* semantics which the header search paths internally built by the Frontend layer have had, which is both non-user-provided, and at times adding the implicit extern "C" bit to the directory entry. There are lots of CC1 options that are very close, but none do quite this, and they are all already overloaded for other purposes. In some senses this makes the command lines more clean as it clearly indicates which flags are exclusively used to implement internal detection of "standard" header search paths. Lots of the implementation of this is really crufty, due to the surrounding cruft. It doesn't seem worth investing lots of time cleaning this up as it isn't new, and hopefully *lots* of this code will melt away as header search inside of the frontend becomes increasingly trivial. llvm-svn: 143798
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r--clang/lib/Frontend/CompilerInvocation.cpp23
1 files changed, 19 insertions, 4 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index 399e0ca8d86..1829d7de0ad 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -575,10 +575,16 @@ static void HeaderSearchOptsToArgs(const HeaderSearchOptions &Opts,
break;
}
} else {
- if (E.Group != frontend::Angled && E.Group != frontend::System)
- llvm::report_fatal_error("Invalid option set!");
- Res.push_back(E.Group == frontend::Angled ? "-iwithprefixbefore" :
- "-iwithprefix");
+ if (E.IsInternal) {
+ assert(E.Group == frontend::System && "Unexpected header search group");
+ Res.push_back(E.ImplicitExternC ? "-internal-externc-isystem"
+ : "-internal-isystem");
+ } else {
+ if (E.Group != frontend::Angled && E.Group != frontend::System)
+ llvm::report_fatal_error("Invalid option set!");
+ Res.push_back(E.Group == frontend::Angled ? "-iwithprefixbefore" :
+ "-iwithprefix");
+ }
}
Res.push_back(E.Path);
}
@@ -1483,6 +1489,15 @@ static void ParseHeaderSearchArgs(HeaderSearchOptions &Opts, ArgList &Args) {
ie = Args.filtered_end(); it != ie; ++it)
Opts.AddPath((*it)->getValue(Args), frontend::ObjCXXSystem, true, false,
true);
+
+ // 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),
+ E = Args.filtered_end();
+ I != E; ++I)
+ Opts.AddPath((*I)->getValue(Args), frontend::System,
+ false, false, false, /*IsInternal=*/true,
+ (*I)->getOption().matches(OPT_internal_externc_isystem));
}
void CompilerInvocation::setLangDefaults(LangOptions &Opts, InputKind IK,
OpenPOWER on IntegriCloud