From 7e51ecfa5685ee4d5b03b459f26f7b5c3ef14f3d Mon Sep 17 00:00:00 2001 From: Yuka Takahashi Date: Wed, 3 May 2017 04:58:39 +0000 Subject: [PATCH] Fix a bug that -isysroot is completely ignored on Unix -isysroot is the flag which set the system root directory. This bug report https://bugs.llvm.org//show_bug.cgi?id=11503 shows that -isysroot is not handled at all on Unix, so fixed this bug. After this diff, I could get this result https://pastebin.com/TeCmn9mj . Differential Revision: https://reviews.llvm.org/D31495 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301998 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Frontend/CompilerInvocation.cpp | 2 +- test/Driver/sysroot-flags.c | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp index d3ebf48315..c69a7e6497 100644 --- a/lib/Frontend/CompilerInvocation.cpp +++ b/lib/Frontend/CompilerInvocation.cpp @@ -1565,7 +1565,7 @@ static void ParseHeaderSearchArgs(HeaderSearchOptions &Opts, ArgList &Args, frontend::IncludeDirGroup Group = frontend::System; if (A->getOption().matches(OPT_internal_externc_isystem)) Group = frontend::ExternCSystem; - Opts.AddPath(A->getValue(), Group, false, true); + Opts.AddPath(A->getValue(), Group, false, false); } // Add the path prefixes which are implicitly treated as being system headers. diff --git a/test/Driver/sysroot-flags.c b/test/Driver/sysroot-flags.c index b0a10bfca4..8149275d31 100644 --- a/test/Driver/sysroot-flags.c +++ b/test/Driver/sysroot-flags.c @@ -26,3 +26,7 @@ // RUN: FileCheck %s -check-prefix=SYSROOT_SEPARATE // SYSROOT_SEPARATE: "-isysroot" "{{[^"]*}}/foo/bar" // SYSROOT_SEPARATE: "--sysroot{{" "|=}}{{[^"]*}}/foo/bar" + +// Check that -isysroot is handled properly +// RUN: %clang -isysroot /foo/bar -c %s -v 2>&1 | \ +// RUN: grep "/foo/bar" -- 2.40.0