r204775 - Move the -i[no-]system-prefix options from CC1Options.td to Options.td.
Alexander Kornienko
alexfh at google.com
Tue Mar 25 18:39:59 PDT 2014
Author: alexfh
Date: Tue Mar 25 20:39:59 2014
New Revision: 204775
URL: http://llvm.org/viewvc/llvm-project?rev=204775&view=rev
Log:
Move the -i[no-]system-prefix options from CC1Options.td to Options.td.
Summary:
This allows them to be used without -cc1 the same way as -I and -isystem.
Renamed the options to --system-header-prefix=/--no-system-header-prefix to avoid interference with -isystem and make the intent of the option cleaner.
Reviewers: rsmith
Reviewed By: rsmith
CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D3185
Modified:
cfe/trunk/docs/UsersManual.rst
cfe/trunk/include/clang/Driver/CC1Options.td
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/test/Frontend/system-header-prefix.c
Modified: cfe/trunk/docs/UsersManual.rst
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/UsersManual.rst?rev=204775&r1=204774&r2=204775&view=diff
==============================================================================
--- cfe/trunk/docs/UsersManual.rst (original)
+++ cfe/trunk/docs/UsersManual.rst Tue Mar 25 20:39:59 2014
@@ -700,17 +700,18 @@ the pragma onwards within the same file.
char b = 'ab'; // no warning
-The :option:`-isystem-prefix` and :option:`-ino-system-prefix` command-line
-arguments can be used to override whether subsets of an include path are
-treated as system headers. When the name in a ``#include`` directive is
-found within a header search path and starts with a system prefix, the
+The :option:`--system-header-prefix=` and :option:`--no-system-header-prefix=`
+command-line arguments can be used to override whether subsets of an include
+path are treated as system headers. When the name in a ``#include`` directive
+is found within a header search path and starts with a system prefix, the
header is treated as a system header. The last prefix on the
command-line which matches the specified header name takes precedence.
For instance:
.. code-block:: console
- $ clang -Ifoo -isystem bar -isystem-prefix x/ -ino-system-prefix x/y/
+ $ clang -Ifoo -isystem bar --system-header-prefix=x/ \
+ --no-system-header-prefix=x/y/
Here, ``#include "x/a.h"`` is treated as including a system header, even
if the header is found in ``foo``, and ``#include "x/y/b.h"`` is treated
Modified: cfe/trunk/include/clang/Driver/CC1Options.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CC1Options.td?rev=204775&r1=204774&r2=204775&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/CC1Options.td (original)
+++ cfe/trunk/include/clang/Driver/CC1Options.td Tue Mar 25 20:39:59 2014
@@ -508,14 +508,6 @@ def internal_externc_isystem : JoinedOrS
"implicit extern \"C\" semantics; these are assumed to not be "
"user-provided and are used to model system and standard headers' "
"paths.">;
-def isystem_prefix : JoinedOrSeparate<["-"], "isystem-prefix">,
- MetaVarName<"<prefix>">,
- HelpText<"Treat all #include paths starting with <prefix> as including a "
- "system header.">;
-def ino_system_prefix : JoinedOrSeparate<["-"], "ino-system-prefix">,
- MetaVarName<"<prefix>">,
- HelpText<"Treat all #include paths starting with <prefix> as not including a "
- "system header.">;
//===----------------------------------------------------------------------===//
// Preprocessor Options
Modified: cfe/trunk/include/clang/Driver/Options.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=204775&r1=204774&r2=204775&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Tue Mar 25 20:39:59 2014
@@ -1297,6 +1297,16 @@ def stdlib_EQ : Joined<["-", "--"], "std
HelpText<"C++ standard library to use">;
def sub__library : JoinedOrSeparate<["-"], "sub_library">;
def sub__umbrella : JoinedOrSeparate<["-"], "sub_umbrella">;
+def system_header_prefix : Joined<["--"], "system-header-prefix=">,
+ Group<clang_i_Group>, Flags<[CC1Option]>, MetaVarName<"<prefix>">,
+ HelpText<"Treat all #include paths starting with <prefix> as including a "
+ "system header.">;
+def : Separate<["--"], "system-header-prefix">, Alias<system_header_prefix>;
+def no_system_header_prefix : Joined<["--"], "no-system-header-prefix=">,
+ Group<clang_i_Group>, Flags<[CC1Option]>, MetaVarName<"<prefix>">,
+ HelpText<"Treat all #include paths starting with <prefix> as not including a "
+ "system header.">;
+def : Separate<["--"], "no-system-header-prefix">, Alias<no_system_header_prefix>;
def s : Flag<["-"], "s">;
def target : Joined<["--"], "target=">, Flags<[DriverOption]>,
HelpText<"Generate code for the given target">;
Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=204775&r1=204774&r2=204775&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Tue Mar 25 20:39:59 2014
@@ -1019,12 +1019,12 @@ static void ParseHeaderSearchArgs(Header
}
// Add the path prefixes which are implicitly treated as being system headers.
- for (arg_iterator I = Args.filtered_begin(OPT_isystem_prefix,
- OPT_ino_system_prefix),
+ for (arg_iterator I = Args.filtered_begin(OPT_system_header_prefix,
+ OPT_no_system_header_prefix),
E = Args.filtered_end();
I != E; ++I)
- Opts.AddSystemHeaderPrefix((*I)->getValue(),
- (*I)->getOption().matches(OPT_isystem_prefix));
+ Opts.AddSystemHeaderPrefix(
+ (*I)->getValue(), (*I)->getOption().matches(OPT_system_header_prefix));
for (arg_iterator I = Args.filtered_begin(OPT_ivfsoverlay),
E = Args.filtered_end(); I != E; ++I)
Modified: cfe/trunk/test/Frontend/system-header-prefix.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Frontend/system-header-prefix.c?rev=204775&r1=204774&r2=204775&view=diff
==============================================================================
--- cfe/trunk/test/Frontend/system-header-prefix.c (original)
+++ cfe/trunk/test/Frontend/system-header-prefix.c Tue Mar 25 20:39:59 2014
@@ -1,4 +1,5 @@
-// RUN: %clang_cc1 -isystem-prefix libs/ -ino-system-prefix libs/mylib/ -I%S/Inputs/SystemHeaderPrefix -Wundef -E %s 2>&1 | FileCheck %s
+// RUN: %clang --system-header-prefix=libs/ --no-system-header-prefix=libs/mylib/ -I%S/Inputs/SystemHeaderPrefix -Wundef -E %s 2>&1 | FileCheck %s
+// RUN: %clang --system-header-prefix libs/ --no-system-header-prefix libs/mylib/ -I%S/Inputs/SystemHeaderPrefix -Wundef -E %s 2>&1 | FileCheck %s
#include "src/all.h"
More information about the cfe-commits
mailing list