Commit Graph

1963 Commits

Author SHA1 Message Date
Henry Wong d97b6101d7 [analyzer] Fix a typo in `RegionStore.txt`.
Summary: The typo of the description for default bindings can be confusing.

Reviewers: NoQ, george.karpenkov

Reviewed By: NoQ, george.karpenkov

Subscribers: xazax.hun, szepet, a.sidorin, mikhail.ramalho, cfe-commits, MTC

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

llvm-svn: 339244
2018-08-08 13:37:28 +00:00
Chandler Carruth 59f1e69d15 [docs] Don't use the `asm` syntax highlighting (which our docs builder
errors on) and clean up the formattting.

This isn't actualy assembly anyways, so dropping the highlighting is
probably for the best.

llvm-svn: 338979
2018-08-06 01:28:42 +00:00
Hans Wennborg 3d0d25ddf4 Update docs version and clear release notes after 8.0.0 version bump
llvm-svn: 338557
2018-08-01 14:01:27 +00:00
Hans Wennborg aade120545 UserManual: Update with the latest clang-cl flags
llvm-svn: 338528
2018-08-01 12:58:57 +00:00
Hans Wennborg a592adbbc4 clang-format: try to make the doc for ConstructorInitializerAllOnOneLineOrOnePerLine more clear
PR38080 complained that the "OnePerLine" case wasn't previously shown.

llvm-svn: 338366
2018-07-31 12:42:02 +00:00
Roman Lebedev 3a5d356bd0 [docs] UndefinedBehaviorSanitizer.rst: {,un}signed-integer-overflow: tune docs
Yes, i erroneously assumed that the "after" was meant,
but i was wrong:
> I really meant "performed before", for cases like 4u / -2,
> where -2 is implicitly converted to UINT_MAX - 2 before
> the computation. Conversions that are performed after
> a computation aren't part of the computation at all,
> so I think it's much clearer that they're not in scope
> for this sanitizer.

llvm-svn: 338306
2018-07-30 21:11:32 +00:00
Roman Lebedev b69ba22773 [clang][ubsan] Implicit Conversion Sanitizer - integer truncation - clang part
Summary:
C and C++ are interesting languages. They are statically typed, but weakly.
The implicit conversions are allowed. This is nice, allows to write code
while balancing between getting drowned in everything being convertible,
and nothing being convertible. As usual, this comes with a price:

```
unsigned char store = 0;

bool consume(unsigned int val);

void test(unsigned long val) {
  if (consume(val)) {
    // the 'val' is `unsigned long`, but `consume()` takes `unsigned int`.
    // If their bit widths are different on this platform, the implicit
    // truncation happens. And if that `unsigned long` had a value bigger
    // than UINT_MAX, then you may or may not have a bug.

    // Similarly, integer addition happens on `int`s, so `store` will
    // be promoted to an `int`, the sum calculated (0+768=768),
    // and the result demoted to `unsigned char`, and stored to `store`.
    // In this case, the `store` will still be 0. Again, not always intended.
    store = store + 768; // before addition, 'store' was promoted to int.
  }

  // But yes, sometimes this is intentional.
  // You can either make the conversion explicit
  (void)consume((unsigned int)val);
  // or mask the value so no bits will be *implicitly* lost.
  (void)consume((~((unsigned int)0)) & val);
}
```

Yes, there is a `-Wconversion`` diagnostic group, but first, it is kinda
noisy, since it warns on everything (unlike sanitizers, warning on an
actual issues), and second, there are cases where it does **not** warn.
So a Sanitizer is needed. I don't have any motivational numbers, but i know
i had this kind of problem 10-20 times, and it was never easy to track down.

The logic to detect whether an truncation has happened is pretty simple
if you think about it - https://godbolt.org/g/NEzXbb - basically, just
extend (using the new, not original!, signedness) the 'truncated' value
back to it's original width, and equality-compare it with the original value.

The most non-trivial thing here is the logic to detect whether this
`ImplicitCastExpr` AST node is **actually** an implicit conversion, //or//
part of an explicit cast. Because the explicit casts are modeled as an outer
`ExplicitCastExpr` with some `ImplicitCastExpr`'s as **direct** children.
https://godbolt.org/g/eE1GkJ

Nowadays, we can just use the new `part_of_explicit_cast` flag, which is set
on all the implicitly-added `ImplicitCastExpr`'s of an `ExplicitCastExpr`.
So if that flag is **not** set, then it is an actual implicit conversion.

As you may have noted, this isn't just named `-fsanitize=implicit-integer-truncation`.
There are potentially some more implicit conversions to be warned about.
Namely, implicit conversions that result in sign change; implicit conversion
between different floating point types, or between fp and an integer,
when again, that conversion is lossy.

One thing i know isn't handled is bitfields.

This is a clang part.
The compiler-rt part is D48959.

Fixes [[ https://bugs.llvm.org/show_bug.cgi?id=21530 | PR21530 ]], [[ https://bugs.llvm.org/show_bug.cgi?id=37552 | PR37552 ]], [[ https://bugs.llvm.org/show_bug.cgi?id=35409 | PR35409 ]].
Partially fixes [[ https://bugs.llvm.org/show_bug.cgi?id=9821 | PR9821 ]].
Fixes https://github.com/google/sanitizers/issues/940. (other than sign-changing implicit conversions)

Reviewers: rjmccall, rsmith, samsonov, pcc, vsk, eugenis, efriedma, kcc, erichkeane

Reviewed By: rsmith, vsk, erichkeane

Subscribers: erichkeane, klimek, #sanitizers, aaron.ballman, RKSimon, dtzWill, filcab, danielaustin, ygribov, dvyukov, milianw, mclow.lists, cfe-commits, regehr

Tags: #sanitizers

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

llvm-svn: 338288
2018-07-30 18:58:30 +00:00
Alexey Bataev cdbe44c95c [OPENMP] Modify the info about OpenMP support in UsersManual, NFC.
llvm-svn: 338252
2018-07-30 14:44:29 +00:00
George Karpenkov 079275b4dc [ASTMatchers] Introduce a matcher for `ObjCIvarExpr`, support getting it's declaration.
ObjCIvarExpr is *not* a subclass of MemberExpr, and a separate matcher
is required to support it.
Adding a hasDeclaration support as well, as it's not very useful without
it.

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

llvm-svn: 338137
2018-07-27 17:26:11 +00:00
Alexey Bataev c5982fb634 [OPENMP, DOCS] Fixed typo, NFC.
llvm-svn: 338055
2018-07-26 18:40:41 +00:00
Alexey Bataev 3bdd60095f [OPENMP] What's new for OpenMP in clang.
Updated ReleaseNotes + Status of the OpenMP support in clang.

llvm-svn: 338049
2018-07-26 17:53:45 +00:00
Jonas Toth acf836763c [ASTMatchers] fix the missing documentation for new decltypeType matcher
Summary: Regenerate the Matchers documentation, forgotten in the original patch.

Reviewers: alexfh, aaron.ballman

Reviewed By: aaron.ballman

Subscribers: cfe-commits

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

llvm-svn: 338022
2018-07-26 13:02:05 +00:00
David Carlier 68a9c7c7b3 Fix tsan doc
llvm-svn: 337927
2018-07-25 14:27:14 +00:00
David Carlier 59a339ab45 [Docs] Update supported oses for safestack, ubsan, asan, tsan and msan
Adding oses others than Linux.

llvm-svn: 337926
2018-07-25 13:55:06 +00:00
Krasimir Georgiev cf699ad9ab [clang-format ]Extend IncludeCategories regex documentation
Summary:
Extend the Clang-Format IncludeCategories documentation by adding a link to the supported regular expression standard (POSIX).
And extenting the example with a system header regex.
[[ https://bugs.llvm.org/show_bug.cgi?id=35041 | bug 35041]]

Contributed by WimLeflere!

Reviewers: krasimir, Typz

Reviewed By: krasimir

Subscribers: cfe-commits

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

llvm-svn: 337899
2018-07-25 10:21:47 +00:00
Erich Keane 634f851766 Remove stale documentation from InternalsManual.rst
The DuplicatesAllowedWhileMerging was removed a while ago,
but the documentation remained.

llvm-svn: 337835
2018-07-24 16:11:30 +00:00
George Karpenkov fc3d72eeea [ASTMatchers] Add an isMain() matcher
Differential Revision: https://reviews.llvm.org/D49615

llvm-svn: 337761
2018-07-23 22:29:35 +00:00
George Karpenkov daac52cabc [ASTMatchers] [NFC] Regenerate HTML docs.
llvm-svn: 337760
2018-07-23 22:29:10 +00:00
Nico Weber f925b33854 fix typo
llvm-svn: 337620
2018-07-20 21:06:41 +00:00
Akira Hatanaka dbfa453e41 [CodeGen][ObjC] Make copying and disposing of a non-escaping block
no-ops.

A non-escaping block on the stack will never be called after its
lifetime ends, so it doesn't have to be copied to the heap. To prevent
a non-escaping block from being copied to the heap, this patch sets
field 'isa' of the block object to NSConcreteGlobalBlock and sets the
BLOCK_IS_GLOBAL bit of field 'flags', which causes the runtime to treat
the block as if it were a global block (calling _Block_copy on the block
just returns the original block and calling _Block_release is a no-op).

Also, a new flag bit 'BLOCK_IS_NOESCAPE' is added, which allows the
runtime or tools to distinguish between true global blocks and
non-escaping blocks.

rdar://problem/39352313

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

llvm-svn: 337580
2018-07-20 17:10:32 +00:00
John McCall ea9c580994 Document -fobjc-weak as an extension.
Fixes rdar://24091053.

llvm-svn: 337525
2018-07-20 05:40:12 +00:00
John McCall 07fa4a49c4 Fix and improve the ARC spec's wording about unmanaged objects.
llvm-svn: 337524
2018-07-20 05:40:09 +00:00
Fangrui Song df81b97927 [docs] Correct -fvisibility-inlines-hidden description
llvm-svn: 337505
2018-07-19 22:45:41 +00:00
Manoj Gupta da08f6ac16 [clang]: Add support for "-fno-delete-null-pointer-checks"
Summary:
Support for this option is needed for building Linux kernel.
This is a very frequently requested feature by kernel developers.

More details : https://lkml.org/lkml/2018/4/4/601

GCC option description for -fdelete-null-pointer-checks:
This Assume that programs cannot safely dereference null pointers,
and that no code or data element resides at address zero.

-fno-delete-null-pointer-checks is the inverse of this implying that
null pointer dereferencing is not undefined.

This feature is implemented in as the function attribute
"null-pointer-is-valid"="true".
This CL only adds the attribute on the function.
It also strips "nonnull" attributes from function arguments but
keeps the related warnings unchanged.

Corresponding LLVM change rL336613 already updated the
optimizations to not treat null pointer dereferencing
as undefined if the attribute is present.

Reviewers: t.p.northover, efriedma, jyknight, chandlerc, rnk, srhines, void, george.burgess.iv

Reviewed By: jyknight

Subscribers: drinkcat, xbolva00, cfe-commits

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

llvm-svn: 337433
2018-07-19 00:44:52 +00:00
Nico Weber 1dbff9a406 Mention clang-cl improvements from r335466 and r336379 in ReleaseNotes.rst
llvm-svn: 337381
2018-07-18 11:55:03 +00:00
Peter Collingbourne 14b468bab6 Re-land r337333, "Teach Clang to emit address-significance tables.",
which was reverted in r337336.

The problem that required a revert was fixed in r337338.

Also added a missing "REQUIRES: x86-registered-target" to one of
the tests.

Original commit message:
> Teach Clang to emit address-significance tables.
>
> By default, we emit an address-significance table on all ELF
> targets when the integrated assembler is enabled. The emission of an
> address-significance table can be controlled with the -faddrsig and
> -fno-addrsig flags.
>
> Differential Revision: https://reviews.llvm.org/D48155

llvm-svn: 337339
2018-07-18 00:27:07 +00:00
Peter Collingbourne 35c6996b68 Revert r337333, "Teach Clang to emit address-significance tables."
Causing multiple failures on sanitizer bots due to TLS symbol errors,
e.g.

/usr/bin/ld: __msan_origin_tls: TLS definition in /home/buildbots/ppc64be-clang-test/clang-ppc64be/stage1/lib/clang/7.0.0/lib/linux/libclang_rt.msan-powerpc64.a(msan.cc.o) section .tbss.__msan_origin_tls mismatches non-TLS reference in /tmp/lit_tmp_0a71tA/mallinfo-3ca75e.o

llvm-svn: 337336
2018-07-17 23:56:30 +00:00
Peter Collingbourne 27242c0402 Teach Clang to emit address-significance tables.
By default, we emit an address-significance table on all ELF
targets when the integrated assembler is enabled. The emission of an
address-significance table can be controlled with the -faddrsig and
-fno-addrsig flags.

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

llvm-svn: 337333
2018-07-17 23:17:16 +00:00
George Karpenkov b5ea4df0eb [ASTMatchers] Introduce Objective-C matchers `hasReceiver` and `isInstanceMessage` for ObjCMessageExpr
Differential Revision: https://reviews.llvm.org/D49333

llvm-svn: 337209
2018-07-16 20:22:12 +00:00
Vlad Tsyrklevich be9a9fd3dd SafeStack: Add builtins to read unsafe stack top/bottom
Summary:
Introduce built-ins to read the unsafe stack top and bottom. The unsafe
stack top is required to implement garbage collection scanning for
Oilpan. Currently there is already a built-in 'get_unsafe_stack_start'
to read the bottom of the unsafe stack, but I chose to duplicate this
API because 'start' is ambiguous (e.g. Oilpan uses WTF::GetStackStart to
read the safe stack top.)

Reviewers: pcc

Reviewed By: pcc

Subscribers: llvm-commits, kcc

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

llvm-svn: 337037
2018-07-13 19:48:35 +00:00
Erich Keane e891aa971a [NFC] Rename clang::AttributeList to clang::ParsedAttr
Since The type no longer contains the 'next' item anymore, it isn't a list,
so rename it to ParsedAttr to be more accurate.

llvm-svn: 337005
2018-07-13 15:07:47 +00:00
Richard Smith 869038e362 [docs] List correct default for -ftemplate-depth; also add missing
documentation for -fconstexpr-steps.

llvm-svn: 336747
2018-07-11 00:34:54 +00:00
George Karpenkov ba02bc5226 [ASTMatchers] A matcher for Objective-C @autoreleasepool
Differential Revision: https://reviews.llvm.org/D48910

llvm-svn: 336468
2018-07-06 21:36:04 +00:00
Aaron Ballman 0050466976 The :option: syntax was generating Sphinx build warnings; switched to double backticks to silence the warning; NFC.
llvm-svn: 335843
2018-06-28 12:05:40 +00:00
Aaron Ballman 37485fdc45 Correct the code highlighting marker to be Objective-C rather than C++ which fixes a Sphinx build warning; NFC.
llvm-svn: 335842
2018-06-28 12:02:38 +00:00
Matt Morehouse 520748f01e [UBSan] Add silence_unsigned_overflow flag.
Summary:
Setting UBSAN_OPTIONS=silence_unsigned_overflow=1 will silence all UIO
reports.  This feature, combined with
-fsanitize-recover=unsigned-integer-overflow, is useful for providing
fuzzing signal without the excessive log output.

Helps with https://github.com/google/oss-fuzz/issues/910.

Reviewers: kcc, vsk

Reviewed By: vsk

Subscribers: vsk, kubamracek, Dor1s, llvm-commits

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

llvm-svn: 335762
2018-06-27 18:24:46 +00:00
Peter Collingbourne e44acadf6a Implement CFI for indirect calls via a member function pointer.
Similarly to CFI on virtual and indirect calls, this implementation
tries to use program type information to make the checks as precise
as possible.  The basic way that it works is as follows, where `C`
is the name of the class being defined or the target of a call and
the function type is assumed to be `void()`.

For virtual calls:
- Attach type metadata to the addresses of function pointers in vtables
  (not the functions themselves) of type `void (B::*)()` for each `B`
  that is a recursive dynamic base class of `C`, including `C` itself.
  This type metadata has an annotation that the type is for virtual
  calls (to distinguish it from the non-virtual case).
- At the call site, check that the computed address of the function
  pointer in the vtable has type `void (C::*)()`.

For non-virtual calls:
- Attach type metadata to each non-virtual member function whose address
  can be taken with a member function pointer. The type of a function
  in class `C` of type `void()` is each of the types `void (B::*)()`
  where `B` is a most-base class of `C`. A most-base class of `C`
  is defined as a recursive base class of `C`, including `C` itself,
  that does not have any bases.
- At the call site, check that the function pointer has one of the types
  `void (B::*)()` where `B` is a most-base class of `C`.

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

llvm-svn: 335569
2018-06-26 02:15:47 +00:00
Evgeniy Stepanov 2b61d12f1e ASan docs: no_sanitize("address") works on globals.
Summary: Mention that no_sanitize attribute can be used with globals.

Reviewers: alekseyshl

Subscribers: cfe-commits

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

llvm-svn: 335193
2018-06-21 00:16:32 +00:00
Fangrui Song 4c35d598e0 [docs] -fsanitize=cfi only allowed with -fvisibility=
llvm-svn: 334870
2018-06-15 23:11:18 +00:00
Francois Ferrand 767e152165 clang-format: Fix documentation generation
Summary:
It seems that the changes done to `ClangFormatStyleOptions.rst` @334408 are causing the generation of the documentation to fail, with the following error:

  Warning, treated as error:
    /llvm/tools/clang/docs/ClangFormatStyleOptions.rst:1060: WARNING: Definition list ends without a blank line; unexpected unindent.

This is due to missing indent in some code block, and fixed by this patch.

Reviewers: krasimir, djasper, klimek

Reviewed By: krasimir

Subscribers: cfe-commits

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

llvm-svn: 334709
2018-06-14 13:32:14 +00:00
Hans Wennborg bfc3406530 [clang-format] Add SpaceBeforeCpp11BracedList option.
WebKit C++ style for object initialization is as follows:

  Foo foo { bar };

Yet using clang-format -style=webkit changes this to:

  Foo foo{ bar };

As there is no existing combination of rules that will ensure a space
before a braced list in this fashion, this patch adds a new
SpaceBeforeCpp11BracedList rule.

Patch by Ross Kirsling!

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

llvm-svn: 334692
2018-06-14 08:01:09 +00:00
Peter Collingbourne b8b248cf2e docs: Add a missing LTO visibility reference.
llvm-svn: 334671
2018-06-13 23:21:02 +00:00
Peter Collingbourne 282ad770ce docs: Correct some misstatements in the control flow integrity docs.
These were true at one point but haven't been true for a long time.

llvm-svn: 334669
2018-06-13 23:18:26 +00:00
Piotr Padlewski e368de364e Add -fforce-emit-vtables
Summary:
 In many cases we can't devirtualize
 because definition of vtable is not present. Most of the
 time it is caused by inline virtual function not beeing
 emitted. Forcing emitting of vtable adds a reference of these
 inline virtual functions.
 Note that GCC was always doing it.

Reviewers: rjmccall, rsmith, amharc, kuhar

Subscribers: llvm-commits, cfe-commits

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

Co-authored-by: Krzysztof Pszeniczny <krzysztof.pszeniczny@gmail.com>
llvm-svn: 334600
2018-06-13 13:55:42 +00:00
Petr Hosek 7250908016 [AArch64] Support reserving x20 register
Register x20 is a callee-saved register which may be used for other
purposes in certain contexts, for example to hold special variables
within the kernel. This change adds support for reserving this register
both to frontend and backend to make this register usable for these
purposes.

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

llvm-svn: 334531
2018-06-12 20:00:50 +00:00
Francois Ferrand 6bb103f9fa clang-format: Introduce BreakInheritanceList option
Summary:
This option replaces the BreakBeforeInheritanceComma option with an
enum, thus introducing a mode where the colon stays on the same line as
constructor declaration:

  // When it fits on line:
  class A : public B, public C {
    ...
  };

  // When it does not fit:
  class A :
      public B,
      public C {
    ...
  };

This matches the behavior of the `BreakConstructorInitializers` option,
introduced in https://reviews.llvm.org/D32479.

Reviewers: djasper, klimek

Reviewed By: djasper

Subscribers: mzeren-vmw, cfe-commits

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

llvm-svn: 334408
2018-06-11 14:41:26 +00:00
Eric Fiselier b87be18d8e [Clang Tablegen][RFC] Allow Early Textual Substitutions in `Diagnostic` messages.
Summary:
There are cases where the same string or select is repeated verbatim in a lot of diagnostics. This can be a pain to maintain and update. Tablegen provides no way stash the common text somewhere and reuse it in the diagnostics, until now!

This patch allows diagnostic texts to contain `%sub{<definition-name>}`, where `<definition-name>` names a Tablegen record of type `TextSubstitution`. These substitutions are done early, before the diagnostic string is otherwise processed. All `%sub` modifiers will be replaced before the diagnostic definitions are emitted.

The substitution must specify all arguments used by the substitution, and modifier indexes in the substitution are re-numbered accordingly. For example:

```
def select_ovl_candidate : TextSubstitution<"%select{function|constructor}0%select{| template| %2}1">;
```
when used as
```
"candidate `%sub{select_ovl_candidate}3,2,1 not viable"
```
will act as if we wrote:
```
"candidate %select{function|constructor}3%select{| template| %1}2 not viable"
```

Reviewers: rsmith, rjmccall, aaron.ballman, a.sidorin

Reviewed By: rjmccall

Subscribers: cfe-commits

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

llvm-svn: 332799
2018-05-19 03:12:04 +00:00
Alexander Ivchenko 0fb8c877c4 This patch aims to match the changes introduced
in gcc by https://gcc.gnu.org/ml/gcc-cvs/2018-04/msg00534.html.
The -mibt feature flag is being removed, and the -fcf-protection
option now also defines a CET macro and causes errors when used
on non-X86 targets, while X86 targets no longer check for -mibt
and -mshstk to determine if -fcf-protection is supported. -mshstk
is now used only to determine availability of shadow stack intrinsics.

Comes with an LLVM patch (D46882).

Patch by mike.dvoretsky

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

llvm-svn: 332704
2018-05-18 11:56:21 +00:00
George Karpenkov b4c0cbda1e [ASTMatchers] Introduce a blockDecl matcher for matching block declarations
Blocks can be matched just as well as functions or Objective-C methods.

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

llvm-svn: 332545
2018-05-16 22:47:03 +00:00
Jonas Devlieghere b48447a1d6 [diagtool] Add diagtool to install target.
Although not very well known, diagtool is an incredibly convenient
utility for dealing with diagnostics.
Particularly useful are the "tree" and "show-enabled" commands:

 - The former prints the hierarchy of diagnostic (warning) flags and
   which of them are enabled by default.
 - The latter can be used to replace an invocation to clang and will
   print which diagnostics are disabled, warnings or errors.
   For instance: `diagtool show-enabled -Wall -Werror /tmp/test.c` will
   print that -Wunused-variable (warn_unused_variable) will be treated as
   an error.

This patch adds them to the install target so it gets shipped with the
LLVM release. It also adds a very basic man page and mentions this
change in the release notes.

Differential revision: https://reviews.llvm.org/D46694

llvm-svn: 332448
2018-05-16 10:23:25 +00:00
Francois Ferrand 58e6fe5b54 clang-format: Allow optimizer to break template declaration.
Summary:
Introduce `PenaltyBreakTemplateDeclaration` to control the penalty,
and change `AlwaysBreakTemplateDeclarations` to an enum with 3 modes:
* `No` for regular, penalty based, wrapping of template declaration
* `MultiLine` for always wrapping before multi-line declarations (e.g.
  same as legacy behavior when `AlwaysBreakTemplateDeclarations=false`)
* `Yes` for always wrapping (e.g. same as legacy behavior when
  `AlwaysBreakTemplateDeclarations=true`)

Reviewers: krasimir, djasper, klimek

Subscribers: cfe-commits

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

llvm-svn: 332436
2018-05-16 08:25:03 +00:00
Eugene Zelenko ad5684aae0 [Documentation] Fix Release Notes format issues.
llvm-svn: 332405
2018-05-15 21:45:01 +00:00
Elena Demikhovsky d31327d505 Added atomic_fetch_min, max, umin, umax intrinsics to clang.
These intrinsics work exactly as all other atomic_fetch_* intrinsics and allow to create *atomicrmw* with ordering.
Updated the clang-extensions document.

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

llvm-svn: 332193
2018-05-13 07:45:58 +00:00
Adrian Prantl 9fc8faf9e6 Remove \brief commands from doxygen comments.
This is similar to the LLVM change https://reviews.llvm.org/D46290.

We've been running doxygen with the autobrief option for a couple of
years now. This makes the \brief markers into our comments
redundant. Since they are a visual distraction and we don't want to
encourage more \brief markers in new code either, this patch removes
them all.

Patch produced by

for i in $(git grep -l '\@brief'); do perl -pi -e 's/\@brief //g' $i & done
for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done

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

llvm-svn: 331834
2018-05-09 01:00:01 +00:00
Stephane Sezer 9601bf5b6a Add missing newlines to cl::extrahelp uses
llvm-svn: 331802
2018-05-08 19:46:29 +00:00
Gabor Horvath 3cd0aa3b7e [ASTMatchers] Overload isConstexpr for ifStmts
Differential Revision: https://reviews.llvm.org/D46233

llvm-svn: 331759
2018-05-08 11:53:32 +00:00
Krasimir Georgiev f2ca41dbba [clang-format] Add raw string formatting to release notes
Reviewers: hans

Reviewed By: hans

Subscribers: cfe-commits

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

llvm-svn: 331750
2018-05-08 09:25:12 +00:00
Joel Galenson 267ea72437 [docs] Fix typos in the Clang User's Manual.
llvm-svn: 331644
2018-05-07 16:23:46 +00:00
Richard Smith b5a317fbf6 Non-zero-length bit-fields make a class non-empty.
This implements the rule intended by the standard (see LWG 2358)
and the rule intended by the Itanium C++ ABI (see
https://github.com/itanium-cxx-abi/cxx-abi/pull/51), and makes
Clang match the behavior of GCC, ICC, and MSVC.

A pedantic reading of both the standard and the ABI indicate that Clang
is currently technically correct, but that's not worth much when it's
clear that the wording is wrong in both those places.

This is an ABI break for classes that derive from a class that is empty
other than one or more unnamed non-zero-length bit-fields. Such cases
are expected to be rare, but -fclang-abi-compat=6 restores the old
behavior just in case.

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

llvm-svn: 331620
2018-05-07 06:43:30 +00:00
Gabor Buella a51e0c2243 [X86] directstore and movdir64b intrinsics
Reviewers: spatel, craig.topper, RKSimon

Reviewed By: craig.topper

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

llvm-svn: 331249
2018-05-01 10:05:42 +00:00
Kostya Serebryany d5dc819a5c [ShadowCallStack] fix the docs
llvm-svn: 331238
2018-05-01 00:15:56 +00:00
Fangrui Song 5dfb61a1b6 [docs] Fix docs/InternalsManual.rst heading.
llvm-svn: 331225
2018-04-30 20:51:50 +00:00
Sanjay Patel c81450e29b [Driver, CodeGen] rename options to disable an FP cast optimization
As suggested in the post-commit thread for rL331056, we should match these 
clang options with the established vocabulary of the corresponding sanitizer
option. Also, the use of 'strict' is well-known for these kinds of knobs, 
and we can improve the descriptive text in the docs.

So this intends to match the logic of D46135 but only change the words.
Matching LLVM commit to match this spelling of the attribute to follow shortly.

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

llvm-svn: 331209
2018-04-30 18:19:03 +00:00
Alexander Kornienko 395ab2e212 Regenerated AST Matchers doc.
Backported a minor fix to the comment in the header.

llvm-svn: 331207
2018-04-30 18:12:15 +00:00
Fangrui Song 0f587e5387 Rename DiagnosticClient to DiagnosticConsumer as per issue 5397.
llvm-svn: 331152
2018-04-30 00:34:09 +00:00
Richard Smith 4ae767ba3d PR37275 packed attribute should not apply to base classes
Clang incorrectly applied the packed attribute to base classes. Per GCC's
documentation and as can be observed from its behavior, packed only applies to
members, not base classes.

This change is conditioned behind -fclang-abi-compat so that an ABI break can
be avoided by users if desired.

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

llvm-svn: 331136
2018-04-29 04:55:46 +00:00
Sanjay Patel c1ecbf261f [docs] more dashes
llvm-svn: 331057
2018-04-27 16:24:39 +00:00
Sanjay Patel cee47befe4 [docs] add -ffp-cast-overflow-workaround to the release notes
This option was added with:
D46135
rL331041
...copying the text from UsersManual.rst for more exposure.

llvm-svn: 331056
2018-04-27 16:21:22 +00:00
Sanjay Patel d175476566 [Driver, CodeGen] add options to enable/disable an FP cast optimization
As discussed in the post-commit thread for:
rL330437 ( http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20180423/545906.html )

We need a way to opt-out of a float-to-int-to-float cast optimization because too much 
existing code relies on the platform-specific undefined result of those casts when the 
float-to-int overflows.

The LLVM changes associated with adding this function attribute are here:
rL330947
rL330950
rL330951

Also as suggested, I changed the LLVM doc to mention the specific sanitizer flag that 
catches this problem:
rL330958

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

llvm-svn: 331041
2018-04-27 14:22:48 +00:00
Alex Shlyapnikov e55bbac546 [HWASan] Update HWASan assembly snippet in the docs
Summary: To complement https://reviews.llvm.org/D45840

Reviewers: eugenis

Subscribers: cfe-commits

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

llvm-svn: 330745
2018-04-24 17:41:48 +00:00
Craig Topper 42da9cb091 [Docs] Regenerate command line documentation.
llvm-svn: 330654
2018-04-23 21:41:06 +00:00
Roman Lebedev 6ed0fad999 [Sema] Add -Wno-self-assign-overloaded
Summary:
It seems there isn't much enthusiasm for `-wtest` D45685.

This is more conservative version, which i had in the very first
revision of D44883, but that 'erroneously' got removed because of the review.

**Based on some [irc] discussions, it must really be documented that
we want all the new diagnostics to have their own flags, to ease
rollouts, transitions, etc.**

Please do note that i'm only adding `-Wno-self-assign-overloaded`,
but not `-Wno-self-assign-field-overloaded`, because i'm honestly
not aware of any false-positives from the `-field` variant,
but i can just as easily add it if wanted.
https://reviews.llvm.org/D44883#1068561

Reviewers: dblaikie, aaron.ballman, thakis, rjmccall, rsmith

Reviewed By: dblaikie

Subscribers: Quuxplusone, chandlerc, cfe-commits

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

llvm-svn: 330651
2018-04-23 21:35:21 +00:00
Jonas Hahnfeld 06039e8fc1 [docs] Regenerate command line reference
This will correctly sort some manually added entries which should
generally be avoided!

llvm-svn: 330430
2018-04-20 13:26:03 +00:00
Jonas Hahnfeld 8da9c2a2f7 [CUDA] Document recent changes
* Finding installations via ptxas binary
 * Relocatable device code

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

llvm-svn: 330426
2018-04-20 13:04:54 +00:00
Duncan P. N. Exon Smith c4f5f605fd Fix malformed table introduced by r330174
http://lab.llvm.org:8011/builders/clang-sphinx-docs/builds/23573

llvm-svn: 330177
2018-04-17 05:48:36 +00:00
Duncan P. N. Exon Smith 2bdf2565a0 Remove GC-related warning terminology
ObjC-GC isn't used any more; clean up this warning text.

rdar://problem/39049693

llvm-svn: 330174
2018-04-17 04:25:18 +00:00
Vlad Tsyrklevich 8b74db9cc7 Fix doc typo
llvm-svn: 329942
2018-04-12 19:35:39 +00:00
Gabor Buella a052016ef2 [x86] wbnoinvd intrinsic
The WBNOINVD instruction writes back all modified
cache lines in the processor’s internal cache to main memory
but does not invalidate (flush) the internal caches.

Reviewers: craig.topper, zvi, ashlykov

Reviewed By: craig.topper

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

llvm-svn: 329848
2018-04-11 20:09:09 +00:00
Dimitry Andric f6c76532c8 Document -std= values for different languages
Summary:
After a remark on a FreeBSD mailing list that the clang man page did
not have any list of possible values for the `-std=` flag, I have now
attempted to exhaustively list those, for each available language.

I also documented the default standard for each language, if there was
more than one choice.

Reviewers: rsmith, dexonsmith, sylvestre.ledru, mgorny

Reviewed By: rsmith

Subscribers: fhahn, emaste, cfe-commits, krytarowski

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

llvm-svn: 329827
2018-04-11 17:21:52 +00:00
Artem Belevich dde3dc27ee [CUDA] Added --[no-]cuda-include-ptx=sm_XX|all option.
Currently we always include PTX into the fatbin along
with the GPU code.It about doubles the size of the GPU binary
we need to carry in the executable. These options allow control
inclusion of PTX into GPU binary.

This patch does not change the defaults, though we may consider
making no-PTX the default in the future.

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

llvm-svn: 329737
2018-04-10 18:38:22 +00:00
Roman Lebedev 61061d69ea [Sema] Extend -Wself-assign and -Wself-assign-field to warn on overloaded self-assignment (classes)
Summary:
This has just bit me, so i though it would be nice to avoid that next time :)
Motivational case:
  https://godbolt.org/g/cq9UNk
Basically, it's likely to happen if you don't like shadowing issues,
and use `-Wshadow` and friends. And it won't be diagnosed by clang.

The reason is, these self-assign diagnostics only work for builtin assignment
operators. Which makes sense, one could have a very special operator=,
that does something unusual in case of self-assignment,
so it may make sense to not warn on that.

But while it may be intentional in some cases, it may be a bug in other cases,
so it would be really great to have some diagnostic about it...

Reviewers: aaron.ballman, rsmith, rtrieu, nikola, rjmccall, dblaikie

Reviewed By: rjmccall

Subscribers: EricWF, lebedev.ri, thakis, Quuxplusone, cfe-commits

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

llvm-svn: 329493
2018-04-07 10:39:21 +00:00
Alexander Kornienko 2a8c18d991 Fix typos in clang
Found via codespell -q 3 -I ../clang-whitelist.txt
Where whitelist consists of:

  archtype
  cas
  classs
  checkk
  compres
  definit
  frome
  iff
  inteval
  ith
  lod
  methode
  nd
  optin
  ot
  pres
  statics
  te
  thru

Patch by luzpaz! (This is a subset of D44188 that applies cleanly with a few
files that have dubious fixes reverted.)

Differential revision: https://reviews.llvm.org/D44188

llvm-svn: 329399
2018-04-06 15:14:32 +00:00
Alexander Kornienko d10d790044 Allow the creation of human-friendly ASTDumper to arbitrary output stream
Summary:
`ASTPrinter` allows setting the ouput to any O-Stream, but that printer creates source-code-like syntax (and is also marked with a `FIXME`). The nice, colourful, mostly human-readable `ASTDumper` only works on the standard output, which is not feasible in case a user wants to see the AST of a file through a code navigation/comprehension tool.

This small addition of an overload solves generating a nice colourful AST block for the users of a tool I'm working on, [[ http://github.com/Ericsson/CodeCompass | CodeCompass ]], as opposed to having to duplicate the behaviour of definitions that only exist in the anonymous namespace of implementation TUs related to this module.

Reviewers: alexfh, klimek, rsmith

Reviewed By: alexfh

Subscribers: rnkovacs, dkrupp, gsd, xazax.hun, cfe-commits, #clang

Tags: #clang

Patch by Whisperity!

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

llvm-svn: 329391
2018-04-06 13:01:12 +00:00
Richard Smith b6070db0d0 DR1672, DR1813, DR1881, DR2120: Implement recent fixes to "standard
layout" rules.

The new rules say that a standard-layout struct has its first non-static
data member and all base classes at offset 0, and consider a class to
not be standard-layout if that would result in multiple subobjects of a
single type having the same address.

We track "is C++11 standard-layout class" separately from "is
standard-layout class" so that the ABIs that need this information can
still use it.

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

llvm-svn: 329332
2018-04-05 18:55:37 +00:00
Peter Collingbourne f11eb3ebe7 AArch64: Implement support for the shadowcallstack attribute.
The implementation of shadow call stack on aarch64 is quite different to
the implementation on x86_64. Instead of reserving a segment register for
the shadow call stack, we reserve the platform register, x18. Any function
that spills lr to sp also spills it to the shadow call stack, a pointer to
which is stored in x18.

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

llvm-svn: 329236
2018-04-04 21:55:44 +00:00
Sylvestre Ledru e0b4638c6b As we don't use minor version anymore, let's remove it from the release notes too
llvm-svn: 329161
2018-04-04 09:38:22 +00:00
Vlad Tsyrklevich e55aa03ad4 Add the -fsanitize=shadow-call-stack flag
Summary:
Add support for the -fsanitize=shadow-call-stack flag which causes clang
to add ShadowCallStack attribute to functions compiled with that flag
enabled.

Reviewers: pcc, kcc

Reviewed By: pcc, kcc

Subscribers: cryptoad, cfe-commits, kcc

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

llvm-svn: 329122
2018-04-03 22:33:53 +00:00
Richard Smith bb0ad1e882 Use Clang when referring to the project and clang when referring to the binary.
llvm-svn: 329098
2018-04-03 18:28:13 +00:00
Krzysztof Parzyszek 3163610010 [Hexagon] Remove -mhvx-double and the corresponding subtarget feature
Specifying the HVX vector length should be done via the -mhvx-length
option.

llvm-svn: 329077
2018-04-03 15:59:10 +00:00
Hans Wennborg 729eb0b2f8 UsersManual.rst: update text for /GX- to match r328708
llvm-svn: 329052
2018-04-03 09:28:21 +00:00
Sylvestre Ledru a8b717fda4 Rename clang link from clang-X.Y to clang-X
Summary:
As we are only doing X.0.Z releases (not using the minor version), there is no need to keep -X.Y in the version.
So, instead, I propose the following:
Instead of having clang-7.0 in bin/, we will have clang-7

Since also matches was gcc is doing.

Reviewers: tstellar, dlj, dim, hans

Reviewed By: dim, hans

Subscribers: dim, mgorny, cfe-commits

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

llvm-svn: 328769
2018-03-29 10:05:46 +00:00
George Karpenkov 88a16a0790 [ASTMatchers] Introduce a matcher for matching any given Objective-C selector
Incudes a tiny related refactoring.

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

llvm-svn: 328747
2018-03-29 00:51:12 +00:00
George Karpenkov 9d1d0c4c57 [ASTMatchers] Extend hasParameter and hasAnyParameter matches to handle Objective-C methods
Differential Revision: https://reviews.llvm.org/D44707

llvm-svn: 328746
2018-03-29 00:51:11 +00:00
Peter Szecsi fff11dbc48 [ASTMatchers] Add isAssignmentOperator matcher
Adding a matcher for BinaryOperator and cxxOperatorCallExpr to be able to
decide whether it is any kind of assignment operator or not. This would be
useful since allows us to easily detect assignments via matchers for static
analysis (Tidy, SA) purposes.

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

llvm-svn: 328618
2018-03-27 12:11:46 +00:00
Tony Tye 1a3f3a2d14 [AMDGPU] Remove use of OpenCL triple environment and replace with function attribute for AMDGPU (CLANG)
- Remove use of the opencl and amdopencl environment member of the target triple for the AMDGPU target.
- Use a function attribute to communicate to the AMDGPU backend.

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

llvm-svn: 328347
2018-03-23 18:43:15 +00:00
Clement Courbet 369e97511d [ASTMatchers] Remove extra qualifier for consistency (LibASTMatchersReference.html)
+ Regenerate doc.

llvm-svn: 328087
2018-03-21 10:54:29 +00:00
Clement Courbet 2513aa0523 [ASTMatchers] Regenerate doc.
llvm-svn: 328086
2018-03-21 10:48:00 +00:00
Roman Lebedev c9977f3877 [docs] ReleaseNotes: document -Wextra-semi changes.
I should have done it in rL327558 / D43162, but forgot..

I'm not 100% sure about the text, but i don't think
it warrants a whole new differential revision.

llvm-svn: 327725
2018-03-16 18:01:07 +00:00
Kostya Serebryany 79fa418d59 [hwasan] update docs
llvm-svn: 327471
2018-03-14 01:55:49 +00:00
Aaron Ballman 567d9a3948 Update the supported C language standards in the user manual.
Remove mention of -std=c94 (it is spelled iso9899:1994, not c94) and add mention of -std=c17 and -std=gnu17.

llvm-svn: 327264
2018-03-12 13:09:13 +00:00