Vendor import of clang trunk r241361:

https://llvm.org/svn/llvm-project/cfe/trunk@241361
This commit is contained in:
Dimitry Andric 2015-07-05 14:23:59 +00:00
parent 2e645aa569
commit c192b3dcff
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/vendor/clang/dist/; revision=285165
svn path=/vendor/clang/clang-trunk-r241361/; revision=285166; tag=vendor/clang/clang-trunk-r241361
570 changed files with 17346 additions and 9574 deletions

View File

@ -60,7 +60,28 @@ or:
% clang -g -fsanitize=address example_UseAfterFree.o
If a bug is detected, the program will print an error message to stderr and
exit with a non-zero exit code. To make AddressSanitizer symbolize its output
exit with a non-zero exit code. AddressSanitizer exits on the first detected error.
This is by design:
* This approach allows AddressSanitizer to produce faster and smaller generated code
(both by ~5%).
* Fixing bugs becomes unavoidable. AddressSanitizer does not produce
false alarms. Once a memory corruption occurs, the program is in an inconsistent
state, which could lead to confusing results and potentially misleading
subsequent reports.
If your process is sandboxed and you are running on OS X 10.10 or earlier, you
will need to set ``DYLD_INSERT_LIBRARIES`` environment variable and point it to
the ASan library that is packaged with the compiler used to build the
executable. (You can find the library by searching for dynamic libraries with
``asan`` in their name.) If the environment variable is not set, the process will
try to re-exec. Also keep in mind that when moving the executable to another machine,
the ASan library will also need to be copied over.
Symbolizing the Reports
=========================
To make AddressSanitizer symbolize its output
you need to set the ``ASAN_SYMBOLIZER_PATH`` environment variable to point to
the ``llvm-symbolizer`` binary (or make sure ``llvm-symbolizer`` is in your
``$PATH``):
@ -100,14 +121,63 @@ force disabled by setting ``ASAN_OPTIONS=symbolize=0``):
Note that on OS X you may need to run ``dsymutil`` on your binary to have the
file\:line info in the AddressSanitizer reports.
AddressSanitizer exits on the first detected error. This is by design.
One reason: it makes the generated code smaller and faster (both by
~5%). Another reason: this makes fixing bugs unavoidable. With Valgrind,
it is often the case that users treat Valgrind warnings as false
positives (which they are not) and don't fix them.
Additional Checks
=================
``__has_feature(address_sanitizer)``
------------------------------------
Initialization order checking
-----------------------------
AddressSanitizer can optionally detect dynamic initialization order problems,
when initialization of globals defined in one translation unit uses
globals defined in another translation unit. To enable this check at runtime,
you should set environment variable
``ASAN_OPTIONS=check_initialization_order=1``.
Note that this option is not supported on OS X.
Memory leak detection
---------------------
For more information on leak detector in AddressSanitizer, see
:doc:`LeakSanitizer`. The leak detection is turned on by default on Linux;
however, it is not yet supported on other platforms.
Issue Suppression
=================
AddressSanitizer is not expected to produce false positives. If you see one,
look again; most likely it is a true positive!
Suppressing Reports in External Libraries
-----------------------------------------
Runtime interposition allows AddressSanitizer to find bugs in code that is
not being recompiled. If you run into an issue in external libraries, we
recommend immediately reporting it to the library maintainer so that it
gets addressed. However, you can use the following suppression mechanism
to unblock yourself and continue on with the testing. This suppression
mechanism should only be used for suppressing issues in external code; it
does not work on code recompiled with AddressSanitizer. To suppress errors
in external libraries, set the ``ASAN_OPTIONS`` environment variable to point
to a suppression file. You can either specify the full path to the file or the
path of the file relative to the location of your executable.
.. code-block:: bash
ASAN_OPTIONS=suppressions=MyASan.supp
Use the following format to specify the names of the functions or libraries
you want to suppress. You can see these in the error report. Remember that
the narrower the scope of the suppression, the more bugs you will be able to
catch.
.. code-block:: bash
interceptor_via_fun:NameOfCFunctionToSuppress
interceptor_via_fun:-[ClassName objCMethodToSuppress:]
interceptor_via_lib:NameOfTheLibraryToSuppress
Conditional Compilation with ``__has_feature(address_sanitizer)``
-----------------------------------------------------------------
In some cases one may need to execute different code depending on whether
AddressSanitizer is enabled.
@ -122,28 +192,19 @@ this purpose.
# endif
#endif
``__attribute__((no_sanitize_address))``
-----------------------------------------------
Disabling Instrumentation with ``__attribute__((no_sanitize("address")))``
--------------------------------------------------------------------------
Some code should not be instrumented by AddressSanitizer. One may use the
function attribute
:ref:`no_sanitize_address <langext-address_sanitizer>`
(or a deprecated synonym `no_address_safety_analysis`)
to disable instrumentation of a particular function. This attribute may not be
supported by other compilers, so we suggest to use it together with
``__has_feature(address_sanitizer)``.
function attribute ``__attribute__((no_sanitize("address")))``
(which has deprecated synonyms
:ref:`no_sanitize_address <langext-address_sanitizer>` and
`no_address_safety_analysis`) to disable instrumentation of a particular
function. This attribute may not be supported by other compilers, so we suggest
to use it together with ``__has_feature(address_sanitizer)``.
Initialization order checking
-----------------------------
AddressSanitizer can optionally detect dynamic initialization order problems,
when initialization of globals defined in one translation unit uses
globals defined in another translation unit. To enable this check at runtime,
you should set environment variable
``ASAN_OPTIONS=check_initialization_order=1``.
Blacklist
---------
Suppressing Errors in Recompiled Code (Blacklist)
-------------------------------------------------
AddressSanitizer supports ``src`` and ``fun`` entity types in
:doc:`SanitizerSpecialCaseList`, that can be used to suppress error reports
@ -172,24 +233,6 @@ problems happening in certain source files or with certain global variables.
type:*BadInitClassSubstring*=init
src:bad/init/files/*=init
Memory leak detection
---------------------
For the experimental memory leak detector in AddressSanitizer, see
:doc:`LeakSanitizer`.
Supported Platforms
===================
AddressSanitizer is supported on
* Linux i386/x86\_64 (tested on Ubuntu 12.04);
* MacOS 10.6 - 10.9 (i386/x86\_64).
* Android ARM
* FreeBSD i386/x86\_64 (tested on FreeBSD 11-current)
Ports to various other platforms are in progress.
Limitations
===========
@ -202,6 +245,19 @@ Limitations
usually expected.
* Static linking is not supported.
Supported Platforms
===================
AddressSanitizer is supported on:
* Linux i386/x86\_64 (tested on Ubuntu 12.04)
* OS X 10.7 - 10.11 (i386/x86\_64)
* iOS Simulator
* Android ARM
* FreeBSD i386/x86\_64 (tested on FreeBSD 11-current)
Ports to various other platforms are in progress.
Current Status
==============

File diff suppressed because it is too large Load Diff

View File

@ -87,5 +87,8 @@ if (LLVM_ENABLE_SPHINX)
if (${SPHINX_OUTPUT_HTML})
add_sphinx_target(html clang)
endif()
if (${SPHINX_OUTPUT_MAN})
add_sphinx_target(man clang)
endif()
endif()
endif()

View File

@ -218,12 +218,19 @@ the configuration (without a prefix: ``Auto``).
If ``true``, ``while (true) continue;`` can be put on a
single line.
**AlwaysBreakAfterDefinitionReturnType** (``bool``)
If ``true``, always break after function definition return types.
**AlwaysBreakAfterDefinitionReturnType** (``DefinitionReturnTypeBreakingStyle``)
The function definition return type breaking style to use.
Possible values:
* ``DRTBS_None`` (in configuration: ``None``)
Break after return type automatically.
``PenaltyReturnTypeOnItsOwnLine`` is taken into account.
* ``DRTBS_All`` (in configuration: ``All``)
Always break after the return type.
* ``DRTBS_TopLevel`` (in configuration: ``TopLevel``)
Always break after the return types of top level functions.
More truthfully called 'break before the identifier following the type
in a function definition'. PenaltyReturnTypeOnItsOwnLine becomes
irrelevant.
**AlwaysBreakBeforeMultilineStrings** (``bool``)
If ``true``, always break before multiline string literals.
@ -327,7 +334,7 @@ the configuration (without a prefix: ``Auto``).
alignment of & and \*. ``PointerAlignment`` is then used only as fallback.
**DisableFormat** (``bool``)
Disables formatting at all.
Disables formatting completely.
**ExperimentalAutoDetectBinPacking** (``bool``)
If ``true``, clang-format detects whether function calls and

484
docs/CommandGuide/clang.rst Normal file
View File

@ -0,0 +1,484 @@
clang - the Clang C, C++, and Objective-C compiler
==================================================
SYNOPSIS
--------
:program:`clang` [*options*] *filename ...*
DESCRIPTION
-----------
:program:`clang` is a C, C++, and Objective-C compiler which encompasses
preprocessing, parsing, optimization, code generation, assembly, and linking.
Depending on which high-level mode setting is passed, Clang will stop before
doing a full link. While Clang is highly integrated, it is important to
understand the stages of compilation, to understand how to invoke it. These
stages are:
Driver
The clang executable is actually a small driver which controls the overall
execution of other tools such as the compiler, assembler and linker.
Typically you do not need to interact with the driver, but you
transparently use it to run the other tools.
Preprocessing
This stage handles tokenization of the input source file, macro expansion,
#include expansion and handling of other preprocessor directives. The
output of this stage is typically called a ".i" (for C), ".ii" (for C++),
".mi" (for Objective-C), or ".mii" (for Objective-C++) file.
Parsing and Semantic Analysis
This stage parses the input file, translating preprocessor tokens into a
parse tree. Once in the form of a parse tree, it applies semantic
analysis to compute types for expressions as well and determine whether
the code is well formed. This stage is responsible for generating most of
the compiler warnings as well as parse errors. The output of this stage is
an "Abstract Syntax Tree" (AST).
Code Generation and Optimization
This stage translates an AST into low-level intermediate code (known as
"LLVM IR") and ultimately to machine code. This phase is responsible for
optimizing the generated code and handling target-specific code generation.
The output of this stage is typically called a ".s" file or "assembly" file.
Clang also supports the use of an integrated assembler, in which the code
generator produces object files directly. This avoids the overhead of
generating the ".s" file and of calling the target assembler.
Assembler
This stage runs the target assembler to translate the output of the
compiler into a target object file. The output of this stage is typically
called a ".o" file or "object" file.
Linker
This stage runs the target linker to merge multiple object files into an
executable or dynamic library. The output of this stage is typically called
an "a.out", ".dylib" or ".so" file.
:program:`Clang Static Analyzer`
The Clang Static Analyzer is a tool that scans source code to try to find bugs
through code analysis. This tool uses many parts of Clang and is built into
the same driver. Please see <http://clang-analyzer.llvm.org> for more details
on how to use the static analyzer.
OPTIONS
-------
Stage Selection Options
~~~~~~~~~~~~~~~~~~~~~~~
.. option:: -E
Run the preprocessor stage.
.. option:: -fsyntax-only
Run the preprocessor, parser and type checking stages.
.. option:: -S
Run the previous stages as well as LLVM generation and optimization stages
and target-specific code generation, producing an assembly file.
.. option:: -c
Run all of the above, plus the assembler, generating a target ".o" object file.
.. option:: no stage selection option
If no stage selection option is specified, all stages above are run, and the
linker is run to combine the results into an executable or shared library.
Language Selection and Mode Options
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. option:: -x <language>
Treat subsequent input files as having type language.
.. option:: -std=<language>
Specify the language standard to compile for.
.. option:: -stdlib=<library>
Specify the C++ standard library to use; supported options are libstdc++ and
libc++.
.. option:: -ansi
Same as -std=c89.
.. option:: -ObjC, -ObjC++
Treat source input files as Objective-C and Object-C++ inputs respectively.
.. option:: -trigraphs
Enable trigraphs.
.. option:: -ffreestanding
Indicate that the file should be compiled for a freestanding, not a hosted,
environment.
.. option:: -fno-builtin
Disable special handling and optimizations of builtin functions like
:c:func:`strlen` and :c:func:`malloc`.
.. option:: -fmath-errno
Indicate that math functions should be treated as updating :c:data:`errno`.
.. option:: -fpascal-strings
Enable support for Pascal-style strings with "\\pfoo".
.. option:: -fms-extensions
Enable support for Microsoft extensions.
.. option:: -fmsc-version=
Set _MSC_VER. Defaults to 1300 on Windows. Not set otherwise.
.. option:: -fborland-extensions
Enable support for Borland extensions.
.. option:: -fwritable-strings
Make all string literals default to writable. This disables uniquing of
strings and other optimizations.
.. option:: -flax-vector-conversions
Allow loose type checking rules for implicit vector conversions.
.. option:: -fblocks
Enable the "Blocks" language feature.
.. option:: -fobjc-gc-only
Indicate that Objective-C code should be compiled in GC-only mode, which only
works when Objective-C Garbage Collection is enabled.
.. option:: -fobjc-gc
Indicate that Objective-C code should be compiled in hybrid-GC mode, which
works with both GC and non-GC mode.
.. option:: -fobjc-abi-version=version
Select the Objective-C ABI version to use. Available versions are 1 (legacy
"fragile" ABI), 2 (non-fragile ABI 1), and 3 (non-fragile ABI 2).
.. option:: -fobjc-nonfragile-abi-version=<version>
Select the Objective-C non-fragile ABI version to use by default. This will
only be used as the Objective-C ABI when the non-fragile ABI is enabled
(either via :option:`-fobjc-nonfragile-abi`, or because it is the platform
default).
.. option:: -fobjc-nonfragile-abi
Enable use of the Objective-C non-fragile ABI. On platforms for which this is
the default ABI, it can be disabled with :option:`-fno-objc-nonfragile-abi`.
Target Selection Options
~~~~~~~~~~~~~~~~~~~~~~~~
Clang fully supports cross compilation as an inherent part of its design.
Depending on how your version of Clang is configured, it may have support for a
number of cross compilers, or may only support a native target.
.. option:: -arch <architecture>
Specify the architecture to build for.
.. option:: -mmacosx-version-min=<version>
When building for Mac OS X, specify the minimum version supported by your
application.
.. option:: -miphoneos-version-min
When building for iPhone OS, specify the minimum version supported by your
application.
.. option:: -march=<cpu>
Specify that Clang should generate code for a specific processor family
member and later. For example, if you specify -march=i486, the compiler is
allowed to generate instructions that are valid on i486 and later processors,
but which may not exist on earlier ones.
Code Generation Options
~~~~~~~~~~~~~~~~~~~~~~~
.. option:: -O0, -O1, -O2, -O3, -Ofast, -Os, -Oz, -O, -O4
Specify which optimization level to use:
:option:`-O0` Means "no optimization": this level compiles the fastest and
generates the most debuggable code.
:option:`-O1` Somewhere between :option:`-O0` and :option:`-O2`.
:option:`-O2` Moderate level of optimization which enables most
optimizations.
:option:`-O3` Like :option:`-O2`, except that it enables optimizations that
take longer to perform or that may generate larger code (in an attempt to
make the program run faster).
:option:`-Ofast` Enables all the optimizations from :option:`-O3` along
with other aggressive optimizations that may violate strict compliance with
language standards.
:option:`-Os` Like :option:`-O2` with extra optimizations to reduce code
size.
:option:`-Oz` Like :option:`-Os` (and thus :option:`-O2`), but reduces code
size further.
:option:`-O` Equivalent to :option:`-O2`.
:option:`-O4` and higher
Currently equivalent to :option:`-O3`
.. option:: -g
Generate debug information. Note that Clang debug information works best at -O0.
.. option:: -fstandalone-debug -fno-standalone-debug
Clang supports a number of optimizations to reduce the size of debug
information in the binary. They work based on the assumption that the
debug type information can be spread out over multiple compilation units.
For instance, Clang will not emit type definitions for types that are not
needed by a module and could be replaced with a forward declaration.
Further, Clang will only emit type info for a dynamic C++ class in the
module that contains the vtable for the class.
The :option:`-fstandalone-debug` option turns off these optimizations.
This is useful when working with 3rd-party libraries that don't come with
debug information. This is the default on Darwin. Note that Clang will
never emit type information for types that are not referenced at all by the
program.
.. option:: -fexceptions
Enable generation of unwind information. This allows exceptions to be thrown
through Clang compiled stack frames. This is on by default in x86-64.
.. option:: -ftrapv
Generate code to catch integer overflow errors. Signed integer overflow is
undefined in C. With this flag, extra code is generated to detect this and
abort when it happens.
.. option:: -fvisibility
This flag sets the default visibility level.
.. option:: -fcommon
This flag specifies that variables without initializers get common linkage.
It can be disabled with :option:`-fno-common`.
.. option:: -ftls-model=<model>
Set the default thread-local storage (TLS) model to use for thread-local
variables. Valid values are: "global-dynamic", "local-dynamic",
"initial-exec" and "local-exec". The default is "global-dynamic". The default
model can be overridden with the tls_model attribute. The compiler will try
to choose a more efficient model if possible.
.. option:: -flto, -emit-llvm
Generate output files in LLVM formats, suitable for link time optimization.
When used with :option:`-S` this generates LLVM intermediate language
assembly files, otherwise this generates LLVM bitcode format object files
(which may be passed to the linker depending on the stage selection options).
Driver Options
~~~~~~~~~~~~~~
.. option:: -###
Print (but do not run) the commands to run for this compilation.
.. option:: --help
Display available options.
.. option:: -Qunused-arguments
Do not emit any warnings for unused driver arguments.
.. option:: -Wa,<args>
Pass the comma separated arguments in args to the assembler.
.. option:: -Wl,<args>
Pass the comma separated arguments in args to the linker.
.. option:: -Wp,<args>
Pass the comma separated arguments in args to the preprocessor.
.. option:: -Xanalyzer <arg>
Pass arg to the static analyzer.
.. option:: -Xassembler <arg>
Pass arg to the assembler.
.. option:: -Xlinker <arg>
Pass arg to the linker.
.. option:: -Xpreprocessor <arg>
Pass arg to the preprocessor.
.. option:: -o <file>
Write output to file.
.. option:: -print-file-name=<file>
Print the full library path of file.
.. option:: -print-libgcc-file-name
Print the library path for "libgcc.a".
.. option:: -print-prog-name=<name>
Print the full program path of name.
.. option:: -print-search-dirs
Print the paths used for finding libraries and programs.
.. option:: -save-temps
Save intermediate compilation results.
.. option:: -integrated-as, -no-integrated-as
Used to enable and disable, respectively, the use of the integrated
assembler. Whether the integrated assembler is on by default is target
dependent.
.. option:: -time
Time individual commands.
.. option:: -ftime-report
Print timing summary of each stage of compilation.
.. option:: -v
Show commands to run and use verbose output.
Diagnostics Options
~~~~~~~~~~~~~~~~~~~
.. option:: -fshow-column, -fshow-source-location, -fcaret-diagnostics, -fdiagnostics-fixit-info, -fdiagnostics-parseable-fixits, -fdiagnostics-print-source-range-info, -fprint-source-range-info, -fdiagnostics-show-option, -fmessage-length
These options control how Clang prints out information about diagnostics
(errors and warnings). Please see the Clang User's Manual for more information.
Preprocessor Options
~~~~~~~~~~~~~~~~~~~~
.. option:: -D<macroname>=<value>
Adds an implicit #define into the predefines buffer which is read before the
source file is preprocessed.
.. option:: -U<macroname>
Adds an implicit #undef into the predefines buffer which is read before the
source file is preprocessed.
.. option:: -include <filename>
Adds an implicit #include into the predefines buffer which is read before the
source file is preprocessed.
.. option:: -I<directory>
Add the specified directory to the search path for include files.
.. option:: -F<directory>
Add the specified directory to the search path for framework include files.
.. option:: -nostdinc
Do not search the standard system directories or compiler builtin directories
for include files.
.. option:: -nostdlibinc
Do not search the standard system directories for include files, but do
search compiler builtin include directories.
.. option:: -nobuiltininc
Do not search clang's builtin directory for include files.
ENVIRONMENT
-----------
.. envvar:: TMPDIR, TEMP, TMP
These environment variables are checked, in order, for the location to write
temporary files used during the compilation process.
.. envvar:: CPATH
If this environment variable is present, it is treated as a delimited list of
paths to be added to the default system include path list. The delimiter is
the platform dependent delimiter, as used in the PATH environment variable.
Empty components in the environment variable are ignored.
.. envvar:: C_INCLUDE_PATH, OBJC_INCLUDE_PATH, CPLUS_INCLUDE_PATH, OBJCPLUS_INCLUDE_PATH
These environment variables specify additional paths, as for :envvar:`CPATH`, which are
only used when processing the appropriate language.
.. envvar:: MACOSX_DEPLOYMENT_TARGET
If :option:`-mmacosx-version-min` is unspecified, the default deployment
target is read from this environment variable. This option only affects
Darwin targets.
BUGS
----
To report bugs, please visit <http://llvm.org/bugs/>. Most bug reports should
include preprocessed source files (use the :option:`-E` option) and the full
output of the compiler, along with information to reproduce.
SEE ALSO
--------
:manpage:`as(1)`, :manpage:`ld(1)`

View File

@ -0,0 +1,17 @@
Clang "man" pages
-----------------
The following documents are command descriptions for all of the Clang tools.
These pages describe how to use the Clang commands and what their options are.
Note that these pages do not describe all of the options available for all
tools. To get a complete listing, pass the ``--help`` (general options) or
``--help-hidden`` (general and debugging options) arguments to the tool you are
interested in.
Basic Commands
~~~~~~~~~~~~~~
.. toctree::
:maxdepth: 1
clang

View File

@ -155,7 +155,7 @@ The driver functionality is conceptually divided into five stages:
Subsequent stages should rarely, if ever, need to do any string
processing.
#. **Pipeline: Compilation Job Construction**
#. **Pipeline: Compilation Action Construction**
Once the arguments are parsed, the tree of subprocess jobs needed for
the desired compilation sequence are constructed. This involves
@ -266,7 +266,7 @@ The driver functionality is conceptually divided into five stages:
#. **Translate: Tool Specific Argument Translation**
Once a Tool has been selected to perform a particular Action, the
Tool must construct concrete Jobs which will be executed during
Tool must construct concrete Commands which will be executed during
compilation. The main work is in translating from the gcc style
command line options to whatever options the subprocess expects.
@ -280,7 +280,7 @@ The driver functionality is conceptually divided into five stages:
last of arguments corresponding to some option, or all arguments for
an option.
The result of this stage is a list of Jobs (executable paths and
The result of this stage is a list of Commands (executable paths and
argument strings) to execute.
#. **Execute**

View File

@ -17,7 +17,8 @@ only, at a minimal performance cost.
Current status
==============
LeakSanitizer is experimental and supported only on x86\_64 Linux.
LeakSanitizer is turned on by default, but it is only supported on x86\_64
Linux.
The combined mode has been tested on fairly large software projects. The
stand-alone mode has received much less testing.

View File

@ -1434,6 +1434,16 @@ Usable as: Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1Charac
Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1FloatingLiteral.html">FloatingLiteral</a>&gt;, Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1IntegerLiteral.html">IntegerLiteral</a>&gt;
</pre></td></tr>
<tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXCatchStmt.html">CXXCatchStmt</a>&gt;</td><td class="name" onclick="toggle('isCatchAll1')"><a name="isCatchAll1Anchor">isCatchAll</a></td><td></td></tr>
<tr><td colspan="4" class="doc" id="isCatchAll1"><pre>Matches a C++ catch statement that has a handler that catches any exception type.
Example matches catch(...) (matcher = catchStmt(isCatchAll()))
try {
// ...
} catch(...) {
}
</pre></td></tr>
<tr><td>Matcher&lt<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>&gt;</td><td class="name" onclick="toggle('argumentCountIs1')"><a name="argumentCountIs1Anchor">argumentCountIs</a></td><td>unsigned N</td></tr>
<tr><td colspan="4" class="doc" id="argumentCountIs1"><pre>Checks that a call expression or a constructor call expression has

View File

@ -8,7 +8,6 @@
##===----------------------------------------------------------------------===##
CLANG_LEVEL := ..
DIRS := tools
ifdef BUILD_FOR_WEBSITE
PROJ_OBJ_DIR = .

View File

@ -119,8 +119,8 @@ Objective-C provides a new syntax for boxing C expressions:
@( <expression> )
Expressions of scalar (numeric, enumerated, BOOL) and C string pointer
types are supported:
Expressions of scalar (numeric, enumerated, BOOL), C string pointer
and some C structures (via NSValue) are supported:
.. code-block:: objc
@ -136,6 +136,12 @@ types are supported:
NSString *path = @(getenv("PATH")); // [NSString stringWithUTF8String:(getenv("PATH"))]
NSArray *pathComponents = [path componentsSeparatedByString:@":"];
// structs.
NSValue *center = @(view.center); // Point p = view.center;
// [NSValue valueWithBytes:&p objCType:@encode(Point)];
NSValue *frame = @(view.frame); // Rect r = view.frame;
// [NSValue valueWithBytes:&r objCType:@encode(Rect)];
Boxed Enums
-----------
@ -218,6 +224,42 @@ character data is valid. Passing ``NULL`` as the character pointer will
raise an exception at runtime. When possible, the compiler will reject
``NULL`` character pointers used in boxed expressions.
Boxed C Structures
------------------
Boxed expressions support construction of NSValue objects.
It said that C structures can be used, the only requirement is:
structure should be marked with ``objc_boxable`` attribute.
To support older version of frameworks and/or third-party libraries
you may need to add the attribute via ``typedef``.
.. code-block:: objc
struct __attribute__((objc_boxable)) Point {
// ...
};
typedef struct __attribute__((objc_boxable)) _Size {
// ...
} Size;
typedef struct _Rect {
// ...
} Rect;
struct Point p;
NSValue *point = @(p); // ok
Size s;
NSValue *size = @(s); // ok
Rect r;
NSValue *bad_rect = @(r); // error
typedef struct __attribute__((objc_boxable)) _Rect Rect;
NSValue *good_rect = @(r); // ok
Container Literals
==================
@ -539,6 +581,22 @@ checks. Here are examples of their use:
}
#endif
#if __has_attribute(objc_boxable)
typedef struct __attribute__((objc_boxable)) _Rect Rect;
#endif
#if __has_feature(objc_boxed_nsvalue_expressions)
CABasicAnimation animation = [CABasicAnimation animationWithKeyPath:@"position"];
animation.fromValue = @(layer.position);
animation.toValue = @(newPosition);
[layer addAnimation:animation forKey:@"move"];
#else
CABasicAnimation animation = [CABasicAnimation animationWithKeyPath:@"position"];
animation.fromValue = [NSValue valueWithCGPoint:layer.position];
animation.toValue = [NSValue valueWithCGPoint:newPosition];
[layer addAnimation:animation forKey:@"move"];
#endif
Code can use also ``__has_feature(objc_bool)`` to check for the
availability of numeric literals support. This checks for the new
``__objc_yes / __objc_no`` keywords, which enable the use of

View File

@ -15,14 +15,17 @@ the safe stack and the unsafe stack. The safe stack stores return addresses,
register spills, and local variables that are always accessed in a safe way,
while the unsafe stack stores everything else. This separation ensures that
buffer overflows on the unsafe stack cannot be used to overwrite anything
on the safe stack, which includes return addresses.
on the safe stack.
SafeStack is a part of the `Code-Pointer Integrity (CPI) Project
<http://dslab.epfl.ch/proj/cpi/>`_.
Performance
-----------
The performance overhead of the SafeStack instrumentation is less than 0.1% on
average across a variety of benchmarks (see the `Code-Pointer Integrity
<http://dslab.epfl.ch/pubs/cpi.pdf>`_ paper for details). This is mainly
<http://dslab.epfl.ch/pubs/cpi.pdf>`__ paper for details). This is mainly
because most small functions do not have any variables that require the unsafe
stack and, hence, do not need unsafe stack frames to be created. The cost of
creating unsafe stack frames for large functions is amortized by the cost of
@ -34,37 +37,6 @@ used through multiple stack frames. Moving such objects away from the safe
stack increases the locality of frequently accessed values on the stack, such
as register spills, return addresses, and small local variables.
Limitations
-----------
SafeStack has not been subjected to a comprehensive security review, and there
exist known weaknesses, including but not limited to the following.
In its current state, the separation of local variables provides protection
against stack buffer overflows, but the safe stack itself is not protected
from being corrupted through a pointer dereference. The Code-Pointer
Integrity paper describes two ways in which we may protect the safe stack:
hardware segmentation on the 32-bit x86 architecture or information hiding
on other architectures.
Even with information hiding, the safe stack would merely be hidden
from attackers by being somewhere in the address space. Depending on the
application, the address could be predictable even on 64-bit address spaces
because not all the bits are addressable, multiple threads each have their
stack, the application could leak the safe stack address to memory via
``__builtin_frame_address``, bugs in the low-level runtime support etc.
Safe stack leaks could be mitigated by writing and deploying a static binary
analysis or a dynamic binary instrumentation based tool to find leaks.
This approach doesn't prevent an attacker from "imbalancing" the safe
stack by say having just one call, and doing two rets (thereby returning
to an address that wasn't meant as a return address). This can be at least
partially mitigated by deploying SafeStack alongside a forward control-flow
integrity mechanism to ensure that calls are made using the correct calling
convention. Clang does not currently implement a comprehensive forward
control-flow integrity protection scheme; there exists one that protects
:doc:`virtual calls <ControlFlowIntegrity>` but not non-virtual indirect calls.
Compatibility
-------------
@ -83,21 +55,73 @@ work with SafeStack. One example is mark-and-sweep garbage collection
implementations for C/C++ (e.g., Oilpan in chromium/blink), which must be
changed to look for the live pointers on both safe and unsafe stacks.
SafeStack supports linking together modules that are compiled with and without
SafeStack, both statically and dynamically. One corner case that is not
supported is using ``dlopen()`` to load a dynamic library that uses SafeStack into
a program that is not compiled with SafeStack but uses threads.
SafeStack supports linking statically modules that are compiled with and
without SafeStack. An executable compiled with SafeStack can load dynamic
libraries that are not compiled with SafeStack. At the moment, compiling
dynamic libraries with SafeStack is not supported.
Signal handlers that use ``sigaltstack()`` must not use the unsafe stack (see
``__attribute__((no_sanitize("safe-stack")))`` below).
Programs that use APIs from ``ucontext.h`` are not supported yet.
Security
--------
SafeStack protects return addresses, spilled registers and local variables that
are always accessed in a safe way by separating them in a dedicated safe stack
region. The safe stack is automatically protected against stack-based buffer
overflows, since it is disjoint from the unsafe stack in memory, and it itself
is always accessed in a safe way. In the current implementation, the safe stack
is protected against arbitrary memory write vulnerabilities though
randomization and information hiding: the safe stack is allocated at a random
address and the instrumentation ensures that no pointers to the safe stack are
ever stored outside of the safe stack itself (see limitations below).
Known security limitations
~~~~~~~~~~~~~~~~~~~~~~~~~~
A complete protection against control-flow hijack attacks requires combining
SafeStack with another mechanism that enforces the integrity of code pointers
that are stored on the heap or the unsafe stack, such as `CPI
<http://dslab.epfl.ch/proj/cpi/>`_, or a forward-edge control flow integrity
mechanism that enforces correct calling conventions at indirect call sites,
such as `IFCC <http://research.google.com/pubs/archive/42808.pdf>`_ with arity
checks. Clang has control-flow integrity protection scheme for :doc:`C++ virtual
calls <ControlFlowIntegrity>`, but not non-virtual indirect calls. With
SafeStack alone, an attacker can overwrite a function pointer on the heap or
the unsafe stack and cause a program to call arbitrary location, which in turn
might enable stack pivoting and return-oriented programming.
In its current implementation, SafeStack provides precise protection against
stack-based buffer overflows, but protection against arbitrary memory write
vulnerabilities is probabilistic and relies on randomization and information
hiding. The randomization is currently based on system-enforced ASLR and shares
its known security limitations. The safe stack pointer hiding is not perfect
yet either: system library functions such as ``swapcontext``, exception
handling mechanisms, intrinsics such as ``__builtin_frame_address``, or
low-level bugs in runtime support could leak the safe stack pointer. In the
future, such leaks could be detected by static or dynamic analysis tools and
prevented by adjusting such functions to either encrypt the stack pointer when
storing it in the heap (as already done e.g., by ``setjmp``/``longjmp``
implementation in glibc), or store it in a safe region instead.
The `CPI paper <http://dslab.epfl.ch/pubs/cpi.pdf>`_ describes two alternative,
stronger safe stack protection mechanisms, that rely on software fault
isolation, or hardware segmentation (as available on x86-32 and some x86-64
CPUs).
At the moment, SafeStack assumes that the compiler's implementation is correct.
This has not been verified except through manual code inspection, and could
always regress in the future. It's therefore desirable to have a separate
static or dynamic binary verification tool that would check the correctness of
the SafeStack instrumentation in final binaries.
Usage
=====
To enable SafeStack, just pass ``-fsanitize=safe-stack`` flag to both compile and link
command lines.
To enable SafeStack, just pass ``-fsanitize=safe-stack`` flag to both compile
and link command lines.
Supported Platforms
-------------------
@ -129,10 +153,11 @@ function, even if enabled globally (see ``-fsanitize=safe-stack`` flag). This
attribute may be required for functions that make assumptions about the
exact layout of their stack frames.
Care should be taken when using this attribute. The return address is not
protected against stack buffer overflows, and it is easier to leak the
address of the safe stack to memory by taking the address of a local variable.
All local variables in functions with this attribute will be stored on the safe
stack. The safe stack remains unprotected against memory errors when accessing
these variables, so extra care must be taken to manually ensure that all such
accesses are safe. Furthermore, the addresses of such local variables should
never be stored on the heap, as it would leak the location of the SafeStack.
``__builtin___get_unsafe_stack_ptr()``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -149,15 +174,14 @@ current thread.
Design
======
Please refer to
`http://dslab.epfl.ch/proj/cpi/ <http://dslab.epfl.ch/proj/cpi/>`_ for more
information about the design of the SafeStack and its related technologies.
Please refer to the `Code-Pointer Integrity <http://dslab.epfl.ch/proj/cpi/>`__
project page for more information about the design of the SafeStack and its
related technologies.
Publications
------------
`Code-Pointer Integrity <http://dslab.epfl.ch/pubs/cpi.pdf>`_.
`Code-Pointer Integrity <http://dslab.epfl.ch/pubs/cpi.pdf>`__.
Volodymyr Kuznetsov, Laszlo Szekeres, Mathias Payer, George Candea, R. Sekar, Dawn Song.
USENIX Symposium on Operating Systems Design and Implementation
(`OSDI <https://www.usenix.org/conference/osdi14>`_), Broomfield, CO, October 2014

View File

@ -41,7 +41,7 @@
# General information about the project.
project = u'Clang'
copyright = u'2007-2014, The Clang Team'
copyright = u'2007-2015, The Clang Team'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
@ -212,10 +212,40 @@
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
('index', 'clang', u'Clang Documentation',
[u'The Clang Team'], 1)
]
man_pages = []
# Automatically derive the list of man pages from the contents of the command
# guide subdirectory. This was copied from llvm/docs/conf.py.
basedir = os.path.dirname(__file__)
man_page_authors = u'Maintained by the Clang / LLVM Team (<http://clang.llvm.org>)'
command_guide_subpath = 'CommandGuide'
command_guide_path = os.path.join(basedir, command_guide_subpath)
for name in os.listdir(command_guide_path):
# Ignore non-ReST files and the index page.
if not name.endswith('.rst') or name in ('index.rst',):
continue
# Otherwise, automatically extract the description.
file_subpath = os.path.join(command_guide_subpath, name)
with open(os.path.join(command_guide_path, name)) as f:
title = f.readline().rstrip('\n')
header = f.readline().rstrip('\n')
if len(header) != len(title):
print >>sys.stderr, (
"error: invalid header in %r (does not match title)" % (
file_subpath,))
if ' - ' not in title:
print >>sys.stderr, (
("error: invalid title in %r "
"(expected '<name> - <description>')") % (
file_subpath,))
# Split the name out of the title.
name,description = title.split(' - ', 1)
man_pages.append((file_subpath.replace('.rst',''), name,
description, man_page_authors, 1))
# If true, show URL addresses after external links.
#man_show_urls = False

View File

@ -32,6 +32,7 @@ Using Clang as a Compiler
SafeStack
Modules
MSVCCompatibility
CommandGuide/index
FAQ
Using Clang as a Library

View File

@ -1,116 +0,0 @@
##===- docs/tools/Makefile ---------------------------------*- Makefile -*-===##
#
# The LLVM Compiler Infrastructure
#
# This file is distributed under the University of Illinois Open Source
# License. See LICENSE.TXT for details.
#
##===----------------------------------------------------------------------===##
ifdef BUILD_FOR_WEBSITE
# FIXME: This was copied from the CommandGuide makefile. Figure out
# how to get this stuff on the website.
# This special case is for keeping the CommandGuide on the LLVM web site
# up to date automatically as the documents are checked in. It must build
# the POD files to HTML only and keep them in the src directories. It must also
# build in an unconfigured tree, hence the ifdef. To use this, run
# make -s BUILD_FOR_WEBSITE=1 inside the cvs commit script.
SRC_DOC_DIR=
DST_HTML_DIR=html/
DST_MAN_DIR=man/man1/
DST_PS_DIR=ps/
CLANG_VERSION := trunk
# If we are in BUILD_FOR_WEBSITE mode, default to the all target.
all:: html man ps
clean:
rm -f pod2htm*.*~~ $(HTML) $(MAN) $(PS)
# To create other directories, as needed, and timestamp their creation
%/.dir:
-mkdir $* > /dev/null
date > $@
else
# Otherwise, if not in BUILD_FOR_WEBSITE mode, use the project info.
CLANG_LEVEL := ../..
include $(CLANG_LEVEL)/Makefile
CLANG_VERSION := $(word 3,$(shell grep "CLANG_VERSION " \
$(PROJ_OBJ_DIR)/$(CLANG_LEVEL)/include/clang/Basic/Version.inc))
SRC_DOC_DIR=$(PROJ_SRC_DIR)/
DST_HTML_DIR=$(PROJ_OBJ_DIR)/
DST_MAN_DIR=$(PROJ_OBJ_DIR)/
DST_PS_DIR=$(PROJ_OBJ_DIR)/
endif
POD := $(wildcard $(SRC_DOC_DIR)*.pod)
HTML := $(patsubst $(SRC_DOC_DIR)%.pod, $(DST_HTML_DIR)%.html, $(POD))
MAN := $(patsubst $(SRC_DOC_DIR)%.pod, $(DST_MAN_DIR)%.1, $(POD))
PS := $(patsubst $(SRC_DOC_DIR)%.pod, $(DST_PS_DIR)%.ps, $(POD))
ifdef ONLY_MAN_DOCS
INSTALL_TARGETS := install-man
else
INSTALL_TARGETS := install-html install-man install-ps
endif
.SUFFIXES:
.SUFFIXES: .html .pod .1 .ps
$(DST_HTML_DIR)%.html: %.pod $(DST_HTML_DIR)/.dir
pod2html --css=manpage.css --htmlroot=. \
--podpath=. --infile=$< --outfile=$@ --title=$*
$(DST_MAN_DIR)%.1: %.pod $(DST_MAN_DIR)/.dir
pod2man --release "clang $(CLANG_VERSION)" --center="Clang Tools Documentation" $< $@
$(DST_PS_DIR)%.ps: $(DST_MAN_DIR)%.1 $(DST_PS_DIR)/.dir
groff -Tps -man $< > $@
html: $(HTML)
man: $(MAN)
ps: $(PS)
EXTRA_DIST := $(POD)
clean-local::
$(Verb) $(RM) -f pod2htm*.*~~ $(HTML) $(MAN) $(PS)
HTML_DIR := $(DESTDIR)$(PROJ_docsdir)/html/clang
MAN_DIR := $(DESTDIR)$(PROJ_mandir)/man1
PS_DIR := $(DESTDIR)$(PROJ_docsdir)/ps
install-html:: $(HTML)
$(Echo) Installing HTML Clang Tools Documentation
$(Verb) $(MKDIR) $(HTML_DIR)
$(Verb) $(DataInstall) $(HTML) $(HTML_DIR)
$(Verb) $(DataInstall) $(PROJ_SRC_DIR)/manpage.css $(HTML_DIR)
install-man:: $(MAN)
$(Echo) Installing MAN Clang Tools Documentation
$(Verb) $(MKDIR) $(MAN_DIR)
$(Verb) $(DataInstall) $(MAN) $(MAN_DIR)
install-ps:: $(PS)
$(Echo) Installing PS Clang Tools Documentation
$(Verb) $(MKDIR) $(PS_DIR)
$(Verb) $(DataInstall) $(PS) $(PS_DIR)
install-local:: $(INSTALL_TARGETS)
uninstall-local::
$(Echo) Uninstalling Clang Tools Documentation
$(Verb) $(RM) -rf $(HTML_DIR) $(MAN_DIR) $(PS_DIR)
printvars::
$(Echo) "POD : " '$(POD)'
$(Echo) "HTML : " '$(HTML)'

View File

@ -1,614 +0,0 @@
=pod
=head1 NAME
clang - the Clang C, C++, and Objective-C compiler
=head1 SYNOPSIS
B<clang> [B<-c>|B<-S>|B<-E>] B<-std=>I<standard> B<-g>
[B<-O0>|B<-O1>|B<-O2>|B<-O3>|B<-Ofast>|B<-Os>|B<-Oz>|B<-O>|B<-O4>]
B<-W>I<warnings...> B<-pedantic>
B<-I>I<dir...> B<-L>I<dir...>
B<-D>I<macro[=defn]>
B<-f>I<feature-option...>
B<-m>I<machine-option...>
B<-o> I<output-file>
B<-stdlib=>I<library>
I<input-filenames>
=head1 DESCRIPTION
B<clang> is a C, C++, and Objective-C compiler which encompasses preprocessing,
parsing, optimization, code generation, assembly, and linking. Depending on
which high-level mode setting is passed, Clang will stop before doing a full
link. While Clang is highly integrated, it is important to understand the
stages of compilation, to understand how to invoke it. These stages are:
=over
=item B<Driver>
The B<clang> executable is actually a small driver which controls the overall
execution of other tools such as the compiler, assembler and linker. Typically
you do not need to interact with the driver, but you transparently use it to run
the other tools.
=item B<Preprocessing>
This stage handles tokenization of the input source file, macro expansion,
#include expansion and handling of other preprocessor directives. The output of
this stage is typically called a ".i" (for C), ".ii" (for C++), ".mi" (for
Objective-C), or ".mii" (for Objective-C++) file.
=item B<Parsing and Semantic Analysis>
This stage parses the input file, translating preprocessor tokens into a parse
tree. Once in the form of a parse tree, it applies semantic analysis to compute
types for expressions as well and determine whether the code is well formed. This
stage is responsible for generating most of the compiler warnings as well as
parse errors. The output of this stage is an "Abstract Syntax Tree" (AST).
=item B<Code Generation and Optimization>
This stage translates an AST into low-level intermediate code (known as "LLVM
IR") and ultimately to machine code. This phase is responsible for optimizing
the generated code and handling target-specific code generation. The output of
this stage is typically called a ".s" file or "assembly" file.
Clang also supports the use of an integrated assembler, in which the code
generator produces object files directly. This avoids the overhead of generating
the ".s" file and of calling the target assembler.
=item B<Assembler>
This stage runs the target assembler to translate the output of the compiler
into a target object file. The output of this stage is typically called a ".o"
file or "object" file.
=item B<Linker>
This stage runs the target linker to merge multiple object files into an
executable or dynamic library. The output of this stage is typically called an
"a.out", ".dylib" or ".so" file.
=back
The Clang compiler supports a large number of options to control each of these
stages. In addition to compilation of code, Clang also supports other tools:
B<Clang Static Analyzer>
The Clang Static Analyzer is a tool that scans source code to try to find bugs
through code analysis. This tool uses many parts of Clang and is built into the
same driver. Please see L<http://clang-analyzer.llvm.org> for more details
on how to use the static analyzer.
=head1 OPTIONS
=head2 Stage Selection Options
=over
=item B<-E>
Run the preprocessor stage.
=item B<-fsyntax-only>
Run the preprocessor, parser and type checking stages.
=item B<-S>
Run the previous stages as well as LLVM generation and optimization stages and
target-specific code generation, producing an assembly file.
=item B<-c>
Run all of the above, plus the assembler, generating a target ".o" object file.
=item B<no stage selection option>
If no stage selection option is specified, all stages above are run, and the
linker is run to combine the results into an executable or shared library.
=back
=head2 Language Selection and Mode Options
=over
=item B<-x> I<language>
Treat subsequent input files as having type I<language>.
=item B<-std>=I<language>
Specify the language standard to compile for.
=item B<-stdlib>=I<library>
Specify the C++ standard library to use; supported options are libstdc++ and
libc++.
=item B<-ansi>
Same as B<-std=c89>.
=item B<-ObjC++>
Treat source input files as Objective-C++ inputs.
=item B<-ObjC>
Treat source input files as Objective-C inputs.
=item B<-trigraphs>
Enable trigraphs.
=item B<-ffreestanding>
Indicate that the file should be compiled for a freestanding, not a hosted,
environment.
=item B<-fno-builtin>
Disable special handling and optimizations of builtin functions like strlen and
malloc.
=item B<-fmath-errno>
Indicate that math functions should be treated as updating errno.
=item B<-fpascal-strings>
Enable support for Pascal-style strings with "\pfoo".
=item B<-fms-extensions>
Enable support for Microsoft extensions.
=item B<-fmsc-version=>
Set _MSC_VER. Defaults to 1300 on Windows. Not set otherwise.
=item B<-fborland-extensions>
Enable support for Borland extensions.
=item B<-fwritable-strings>
Make all string literals default to writable. This disables uniquing of
strings and other optimizations.
=item B<-flax-vector-conversions>
Allow loose type checking rules for implicit vector conversions.
=item B<-fblocks>
Enable the "Blocks" language feature.
=item B<-fobjc-gc-only>
Indicate that Objective-C code should be compiled in GC-only mode, which only
works when Objective-C Garbage Collection is enabled.
=item B<-fobjc-gc>
Indicate that Objective-C code should be compiled in hybrid-GC mode, which works
with both GC and non-GC mode.
=item B<-fobjc-abi-version>=I<version>
Select the Objective-C ABI version to use. Available versions are 1 (legacy
"fragile" ABI), 2 (non-fragile ABI 1), and 3 (non-fragile ABI 2).
=item B<-fobjc-nonfragile-abi-version>=I<version>
Select the Objective-C non-fragile ABI version to use by default. This will only
be used as the Objective-C ABI when the non-fragile ABI is enabled (either via
-fobjc-nonfragile-abi, or because it is the platform default).
=item B<-fobjc-nonfragile-abi>
Enable use of the Objective-C non-fragile ABI. On platforms for which this is
the default ABI, it can be disabled with B<-fno-objc-nonfragile-abi>.
=back
=head2 Target Selection Options
Clang fully supports cross compilation as an inherent part of its design.
Depending on how your version of Clang is configured, it may have support for
a number of cross compilers, or may only support a native target.
=over
=item B<-arch> I<architecture>
Specify the architecture to build for.
=item B<-mmacosx-version-min>=I<version>
When building for Mac OS X, specify the minimum version supported by your
application.
=item B<-miphoneos-version-min>
When building for iPhone OS, specify the minimum version supported by your
application.
=item B<-march>=I<cpu>
Specify that Clang should generate code for a specific processor family member
and later. For example, if you specify -march=i486, the compiler is allowed to
generate instructions that are valid on i486 and later processors, but which
may not exist on earlier ones.
=back
=head2 Code Generation Options
=over
=item B<-O0> B<-O1> B<-O2> B<-O3> B<-Ofast> B<-Os> B<-Oz> B<-O> B<-O4>
Specify which optimization level to use:
=over
=item B<-O0>
Means "no optimization": this level compiles the fastest and
generates the most debuggable code.
=item B<-O1>
Somewhere between B<-O0> and B<-O2>.
=item B<-O2>
Moderate level of optimization which enables most optimizations.
=item B<-O3>
Like B<-O2>, except that it enables optimizations that take longer to perform
or that may generate larger code (in an attempt to make the program run faster).
=item B<-Ofast>
Enables all the optimizations from B<-O3> along with other aggressive
optimizations that may violate strict compliance with language standards.
=item B<-Os>
Like B<-O2> with extra optimizations to reduce code size.
=item B<-Oz>
Like B<-Os> (and thus B<-O2>), but reduces code size further.
=item B<-O>
Equivalent to B<-O2>.
=item B<-O4> and higher
Currently equivalent to B<-O3>
=back
=item B<-g>
Generate debug information. Note that Clang debug information works best at
B<-O0>.
=item B<-fstandalone-debug> B<-fno-standalone-debug>
Clang supports a number of optimizations to reduce the size of debug
information in the binary. They work based on the assumption that the
debug type information can be spread out over multiple compilation
units. For instance, Clang will not emit type definitions for types
that are not needed by a module and could be replaced with a forward
declaration. Further, Clang will only emit type info for a dynamic
C++ class in the module that contains the vtable for the class.
The B<-fstandalone-debug> option turns off these optimizations. This
is useful when working with 3rd-party libraries that don't come with
debug information. This is the default on Darwin. Note that Clang
will never emit type information for types that are not referenced at
all by the program.
=item B<-fexceptions>
Enable generation of unwind information. This allows exceptions to be thrown
through Clang compiled stack frames. This is on by default in x86-64.
=item B<-ftrapv>
Generate code to catch integer overflow errors. Signed integer overflow is
undefined in C. With this flag, extra code is generated to detect this and abort
when it happens.
=item B<-fvisibility>
This flag sets the default visibility level.
=item B<-fcommon>
This flag specifies that variables without initializers get common linkage. It
can be disabled with B<-fno-common>.
=item B<-ftls-model>
Set the default thread-local storage (TLS) model to use for thread-local
variables. Valid values are: "global-dynamic", "local-dynamic", "initial-exec"
and "local-exec". The default is "global-dynamic". The default model can be
overridden with the tls_model attribute. The compiler will try to choose a more
efficient model if possible.
=item B<-flto> B<-emit-llvm>
Generate output files in LLVM formats, suitable for link time optimization. When
used with B<-S> this generates LLVM intermediate language assembly files,
otherwise this generates LLVM bitcode format object files (which may be passed
to the linker depending on the stage selection options).
=cut
##=item B<-fnext-runtime> B<-fobjc-nonfragile-abi> B<-fgnu-runtime>
##These options specify which Objective-C runtime the code generator should
##target. FIXME: we don't want people poking these generally.
=pod
=back
=head2 Driver Options
=over
=item B<-###>
Print (but do not run) the commands to run for this compilation.
=item B<--help>
Display available options.
=item B<-Qunused-arguments>
Do not emit any warnings for unused driver arguments.
=item B<-Wa,>I<args>
Pass the comma separated arguments in I<args> to the assembler.
=item B<-Wl,>I<args>
Pass the comma separated arguments in I<args> to the linker.
=item B<-Wp,>I<args>
Pass the comma separated arguments in I<args> to the preprocessor.
=item B<-Xanalyzer> I<arg>
Pass I<arg> to the static analyzer.
=item B<-Xassembler> I<arg>
Pass I<arg> to the assembler.
=item B<-Xlinker> I<arg>
Pass I<arg> to the linker.
=item B<-Xpreprocessor> I<arg>
Pass I<arg> to the preprocessor.
=item B<-o> I<file>
Write output to I<file>.
=item B<-print-file-name>=I<file>
Print the full library path of I<file>.
=item B<-print-libgcc-file-name>
Print the library path for "libgcc.a".
=item B<-print-prog-name>=I<name>
Print the full program path of I<name>.
=item B<-print-search-dirs>
Print the paths used for finding libraries and programs.
=item B<-save-temps>
Save intermediate compilation results.
=item B<-integrated-as> B<-no-integrated-as>
Used to enable and disable, respectively, the use of the integrated
assembler. Whether the integrated assembler is on by default is target
dependent.
=item B<-time>
Time individual commands.
=item B<-ftime-report>
Print timing summary of each stage of compilation.
=item B<-v>
Show commands to run and use verbose output.
=back
=head2 Diagnostics Options
=over
=item B<-fshow-column>
B<-fshow-source-location>
B<-fcaret-diagnostics>
B<-fdiagnostics-fixit-info>
B<-fdiagnostics-parseable-fixits>
B<-fdiagnostics-print-source-range-info>
B<-fprint-source-range-info>
B<-fdiagnostics-show-option>
B<-fmessage-length>
These options control how Clang prints out information about diagnostics (errors
and warnings). Please see the Clang User's Manual for more information.
=back
=head2 Preprocessor Options
=over
=item B<-D>I<macroname=value>
Adds an implicit #define into the predefines buffer which is read before the
source file is preprocessed.
=item B<-U>I<macroname>
Adds an implicit #undef into the predefines buffer which is read before the
source file is preprocessed.
=item B<-include> I<filename>
Adds an implicit #include into the predefines buffer which is read before the
source file is preprocessed.
=item B<-I>I<directory>
Add the specified directory to the search path for include files.
=item B<-F>I<directory>
Add the specified directory to the search path for framework include files.
=item B<-nostdinc>
Do not search the standard system directories or compiler builtin directories
for include files.
=item B<-nostdlibinc>
Do not search the standard system directories for include files, but do search
compiler builtin include directories.
=item B<-nobuiltininc>
Do not search clang's builtin directory for include files.
=cut
## TODO, but do we really want people using this stuff?
#=item B<-idirafter>I<directory>
#=item B<-iquote>I<directory>
#=item B<-isystem>I<directory>
#=item B<-iprefix>I<directory>
#=item B<-iwithprefix>I<directory>
#=item B<-iwithprefixbefore>I<directory>
#=item B<-isysroot>
=pod
=back
=cut
### TODO someday.
#=head2 Warning Control Options
#=over
#=back
#=head2 Code Generation and Optimization Options
#=over
#=back
#=head2 Assembler Options
#=over
#=back
#=head2 Linker Options
#=over
#=back
#=head2 Static Analyzer Options
#=over
#=back
=pod
=head1 ENVIRONMENT
=over
=item B<TMPDIR>, B<TEMP>, B<TMP>
These environment variables are checked, in order, for the location to
write temporary files used during the compilation process.
=item B<CPATH>
If this environment variable is present, it is treated as a delimited
list of paths to be added to the default system include path list. The
delimiter is the platform dependent delimiter, as used in the I<PATH>
environment variable.
Empty components in the environment variable are ignored.
=item B<C_INCLUDE_PATH>, B<OBJC_INCLUDE_PATH>, B<CPLUS_INCLUDE_PATH>,
B<OBJCPLUS_INCLUDE_PATH>
These environment variables specify additional paths, as for CPATH,
which are only used when processing the appropriate language.
=item B<MACOSX_DEPLOYMENT_TARGET>
If -mmacosx-version-min is unspecified, the default deployment target
is read from this environment variable. This option only affects Darwin
targets.
=back
=head1 BUGS
To report bugs, please visit L<http://llvm.org/bugs/>. Most bug reports should
include preprocessed source files (use the B<-E> option) and the full output of
the compiler, along with information to reproduce.
=head1 SEE ALSO
as(1), ld(1)
=head1 AUTHOR
Maintained by the Clang / LLVM Team (L<http://clang.llvm.org>).
=cut

View File

@ -1,256 +0,0 @@
/* Based on http://www.perldoc.com/css/perldoc.css */
@import url("../llvm.css");
body { font-family: Arial,Helvetica; }
blockquote { margin: 10pt; }
h1, a { color: #336699; }
/*** Top menu style ****/
.mmenuon {
font-family: Arial,Helvetica; font-weight: bold; text-decoration: none;
color: #ff6600; font-size: 10pt;
}
.mmenuoff {
font-family: Arial,Helvetica; font-weight: bold; text-decoration: none;
color: #ffffff; font-size: 10pt;
}
.cpyright {
font-family: Arial,Helvetica; font-weight: bold; text-decoration: none;
color: #ffffff; font-size: xx-small;
}
.cpyrightText {
font-family: Arial,Helvetica; font-weight: bold; text-decoration: none;
color: #ffffff; font-size: xx-small;
}
.sections {
font-family: Arial,Helvetica; font-weight: bold; text-decoration: none;
color: #336699; font-size: 11pt;
}
.dsections {
font-family: Arial,Helvetica; font-weight: bold; text-decoration: none;
color: #336699; font-size: 12pt;
}
.slink {
font-family: Arial,Helvetica; font-weight: normal; text-decoration: none;
color: #000000; font-size: 9pt;
}
.slink2 { font-family: Arial,Helvetica; text-decoration: none; color: #336699; }
.maintitle {
font-family: Arial,Helvetica; font-weight: bold; text-decoration: none;
color: #336699; font-size: 18pt;
}
.dblArrow {
font-family: Arial,Helvetica; font-weight: bold; text-decoration: none;
color: #336699; font-size: small;
}
.menuSec {
font-family: Arial,Helvetica; font-weight: bold; text-decoration: none;
color: #336699; font-size: small;
}
.newstext {
font-family: Arial,Helvetica; font-size: small;
}
.linkmenu {
font-family: Arial,Helvetica; color: #000000; font-weight: bold;
text-decoration: none;
}
P {
font-family: Arial,Helvetica;
}
PRE {
font-size: 10pt;
}
.quote {
font-family: Times; text-decoration: none;
color: #000000; font-size: 9pt; font-style: italic;
}
.smstd { font-family: Arial,Helvetica; color: #000000; font-size: x-small; }
.std { font-family: Arial,Helvetica; color: #000000; }
.meerkatTitle {
font-family: sans-serif; font-size: x-small; color: black; }
.meerkatDescription { font-family: sans-serif; font-size: 10pt; color: black }
.meerkatCategory {
font-family: sans-serif; font-size: 9pt; font-weight: bold; font-style: italic;
color: brown; }
.meerkatChannel {
font-family: sans-serif; font-size: 9pt; font-style: italic; color: brown; }
.meerkatDate { font-family: sans-serif; font-size: xx-small; color: #336699; }
.tocTitle {
font-family: Arial,Helvetica; font-weight: bold; text-decoration: none;
color: #333333; font-size: 10pt;
}
.toc-item {
font-family: Arial,Helvetica; font-weight: bold;
color: #336699; font-size: 10pt; text-decoration: underline;
}
.perlVersion {
font-family: Arial,Helvetica; font-weight: bold;
color: #336699; font-size: 10pt; text-decoration: none;
}
.podTitle {
font-family: Arial,Helvetica; font-weight: bold; text-decoration: none;
color: #000000;
}
.docTitle {
font-family: Arial,Helvetica; font-weight: bold; text-decoration: none;
color: #000000; font-size: 10pt;
}
.dotDot {
font-family: Arial,Helvetica; font-weight: bold;
color: #000000; font-size: 9pt;
}
.docSec {
font-family: Arial,Helvetica; font-weight: normal;
color: #333333; font-size: 9pt;
}
.docVersion {
font-family: Arial,Helvetica; font-weight: bold; text-decoration: none;
color: #336699; font-size: 10pt;
}
.docSecs-on {
font-family: Arial,Helvetica; font-weight: normal; text-decoration: none;
color: #ff0000; font-size: 10pt;
}
.docSecs-off {
font-family: Arial,Helvetica; font-weight: normal; text-decoration: none;
color: #333333; font-size: 10pt;
}
h2 {
font-family: Arial,Helvetica; font-weight: bold; text-decoration: none;
color: #336699; font-size: medium;
}
h1 {
font-family: Verdana,Arial,Helvetica; font-weight: bold; text-decoration: none;
color: #336699; font-size: large;
}
DL {
font-family: Arial,Helvetica; font-weight: normal; text-decoration: none;
color: #333333; font-size: 10pt;
}
UL > LI > A {
font-family: Arial,Helvetica; font-weight: bold;
color: #336699; font-size: 10pt;
}
.moduleInfo {
font-family: Arial,Helvetica; font-weight: bold; text-decoration: none;
color: #333333; font-size: 11pt;
}
.moduleInfoSec {
font-family: Arial,Helvetica; font-weight: bold; text-decoration: none;
color: #336699; font-size: 10pt;
}
.moduleInfoVal {
font-family: Arial,Helvetica; font-weight: normal; text-decoration: underline;
color: #000000; font-size: 10pt;
}
.cpanNavTitle {
font-family: Arial,Helvetica; font-weight: bold;
color: #ffffff; font-size: 10pt;
}
.cpanNavLetter {
font-family: Arial,Helvetica; font-weight: bold; text-decoration: none;
color: #333333; font-size: 9pt;
}
.cpanCat {
font-family: Arial,Helvetica; font-weight: bold; text-decoration: none;
color: #336699; font-size: 9pt;
}
.bttndrkblue-bkgd-top {
background-color: #225688;
background-image: url(/global/mvc_objects/images/bttndrkblue_bgtop.gif);
}
.bttndrkblue-bkgd-left {
background-color: #225688;
background-image: url(/global/mvc_objects/images/bttndrkblue_bgleft.gif);
}
.bttndrkblue-bkgd {
padding-top: 0px;
padding-bottom: 0px;
margin-bottom: 0px;
margin-top: 0px;
background-repeat: no-repeat;
background-color: #225688;
background-image: url(/global/mvc_objects/images/bttndrkblue_bgmiddle.gif);
vertical-align: top;
}
.bttndrkblue-bkgd-right {
background-color: #225688;
background-image: url(/global/mvc_objects/images/bttndrkblue_bgright.gif);
}
.bttndrkblue-bkgd-bottom {
background-color: #225688;
background-image: url(/global/mvc_objects/images/bttndrkblue_bgbottom.gif);
}
.bttndrkblue-text a {
color: #ffffff;
text-decoration: none;
}
a.bttndrkblue-text:hover {
color: #ffDD3C;
text-decoration: none;
}
.bg-ltblue {
background-color: #f0f5fa;
}
.border-left-b {
background: #f0f5fa url(/i/corner-leftline.gif) repeat-y;
}
.border-right-b {
background: #f0f5fa url(/i/corner-rightline.gif) repeat-y;
}
.border-top-b {
background: #f0f5fa url(/i/corner-topline.gif) repeat-x;
}
.border-bottom-b {
background: #f0f5fa url(/i/corner-botline.gif) repeat-x;
}
.border-right-w {
background: #ffffff url(/i/corner-rightline.gif) repeat-y;
}
.border-top-w {
background: #ffffff url(/i/corner-topline.gif) repeat-x;
}
.border-bottom-w {
background: #ffffff url(/i/corner-botline.gif) repeat-x;
}
.bg-white {
background-color: #ffffff;
}
.border-left-w {
background: #ffffff url(/i/corner-leftline.gif) repeat-y;
}

View File

@ -37,9 +37,10 @@ void MainCallChecker::checkPreStmt(const CallExpr *CE, CheckerContext &C) const
if (!BT)
BT.reset(new BugType(this, "call to main", "example analyzer plugin"));
BugReport *report = new BugReport(*BT, BT->getName(), N);
std::unique_ptr<BugReport> report =
llvm::make_unique<BugReport>(*BT, BT->getName(), N);
report->addRange(Callee->getSourceRange());
C.emitReport(report);
C.emitReport(std::move(report));
}
}

View File

@ -2225,12 +2225,19 @@ enum CXCursorKind {
*/
CXCursor_OMPTeamsDirective = 253,
/** \brief OpenMP taskwait directive.
/** \brief OpenMP taskgroup directive.
*/
CXCursor_OMPTaskgroupDirective = 254,
/** \brief OpenMP cancellation point directive.
*/
CXCursor_OMPCancellationPointDirective = 255,
CXCursor_LastStmt = CXCursor_OMPTaskgroupDirective,
/** \brief OpenMP cancel directive.
*/
CXCursor_OMPCancelDirective = 256,
CXCursor_LastStmt = CXCursor_OMPCancelDirective,
/**
* \brief Cursor that represents the translation unit itself.

View File

@ -1664,6 +1664,9 @@ class ASTContext : public RefCountedBase<ASTContext> {
TypeInfo getTypeInfo(const Type *T) const;
TypeInfo getTypeInfo(QualType T) const { return getTypeInfo(T.getTypePtr()); }
/// \brief Get default simd alignment of the specified complete type in bits.
unsigned getOpenMPDefaultSimdAlign(QualType T) const;
/// \brief Return the size of the specified (complete) type \p T, in bits.
uint64_t getTypeSize(QualType T) const { return getTypeInfo(T).Width; }
uint64_t getTypeSize(const Type *T) const { return getTypeInfo(T).Width; }
@ -1780,6 +1783,17 @@ class ASTContext : public RefCountedBase<ASTContext> {
/// \param method should be the declaration from the class definition
void setNonKeyFunction(const CXXMethodDecl *method);
/// Loading virtual member pointers using the virtual inheritance model
/// always results in an adjustment using the vbtable even if the index is
/// zero.
///
/// This is usually OK because the first slot in the vbtable points
/// backwards to the top of the MDC. However, the MDC might be reusing a
/// vbptr from an nv-base. In this case, the first slot in the vbtable
/// points to the start of the nv-base which introduced the vbptr and *not*
/// the MDC. Modify the NonVirtualBaseAdjustment to account for this.
CharUnits getOffsetOfBaseWithVBPtr(const CXXRecordDecl *RD) const;
/// Get the offset of a FieldDecl or IndirectFieldDecl, in bits.
uint64_t getFieldOffset(const ValueDecl *FD) const;

View File

@ -14,6 +14,7 @@
#define LLVM_CLANG_AST_ASTMUTATIONLISTENER_H
namespace clang {
class Attr;
class ClassTemplateDecl;
class ClassTemplateSpecializationDecl;
class CXXDestructorDecl;
@ -29,6 +30,7 @@ namespace clang {
class ObjCInterfaceDecl;
class ObjCPropertyDecl;
class QualType;
class RecordDecl;
class TagDecl;
class VarDecl;
class VarTemplateDecl;
@ -119,6 +121,14 @@ class ASTMutationListener {
/// \param M The containing module in which the definition was made visible,
/// if any.
virtual void RedefinedHiddenDefinition(const NamedDecl *D, Module *M) {}
/// \brief An attribute was added to a RecordDecl
///
/// \param Attr The attribute that was added to the Record
///
/// \param Record The RecordDecl that got a new attribute
virtual void AddedAttributeToRecord(const Attr *Attr,
const RecordDecl *Record) {}
// NOTE: If new methods are added they should also be added to
// MultiplexASTMutationListener.

View File

@ -1861,8 +1861,8 @@ DEF_TRAVERSE_DECL(ParmVarDecl, {
TRY_TO(WalkUpFrom##STMT(S)); \
StmtQueueAction StmtQueue(*this); \
{ CODE; } \
for (Stmt::child_range range = S->children(); range; ++range) { \
StmtQueue.queue(*range); \
for (Stmt *SubStmt : S->children()) { \
StmtQueue.queue(SubStmt); \
} \
return true; \
}
@ -2011,8 +2011,8 @@ bool RecursiveASTVisitor<Derived>::TraverseInitListExpr(InitListExpr *S) {
TRY_TO(WalkUpFromInitListExpr(S));
StmtQueueAction StmtQueue(*this);
// All we need are the default actions. FIXME: use a helper function.
for (Stmt::child_range range = S->children(); range; ++range) {
StmtQueue.queue(*range);
for (Stmt *SubStmt : S->children()) {
StmtQueue.queue(SubStmt);
}
return true;
}
@ -2358,6 +2358,12 @@ DEF_TRAVERSE_STMT(OMPTaskwaitDirective,
DEF_TRAVERSE_STMT(OMPTaskgroupDirective,
{ TRY_TO(TraverseOMPExecutableDirective(S)); })
DEF_TRAVERSE_STMT(OMPCancellationPointDirective,
{ TRY_TO(TraverseOMPExecutableDirective(S)); })
DEF_TRAVERSE_STMT(OMPCancelDirective,
{ TRY_TO(TraverseOMPExecutableDirective(S)); })
DEF_TRAVERSE_STMT(OMPFlushDirective,
{ TRY_TO(TraverseOMPExecutableDirective(S)); })
@ -2622,6 +2628,12 @@ bool RecursiveASTVisitor<Derived>::VisitOMPFlushClause(OMPFlushClause *C) {
return true;
}
template <typename Derived>
bool RecursiveASTVisitor<Derived>::VisitOMPDependClause(OMPDependClause *C) {
TRY_TO(VisitOMPClauseList(C));
return true;
}
// FIXME: look at the following tricky-seeming exprs to see if we
// need to recurse on anything. These are ones that have methods
// returning decls or qualtypes or nestednamespecifier -- though I'm

View File

@ -98,9 +98,9 @@ class EvaluatedExprVisitorBase : public StmtVisitorBase<Ptr, ImplClass, void> {
/// \brief The basis case walks all of the children of the statement or
/// expression, assuming they are all potentially evaluated.
void VisitStmt(PTR(Stmt) S) {
for (auto C = S->children(); C; ++C)
if (*C)
this->Visit(*C);
for (auto *SubStmt : S->children())
if (SubStmt)
this->Visit(SubStmt);
}
#undef PTR

View File

@ -86,7 +86,7 @@ class ObjCBoolLiteralExpr : public Expr {
};
/// ObjCBoxedExpr - used for generalized expression boxing.
/// as in: @(strdup("hello world")) or @(random())
/// as in: @(strdup("hello world")), @(random()) or @(view.frame)
/// Also used for boxing non-parenthesized numeric literals;
/// as in: @42 or \@true (c++/objc++) or \@__yes (c/objc).
class ObjCBoxedExpr : public Expr {

View File

@ -156,6 +156,20 @@ class ExternalASTSource : public RefCountedBase<ExternalASTSource> {
/// \brief Retrieve the module that corresponds to the given module ID.
virtual Module *getModule(unsigned ID) { return nullptr; }
/// \brief Holds everything needed to generate debug info for an
/// imported module or precompiled header file.
struct ASTSourceDescriptor {
std::string ModuleName;
std::string Path;
std::string ASTFile;
uint64_t Signature;
};
/// \brief Return a descriptor for the corresponding module, if one exists.
virtual llvm::Optional<ASTSourceDescriptor> getSourceDescriptor(unsigned ID);
/// \brief Return a descriptor for the module.
virtual ASTSourceDescriptor getSourceDescriptor(const Module &M);
/// \brief Finds all declarations lexically contained within the given
/// DeclContext, after applying an optional filter predicate.
///

View File

@ -204,6 +204,10 @@ class MicrosoftMangleContext : public MangleContext {
virtual void mangleVirtualMemPtrThunk(const CXXMethodDecl *MD,
raw_ostream &) = 0;
virtual void mangleCXXVirtualDisplacementMap(const CXXRecordDecl *SrcRD,
const CXXRecordDecl *DstRD,
raw_ostream &Out) = 0;
virtual void mangleCXXThrowInfo(QualType T, bool IsConst, bool IsVolatile,
uint32_t NumEntries, raw_ostream &Out) = 0;

View File

@ -37,8 +37,9 @@ class NSAPI {
ClassId_NSMutableSet,
ClassId_NSCountedSet,
ClassId_NSMutableOrderedSet,
ClassId_NSValue
};
static const unsigned NumClassIds = 10;
static const unsigned NumClassIds = 11;
enum NSStringMethodKind {
NSStr_stringWithString,

View File

@ -2212,6 +2212,94 @@ class OMPFlushClause : public OMPVarListClause<OMPFlushClause> {
}
};
/// \brief This represents implicit clause 'depend' for the '#pragma omp task'
/// directive.
///
/// \code
/// #pragma omp task depend(in:a,b)
/// \endcode
/// In this example directive '#pragma omp task' with clause 'depend' with the
/// variables 'a' and 'b' with dependency 'in'.
///
class OMPDependClause : public OMPVarListClause<OMPDependClause> {
friend class OMPClauseReader;
/// \brief Dependency type (one of in, out, inout).
OpenMPDependClauseKind DepKind;
/// \brief Dependency type location.
SourceLocation DepLoc;
/// \brief Colon location.
SourceLocation ColonLoc;
/// \brief Build clause with number of variables \a N.
///
/// \param StartLoc Starting location of the clause.
/// \param LParenLoc Location of '('.
/// \param EndLoc Ending location of the clause.
/// \param N Number of the variables in the clause.
///
OMPDependClause(SourceLocation StartLoc, SourceLocation LParenLoc,
SourceLocation EndLoc, unsigned N)
: OMPVarListClause<OMPDependClause>(OMPC_depend, StartLoc, LParenLoc,
EndLoc, N),
DepKind(OMPC_DEPEND_unknown) {}
/// \brief Build an empty clause.
///
/// \param N Number of variables.
///
explicit OMPDependClause(unsigned N)
: OMPVarListClause<OMPDependClause>(OMPC_depend, SourceLocation(),
SourceLocation(), SourceLocation(),
N),
DepKind(OMPC_DEPEND_unknown) {}
/// \brief Set dependency kind.
void setDependencyKind(OpenMPDependClauseKind K) { DepKind = K; }
/// \brief Set dependency kind and its location.
void setDependencyLoc(SourceLocation Loc) { DepLoc = Loc; }
/// \brief Set colon location.
void setColonLoc(SourceLocation Loc) { ColonLoc = Loc; }
public:
/// \brief Creates clause with a list of variables \a VL.
///
/// \param C AST context.
/// \param StartLoc Starting location of the clause.
/// \param LParenLoc Location of '('.
/// \param EndLoc Ending location of the clause.
/// \param DepKind Dependency type.
/// \param DepLoc Location of the dependency type.
/// \param ColonLoc Colon location.
/// \param VL List of references to the variables.
///
static OMPDependClause *
Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc,
SourceLocation EndLoc, OpenMPDependClauseKind DepKind,
SourceLocation DepLoc, SourceLocation ColonLoc, ArrayRef<Expr *> VL);
/// \brief Creates an empty clause with \a N variables.
///
/// \param C AST context.
/// \param N The number of variables.
///
static OMPDependClause *CreateEmpty(const ASTContext &C, unsigned N);
/// \brief Get dependency type.
OpenMPDependClauseKind getDependencyKind() const { return DepKind; }
/// \brief Get dependency type location.
SourceLocation getDependencyLoc() const { return DepLoc; }
/// \brief Get colon location.
SourceLocation getColonLoc() const { return ColonLoc; }
StmtRange children() {
return StmtRange(reinterpret_cast<Stmt **>(varlist_begin()),
reinterpret_cast<Stmt **>(varlist_end()));
}
static bool classof(const OMPClause *T) {
return T->getClauseKind() == OMPC_depend;
}
};
} // end namespace clang
#endif

View File

@ -1881,8 +1881,8 @@ DEF_TRAVERSE_DECL(ParmVarDecl, {
bool RecursiveASTVisitor<Derived>::Traverse##STMT(STMT *S) { \
TRY_TO(WalkUpFrom##STMT(S)); \
{ CODE; } \
for (Stmt::child_range range = S->children(); range; ++range) { \
TRY_TO(TraverseStmt(*range)); \
for (Stmt *SubStmt : S->children()) { \
TRY_TO(TraverseStmt(SubStmt)); \
} \
return true; \
}
@ -2038,15 +2038,15 @@ bool RecursiveASTVisitor<Derived>::TraverseInitListExpr(InitListExpr *S) {
if (Syn) {
TRY_TO(WalkUpFromInitListExpr(Syn));
// All we need are the default actions. FIXME: use a helper function.
for (Stmt::child_range range = Syn->children(); range; ++range) {
TRY_TO(TraverseStmt(*range));
for (Stmt *SubStmt : Syn->children()) {
TRY_TO(TraverseStmt(SubStmt));
}
}
InitListExpr *Sem = S->isSemanticForm() ? S : S->getSemanticForm();
if (Sem) {
TRY_TO(WalkUpFromInitListExpr(Sem));
for (Stmt::child_range range = Sem->children(); range; ++range) {
TRY_TO(TraverseStmt(*range));
for (Stmt *SubStmt : Sem->children()) {
TRY_TO(TraverseStmt(SubStmt));
}
}
return true;
@ -2391,6 +2391,12 @@ DEF_TRAVERSE_STMT(OMPTaskwaitDirective,
DEF_TRAVERSE_STMT(OMPTaskgroupDirective,
{ TRY_TO(TraverseOMPExecutableDirective(S)); })
DEF_TRAVERSE_STMT(OMPCancellationPointDirective,
{ TRY_TO(TraverseOMPExecutableDirective(S)); })
DEF_TRAVERSE_STMT(OMPCancelDirective,
{ TRY_TO(TraverseOMPExecutableDirective(S)); })
DEF_TRAVERSE_STMT(OMPFlushDirective,
{ TRY_TO(TraverseOMPExecutableDirective(S)); })
@ -2655,6 +2661,12 @@ bool RecursiveASTVisitor<Derived>::VisitOMPFlushClause(OMPFlushClause *C) {
return true;
}
template <typename Derived>
bool RecursiveASTVisitor<Derived>::VisitOMPDependClause(OMPDependClause *C) {
TRY_TO(VisitOMPClauseList(C));
return true;
}
// FIXME: look at the following tricky-seeming exprs to see if we
// need to recurse on anything. These are ones that have methods
// returning decls or qualtypes or nestednamespecifier -- though I'm

View File

@ -32,8 +32,10 @@ class StmtIteratorBase {
enum { StmtMode = 0x0, SizeOfTypeVAMode = 0x1, DeclGroupMode = 0x2,
Flags = 0x3 };
Stmt **stmt;
Decl **DGI;
union {
Stmt **stmt;
Decl **DGI;
};
uintptr_t RawVAPtr;
Decl **DGE;
@ -64,10 +66,10 @@ class StmtIteratorBase {
Stmt*& GetDeclExpr() const;
StmtIteratorBase(Stmt **s) : stmt(s), DGI(nullptr), RawVAPtr(0) {}
StmtIteratorBase(Stmt **s) : stmt(s), RawVAPtr(0) {}
StmtIteratorBase(const VariableArrayType *t);
StmtIteratorBase(Decl **dgi, Decl **dge);
StmtIteratorBase() : stmt(nullptr), DGI(nullptr), RawVAPtr(0) {}
StmtIteratorBase() : stmt(nullptr), RawVAPtr(0) {}
};

View File

@ -1856,6 +1856,121 @@ class OMPTeamsDirective : public OMPExecutableDirective {
}
};
/// \brief This represents '#pragma omp cancellation point' directive.
///
/// \code
/// #pragma omp cancellation point for
/// \endcode
///
/// In this example a cancellation point is created for innermost 'for' region.
class OMPCancellationPointDirective : public OMPExecutableDirective {
friend class ASTStmtReader;
OpenMPDirectiveKind CancelRegion;
/// \brief Build directive with the given start and end location.
///
/// \param StartLoc Starting location of the directive kind.
/// \param EndLoc Ending location of the directive.
///
OMPCancellationPointDirective(SourceLocation StartLoc, SourceLocation EndLoc)
: OMPExecutableDirective(this, OMPCancellationPointDirectiveClass,
OMPD_cancellation_point, StartLoc, EndLoc, 0, 0),
CancelRegion(OMPD_unknown) {}
/// \brief Build an empty directive.
///
explicit OMPCancellationPointDirective()
: OMPExecutableDirective(this, OMPCancellationPointDirectiveClass,
OMPD_cancellation_point, SourceLocation(),
SourceLocation(), 0, 0),
CancelRegion(OMPD_unknown) {}
/// \brief Set cancel region for current cancellation point.
/// \param CR Cancellation region.
void setCancelRegion(OpenMPDirectiveKind CR) { CancelRegion = CR; }
public:
/// \brief Creates directive.
///
/// \param C AST context.
/// \param StartLoc Starting location of the directive kind.
/// \param EndLoc Ending Location of the directive.
///
static OMPCancellationPointDirective *
Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
OpenMPDirectiveKind CancelRegion);
/// \brief Creates an empty directive.
///
/// \param C AST context.
///
static OMPCancellationPointDirective *CreateEmpty(const ASTContext &C,
EmptyShell);
/// \brief Get cancellation region for the current cancellation point.
OpenMPDirectiveKind getCancelRegion() const { return CancelRegion; }
static bool classof(const Stmt *T) {
return T->getStmtClass() == OMPCancellationPointDirectiveClass;
}
};
/// \brief This represents '#pragma omp cancel' directive.
///
/// \code
/// #pragma omp cancel for
/// \endcode
///
/// In this example a cancel is created for innermost 'for' region.
class OMPCancelDirective : public OMPExecutableDirective {
friend class ASTStmtReader;
OpenMPDirectiveKind CancelRegion;
/// \brief Build directive with the given start and end location.
///
/// \param StartLoc Starting location of the directive kind.
/// \param EndLoc Ending location of the directive.
///
OMPCancelDirective(SourceLocation StartLoc, SourceLocation EndLoc)
: OMPExecutableDirective(this, OMPCancelDirectiveClass, OMPD_cancel,
StartLoc, EndLoc, 0, 0),
CancelRegion(OMPD_unknown) {}
/// \brief Build an empty directive.
///
explicit OMPCancelDirective()
: OMPExecutableDirective(this, OMPCancelDirectiveClass, OMPD_cancel,
SourceLocation(), SourceLocation(), 0, 0),
CancelRegion(OMPD_unknown) {}
/// \brief Set cancel region for current cancellation point.
/// \param CR Cancellation region.
void setCancelRegion(OpenMPDirectiveKind CR) { CancelRegion = CR; }
public:
/// \brief Creates directive.
///
/// \param C AST context.
/// \param StartLoc Starting location of the directive kind.
/// \param EndLoc Ending Location of the directive.
///
static OMPCancelDirective *Create(const ASTContext &C,
SourceLocation StartLoc,
SourceLocation EndLoc,
OpenMPDirectiveKind CancelRegion);
/// \brief Creates an empty directive.
///
/// \param C AST context.
///
static OMPCancelDirective *CreateEmpty(const ASTContext &C, EmptyShell);
/// \brief Get cancellation region for the current cancellation point.
OpenMPDirectiveKind getCancelRegion() const { return CancelRegion; }
static bool classof(const Stmt *T) {
return T->getStmtClass() == OMPCancelDirectiveClass;
}
};
} // end namespace clang
#endif

View File

@ -1564,6 +1564,7 @@ class Type : public ExtQualsTypeCommonBase {
bool isRecordType() const;
bool isClassType() const;
bool isStructureType() const;
bool isObjCBoxableRecordType() const;
bool isInterfaceType() const;
bool isStructureOrClassType() const;
bool isUnionType() const;

View File

@ -2528,6 +2528,23 @@ AST_MATCHER_P2(DeclStmt, containsDeclaration, unsigned, N,
return InnerMatcher.matches(**Iterator, Finder, Builder);
}
/// \brief Matches a C++ catch statement that has a catch-all handler.
///
/// Given
/// \code
/// try {
/// // ...
/// } catch (int) {
/// // ...
/// } catch (...) {
/// // ...
/// }
/// /endcode
/// catchStmt(isCatchAll()) matches catch(...) but not catch(int).
AST_MATCHER(CXXCatchStmt, isCatchAll) {
return Node.getExceptionDecl() == nullptr;
}
/// \brief Matches a constructor initializer.
///
/// Given

View File

@ -40,6 +40,7 @@ class OptionalFlag {
void clear() { flag = false; }
void setPosition(const char *position) {
assert(position);
flag = true;
this->position = position;
}
const char *getPosition() const {
@ -435,12 +436,14 @@ class PrintfSpecifier : public analyze_format_string::FormatSpecifier {
OptionalFlag HasSpacePrefix; // ' '
OptionalFlag HasAlternativeForm; // '#'
OptionalFlag HasLeadingZeroes; // '0'
OptionalFlag HasObjCTechnicalTerm; // '[tt]'
OptionalAmount Precision;
public:
PrintfSpecifier() :
FormatSpecifier(/* isPrintf = */ true),
HasThousandsGrouping("'"), IsLeftJustified("-"), HasPlusPrefix("+"),
HasSpacePrefix(" "), HasAlternativeForm("#"), HasLeadingZeroes("0") {}
HasSpacePrefix(" "), HasAlternativeForm("#"), HasLeadingZeroes("0"),
HasObjCTechnicalTerm("tt") {}
static PrintfSpecifier Parse(const char *beg, const char *end);
@ -449,29 +452,26 @@ class PrintfSpecifier : public analyze_format_string::FormatSpecifier {
CS = cs;
}
void setHasThousandsGrouping(const char *position) {
HasThousandsGrouping = true;
HasThousandsGrouping.setPosition(position);
}
void setIsLeftJustified(const char *position) {
IsLeftJustified = true;
IsLeftJustified.setPosition(position);
}
void setHasPlusPrefix(const char *position) {
HasPlusPrefix = true;
HasPlusPrefix.setPosition(position);
}
void setHasSpacePrefix(const char *position) {
HasSpacePrefix = true;
HasSpacePrefix.setPosition(position);
}
void setHasAlternativeForm(const char *position) {
HasAlternativeForm = true;
HasAlternativeForm.setPosition(position);
}
void setHasLeadingZeros(const char *position) {
HasLeadingZeroes = true;
HasLeadingZeroes.setPosition(position);
}
void setHasObjCTechnicalTerm(const char *position) {
HasObjCTechnicalTerm.setPosition(position);
}
void setUsesPositionalArg() { UsesPositionalArg = true; }
// Methods for querying the format specifier.
@ -508,6 +508,7 @@ class PrintfSpecifier : public analyze_format_string::FormatSpecifier {
const OptionalFlag &hasAlternativeForm() const { return HasAlternativeForm; }
const OptionalFlag &hasLeadingZeros() const { return HasLeadingZeroes; }
const OptionalFlag &hasSpacePrefix() const { return HasSpacePrefix; }
const OptionalFlag &hasObjCTechnicalTerm() const { return HasObjCTechnicalTerm; }
bool usesPositionalArg() const { return UsesPositionalArg; }
/// Changes the specifier and length according to a QualType, retaining any
@ -565,7 +566,6 @@ class ScanfSpecifier : public analyze_format_string::FormatSpecifier {
SuppressAssignment("*") {}
void setSuppressAssignment(const char *position) {
SuppressAssignment = true;
SuppressAssignment.setPosition(position);
}
@ -621,6 +621,15 @@ class FormatStringHandler {
virtual void HandleIncompleteSpecifier(const char *startSpecifier,
unsigned specifierLen) {}
virtual void HandleEmptyObjCModifierFlag(const char *startFlags,
unsigned flagsLen) {}
virtual void HandleInvalidObjCModifierFlag(const char *startFlag,
unsigned flagLen) {}
virtual void HandleObjCFlagsWithNonObjCConversion(const char *flagsStart,
const char *flagsEnd,
const char *conversionPosition) {}
// Printf-specific handlers.
virtual bool HandleInvalidPrintfConversionSpecifier(

View File

@ -950,30 +950,30 @@ def NonNull : InheritableAttr {
} }];
// FIXME: We should merge duplicates into a single nonnull attribute.
let DuplicatesAllowedWhileMerging = 1;
let Documentation = [Undocumented];
let Documentation = [NonNullDocs];
}
def ReturnsNonNull : InheritableAttr {
let Spellings = [GCC<"returns_nonnull">];
let Subjects = SubjectList<[ObjCMethod, Function], WarnDiag,
"ExpectedFunctionOrMethod">;
let Documentation = [Undocumented];
let Documentation = [ReturnsNonNullDocs];
}
// Nullability type attributes.
def TypeNonNull : TypeAttr {
let Spellings = [Keyword<"__nonnull">];
let Documentation = [Undocumented];
let Spellings = [Keyword<"_Nonnull">];
let Documentation = [TypeNonNullDocs];
}
def TypeNullable : TypeAttr {
let Spellings = [Keyword<"__nullable">];
let Documentation = [Undocumented];
let Spellings = [Keyword<"_Nullable">];
let Documentation = [TypeNullableDocs];
}
def TypeNullUnspecified : TypeAttr {
let Spellings = [Keyword<"__null_unspecified">];
let Documentation = [Undocumented];
let Spellings = [Keyword<"_Null_unspecified">];
let Documentation = [TypeNullUnspecifiedDocs];
}
def AssumeAligned : InheritableAttr {
@ -1125,6 +1125,12 @@ def ObjCRuntimeName : Attr {
let Documentation = [ObjCRuntimeNameDocs];
}
def ObjCBoxable : Attr {
let Spellings = [GNU<"objc_boxable">];
let Subjects = SubjectList<[Record], ErrorDiag, "ExpectedStructOrUnion">;
let Documentation = [Undocumented];
}
def OptimizeNone : InheritableAttr {
let Spellings = [GNU<"optnone">, CXX11<"clang", "optnone">];
let Subjects = SubjectList<[Function, ObjCMethod]>;

View File

@ -181,6 +181,11 @@ to enforce the provided alignment assumption.
def EnableIfDocs : Documentation {
let Category = DocCatFunction;
let Content = [{
.. Note:: Some features of this attribute are experimental. The meaning of
multiple enable_if attributes on a single declaration is subject to change in
a future version of clang. Also, the ABI is not standardized and the name
mangling may change in future versions. To avoid that, use asm labels.
The ``enable_if`` attribute can be placed on function declarations to control
which overload is selected based on the values of the function's arguments.
When combined with the ``overloadable`` attribute, this feature is also
@ -1448,3 +1453,114 @@ private address space. Kernel function arguments of a pointer or an array type
cannot point to the private address space.
}];
}
def NullabilityDocs : DocumentationCategory<"Nullability Attributes"> {
let Content = [{
Whether a particular pointer may be "null" is an important concern when working with pointers in the C family of languages. The various nullability attributes indicate whether a particular pointer can be null or not, which makes APIs more expressive and can help static analysis tools identify bugs involving null pointers. Clang supports several kinds of nullability attributes: the ``nonnull`` and ``returns_nonnull`` attributes indicate which function or method parameters and result types can never be null, while nullability type qualifiers indicate which pointer types can be null (``_Nullable``) or cannot be null (``_Nonnull``).
The nullability (type) qualifiers express whether a value of a given pointer type can be null (the ``_Nullable`` qualifier), doesn't have a defined meaning for null (the ``_Nonnull`` qualifier), or for which the purpose of null is unclear (the ``_Null_unspecified`` qualifier). Because nullability qualifiers are expressed within the type system, they are more general than the ``nonnull`` and ``returns_nonnull`` attributes, allowing one to express (for example) a nullable pointer to an array of nonnull pointers. Nullability qualifiers are written to the right of the pointer to which they apply. For example:
.. code-block:: c
// No meaningful result when 'ptr' is null (here, it happens to be undefined behavior).
int fetch(int * _Nonnull ptr) { return *ptr; }
// 'ptr' may be null.
int fetch_or_zero(int * _Nullable ptr) {
return ptr ? *ptr : 0;
}
// A nullable pointer to non-null pointers to const characters.
const char *join_strings(const char * _Nonnull * _Nullable strings, unsigned n);
In Objective-C, there is an alternate spelling for the nullability qualifiers that can be used in Objective-C methods and properties using context-sensitive, non-underscored keywords. For example:
.. code-block:: objective-c
@interface NSView : NSResponder
- (nullable NSView *)ancestorSharedWithView:(nonnull NSView *)aView;
@property (assign, nullable) NSView *superview;
@property (readonly, nonnull) NSArray *subviews;
@end
}];
}
def TypeNonNullDocs : Documentation {
let Category = NullabilityDocs;
let Heading = "_Nonnull";
let Content = [{
The ``_Nonnull`` nullability qualifier indicates that null is not a meaningful value for a value of the ``_Nonnull`` pointer type. For example, given a declaration such as:
.. code-block:: c
int fetch(int * _Nonnull ptr);
a caller of ``fetch`` should not provide a null value, and the compiler will produce a warning if it sees a literal null value passed to ``fetch``. Note that, unlike the declaration attribute ``nonnull``, the presence of ``_Nonnull`` does not imply that passing null is undefined behavior: ``fetch`` is free to consider null undefined behavior or (perhaps for backward-compatibility reasons) defensively handle null.
}];
}
def TypeNullableDocs : Documentation {
let Category = NullabilityDocs;
let Heading = "_Nullable";
let Content = [{
The ``_Nullable`` nullability qualifier indicates that a value of the ``_Nullable`` pointer type can be null. For example, given:
.. code-block:: c
int fetch_or_zero(int * _Nullable ptr);
a caller of ``fetch_or_zero`` can provide null.
}];
}
def TypeNullUnspecifiedDocs : Documentation {
let Category = NullabilityDocs;
let Heading = "_Null_unspecified";
let Content = [{
The ``_Null_unspecified`` nullability qualifier indicates that neither the ``_Nonnull`` nor ``_Nullable`` qualifiers make sense for a particular pointer type. It is used primarily to indicate that the role of null with specific pointers in a nullability-annotated header is unclear, e.g., due to overly-complex implementations or historical factors with a long-lived API.
}];
}
def NonNullDocs : Documentation {
let Category = NullabilityDocs;
let Heading = "nonnull";
let Content = [{
The ``nonnull`` attribute indicates that some function parameters must not be null, and can be used in several different ways. It's original usage (`from GCC <https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#Common-Function-Attributes>`_) is as a function (or Objective-C method) attribute that specifies which parameters of the function are nonnull in a comma-separated list. For example:
.. code-block:: c
extern void * my_memcpy (void *dest, const void *src, size_t len)
__attribute__((nonnull (1, 2)));
Here, the ``nonnull`` attribute indicates that parameters 1 and 2
cannot have a null value. Omitting the parenthesized list of parameter indices means that all parameters of pointer type cannot be null:
.. code-block:: c
extern void * my_memcpy (void *dest, const void *src, size_t len)
__attribute__((nonnull));
Clang also allows the ``nonnull`` attribute to be placed directly on a function (or Objective-C method) parameter, eliminating the need to specify the parameter index ahead of type. For example:
.. code-block:: c
extern void * my_memcpy (void *dest __attribute__((nonnull)),
const void *src __attribute__((nonnull)), size_t len);
Note that the ``nonnull`` attribute indicates that passing null to a non-null parameter is undefined behavior, which the optimizer may take advantage of to, e.g., remove null checks. The ``_Nonnull`` type qualifier indicates that a pointer cannot be null in a more general manner (because it is part of the type system) and does not imply undefined behavior, making it more widely applicable.
}];
}
def ReturnsNonNullDocs : Documentation {
let Category = NullabilityDocs;
let Heading = "returns_nonnull";
let Content = [{
The ``returns_nonnull`` attribute indicates that a particular function (or Objective-C method) always returns a non-null pointer. For example, a particular system ``malloc`` might be defined to terminate a process when memory is not available rather than returning a null pointer:
.. code-block:: c
extern void * malloc (size_t size) __attribute__((returns_nonnull));
The ``returns_nonnull`` attribute implies that returning a null pointer is undefined behavior, which the optimizer may take advantage of. The ``_Nonnull`` type qualifier indicates that a pointer cannot be null in a more general manner (because it is part of the type system) and does not imply undefined behavior, making it more widely applicable
}];
}

View File

@ -105,10 +105,10 @@ LANGBUILTIN(__dmb, "vUi", "nc", ALL_MS_LANGUAGES)
LANGBUILTIN(__dsb, "vUi", "nc", ALL_MS_LANGUAGES)
LANGBUILTIN(__isb, "vUi", "nc", ALL_MS_LANGUAGES)
LANGBUILTIN(__ldrexd, "WiWiCD*", "", ALL_MS_LANGUAGES)
LANGBUILTIN(_MoveFromCoprocessor, "UiUiUiUiUiUi", "", ALL_MS_LANGUAGES)
LANGBUILTIN(_MoveFromCoprocessor2, "UiUiUiUiUiUi", "", ALL_MS_LANGUAGES)
LANGBUILTIN(_MoveToCoprocessor, "vUiUiUiUiUiUi", "", ALL_MS_LANGUAGES)
LANGBUILTIN(_MoveToCoprocessor2, "vUiUiUiUiUiUi", "", ALL_MS_LANGUAGES)
LANGBUILTIN(_MoveFromCoprocessor, "UiIUiIUiIUiIUiIUi", "", ALL_MS_LANGUAGES)
LANGBUILTIN(_MoveFromCoprocessor2, "UiIUiIUiIUiIUiIUi", "", ALL_MS_LANGUAGES)
LANGBUILTIN(_MoveToCoprocessor, "vUiIUiIUiIUiIUiIUi", "", ALL_MS_LANGUAGES)
LANGBUILTIN(_MoveToCoprocessor2, "vUiIUiIUiIUiIUiIUi", "", ALL_MS_LANGUAGES)
#undef BUILTIN
#undef LANGBUILTIN

View File

@ -501,7 +501,7 @@ BUILTIN(__nvvm_atom_min_s_ui, "UiUiD*3Ui", "n")
BUILTIN(__nvvm_atom_min_gen_ui, "UiUiD*Ui", "n")
BUILTIN(__nvvm_atom_min_g_l, "LiLiD*1Li", "n")
BUILTIN(__nvvm_atom_min_s_l, "LiLiD*3Li", "n")
BUILTIN(__nvvm_atom_min_gen_l, "LiLi10D*Li", "n")
BUILTIN(__nvvm_atom_min_gen_l, "LiLiD*Li", "n")
BUILTIN(__nvvm_atom_min_g_ul, "ULiULiD*1ULi", "n")
BUILTIN(__nvvm_atom_min_s_ul, "ULiULiD*3ULi", "n")
BUILTIN(__nvvm_atom_min_gen_ul, "ULiULiD*ULi", "n")

View File

@ -267,6 +267,18 @@ BUILTIN(__builtin_vsx_xsmindp, "ddd", "")
BUILTIN(__builtin_vsx_xvdivdp, "V2dV2dV2d", "")
BUILTIN(__builtin_vsx_xvdivsp, "V4fV4fV4f", "")
BUILTIN(__builtin_vsx_xvrdpip, "V2dV2d", "")
BUILTIN(__builtin_vsx_xvrspip, "V4fV4f", "")
BUILTIN(__builtin_vsx_xvcmpeqdp, "V2ULLiV2dV2d", "")
BUILTIN(__builtin_vsx_xvcmpeqsp, "V4UiV4fV4f", "")
BUILTIN(__builtin_vsx_xvcmpgedp, "V2ULLiV2dV2d", "")
BUILTIN(__builtin_vsx_xvcmpgesp, "V4UiV4fV4f", "")
BUILTIN(__builtin_vsx_xvcmpgtdp, "V2ULLiV2dV2d", "")
BUILTIN(__builtin_vsx_xvcmpgtsp, "V4UiV4fV4f", "")
// HTM builtins
BUILTIN(__builtin_tbegin, "UiUIi", "")
BUILTIN(__builtin_tend, "UiUIi", "")

View File

@ -24,6 +24,11 @@
// FIXME: Are these nothrow/const?
// Miscellaneous builtin for checking x86 cpu features.
// TODO: Make this somewhat generic so that other backends
// can use it?
BUILTIN(__builtin_cpu_supports, "bcC*", "nc")
// 3DNow!
//
BUILTIN(__builtin_ia32_femms, "v", "")
@ -651,6 +656,12 @@ BUILTIN(__builtin_ia32_wrfsbase64, "vULLi", "")
BUILTIN(__builtin_ia32_wrgsbase32, "vUi", "")
BUILTIN(__builtin_ia32_wrgsbase64, "vULLi", "")
// FXSR
BUILTIN(__builtin_ia32_fxrstor, "vv*", "")
BUILTIN(__builtin_ia32_fxrstor64, "vv*", "")
BUILTIN(__builtin_ia32_fxsave, "vv*", "")
BUILTIN(__builtin_ia32_fxsave64, "vv*", "")
// ADX
BUILTIN(__builtin_ia32_addcarryx_u32, "UcUcUiUiUi*", "")
BUILTIN(__builtin_ia32_addcarryx_u64, "UcUcULLiULLiULLi*", "")
@ -722,12 +733,72 @@ BUILTIN(__builtin_ia32_vfmaddsubps256, "V8fV8fV8fV8f", "")
BUILTIN(__builtin_ia32_vfmaddsubpd256, "V4dV4dV4dV4d", "")
BUILTIN(__builtin_ia32_vfmsubaddps256, "V8fV8fV8fV8f", "")
BUILTIN(__builtin_ia32_vfmsubaddpd256, "V4dV4dV4dV4d", "")
BUILTIN(__builtin_ia32_vfmaddpd512_mask, "V8dV8dV8dV8dUcIi", "")
BUILTIN(__builtin_ia32_vfmsubpd512_mask, "V8dV8dV8dV8dUcIi", "")
BUILTIN(__builtin_ia32_vfnmaddpd512_mask, "V8dV8dV8dV8dUcIi", "")
BUILTIN(__builtin_ia32_vfmaddps512_mask, "V16fV16fV16fV16fUsIi", "")
BUILTIN(__builtin_ia32_vfmsubps512_mask, "V16fV16fV16fV16fUsIi", "")
BUILTIN(__builtin_ia32_vfnmaddps512_mask, "V16fV16fV16fV16fUsIi", "")
BUILTIN(__builtin_ia32_vfmaddpd128_mask, "V2dV2dV2dV2dUc", "")
BUILTIN(__builtin_ia32_vfmaddpd128_mask3, "V2dV2dV2dV2dUc", "")
BUILTIN(__builtin_ia32_vfmaddpd128_maskz, "V2dV2dV2dV2dUc", "")
BUILTIN(__builtin_ia32_vfmaddpd256_mask, "V4dV4dV4dV4dUc", "")
BUILTIN(__builtin_ia32_vfmaddpd256_mask3, "V4dV4dV4dV4dUc", "")
BUILTIN(__builtin_ia32_vfmaddpd256_maskz, "V4dV4dV4dV4dUc", "")
BUILTIN(__builtin_ia32_vfmaddpd512_mask, "V8dV8dV8dV8dUcIi", "")
BUILTIN(__builtin_ia32_vfmaddpd512_mask3, "V8dV8dV8dV8dUcIi", "")
BUILTIN(__builtin_ia32_vfmaddpd512_maskz, "V8dV8dV8dV8dUcIi", "")
BUILTIN(__builtin_ia32_vfmaddps128_mask, "V4fV4fV4fV4fUc", "")
BUILTIN(__builtin_ia32_vfmaddps128_mask3, "V4fV4fV4fV4fUc", "")
BUILTIN(__builtin_ia32_vfmaddps128_maskz, "V4fV4fV4fV4fUc", "")
BUILTIN(__builtin_ia32_vfmaddps256_mask, "V8fV8fV8fV8fUc", "")
BUILTIN(__builtin_ia32_vfmaddps256_mask3, "V8fV8fV8fV8fUc", "")
BUILTIN(__builtin_ia32_vfmaddps256_maskz, "V8fV8fV8fV8fUc", "")
BUILTIN(__builtin_ia32_vfmaddps512_mask, "V16fV16fV16fV16fUsIi", "")
BUILTIN(__builtin_ia32_vfmaddps512_mask3, "V16fV16fV16fV16fUsIi", "")
BUILTIN(__builtin_ia32_vfmaddps512_maskz, "V16fV16fV16fV16fUsIi", "")
BUILTIN(__builtin_ia32_vfmaddsubpd128_mask, "V2dV2dV2dV2dUc", "")
BUILTIN(__builtin_ia32_vfmaddsubpd128_mask3, "V2dV2dV2dV2dUc", "")
BUILTIN(__builtin_ia32_vfmaddsubpd128_maskz, "V2dV2dV2dV2dUc", "")
BUILTIN(__builtin_ia32_vfmaddsubpd256_mask, "V4dV4dV4dV4dUc", "")
BUILTIN(__builtin_ia32_vfmaddsubpd256_mask3, "V4dV4dV4dV4dUc", "")
BUILTIN(__builtin_ia32_vfmaddsubpd256_maskz, "V4dV4dV4dV4dUc", "")
BUILTIN(__builtin_ia32_vfmaddsubpd512_mask, "V8dV8dV8dV8dUcIi", "")
BUILTIN(__builtin_ia32_vfmaddsubpd512_mask3, "V8dV8dV8dV8dUcIi", "")
BUILTIN(__builtin_ia32_vfmaddsubpd512_maskz, "V8dV8dV8dV8dUcIi", "")
BUILTIN(__builtin_ia32_vfmaddsubps128_mask, "V4fV4fV4fV4fUc", "")
BUILTIN(__builtin_ia32_vfmaddsubps128_mask3, "V4fV4fV4fV4fUc", "")
BUILTIN(__builtin_ia32_vfmaddsubps128_maskz, "V4fV4fV4fV4fUc", "")
BUILTIN(__builtin_ia32_vfmaddsubps256_mask, "V8fV8fV8fV8fUc", "")
BUILTIN(__builtin_ia32_vfmaddsubps256_mask3, "V8fV8fV8fV8fUc", "")
BUILTIN(__builtin_ia32_vfmaddsubps256_maskz, "V8fV8fV8fV8fUc", "")
BUILTIN(__builtin_ia32_vfmaddsubps512_mask, "V16fV16fV16fV16fUsIi", "")
BUILTIN(__builtin_ia32_vfmaddsubps512_mask3, "V16fV16fV16fV16fUsIi", "")
BUILTIN(__builtin_ia32_vfmaddsubps512_maskz, "V16fV16fV16fV16fUsIi", "")
BUILTIN(__builtin_ia32_vfmsubpd128_mask3, "V2dV2dV2dV2dUc", "")
BUILTIN(__builtin_ia32_vfmsubpd256_mask3, "V4dV4dV4dV4dUc", "")
BUILTIN(__builtin_ia32_vfmsubpd512_mask3, "V8dV8dV8dV8dUcIi", "")
BUILTIN(__builtin_ia32_vfmsubps128_mask3, "V4fV4fV4fV4fUc", "")
BUILTIN(__builtin_ia32_vfmsubps256_mask3, "V8fV8fV8fV8fUc", "")
BUILTIN(__builtin_ia32_vfmsubps512_mask3, "V16fV16fV16fV16fUsIi", "")
BUILTIN(__builtin_ia32_vfmsubaddpd128_mask3, "V2dV2dV2dV2dUc", "")
BUILTIN(__builtin_ia32_vfmsubaddpd256_mask3, "V4dV4dV4dV4dUc", "")
BUILTIN(__builtin_ia32_vfmsubaddpd512_mask3, "V8dV8dV8dV8dUcIi", "")
BUILTIN(__builtin_ia32_vfmsubaddps128_mask3, "V4fV4fV4fV4fUc", "")
BUILTIN(__builtin_ia32_vfmsubaddps256_mask3, "V8fV8fV8fV8fUc", "")
BUILTIN(__builtin_ia32_vfmsubaddps512_mask3, "V16fV16fV16fV16fUsIi", "")
BUILTIN(__builtin_ia32_vfnmaddpd128_mask, "V2dV2dV2dV2dUc", "")
BUILTIN(__builtin_ia32_vfnmaddpd256_mask, "V4dV4dV4dV4dUc", "")
BUILTIN(__builtin_ia32_vfnmaddpd512_mask, "V8dV8dV8dV8dUcIi", "")
BUILTIN(__builtin_ia32_vfnmaddps128_mask, "V4fV4fV4fV4fUc", "")
BUILTIN(__builtin_ia32_vfnmaddps256_mask, "V8fV8fV8fV8fUc", "")
BUILTIN(__builtin_ia32_vfnmaddps512_mask, "V16fV16fV16fV16fUsIi", "")
BUILTIN(__builtin_ia32_vfnmsubpd128_mask, "V2dV2dV2dV2dUc", "")
BUILTIN(__builtin_ia32_vfnmsubpd128_mask3, "V2dV2dV2dV2dUc", "")
BUILTIN(__builtin_ia32_vfnmsubpd256_mask, "V4dV4dV4dV4dUc", "")
BUILTIN(__builtin_ia32_vfnmsubpd256_mask3, "V4dV4dV4dV4dUc", "")
BUILTIN(__builtin_ia32_vfnmsubpd512_mask, "V8dV8dV8dV8dUcIi", "")
BUILTIN(__builtin_ia32_vfnmsubpd512_mask3, "V8dV8dV8dV8dUcIi", "")
BUILTIN(__builtin_ia32_vfnmsubps128_mask, "V4fV4fV4fV4fUc", "")
BUILTIN(__builtin_ia32_vfnmsubps128_mask3, "V4fV4fV4fV4fUc", "")
BUILTIN(__builtin_ia32_vfnmsubps256_mask, "V8fV8fV8fV8fUc", "")
BUILTIN(__builtin_ia32_vfnmsubps256_mask3, "V8fV8fV8fV8fUc", "")
BUILTIN(__builtin_ia32_vfnmsubps512_mask, "V16fV16fV16fV16fUsIi", "")
BUILTIN(__builtin_ia32_vfnmsubps512_mask3, "V16fV16fV16fV16fUsIi", "")
// XOP
BUILTIN(__builtin_ia32_vpmacssww, "V8sV8sV8sV8s", "")
@ -1052,5 +1123,39 @@ BUILTIN(__builtin_ia32_orpd256_mask, "V4dV4dV4dV4dUc", "")
BUILTIN(__builtin_ia32_orpd128_mask, "V2dV2dV2dV2dUc", "")
BUILTIN(__builtin_ia32_orps256_mask, "V8fV8fV8fV8fUc", "")
BUILTIN(__builtin_ia32_orps128_mask, "V4fV4fV4fV4fUc", "")
BUILTIN(__builtin_ia32_blendmb_512_mask, "V64cV64cV64cULLi", "")
BUILTIN(__builtin_ia32_blendmw_512_mask, "V32sV32sV32sUi", "")
BUILTIN(__builtin_ia32_pabsb512_mask, "V64cV64cV64cULLi", "")
BUILTIN(__builtin_ia32_pabsw512_mask, "V32sV32sV32sUi", "")
BUILTIN(__builtin_ia32_packssdw512_mask, "V32sV16iV16iV32sUi", "")
BUILTIN(__builtin_ia32_packsswb512_mask, "V64cV32sV32sV64cULLi", "")
BUILTIN(__builtin_ia32_packusdw512_mask, "V32sV16iV16iV32sUi", "")
BUILTIN(__builtin_ia32_packuswb512_mask, "V64cV32sV32sV64cULLi", "")
BUILTIN(__builtin_ia32_paddsb512_mask, "V64cV64cV64cV64cULLi", "")
BUILTIN(__builtin_ia32_paddsw512_mask, "V32sV32sV32sV32sUi", "")
BUILTIN(__builtin_ia32_paddusb512_mask, "V64cV64cV64cV64cULLi", "")
BUILTIN(__builtin_ia32_paddusw512_mask, "V32sV32sV32sV32sUi", "")
BUILTIN(__builtin_ia32_pavgb512_mask, "V64cV64cV64cV64cULLi", "")
BUILTIN(__builtin_ia32_pavgw512_mask, "V32sV32sV32sV32sUi", "")
BUILTIN(__builtin_ia32_pmaxsb512_mask, "V64cV64cV64cV64cULLi", "")
BUILTIN(__builtin_ia32_pmaxsw512_mask, "V32sV32sV32sV32sUi", "")
BUILTIN(__builtin_ia32_pmaxub512_mask, "V64cV64cV64cV64cULLi", "")
BUILTIN(__builtin_ia32_pmaxuw512_mask, "V32sV32sV32sV32sUi", "")
BUILTIN(__builtin_ia32_pminsb512_mask, "V64cV64cV64cV64cULLi", "")
BUILTIN(__builtin_ia32_pminsw512_mask, "V32sV32sV32sV32sUi", "")
BUILTIN(__builtin_ia32_pminub512_mask, "V64cV64cV64cV64cULLi", "")
BUILTIN(__builtin_ia32_pminuw512_mask, "V32sV32sV32sV32sUi", "")
BUILTIN(__builtin_ia32_pshufb512_mask, "V64cV64cV64cV64cULLi", "")
BUILTIN(__builtin_ia32_psubsb512_mask, "V64cV64cV64cV64cULLi", "")
BUILTIN(__builtin_ia32_psubsw512_mask, "V32sV32sV32sV32sUi", "")
BUILTIN(__builtin_ia32_psubusb512_mask, "V64cV64cV64cV64cULLi", "")
BUILTIN(__builtin_ia32_psubusw512_mask, "V32sV32sV32sV32sUi", "")
BUILTIN(__builtin_ia32_vpermi2varhi512_mask, "V32sV32sV32sV32sUi", "")
BUILTIN(__builtin_ia32_vpermt2varhi512_mask, "V32sV32sV32sV32sUi", "")
BUILTIN(__builtin_ia32_vpermt2varhi512_maskz, "V32sV32sV32sV32sUi", "")
BUILTIN(__builtin_ia32_vpconflictdi_512_mask, "V8LLiV8LLiV8LLiUc", "")
BUILTIN(__builtin_ia32_vpconflictsi_512_mask, "V16iV16iV16iUs", "")
BUILTIN(__builtin_ia32_vplzcntd_512_mask, "V16iV16iV16iUs", "")
BUILTIN(__builtin_ia32_vplzcntq_512_mask, "V8LLiV8LLiV8LLiUc", "")
#undef BUILTIN

View File

@ -18,6 +18,7 @@
#include "clang/Basic/DiagnosticIDs.h"
#include "clang/Basic/DiagnosticOptions.h"
#include "clang/Basic/SourceLocation.h"
#include "clang/Basic/Specifiers.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/IntrusiveRefCntPtr.h"
@ -1107,6 +1108,13 @@ inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB,
return DB;
}
/// A nullability kind paired with a bit indicating whether it used a
/// context-sensitive keyword.
typedef std::pair<NullabilityKind, bool> DiagNullabilityKind;
const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB,
DiagNullabilityKind nullability);
inline DiagnosticBuilder DiagnosticsEngine::Report(SourceLocation Loc,
unsigned DiagID) {
assert(CurDiagID == ~0U && "Multiple diagnostics in flight at once!");

View File

@ -102,31 +102,21 @@ def err_enum_template : Error<"enumeration cannot be a template">;
let CategoryName = "Nullability Issue" in {
def warn_nullability_duplicate : Warning<
"duplicate nullability specifier "
"'%select{__|}1%select{nonnull|nullable|null_unspecified}0'">,
"duplicate nullability specifier %0">,
InGroup<Nullability>;
def warn_conflicting_nullability_attr_overriding_ret_types : Warning<
"conflicting nullability specifier on return types, "
"'%select{%select{__|}1nonnull|"
"%select{__|}1nullable|%select{__|}1null_unspecified}0' "
"conflicts with existing specifier '%select{%select{__|}3nonnull|"
"%select{__|}3nullable|%select{__|}3null_unspecified}2'">,
"conflicting nullability specifier on return types, %0 "
"conflicts with existing specifier %1">,
InGroup<Nullability>;
def warn_conflicting_nullability_attr_overriding_param_types : Warning<
"conflicting nullability specifier on parameter types, "
"'%select{%select{__|}1nonnull|"
"%select{__|}1nullable|%select{__|}1null_unspecified}0' "
"conflicts with existing specifier '%select{%select{__|}3nonnull|"
"%select{__|}3nullable|%select{__|}3null_unspecified}2'">,
"conflicting nullability specifier on parameter types, %0 "
"conflicts with existing specifier %1">,
InGroup<Nullability>;
def err_nullability_conflicting : Error<
"nullability specifier "
"'%select{__|}1%select{nonnull|nullable|null_unspecified}0' conflicts with "
"existing specifier '%select{__|}3%select{nonnull|nullable|"
"null_unspecified}2'">;
"nullability specifier %0 conflicts with existing specifier %1">;
}

View File

@ -426,6 +426,7 @@ def warn_redecl_library_builtin : Warning<
InGroup<DiagGroup<"incompatible-library-redeclaration">>;
def err_builtin_definition : Error<"definition of builtin function %0">;
def err_arm_invalid_specialreg : Error<"invalid special register for builtin">;
def err_invalid_cpu_supports : Error<"invalid cpu feature string for builtin">;
def warn_builtin_unknown : Warning<"use of unknown builtin %0">,
InGroup<ImplicitFunctionDeclare>, DefaultError;
def warn_dyn_class_memaccess : Warning<
@ -1050,6 +1051,7 @@ def ext_friend_tag_redecl_outside_namespace : ExtWarn<
"unqualified friend declaration referring to type outside of the nearest "
"enclosing namespace is a Microsoft extension; add a nested name specifier">,
InGroup<Microsoft>;
def err_pure_friend : Error<"friend declaration cannot have a pure-specifier">;
def err_invalid_member_in_interface : Error<
"%select{data member |non-public member function |static member function |"
@ -1262,6 +1264,8 @@ def ext_mutable_reference : ExtWarn<
def err_mutable_const : Error<"'mutable' and 'const' cannot be mixed">;
def err_mutable_nonmember : Error<
"'mutable' can only be applied to member variables">;
def err_virtual_in_union : Error<
"unions cannot have virtual functions">;
def err_virtual_non_function : Error<
"'virtual' can only appear on non-static member functions">;
def err_virtual_out_of_class : Error<
@ -2081,12 +2085,16 @@ def err_attr_objc_ownership_redundant : Error<
"the type %0 is already explicitly ownership-qualified">;
def err_undeclared_nsnumber : Error<
"NSNumber must be available to use Objective-C literals">;
def err_undeclared_nsvalue : Error<
"NSValue must be available to use Objective-C boxed expressions">;
def err_invalid_nsnumber_type : Error<
"%0 is not a valid literal type for NSNumber">;
def err_undeclared_nsstring : Error<
"cannot box a string value because NSString has not been declared">;
def err_objc_illegal_boxed_expression_type : Error<
"illegal type %0 used in a boxed expression">;
def err_objc_non_trivially_copyable_boxed_expression_type : Error<
"non-trivially copyable type %0 cannot be used in a boxed expression">;
def err_objc_incomplete_boxed_expression_type : Error<
"incomplete type %0 used in a boxed expression">;
def err_undeclared_nsarray : Error<
@ -2190,7 +2198,7 @@ def err_attribute_invalid_on_stmt : Error<
"%0 attribute cannot be applied to a statement">;
def warn_declspec_attribute_ignored : Warning<
"attribute %0 is ignored, place it after "
"\"%select{class|struct|union|interface|enum}1\" to apply attribute to "
"\"%select{class|struct|interface|union|enum}1\" to apply attribute to "
"type declaration">, InGroup<IgnoredAttributes>;
def warn_attribute_precede_definition : Warning<
"attribute declaration must precede definition">,
@ -4690,13 +4698,15 @@ def ext_sizeof_alignof_void_type : Extension<
"invalid application of '%select{sizeof|alignof|vec_step}0' to a void "
"type">, InGroup<PointerArith>;
def err_opencl_sizeof_alignof_type : Error<
"invalid application of '%select{sizeof|alignof|vec_step}0' to a void type">;
"invalid application of '%select{sizeof|alignof|vec_step|__builtin_omp_required_simd_align}0' to a void type">;
def err_sizeof_alignof_incomplete_type : Error<
"invalid application of '%select{sizeof|alignof|vec_step}0' to an "
"invalid application of '%select{sizeof|alignof|vec_step|__builtin_omp_required_simd_align}0' to an "
"incomplete type %1">;
def err_sizeof_alignof_function_type : Error<
"invalid application of '%select{sizeof|alignof|vec_step}0' to a "
"invalid application of '%select{sizeof|alignof|vec_step|__builtin_omp_required_simd_align}0' to a "
"function type">;
def err_openmp_default_simd_align_expr : Error<
"invalid application of '__builtin_omp_required_simd_align' to an expression, only type is allowed">;
def err_sizeof_alignof_bitfield : Error<
"invalid application of '%select{sizeof|alignof}0' to bit-field">;
def err_alignof_member_of_incomplete_type : Error<
@ -6791,6 +6801,15 @@ def warn_format_non_standard_conversion_spec: Warning<
def warn_printf_ignored_flag: Warning<
"flag '%0' is ignored when flag '%1' is present">,
InGroup<Format>;
def warn_printf_empty_objc_flag: Warning<
"missing object format flag">,
InGroup<Format>;
def warn_printf_ObjCflags_without_ObjCConversion: Warning<
"object format flags cannot be used with '%0' conversion specifier">,
InGroup<Format>;
def warn_printf_invalid_objc_flag: Warning<
"'%0' is not a valid object format flag">,
InGroup<Format>;
def warn_scanf_scanlist_incomplete : Warning<
"no closing ']' for '%%[' in scanf format string">,
InGroup<Format>;
@ -7413,6 +7432,8 @@ def err_omp_unexpected_clause_value : Error<
"expected %0 in OpenMP clause '%1'">;
def err_omp_expected_var_name : Error<
"expected variable name">;
def err_omp_expected_var_name_or_array_item : Error<
"expected variable name, array element or array section">;
def note_omp_task_predetermined_firstprivate_here : Note<
"predetermined as a firstprivate in a task construct here">;
def err_omp_clause_ref_type_arg : Error<
@ -7601,6 +7622,12 @@ def err_omp_single_copyprivate_with_nowait : Error<
"the 'copyprivate' clause must not be used with the 'nowait' clause">;
def note_omp_nowait_clause_here : Note<
"'nowait' clause is here">;
def err_omp_wrong_cancel_region : Error<
"one of 'for', 'parallel', 'sections' or 'taskgroup' is expected">;
def err_omp_parent_cancel_region_nowait : Error<
"parent region for 'omp %select{cancellation point/cancel}0' construct cannot be nowait">;
def err_omp_parent_cancel_region_ordered : Error<
"parent region for 'omp %select{cancellation point/cancel}0' construct cannot be ordered">;
} // end of OpenMP category
let CategoryName = "Related Result Type Issue" in {
@ -7677,28 +7704,21 @@ def warn_profile_data_unprofiled : Warning<
let CategoryName = "Nullability Issue" in {
def warn_mismatched_nullability_attr : Warning<
"nullability specifier "
"'%select{__|}1%select{nonnull|nullable|null_unspecified}0' "
"conflicts with existing specifier "
"'%select{__|}3%select{nonnull|nullable|null_unspecified}2'">,
"nullability specifier %0 conflicts with existing specifier %1">,
InGroup<Nullability>;
def warn_nullability_declspec : Warning<
"nullability specifier "
"'%select{__nonnull|__nullable|__null_unspecified}0' cannot be applied "
"nullability specifier %0 cannot be applied "
"to non-pointer type %1; did you mean to apply the specifier to the "
"%select{pointer|block pointer|member pointer|function pointer|"
"member function pointer}2?">,
InGroup<NullabilityDeclSpec>,
DefaultError;
def note_nullability_here : Note<
"'%select{__nonnull|__nullable|__null_unspecified}0' specified here">;
def note_nullability_here : Note<"%0 specified here">;
def err_nullability_nonpointer : Error<
"nullability specifier "
"'%select{__|}1%select{nonnull|nullable|null_unspecified}0' cannot be applied "
"to non-pointer type %2">;
"nullability specifier %0 cannot be applied to non-pointer type %1">;
def warn_nullability_lost : Warning<
"implicit conversion from nullable pointer %0 to non-nullable pointer "
@ -7706,12 +7726,9 @@ def warn_nullability_lost : Warning<
InGroup<NullableToNonNullConversion>, DefaultIgnore;
def err_nullability_cs_multilevel : Error<
"nullability keyword "
"'%select{nonnull|nullable|null_unspecified}0' cannot be applied to "
"multi-level pointer type %1">;
"nullability keyword %0 cannot be applied to multi-level pointer type %1">;
def note_nullability_type_specifier : Note<
"use nullability type specifier "
"'%select{__nonnull|__nullable|__null_unspecified}0' to affect the innermost "
"use nullability type specifier %0 to affect the innermost "
"pointer type of %1">;
def warn_null_resettable_setter : Warning<
@ -7720,7 +7737,7 @@ def warn_null_resettable_setter : Warning<
def warn_nullability_missing : Warning<
"%select{pointer|block pointer|member pointer}0 is missing a nullability "
"type specifier (__nonnull, __nullable, or __null_unspecified)">,
"type specifier (_Nonnull, _Nullable, or _Null_unspecified)">,
InGroup<NullabilityCompleteness>;
}

View File

@ -406,19 +406,6 @@ class IdentifierInfoLookup {
virtual IdentifierIterator *getIdentifiers();
};
/// \brief An abstract class used to resolve numerical identifier
/// references (meaningful only to some external source) into
/// IdentifierInfo pointers.
class ExternalIdentifierLookup {
public:
virtual ~ExternalIdentifierLookup();
/// \brief Return the identifier associated with the given ID number.
///
/// The ID 0 is associated with the NULL identifier.
virtual IdentifierInfo *GetIdentifier(unsigned ID) = 0;
};
/// \brief Implements an efficient mapping from strings to IdentifierInfo nodes.
///
/// This has no other purpose, but this is an extremely performance-critical

View File

@ -130,6 +130,7 @@ COMPATIBLE_LANGOPT(ModulesStrictDeclUse, 1, 0, "require declaration of module us
BENIGN_LANGOPT(ModulesErrorRecovery, 1, 1, "automatically import modules as needed when performing error recovery")
BENIGN_LANGOPT(ImplicitModules, 1, 1, "build modules that are not specified via -fmodule-file")
COMPATIBLE_LANGOPT(ModulesLocalVisibility, 1, 0, "local submodule visibility")
COMPATIBLE_LANGOPT(ModulesHideInternalLinkage, 1, 1, "hiding non-visible internal linkage declarations from redeclaration lookup")
COMPATIBLE_LANGOPT(Optimize , 1, 0, "__OPTIMIZE__ predefined macro")
COMPATIBLE_LANGOPT(OptimizeSize , 1, 0, "__OPTIMIZE_SIZE__ predefined macro")
LANGOPT(Static , 1, 0, "__STATIC__ predefined macro (as opposed to __DYNAMIC__)")

View File

@ -102,6 +102,8 @@ class LangOptions : public LangOptionsBase {
/// \brief The names of any features to enable in module 'requires' decls
/// in addition to the hard-coded list in Module.cpp and the target features.
///
/// This list is sorted.
std::vector<std::string> ModuleFeatures;
/// \brief Options for parsing comments.

View File

@ -66,6 +66,9 @@ class Module {
/// \brief The umbrella header or directory.
llvm::PointerUnion<const DirectoryEntry *, const FileEntry *> Umbrella;
/// \brief The module signature.
uint64_t Signature;
/// \brief The name of the umbrella entry, as written in the module map.
std::string UmbrellaAsWritten;

View File

@ -69,6 +69,9 @@
#ifndef OPENMP_SCHEDULE_KIND
#define OPENMP_SCHEDULE_KIND(Name)
#endif
#ifndef OPENMP_DEPEND_KIND
#define OPENMP_DEPEND_KIND(Name)
#endif
// OpenMP directives.
OPENMP_DIRECTIVE(threadprivate)
@ -90,10 +93,12 @@ OPENMP_DIRECTIVE(ordered)
OPENMP_DIRECTIVE(atomic)
OPENMP_DIRECTIVE(target)
OPENMP_DIRECTIVE(teams)
OPENMP_DIRECTIVE(cancel)
OPENMP_DIRECTIVE_EXT(parallel_for, "parallel for")
OPENMP_DIRECTIVE_EXT(parallel_for_simd, "parallel for simd")
OPENMP_DIRECTIVE_EXT(parallel_sections, "parallel sections")
OPENMP_DIRECTIVE_EXT(for_simd, "for simd")
OPENMP_DIRECTIVE_EXT(cancellation_point, "cancellation point")
// OpenMP clauses.
OPENMP_CLAUSE(if, OMPIfClause)
@ -123,6 +128,7 @@ OPENMP_CLAUSE(write, OMPWriteClause)
OPENMP_CLAUSE(update, OMPUpdateClause)
OPENMP_CLAUSE(capture, OMPCaptureClause)
OPENMP_CLAUSE(seq_cst, OMPSeqCstClause)
OPENMP_CLAUSE(depend, OMPDependClause)
// Clauses allowed for OpenMP directive 'parallel'.
OPENMP_PARALLEL_CLAUSE(if)
@ -195,6 +201,11 @@ OPENMP_SCHEDULE_KIND(guided)
OPENMP_SCHEDULE_KIND(auto)
OPENMP_SCHEDULE_KIND(runtime)
// Static attributes for 'depend' clause.
OPENMP_DEPEND_KIND(in)
OPENMP_DEPEND_KIND(out)
OPENMP_DEPEND_KIND(inout)
// Clauses allowed for OpenMP directive 'parallel for'.
OPENMP_PARALLEL_FOR_CLAUSE(if)
OPENMP_PARALLEL_FOR_CLAUSE(num_threads)
@ -248,6 +259,7 @@ OPENMP_TASK_CLAUSE(firstprivate)
OPENMP_TASK_CLAUSE(shared)
OPENMP_TASK_CLAUSE(untied)
OPENMP_TASK_CLAUSE(mergeable)
OPENMP_TASK_CLAUSE(depend)
// Clauses allowed for OpenMP directive 'atomic'.
OPENMP_ATOMIC_CLAUSE(read)
@ -268,6 +280,7 @@ OPENMP_TEAMS_CLAUSE(firstprivate)
OPENMP_TEAMS_CLAUSE(shared)
OPENMP_TEAMS_CLAUSE(reduction)
#undef OPENMP_DEPEND_KIND
#undef OPENMP_SCHEDULE_KIND
#undef OPENMP_PROC_BIND_KIND
#undef OPENMP_DEFAULT_KIND

View File

@ -62,6 +62,14 @@ enum OpenMPScheduleClauseKind {
OMPC_SCHEDULE_unknown
};
/// \brief OpenMP attributes for 'depend' clause.
enum OpenMPDependClauseKind {
#define OPENMP_DEPEND_KIND(Name) \
OMPC_DEPEND_##Name,
#include "clang/Basic/OpenMPKinds.def"
OMPC_DEPEND_unknown
};
OpenMPDirectiveKind getOpenMPDirectiveKind(llvm::StringRef Str);
const char *getOpenMPDirectiveName(OpenMPDirectiveKind Kind);

View File

@ -257,7 +257,8 @@ namespace clang {
};
/// Retrieve the spelling of the given nullability kind.
llvm::StringRef getNullabilitySpelling(NullabilityKind kind);
llvm::StringRef getNullabilitySpelling(NullabilityKind kind,
bool isContextSensitive = false);
} // end namespace clang
#endif // LLVM_CLANG_BASIC_SPECIFIERS_H

View File

@ -205,3 +205,5 @@ def OMPOrderedDirective : DStmt<OMPExecutableDirective>;
def OMPAtomicDirective : DStmt<OMPExecutableDirective>;
def OMPTargetDirective : DStmt<OMPExecutableDirective>;
def OMPTeamsDirective : DStmt<OMPExecutableDirective>;
def OMPCancellationPointDirective : DStmt<OMPExecutableDirective>;
def OMPCancelDirective : DStmt<OMPExecutableDirective>;

View File

@ -70,6 +70,7 @@ class TargetInfo : public RefCountedBase<TargetInfo> {
unsigned char MinGlobalAlign;
unsigned char MaxAtomicPromoteWidth, MaxAtomicInlineWidth;
unsigned short MaxVectorAlign;
unsigned short SimdDefaultAlign;
const char *DescriptionString;
const char *UserLabelPrefix;
const char *MCountName;
@ -393,6 +394,10 @@ class TargetInfo : public RefCountedBase<TargetInfo> {
/// \brief Return the maximum vector alignment supported for the given target.
unsigned getMaxVectorAlign() const { return MaxVectorAlign; }
/// \brief Return default simd alignment for the given target. Generally, this
/// value is type-specific, but this alignment can be used for most of the
/// types for the given target.
unsigned getSimdDefaultAlign() const { return SimdDefaultAlign; }
/// \brief Return the size of intmax_t and uintmax_t for this target, in bits.
unsigned getIntMaxTWidth() const {
@ -611,6 +616,9 @@ class TargetInfo : public RefCountedBase<TargetInfo> {
}
};
// Validate the contents of the __builtin_cpu_supports(const char*) argument.
virtual bool validateCpuSupports(StringRef Name) const { return false; }
// validateOutputConstraint, validateInputConstraint - Checks that
// a constraint is valid and provides information about it.
// FIXME: These should return a real error instead of just true/false.

View File

@ -503,6 +503,9 @@ ALIAS("read_write", __read_write , KEYOPENCL)
KEYWORD(__builtin_astype , KEYOPENCL)
KEYWORD(vec_step , KEYOPENCL|KEYALTIVEC)
// OpenMP Type Traits
KEYWORD(__builtin_omp_required_simd_align, KEYALL)
// Borland Extensions.
KEYWORD(__pascal , KEYALL)
@ -549,9 +552,9 @@ ALIAS("__volatile" , volatile , KEYALL)
ALIAS("__volatile__" , volatile , KEYALL)
// Type nullability.
KEYWORD(__nonnull , KEYALL)
KEYWORD(__nullable , KEYALL)
KEYWORD(__null_unspecified , KEYALL)
KEYWORD(_Nonnull , KEYALL)
KEYWORD(_Nullable , KEYALL)
KEYWORD(_Null_unspecified , KEYALL)
// Microsoft extensions which should be disabled in strict conformance mode
KEYWORD(__ptr64 , KEYMS)

View File

@ -92,7 +92,8 @@ namespace clang {
enum UnaryExprOrTypeTrait {
UETT_SizeOf,
UETT_AlignOf,
UETT_VecStep
UETT_VecStep,
UETT_OpenMPRequiredSimdAlign,
};
}

View File

@ -37,9 +37,11 @@ namespace clang {
class ASTContext;
class CXXRecordDecl;
class CodeGenOptions;
class DiagnosticsEngine;
class ObjCMethodDecl;
class CoverageSourceInfo;
class DiagnosticsEngine;
class HeaderSearchOptions;
class ObjCMethodDecl;
class PreprocessorOptions;
namespace CodeGen {
class CGFunctionInfo;
@ -74,6 +76,8 @@ class CodeGenABITypes
/// CodeGenModule and otherwise not used. More specifically, it is
/// not used in ABI type generation, so none of the options matter.
CodeGenOptions *CGO;
HeaderSearchOptions *HSO;
PreprocessorOptions *PPO;
/// The CodeGenModule we use get to the CodeGenTypes object.
CodeGen::CodeGenModule *CGM;

View File

@ -26,6 +26,8 @@ namespace clang {
class DiagnosticsEngine;
class CoverageSourceInfo;
class LangOptions;
class HeaderSearchOptions;
class PreprocessorOptions;
class CodeGenOptions;
class Decl;
@ -42,6 +44,8 @@ namespace clang {
/// the allocated CodeGenerator instance.
CodeGenerator *CreateLLVMCodeGen(DiagnosticsEngine &Diags,
const std::string &ModuleName,
const HeaderSearchOptions &HeaderSearchOpts,
const PreprocessorOptions &PreprocessorOpts,
const CodeGenOptions &CGO,
llvm::LLVMContext& C,
CoverageSourceInfo *CoverageInfo = nullptr);

View File

@ -369,6 +369,10 @@ def fmodules_local_submodule_visibility :
Flag<["-"], "fmodules-local-submodule-visibility">,
HelpText<"Enforce name visibility rules across submodules of the same "
"top-level module.">;
def fno_modules_hide_internal_linkage :
Flag<["-"], "fno-modules-hide-internal-linkage">,
HelpText<"Make all declarations visible to redeclaration lookup, "
"even if they have internal linkage.">;
def fconcepts_ts : Flag<["-"], "fconcepts-ts">,
HelpText<"Enable C++ Extensions for Concepts.">;

View File

@ -52,16 +52,18 @@ class CLRemainingArgs<string name> : Option<["/", "-"], name,
// (We don't put any of these in cl_compile_Group as the options they alias are
// already in the right group.)
def _SLASH_C : CLFlag<"C">, HelpText<"Don't discard comments when preprocessing">,
Alias<C>;
def _SLASH_C : CLFlag<"C">,
HelpText<"Don't discard comments when preprocessing">, Alias<C>;
def _SLASH_c : CLFlag<"c">, HelpText<"Compile only">, Alias<c>;
def _SLASH_D : CLJoinedOrSeparate<"D">, HelpText<"Define macro">,
MetaVarName<"<macro[=value]>">, Alias<D>;
def _SLASH_E : CLFlag<"E">, HelpText<"Preprocess to stdout">, Alias<E>;
def _SLASH_fp_except : CLFlag<"fp:except">, HelpText<"">, Alias<ftrapping_math>;
def _SLASH_fp_except_ : CLFlag<"fp:except-">, HelpText<"">, Alias<fno_trapping_math>;
def _SLASH_fp_except_ : CLFlag<"fp:except-">,
HelpText<"">, Alias<fno_trapping_math>;
def _SLASH_fp_fast : CLFlag<"fp:fast">, HelpText<"">, Alias<ffast_math>;
def _SLASH_fp_precise : CLFlag<"fp:precise">, HelpText<"">, Alias<fno_fast_math>;
def _SLASH_fp_precise : CLFlag<"fp:precise">,
HelpText<"">, Alias<fno_fast_math>;
def _SLASH_fp_strict : CLFlag<"fp:strict">, HelpText<"">, Alias<fno_fast_math>;
def _SLASH_GA : CLFlag<"GA">, Alias<ftlsmodel_EQ>, AliasArgs<["local-exec"]>,
HelpText<"Assume thread-local variables are defined in the executable">;
@ -73,11 +75,13 @@ def _SLASH_Gs : CLJoined<"Gs">, HelpText<"Set stack probe size">,
Alias<mstack_probe_size>;
def _SLASH_Gy : CLFlag<"Gy">, HelpText<"Put each function in its own section">,
Alias<ffunction_sections>;
def _SLASH_Gy_ : CLFlag<"Gy-">, HelpText<"Don't put each function in its own section">,
def _SLASH_Gy_ : CLFlag<"Gy-">,
HelpText<"Don't put each function in its own section">,
Alias<fno_function_sections>;
def _SLASH_Gw : CLFlag<"Gw">, HelpText<"Put each data item in its own section">,
Alias<fdata_sections>;
def _SLASH_Gw_ : CLFlag<"Gw-">, HelpText<"Don't put each data item in its own section">,
def _SLASH_Gw_ : CLFlag<"Gw-">,
HelpText<"Don't put each data item in its own section">,
Alias<fno_data_sections>;
def _SLASH_help : CLFlag<"help">, Alias<help>,
HelpText<"Display available options">;
@ -109,21 +113,15 @@ def _SLASH_Oy_ : CLFlag<"Oy-">, HelpText<"Disable frame pointer omission">,
Alias<fno_omit_frame_pointer>;
def _SLASH_QUESTION : CLFlag<"?">, Alias<help>,
HelpText<"Display available options">;
def _SLASH_Qvec : CLFlag<"Qvec">,
HelpText<"Enable the loop vectorization passes">, Alias<fvectorize>;
def _SLASH_Qvec_ : CLFlag<"Qvec-">,
HelpText<"Disable the loop vectorization passes">, Alias<fno_vectorize>;
def _SLASH_showIncludes : CLFlag<"showIncludes">,
HelpText<"Print info about included files to stderr">,
Alias<show_includes>;
def _SLASH_U : CLJoinedOrSeparate<"U">, HelpText<"Undefine macro">,
MetaVarName<"<macro>">, Alias<U>;
def _SLASH_vmb : CLFlag<"vmb">,
HelpText<"Use a best-case representation method for member pointers">;
def _SLASH_vmg : CLFlag<"vmg">,
HelpText<"Use a most-general representation for member pointers">;
def _SLASH_vms : CLFlag<"vms">,
HelpText<"Set the default most-general representation to single inheritance">;
def _SLASH_vmm : CLFlag<"vmm">,
HelpText<"Set the default most-general representation to multiple inheritance">;
def _SLASH_vmv : CLFlag<"vmv">,
HelpText<"Set the default most-general representation to virtual inheritance">;
def _SLASH_W0 : CLFlag<"W0">, HelpText<"Disable all warnings">, Alias<w>;
def _SLASH_W1 : CLFlag<"W1">, HelpText<"Enable -Wall">, Alias<Wall>;
def _SLASH_W2 : CLFlag<"W2">, HelpText<"Enable -Wall">, Alias<Wall>;
@ -181,7 +179,8 @@ def _SLASH_arch : CLCompileJoined<"arch:">,
HelpText<"Set architecture for code generation">;
def _SLASH_M_Group : OptionGroup<"</M group>">, Group<cl_compile_Group>;
def _SLASH_volatile_Group : OptionGroup<"</volatile group>">, Group<cl_compile_Group>;
def _SLASH_volatile_Group : OptionGroup<"</volatile group>">,
Group<cl_compile_Group>;
def _SLASH_EH : CLJoined<"EH">, HelpText<"Exception handling model">;
def _SLASH_EP : CLFlag<"EP">,
@ -220,22 +219,30 @@ def _SLASH_o : CLJoinedOrSeparate<"o">,
HelpText<"Set output file or directory (ends in / or \\)">,
MetaVarName<"<file or directory>">;
def _SLASH_P : CLFlag<"P">, HelpText<"Preprocess to file">;
def _SLASH_Qvec : CLFlag<"Qvec">,
HelpText<"Enable the loop vectorization passes">,
Alias<fvectorize>;
def _SLASH_Qvec_ : CLFlag<"Qvec-">,
HelpText<"Disable the loop vectorization passes">,
Alias<fno_vectorize>;
def _SLASH_Tc : CLCompileJoinedOrSeparate<"Tc">,
HelpText<"Specify a C source file">, MetaVarName<"<filename>">;
def _SLASH_TC : CLCompileFlag<"TC">, HelpText<"Treat all source files as C">;
def _SLASH_Tp : CLCompileJoinedOrSeparate<"Tp">,
HelpText<"Specify a C++ source file">, MetaVarName<"<filename>">;
def _SLASH_TP : CLCompileFlag<"TP">, HelpText<"Treat all source files as C++">;
def _SLASH_volatile_iso : Option<["/", "-"], "volatile:iso", KIND_FLAG>, Group<_SLASH_volatile_Group>,
Flags<[CLOption, DriverOption]>, HelpText<"Volatile loads and stores have standard semantics">;
def _SLASH_volatile_ms : Option<["/", "-"], "volatile:ms", KIND_FLAG>, Group<_SLASH_volatile_Group>,
Flags<[CLOption, DriverOption]>, HelpText<"Volatile loads and stores have acquire and release semantics">;
def _SLASH_volatile_iso : Option<["/", "-"], "volatile:iso", KIND_FLAG>,
Group<_SLASH_volatile_Group>, Flags<[CLOption, DriverOption]>,
HelpText<"Volatile loads and stores have standard semantics">;
def _SLASH_vmb : CLFlag<"vmb">,
HelpText<"Use a best-case representation method for member pointers">;
def _SLASH_vmg : CLFlag<"vmg">,
HelpText<"Use a most-general representation for member pointers">;
def _SLASH_vms : CLFlag<"vms">,
HelpText<"Set the default most-general representation to single inheritance">;
def _SLASH_vmm : CLFlag<"vmm">,
HelpText<"Set the default most-general representation to "
"multiple inheritance">;
def _SLASH_vmv : CLFlag<"vmv">,
HelpText<"Set the default most-general representation to "
"virtual inheritance">;
def _SLASH_volatile_ms : Option<["/", "-"], "volatile:ms", KIND_FLAG>,
Group<_SLASH_volatile_Group>, Flags<[CLOption, DriverOption]>,
HelpText<"Volatile loads and stores have acquire and release semantics">;
// Ignored:

View File

@ -169,8 +169,9 @@ class Compilation {
///
/// \param FailingCommands - For non-zero results, this will be a vector of
/// failing commands and their associated result code.
void ExecuteJob(const Job &J,
SmallVectorImpl< std::pair<int, const Command *> > &FailingCommands) const;
void ExecuteJobs(
const JobList &Jobs,
SmallVectorImpl<std::pair<int, const Command *>> &FailingCommands) const;
/// initCompilationForDiagnostics - Remove stale state and suppress output
/// so compilation can be reexecuted to generate additional diagnostic

View File

@ -42,7 +42,7 @@ namespace driver {
class Command;
class Compilation;
class InputInfo;
class Job;
class JobList;
class JobAction;
class SanitizerArgs;
class ToolChain;
@ -195,7 +195,7 @@ class Driver {
llvm::opt::Arg **FinalPhaseArg = nullptr) const;
// Before executing jobs, sets up response files for commands that need them.
void setUpResponseFiles(Compilation &C, Job &J);
void setUpResponseFiles(Compilation &C, Command &Cmd);
void generatePrefixedToolNames(const char *Tool, const ToolChain &TC,
SmallVectorImpl<std::string> &Names) const;
@ -262,7 +262,7 @@ class Driver {
/// ParseArgStrings - Parse the given list of strings into an
/// ArgList.
llvm::opt::InputArgList *ParseArgStrings(ArrayRef<const char *> Args);
llvm::opt::InputArgList ParseArgStrings(ArrayRef<const char *> Args);
/// BuildInputs - Construct the list of inputs and their types from
/// the given arguments.

View File

@ -37,37 +37,9 @@ struct CrashReportInfo {
: Filename(Filename), VFSPath(VFSPath) {}
};
class Job {
public:
enum JobClass {
CommandClass,
FallbackCommandClass,
JobListClass
};
private:
JobClass Kind;
protected:
Job(JobClass _Kind) : Kind(_Kind) {}
public:
virtual ~Job();
JobClass getKind() const { return Kind; }
/// Print - Print this Job in -### format.
///
/// \param OS - The stream to print on.
/// \param Terminator - A string to print at the end of the line.
/// \param Quote - Should separate arguments be quoted.
/// \param CrashInfo - Details for inclusion in a crash report.
virtual void Print(llvm::raw_ostream &OS, const char *Terminator, bool Quote,
CrashReportInfo *CrashInfo = nullptr) const = 0;
};
/// Command - An executable path/name and argument vector to
/// execute.
class Command : public Job {
class Command {
/// Source - The action which caused the creation of this job.
const Action &Source;
@ -106,11 +78,12 @@ class Command : public Job {
void writeResponseFile(raw_ostream &OS) const;
public:
Command(const Action &_Source, const Tool &_Creator, const char *_Executable,
const llvm::opt::ArgStringList &_Arguments);
Command(const Action &Source, const Tool &Creator, const char *Executable,
const llvm::opt::ArgStringList &Arguments);
virtual ~Command() {}
void Print(llvm::raw_ostream &OS, const char *Terminator, bool Quote,
CrashReportInfo *CrashInfo = nullptr) const override;
virtual void Print(llvm::raw_ostream &OS, const char *Terminator, bool Quote,
CrashReportInfo *CrashInfo = nullptr) const;
virtual int Execute(const StringRef **Redirects, std::string *ErrMsg,
bool *ExecutionFailed) const;
@ -133,11 +106,6 @@ class Command : public Job {
const char *getExecutable() const { return Executable; }
const llvm::opt::ArgStringList &getArguments() const { return Arguments; }
static bool classof(const Job *J) {
return J->getKind() == CommandClass ||
J->getKind() == FallbackCommandClass;
}
};
/// Like Command, but with a fallback which is executed in case
@ -154,18 +122,14 @@ class FallbackCommand : public Command {
int Execute(const StringRef **Redirects, std::string *ErrMsg,
bool *ExecutionFailed) const override;
static bool classof(const Job *J) {
return J->getKind() == FallbackCommandClass;
}
private:
std::unique_ptr<Command> Fallback;
};
/// JobList - A sequence of jobs to perform.
class JobList : public Job {
class JobList {
public:
typedef SmallVector<std::unique_ptr<Job>, 4> list_type;
typedef SmallVector<std::unique_ptr<Command>, 4> list_type;
typedef list_type::size_type size_type;
typedef llvm::pointee_iterator<list_type::iterator> iterator;
typedef llvm::pointee_iterator<list_type::const_iterator> const_iterator;
@ -174,14 +138,11 @@ class JobList : public Job {
list_type Jobs;
public:
JobList();
~JobList() override {}
void Print(llvm::raw_ostream &OS, const char *Terminator,
bool Quote, CrashReportInfo *CrashInfo = nullptr) const override;
bool Quote, CrashReportInfo *CrashInfo = nullptr) const;
/// Add a job to the list (taking ownership).
void addJob(std::unique_ptr<Job> J) { Jobs.push_back(std::move(J)); }
void addJob(std::unique_ptr<Command> J) { Jobs.push_back(std::move(J)); }
/// Clear the job list.
void clear();
@ -193,10 +154,6 @@ class JobList : public Job {
const_iterator begin() const { return Jobs.begin(); }
iterator end() { return Jobs.end(); }
const_iterator end() const { return Jobs.end(); }
static bool classof(const Job *J) {
return J->getKind() == JobListClass;
}
};
} // end namespace driver

View File

@ -1153,6 +1153,11 @@ def march_EQ : Joined<["-"], "march=">, Group<m_Group>;
def masm_EQ : Joined<["-"], "masm=">, Group<m_Group>, Flags<[DriverOption]>;
def mcmodel_EQ : Joined<["-"], "mcmodel=">, Group<m_Group>;
def mconstant_cfstrings : Flag<["-"], "mconstant-cfstrings">, Group<clang_ignored_m_Group>;
def mconsole : Joined<["-"], "mconsole">, Group<m_Group>, Flags<[DriverOption]>;
def mwindows : Joined<["-"], "mwindows">, Group<m_Group>, Flags<[DriverOption]>;
def mdll : Joined<["-"], "mdll">, Group<m_Group>, Flags<[DriverOption]>;
def municode : Joined<["-"], "municode">, Group<m_Group>, Flags<[DriverOption]>;
def mthreads : Joined<["-"], "mthreads">, Group<m_Group>, Flags<[DriverOption]>;
def mcpu_EQ : Joined<["-"], "mcpu=">, Group<m_Group>;
def mdynamic_no_pic : Joined<["-"], "mdynamic-no-pic">, Group<m_Group>;
def mfix_and_continue : Flag<["-"], "mfix-and-continue">, Group<clang_ignored_m_Group>;
@ -1170,6 +1175,7 @@ def miphoneos_version_min_EQ : Joined<["-"], "miphoneos-version-min=">, Group<m_
def mios_version_min_EQ : Joined<["-"], "mios-version-min=">,
Alias<miphoneos_version_min_EQ>, HelpText<"Set iOS deployment target">;
def mios_simulator_version_min_EQ : Joined<["-"], "mios-simulator-version-min=">, Alias<miphoneos_version_min_EQ>;
def miphonesimulator_version_min_EQ : Joined<["-"], "miphonesimulator-version-min=">, Alias<miphoneos_version_min_EQ>;
def mkernel : Flag<["-"], "mkernel">, Group<m_Group>;
def mlinker_version_EQ : Joined<["-"], "mlinker-version=">,
Flags<[DriverOption]>;
@ -1742,6 +1748,7 @@ def _warn_ : Joined<["--"], "warn-">, Alias<W_Joined>;
def _write_dependencies : Flag<["--"], "write-dependencies">, Alias<MD>;
def _write_user_dependencies : Flag<["--"], "write-user-dependencies">, Alias<MMD>;
def _ : Joined<["--"], "">, Flags<[Unsupported]>;
def mieee_rnd_near : Flag<["-"], "mieee-rnd-near">, Group<m_hexagon_Features_Group>;
def mv1 : Flag<["-"], "mv1">, Group<m_hexagon_Features_Group>, Alias<march_EQ>,
AliasArgs<["v1"]>;

View File

@ -10,6 +10,7 @@
#define LLVM_CLANG_DRIVER_SANITIZERARGS_H
#include "clang/Basic/Sanitizers.h"
#include "clang/Driver/Types.h"
#include "llvm/Option/Arg.h"
#include "llvm/Option/ArgList.h"
#include <string>
@ -54,8 +55,8 @@ class SanitizerArgs {
bool requiresPIE() const;
bool needsUnwindTables() const;
bool linkCXXRuntimes() const { return LinkCXXRuntimes; }
void addArgs(const llvm::opt::ArgList &Args,
llvm::opt::ArgStringList &CmdArgs) const;
void addArgs(const ToolChain &TC, const llvm::opt::ArgList &Args,
llvm::opt::ArgStringList &CmdArgs, types::ID InputType) const;
private:
void clear();

View File

@ -40,168 +40,50 @@ std::error_code make_error_code(ParseError e);
/// \brief The \c FormatStyle is used to configure the formatting to follow
/// specific guidelines.
struct FormatStyle {
/// \brief Supported languages. When stored in a configuration file, specifies
/// the language, that the configuration targets. When passed to the
/// reformat() function, enables syntax features specific to the language.
enum LanguageKind {
/// Do not use.
LK_None,
/// Should be used for C, C++, ObjectiveC, ObjectiveC++.
LK_Cpp,
/// Should be used for Java.
LK_Java,
/// Should be used for JavaScript.
LK_JavaScript,
/// Should be used for Protocol Buffers
/// (https://developers.google.com/protocol-buffers/).
LK_Proto
};
/// \brief Language, this format style is targeted at.
LanguageKind Language;
/// \brief The column limit.
///
/// A column limit of \c 0 means that there is no column limit. In this case,
/// clang-format will respect the input's line breaking decisions within
/// statements unless they contradict other rules.
unsigned ColumnLimit;
/// \brief The maximum number of consecutive empty lines to keep.
unsigned MaxEmptyLinesToKeep;
/// \brief If true, empty lines at the start of blocks are kept.
bool KeepEmptyLinesAtTheStartOfBlocks;
/// \brief The penalty for each line break introduced inside a comment.
unsigned PenaltyBreakComment;
/// \brief The penalty for each line break introduced inside a string literal.
unsigned PenaltyBreakString;
/// \brief The penalty for each character outside of the column limit.
unsigned PenaltyExcessCharacter;
/// \brief The penalty for breaking before the first \c <<.
unsigned PenaltyBreakFirstLessLess;
/// \brief The penalty for breaking a function call after "call(".
unsigned PenaltyBreakBeforeFirstCallParameter;
/// \brief The & and * alignment style.
enum PointerAlignmentStyle {
/// Align pointer to the left.
PAS_Left,
/// Align pointer to the right.
PAS_Right,
/// Align pointer in the middle.
PAS_Middle
};
/// Pointer and reference alignment style.
PointerAlignmentStyle PointerAlignment;
/// \brief If \c true, analyze the formatted file for the most common
/// alignment of & and *. \c PointerAlignment is then used only as fallback.
bool DerivePointerAlignment;
/// \brief The extra indent or outdent of access modifiers, e.g. \c public:.
int AccessModifierOffset;
/// \brief Supported language standards.
enum LanguageStandard {
/// Use C++03-compatible syntax.
LS_Cpp03,
/// Use features of C++11 (e.g. \c A<A<int>> instead of
/// <tt>A<A<int> ></tt>).
LS_Cpp11,
/// Automatic detection based on the input.
LS_Auto
};
/// \brief Format compatible with this standard, e.g. use
/// <tt>A<A<int> ></tt> instead of \c A<A<int>> for LS_Cpp03.
LanguageStandard Standard;
/// \brief Indent case labels one level from the switch statement.
/// \brief If \c true, horizontally aligns arguments after an open bracket.
///
/// When \c false, use the same indentation level as for the switch statement.
/// Switch statement body is always indented one level more than case labels.
bool IndentCaseLabels;
/// This applies to round brackets (parentheses), angle brackets and square
/// brackets. This will result in formattings like
/// \code
/// someLongFunction(argument1,
/// argument2);
/// \endcode
bool AlignAfterOpenBracket;
/// \brief Indent if a function definition or declaration is wrapped after the
/// type.
bool IndentWrappedFunctionNames;
/// \brief Different ways to indent namespace contents.
enum NamespaceIndentationKind {
/// Don't indent in namespaces.
NI_None,
/// Indent only in inner namespaces (nested in other namespaces).
NI_Inner,
/// Indent in all namespaces.
NI_All
};
/// \brief The indentation used for namespaces.
NamespaceIndentationKind NamespaceIndentation;
/// \brief The number of spaces before trailing line comments
/// (\c // - comments).
/// \brief If \c true, aligns consecutive assignments.
///
/// This does not affect trailing block comments (\c /**/ - comments) as those
/// commonly have different usage patterns and a number of special cases.
unsigned SpacesBeforeTrailingComments;
/// This will align the assignment operators of consecutive lines. This
/// will result in formattings like
/// \code
/// int aaaa = 12;
/// int b = 23;
/// int ccc = 23;
/// \endcode
bool AlignConsecutiveAssignments;
/// \brief If \c false, a function declaration's or function definition's
/// parameters will either all be on the same line or will have one line each.
bool BinPackParameters;
/// \brief If \c true, aligns escaped newlines as far left as possible.
/// Otherwise puts them into the right-most column.
bool AlignEscapedNewlinesLeft;
/// \brief If \c false, a function call's arguments will either be all on the
/// same line or will have one line each.
bool BinPackArguments;
/// \brief If \c true, horizontally align operands of binary and ternary
/// expressions.
bool AlignOperands;
/// \brief If \c true, clang-format detects whether function calls and
/// definitions are formatted with one parameter per line.
///
/// Each call can be bin-packed, one-per-line or inconclusive. If it is
/// inconclusive, e.g. completely on one line, but a decision needs to be
/// made, clang-format analyzes whether there are other bin-packed cases in
/// the input file and act accordingly.
///
/// NOTE: This is an experimental flag, that might go away or be renamed. Do
/// not use this in config files, etc. Use at your own risk.
bool ExperimentalAutoDetectBinPacking;
/// \brief If \c true, aligns trailing comments.
bool AlignTrailingComments;
/// \brief Allow putting all parameters of a function declaration onto
/// the next line even if \c BinPackParameters is \c false.
bool AllowAllParametersOfDeclarationOnNextLine;
/// \brief Penalty for putting the return type of a function onto its own
/// line.
unsigned PenaltyReturnTypeOnItsOwnLine;
/// \brief If the constructor initializers don't fit on a line, put each
/// initializer on its own line.
bool ConstructorInitializerAllOnOneLineOrOnePerLine;
/// \brief Always break constructor initializers before commas and align
/// the commas with the colon.
bool BreakConstructorInitializersBeforeComma;
/// \brief Allows contracting simple braced statements to a single line.
///
/// E.g., this allows <tt>if (a) { return; }</tt> to be put on a single line.
bool AllowShortBlocksOnASingleLine;
/// \brief If \c true, <tt>if (a) return;</tt> can be put on a single
/// line.
bool AllowShortIfStatementsOnASingleLine;
/// \brief If \c true, <tt>while (true) continue;</tt> can be put on a
/// single line.
bool AllowShortLoopsOnASingleLine;
/// \brief If \c true, short case labels will be contracted to a single line.
bool AllowShortCaseLabelsOnASingleLine;
@ -222,69 +104,27 @@ struct FormatStyle {
/// on a single line.
ShortFunctionStyle AllowShortFunctionsOnASingleLine;
/// \brief Add a space after \c @property in Objective-C, i.e. use
/// <tt>\@property (readonly)</tt> instead of <tt>\@property(readonly)</tt>.
bool ObjCSpaceAfterProperty;
/// \brief If \c true, <tt>if (a) return;</tt> can be put on a single
/// line.
bool AllowShortIfStatementsOnASingleLine;
/// \brief Add a space in front of an Objective-C protocol list, i.e. use
/// <tt>Foo <Protocol></tt> instead of \c Foo<Protocol>.
bool ObjCSpaceBeforeProtocolList;
/// \brief If \c true, <tt>while (true) continue;</tt> can be put on a
/// single line.
bool AllowShortLoopsOnASingleLine;
/// \brief If \c true, horizontally aligns arguments after an open bracket.
///
/// This applies to round brackets (parentheses), angle brackets and square
/// brackets. This will result in formattings like
/// \code
/// someLongFunction(argument1,
/// argument2);
/// \endcode
bool AlignAfterOpenBracket;
/// \brief Different ways to break after the function definition return type.
enum DefinitionReturnTypeBreakingStyle {
/// Break after return type automatically.
/// \c PenaltyReturnTypeOnItsOwnLine is taken into account.
DRTBS_None,
/// Always break after the return type.
DRTBS_All,
/// Always break after the return types of top level functions.
DRTBS_TopLevel,
};
/// \brief If \c true, horizontally align operands of binary and ternary
/// expressions.
bool AlignOperands;
/// \brief If \c true, aligns trailing comments.
bool AlignTrailingComments;
/// \brief If \c true, aligns consecutive assignments.
///
/// This will align the assignment operators of consecutive lines. This
/// will result in formattings like
/// \code
/// int aaaa = 12;
/// int b = 23;
/// int ccc = 23;
/// \endcode
bool AlignConsecutiveAssignments;
/// \brief If \c true, aligns escaped newlines as far left as possible.
/// Otherwise puts them into the right-most column.
bool AlignEscapedNewlinesLeft;
/// \brief The number of columns to use for indentation.
unsigned IndentWidth;
/// \brief The number of columns used for tab stops.
unsigned TabWidth;
/// \brief The number of characters to use for indentation of constructor
/// initializer lists.
unsigned ConstructorInitializerIndentWidth;
/// \brief The number of characters to use for indentation of ObjC blocks.
unsigned ObjCBlockIndentWidth;
/// \brief If \c true, always break after function definition return types.
///
/// More truthfully called 'break before the identifier following the type
/// in a function definition'. PenaltyReturnTypeOnItsOwnLine becomes
/// irrelevant.
bool AlwaysBreakAfterDefinitionReturnType;
/// \brief If \c true, always break after the <tt>template<...></tt> of a
/// template declaration.
bool AlwaysBreakTemplateDeclarations;
/// \brief The function definition return type breaking style to use.
DefinitionReturnTypeBreakingStyle AlwaysBreakAfterDefinitionReturnType;
/// \brief If \c true, always break before multiline string literals.
///
@ -294,19 +134,17 @@ struct FormatStyle {
/// \c ContinuationIndentWidth spaces from the start of the line.
bool AlwaysBreakBeforeMultilineStrings;
/// \brief Different ways to use tab in formatting.
enum UseTabStyle {
/// Never use tab.
UT_Never,
/// Use tabs only for indentation.
UT_ForIndentation,
/// Use tabs whenever we need to fill whitespace that spans at least from
/// one tab stop to the next one.
UT_Always
};
/// \brief If \c true, always break after the <tt>template<...></tt> of a
/// template declaration.
bool AlwaysBreakTemplateDeclarations;
/// \brief The way to use tab characters in the resulting file.
UseTabStyle UseTab;
/// \brief If \c false, a function call's arguments will either be all on the
/// same line or will have one line each.
bool BinPackArguments;
/// \brief If \c false, a function declaration's or function definition's
/// parameters will either all be on the same line or will have one line each.
bool BinPackParameters;
/// \brief The style of breaking before or after binary operators.
enum BinaryOperatorStyle {
@ -321,9 +159,6 @@ struct FormatStyle {
/// \brief The way to wrap binary operators.
BinaryOperatorStyle BreakBeforeBinaryOperators;
/// \brief If \c true, ternary operators will be placed after line breaks.
bool BreakBeforeTernaryOperators;
/// \brief Different ways to attach braces to their surrounding context.
enum BraceBreakingStyle {
/// Always attach braces to surrounding context.
@ -344,6 +179,35 @@ struct FormatStyle {
/// \brief The brace breaking style to use.
BraceBreakingStyle BreakBeforeBraces;
/// \brief If \c true, ternary operators will be placed after line breaks.
bool BreakBeforeTernaryOperators;
/// \brief Always break constructor initializers before commas and align
/// the commas with the colon.
bool BreakConstructorInitializersBeforeComma;
/// \brief The column limit.
///
/// A column limit of \c 0 means that there is no column limit. In this case,
/// clang-format will respect the input's line breaking decisions within
/// statements unless they contradict other rules.
unsigned ColumnLimit;
/// \brief A regular expression that describes comments with special meaning,
/// which should not be split into lines or otherwise changed.
std::string CommentPragmas;
/// \brief If the constructor initializers don't fit on a line, put each
/// initializer on its own line.
bool ConstructorInitializerAllOnOneLineOrOnePerLine;
/// \brief The number of characters to use for indentation of constructor
/// initializer lists.
unsigned ConstructorInitializerIndentWidth;
/// \brief Indent width for line continuations.
unsigned ContinuationIndentWidth;
/// \brief If \c true, format braced lists as best suited for C++11 braced
/// lists.
///
@ -359,29 +223,138 @@ struct FormatStyle {
/// a zero-length name is assumed.
bool Cpp11BracedListStyle;
/// \brief If \c true, spaces will be inserted after '(' and before ')'.
bool SpacesInParentheses;
/// \brief If \c true, analyze the formatted file for the most common
/// alignment of & and *. \c PointerAlignment is then used only as fallback.
bool DerivePointerAlignment;
/// \brief If \c true, spaces will be inserted after '<' and before '>' in
/// template argument lists
bool SpacesInAngles;
/// \brief Disables formatting completely.
bool DisableFormat;
/// \brief If \c true, spaces will be inserted after '[' and before ']'.
bool SpacesInSquareBrackets;
/// \brief If \c true, clang-format detects whether function calls and
/// definitions are formatted with one parameter per line.
///
/// Each call can be bin-packed, one-per-line or inconclusive. If it is
/// inconclusive, e.g. completely on one line, but a decision needs to be
/// made, clang-format analyzes whether there are other bin-packed cases in
/// the input file and act accordingly.
///
/// NOTE: This is an experimental flag, that might go away or be renamed. Do
/// not use this in config files, etc. Use at your own risk.
bool ExperimentalAutoDetectBinPacking;
/// \brief If \c true, spaces may be inserted into '()'.
bool SpaceInEmptyParentheses;
/// \brief A vector of macros that should be interpreted as foreach loops
/// instead of as function calls.
///
/// These are expected to be macros of the form:
/// \code
/// FOREACH(<variable-declaration>, ...)
/// <loop-body>
/// \endcode
///
/// For example: BOOST_FOREACH.
std::vector<std::string> ForEachMacros;
/// \brief If \c true, spaces are inserted inside container literals (e.g.
/// ObjC and Javascript array and dict literals).
bool SpacesInContainerLiterals;
/// \brief Indent case labels one level from the switch statement.
///
/// When \c false, use the same indentation level as for the switch statement.
/// Switch statement body is always indented one level more than case labels.
bool IndentCaseLabels;
/// \brief If \c true, spaces may be inserted into C style casts.
bool SpacesInCStyleCastParentheses;
/// \brief The number of columns to use for indentation.
unsigned IndentWidth;
/// \brief Indent if a function definition or declaration is wrapped after the
/// type.
bool IndentWrappedFunctionNames;
/// \brief If true, empty lines at the start of blocks are kept.
bool KeepEmptyLinesAtTheStartOfBlocks;
/// \brief Supported languages. When stored in a configuration file, specifies
/// the language, that the configuration targets. When passed to the
/// reformat() function, enables syntax features specific to the language.
enum LanguageKind {
/// Do not use.
LK_None,
/// Should be used for C, C++, ObjectiveC, ObjectiveC++.
LK_Cpp,
/// Should be used for Java.
LK_Java,
/// Should be used for JavaScript.
LK_JavaScript,
/// Should be used for Protocol Buffers
/// (https://developers.google.com/protocol-buffers/).
LK_Proto
};
/// \brief Language, this format style is targeted at.
LanguageKind Language;
/// \brief The maximum number of consecutive empty lines to keep.
unsigned MaxEmptyLinesToKeep;
/// \brief Different ways to indent namespace contents.
enum NamespaceIndentationKind {
/// Don't indent in namespaces.
NI_None,
/// Indent only in inner namespaces (nested in other namespaces).
NI_Inner,
/// Indent in all namespaces.
NI_All
};
/// \brief The indentation used for namespaces.
NamespaceIndentationKind NamespaceIndentation;
/// \brief The number of characters to use for indentation of ObjC blocks.
unsigned ObjCBlockIndentWidth;
/// \brief Add a space after \c @property in Objective-C, i.e. use
/// <tt>\@property (readonly)</tt> instead of <tt>\@property(readonly)</tt>.
bool ObjCSpaceAfterProperty;
/// \brief Add a space in front of an Objective-C protocol list, i.e. use
/// <tt>Foo <Protocol></tt> instead of \c Foo<Protocol>.
bool ObjCSpaceBeforeProtocolList;
/// \brief The penalty for breaking a function call after "call(".
unsigned PenaltyBreakBeforeFirstCallParameter;
/// \brief The penalty for each line break introduced inside a comment.
unsigned PenaltyBreakComment;
/// \brief The penalty for breaking before the first \c <<.
unsigned PenaltyBreakFirstLessLess;
/// \brief The penalty for each line break introduced inside a string literal.
unsigned PenaltyBreakString;
/// \brief The penalty for each character outside of the column limit.
unsigned PenaltyExcessCharacter;
/// \brief Penalty for putting the return type of a function onto its own
/// line.
unsigned PenaltyReturnTypeOnItsOwnLine;
/// \brief The & and * alignment style.
enum PointerAlignmentStyle {
/// Align pointer to the left.
PAS_Left,
/// Align pointer to the right.
PAS_Right,
/// Align pointer in the middle.
PAS_Middle
};
/// Pointer and reference alignment style.
PointerAlignmentStyle PointerAlignment;
/// \brief If \c true, a space may be inserted after C style casts.
bool SpaceAfterCStyleCast;
/// \brief If \c false, spaces will be removed before assignment operators.
bool SpaceBeforeAssignmentOperators;
/// \brief Different ways to put a space before opening parentheses.
enum SpaceBeforeParensOptions {
/// Never put a space before opening parentheses.
@ -399,97 +372,139 @@ struct FormatStyle {
/// \brief Defines in which cases to put a space before opening parentheses.
SpaceBeforeParensOptions SpaceBeforeParens;
/// \brief If \c false, spaces will be removed before assignment operators.
bool SpaceBeforeAssignmentOperators;
/// \brief If \c true, spaces may be inserted into '()'.
bool SpaceInEmptyParentheses;
/// \brief Indent width for line continuations.
unsigned ContinuationIndentWidth;
/// \brief A regular expression that describes comments with special meaning,
/// which should not be split into lines or otherwise changed.
std::string CommentPragmas;
/// \brief Disables formatting at all.
bool DisableFormat;
/// \brief A vector of macros that should be interpreted as foreach loops
/// instead of as function calls.
/// \brief The number of spaces before trailing line comments
/// (\c // - comments).
///
/// These are expected to be macros of the form:
/// \code
/// FOREACH(<variable-declaration>, ...)
/// <loop-body>
/// \endcode
///
/// For example: BOOST_FOREACH.
std::vector<std::string> ForEachMacros;
/// This does not affect trailing block comments (\c /**/ - comments) as those
/// commonly have different usage patterns and a number of special cases.
unsigned SpacesBeforeTrailingComments;
/// \brief If \c true, spaces will be inserted after '<' and before '>' in
/// template argument lists
bool SpacesInAngles;
/// \brief If \c true, spaces are inserted inside container literals (e.g.
/// ObjC and Javascript array and dict literals).
bool SpacesInContainerLiterals;
/// \brief If \c true, spaces may be inserted into C style casts.
bool SpacesInCStyleCastParentheses;
/// \brief If \c true, spaces will be inserted after '(' and before ')'.
bool SpacesInParentheses;
/// \brief If \c true, spaces will be inserted after '[' and before ']'.
bool SpacesInSquareBrackets;
/// \brief Supported language standards.
enum LanguageStandard {
/// Use C++03-compatible syntax.
LS_Cpp03,
/// Use features of C++11 (e.g. \c A<A<int>> instead of
/// <tt>A<A<int> ></tt>).
LS_Cpp11,
/// Automatic detection based on the input.
LS_Auto
};
/// \brief Format compatible with this standard, e.g. use
/// <tt>A<A<int> ></tt> instead of \c A<A<int>> for LS_Cpp03.
LanguageStandard Standard;
/// \brief The number of columns used for tab stops.
unsigned TabWidth;
/// \brief Different ways to use tab in formatting.
enum UseTabStyle {
/// Never use tab.
UT_Never,
/// Use tabs only for indentation.
UT_ForIndentation,
/// Use tabs whenever we need to fill whitespace that spans at least from
/// one tab stop to the next one.
UT_Always
};
/// \brief The way to use tab characters in the resulting file.
UseTabStyle UseTab;
bool operator==(const FormatStyle &R) const {
return AccessModifierOffset == R.AccessModifierOffset &&
AlignAfterOpenBracket == R.AlignAfterOpenBracket &&
AlignOperands == R.AlignOperands &&
AlignConsecutiveAssignments == R.AlignConsecutiveAssignments &&
AlignEscapedNewlinesLeft == R.AlignEscapedNewlinesLeft &&
AlignOperands == R.AlignOperands &&
AlignTrailingComments == R.AlignTrailingComments &&
AllowAllParametersOfDeclarationOnNextLine ==
R.AllowAllParametersOfDeclarationOnNextLine &&
AllowShortBlocksOnASingleLine == R.AllowShortBlocksOnASingleLine &&
AllowShortCaseLabelsOnASingleLine ==
R.AllowShortCaseLabelsOnASingleLine &&
AllowShortFunctionsOnASingleLine ==
R.AllowShortFunctionsOnASingleLine &&
AllowShortBlocksOnASingleLine == R.AllowShortBlocksOnASingleLine &&
AllowShortIfStatementsOnASingleLine ==
R.AllowShortIfStatementsOnASingleLine &&
AllowShortLoopsOnASingleLine == R.AllowShortLoopsOnASingleLine &&
AlwaysBreakAfterDefinitionReturnType ==
R.AlwaysBreakAfterDefinitionReturnType &&
AlwaysBreakTemplateDeclarations ==
R.AlwaysBreakTemplateDeclarations &&
AlwaysBreakBeforeMultilineStrings ==
R.AlwaysBreakBeforeMultilineStrings &&
BinPackParameters == R.BinPackParameters &&
AlwaysBreakTemplateDeclarations ==
R.AlwaysBreakTemplateDeclarations &&
BinPackArguments == R.BinPackArguments &&
BinPackParameters == R.BinPackParameters &&
BreakBeforeBinaryOperators == R.BreakBeforeBinaryOperators &&
BreakBeforeTernaryOperators == R.BreakBeforeTernaryOperators &&
BreakBeforeBraces == R.BreakBeforeBraces &&
BreakBeforeTernaryOperators == R.BreakBeforeTernaryOperators &&
BreakConstructorInitializersBeforeComma ==
R.BreakConstructorInitializersBeforeComma &&
ColumnLimit == R.ColumnLimit &&
CommentPragmas == R.CommentPragmas &&
ConstructorInitializerAllOnOneLineOrOnePerLine ==
R.ConstructorInitializerAllOnOneLineOrOnePerLine &&
ConstructorInitializerIndentWidth ==
R.ConstructorInitializerIndentWidth &&
ContinuationIndentWidth == R.ContinuationIndentWidth &&
Cpp11BracedListStyle == R.Cpp11BracedListStyle &&
DerivePointerAlignment == R.DerivePointerAlignment &&
DisableFormat == R.DisableFormat &&
ExperimentalAutoDetectBinPacking ==
R.ExperimentalAutoDetectBinPacking &&
ForEachMacros == R.ForEachMacros &&
IndentCaseLabels == R.IndentCaseLabels &&
IndentWrappedFunctionNames == R.IndentWrappedFunctionNames &&
IndentWidth == R.IndentWidth && Language == R.Language &&
MaxEmptyLinesToKeep == R.MaxEmptyLinesToKeep &&
IndentWrappedFunctionNames == R.IndentWrappedFunctionNames &&
KeepEmptyLinesAtTheStartOfBlocks ==
R.KeepEmptyLinesAtTheStartOfBlocks &&
MaxEmptyLinesToKeep == R.MaxEmptyLinesToKeep &&
NamespaceIndentation == R.NamespaceIndentation &&
ObjCBlockIndentWidth == R.ObjCBlockIndentWidth &&
ObjCSpaceAfterProperty == R.ObjCSpaceAfterProperty &&
ObjCSpaceBeforeProtocolList == R.ObjCSpaceBeforeProtocolList &&
PenaltyBreakBeforeFirstCallParameter ==
R.PenaltyBreakBeforeFirstCallParameter &&
PenaltyBreakComment == R.PenaltyBreakComment &&
PenaltyBreakFirstLessLess == R.PenaltyBreakFirstLessLess &&
PenaltyBreakString == R.PenaltyBreakString &&
PenaltyExcessCharacter == R.PenaltyExcessCharacter &&
PenaltyReturnTypeOnItsOwnLine == R.PenaltyReturnTypeOnItsOwnLine &&
PointerAlignment == R.PointerAlignment &&
SpacesBeforeTrailingComments == R.SpacesBeforeTrailingComments &&
Cpp11BracedListStyle == R.Cpp11BracedListStyle &&
Standard == R.Standard && TabWidth == R.TabWidth &&
UseTab == R.UseTab && SpacesInParentheses == R.SpacesInParentheses &&
SpacesInSquareBrackets == R.SpacesInSquareBrackets &&
SpacesInAngles == R.SpacesInAngles &&
SpaceAfterCStyleCast == R.SpaceAfterCStyleCast &&
SpaceBeforeAssignmentOperators == R.SpaceBeforeAssignmentOperators &&
SpaceBeforeParens == R.SpaceBeforeParens &&
SpaceInEmptyParentheses == R.SpaceInEmptyParentheses &&
SpacesBeforeTrailingComments == R.SpacesBeforeTrailingComments &&
SpacesInAngles == R.SpacesInAngles &&
SpacesInContainerLiterals == R.SpacesInContainerLiterals &&
SpacesInCStyleCastParentheses == R.SpacesInCStyleCastParentheses &&
SpaceAfterCStyleCast == R.SpaceAfterCStyleCast &&
SpaceBeforeParens == R.SpaceBeforeParens &&
SpaceBeforeAssignmentOperators == R.SpaceBeforeAssignmentOperators &&
ContinuationIndentWidth == R.ContinuationIndentWidth &&
CommentPragmas == R.CommentPragmas &&
ForEachMacros == R.ForEachMacros;
SpacesInParentheses == R.SpacesInParentheses &&
SpacesInSquareBrackets == R.SpacesInSquareBrackets &&
Standard == R.Standard &&
TabWidth == R.TabWidth &&
UseTab == R.UseTab;
}
};

View File

@ -23,7 +23,7 @@ class Module;
/// information.
///
/// This abstract class allows an external sources (such as the \c ASTReader)
/// to provide additional macro definitions.
/// to provide additional preprocessing information.
class ExternalPreprocessorSource {
public:
virtual ~ExternalPreprocessorSource();
@ -34,6 +34,11 @@ class ExternalPreprocessorSource {
/// \brief Update an out-of-date identifier.
virtual void updateOutOfDateIdentifier(IdentifierInfo &II) = 0;
/// \brief Return the identifier associated with the given ID number.
///
/// The ID 0 is associated with the NULL identifier.
virtual IdentifierInfo *GetIdentifier(unsigned ID) = 0;
/// \brief Map a module ID to a module.
virtual Module *getModule(unsigned ModuleID) = 0;
};

View File

@ -27,7 +27,7 @@
namespace clang {
class DiagnosticsEngine;
class ExternalIdentifierLookup;
class ExternalPreprocessorSource;
class FileEntry;
class FileManager;
class HeaderSearchOptions;
@ -111,8 +111,9 @@ struct HeaderFileInfo {
/// \brief Retrieve the controlling macro for this header file, if
/// any.
const IdentifierInfo *getControllingMacro(ExternalIdentifierLookup *External);
const IdentifierInfo *
getControllingMacro(ExternalPreprocessorSource *External);
/// \brief Determine whether this is a non-default header file info, e.g.,
/// it corresponds to an actual header we've included or tried to include.
bool isNonDefault() const {
@ -242,8 +243,9 @@ class HeaderSearch {
llvm::StringSet<llvm::BumpPtrAllocator> FrameworkNames;
/// \brief Entity used to resolve the identifier IDs of controlling
/// macros into IdentifierInfo pointers, as needed.
ExternalIdentifierLookup *ExternalLookup;
/// macros into IdentifierInfo pointers, and keep the identifire up to date,
/// as needed.
ExternalPreprocessorSource *ExternalLookup;
/// \brief Entity used to look up stored header file information.
ExternalHeaderFileInfoSource *ExternalSource;
@ -345,11 +347,11 @@ class HeaderSearch {
FileInfo.clear();
}
void SetExternalLookup(ExternalIdentifierLookup *EIL) {
ExternalLookup = EIL;
void SetExternalLookup(ExternalPreprocessorSource *EPS) {
ExternalLookup = EPS;
}
ExternalIdentifierLookup *getExternalLookup() const {
ExternalPreprocessorSource *getExternalLookup() const {
return ExternalLookup;
}
@ -421,7 +423,7 @@ class HeaderSearch {
/// \return false if \#including the file will have no effect or true
/// if we should include it.
bool ShouldEnterIncludeFile(Preprocessor &PP, const FileEntry *File,
bool isImport);
bool isImport, Module *CorrespondingModule);
/// \brief Return whether the specified file is a normal header,
/// a system header, or a C++ friendly system header.

View File

@ -231,8 +231,7 @@ class ModuleMap {
return static_cast<bool>(findHeaderInUmbrellaDirs(File, IntermediateDirs));
}
Module *inferFrameworkModule(StringRef ModuleName,
const DirectoryEntry *FrameworkDir,
Module *inferFrameworkModule(const DirectoryEntry *FrameworkDir,
Attributes Attrs, Module *Parent);
public:
@ -344,10 +343,9 @@ class ModuleMap {
/// \brief Infer the contents of a framework module map from the given
/// framework directory.
Module *inferFrameworkModule(StringRef ModuleName,
const DirectoryEntry *FrameworkDir,
Module *inferFrameworkModule(const DirectoryEntry *FrameworkDir,
bool IsSystem, Module *Parent);
/// \brief Retrieve the module map file containing the definition of the given
/// module.
///

View File

@ -394,7 +394,9 @@ class Preprocessor : public RefCountedBase<Preprocessor> {
const IdentifierInfo *II) const {
// FIXME: Find a spare bit on IdentifierInfo and store a
// HasModuleMacros flag.
if (!II->hasMacroDefinition() || !PP.getLangOpts().Modules ||
if (!II->hasMacroDefinition() ||
(!PP.getLangOpts().Modules &&
!PP.getLangOpts().ModulesLocalVisibility) ||
!PP.CurSubmoduleState->VisibleModules.getGeneration())
return nullptr;
@ -454,7 +456,9 @@ class Preprocessor : public RefCountedBase<Preprocessor> {
MacroDirective::DefInfo findDirectiveAtLoc(SourceLocation Loc,
SourceManager &SourceMgr) const {
// FIXME: Incorporate module macros into the result of this.
return getLatest()->findDirectiveAtLoc(Loc, SourceMgr);
if (auto *Latest = getLatest())
return Latest->findDirectiveAtLoc(Loc, SourceMgr);
return MacroDirective::DefInfo();
}
void overrideActiveModuleMacros(Preprocessor &PP, IdentifierInfo *II) {

View File

@ -303,7 +303,7 @@ class Parser : public CodeCompletionHandler {
return true;
}
/// Retrieve the underscored keyword (__nonnull, __nullable) that corresponds
/// Retrieve the underscored keyword (_Nonnull, _Nullable) that corresponds
/// to the given nullability kind.
IdentifierInfo *getNullabilityKeyword(NullabilityKind nullability) {
return Actions.getNullabilityKeyword(nullability);
@ -1182,7 +1182,7 @@ class Parser : public CodeCompletionHandler {
ParsingDeclarator &D,
const ParsedTemplateInfo &TemplateInfo,
const VirtSpecifiers& VS,
ExprResult& Init);
SourceLocation PureSpecLoc);
void ParseCXXNonStaticMemberInitializer(Decl *VarD);
void ParseLexedAttributes(ParsingClass &Class);
void ParseLexedAttributeList(LateParsedAttrList &LAs, Decl *D,
@ -1331,6 +1331,7 @@ class Parser : public CodeCompletionHandler {
ExprResult ParseExpression(TypeCastState isTypeCast = NotTypeCast);
ExprResult ParseConstantExpression(TypeCastState isTypeCast = NotTypeCast);
ExprResult ParseConstraintExpression();
// Expr that doesn't include commas.
ExprResult ParseAssignmentExpression(TypeCastState isTypeCast = NotTypeCast);
@ -1704,6 +1705,7 @@ class Parser : public CodeCompletionHandler {
DSC_top_level, // top-level/namespace declaration context
DSC_template_type_arg, // template type argument context
DSC_objc_method_result, // ObjC method result context, enables 'instancetype'
DSC_condition // condition declaration context
};
/// Is this a context in which we are parsing just a type-specifier (or
@ -1714,6 +1716,7 @@ class Parser : public CodeCompletionHandler {
case DSC_class:
case DSC_top_level:
case DSC_objc_method_result:
case DSC_condition:
return false;
case DSC_template_type_arg:

View File

@ -358,6 +358,9 @@ class DeclSpec {
// constexpr-specifier
unsigned Constexpr_specified : 1;
// concept-specifier
unsigned Concept_specified : 1;
union {
UnionParsedType TypeRep;
Decl *DeclRep;
@ -393,7 +396,7 @@ class DeclSpec {
SourceLocation TQ_constLoc, TQ_restrictLoc, TQ_volatileLoc, TQ_atomicLoc;
SourceLocation FS_inlineLoc, FS_virtualLoc, FS_explicitLoc, FS_noreturnLoc;
SourceLocation FS_forceinlineLoc;
SourceLocation FriendLoc, ModulePrivateLoc, ConstexprLoc;
SourceLocation FriendLoc, ModulePrivateLoc, ConstexprLoc, ConceptLoc;
WrittenBuiltinSpecs writtenBS;
void SaveWrittenBuiltinSpecs();
@ -437,6 +440,7 @@ class DeclSpec {
FS_noreturn_specified(false),
Friend_specified(false),
Constexpr_specified(false),
Concept_specified(false),
Attrs(attrFactory),
ProtocolQualifiers(nullptr),
NumProtocolQualifiers(0),
@ -688,6 +692,8 @@ class DeclSpec {
unsigned &DiagID);
bool SetConstexprSpec(SourceLocation Loc, const char *&PrevSpec,
unsigned &DiagID);
bool SetConceptSpec(SourceLocation Loc, const char *&PrevSpec,
unsigned &DiagID);
bool isFriendSpecified() const { return Friend_specified; }
SourceLocation getFriendSpecLoc() const { return FriendLoc; }
@ -698,11 +704,19 @@ class DeclSpec {
bool isConstexprSpecified() const { return Constexpr_specified; }
SourceLocation getConstexprSpecLoc() const { return ConstexprLoc; }
bool isConceptSpecified() const { return Concept_specified; }
SourceLocation getConceptSpecLoc() const { return ConceptLoc; }
void ClearConstexprSpec() {
Constexpr_specified = false;
ConstexprLoc = SourceLocation();
}
void ClearConceptSpec() {
Concept_specified = false;
ConceptLoc = SourceLocation();
}
AttributePool &getAttributePool() const {
return Attrs.getPool();
}

View File

@ -277,7 +277,9 @@ class Sema {
// it will keep having external linkage. If it has internal linkage, we
// will not link it. Since it has no previous decls, it will remain
// with internal linkage.
return isVisible(Old) || New->isExternallyVisible();
if (getLangOpts().ModulesHideInternalLinkage)
return isVisible(Old) || New->isExternallyVisible();
return true;
}
public:
@ -700,9 +702,15 @@ class Sema {
/// \brief The declaration of the Objective-C NSNumber class.
ObjCInterfaceDecl *NSNumberDecl;
/// \brief The declaration of the Objective-C NSValue class.
ObjCInterfaceDecl *NSValueDecl;
/// \brief Pointer to NSNumber type (NSNumber *).
QualType NSNumberPointer;
/// \brief Pointer to NSValue type (NSValue *).
QualType NSValuePointer;
/// \brief The Objective-C NSNumber methods used to create NSNumber literals.
ObjCMethodDecl *NSNumberLiteralMethods[NSAPI::NumNSNumberLiteralMethods];
@ -715,6 +723,9 @@ class Sema {
/// \brief The declaration of the stringWithUTF8String: method.
ObjCMethodDecl *StringWithUTF8StringMethod;
/// \brief The declaration of the valueWithBytes:objCType: method.
ObjCMethodDecl *ValueWithBytesObjCTypeMethod;
/// \brief The declaration of the Objective-C NSArray class.
ObjCInterfaceDecl *NSArrayDecl;
@ -1679,6 +1690,7 @@ class Sema {
bool TypeMayContainAuto);
void ActOnUninitializedDecl(Decl *dcl, bool TypeMayContainAuto);
void ActOnInitializerError(Decl *Dcl);
void ActOnPureSpecifier(Decl *D, SourceLocation PureSpecLoc);
void ActOnCXXForRangeDecl(Decl *D);
StmtResult ActOnCXXForRangeIdentifier(Scope *S, SourceLocation IdentLoc,
IdentifierInfo *Ident,
@ -2976,7 +2988,7 @@ class Sema {
bool SynthesizeProperties);
/// Diagnose any null-resettable synthesized setters.
void diagnoseNullResettableSynthesizedSetters(ObjCImplDecl *impDecl);
void diagnoseNullResettableSynthesizedSetters(const ObjCImplDecl *impDecl);
/// DefaultSynthesizeProperties - This routine default synthesizes all
/// properties which must be synthesized in the class's \@implementation.
@ -5025,9 +5037,9 @@ class Sema {
/// BuildObjCBoxedExpr - builds an ObjCBoxedExpr AST node for the
/// '@' prefixed parenthesized expression. The type of the expression will
/// either be "NSNumber *" or "NSString *" depending on the type of
/// ValueType, which is allowed to be a built-in numeric type or
/// "char *" or "const char *".
/// either be "NSNumber *", "NSString *" or "NSValue *" depending on the type
/// of ValueType, which is allowed to be a built-in numeric type, "char *",
/// "const char *" or C structure with attribute 'objc_boxable'.
ExprResult BuildObjCBoxedExpr(SourceRange SR, Expr *ValueExpr);
ExprResult BuildObjCSubscriptExpression(SourceLocation RB, Expr *BaseExpr,
@ -7603,6 +7615,12 @@ class Sema {
bool IsOpenMPCapturedVar(VarDecl *VD);
public:
/// \brief Check if the specified variable is used in one of the private
/// clauses in OpenMP constructs.
/// \param Level Relative level of nested OpenMP construct for that the check
/// is performed.
bool isOpenMPPrivateVar(VarDecl *VD, unsigned Level);
ExprResult PerformOpenMPImplicitIntegerConversion(SourceLocation OpLoc,
Expr *Op);
/// \brief Called on start of new data sharing attribute block.
@ -7610,9 +7628,9 @@ class Sema {
const DeclarationNameInfo &DirName, Scope *CurScope,
SourceLocation Loc);
/// \brief Start analysis of clauses.
void StartOpenMPClauses();
void StartOpenMPClause(OpenMPClauseKind K);
/// \brief End analysis of clauses.
void EndOpenMPClauses();
void EndOpenMPClause();
/// \brief Called on end of data sharing attribute block.
void EndOpenMPDSABlock(Stmt *CurDirective);
@ -7646,12 +7664,10 @@ class Sema {
///
/// \returns Statement for finished OpenMP region.
StmtResult ActOnOpenMPRegionEnd(StmtResult S, ArrayRef<OMPClause *> Clauses);
StmtResult ActOnOpenMPExecutableDirective(OpenMPDirectiveKind Kind,
const DeclarationNameInfo &DirName,
ArrayRef<OMPClause *> Clauses,
Stmt *AStmt,
SourceLocation StartLoc,
SourceLocation EndLoc);
StmtResult ActOnOpenMPExecutableDirective(
OpenMPDirectiveKind Kind, const DeclarationNameInfo &DirName,
OpenMPDirectiveKind CancelRegion, ArrayRef<OMPClause *> Clauses,
Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc);
/// \brief Called on well-formed '\#pragma omp parallel' after parsing
/// of the associated statement.
StmtResult ActOnOpenMPParallelDirective(ArrayRef<OMPClause *> Clauses,
@ -7757,6 +7773,15 @@ class Sema {
StmtResult ActOnOpenMPTeamsDirective(ArrayRef<OMPClause *> Clauses,
Stmt *AStmt, SourceLocation StartLoc,
SourceLocation EndLoc);
/// \brief Called on well-formed '\#pragma omp cancellation point'.
StmtResult
ActOnOpenMPCancellationPointDirective(SourceLocation StartLoc,
SourceLocation EndLoc,
OpenMPDirectiveKind CancelRegion);
/// \brief Called on well-formed '\#pragma omp cancel'.
StmtResult ActOnOpenMPCancelDirective(SourceLocation StartLoc,
SourceLocation EndLoc,
OpenMPDirectiveKind CancelRegion);
OMPClause *ActOnOpenMPSingleExprClause(OpenMPClauseKind Kind,
Expr *Expr,
@ -7851,13 +7876,13 @@ class Sema {
OMPClause *ActOnOpenMPSeqCstClause(SourceLocation StartLoc,
SourceLocation EndLoc);
OMPClause *
ActOnOpenMPVarListClause(OpenMPClauseKind Kind, ArrayRef<Expr *> Vars,
Expr *TailExpr, SourceLocation StartLoc,
SourceLocation LParenLoc, SourceLocation ColonLoc,
SourceLocation EndLoc,
CXXScopeSpec &ReductionIdScopeSpec,
const DeclarationNameInfo &ReductionId);
OMPClause *ActOnOpenMPVarListClause(
OpenMPClauseKind Kind, ArrayRef<Expr *> Vars, Expr *TailExpr,
SourceLocation StartLoc, SourceLocation LParenLoc,
SourceLocation ColonLoc, SourceLocation EndLoc,
CXXScopeSpec &ReductionIdScopeSpec,
const DeclarationNameInfo &ReductionId, OpenMPDependClauseKind DepKind,
SourceLocation DepLoc);
/// \brief Called on well-formed 'private' clause.
OMPClause *ActOnOpenMPPrivateClause(ArrayRef<Expr *> VarList,
SourceLocation StartLoc,
@ -7914,6 +7939,12 @@ class Sema {
SourceLocation StartLoc,
SourceLocation LParenLoc,
SourceLocation EndLoc);
/// \brief Called on well-formed 'depend' clause.
OMPClause *
ActOnOpenMPDependClause(OpenMPDependClauseKind DepKind, SourceLocation DepLoc,
SourceLocation ColonLoc, ArrayRef<Expr *> VarList,
SourceLocation StartLoc, SourceLocation LParenLoc,
SourceLocation EndLoc);
/// \brief The kind of conversion being performed.
enum CheckedConversionKind {
@ -8711,6 +8742,7 @@ class Sema {
bool SemaBuiltinARMSpecialReg(unsigned BuiltinID, CallExpr *TheCall,
int ArgNum, unsigned ExpectedFieldNum,
bool AllowName);
bool SemaBuiltinCpuSupports(CallExpr *TheCall);
public:
enum FormatStringType {
FST_Scanf,
@ -8840,9 +8872,9 @@ class Sema {
mutable IdentifierInfo *Ident___float128;
/// Nullability type specifiers.
IdentifierInfo *Ident___nonnull = nullptr;
IdentifierInfo *Ident___nullable = nullptr;
IdentifierInfo *Ident___null_unspecified = nullptr;
IdentifierInfo *Ident__Nonnull = nullptr;
IdentifierInfo *Ident__Nullable = nullptr;
IdentifierInfo *Ident__Null_unspecified = nullptr;
IdentifierInfo *Ident_NSError = nullptr;

View File

@ -1397,6 +1397,8 @@ namespace clang {
STMT_OMP_TARGET_DIRECTIVE,
STMT_OMP_TEAMS_DIRECTIVE,
STMT_OMP_TASKGROUP_DIRECTIVE,
STMT_OMP_CANCELLATION_POINT_DIRECTIVE,
STMT_OMP_CANCEL_DIRECTIVE,
// ARC
EXPR_OBJC_BRIDGED_CAST, // ObjCBridgedCastExpr

View File

@ -304,7 +304,6 @@ class ASTReader
public ExternalHeaderFileInfoSource,
public ExternalSemaSource,
public IdentifierInfoLookup,
public ExternalIdentifierLookup,
public ExternalSLocEntrySource
{
public:
@ -1846,6 +1845,11 @@ class ASTReader
/// Note: overrides method in ExternalASTSource
Module *getModule(unsigned ID) override;
/// \brief Return a descriptor for the corresponding module.
llvm::Optional<ASTSourceDescriptor> getSourceDescriptor(unsigned ID) override;
/// \brief Return a descriptor for the module.
ASTSourceDescriptor getSourceDescriptor(const Module &M) override;
/// \brief Retrieve a selector from the given module with its local ID
/// number.
Selector getLocalSelector(ModuleFile &M, unsigned LocalID);

View File

@ -42,6 +42,7 @@ namespace llvm {
namespace clang {
class ASTContext;
class Attr;
class NestedNameSpecifier;
class CXXBaseSpecifier;
class CXXCtorInitializer;
@ -60,6 +61,7 @@ class Module;
class PreprocessedEntity;
class PreprocessingRecord;
class Preprocessor;
class RecordDecl;
class Sema;
class SourceManager;
struct StoredDeclsList;
@ -302,6 +304,7 @@ class ASTWriter : public ASTDeserializationListener,
unsigned Loc;
unsigned Val;
Module *Mod;
const Attr *Attribute;
};
public:
@ -315,6 +318,8 @@ class ASTWriter : public ASTDeserializationListener,
: Kind(Kind), Val(Val) {}
DeclUpdate(unsigned Kind, Module *M)
: Kind(Kind), Mod(M) {}
DeclUpdate(unsigned Kind, const Attr *Attribute)
: Kind(Kind), Attribute(Attribute) {}
unsigned getKind() const { return Kind; }
const Decl *getDecl() const { return Dcl; }
@ -324,6 +329,7 @@ class ASTWriter : public ASTDeserializationListener,
}
unsigned getNumber() const { return Val; }
Module *getModule() const { return Mod; }
const Attr *getAttr() const { return Attribute; }
};
typedef SmallVector<DeclUpdate, 1> UpdateRecord;
@ -860,6 +866,8 @@ class ASTWriter : public ASTDeserializationListener,
void DeclarationMarkedUsed(const Decl *D) override;
void DeclarationMarkedOpenMPThreadPrivate(const Decl *D) override;
void RedefinedHiddenDefinition(const NamedDecl *D, Module *M) override;
void AddedAttributeToRecord(const Attr *Attr,
const RecordDecl *Record) override;
};
/// \brief AST and semantic-analysis consumer that generates a

View File

@ -20,6 +20,7 @@
#include "clang/Serialization/ContinuousRangeMap.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/Bitcode/BitstreamReader.h"
#include "llvm/Support/Endian.h"
#include <memory>
#include <string>
@ -206,7 +207,7 @@ class ModuleFile {
llvm::BitstreamCursor InputFilesCursor;
/// \brief Offsets for all of the input file entries in the AST file.
const uint64_t *InputFileOffsets;
const llvm::support::unaligned_uint64_t *InputFileOffsets;
/// \brief The input files that have been loaded from this AST file.
std::vector<InputFile> InputFilesLoaded;

View File

@ -464,7 +464,7 @@ class BugReporter {
/// The reports are usually generated by the checkers. Further, they are
/// folded based on the profile value, which is done to coalesce similar
/// reports.
void emitReport(BugReport *R);
void emitReport(std::unique_ptr<BugReport> R);
void EmitBasicReport(const Decl *DeclWithIssue, const CheckerBase *Checker,
StringRef BugName, StringRef BugCategory,

View File

@ -232,9 +232,9 @@ class CheckerContext {
}
/// \brief Emit the diagnostics report.
void emitReport(BugReport *R) {
void emitReport(std::unique_ptr<BugReport> R) {
Changed = true;
Eng.getBugReporter().emitReport(R);
Eng.getBugReporter().emitReport(std::move(R));
}
/// \brief Get the declaration of the called function (path-sensitive).

View File

@ -28,10 +28,9 @@ template <class T> bool containsStmt(const Stmt *S) {
if (isa<T>(S))
return true;
for (Stmt::const_child_range I = S->children(); I; ++I)
if (const Stmt *child = *I)
if (containsStmt<T>(child))
return true;
for (const Stmt *Child : S->children())
if (Child && containsStmt<T>(Child))
return true;
return false;
}

View File

@ -355,8 +355,8 @@ class ObjCMigrator : public RecursiveASTVisitor<ObjCMigrator> {
bool TraverseObjCMessageExpr(ObjCMessageExpr *E) {
// Do depth first; we want to rewrite the subexpressions first so that if
// we have to move expressions we will move them already rewritten.
for (Stmt::child_range range = E->children(); range; ++range)
if (!TraverseStmt(*range))
for (Stmt *SubStmt : E->children())
if (!TraverseStmt(SubStmt))
return false;
return WalkUpFromObjCMessageExpr(E);

View File

@ -1786,6 +1786,17 @@ TypeInfo ASTContext::getTypeInfoImpl(const Type *T) const {
return TypeInfo(Width, Align, AlignIsRequired);
}
unsigned ASTContext::getOpenMPDefaultSimdAlign(QualType T) const {
unsigned SimdAlign = getTargetInfo().getSimdDefaultAlign();
// Target ppc64 with QPX: simd default alignment for pointer to double is 32.
if ((getTargetInfo().getTriple().getArch() == llvm::Triple::ppc64 ||
getTargetInfo().getTriple().getArch() == llvm::Triple::ppc64le) &&
getTargetInfo().getABI() == "elfv1-qpx" &&
T->isSpecificBuiltinType(BuiltinType::Double))
SimdAlign = 256;
return SimdAlign;
}
/// toCharUnitsFromBits - Convert a size in bits to a size in characters.
CharUnits ASTContext::toCharUnitsFromBits(int64_t BitSize) const {
return CharUnits::fromQuantity(BitSize / getCharWidth());
@ -1866,6 +1877,16 @@ CharUnits ASTContext::getAlignOfGlobalVarInChars(QualType T) const {
return toCharUnitsFromBits(getAlignOfGlobalVar(T));
}
CharUnits ASTContext::getOffsetOfBaseWithVBPtr(const CXXRecordDecl *RD) const {
CharUnits Offset = CharUnits::Zero();
const ASTRecordLayout *Layout = &getASTRecordLayout(RD);
while (const CXXRecordDecl *Base = Layout->getBaseSharingVBPtr()) {
Offset += Layout->getBaseClassOffset(Base);
Layout = &getASTRecordLayout(Base);
}
return Offset;
}
/// DeepCollectObjCIvars -
/// This routine first collects all declared, but not synthesized, ivars in
/// super class and then collects all ivars, including those synthesized for

View File

@ -981,6 +981,10 @@ void ASTDumper::dumpDecl(const Decl *D) {
OS << " in " << M->getFullModuleName();
else if (Module *M = D->getLocalOwningModule())
OS << " in (local) " << M->getFullModuleName();
if (auto *ND = dyn_cast<NamedDecl>(D))
for (Module *M : D->getASTContext().getModulesWithMergedDefinition(
const_cast<NamedDecl *>(ND)))
dumpChild([=] { OS << "also in " << M->getFullModuleName(); });
if (const NamedDecl *ND = dyn_cast<NamedDecl>(D))
if (ND->isHidden())
OS << " hidden";
@ -1595,8 +1599,8 @@ void ASTDumper::dumpStmt(const Stmt *S) {
ConstStmtVisitor<ASTDumper>::Visit(S);
for (Stmt::const_child_range CI = S->children(); CI; ++CI)
dumpStmt(*CI);
for (const Stmt *SubStmt : S->children())
dumpStmt(SubStmt);
});
}
@ -1825,6 +1829,9 @@ void ASTDumper::VisitUnaryExprOrTypeTraitExpr(
case UETT_VecStep:
OS << " vec_step";
break;
case UETT_OpenMPRequiredSimdAlign:
OS << " __builtin_omp_required_simd_align";
break;
}
if (Node->isArgumentType())
dumpType(Node->getArgumentType());

View File

@ -236,6 +236,7 @@ void Decl::setLexicalDeclContext(DeclContext *DC) {
} else {
getMultipleDC()->LexicalDC = DC;
}
Hidden = cast<Decl>(DC)->Hidden;
}
void Decl::setDeclContextsImpl(DeclContext *SemaDC, DeclContext *LexicalDC,

View File

@ -954,9 +954,8 @@ void DeclPrinter::PrintObjCMethodType(ASTContext &Ctx,
if (Quals & Decl::ObjCDeclQualifier::OBJC_TQ_Oneway)
Out << "oneway ";
if (Quals & Decl::ObjCDeclQualifier::OBJC_TQ_CSNullability) {
if (auto nullability = AttributedType::stripOuterNullability(T)) {
Out << getNullabilitySpelling(*nullability).substr(2) << ' ';
}
if (auto nullability = AttributedType::stripOuterNullability(T))
Out << getNullabilitySpelling(*nullability, true) << ' ';
}
Out << Ctx.getUnqualifiedObjCPointerType(T).getAsString(Policy);
@ -1207,7 +1206,7 @@ void DeclPrinter::VisitObjCPropertyDecl(ObjCPropertyDecl *PDecl) {
Out << (first ? ' ' : ',') << "null_resettable";
} else {
Out << (first ? ' ' : ',')
<< getNullabilitySpelling(*nullability).substr(2);
<< getNullabilitySpelling(*nullability, true);
}
first = false;
}

View File

@ -3154,10 +3154,10 @@ bool Expr::HasSideEffects(const ASTContext &Ctx,
}
// Recurse to children.
for (const_child_range SubStmts = children(); SubStmts; ++SubStmts)
if (const Stmt *S = *SubStmts)
if (cast<Expr>(S)->HasSideEffects(Ctx, IncludePossibleEffects))
return true;
for (const Stmt *SubStmt : children())
if (SubStmt &&
cast<Expr>(SubStmt)->HasSideEffects(Ctx, IncludePossibleEffects))
return true;
return false;
}

View File

@ -7251,6 +7251,13 @@ bool IntExprEvaluator::VisitUnaryExprOrTypeTraitExpr(
return false;
return Success(Sizeof, E);
}
case UETT_OpenMPRequiredSimdAlign:
assert(E->isArgumentType());
return Success(
Info.Ctx.toCharUnitsFromBits(
Info.Ctx.getOpenMPDefaultSimdAlign(E->getArgumentType()))
.getQuantity(),
E);
}
llvm_unreachable("unknown expr/type trait");

View File

@ -22,6 +22,16 @@ using namespace clang;
ExternalASTSource::~ExternalASTSource() { }
llvm::Optional<ExternalASTSource::ASTSourceDescriptor>
ExternalASTSource::getSourceDescriptor(unsigned ID) {
return None;
}
ExternalASTSource::ASTSourceDescriptor
ExternalASTSource::getSourceDescriptor(const Module &M) {
return ASTSourceDescriptor();
}
void ExternalASTSource::FindFileRegionDecls(FileID File, unsigned Offset,
unsigned Length,
SmallVectorImpl<Decl *> &Decls) {}

View File

@ -3018,13 +3018,21 @@ void CXXNameMangler::mangleExpression(const Expr *E, unsigned Arity) {
case UETT_AlignOf:
Out << 'a';
break;
case UETT_VecStep:
case UETT_VecStep: {
DiagnosticsEngine &Diags = Context.getDiags();
unsigned DiagID = Diags.getCustomDiagID(DiagnosticsEngine::Error,
"cannot yet mangle vec_step expression");
Diags.Report(DiagID);
return;
}
case UETT_OpenMPRequiredSimdAlign:
DiagnosticsEngine &Diags = Context.getDiags();
unsigned DiagID = Diags.getCustomDiagID(
DiagnosticsEngine::Error,
"cannot yet mangle __builtin_omp_required_simd_align expression");
Diags.Report(DiagID);
return;
}
if (SAE->isArgumentType()) {
Out << 't';
mangleType(SAE->getArgumentType());

View File

@ -115,6 +115,9 @@ class MicrosoftMangleContextImpl : public MicrosoftMangleContext {
void mangleCXXVBTable(const CXXRecordDecl *Derived,
ArrayRef<const CXXRecordDecl *> BasePath,
raw_ostream &Out) override;
void mangleCXXVirtualDisplacementMap(const CXXRecordDecl *SrcRD,
const CXXRecordDecl *DstRD,
raw_ostream &Out) override;
void mangleCXXThrowInfo(QualType T, bool IsConst, bool IsVolatile,
uint32_t NumEntries, raw_ostream &Out) override;
void mangleCXXCatchableTypeArray(QualType T, uint32_t NumEntries,
@ -499,6 +502,9 @@ void MicrosoftCXXNameMangler::mangleMemberDataPointer(const CXXRecordDecl *RD,
FieldOffset /= getASTContext().getCharWidth();
VBTableOffset = 0;
if (IM == MSInheritanceAttr::Keyword_virtual_inheritance)
FieldOffset -= getASTContext().getOffsetOfBaseWithVBPtr(RD).getQuantity();
} else {
FieldOffset = RD->nullFieldOffsetIsZero() ? 0 : -1;
@ -567,6 +573,10 @@ MicrosoftCXXNameMangler::mangleMemberFunctionPointer(const CXXRecordDecl *RD,
mangleName(MD);
mangleFunctionEncoding(MD, /*ShouldMangle=*/true);
}
if (VBTableOffset == 0 &&
IM == MSInheritanceAttr::Keyword_virtual_inheritance)
NVOffset -= getASTContext().getOffsetOfBaseWithVBPtr(RD).getQuantity();
} else {
// Null single inheritance member functions are encoded as a simple nullptr.
if (IM == MSInheritanceAttr::Keyword_single_inheritance) {
@ -579,7 +589,7 @@ MicrosoftCXXNameMangler::mangleMemberFunctionPointer(const CXXRecordDecl *RD,
}
if (MSInheritanceAttr::hasNVOffsetField(/*IsMemberFunction=*/true, IM))
mangleNumber(NVOffset);
mangleNumber(static_cast<uint32_t>(NVOffset));
if (MSInheritanceAttr::hasVBPtrOffsetField(IM))
mangleNumber(VBPtrOffset);
if (MSInheritanceAttr::hasVBTableOffsetField(IM))
@ -1205,11 +1215,23 @@ void MicrosoftCXXNameMangler::mangleTemplateArg(const TemplateDecl *TD,
return;
}
if (MPT->isMemberDataPointer()) {
mangleMemberDataPointer(RD, nullptr);
return;
if (isa<ClassTemplateDecl>(TD)) {
mangleMemberDataPointer(RD, nullptr);
return;
}
// nullptr data pointers are always represented with a single field
// which is initialized with either 0 or -1. Why -1? Well, we need to
// distinguish the case where the data member is at offset zero in the
// record.
// However, we are free to use 0 *if* we would use multiple fields for
// non-nullptr member pointers.
if (!RD->nullFieldOffsetIsZero()) {
mangleIntegerLiteral(llvm::APSInt::get(-1), /*IsBoolean=*/false);
return;
}
}
}
Out << "$0A@";
mangleIntegerLiteral(llvm::APSInt::getUnsigned(0), /*IsBoolean=*/false);
break;
}
case TemplateArgument::Expression:
@ -2395,6 +2417,15 @@ void MicrosoftMangleContextImpl::mangleCXXCatchHandlerType(QualType T,
Mangler.getStream() << '.' << Flags;
}
void MicrosoftMangleContextImpl::mangleCXXVirtualDisplacementMap(
const CXXRecordDecl *SrcRD, const CXXRecordDecl *DstRD, raw_ostream &Out) {
MicrosoftCXXNameMangler Mangler(*this, Out);
Mangler.getStream() << "\01??_K";
Mangler.mangleName(SrcRD);
Mangler.getStream() << "$C";
Mangler.mangleName(DstRD);
}
void MicrosoftMangleContextImpl::mangleCXXThrowInfo(QualType T,
bool IsConst,
bool IsVolatile,

View File

@ -30,7 +30,8 @@ IdentifierInfo *NSAPI::getNSClassId(NSClassIdKindKind K) const {
"NSNumber",
"NSMutableSet",
"NSCountedSet",
"NSMutableOrderedSet"
"NSMutableOrderedSet",
"NSValue"
};
if (!ClassIds[K])

View File

@ -36,8 +36,8 @@ static void BuildParentMap(MapTy& M, Stmt* S,
// If we are rebuilding the map, clear out any existing state.
if (M[POE->getSyntacticForm()])
for (Stmt::child_range I = S->children(); I; ++I)
M[*I] = nullptr;
for (Stmt *SubStmt : S->children())
M[SubStmt] = nullptr;
M[POE->getSyntacticForm()] = S;
BuildParentMap(M, POE->getSyntacticForm(), OV_Transparent);
@ -82,10 +82,10 @@ static void BuildParentMap(MapTy& M, Stmt* S,
break;
}
default:
for (Stmt::child_range I = S->children(); I; ++I) {
if (*I) {
M[*I] = S;
BuildParentMap(M, *I, OVMode);
for (Stmt *SubStmt : S->children()) {
if (SubStmt) {
M[SubStmt] = S;
BuildParentMap(M, SubStmt, OVMode);
}
}
break;

View File

@ -1579,6 +1579,30 @@ OMPFlushClause *OMPFlushClause::CreateEmpty(const ASTContext &C, unsigned N) {
return new (Mem) OMPFlushClause(N);
}
OMPDependClause *
OMPDependClause::Create(const ASTContext &C, SourceLocation StartLoc,
SourceLocation LParenLoc, SourceLocation EndLoc,
OpenMPDependClauseKind DepKind, SourceLocation DepLoc,
SourceLocation ColonLoc, ArrayRef<Expr *> VL) {
void *Mem = C.Allocate(llvm::RoundUpToAlignment(sizeof(OMPDependClause),
llvm::alignOf<Expr *>()) +
sizeof(Expr *) * VL.size());
OMPDependClause *Clause =
new (Mem) OMPDependClause(StartLoc, LParenLoc, EndLoc, VL.size());
Clause->setVarRefs(VL);
Clause->setDependencyKind(DepKind);
Clause->setDependencyLoc(DepLoc);
Clause->setColonLoc(ColonLoc);
return Clause;
}
OMPDependClause *OMPDependClause::CreateEmpty(const ASTContext &C, unsigned N) {
void *Mem = C.Allocate(llvm::RoundUpToAlignment(sizeof(OMPDependClause),
llvm::alignOf<Expr *>()) +
sizeof(Expr *) * N);
return new (Mem) OMPDependClause(N);
}
const OMPClause *
OMPExecutableDirective::getSingleClause(OpenMPClauseKind K) const {
auto &&I = getClausesOfKind(K);
@ -2062,6 +2086,46 @@ OMPTaskgroupDirective *OMPTaskgroupDirective::CreateEmpty(const ASTContext &C,
return new (Mem) OMPTaskgroupDirective();
}
OMPCancellationPointDirective *OMPCancellationPointDirective::Create(
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
OpenMPDirectiveKind CancelRegion) {
unsigned Size = llvm::RoundUpToAlignment(
sizeof(OMPCancellationPointDirective), llvm::alignOf<Stmt *>());
void *Mem = C.Allocate(Size);
OMPCancellationPointDirective *Dir =
new (Mem) OMPCancellationPointDirective(StartLoc, EndLoc);
Dir->setCancelRegion(CancelRegion);
return Dir;
}
OMPCancellationPointDirective *
OMPCancellationPointDirective::CreateEmpty(const ASTContext &C, EmptyShell) {
unsigned Size = llvm::RoundUpToAlignment(
sizeof(OMPCancellationPointDirective), llvm::alignOf<Stmt *>());
void *Mem = C.Allocate(Size);
return new (Mem) OMPCancellationPointDirective();
}
OMPCancelDirective *
OMPCancelDirective::Create(const ASTContext &C, SourceLocation StartLoc,
SourceLocation EndLoc,
OpenMPDirectiveKind CancelRegion) {
unsigned Size = llvm::RoundUpToAlignment(sizeof(OMPCancelDirective),
llvm::alignOf<Stmt *>());
void *Mem = C.Allocate(Size);
OMPCancelDirective *Dir = new (Mem) OMPCancelDirective(StartLoc, EndLoc);
Dir->setCancelRegion(CancelRegion);
return Dir;
}
OMPCancelDirective *OMPCancelDirective::CreateEmpty(const ASTContext &C,
EmptyShell) {
unsigned Size = llvm::RoundUpToAlignment(sizeof(OMPCancelDirective),
llvm::alignOf<Stmt *>());
void *Mem = C.Allocate(Size);
return new (Mem) OMPCancelDirective();
}
OMPFlushDirective *OMPFlushDirective::Create(const ASTContext &C,
SourceLocation StartLoc,
SourceLocation EndLoc,

View File

@ -93,12 +93,12 @@ bool StmtIteratorBase::HandleDecl(Decl* D) {
}
StmtIteratorBase::StmtIteratorBase(Decl** dgi, Decl** dge)
: stmt(nullptr), DGI(dgi), RawVAPtr(DeclGroupMode), DGE(dge) {
: DGI(dgi), RawVAPtr(DeclGroupMode), DGE(dge) {
NextDecl(false);
}
StmtIteratorBase::StmtIteratorBase(const VariableArrayType* t)
: stmt(nullptr), DGI(nullptr), RawVAPtr(SizeOfTypeVAMode) {
: DGI(nullptr), RawVAPtr(SizeOfTypeVAMode) {
RawVAPtr |= reinterpret_cast<uintptr_t>(t);
}

View File

@ -799,6 +799,17 @@ void OMPClausePrinter::VisitOMPFlushClause(OMPFlushClause *Node) {
OS << ")";
}
}
void OMPClausePrinter::VisitOMPDependClause(OMPDependClause *Node) {
if (!Node->varlist_empty()) {
OS << "depend(";
OS << getOpenMPSimpleClauseTypeName(Node->getClauseKind(),
Node->getDependencyKind())
<< " :";
VisitOMPClauseList(Node, ' ');
OS << ")";
}
}
}
//===----------------------------------------------------------------------===//
@ -940,6 +951,18 @@ void StmtPrinter::VisitOMPTeamsDirective(OMPTeamsDirective *Node) {
PrintOMPExecutableDirective(Node);
}
void StmtPrinter::VisitOMPCancellationPointDirective(
OMPCancellationPointDirective *Node) {
Indent() << "#pragma omp cancellation point "
<< getOpenMPDirectiveName(Node->getCancelRegion());
PrintOMPExecutableDirective(Node);
}
void StmtPrinter::VisitOMPCancelDirective(OMPCancelDirective *Node) {
Indent() << "#pragma omp cancel "
<< getOpenMPDirectiveName(Node->getCancelRegion());
PrintOMPExecutableDirective(Node);
}
//===----------------------------------------------------------------------===//
// Expr printing methods.
//===----------------------------------------------------------------------===//
@ -1206,6 +1229,9 @@ void StmtPrinter::VisitUnaryExprOrTypeTraitExpr(UnaryExprOrTypeTraitExpr *Node){
case UETT_VecStep:
OS << "vec_step";
break;
case UETT_OpenMPRequiredSimdAlign:
OS << "__builtin_omp_required_simd_align";
break;
}
if (Node->isArgumentType()) {
OS << '(';

View File

@ -69,9 +69,9 @@ namespace {
void StmtProfiler::VisitStmt(const Stmt *S) {
ID.AddInteger(S->getStmtClass());
for (Stmt::const_child_range C = S->children(); C; ++C) {
if (*C)
Visit(*C);
for (const Stmt *SubStmt : S->children()) {
if (SubStmt)
Visit(SubStmt);
else
ID.AddInteger(0);
}
@ -425,6 +425,9 @@ OMPClauseProfiler::VisitOMPCopyprivateClause(const OMPCopyprivateClause *C) {
void OMPClauseProfiler::VisitOMPFlushClause(const OMPFlushClause *C) {
VisitOMPClauseList(C);
}
void OMPClauseProfiler::VisitOMPDependClause(const OMPDependClause *C) {
VisitOMPClauseList(C);
}
}
void
@ -534,6 +537,15 @@ void StmtProfiler::VisitOMPTeamsDirective(const OMPTeamsDirective *S) {
VisitOMPExecutableDirective(S);
}
void StmtProfiler::VisitOMPCancellationPointDirective(
const OMPCancellationPointDirective *S) {
VisitOMPExecutableDirective(S);
}
void StmtProfiler::VisitOMPCancelDirective(const OMPCancelDirective *S) {
VisitOMPExecutableDirective(S);
}
void StmtProfiler::VisitExpr(const Expr *S) {
VisitStmt(S);
}

View File

@ -364,6 +364,11 @@ bool Type::isStructureType() const {
return RT->getDecl()->isStruct();
return false;
}
bool Type::isObjCBoxableRecordType() const {
if (const RecordType *RT = getAs<RecordType>())
return RT->getDecl()->hasAttr<ObjCBoxableAttr>();
return false;
}
bool Type::isInterfaceType() const {
if (const RecordType *RT = getAs<RecordType>())
return RT->getDecl()->isInterface();

View File

@ -1147,11 +1147,11 @@ void TypePrinter::printAttributedBefore(const AttributedType *T,
T->getAttrKind() == AttributedType::attr_nullable ||
T->getAttrKind() == AttributedType::attr_null_unspecified) {
if (T->getAttrKind() == AttributedType::attr_nonnull)
OS << " __nonnull";
OS << " _Nonnull";
else if (T->getAttrKind() == AttributedType::attr_nullable)
OS << " __nullable";
OS << " _Nullable";
else if (T->getAttrKind() == AttributedType::attr_null_unspecified)
OS << " __null_unspecified";
OS << " _Null_unspecified";
else
llvm_unreachable("unhandled nullability");
spaceBeforePlaceHolder(OS);
@ -1186,11 +1186,11 @@ void TypePrinter::printAttributedAfter(const AttributedType *T,
T->getAttrKind() == AttributedType::attr_nullable ||
T->getAttrKind() == AttributedType::attr_null_unspecified) {
if (T->getAttrKind() == AttributedType::attr_nonnull)
OS << " __nonnull";
OS << " _Nonnull";
else if (T->getAttrKind() == AttributedType::attr_nullable)
OS << " __nullable";
OS << " _Nullable";
else if (T->getAttrKind() == AttributedType::attr_null_unspecified)
OS << " __null_unspecified";
OS << " _Null_unspecified";
else
llvm_unreachable("unhandled nullability");

View File

@ -114,9 +114,9 @@ DynTypedMatcher DynTypedMatcher::constructVariadic(
assert(InnerMatchers.size() > 0 && "Array must not be empty.");
assert(std::all_of(InnerMatchers.begin(), InnerMatchers.end(),
[&InnerMatchers](const DynTypedMatcher &M) {
return InnerMatchers[0].SupportedKind.isSame(M.SupportedKind);
return InnerMatchers[0].canConvertTo(M.SupportedKind);
}) &&
"SupportedKind must match!");
"SupportedKind must be convertible to a common type!");
auto SupportedKind = InnerMatchers[0].SupportedKind;
// We must relax the restrict kind here.

View File

@ -240,6 +240,7 @@ RegistryMaps::RegistryMaps() {
REGISTER_MATCHER(innerType);
REGISTER_MATCHER(integerLiteral);
REGISTER_MATCHER(isArrow);
REGISTER_MATCHER(isCatchAll);
REGISTER_MATCHER(isConst);
REGISTER_MATCHER(isConstQualified);
REGISTER_MATCHER(isDefinition);

View File

@ -472,9 +472,9 @@ class FindBlockDeclRefExprsVals : public StmtVisitor<FindBlockDeclRefExprsVals>{
: BEVals(bevals), BC(bc) {}
void VisitStmt(Stmt *S) {
for (Stmt::child_range I = S->children(); I; ++I)
if (Stmt *child = *I)
Visit(child);
for (Stmt *Child : S->children())
if (Child)
Visit(Child);
}
void VisitDeclRefExpr(DeclRefExpr *DR) {

View File

@ -270,9 +270,8 @@ reverse_children::reverse_children(Stmt *S) {
}
// Default case for all other statements.
for (Stmt::child_range I = S->children(); I; ++I) {
childrenBuf.push_back(*I);
}
for (Stmt *SubStmt : S->children())
childrenBuf.push_back(SubStmt);
// This needs to be done *after* childrenBuf has been populated.
children = childrenBuf;
@ -3641,11 +3640,11 @@ CFGBlock *CFGBuilder::VisitChildrenForTemporaryDtors(Stmt *E,
// bottom-up, this means we visit them in their natural order, which
// reverses them in the CFG.
CFGBlock *B = Block;
for (Stmt::child_range I = E->children(); I; ++I) {
if (Stmt *Child = *I)
for (Stmt *Child : E->children())
if (Child)
if (CFGBlock *R = VisitForTemporaryDtors(Child, false, Context))
B = R;
}
return B;
}

Some files were not shown because too many files have changed in this diff Show More