Commit Graph

2528 Commits

Author SHA1 Message Date
Richard Sandiford 69ab8b46b8 [Sema][SVE] Fix handling of initialisers for built-in SVE types
The built-in SVE types are supposed to be treated as opaque types.
This means that for initialisation purposes they should be treated
as a single unit, much like a scalar type.

However, as Eli pointed out, actually using "scalar" in the diagnostics
is likely to cause confusion, given the types are logically vectors.
The patch therefore uses custom diagnostics or generalises existing
ones.  Some of the messages use the word "indivisible" to try to make
it clear(er) that these types can't be initialised elementwise.

I don't think it's possible to trigger warn_braces_around_(scalar_)init
for sizeless types as things stand, since the types can't be used as
members or elements of more complex types.  But it seemed better to be
consistent with ext_many_braces_around_(scalar_)init, so the patch
changes it anyway.

Differential Revision: https://reviews.llvm.org/D76689
2020-05-06 12:24:27 +01:00
Richard Sandiford e959931092 [Sema] Put existing warning under -Wexcess-initializers
I have a follow-on patch that uses an alternative wording for
ext_excess_initializers in some cases.  This patch puts it and
a couple of related warnings under their own -W option in order
to avoid a regression in Misc/warning-flags.c.

Differential Revision: https://reviews.llvm.org/D79244
2020-05-06 11:28:40 +01:00
Richard Sandiford fb4574df52 [docs] Regenerate DiagnosticsReference.rst
It looks like it has been a while since the checked-in version of
DiagnosticsReference.rst was regenerated.  I realise there probably
isn't any expectation that the checked-in version is kept up-to-date,
but now that the project is on github and the rst can be viewed directly
from the repo's web interface, it seemed worth having something a bit
more recent.

Differential Revision: https://reviews.llvm.org/D79236
2020-05-06 10:26:47 +01:00
Vitaly Buka 04bd2c37ca [local-bounds] Ignore volatile operations
Summary:
-fsanitize=local-bounds is very similar to ``object-size`` and
should also ignore volatile pointers.
https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html#volatile

Reviewers: chandlerc, rsmith

Reviewed By: rsmith

Subscribers: cfe-commits, hiraditya, llvm-commits

Tags: #llvm, #clang

Differential Revision: https://reviews.llvm.org/D78607
2020-05-05 23:08:08 -07:00
Melanie Blower f5360d4bb3 Reapply "Add support for #pragma float_control" with buildbot fixes
Add support for #pragma float_control

Reviewers: rjmccall, erichkeane, sepavloff

Differential Revision: https://reviews.llvm.org/D72841

This reverts commit fce82c0ed3.
2020-05-04 05:51:25 -07:00
Melanie Blower fce82c0ed3 Revert "Reapply "Add support for #pragma float_control" with improvements to"
This reverts commit 69aacaf699.
2020-05-01 10:31:09 -07:00
Melanie Blower 69aacaf699 Reapply "Add support for #pragma float_control" with improvements to
test cases
Add support for #pragma float_control

Reviewers: rjmccall, erichkeane, sepavloff

Differential Revision: https://reviews.llvm.org/D72841

This reverts commit 85dc033cac, and makes
corrections to the test cases that failed on buildbots.
2020-05-01 10:03:30 -07:00
Melanie Blower 85dc033cac Revert "Add support for #pragma float_control"
This reverts commit 4f1e9a17e9.
due to fail on buildbot, sorry for the noise
2020-05-01 06:36:58 -07:00
Melanie Blower 4f1e9a17e9 Add support for #pragma float_control
Reviewers: rjmccall, erichkeane, sepavloff

Differential Revision: https://reviews.llvm.org/D72841
2020-05-01 06:14:24 -07:00
Aaron Smith 292058a5d6 [clang-format] Fix Microsoft style for enums
Summary:
Before this change enums were formatted incorrectly for the Microsoft style.

[C++ Example]

    enum {
      one,
      two
    } three, four;

[Incorrectly Formatted]

    enum
    {
      one,
      two
    } three,
        four;

[Correct Format with Patch]

    enum
    {
      one,
      two
    } three, four;

Reviewers: jbcoe, MyDeveloperDay, rnk

Reviewed By: MyDeveloperDay

Subscribers: cfe-commits

Tags: #clang, #clang-format

Differential Revision: https://reviews.llvm.org/D78982
2020-04-30 09:11:54 -07:00
mydeveloperday 0fa7e4adca [clang-format] NFC Correct clang-format headers file so documentation can be once again autogenerated
Summary:
`ClangFormatStyleOptions.rst` should ALWAYS be autogenerated from Format.h using `clang/docs/tools/dump_format_style.py` if not its liable to get removed leaving options undocumented.

This revision reworks the documentation for {D73354} {D73768} to ensure we can continue to regenerated

Fix other minor changes that ensure the documentation remains consistent (Format.h obviously got re clang-formatted after the rst had been regenerated previously)

Reviewed By: krasimir

Subscribers: cfe-commits

Tags: #clang, #clang-format

Differential Revision: https://reviews.llvm.org/D79095
2020-04-30 10:50:29 +01:00
Richard Smith 20df6038ee Make -fno-char8_t disable the char8_t keyword, even in C++20.
This fixes a regression introduced in r354736, and makes our behavior
compatible with that of Clang 8 and GCC.
2020-04-28 23:49:35 -07:00
Reid Kleckner b8000c0ce8 [Windows] Autolink with basenames and add libdir to libpath
Prior to this change, for a few compiler-rt libraries such as ubsan and
the profile library, Clang would embed "-defaultlib:path/to/rt-arch.lib"
into the .drective section of every object compiled with
-finstr-profile-generate or -fsanitize=ubsan as appropriate.

These paths assume that the link step will run from the same working
directory as the compile step. There is also evidence that sometimes the
paths become absolute, such as when clang is run from a different drive
letter from the current working directory. This is fragile, and I'd like
to get away from having paths embedded in the object if possible. Long
ago it was suggested that we use this for ASan, and apparently I felt
the same way back then:
https://reviews.llvm.org/D4428#56536

This is also consistent with how all other autolinking usage works for
PS4, Mac, and Windows: they all use basenames, not paths.

To keep things working for people using the standard GCC driver
workflow, the driver now adds the resource directory to the linker
library search path when it calls the linker. This is enough to make
check-ubsan pass, and seems like a generally good thing.

Users that invoke the linker directly (most clang-cl users) will have to
add clang's resource library directory to their linker search path in
their build system. I'm not sure where I can document this. Ideally I'd
also do it in the MSBuild files, but I can't figure out where they go.
I'd like to start with this for now.

Reviewed By: hans

Differential Revision: https://reviews.llvm.org/D65543
2020-04-28 11:36:21 -07:00
Zola Bridges c750847e0c [libcxx][docs][dfsan] Fix rst rendering related typos
* Fix the code block disappearance problem by adding a new line
* Fix the typo where I forgot a space

Reviewed By: ldionne

Differential Revision: https://reviews.llvm.org/D78953
2020-04-27 15:07:11 -07:00
Florian Hahn 7363ffe95f [Matrix] Add draft specification for matrix support in Clang.
This patch documents the planned matrix support in Clang, based on the
draft specification discussed on cfe-dev in the 'Matrix Support in
Clang' thread.

Latest draft spec sent to cfe-dev: http://lists.llvm.org/pipermail/cfe-dev/2020-February/064742.html
Discussion thread January: http://lists.llvm.org/pipermail/cfe-dev/2020-January/064206.html
Discussion thread March: http://lists.llvm.org/pipermail/cfe-dev/2020-March/064834.html

Reviewers: rsmith, anemet, Bigcheese, dexonsmith, rjmccall

Reviewed By: rjmccall

Differential Revision: https://reviews.llvm.org/D76612
2020-04-27 18:00:23 +01:00
Dmitri Gribenko 96717125e8 Revert "[analyzer] On-demand parsing capability for CTU"
This reverts commit 811c0c9eb4. It broke
multiple buildbots.
2020-04-27 14:27:04 +02:00
Endre Fülöp 811c0c9eb4 [analyzer] On-demand parsing capability for CTU
Summary:
Add an option to enable on-demand parsing of needed ASTs during CTU analysis.
Two options are introduced. CTUOnDemandParsing enables the feature, and
CTUOnDemandParsingDatabase specifies the path to a compilation database, which
has all the necessary information to generate the ASTs.

Reviewers: martong, balazske, Szelethus, xazax.hun

Subscribers: ormris, mgorny, whisperity, xazax.hun, baloghadamsoftware, szepet, rnkovacs, a.sidorin, mikhail.ramalho, Szelethus, donat.nagy, dkrupp, Charusso, steakhal, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D75665
2020-04-27 11:20:35 +02:00
Jian Cai fcbc613ad8 Make "#pragma clang attribute" support uninitialized attribute.
Summary:
When using -ftrivial-auto-var-init=* options to initiate automatic
variables in a file, to disable initialization on some variables,
currently we have to manually annotate the variables with uninitialized
attribute, such as

int dont_initialize_me __attribute((uninitialized));

Making pragma clang attribute to support this attribute would make
annotating variables much easier, and could be particular useful for
bisection efforts, e.g.

void use(void*);

void buggy() {
    int arr[256];
    int boom;
    float bam;
    struct { int oops; } oops;
    union { int oof; float aaaaa; } oof;

    use(&arr);
    use(&boom);
    use(&bam);
    use(&oops);
    use(&oof);
}

Reviewers: jfb, rjmccall, aaron.ballman

Reviewed By: jfb, aaron.ballman

Subscribers: aaron.ballman, george.burgess.iv, dexonsmith, MaskRay, phosek, hubert.reinterpretcast, gbiv, manojgupta, llozano, srhines, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D78693
2020-04-23 14:25:13 -07:00
Xing GUO b0a1c0b72c [doc] Fix broken link. NFC. 2020-04-23 22:47:39 +08:00
Kumar Harsh 3a5380618e Add extension links for VSCode
The clang-format docs were missing mention or links for the VSCode extension, which have been added.
2020-04-23 14:56:36 +02:00
Haojian Wu 47ef09e484 Revert "clang-format: support aligned nested conditionals formatting"
This reverts 3d61b1120e, 5daa25fd7a

The clang-format test (FormatTest.ConfigurableUseOfTab) is failing in the buildbot:

http://lab.llvm.org:8011/builders/clang-s390x-linux/builds/31811/steps/ninja%20check%201/logs/stdio
2020-04-23 09:25:01 +02:00
Mikhail Maltsev 089fbe6919 [Docs] Fixed formatting in release notes, NFC 2020-04-22 18:25:22 +01:00
Francois Ferrand 3d61b1120e clang-format: Introduce stricter AlignOperands flag
Summary:
Even when BreakBeforeBinaryOperators is set, AlignOperands kept
aligning the beginning of the line, even when it could align the
actual operands (e.g. after an assignment).

With this patch, there is an option to actually align the operands, so
that the operator gets right-aligned with the equal sign or return
operator:

  int aaaaa = bbbbbb
            + cccccc;
  return aaaaaaa
      && bbbbbbb;

This not happen in parentheses, to avoid 'breaking' the indentation:

  if (aaaaa
      && bbbbb)
    return;

Reviewers: krasimir, djasper

Subscribers: cfe-commits, klimek

Differential Revision: https://reviews.llvm.org/D32478
2020-04-22 17:36:38 +02:00
Mikhail Maltsev d7ab9e7c9b [ARM] Release notes for the Custom Datapath Extension (CDE)
Summary:
This change mentions CDE assembly in the LLVM release notes and CDE
intrinsics in both Clang and LLVM release notes.

Reviewers: kristof.beyls, simon_tatham

Reviewed By: kristof.beyls

Subscribers: danielkiss, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D78481
2020-04-22 16:34:19 +01:00
Sjoerd Meijer 35cf2f42dd [Driver][docs] Document option -mtune as a no-op.
This documents that option -mtune is accepted for compatibility with GCC,
currently it has no effect, and thus does not currently perform any CPU type
specific tuning.

Corresponding discussion on the cfe dev list:
http://lists.llvm.org/pipermail/cfe-dev/2020-April/065169.html

Differential Revision: https://reviews.llvm.org/D78511
2020-04-22 09:15:48 +01:00
Justin Hibbits 4ca2cad947 [PowerPC] Add clang -msvr4-struct-return for 32-bit ELF
Summary:

Change the default ABI to be compatible with GCC.  For 32-bit ELF
targets other than Linux, Clang now returns small structs in registers
r3/r4.  This affects FreeBSD, NetBSD, OpenBSD.  There is no change for
32-bit Linux, where Clang continues to return all structs in memory.

Add clang options -maix-struct-return (to return structs in memory) and
-msvr4-struct-return (to return structs in registers) to be compatible
with gcc.  These options are only for PPC32; reject them on PPC64 and
other targets.  The options are like -fpcc-struct-return and
-freg-struct-return for X86_32, and use similar code.

To actually return a struct in registers, coerce it to an integer of the
same size.  LLVM may optimize the code to remove unnecessary accesses to
memory, and will return i32 in r3 or i64 in r3:r4.

Fixes PR#40736

Patch by George Koehler!

Reviewed By: jhibbits, nemanjai
Differential Revision: https://reviews.llvm.org/D73290
2020-04-21 20:17:25 -05:00
Zola Bridges 0f12480bd1 [dfsan] Add "DataFlow" option to LLVM_USE_SANITIZER
Summary:
This patch add the dataflow option to LLVM_USE_SANITIZER and documents
it.

Tested via check-cxx (wip to fix the errors).

Reviewers: morehouse, #libc!

Subscribers: mgorny, cfe-commits, libcxx-commits

Tags: #clang, #libc

Differential Revision: https://reviews.llvm.org/D78390
2020-04-20 10:30:52 -07:00
Richard Smith c8248dc3bb Change deprecated -fsanitize-recover flag to apply to all sanitizers, not just UBSan.
Summary:
This flag has been deprecated, with an on-by-default warning encouraging
users to explicitly specify whether they mean "all" or ubsan for 5 years
(released in Clang 3.7). Change it to mean what we wanted and
undeprecate it.

Also make the argument to -fsanitize-trap optional, and likewise default
it to 'all', and express the aliases for these flags in the .td file
rather than in code. (Plus documentation updates for the above.)

Reviewers: kcc

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D77753
2020-04-17 22:37:30 -07:00
Erich Keane 5f0903e9be Reland Implement _ExtInt as an extended int type specifier.
I fixed the LLDB issue, so re-applying the patch.

This reverts commit a4b88c0449.
2020-04-17 10:45:48 -07:00
Sterling Augustine a4b88c0449 Revert "Implement _ExtInt as an extended int type specifier."
This reverts commit 61ba1481e2.

I'm reverting this because it breaks the lldb build with
incomplete switch coverage warnings. I would fix it forward,
but am not familiar enough with lldb to determine the correct
fix.

lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp:3958:11: error: enumeration values 'DependentExtInt' and 'ExtInt' not handled in switch [-Werror,-Wswitch]
  switch (qual_type->getTypeClass()) {
          ^
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp:4633:11: error: enumeration values 'DependentExtInt' and 'ExtInt' not handled in switch [-Werror,-Wswitch]
  switch (qual_type->getTypeClass()) {
          ^
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp:4889:11: error: enumeration values 'DependentExtInt' and 'ExtInt' not handled in switch [-Werror,-Wswitch]
  switch (qual_type->getTypeClass()) {
2020-04-17 10:29:40 -07:00
Erich Keane 61ba1481e2 Implement _ExtInt as an extended int type specifier.
Introduction/Motivation:
LLVM-IR supports integers of non-power-of-2 bitwidth, in the iN syntax.
Integers of non-power-of-two aren't particularly interesting or useful
on most hardware, so much so that no language in Clang has been
motivated to expose it before.

However, in the case of FPGA hardware normal integer types where the
full bitwidth isn't used, is extremely wasteful and has severe
performance/space concerns.  Because of this, Intel has introduced this
functionality in the High Level Synthesis compiler[0]
under the name "Arbitrary Precision Integer" (ap_int for short). This
has been extremely useful and effective for our users, permitting them
to optimize their storage and operation space on an architecture where
both can be extremely expensive.

We are proposing upstreaming a more palatable version of this to the
community, in the form of this proposal and accompanying patch.  We are
proposing the syntax _ExtInt(N).  We intend to propose this to the WG14
committee[1], and the underscore-capital seems like the active direction
for a WG14 paper's acceptance.  An alternative that Richard Smith
suggested on the initial review was __int(N), however we believe that
is much less acceptable by WG14.  We considered _Int, however _Int is
used as an identifier in libstdc++ and there is no good way to fall
back to an identifier (since _Int(5) is indistinguishable from an
unnamed initializer of a template type named _Int).

[0]https://www.intel.com/content/www/us/en/software/programmable/quartus-prime/hls-compiler.html)
[1]http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2472.pdf

Differential Revision: https://reviews.llvm.org/D73967
2020-04-17 07:10:57 -07:00
Nandor Licker b3387d1c30 [ConstExprPreter] Updated constant interpreter documentation
Summary:
Updated the documentation to better reflect features implemented on the
constexpr branch at https://github.com/nandor/llvm-project and extended
the TODO list with known missing features

Reviewers: rsmith, Bigcheese, dexonsmith, jfb

Subscribers: lebedev.ri, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D75726
2020-04-15 11:25:23 +01:00
mydeveloperday e8111502d8 [clang-format] use spaces for alignment with UT_ForContinuationAndIndentation
Summary:
Use spaces instead of tabs for alignment with UT_ForContinuationAndIndentation to make the code aligned for any tab/indent width.

Fixes https://bugs.llvm.org/show_bug.cgi?id=38381

Reviewed By: MyDeveloperDay

Patch By: fickert

Tags: #clang-format

Differential Revision: https://reviews.llvm.org/D75034
2020-04-13 15:14:26 +01:00
Benjamin Kramer ebd5290ff2 Address sphinx warnings
LanguageExtensions.rst:2191: WARNING: Title underline too short.
llvm-symbolizer.rst:157: Error in "code-block" directive: maximum 1 argument(s) allowed, 30 supplied.
2020-04-13 14:41:55 +02:00
Matt Morehouse bef187c750 Implement `-fsanitize-coverage-whitelist` and `-fsanitize-coverage-blacklist` for clang
Summary:
This commit adds two command-line options to clang.
These options let the user decide which functions will receive SanitizerCoverage instrumentation.
This is most useful in the libFuzzer use case, where it enables targeted coverage-guided fuzzing.

Patch by Yannis Juglaret of DGA-MI, Rennes, France

libFuzzer tests its target against an evolving corpus, and relies on SanitizerCoverage instrumentation to collect the code coverage information that drives corpus evolution. Currently, libFuzzer collects such information for all functions of the target under test, and adds to the corpus every mutated sample that finds a new code coverage path in any function of the target. We propose instead to let the user specify which functions' code coverage information is relevant for building the upcoming fuzzing campaign's corpus. To this end, we add two new command line options for clang, enabling targeted coverage-guided fuzzing with libFuzzer. We see targeted coverage guided fuzzing as a simple way to leverage libFuzzer for big targets with thousands of functions or multiple dependencies. We publish this patch as work from DGA-MI of Rennes, France, with proper authorization from the hierarchy.

Targeted coverage-guided fuzzing can accelerate bug finding for two reasons. First, the compiler will avoid costly instrumentation for non-relevant functions, accelerating fuzzer execution for each call to any of these functions. Second, the built fuzzer will produce and use a more accurate corpus, because it will not keep the samples that find new coverage paths in non-relevant functions.

The two new command line options are `-fsanitize-coverage-whitelist` and `-fsanitize-coverage-blacklist`. They accept files in the same format as the existing `-fsanitize-blacklist` option <https://clang.llvm.org/docs/SanitizerSpecialCaseList.html#format>. The new options influence SanitizerCoverage so that it will only instrument a subset of the functions in the target. We explain these options in detail in `clang/docs/SanitizerCoverage.rst`.

Consider now the woff2 fuzzing example from the libFuzzer tutorial <https://github.com/google/fuzzer-test-suite/blob/master/tutorial/libFuzzerTutorial.md>. We are aware that we cannot conclude much from this example because mutating compressed data is generally a bad idea, but let us use it anyway as an illustration for its simplicity. Let us use an empty blacklist together with one of the three following whitelists:

```
  # (a)
  src:*
  fun:*

  # (b)
  src:SRC/*
  fun:*

  # (c)
  src:SRC/src/woff2_dec.cc
  fun:*
```

Running the built fuzzers shows how many instrumentation points the compiler adds, the fuzzer will output //XXX PCs//. Whitelist (a) is the instrument-everything whitelist, it produces 11912 instrumentation points. Whitelist (b) focuses coverage to instrument woff2 source code only, ignoring the dependency code for brotli (de)compression; it produces 3984 instrumented instrumentation points. Whitelist (c) focuses coverage to only instrument functions in the main file that deals with WOFF2 to TTF conversion, resulting in 1056 instrumentation points.

For experimentation purposes, we ran each fuzzer approximately 100 times, single process, with the initial corpus provided in the tutorial. We let the fuzzer run until it either found the heap buffer overflow or went out of memory. On this simple example, whitelists (b) and (c) found the heap buffer overflow more reliably and 5x faster than whitelist (a). The average execution times when finding the heap buffer overflow were as follows: (a) 904 s, (b) 156 s, and (c) 176 s.

We explain these results by the fact that WOFF2 to TTF conversion calls the brotli decompression algorithm's functions, which are mostly irrelevant for finding bugs in WOFF2 font reconstruction but nevertheless instrumented and used by whitelist (a) to guide fuzzing. This results in longer execution time for these functions and a partially irrelevant corpus. Contrary to whitelist (a), whitelists (b) and (c) will execute brotli-related functions without instrumentation overhead, and ignore new code paths found in them. This results in faster bug finding for WOFF2 font reconstruction.

The results for whitelist (b) are similar to the ones for whitelist (c). Indeed, WOFF2 to TTF conversion calls functions that are mostly located in SRC/src/woff2_dec.cc. The 2892 extra instrumentation points allowed by whitelist (b) do not tamper with bug finding, even though they are mostly irrelevant, simply because most of these functions do not get called. We get a slightly faster average time for bug finding with whitelist (b), which might indicate that some of the extra instrumentation points are actually relevant, or might just be random noise.

Reviewers: kcc, morehouse, vitalybuka

Reviewed By: morehouse, vitalybuka

Subscribers: pratyai, vitalybuka, eternalsakura, xwlin222, dende, srhines, kubamracek, #sanitizers, lebedev.ri, hiraditya, cfe-commits, llvm-commits

Tags: #clang, #sanitizers, #llvm

Differential Revision: https://reviews.llvm.org/D63616
2020-04-10 10:44:03 -07:00
Nathan James db71354e4f [ASTMatchers] Fixed CastKind being parsed incorrectly for dynamic matchers
Summary: Requires hasCastKind arguments to have `CK_` prefixed to bring it in line with the documentation and other matchers that take enumerations.

Reviewers: klimek, aaron.ballman

Reviewed By: aaron.ballman

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D77503
2020-04-09 15:09:45 +01:00
Pratyai Mazumder ced398fdc8 [SanitizerCoverage] Add -fsanitize-coverage=inline-bool-flag
Reviewers: kcc, vitalybuka

Reviewed By: vitalybuka

Subscribers: cfe-commits, llvm-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D77637
2020-04-09 02:40:55 -07:00
WangTianQing a3dc949000 [X86] Add TSXLDTRK instructions.
Summary: For more details about these instructions, please refer to the latest ISE document: https://software.intel.com/en-us/download/intel-architecture-instruction-set-extensions-programming-reference

Reviewers: craig.topper, RKSimon, LuoYuanke

Reviewed By: craig.topper

Subscribers: mgorny, hiraditya, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D77205
2020-04-09 13:17:29 +08:00
Alexey Bataev e0ae907ab5 [OPENMP][DOCS]Update status of oimplemented constructs, NFC. 2020-04-07 15:45:08 -04:00
Nico Weber 7545be074d fix comment typo to cycle bots 2020-04-06 18:58:27 -04:00
Kanglei Fang 28ecd7f0b0 [clang-format] Don't break multi block parameters on ObjCBreakBeforeNestedBlockParam
Summary:
While [the original diff](https://reviews.llvm.org/D42493) makes a lot of sense, and multiple inline block parameter/trailing paramemter after inline block paramemter should be discouraged, the formatting result is different than what xcode does by default
For the exact same example provided in the original diff:
```
[object
  blockArgument:^{
    a = 42;
  }
     anotherArg:42];
```
The code is hard to read and not very visually pleasing

This diff uses `ObjCBreakBeforeNestedBlockParam` to shield from the formatting
When it's set to false, don't allign the inline block paramemters.

Reviewers: jolesiak, benhamilton, jinlin

Reviewed By: jolesiak

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D77039
2020-04-06 14:20:09 -07:00
Richard Smith 7f24db0175 Add documentation and testing for
2c88a485c7.

Also extend it to cover memchr for consistency.
2020-04-05 15:24:49 -07:00
Richard Smith 4ede887992 PR45402: Make the restrictions on constant evaluation of memcmp and
memchr consistent and comprehensible, and document them.

We previously allowed evaluation of memcmp on arrays of integers of any
size, so long as the call evaluated to 0, and allowed evaluation of
memchr on any array of integral type of size 1 (including enums). The
purpose of constant-evaluating these builtins is only to support
constexpr std::char_traits, so we now consistently allow them on arrays
of (possibly signed or unsigned) char only.
2020-04-03 18:26:14 -07:00
Scott Constable 5b519cf1fc [X86] Add Indirect Thunk Support to X86 to mitigate Load Value Injection (LVI)
This pass replaces each indirect call/jump with a direct call to a thunk that looks like:

lfence
jmpq *%r11

This ensures that if the value in register %r11 was loaded from memory, then
the value in %r11 is (architecturally) correct prior to the jump.
Also adds a new target feature to X86: +lvi-cfi
("cfi" meaning control-flow integrity)
The feature can be added via clang CLI using -mlvi-cfi.

This is an alternate implementation to https://reviews.llvm.org/D75934 That merges the thunk insertion functionality with the existing X86 retpoline code.

Differential Revision: https://reviews.llvm.org/D76812
2020-04-03 00:34:39 -07:00
WangTianQing d08fadd662 [X86] Add SERIALIZE instruction.
Summary: For more details about this instruction, please refer to the latest ISE document: https://software.intel.com/en-us/download/intel-architecture-instruction-set-extensions-programming-reference

Reviewers: craig.topper, RKSimon, LuoYuanke

Reviewed By: craig.topper

Subscribers: mgorny, hiraditya, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D77193
2020-04-02 16:19:23 +08:00
Alexey Bataev 39ada46889 [OPENMP][DOCS]Mark array shaping as done, NFC. 2020-03-31 19:12:52 -04:00
John Brawn 0cff81cff0 Add a release note for attribute plugins 2020-03-26 15:01:57 +00:00
John Brawn 3f03c12a51 Add an attribute plugin example
Differential Revision: https://reviews.llvm.org/D31343
2020-03-25 14:33:44 +00:00
Erich Keane b5a034e771 [SYCL] Implement __builtin_unique_stable_name.
In order to support non-user-named kernels, SYCL needs some way in the
integration headers to name the kernel object themselves. Initially, the
design considered just RTTI naming of the lambdas, this results in a
quite unstable situation in light of some device/host macros.
Additionally, this ends up needing to use RTTI, which is a burden on the
implementation and typically unsupported.

Instead, we've introduced a builtin, __builtin_unique_stable_name, which
takes a type or expression, and results in a constexpr constant
character array that uniquely represents the type (or type of the
expression) being passed to it.

The implementation accomplishes that simply by using a slightly modified
version of the Itanium Mangling. The one exception is when mangling
lambdas, instead of appending the index of the lambda in the function,
it appends the macro-expansion back-trace of the lambda itself in the
form LINE->COL[~LINE->COL...].

Differential Revision: https://reviews.llvm.org/D76620
2020-03-25 07:01:50 -07:00
Simon Tatham f282b6ab23 [ReleaseNotes,ARM] MVE intrinsics are all implemented!
Summary:
The next release of LLVM will support the full ACLE spec for MVE intrinsics,
so it's worth saying so in the release notes.

Reviewers: kristof.beyls

Reviewed By: kristof.beyls

Subscribers: cfe-commits, hans, dmgreen, llvm-commits

Tags: #llvm, #clang

Differential Revision: https://reviews.llvm.org/D76513
2020-03-24 11:42:25 +00:00
Richard Smith 5bd06118c2 Update documentation for __builtin_operator_new and
__builtin_operator_delete to match r328134.
2020-03-23 16:31:10 -07:00
John Brawn fa0320dd8d Add ParsedAttrInfo::handleDeclAttribute
This makes it possible for plugin attributes to actually do something, and also
removes a lot of boilerplate for simple attributes in SemaDeclAttr.cpp.

Differential Revision: https://reviews.llvm.org/D31342
2020-03-23 13:23:11 +00:00
Sylvestre Ledru 72fd1033ea Doc: Links should use https 2020-03-22 22:49:33 +01:00
Sylvestre Ledru 7cfd5de61b clang/release notes: s/Subversion/git/ 2020-03-22 22:18:40 +01:00
Florian Hahn 684ee2057f [clang/docs] Fix various sphinx warnings/errors in docs.
There are a few places with unexpected indents that trip over sphinx and
other syntax errors.

Also, the C++ syntax highlighting does not work for
    class [[gsl::Owner(int)]] IntOwner {

Use a regular code:: block instead.

There are a few other warnings errors remaining, of the form
'Duplicate explicit target name: "cmdoption-clang--prefix"'. They seem
to be caused by the following
  .. option:: -B<dir>, --prefix <arg>, --prefix=<arg>

I am no Restructured Text expert, but it seems like sphinx 1.8.5
tries to generate the same target for the --prefix <arg> and
--prefix=<arg>. This pops up in a lot of places and I am not sure how to
best resolve it

Reviewers: jfb, Bigcheese, dexonsmith, rjmccall

Reviewed By: rjmccall

Differential Revision: https://reviews.llvm.org/D76534
2020-03-21 16:06:33 +00:00
Shiva Chen fc3752665f [RISCV] Passing small data limitation value to RISCV backend
Passing small data limit to RISCVELFTargetObjectFile by module flag,
So the backend can set small data section threshold by the value.
The data will be put into the small data section if the data smaller than
the threshold.

Differential Revision: https://reviews.llvm.org/D57497
2020-03-20 11:03:51 +08:00
Alexey Bataev cf1f8f9bec [OPENMP][DOCS]Update list of constructs and status, NFC. 2020-03-19 10:20:29 -04:00
Aaron Ballman 83989e6941 Don't call anyone lazy in the documentation. 2020-03-17 16:33:28 -04:00
Nick Desaulniers 246398ece7 [clang][Parse] properly parse asm-qualifiers, asm inline
Summary:
The parsing of GNU C extended asm statements was a little brittle and
had a few issues:
- It was using Parse::ParseTypeQualifierListOpt to parse the `volatile`
  qualifier.  That parser is really meant for TypeQualifiers; an asm
  statement doesn't really have a type qualifier. This is still maybe
  nice to have, but not necessary. We now can check for the `volatile`
  token by properly expanding the grammer, rather than abusing
  Parse::ParseTypeQualifierListOpt.
- The parsing of `goto` was position dependent, so `asm goto volatile`
  wouldn't parse. The qualifiers should be position independent to one
  another. Now they are.
- We would warn on duplicate `volatile`, but the parse error for
  duplicate `goto` was a generic parse error and wasn't clear.
- We need to add support for the recent GNU C extension `asm inline`.
  Adding support to the parser with the above issues highlighted the
  need for this refactoring.

Link: https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html

Reviewers: aaron.ballman

Reviewed By: aaron.ballman

Subscribers: aheejin, jfb, nathanchance, cfe-commits, echristo, efriedma, rsmith, chandlerc, craig.topper, erichkeane, jyu2, void, srhines

Tags: #clang

Differential Revision: https://reviews.llvm.org/D75563
2020-03-12 15:13:59 -07:00
Roman Lebedev d5edcb9064
[clang] Prune 'IsOMPStructuredBlock' Stmt bit
As discussed in https://reviews.llvm.org/D59214#1916596
and in some other reviews dealing with FPenv,
bits in Stmt are scarce, and i got so burnout with D59214
and https://bugs.llvm.org/show_bug.cgi?id=40563 specifically
that i never actually followed up with the usages for this bit.

So let's unhoard it, at least for now?
2020-03-12 14:48:57 +03:00
Mitchell Balan c5c487f0d4 Revert "[clang-format] Add option to specify explicit config file"
There were a number of unexpected test failures.

This reverts commit 10b1a87ba3.
2020-03-11 16:14:42 -04:00
Mitchell Balan 10b1a87ba3 [clang-format] Add option to specify explicit config file
Summary:
This diff extends the -style=file option to allow a config file to be specified explicitly. This is useful (for instance) when adding IDE commands to reformat code to a personal style.

Reviewers: djasper, ioeric, krasimir, MyDeveloperDay

Reviewed by: MyDeveloperDay

Contributed by: tnorth

Subscribers: cfe-commits, lebedev.ri, MyDeveloperDay, klimek, sammccall, mitchell-stellar

Tags: #clang, #clang-format

Differential Revision: https://reviews.llvm.org/D72326
2020-03-11 15:56:44 -04:00
Alexey Bataev 0d7c8c07d2 [OPENMP][DOCS]Mark depobj as implemented, NFC. 2020-03-11 13:26:01 -04:00
Craig Topper 9624beb38a [docs] Regenerate ClangCommandLineReference.rst
Just ran clang-tblgen -gen-opt-docs ClangOptionDocs.td
2020-03-10 11:10:18 -07:00
Nathan James 77eec38626 [ASTMatchers] Add hasAnyOverloadedOperatorName matcher
Reviewers: aaron.ballman

Reviewed By: aaron.ballman

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D75841
2020-03-10 00:11:27 +00:00
Sjoerd Meijer 3d9a0445cc Recommit #2 "[Driver] Default to -fno-common for all targets"
After a first attempt to fix the test-suite failures, my first recommit
caused the same failures again. I had updated CMakeList.txt files of
tests that needed -fcommon, but it turns out that there are also
Makefiles which are used by some bots, so I've updated these Makefiles
now too.

See the original commit message for more details on this change:
0a9fc9233e
2020-03-09 19:57:03 +00:00
Sjoerd Meijer f35d112efd Revert "Recommit "[Driver] Default to -fno-common for all targets""
This reverts commit 2c36c23f34.

Still problems in the test-suite, which I really thought I had fixed...
2020-03-09 10:37:28 +00:00
Sjoerd Meijer 2c36c23f34 Recommit "[Driver] Default to -fno-common for all targets"
This includes fixes for:
- test-suite: some benchmarks need to be compiled with -fcommon, see D75557.
- compiler-rt: one test needed -fcommon, and another a change, see D75520.
2020-03-09 10:07:37 +00:00
Nathan James fc3c80c386 [ASTMatchers] adds isComparisonOperator to BinaryOperator and CXXOperatorCallExpr
Reviewers: aaron.ballman, gribozavr2

Reviewed By: aaron.ballman

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D75800
2020-03-09 00:05:10 +00:00
John McCall e4422ae0f6 Rewrite the non-trivial structs section of the ARC spec.
As part of this, set down the general rules for non-trivial types
in C in their full and gory detail, and then separately describe how
they apply to the ARC qualified types.

I'm not totally satisfied with the drafting of the dynamic-objects UB
rules here, but I feel like I'm building on a lot of wreckage.
2020-03-06 02:51:45 -05:00
Tom Stellard 87d8ae700b [clang][cmake] Include generated rst files in html built by docs-clang-html target
Summary:
This is an attempt to simply the process of building the clang
documentation, which should help avoid some of the recent issues we've
had generating the documentation for the website.

The html documentation for clang is generated by sphinx from the
reStructuredText (rst) files we have in the clang/docs directory.
There are also some rst files that need to be generated by TableGen,
before they can be passed to sphinx.  Prior to this patch we were not
generating those rst files as part with the build system and they had to be
generated manually.

This patch enables the automatic generation of these rst files, but
since they are generated at build time the cannot be placed in the
clang/docs directory and must go into the cmake build directory.

Unfortunately sphinx does not currently support multiple source
directories[1], so in order to be able to generate the full
documentation, we need to work around this by copying the
rst files from the clang/docs into the  build directory before
generating the html documentation.

[1] https://github.com/sphinx-doc/sphinx/issues/3132

Reviewers: rsmith, aaron.ballman, beanz, smeenai, phosek, compnerd, mgorny, delcypher

Reviewed By: mgorny, delcypher

Subscribers: delcypher, merge_guards_bot, mgorny, llvm-commits, cfe-commits

Tags: #clang, #llvm

Differential Revision: https://reviews.llvm.org/D72875
2020-03-05 21:30:37 -08:00
Yitzhak Mandelbaum c359f9537f [AST Matchers] Restrict `optionally` matcher to a single argument.
Summary:
Currently, `optionally` can take multiple arguments, which commits it to a
particular strategy for those arguments (in this case, "for each"). We limit the
matcher to a single argument, which avoids any potential confusion and
simplifies the implementation. The user can retrieve multiple-argument
optionality, by explicitly using the desired operator (like `forEach`, `anyOf`,
`allOf`, etc.) with all children wrapped in `optionally`.

Reviewers: sbenza, aaron.ballman

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D75556
2020-03-05 14:48:40 -05:00
Balazs Benics 859bcf4e3b [analyzer][taint] Add isTainted debug expression inspection check
Summary:
This patch introduces the `clang_analyzer_isTainted` expression inspection
check for checking taint.

Using this we could query the analyzer whether the expression used as the
argument is tainted or not. This would be useful in tests, where we don't want
to issue warning for all tainted expressions in a given file
(like the `debug.TaintTest` would do) but only for certain expressions.

Example usage:

```lang=c++
int read_integer() {
  int n;
  clang_analyzer_isTainted(n);     // expected-warning{{NO}}
  scanf("%d", &n);
  clang_analyzer_isTainted(n);     // expected-warning{{YES}}
  clang_analyzer_isTainted(n + 2); // expected-warning{{YES}}
  clang_analyzer_isTainted(n > 0); // expected-warning{{YES}}
  int next_tainted_value = n; // no-warning
  return n;
}
```

Reviewers: NoQ, Szelethus, baloghadamsoftware, xazax.hun, boga95

Reviewed By: Szelethus

Subscribers: martong, rnkovacs, whisperity, xazax.hun,
baloghadamsoftware, szepet, a.sidorin, mikhail.ramalho, donat.nagy,
Charusso, cfe-commits, boga95, dkrupp, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D74131
2020-03-03 14:40:23 +01:00
Sjoerd Meijer 4e363563fa Revert "[Driver] Default to -fno-common for all targets"
This reverts commit 0a9fc9233e.

Going to look at the asan failures.

I find the failures in the test suite weird, because they look
like compile time test and I don't understand how that can be
failing, but will have a brief look at that too.
2020-03-03 10:00:36 +00:00
Sjoerd Meijer 0a9fc9233e [Driver] Default to -fno-common for all targets
This makes -fno-common the default for all targets because this has performance
and code-size benefits and is more language conforming for C code.
Additionally, GCC10 also defaults to -fno-common and so we get consistent
behaviour with GCC.

With this change, C code that uses tentative definitions as definitions of a
variable in multiple translation units will trigger multiple-definition linker
errors. Generally, this occurs when the use of the extern keyword is neglected
in the declaration of a variable in a header file. In some cases, no specific
translation unit provides a definition of the variable. The previous behavior
can be restored by specifying -fcommon.

As GCC has switched already, we benefit from applications already being ported
and existing documentation how to do this. For example:
- https://gcc.gnu.org/gcc-10/porting_to.html
- https://wiki.gentoo.org/wiki/Gcc_10_porting_notes/fno_common

Differential revision: https://reviews.llvm.org/D75056
2020-03-03 09:15:07 +00:00
Nick Desaulniers 91cdbd521a clang: Switch C compilations to C17 by default.
Summary:
Matches GCC 8.1 (2018).

Updates documentation+release notes as well.

See also https://reviews.llvm.org/rL220244.

Reviewers: rsmith, aaron.ballman

Reviewed By: rsmith, aaron.ballman

Subscribers: aaron.ballman, dschuff, aheejin, simoncook, s.egerton, cfe-commits, hans, srhines

Tags: #clang

Differential Revision: https://reviews.llvm.org/D75383
2020-03-02 09:39:26 -08:00
Aaron Ballman f35f59ac36 Adding some documentation for __builtin_dump_struct. 2020-02-27 09:30:17 -05:00
John McCall 7848a3c8ab Update the ARC docs for non-trivial ownership in structs. 2020-02-26 16:42:08 -05:00
Nathan James b653ab0e70 [docs] dump-ast-matchers removes const from Matcher args and handles template functions slightly better
Reviewers: aaron.ballman, gribozavr2, joerg

Reviewed By: aaron.ballman

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D75113
2020-02-26 01:56:50 +00:00
Nathan James 6a0c066c61 [ASTMatchers] Adds a matcher called `hasAnyOperatorName`
Summary:
Acts on `BinaryOperator` and `UnaryOperator` and functions the same as `anyOf(hasOperatorName(...), hasOperatorName(...), ...)`

Documentation generation isn't perfect but I feel that the python doc script needs updating for that

Reviewers: aaron.ballman, gribozavr2

Reviewed By: aaron.ballman, gribozavr2

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D75040
2020-02-25 07:51:20 +00:00
Bill Wendling 50cac24877 Support output constraints on "asm goto"
Summary:
Clang's "asm goto" feature didn't initially support outputs constraints. That
was the same behavior as gcc's implementation. The decision by gcc not to
support outputs was based on a restriction in their IR regarding terminators.
LLVM doesn't restrict terminators from returning values (e.g. 'invoke'), so
it made sense to support this feature.

Output values are valid only on the 'fallthrough' path. If an output value's used
on an indirect branch, then it's 'poisoned'.

In theory, outputs *could* be valid on the 'indirect' paths, but it's very
difficult to guarantee that the original semantics would be retained. E.g.
because indirect labels could be used as data, we wouldn't be able to split
critical edges in situations where two 'callbr' instructions have the same
indirect label, because the indirect branch's destination would no longer be
the same.

Reviewers: jyknight, nickdesaulniers, hfinkel

Reviewed By: jyknight, nickdesaulniers

Subscribers: MaskRay, rsmith, hiraditya, llvm-commits, cfe-commits, craig.topper, rnk

Tags: #clang, #llvm

Differential Revision: https://reviews.llvm.org/D69876
2020-02-24 18:51:29 -08:00
Nathan James e6f9cb025c [docs] dump_ast_matchers strips internal::(Bindable)?Matcher from Result_type
Summary: Remove `internal::Matcher` and `internal::BindableMatcher` from Result Type when dumping AST Matchers

Reviewers: joerg, gribozavr2, aaron.ballman

Reviewed By: aaron.ballman

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D75046
2020-02-25 00:00:39 +00:00
Melanie Blower c8dadac228 add release notes for ffp-model and ffp-exception-behavior 2020-02-24 06:42:05 -08:00
Zurab Tsinadze a54d81f597 [analyzer] CERT: POS34-C
Summary:
This patch introduces a new checker:
`alpha.security.cert.pos.34c`

This checker is implemented based on the following rule:
https://wiki.sei.cmu.edu/confluence/x/6NYxBQ
The check warns if  `putenv` function is
called with automatic storage variable as an argument.

Differential Revision: https://reviews.llvm.org/D71433
2020-02-19 18:12:19 +01:00
Oliver Stannard 78654e8511 Revert "Reland D74436 "Change clang option -ffp-model=precise to select ffp-contract=on"""
Reverting because this patch is causing ~20 llvm-test-suite failures on
a number of different bots:
* http://lab.llvm.org:8011/builders/clang-cmake-armv8-lld/builds/3366
* http://lab.llvm.org:8011/builders/clang-cmake-aarch64-lld/builds/8222
* http://lab.llvm.org:8011/builders/clang-cmake-x86_64-avx2-linux/builds/13275
* http://lab.llvm.org:8011/builders/clang-s390x-linux-lnt/builds/17213

This reverts commit cd2c5af6df.
2020-02-19 12:03:27 +00:00
Richard Smith 24ad121582 Add -std=c++20 flag, replace C++2a with C++20 throughout the Clang
user interface and documentation, and update __cplusplus for C++20.

WG21 considers the C++20 standard to be finished (even though it still
has some more steps to pass through in the ISO process).

The old flag names are accepted for compatibility, as usual, and we
still have lots of references to C++2a in comments and identifiers;
those can be cleaned up separately.
2020-02-18 16:16:37 -08:00
Melanie Blower cd2c5af6df Reland D74436 "Change clang option -ffp-model=precise to select ffp-contract=on""
Change clang option -ffp-model=precise, the default, to select ffp-contract=on
    The patch caused some problems for PowerPC but ibm has made
    adjustments so I am resubmitting this patch.  Additionally, Andy looked
    at the performance regressions on LNT and it looks like a loop
    unrolling decision that could be adjusted.

    Reviewers: rjmccall, Andy Kaylor

    Differential Revision: https://reviews.llvm.org/D74436
2020-02-18 06:55:36 -08:00
Mark de Wever 9658d895c8 [Sema] Adds the pointer-to-int-cast diagnostic
Converting a pointer to an integer whose result cannot represented in the
integer type is undefined behavior is C and prohibited in C++. C++ already
has a diagnostic when casting. This adds a diagnostic for C.

Since this diagnostic uses the range of the conversion it also modifies
int-to-pointer-cast diagnostic to use a range.

Fixes PR8718: No warning on casting between pointer and non-pointer-sized int

Differential Revision: https://reviews.llvm.org/D72231
2020-02-16 15:38:25 +01:00
Johannes Doerfert 5313abdbca [OpenMP][NFC] Update OpenMPSupport table 2020-02-15 00:40:39 -06:00
Melanie Blower 9122b92f8e Revert "Reland D74436 "Change clang option -ffp-model=precise to select ffp-contract=on""
This reverts commit 0a1123eb43.
Want to revert this because it's causing trouble for PowerPC
I also fixed test fp-model.c which was looking for an incorrect error message
2020-02-14 07:32:09 -08:00
Fangrui Song 0a1123eb43 Reland D74436 "Change clang option -ffp-model=precise to select ffp-contract=on"
Buildbot are failing with the current revert status. So reland with a
fix to fp-model.c
2020-02-13 16:22:03 -08:00
Melanie Blower 88ec01ca1b Revert "Revert "Revert "Change clang option -ffp-model=precise to select ffp-contract=on"""
This reverts commit abd09053bc.
It's causing internal buildbot fails on ppc

Conflicts:
	clang/lib/Driver/ToolChains/Clang.cpp
2020-02-13 15:06:12 -08:00
Wawha f7e2227832 [clang] Fix bad line ending (DOS instead of Unix) inside the release notes. 2020-02-13 22:52:28 +01:00
Wawha fa0118e6e5 [clang-format] Add new option BeforeLambdaBody in Allman style.
This option add a line break then a lambda is inside a function call.

Reviewers : djasper, klimek, krasimir, MyDeveloperDay

Reviewed By: MyDeveloperDay

Differential Revision: https://reviews.llvm.org/D44609
2020-02-13 22:16:41 +01:00
Alexey Bataev 7ecf066e65 [OPENMP][DOCS]Fix misprint, NFC. 2020-02-13 15:43:05 -05:00
Alexey Bataev 3eb1b59ec0 [OPENMP50][DOCS]Claim iterators and add reference to array shaping
patch, NFC.
2020-02-13 15:05:19 -05:00
Alexey Bataev 3203e1bc2e [OPENMP50][DOCS]Update list of supported constructs, NFC. 2020-02-13 15:02:59 -05:00
Reid Kleckner cd62511496 Remove clang::ast_type_traits namespace in favor of clang
DynTypedNode and ASTNodeKind are implemented as part of the clang AST
library, which uses the main clang namespace. There doesn't seem to be a
need for this extra level of namespacing.

I left behind aliases in the ast_type_traits namespace for out of tree
clients of these APIs. To provide aliases for the enumerators, I used
this pattern:
  namespace ast_type_traits {
  constexpr TraversalKind TK_AsIs = ::clang::TK_AsIs;
  }
I think the typedefs will be useful for migration, but we might be able
to drop these enumerator aliases.

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D74499
2020-02-13 10:46:47 -08:00
Alexey Bataev 43b98ffed0 [OPENMP][DOCS]Update status of support constructs, NFC. 2020-02-13 12:28:17 -05:00
Melanie Blower abd09053bc Revert "Revert "Change clang option -ffp-model=precise to select ffp-contract=on""
This reverts commit 99c5bcbce8.
Change clang option -ffp-model=precise to select ffp-contract=on
Including some small touch-ups to the original commit

Reviewers: rjmccall, Andy Kaylor

Differential Revision: https://reviews.llvm.org/D74436
2020-02-12 07:30:43 -08:00
Melanie Blower 99c5bcbce8 Revert "Change clang option -ffp-model=precise to select ffp-contract=on"
This reverts commit 3fcdf2fa94.
Sorry I was too hasty with my commit, I will review Andy's comments
and resubmit.
2020-02-11 14:20:00 -08:00
Melanie Blower 3fcdf2fa94 Change clang option -ffp-model=precise to select ffp-contract=on
Reviewers: rjmccall

Differential Revision: https://reviews.llvm.org/D74436
2020-02-11 14:07:10 -08:00
Nico Weber b50431defb fix some typos to cycle bots 2020-02-10 13:51:23 -05:00
serge_sans_paille e67cbac812 Support -fstack-clash-protection for x86
Implement protection against the stack clash attack [0] through inline stack
probing.

Probe stack allocation every PAGE_SIZE during frame lowering or dynamic
allocation to make sure the page guard, if any, is touched when touching the
stack, in a similar manner to GCC[1].

This extends the existing `probe-stack' mechanism with a special value `inline-asm'.
Technically the former uses function call before stack allocation while this
patch provides inlined stack probes and chunk allocation.

Only implemented for x86.

[0] https://www.qualys.com/2017/06/19/stack-clash/stack-clash.txt
[1] https://gcc.gnu.org/ml/gcc-patches/2017-07/msg00556.html

This a recommit of 39f50da2a3 with proper LiveIn
declaration, better option handling and more portable testing.

Differential Revision: https://reviews.llvm.org/D68720
2020-02-09 10:42:45 +01:00
serge-sans-paille 4546211600 Revert "Support -fstack-clash-protection for x86"
This reverts commit 0fd51a4554.

Failures:

http://lab.llvm.org:8011/builders/llvm-clang-win-x-armv7l/builds/4354
2020-02-09 10:06:31 +01:00
serge_sans_paille 0fd51a4554 Support -fstack-clash-protection for x86
Implement protection against the stack clash attack [0] through inline stack
probing.

Probe stack allocation every PAGE_SIZE during frame lowering or dynamic
allocation to make sure the page guard, if any, is touched when touching the
stack, in a similar manner to GCC[1].

This extends the existing `probe-stack' mechanism with a special value `inline-asm'.
Technically the former uses function call before stack allocation while this
patch provides inlined stack probes and chunk allocation.

Only implemented for x86.

[0] https://www.qualys.com/2017/06/19/stack-clash/stack-clash.txt
[1] https://gcc.gnu.org/ml/gcc-patches/2017-07/msg00556.html

This a recommit of 39f50da2a3 with proper LiveIn
declaration, better option handling and more portable testing.

Differential Revision: https://reviews.llvm.org/D68720
2020-02-09 09:35:42 +01:00
serge-sans-paille 658495e6ec Revert "Support -fstack-clash-protection for x86"
This reverts commit e229017732.

Failures:

http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-debian/builds/2604
http://lab.llvm.org:8011/builders/llvm-clang-win-x-aarch64/builds/4308
2020-02-08 14:26:22 +01:00
serge_sans_paille e229017732 Support -fstack-clash-protection for x86
Implement protection against the stack clash attack [0] through inline stack
probing.

Probe stack allocation every PAGE_SIZE during frame lowering or dynamic
allocation to make sure the page guard, if any, is touched when touching the
stack, in a similar manner to GCC[1].

This extends the existing `probe-stack' mechanism with a special value `inline-asm'.
Technically the former uses function call before stack allocation while this
patch provides inlined stack probes and chunk allocation.

Only implemented for x86.

[0] https://www.qualys.com/2017/06/19/stack-clash/stack-clash.txt
[1] https://gcc.gnu.org/ml/gcc-patches/2017-07/msg00556.html

This a recommit of 39f50da2a3 with better option
handling and more portable testing

Differential Revision: https://reviews.llvm.org/D68720
2020-02-08 13:31:52 +01:00
Guillaume Chatelet d65bbf81f8 [clang] Add support for __builtin_memcpy_inline
Summary: This is a follow up on D61634 and the last step to implement http://lists.llvm.org/pipermail/llvm-dev/2019-April/131973.html

Reviewers: efriedma, courbet, tejohnson

Subscribers: hiraditya, cfe-commits, llvm-commits, jdoerfert, t.p.northover

Tags: #clang, #llvm

Differential Revision: https://reviews.llvm.org/D73543
2020-02-07 23:55:26 +01:00
Nico Weber b03c3d8c62 Revert "Support -fstack-clash-protection for x86"
This reverts commit 4a1a0690ad.
Breaks tests on mac and win, see https://reviews.llvm.org/D68720
2020-02-07 14:49:38 -05:00
Richard Smith 7ae1b4a0ce Implement P1766R1: diagnose giving non-C-compatible classes a typedef name for linkage purposes.
Summary:
Due to a recent (but retroactive) C++ rule change, only sufficiently
C-compatible classes are permitted to be given a typedef name for
linkage purposes. Add an enabled-by-default warning for these cases, and
rephrase our existing error for the case where we encounter the typedef
name for linkage after we've already computed and used a wrong linkage
in terms of the new rule.

Reviewers: rjmccall

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D74103
2020-02-07 11:47:37 -08:00
serge_sans_paille 4a1a0690ad Support -fstack-clash-protection for x86
Implement protection against the stack clash attack [0] through inline stack
probing.

Probe stack allocation every PAGE_SIZE during frame lowering or dynamic
allocation to make sure the page guard, if any, is touched when touching the
stack, in a similar manner to GCC[1].

This extends the existing `probe-stack' mechanism with a special value `inline-asm'.
Technically the former uses function call before stack allocation while this
patch provides inlined stack probes and chunk allocation.

Only implemented for x86.

[0] https://www.qualys.com/2017/06/19/stack-clash/stack-clash.txt
[1] https://gcc.gnu.org/ml/gcc-patches/2017-07/msg00556.html

This a recommit of 39f50da2a3 with correct option
flags set.

Differential Revision: https://reviews.llvm.org/D68720
2020-02-07 19:54:39 +01:00
serge-sans-paille f6d98429fc Revert "Support -fstack-clash-protection for x86"
This reverts commit 39f50da2a3.

The -fstack-clash-protection is being passed to the linker too, which
is not intended.

Reverting and fixing that in a later commit.
2020-02-07 11:36:53 +01:00
serge_sans_paille 39f50da2a3 Support -fstack-clash-protection for x86
Implement protection against the stack clash attack [0] through inline stack
probing.

Probe stack allocation every PAGE_SIZE during frame lowering or dynamic
allocation to make sure the page guard, if any, is touched when touching the
stack, in a similar manner to GCC[1].

This extends the existing `probe-stack' mechanism with a special value `inline-asm'.
Technically the former uses function call before stack allocation while this
patch provides inlined stack probes and chunk allocation.

Only implemented for x86.

[0] https://www.qualys.com/2017/06/19/stack-clash/stack-clash.txt
[1] https://gcc.gnu.org/ml/gcc-patches/2017-07/msg00556.html

Differential Revision: https://reviews.llvm.org/D68720
2020-02-07 10:56:15 +01:00
Peter Collingbourne 7931e8eee3 Update hwasan docs to cover outlined checks and globals.
Differential Revision: https://reviews.llvm.org/D74150
2020-02-06 17:44:43 -08:00
Alexey Bataev 569dc65c63 [OPNEMP50][DOCS]Mark array shaping expression as claimed, NFC. 2020-02-05 10:02:39 -05:00
Kelvin Li ac43033631 [OpenMP] [DOCS] Update OMP5.0 feature status table [NFC]
Differential Revision: https://reviews.llvm.org/D72901
2020-02-03 18:30:36 -05:00
Alexey Bataev 6c3252e521 [OPENMP][DOCS]Update status of conditional lastprivate, NFC. 2020-02-03 12:43:40 -05:00
Haojian Wu bdbdf74822 [clang][AST] Add an AST matcher for deducedTemplateSpeializationType.
Summary:
misc-unused-using clang-tidy check needs this matcher to fix a false
positive of C++17 deduced class template types.

Reviewers: gribozavr2

Reviewed By: gribozavr2

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D73869
2020-02-03 12:11:44 +01:00
Martin Probst dc04c54fc1 clang-format: [JS] document InsertTrailingCommas.
Summary: In release notes and the regular docs.

Reviewers: MyDeveloperDay

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D73768
2020-02-03 08:51:52 +01:00
mydeveloperday 70c98671fa [clang-format] Add option for not breaking line before ObjC params
Summary:
From `clang-format` version 3.7.0 and up, , there is no way to keep following format of ObjectiveC block:
```
- (void)_aMethod
{
    [self.test1 t:self w:self callback:^(typeof(self) self, NSNumber *u, NSNumber *v) {
        u = c;
    }]
}
```
Regardless of the change in `.clang-format` configuration file, all parameters will be lined up so that colons will be on the same column, like following:
```
- (void)_aMethod
{
    [self.test1 t:self
                w:self
         callback:^(typeof(self) self, NSNumber *u, NSNumber *v) {
             u = c;
         }]
}
```

Considering with ObjectiveC, the first code style is cleaner & more readable for some people, I've added a config option: `ObjCDontBreakBeforeNestedBlockParam` (boolean) so that if it is enable, the first code style will be favored.

Reviewed By: MyDeveloperDay

Patch By: ghvg1313

Tags: #clang, #clang-format

Differential Revision: https://reviews.llvm.org/D70926
2020-02-01 17:39:34 +00:00
serge-sans-paille fd09f12f32 Implement -fsemantic-interposition
First attempt at implementing -fsemantic-interposition.

Rely on GlobalValue::isInterposable that already captures most of the expected
behavior.

Rely on a ModuleFlag to state whether we should respect SemanticInterposition or
not. The default remains no.

So this should be a no-op if -fsemantic-interposition isn't used, and if it is,
isInterposable being already used in most optimisation, they should honor it
properly.

Note that it only impacts architecture compiled with -fPIC and no pie.

Differential Revision: https://reviews.llvm.org/D72829
2020-01-31 14:02:33 +01:00
Nathan James a156a0e28d [ASTMatchers] Add hasPlacementArg and hasAnyPlacementArg traversal matcher for CXXNewExpr
Summary: Adds new traversal matchers called `hasPlacementArg` and `hasAnyPlacementArg` that matches on arguments to `placement new` operators.

Reviewers: aaron.ballman

Reviewed By: aaron.ballman

Subscribers: merge_guards_bot, mehdi_amini, hiraditya, steven_wu, dexonsmith, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D73562
2020-01-30 10:16:04 +00:00
Karasev Nikita d5dfd1350e Add TagDecl AST matcher 2020-01-29 07:58:31 -05:00
Momchil Velikov ac21535460 [ARM] Add documentation for -march= and -mfpu= command line options
Differential Revision: https://reviews.llvm.org/D73459
2020-01-29 10:39:01 +00:00
Nate Voorhies 84118fac3a [NFC] Removing experimental designation for ninja in docs.
Summary:
Ninja is no longer an experimental tool, documentation changed to
reflect this.

Reviewers: nikola

Reviewed By: nikola

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D73567
2020-01-28 15:28:40 -08:00
Nathan aec6210367 [ASTMatchers] Add cxxNoexceptExpr AST matcher
Summary: Adds a cxxNoexceptExpr matcher that matches the [[ https://en.cppreference.com/w/cpp/language/noexcept |  noexcept operator ]].

Reviewers: aaron.ballman

Reviewed By: aaron.ballman

Subscribers: merge_guards_bot, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D73439
2020-01-28 13:12:28 +00:00
Qiu Chaofan 59d690850e [NFC] Fix typo in Clang docs 2020-01-27 11:37:43 +08:00
Richard Smith fa2fc81d34 Re-add documentation for -flax-vector-conversions= removed in
edd4398f4c.

The documentation remains correct despite the revert of the patch.
2020-01-23 12:28:03 -08:00
Aaron Ballman 8edf037aeb Add a bit of documentation on attribute spellings that were missing. 2020-01-22 15:22:40 -05:00
Mitch Phillips edd4398f4c Revert "PR17164: Change clang's default behavior from -flax-vector-conversions=all to -flax-vector-conversions=integer."
This patch broke the Sanitizer buildbots. Please see the commit's
differential revision for more information
(https://reviews.llvm.org/D67678).

This reverts commit b72a8c65e4.
2020-01-20 16:34:09 -08:00
Richard Smith 7a9fa76be7 Undo changes to release notes intended for the Clang 10 branch, not master. 2020-01-19 18:33:42 -08:00
Nico Weber a7818e6f29 fix doc typos to cycle bots 2020-01-19 18:13:08 -05:00
mydeveloperday 14c044756e [clang-format] Add IndentCaseBlocks option
Summary:
The documentation for IndentCaseLabels claimed that the "Switch
statement body is always indented one level more than case labels". This
is technically false for the code block immediately following the label.
Its closing bracket aligns with the start of the label.

If the case label are not indented, it leads to a style where the
closing bracket of the block aligns with the closing bracket of the
switch statement, which can be hard to parse.

This change introduces a new option, IndentCaseBlocks, which when true
treats the block as a scope block (which it technically is).

(Note: regenerated ClangFormatStyleOptions.rst using tools/dump_style.py)

Reviewed By: MyDeveloperDay

Patch By: capn

Tags: #clang-format, #clang

Differential Revision: https://reviews.llvm.org/D72276
2020-01-19 15:52:26 +00:00
Nico Weber 46be168977 fix doc typos to cycle bots 2020-01-19 09:51:25 -05:00
Petr Hosek d3db13af7e [profile] Support counter relocation at runtime
This is an alternative to the continous mode that was implemented in
D68351. This mode relies on padding and the ability to mmap a file over
the existing mapping which is generally only available on POSIX systems
and isn't suitable for other platforms.

This change instead introduces the ability to relocate counters at
runtime using a level of indirection. On every counter access, we add a
bias to the counter address. This bias is stored in a symbol that's
provided by the profile runtime and is initially set to zero, meaning no
relocation. The runtime can mmap the profile into memory at abitrary
location, and set bias to the offset between the original and the new
counter location, at which point every subsequent counter access will be
to the new location, which allows updating profile directly akin to the
continous mode.

The advantage of this implementation is that doesn't require any special
OS support. The disadvantage is the extra overhead due to additional
instructions required for each counter access (overhead both in terms of
binary size and performance) plus duplication of counters (i.e. one copy
in the binary itself and another copy that's mmapped).

Differential Revision: https://reviews.llvm.org/D69740
2020-01-17 15:02:23 -08:00
Hans Wennborg 00c74d0b64 Remove release note about in-process-cc1
This feature landed before the 10.x branch, so it will be covered in the
clang 10 release notes instead.
2020-01-16 13:24:22 +01:00
Richard Smith b72a8c65e4 PR17164: Change clang's default behavior from -flax-vector-conversions=all to -flax-vector-conversions=integer.
Summary:
See proposal on cfe-dev:
http://lists.llvm.org/pipermail/cfe-dev/2019-April/062030.html

Reviewers: SjoerdMeijer, eli.friedman

Subscribers: kristof.beyls, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D67678
2020-01-15 13:14:57 -08:00
Nico Weber 8e5018e990 Replace CLANG_SPAWN_CC1 env var with a driver mode flag
Flags are clang's default UI is flags.

We can have an env var in addition to that, but in D69825 nobody has yet
mentioned why this needs an env var, so omit it for now.  If someone
needs to set the flag via env var, the existing CCC_OVERRIDE_OPTIONS
mechanism works for it (set CCC_OVERRIDE_OPTIONS=+-fno-integrated-cc1
for example).

Also mention the cc1-in-process change in the release notes.

Also spruce up the test a bit so it actually tests something :)

Differential Revision: https://reviews.llvm.org/D72769
2020-01-15 12:22:40 -05:00
Hans Wennborg 5852475e2c Bump the trunk major version to 11
and clear the release notes.
2020-01-15 13:38:01 +01:00
Erich Keane 349636d2bf Implement VectorType conditional operator GNU extension.
GCC supports the conditional operator on VectorTypes that acts as a
'select' in C++ mode. This patch implements the support. Types are
converted as closely to GCC's behavior as possible, though in a few
places consistency with our existing vector type support was preferred.

Note that this implementation is different from the OpenCL version in a
number of ways, so it unfortunately required a different implementation.

First, the SEMA rules and promotion rules are significantly different.

Secondly, GCC implements COND[i] != 0 ? LHS[i] : RHS[i] (where i is in
the range 0- VectorSize, for each element).  In OpenCL, the condition is
COND[i] < 0 ? LHS[i]: RHS[i].

In the process of implementing this, it was also required to make the
expression COND ? LHS : RHS type dependent if COND is type dependent,
since the type is now dependent on the condition.  For example:

    T ? 1 : 2;

Is not typically type dependent, since the result can be deduced from
the operands.  HOWEVER, if T is a VectorType now, it could change this
to a 'select' (basically a swizzle with a non-constant mask) with the 1
and 2 being promoted to vectors themselves.

While this is a change, it is NOT a standards incompatible change. Based
on my (and D. Gregor's, at the time of writing the code) reading of the
standard, the expression is supposed to be type dependent if ANY
sub-expression is type dependent.

Differential Revision: https://reviews.llvm.org/D71463
2020-01-13 13:27:20 -08:00
Mark de Wever dc422e968e Add -Wrange-loop-analysis changes to ReleaseNotes
This reflects the recent changes done.
2020-01-11 19:56:34 +01:00
Jonas Toth 23a799adf0 Revert "[ASTMatchers] extract public matchers from const-analysis into own patch"
This reverts commit 4c48ea68e4.
The powerpc buildbots had an internal compiler error after this patch.
This requires some inspection.
2020-01-11 19:41:27 +01:00
Jonas Toth 4c48ea68e4 [ASTMatchers] extract public matchers from const-analysis into own patch
Summary:
The analysis for const-ness of local variables required a view generally useful
matchers that are extracted into its own patch.

They are `decompositionDecl` and `forEachArgumentWithParamType`, that works
for calls through function pointers as well.

Reviewers: aaron.ballman

Reviewed By: aaron.ballman

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D72505
2020-01-11 19:21:03 +01:00
Reid 4ffcec40ac Implement new AST matcher hasAnyCapture to match on LambdaExpr captures.
Accepts child matchers cxxThisExpr to match on capture of this and also on varDecl.
2020-01-10 15:49:43 -05:00
Gabor Marton 5e7beb0a41 [analyzer] Add PlacementNewChecker
Summary:
This checker verifies if default placement new is provided with pointers
to sufficient storage capacity.

Noncompliant Code Example:
  #include <new>
  void f() {
    short s;
    long *lp = ::new (&s) long;
  }

Based on SEI CERT rule MEM54-CPP
https://wiki.sei.cmu.edu/confluence/display/cplusplus/MEM54-CPP.+Provide+placement+new+with+properly+aligned+pointe
This patch does not implement checking of the alignment.

Reviewers: NoQ, xazax.hun

Subscribers: mgorny, whisperity, xazax.hun, baloghadamsoftware, szepet,
rnkovacs, a.sidorin, mikhail.ramalho, donat

Tags: #clang

Differential Revision: https://reviews.llvm.org/D71612
2020-01-10 17:59:06 +01:00
Alex Richardson 8c387cbea7 Add builtins for aligning and checking alignment of pointers and integers
This change introduces three new builtins (which work on both pointers
and integers) that can be used instead of common bitwise arithmetic:
__builtin_align_up(x, alignment), __builtin_align_down(x, alignment) and
__builtin_is_aligned(x, alignment).

I originally added these builtins to the CHERI fork of LLVM a few years ago
to handle the slightly different C semantics that we use for CHERI [1].
Until recently these builtins (or sequences of other builtins) were
required to generate correct code. I have since made changes to the default
C semantics so that they are no longer strictly necessary (but using them
does generate slightly more efficient code). However, based on our experience
using them in various projects over the past few years, I believe that adding
these builtins to clang would be useful.

These builtins have the following benefit over bit-manipulation and casts
via uintptr_t:

- The named builtins clearly convey the semantics of the operation. While
  checking alignment using __builtin_is_aligned(x, 16) versus
  ((x & 15) == 0) is probably not a huge win in readably, I personally find
  __builtin_align_up(x, N) a lot easier to read than (x+(N-1))&~(N-1).
- They preserve the type of the argument (including const qualifiers). When
  using casts via uintptr_t, it is easy to cast to the wrong type or strip
  qualifiers such as const.
- If the alignment argument is a constant value, clang can check that it is
  a power-of-two and within the range of the type. Since the semantics of
  these builtins is well defined compared to arbitrary bit-manipulation,
  it is possible to add a UBSAN checker that the run-time value is a valid
  power-of-two. I intend to add this as a follow-up to this change.
- The builtins avoids int-to-pointer casts both in C and LLVM IR.
  In the future (i.e. once most optimizations handle it), we could use the new
  llvm.ptrmask intrinsic to avoid the ptrtoint instruction that would normally
  be generated.
- They can be used to round up/down to the next aligned value for both
  integers and pointers without requiring two separate macros.
- In many projects the alignment operations are already wrapped in macros (e.g.
  roundup2 and rounddown2 in FreeBSD), so by replacing the macro implementation
  with a builtin call, we get improved diagnostics for many call-sites while
  only having to change a few lines.
- Finally, the builtins also emit assume_aligned metadata when used on pointers.
  This can improve code generation compared to the uintptr_t casts.

[1] In our CHERI compiler we have compilation mode where all pointers are
implemented as capabilities (essentially unforgeable 128-bit fat pointers).
In our original model, casts from uintptr_t (which is a 128-bit capability)
to an integer value returned the "offset" of the capability (i.e. the
difference between the virtual address and the base of the allocation).
This causes problems for cases such as checking the alignment: for example, the
expression `if ((uintptr_t)ptr & 63) == 0` is generally used to check if the
pointer is aligned to a multiple of 64 bytes. The problem with offsets is that
any pointer to the beginning of an allocation will have an offset of zero, so
this check always succeeds in that case (even if the address is not correctly
aligned). The same issues also exist when aligning up or down. Using the
alignment builtins ensures that the address is used instead of the offset. While
I have since changed the default C semantics to return the address instead of
the offset when casting, this offset compilation mode can still be used by
passing a command-line flag.

Reviewers: rsmith, aaron.ballman, theraven, fhahn, lebedev.ri, nlopes, aqjune
Reviewed By: aaron.ballman, lebedev.ri
Differential Revision: https://reviews.llvm.org/D71499
2020-01-09 21:48:29 +00:00
Sven van Haastregt 241f335b26 [OpenCL][Docs] Rename C++ for OpenCL label
To avoid potential confusion with OpenCL C++.
2020-01-09 16:31:45 +00:00
Teresa Johnson 43f938eddc LTOVisibility.rst: fix up syntax in example
Summary: Pretty self-evident. This example was missing an lparen. Added it, and fixed up the ASCII art.

Patch by Nick Black <dankamongmen@gmail.com>

Reviewers: pcc

Reviewed By: pcc

Subscribers: tejohnson, mehdi_amini, inglorion, hiraditya, steven_wu, dexonsmith, cfe-commits

Tags: #llvm, #clang

Differential Revision: https://reviews.llvm.org/D70765
2020-01-08 11:43:11 -08:00
Rihan Yang 2823e91d55 Add a new AST matcher 'optionally'.
This matcher matches any node and at the same time executes all its
inner matchers to produce any possbile result bindings.

This is useful when a user wants certain supplementary information
that's not always present along with the main match result.
2020-01-08 14:10:11 -05:00