r301998 - Fix a bug that -isysroot is completely ignored on Unix

Yuka Takahashi via cfe-commits cfe-commits at lists.llvm.org
Tue May 2 21:58:39 PDT 2017


Author: yamaguchi
Date: Tue May  2 23:58:39 2017
New Revision: 301998

URL: http://llvm.org/viewvc/llvm-project?rev=301998&view=rev
Log:
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

Modified:
    cfe/trunk/lib/Frontend/CompilerInvocation.cpp
    cfe/trunk/test/Driver/sysroot-flags.c

Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=301998&r1=301997&r2=301998&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Tue May  2 23:58:39 2017
@@ -1565,7 +1565,7 @@ static void ParseHeaderSearchArgs(Header
     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.

Modified: cfe/trunk/test/Driver/sysroot-flags.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/sysroot-flags.c?rev=301998&r1=301997&r2=301998&view=diff
==============================================================================
--- cfe/trunk/test/Driver/sysroot-flags.c (original)
+++ cfe/trunk/test/Driver/sysroot-flags.c Tue May  2 23:58:39 2017
@@ -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"




More information about the cfe-commits mailing list