forked from OSchip/llvm-project
Add gcc's -no-canonical-prefixes option to clang.
llvm-svn: 90577
This commit is contained in:
parent
875912ac13
commit
73d4637545
|
@ -375,6 +375,8 @@ def multiply__defined : Separate<"-multiply_defined">;
|
|||
def mwarn_nonportable_cfstrings : Flag<"-mwarn-nonportable-cfstrings">, Group<m_Group>;
|
||||
def m_Separate : Separate<"-m">, Group<m_Group>;
|
||||
def m_Joined : Joined<"-m">, Group<m_Group>;
|
||||
def no_canonical_prefixes : Flag<"-no-canonical-prefixes">, Flags<[DriverOption]>,
|
||||
HelpText<"Do not resolve symbolic links, turn relative paths into absolute ones, or do anything else to identify the executable">;
|
||||
def no_cpp_precomp : Flag<"-no-cpp-precomp">;
|
||||
def no_integrated_cpp : Flag<"-no-integrated-cpp">, Flags<[DriverOption]>;
|
||||
def no__dead__strip__inits__and__terms : Flag<"-no_dead_strip_inits_and_terms">;
|
||||
|
|
|
@ -1104,6 +1104,9 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
// care to warn the user about.
|
||||
Args.ClaimAllArgs(options::OPT_clang_ignored_f_Group);
|
||||
Args.ClaimAllArgs(options::OPT_clang_ignored_m_Group);
|
||||
|
||||
// -no-canonical-prefixes is used very early in main.
|
||||
Args.ClaimAllArgs(options::OPT_no_canonical_prefixes);
|
||||
}
|
||||
|
||||
void gcc::Common::ConstructJob(Compilation &C, const JobAction &JA,
|
||||
|
|
|
@ -60,7 +60,10 @@ void DriverDiagnosticPrinter::HandleDiagnostic(Diagnostic::Level Level,
|
|||
OS << '\n';
|
||||
}
|
||||
|
||||
llvm::sys::Path GetExecutablePath(const char *Argv0) {
|
||||
llvm::sys::Path GetExecutablePath(const char *Argv0, bool CanonicalPrefixes) {
|
||||
if (!CanonicalPrefixes)
|
||||
return llvm::sys::Path(Argv0);
|
||||
|
||||
// This just needs to be some symbol in the binary; C++ doesn't
|
||||
// allow taking the address of ::main however.
|
||||
void *P = (void*) (intptr_t) GetExecutablePath;
|
||||
|
@ -190,7 +193,16 @@ int main(int argc, const char **argv) {
|
|||
return cc1_main(argv+2, argv+argc, argv[0],
|
||||
(void*) (intptr_t) GetExecutablePath);
|
||||
|
||||
llvm::sys::Path Path = GetExecutablePath(argv[0]);
|
||||
bool CanonicalPrefixes = true;
|
||||
for (int i = 1; i < argc; ++i) {
|
||||
if (llvm::StringRef(argv[i]) == "-no-canonical-prefixes") {
|
||||
CanonicalPrefixes = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
llvm::sys::Path Path = GetExecutablePath(argv[0], CanonicalPrefixes);
|
||||
|
||||
DriverDiagnosticPrinter DiagClient(Path.getBasename(), llvm::errs());
|
||||
|
||||
Diagnostic Diags(&DiagClient);
|
||||
|
@ -264,4 +276,3 @@ int main(int argc, const char **argv) {
|
|||
|
||||
return Res;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue