]> granicus.if.org Git - clang/log
clang
6 years agoRewrite the VS integration scripts.
Zachary Turner [Fri, 20 Jul 2018 16:30:02 +0000 (16:30 +0000)]
Rewrite the VS integration scripts.

This is a new modernized VS integration installer.  It adds a
Visual Studio .sln file which, when built, outputs a VSIX that can
be used to install ourselves as a "real" Visual Studio Extension.
We can even upload this extension to the visual studio marketplace.

This fixes a longstanding problem where we didn't support installing
into VS 2017 and higher.  In addition to supporting VS 2017, due
to the way this is written we now longer need to do anything special
to support future versions of VS as well.  Everything should
"just work".  This also fixes several bugs with our old integration,
such as MSBuild triggering full rebuilds when /Zi was used.

Finally, we add a new UI page called "LLVM" which becomes visible
when the LLVM toolchain is selected.  For now this only contains
one option which is the path to clang-cl.exe, but in the future
we can add more things here.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337572 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[analyzer] Rename DanglingInternalBufferChecker to InnerPointerChecker.
Reka Kovacs [Fri, 20 Jul 2018 15:14:49 +0000 (15:14 +0000)]
[analyzer] Rename DanglingInternalBufferChecker to InnerPointerChecker.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337559 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[www] Add CodeCompass and CodeChecker to Clang Related Projects page
Bruno Cardoso Lopes [Fri, 20 Jul 2018 14:46:10 +0000 (14:46 +0000)]
[www] Add CodeCompass and CodeChecker to Clang Related Projects page

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337555 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoImplement cpu_dispatch/cpu_specific Multiversioning
Erich Keane [Fri, 20 Jul 2018 14:13:28 +0000 (14:13 +0000)]
Implement cpu_dispatch/cpu_specific Multiversioning

As documented here: https://software.intel.com/en-us/node/682969 and
https://software.intel.com/en-us/node/523346. cpu_dispatch multiversioning
is an ICC feature that provides for function multiversioning.

This feature is implemented with two attributes: First, cpu_specific,
which specifies the individual function versions. Second, cpu_dispatch,
which specifies the location of the resolver function and the list of
resolvable functions.

This is valuable since it provides a mechanism where the resolver's TU
can be specified in one location, and the individual implementions
each in their own translation units.

The goal of this patch is to be source-compatible with ICC, so this
implementation diverges from the ICC implementation in a few ways:
1- Linux x86/64 only: This implementation uses ifuncs in order to
properly dispatch functions. This is is a valuable performance benefit
over the ICC implementation. A future patch will be provided to enable
this feature on Windows, but it will obviously more closely fit ICC's
implementation.
2- CPU Identification functions: ICC uses a set of custom functions to identify
the feature list of the host processor. This patch uses the cpu_supports
functionality in order to better align with 'target' multiversioning.
1- cpu_dispatch function def/decl: ICC's cpu_dispatch requires that the function
marked cpu_dispatch be an empty definition. This patch supports that as well,
however declarations are also permitted, since the linker will solve the
issue of multiple emissions.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337552 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoSema: Fix explicit address space cast in C++
Yaxun Liu [Fri, 20 Jul 2018 11:32:51 +0000 (11:32 +0000)]
Sema: Fix explicit address space cast in C++

Currently clang does not allow implicit cast of a pointer to a pointer type
in different address space but allows C-style cast of a pointer to a pointer
type in different address space. However, there is a bug in Sema causing
incorrect Cast Expr in AST for the latter case, which in turn results in
invalid LLVM IR in codegen.

This is because Sema::IsQualificationConversion returns true for a cast of
pointer to a pointer type in different address space, which in turn allows
a standard conversion and results in a cast expression with no op in AST.

This patch fixes that by let Sema::IsQualificationConversion returns false
for a cast of pointer to a pointer type in different address space, which
in turn disallows standard conversion, implicit cast, and static cast.
Finally it results in an reinterpret cast and correct conversion kind is set.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337540 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoChange \t to spaces
Fangrui Song [Fri, 20 Jul 2018 08:19:20 +0000 (08:19 +0000)]
Change \t to spaces

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337530 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Index] Set OrigD before D is changed.
Eric Liu [Fri, 20 Jul 2018 08:08:56 +0000 (08:08 +0000)]
[Index] Set OrigD before D is changed.

Reviewers: akyrtzi, arphaman

Reviewed By: akyrtzi

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337529 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoDocument -fobjc-weak as an extension.
John McCall [Fri, 20 Jul 2018 05:40:12 +0000 (05:40 +0000)]
Document -fobjc-weak as an extension.

Fixes rdar://24091053.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337525 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoFix and improve the ARC spec's wording about unmanaged objects.
John McCall [Fri, 20 Jul 2018 05:40:09 +0000 (05:40 +0000)]
Fix and improve the ARC spec's wording about unmanaged objects.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337524 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoFix typo causing assert in self-host.
Richard Smith [Thu, 19 Jul 2018 23:24:41 +0000 (23:24 +0000)]
Fix typo causing assert in self-host.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337508 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[docs] Correct -fvisibility-inlines-hidden description
Fangrui Song [Thu, 19 Jul 2018 22:45:41 +0000 (22:45 +0000)]
[docs] Correct -fvisibility-inlines-hidden description

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337505 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[CStringSyntaxChecker] Check strlcpy sizeof syntax
David Carlier [Thu, 19 Jul 2018 21:50:03 +0000 (21:50 +0000)]
[CStringSyntaxChecker] Check strlcpy sizeof syntax

The last argument is expected to be the destination buffer size (or less).

    Detects if it points to destination buffer size directly or via a variable.
    Detects if it is an integral, try to detect if the destination buffer can receive the source length.

Updating bsd-string.c unit tests as it make it fails now.

Reviewers: george.karpenpov, NoQ

Reviewed By: george.karpenkov

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337499 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoWhen we choose to use zeroinitializer for a trailing portion of an array
Richard Smith [Thu, 19 Jul 2018 21:38:56 +0000 (21:38 +0000)]
When we choose to use zeroinitializer for a trailing portion of an array
constant, don't convert the rest into a packed struct.

If an array constant has a large non-zero portion and a large zero
portion, we want to emit the first part as an array and the rest as a
zeroinitializer if possible. This fixes a memory usage regression from
r333141 when compiling PHP.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337498 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Sema] Diagnose an invalid dependent function template specialization
Erik Pilkington [Thu, 19 Jul 2018 20:40:20 +0000 (20:40 +0000)]
[Sema] Diagnose an invalid dependent function template specialization

Previously, clang marked the specialization as invalid without emitting a
diagnostic. This lead to an assert in CodeGen.

rdar://41806724

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337497 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoFix failing testcase to actually be valid.
Richard Smith [Thu, 19 Jul 2018 19:05:13 +0000 (19:05 +0000)]
Fix failing testcase to actually be valid.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337483 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoFix template argument deduction when a parameter pack has a value
Richard Smith [Thu, 19 Jul 2018 19:00:37 +0000 (19:00 +0000)]
Fix template argument deduction when a parameter pack has a value
provided by an outer template.

We made the incorrect assumption in various places that the only way we
can have any arguments already provided for a pack during template
argument deduction was from a partially-specified pack. That's not true;
we can also have arguments from an enclosing already-instantiated
template, and that can even result in the function template's own pack
parameters having a fixed length and not being packs for the purposes of
template argument deduction.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337481 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agofix typo in comment
Nico Weber [Thu, 19 Jul 2018 18:59:38 +0000 (18:59 +0000)]
fix typo in comment

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337480 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[analyzer] Fix memory sanitizer error in MallocChecker.
Reka Kovacs [Thu, 19 Jul 2018 17:43:09 +0000 (17:43 +0000)]
[analyzer] Fix memory sanitizer error in MallocChecker.

StringRef's data() returns a string that may be non-null-terminated.
Switch to using StringRefs from const char pointers in visitor notes
to avoid problems.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337474 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoFix unused variable warning.
Erich Keane [Thu, 19 Jul 2018 17:19:16 +0000 (17:19 +0000)]
Fix unused variable warning.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337473 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[analyzer] Memoize complexity of SymExpr
Mikhail R. Gadelha [Thu, 19 Jul 2018 17:03:12 +0000 (17:03 +0000)]
[analyzer] Memoize complexity of SymExpr

Summary:
This patch introduces a new member to SymExpr, which stores the symbol complexity, avoiding recalculating it every time computeComplexity() is called.

Also, increase the complexity of conjured Symbols by one, so it's clear that it has a greater complexity than its underlying symbols.

Reviewers: NoQ, george.karpenkov

Reviewed By: NoQ, george.karpenkov

Subscribers: xazax.hun, szepet, a.sidorin

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337472 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Sema] Add a new warning, -Wmemset-transposed-args
Erik Pilkington [Thu, 19 Jul 2018 16:46:15 +0000 (16:46 +0000)]
[Sema] Add a new warning, -Wmemset-transposed-args

This diagnoses calls to memset that have the second and third arguments
transposed, for example:

  memset(buf, sizeof(buf), 0);

This is done by checking if the third argument is a literal 0, or if the second
is a sizeof expression (and the third isn't). The first check is also done for
calls to bzero.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337470 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoThe patch adds support for the new map interface between clang and libomptarget....
Alexey Bataev [Thu, 19 Jul 2018 16:34:13 +0000 (16:34 +0000)]
The patch adds support for the new map interface between clang and libomptarget. The changes in the interface are the following:

device IDs are now 64-bit integers (as opposed to 32-bit)
map flags are 64-bit long (used to be 32-bit)
mappings for partially mapped structs are now calculated at compile time and members of partially mapped structs are flagged using the MEMBER_OF field
Support for is_device_ptr on struct members was dropped - this functionality is not supported by the OpenMP standard and its implementation is technically infeasible (however, use_device_ptr on struct members works as a non-standard extension of the compiler)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337468 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[analyzer] Fix disappearing notes in DanglingInternalBufferChecker tests
Reka Kovacs [Thu, 19 Jul 2018 15:44:46 +0000 (15:44 +0000)]
[analyzer] Fix disappearing notes in DanglingInternalBufferChecker tests

Correct a mistake of the exact same kind I am writing this checker for.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337466 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[analyzer] Add support for more basic_string API in
Reka Kovacs [Thu, 19 Jul 2018 15:10:06 +0000 (15:10 +0000)]
[analyzer] Add support for more basic_string API in
DanglingInternalBufferChecker.

A pointer referring to the elements of a basic_string may be invalidated
by calling a non-const member function, except operator[], at, front,
back, begin, rbegin, end, and rend. The checker now warns if the pointer
is used after such operations.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337463 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[CodeGen] Disable aggressive structor optimizations at -O0, take 3
Pavel Labath [Thu, 19 Jul 2018 14:05:22 +0000 (14:05 +0000)]
[CodeGen] Disable aggressive structor optimizations at -O0, take 3

The previous version of this patch (r332839) was reverted because it was
causing "definition with same mangled name as another definition" errors
in some module builds. This was caused by an unrelated bug in module
importing which it exposed. The importing problem was fixed in r336240,
so this recommits the original patch (r332839).

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337456 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoEnable C++2a Chrono Literals
Erich Keane [Thu, 19 Jul 2018 13:36:57 +0000 (13:36 +0000)]
Enable C++2a Chrono Literals

C++2a via http://wg21.link/p0355 permits the library
literals of 'd' and 'y'. This patch enables them in the
Lexer so that they can be properly parsed.

Note that 'd' gets confused with the hex character, so
modifications to how octal, binary, and decimal numbers are
parsed were required. Since this is simply making previously
invalid code legal, this should be fine.

Hex still greedily parses the 'd' as a hexit, since it would
a: violate [lex.ext]p1
b: break existing code.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337454 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[CodeComplete] Fix accessibilty of protected members from base class.
Eric Liu [Thu, 19 Jul 2018 13:32:00 +0000 (13:32 +0000)]
[CodeComplete] Fix accessibilty of protected members from base class.

Summary:
Currently, protected members from base classes are marked as
inaccessible when completing in derived class. This patch fixes the problem by
setting the naming class correctly when looking up results in base class
according to [11.2.p5].

Reviewers: aaron.ballman, sammccall, rsmith

Reviewed By: aaron.ballman

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337453 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoNFC: Remove extraneous semicolons as pointed out in the differential review
Nemanja Ivanovic [Thu, 19 Jul 2018 12:49:27 +0000 (12:49 +0000)]
NFC: Remove extraneous semicolons as pointed out in the differential review

The commit for
https://reviews.llvm.org/D49424
missed the comment about the extraneous semicolons. Remove them.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337451 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[PowerPC] Handle __builtin_xxpermdi the same way as GCC does
Nemanja Ivanovic [Thu, 19 Jul 2018 12:44:15 +0000 (12:44 +0000)]
[PowerPC] Handle __builtin_xxpermdi the same way as GCC does

The codegen for this builtin was initially implemented to match GCC.
However, due to interest from users GCC changed behaviour to account for the
big endian bias of the instruction and correct it. This patch brings the
handling inline with GCC.

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

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337449 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[PCH+Modules] Load -fmodule-map-file content before including PCHs
Bruno Cardoso Lopes [Thu, 19 Jul 2018 12:32:06 +0000 (12:32 +0000)]
[PCH+Modules] Load -fmodule-map-file content before including PCHs

Consider:
1) Generate PCH with -fmodules and -fmodule-map-file
2) Use PCH with -fmodules and the same -fmodule-map-file

If we don't load -fmodule-map-file content before including PCHs,
the modules that are dependencies in PCHs cannot get loaded,
since there's no matching module map file when reading back the AST.

rdar://problem/40852867

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337447 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[clang]: Add support for "-fno-delete-null-pointer-checks"
Manoj Gupta [Thu, 19 Jul 2018 00:44:52 +0000 (00:44 +0000)]
[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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337433 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoDocumentation: fix a typo in the AST Matcher Reference docs.
James Dennett [Wed, 18 Jul 2018 23:21:31 +0000 (23:21 +0000)]
Documentation: fix a typo in the AST Matcher Reference docs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337431 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoReapply r336660: [Modules] Autoload subdirectory modulemaps with specific LangOpts
Bruno Cardoso Lopes [Wed, 18 Jul 2018 23:21:19 +0000 (23:21 +0000)]
Reapply r336660: [Modules] Autoload subdirectory modulemaps with specific LangOpts

Summary:
Reproducer and errors:
https://bugs.llvm.org/show_bug.cgi?id=37878

lookupModule was falling back to loadSubdirectoryModuleMaps when it couldn't
find ModuleName in (proper) search paths. This was causing iteration over all
files in the search path subdirectories for example "/usr/include/foobar" in
bugzilla case.

Users don't expect Clang to load modulemaps in subdirectories implicitly, and
also the disk access is not cheap.

if (AllowExtraModuleMapSearch) true with ObjC with @import ModuleName.

Reviewers: rsmith, aprantl, bruno

Subscribers: cfe-commits, teemperor, v.g.vassilev

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337430 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoDR330: when determining whether a cast casts away constness, consider
Richard Smith [Wed, 18 Jul 2018 20:13:36 +0000 (20:13 +0000)]
DR330: when determining whether a cast casts away constness, consider
qualifiers from all levels matching a multidimensional array.

For example, this allows casting from
  pointer to       array of            array of   const volatile int
to
  pointer to const pointer to volatile pointer to                int
because the multidimensional array part of the source type corresponds
to a part of the destination type that contains both 'const' and
'volatile'.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337422 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAdd support for __declspec(code_seg("segname"))
Erich Keane [Wed, 18 Jul 2018 20:04:48 +0000 (20:04 +0000)]
Add support for __declspec(code_seg("segname"))

This patch uses CodeSegAttr to represent __declspec(code_seg) rather than
building on the existing support for #pragma code_seg.
The code_seg declspec is applied on functions and classes. This attribute
enables the placement of code into separate named segments, including compiler-
generated codes and template instantiations.

For more information, please see the following:
https://msdn.microsoft.com/en-us/library/dn636922.aspx

This patch fixes the regression for the support for attribute ((section).
https://github.com/llvm-mirror/clang/commit/746b78de7812bc785fbb5207b788348040b23fa7

Patch by Soumi Manna (Manna)
Differential Revision: https://reviews.llvm.org/D48841

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337420 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[analyzer] Remove a debug print that was accidentally left around.
Artem Dergachev [Wed, 18 Jul 2018 18:44:40 +0000 (18:44 +0000)]
[analyzer] Remove a debug print that was accidentally left around.

No functional change intended.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337417 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoSupport implicit _Atomic struct load / store
JF Bastien [Wed, 18 Jul 2018 18:01:41 +0000 (18:01 +0000)]
Support implicit _Atomic struct load / store

Summary:
Using _Atomic to do implicit load / store is just a seq_cst atomic_load / atomic_store. Stores currently assert in Sema::ImpCastExprToType with 'can't implicitly cast lvalue to rvalue with this cast kind', but that's erroneous. The codegen is fine as the test shows.

While investigating I found that Richard had found the problem here: https://reviews.llvm.org/D46112#1113557

<rdar://problem/40347123>

Reviewers: dexonsmith

Subscribers: cfe-commits, efriedma, rsmith, aaron.ballman

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337410 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[CodeComplete] Allow getDeclaration on RK_Pattern result.
Eric Liu [Wed, 18 Jul 2018 15:17:52 +0000 (15:17 +0000)]
[CodeComplete] Allow getDeclaration on RK_Pattern result.

Summary:
RK_Pattern results can also have associated declarations e.g. field
decls in constructor initializers.

Reviewers: bkramer

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337394 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoClear properties inadvertantly added to tests in R336379
Erich Keane [Wed, 18 Jul 2018 13:07:13 +0000 (13:07 +0000)]
Clear properties inadvertantly added to tests in R336379

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337388 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoMention clang-cl improvements from r335466 and r336379 in ReleaseNotes.rst
Nico Weber [Wed, 18 Jul 2018 11:55:03 +0000 (11:55 +0000)]
Mention clang-cl improvements from r335466 and r336379 in ReleaseNotes.rst

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337381 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[modules] Print input files when -module-file-info file switch is passed.
Vassil Vassilev [Wed, 18 Jul 2018 06:49:33 +0000 (06:49 +0000)]
[modules] Print input files when -module-file-info file switch is passed.

This patch improves traceability of duplicated header files which end
up in multiple pcms.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337353 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[AArch64] Define TARGET_HEADER_BUILTIN
Martin Storsjo [Wed, 18 Jul 2018 06:15:09 +0000 (06:15 +0000)]
[AArch64] Define TARGET_HEADER_BUILTIN

Without it, the new intrinsics became available for all language
variants. This was missed in SVN r337327.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337352 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRe-land r337333, "Teach Clang to emit address-significance tables.",
Peter Collingbourne [Wed, 18 Jul 2018 00:27:07 +0000 (00:27 +0000)]
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337339 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRevert r337333, "Teach Clang to emit address-significance tables."
Peter Collingbourne [Tue, 17 Jul 2018 23:56:30 +0000 (23:56 +0000)]
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337336 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoTeach Clang to emit address-significance tables.
Peter Collingbourne [Tue, 17 Jul 2018 23:17:16 +0000 (23:17 +0000)]
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337333 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoReplace LLVM_ALIGNAS with just alignas.
Richard Smith [Tue, 17 Jul 2018 22:24:11 +0000 (22:24 +0000)]
Replace LLVM_ALIGNAS with just alignas.

Various places in Clang and LLVM are already using alignas; it seems
our minimum host configuration now requires it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337330 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRestructure checking for, and warning on, lifetime extension.
Richard Smith [Tue, 17 Jul 2018 22:24:09 +0000 (22:24 +0000)]
Restructure checking for, and warning on, lifetime extension.

This change implements C++ DR1696, which makes initialization of a
reference member of a class from a temporary object ill-formed. The
standard wording here is imprecise, but we interpret it as meaning that
any time a mem-initializer would result in lifetime extension, the
program is ill-formed.

This reinstates r337226, reverted in r337255, with a fix for the
InitializedEntity alignment problem that was breaking ARM buildbots.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337329 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[COFF] Add more missing MSVC ARM64 intrinsics
Mandeep Singh Grang [Tue, 17 Jul 2018 22:03:24 +0000 (22:03 +0000)]
[COFF] Add more missing MSVC ARM64 intrinsics

Summary:
Added the following intrinsics:
_BitScanForward, _BitScanReverse, _BitScanForward64, _BitScanReverse64
_InterlockedAnd64, _InterlockedDecrement64, _InterlockedExchange64,
_InterlockedExchangeAdd64, _InterlockedExchangeSub64,
_InterlockedIncrement64, _InterlockedOr64, _InterlockedXor64.

Reviewers: compnerd, mstorsjo, rnk, javed.absar

Reviewed By: mstorsjo

Subscribers: kristof.beyls, chrib, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337327 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRemove unnecessary trailing ; in macro intrinsic definition.
Eric Christopher [Tue, 17 Jul 2018 20:22:17 +0000 (20:22 +0000)]
Remove unnecessary trailing ; in macro intrinsic definition.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337321 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[analyzer] Fix Z3 backend after D48205
Mikhail R. Gadelha [Tue, 17 Jul 2018 17:40:34 +0000 (17:40 +0000)]
[analyzer] Fix Z3 backend after D48205

Summary:
An assertion was added in D48205 to catch places where a `nonloc::SymbolVal` was wrapping a `loc` object.

This patch fixes that in the Z3 backend by making the `SValBuilder` object accessible from inherited instances of `SimpleConstraintManager` and calling `SVB.makeSymbolVal(foo)` instead of `nonloc::SymbolVal(foo)`.

Reviewers: NoQ, george.karpenkov

Reviewed By: NoQ

Subscribers: xazax.hun, szepet, a.sidorin

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337304 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoclang-cl: Postpone Wmsvc-not-found emission until link.exe gets used.
Nico Weber [Tue, 17 Jul 2018 15:07:40 +0000 (15:07 +0000)]
clang-cl: Postpone Wmsvc-not-found emission until link.exe gets used.

Wmsvc-not-found was added in r297851 to help diagnose why link.exe can't be
executed. However, it's emitted even when using -fuse-ld=lld, and in cross
builds there's no way to get rid of the warning other than disabling it.

Instead, emit it when we look up link.exe and it ends up not being executable.
That way, when passing -fuse-ld=lld it will never be printed.
It will also not be printed if we find link.exe on PATH.

(We might want to eventually default to lld one day, at least when running on a
non-Win host, but that's for another day.)

Fixes PR38016.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337290 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Fixed Point Arithmetic] Fix for bug where integer literals could be treated as fixed...
Leonard Chan [Tue, 17 Jul 2018 14:58:49 +0000 (14:58 +0000)]
[Fixed Point Arithmetic] Fix for bug where integer literals could be treated as fixed point literals

This addresses a bug brought up in https://bugs.llvm.org/show_bug.cgi?id=38161 where integer literals could be treated as fixed point types and throw errors related to fixed point types when the 'k' or 'r' suffix used. The fix also addresses the second issue brought up with the assertion by not treating integers as fixed point types in the first place.

Integers that have suffixes 'k' and 'r' now throw the error `invalid suffix 'k/r' on integer constant`.

A few more tests were also added to ensure that fixed point types, and any errors/warnings related to them, are limited to C for now.

Prior discussion also at https://reviews.llvm.org/D46915.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337289 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRemove superfluous ; to fix -Wpedantic warning from gcc
Nico Weber [Tue, 17 Jul 2018 14:20:02 +0000 (14:20 +0000)]
Remove superfluous ; to fix -Wpedantic warning from gcc

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337285 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Tooling] Add operator== to CompileCommand
Simon Marchi [Tue, 17 Jul 2018 14:13:05 +0000 (14:13 +0000)]
[Tooling] Add operator== to CompileCommand

Summary:
It does the obvious thing of comparing all fields.  This will be needed
for a clangd patch I have in the pipeline.

Subscribers: dblaikie, ilya-biryukov, ioeric, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337284 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRevert "[Sema] Reword warning for constant captures that are not required"
Benjamin Kramer [Tue, 17 Jul 2018 13:17:01 +0000 (13:17 +0000)]
Revert "[Sema] Reword warning for constant captures that are not required"

This reverts commit r337152. This applies to non-constants too. The real
explanation is that the capture is not ODR-used, but putting that into
the warning message seems ... worse.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337278 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAlways use __mcount on NetBSD. Some platforms don't provide _mcount.
Joerg Sonnenberger [Tue, 17 Jul 2018 13:13:34 +0000 (13:13 +0000)]
Always use __mcount on NetBSD. Some platforms don't provide _mcount.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337277 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[ASTImporter] Fix poisonous structural equivalence cache
Gabor Marton [Tue, 17 Jul 2018 12:39:27 +0000 (12:39 +0000)]
[ASTImporter] Fix poisonous structural equivalence cache

Summary:
Implementation functions call into the member functions of
ASTStructuralEquivalence, thus they can falsely alter the DeclsToCheck state
(they add decls).  This results that some leaf declarations can be stated as
inequivalent as a side effect of one inequivalent element in the DeclsToCheck
list.  And since we store the non-equivalencies, any (otherwise independent)
decls will be rendered as non-equivalent.  Solution: I tried to clearly
separate the implementation functions (the static ones) and the public
interface.  From now on, the implementation functions do not call any public
member functions, only other implementation functions.

Reviewers: a.sidorin, a_sidorin, r.stahl

Subscribers: rnkovacs, dkrupp, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337275 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoFor NetBSD, unwind data is emitted by default, so also enable frame
Joerg Sonnenberger [Tue, 17 Jul 2018 12:38:57 +0000 (12:38 +0000)]
For NetBSD, unwind data is emitted by default, so also enable frame
pointer optimisation by default when using optimisation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337274 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoBy popular demand, switch in64_t on NetBSD/AArch64 and NetBSD/PowerPC64
Joerg Sonnenberger [Tue, 17 Jul 2018 12:33:19 +0000 (12:33 +0000)]
By popular demand, switch in64_t on NetBSD/AArch64 and NetBSD/PowerPC64
to long for consistency with other 64bit platforms.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337271 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[ASTImporter] Fix import of unnamed structs
Gabor Marton [Tue, 17 Jul 2018 12:06:36 +0000 (12:06 +0000)]
[ASTImporter] Fix import of unnamed structs

Summary:
D48773 simplified ASTImporter nicely, but it introduced a new error: Unnamed
structs are not imported correctly, if they appear in a recursive context.
This patch provides a fix for structural equivalency.

Reviewers: a.sidorin, a_sidorin, balazske, gerazo

Subscribers: rnkovacs, dkrupp, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337267 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[ASTImporter] Import described template (if any) of function.
Balazs Keri [Tue, 17 Jul 2018 09:52:41 +0000 (09:52 +0000)]
[ASTImporter] Import described template (if any) of function.

Summary:
When a function is imported, check if it has a described template.
The name lookup is corrected to find the templated entity in this case.
The described template of the function is imported too.

Reviewers: a.sidorin, a_sidorin

Reviewed By: a_sidorin

Subscribers: a_sidorin, martong, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337260 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoTemporarily revert r337226 "Restructure checking for, and warning on, lifetime extens...
Florian Hahn [Tue, 17 Jul 2018 09:23:31 +0000 (09:23 +0000)]
Temporarily revert r337226 "Restructure checking for, and warning on, lifetime extension."

This change breaks on ARM because pointers to clang::InitializedEntity are only
4 byte aligned and do not have 3 bits to store values. A possible solution
would be to change the fields in clang::InitializedEntity to enforce a bigger
alignment requirement.

The error message is

llvm/include/llvm/ADT/PointerIntPair.h:132:3: error: static_assert failed "PointerIntPair with integer size too large for pointer"
  static_assert(IntBits <= PtrTraits::NumLowBitsAvailable,
include/llvm/ADT/PointerIntPair.h:73:13: note: in instantiation of template class 'llvm::PointerIntPairInfo<const clang::InitializedEntity *, 3, llvm::PointerLikeTypeTraits<const clang::InitializedEntity *> >' requested here
    Value = Info::updateInt(Info::updatePointer(0, PtrVal),
llvm/include/llvm/ADT/PointerIntPair.h:51:5: note: in instantiation of member function 'llvm::PointerIntPair<const clang::InitializedEntity *, 3, (anonymous namespace)::LifetimeKind, llvm::PointerLikeTypeTraits<const clang::InitializedEntity *>, llvm::PointerIntPairInfo<const clang::InitializedEntity *, 3, llvm::PointerLikeTypeTraits<const clang::InitializedEntity *> > >::setPointerAndInt' requested here
    setPointerAndInt(PtrVal, IntVal);
    ^
llvm/tools/clang/lib/Sema/SemaInit.cpp:6237:12: note: in instantiation of member function 'llvm::PointerIntPair<const clang::InitializedEntity *, 3, (anonymous namespace)::LifetimeKind, llvm::PointerLikeTypeTraits<const clang::InitializedEntity *>, llvm::PointerIntPairInfo<const clang::InitializedEntity *, 3, llvm::PointerLikeTypeTraits<const clang::InitializedEntity *> > >::PointerIntPair' requested here
    return {Entity, LK_Extended};

Full log here:
http://lab.llvm.org:8011/builders/clang-cmake-armv7-global-isel/builds/1330
http://lab.llvm.org:8011/builders/clang-cmake-armv7-full/builds/1394

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337255 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoHarden/relax clang/test/CodeGen/opt-record-MIR.c test
Roman Lebedev [Tue, 17 Jul 2018 07:12:08 +0000 (07:12 +0000)]
Harden/relax clang/test/CodeGen/opt-record-MIR.c test

Summary:
If the build path is short, `Line` field can end up fitting on the same line as `File`,
but the `{{.*}}` would consume it. Keeping in mind rL293149, i think we can fix it,
while keeping it working when there are and there are not any quotations.
At least this fixes this test for me.

Reviewers: anemet, aaron.ballman, hfinkel

Reviewed By: anemet

Subscribers: cfe-commits, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337249 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Driver] Add -fno-digraphs
Jacob Bandes-Storch [Tue, 17 Jul 2018 04:56:22 +0000 (04:56 +0000)]
[Driver] Add -fno-digraphs

Summary: Add a flag `-fno-digraphs` to disable digraphs in the lexer, similar to `-fno-operator-names` which disables alternative names for C++ operators.

Reviewers: rsmith

Reviewed By: rsmith

Subscribers: rsmith, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337232 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[analyzer] Fix size_t in tests.
Artem Dergachev [Tue, 17 Jul 2018 01:39:25 +0000 (01:39 +0000)]
[analyzer] Fix size_t in tests.

Should fix a buildbot. No functional change intended.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337231 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[CFG] [analyzer] Allow elidable copies to have more than one arguments.
Artem Dergachev [Tue, 17 Jul 2018 00:57:57 +0000 (00:57 +0000)]
[CFG] [analyzer] Allow elidable copies to have more than one arguments.

Copy-constructors and move-constructors may have default arguments. It is
incorrect to assert that they only have one argument, i.e. the reference to the
object being copied or moved. Remove the assertion.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337229 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[analyzer] pr37802: Fix symbolic-pointer-to-boolean casts during load.
Artem Dergachev [Tue, 17 Jul 2018 00:42:35 +0000 (00:42 +0000)]
[analyzer] pr37802: Fix symbolic-pointer-to-boolean casts during load.

The canonical representation of pointer &SymRegion{$x} casted to boolean is
"$x != 0", not "$x". Assertion added in r337227 catches that.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337228 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[analyzer] Assert that nonloc::SymbolVal always wraps a non-Loc-type symbol.
Artem Dergachev [Tue, 17 Jul 2018 00:22:27 +0000 (00:22 +0000)]
[analyzer] Assert that nonloc::SymbolVal always wraps a non-Loc-type symbol.

In the current SVal hierarchy there are multiple ways of representing certain
values but few are actually used and expected to be seen by the code.

In particular, a value of a symbolic pointer is always represented by a
loc::MemRegionVal that wraps a SymbolicRegion that wraps the pointer symbol
and never by a nonloc::SymbolVal that wraps that symbol directly.

Assert the aforementioned fact. Fix one minor violation of it.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337227 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRestructure checking for, and warning on, lifetime extension.
Richard Smith [Tue, 17 Jul 2018 00:11:41 +0000 (00:11 +0000)]
Restructure checking for, and warning on, lifetime extension.

This change implements C++ DR1696, which makes initialization of a
reference member of a class from a temporary object ill-formed. The
standard wording here is imprecise, but we interpret it as meaning that
any time a mem-initializer would result in lifetime extension, the
program is ill-formed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337226 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[analyzer] Make checkEndFunction() give access to the return statement.
Reka Kovacs [Mon, 16 Jul 2018 20:47:45 +0000 (20:47 +0000)]
[analyzer] Make checkEndFunction() give access to the return statement.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337215 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[ASTMatchers] Quickfix for tests.
George Karpenkov [Mon, 16 Jul 2018 20:42:37 +0000 (20:42 +0000)]
[ASTMatchers] Quickfix for tests.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337214 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[analyzer] Bugfix for an overly eager suppression for null pointer return from macros.
George Karpenkov [Mon, 16 Jul 2018 20:33:25 +0000 (20:33 +0000)]
[analyzer] Bugfix for an overly eager suppression for null pointer return from macros.

Only suppress those cases where the null which came from the macro is
relevant to the bug, and was not overwritten in between.

rdar://41497323

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337213 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[analyzer] Fix GCDAntipatternChecker to only fire when the semaphore is initialized...
George Karpenkov [Mon, 16 Jul 2018 20:32:57 +0000 (20:32 +0000)]
[analyzer] Fix GCDAntipatternChecker to only fire when the semaphore is initialized to zero

Initializing a semaphore with a different constant most likely signals a different intent

rdar://41802552

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337212 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[analyzer] Provide a symmetric method for generating a PathDiagnosticLocation from...
George Karpenkov [Mon, 16 Jul 2018 20:32:32 +0000 (20:32 +0000)]
[analyzer] Provide a symmetric method for generating a PathDiagnosticLocation from Decl

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337211 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[ASTMatchers] Introduce Objective-C matchers `hasReceiver` and `isInstanceMessage...
George Karpenkov [Mon, 16 Jul 2018 20:22:12 +0000 (20:22 +0000)]
[ASTMatchers] Introduce Objective-C matchers `hasReceiver` and `isInstanceMessage` for ObjCMessageExpr

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337209 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[OPENMP] Fix checks for declare target link entries.
Alexey Bataev [Mon, 16 Jul 2018 20:05:25 +0000 (20:05 +0000)]
[OPENMP] Fix checks for declare target link entries.

If the declare target link entries are created but not used, the
compiler will produce an error message. Patch improves handling of such
situations + improves checks for possibly lost declare target variables.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337207 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[OPENMP] Fix syntactic errors in error messages.
Alexey Bataev [Mon, 16 Jul 2018 18:12:18 +0000 (18:12 +0000)]
[OPENMP] Fix syntactic errors in error messages.

Fixed spelling of the offloading error messages.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337196 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[OPENMP, NVPTX] Globalize only captured variables.
Alexey Bataev [Mon, 16 Jul 2018 16:49:20 +0000 (16:49 +0000)]
[OPENMP, NVPTX] Globalize only captured variables.

Sometimes we can try to globalize non-variable declarations, which may
lead to compiler crash.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337191 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRestore "[ThinLTO] Ensure we always select the same function copy to import"
Teresa Johnson [Mon, 16 Jul 2018 15:30:36 +0000 (15:30 +0000)]
Restore "[ThinLTO] Ensure we always select the same function copy to import"

This reverts commit r337082, restoring r337051, since the LLVM side
patch has been restored.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337185 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[ASTImporter] Changed constant int to unsigned int in test code.
Balazs Keri [Mon, 16 Jul 2018 14:05:18 +0000 (14:05 +0000)]
[ASTImporter] Changed constant int to unsigned int in test code.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337172 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[analyzer] Fix the Z3 backend always generating unsigned APSInt
Mikhail R. Gadelha [Mon, 16 Jul 2018 13:32:22 +0000 (13:32 +0000)]
[analyzer] Fix the Z3 backend always generating unsigned APSInt

Summary:
In `toAPSInt`, the Z3 backend was not checking the variable `Int`'s type and was always generating unsigned `APSInt`s.

This was found by accident when I removed:
```
    llvm::APSInt ConvertedLHS, ConvertedRHS;
    QualType LTy, RTy;
    std::tie(ConvertedLHS, LTy) = fixAPSInt(*LHS);
    std::tie(ConvertedRHS, RTy) = fixAPSInt(*RHS);
-    doIntTypePromotion<llvm::APSInt, Z3ConstraintManager::castAPSInt>(
-        ConvertedLHS, LTy, ConvertedRHS, RTy);
    return BVF.evalAPSInt(BSE->getOpcode(), ConvertedLHS, ConvertedRHS);
```

And the `BasicValueFactory` started to complain about different `signedness`.

Reviewers: george.karpenkov, NoQ, ddcc

Reviewed By: ddcc

Subscribers: xazax.hun, szepet, a.sidorin

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337169 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[analyzer] Fix constraint being dropped when analyzing a program without taint tracki...
Mikhail R. Gadelha [Mon, 16 Jul 2018 13:14:46 +0000 (13:14 +0000)]
[analyzer] Fix constraint being dropped when analyzing a program without taint tracking enabled

Summary:
This patch removes the constraint dropping when taint tracking is disabled.

It also voids the crash reported in D28953 by treating a SymSymExpr with non pointer symbols as an opaque expression.

Updated the regressions and verifying the big projects now; I'll update here when they're done.

Based on the discussion on the mailing list and the patches by @ddcc.

Reviewers: george.karpenkov, NoQ, ddcc, baloghadamsoftware

Reviewed By: george.karpenkov

Subscribers: delcypher, llvm-commits, rnkovacs, xazax.hun, szepet, a.sidorin, ddcc

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337167 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[ASTImporter] Import implicit methods of existing class.
Balazs Keri [Mon, 16 Jul 2018 12:16:39 +0000 (12:16 +0000)]
[ASTImporter] Import implicit methods of existing class.

Summary:
When an already existing class is encountered during import,
check if it has implicit methods that are missing in the existing one,
and import these.
The to-be-imported code may use the same class in different way than the
existing (before the import) code. This may result in that there are
implicit methods that are not generated for the existing code.

Reviewers: a.sidorin, a_sidorin

Reviewed By: a_sidorin

Subscribers: a_sidorin, martong, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337162 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Sema] Reword warning for constant captures that are not required
Benjamin Kramer [Mon, 16 Jul 2018 09:52:02 +0000 (09:52 +0000)]
[Sema] Reword warning for constant captures that are not required

This is one of the darker corners of C++, make it clear that this is
about constants and rephrase it a bit.

Before: lambda capture 'i' is not required to be captured for this use
After:  lambda capture of constant 'i' is not required for this use

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337152 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Analyzer] Mark `SymbolData` parts of iterator position as live in program state...
Adam Balogh [Mon, 16 Jul 2018 09:27:27 +0000 (09:27 +0000)]
[Analyzer] Mark `SymbolData` parts of iterator position as live in program state maps

Marking a symbolic expression as live is non-recursive. In our checkers we
either use conjured symbols or conjured symbols plus/minus integers to
represent abstract position of iterators, so in this latter case we also
must mark the `SymbolData` part of these symbolic expressions as live to
prevent them from getting reaped.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337151 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Sema] Add fixit for unused lambda captures
Alexander Shaposhnikov [Mon, 16 Jul 2018 07:23:47 +0000 (07:23 +0000)]
[Sema] Add fixit for unused lambda captures

This diff adds a fixit to suggest removing unused lambda captures
in the appropriate diagnostic.

Patch by Andrew Comminos!

Test plan: make check-all

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337148 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[MinGW] Automatically mangle Windows-specific entry points as C
Martin Storsjo [Mon, 16 Jul 2018 05:42:25 +0000 (05:42 +0000)]
[MinGW] Automatically mangle Windows-specific entry points as C

This mangles entry points wmain, WinMain, wWinMain or DllMain as C
functions, to match the ABI for these functions.

We already did the same for these functions in MSVC mode, but we also
should do the same in the Itanium ABI.

This fixes PR38124.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337146 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRun thread safety tests with both lock and capability attributes; NFC to the analysis...
Aaron Ballman [Sun, 15 Jul 2018 12:08:52 +0000 (12:08 +0000)]
Run thread safety tests with both lock and capability attributes; NFC to the analysis behavior.

Patch thanks to Aaron Puchert.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337125 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[CMake] Use libc++ and compiler-rt for sanitizers
Petr Hosek [Sun, 15 Jul 2018 03:11:43 +0000 (03:11 +0000)]
[CMake] Use libc++ and compiler-rt for sanitizers

When building runtimes for Linux as part of Fuchsia toolchain, use
libc++ and compiler-rt for sanitizers.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337117 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAdd caching when looking up coroutine_traits
Brian Gesiak [Sat, 14 Jul 2018 18:21:44 +0000 (18:21 +0000)]
Add caching when looking up coroutine_traits

Summary:
Currently clang looks up the coroutine_traits ClassTemplateDecl
everytime it looks up the promise type. This is unnecessary
as coroutine_traits doesn't change between promise type lookups.

This diff caches the coroutine_traits lookup.

Patch by Tanoy Sinha!

Test Plan:
I added log statements in the new lookupCoroutineTraits function
to ensure that LookupQualifiedName was only called once even
when multiple coroutines existed in the source file.

Reviewers: modocache, GorNishanov

Reviewed By: modocache

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337103 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRevert "[ThinLTO] Ensure we always select the same function copy to import"
Teresa Johnson [Sat, 14 Jul 2018 01:50:14 +0000 (01:50 +0000)]
Revert "[ThinLTO] Ensure we always select the same function copy to import"

This reverts commit r337051.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337082 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[ThinLTO] Ensure we always select the same function copy to import
Teresa Johnson [Fri, 13 Jul 2018 21:35:58 +0000 (21:35 +0000)]
[ThinLTO] Ensure we always select the same function copy to import

Clang change to reflect the FunctionsToImportTy type change
in the llvm changes for D48670.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337051 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Hexagon] Fix hvx-length feature name in testcases
Krzysztof Parzyszek [Fri, 13 Jul 2018 21:32:33 +0000 (21:32 +0000)]
[Hexagon] Fix hvx-length feature name in testcases

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337049 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoMake BuiltinType constructor private, and befriend ASTContext.
Richard Smith [Fri, 13 Jul 2018 21:29:31 +0000 (21:29 +0000)]
Make BuiltinType constructor private, and befriend ASTContext.

This reflects the fact that only ASTContext should ever create an
instance of BuiltinType, and matches what we do for all the other Type
subclasses.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337048 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoUse external layout information to layout bit-fields for MS ABI.
Richard Smith [Fri, 13 Jul 2018 21:07:42 +0000 (21:07 +0000)]
Use external layout information to layout bit-fields for MS ABI.

Patch by Aleksandr Urakov!

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337047 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoCodeGen: specify alignment + inbounds for automatic variable initialization
JF Bastien [Fri, 13 Jul 2018 20:33:23 +0000 (20:33 +0000)]
CodeGen: specify alignment + inbounds for automatic variable initialization

Summary: Automatic variable initialization was generating default-aligned stores (which are deprecated) instead of using the known alignment from the alloca. Further, they didn't specify inbounds.

Subscribers: dexonsmith, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337041 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86] Change the rounding mode used when testing the sqrt_round intrinsics.
Craig Topper [Fri, 13 Jul 2018 20:16:38 +0000 (20:16 +0000)]
[X86] Change the rounding mode used when testing the sqrt_round intrinsics.

Using CUR_DIRECTION is not a realistic scenario. That is equivalent to the intrinsic without rounding.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337040 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoSafeStack: Add builtins to read unsafe stack top/bottom
Vlad Tsyrklevich [Fri, 13 Jul 2018 19:48:35 +0000 (19:48 +0000)]
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337037 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoPR15730/PR16986 Allow dependently typed vector_size types.
Erich Keane [Fri, 13 Jul 2018 19:46:04 +0000 (19:46 +0000)]
PR15730/PR16986 Allow dependently typed vector_size types.

As listed in the above PRs, vector_size doesn't allow
dependent types/values. This patch introduces a new
DependentVectorType to handle a VectorType that has a dependent
size or type.

In the future, ALL the vector-types should be able to create one
of these to handle dependent types/sizes as well. For example,
DependentSizedExtVectorType could likely be switched to just use
this instead, though that is left as an exercise for the future.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337036 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoFix PR34668 - P0704R1 implementation is too permissive
Nicolas Lesser [Fri, 13 Jul 2018 16:27:45 +0000 (16:27 +0000)]
Fix PR34668 - P0704R1 implementation is too permissive

Summary:
https://bugs.llvm.org/show_bug.cgi?id=34668

Pretty straightforward.

Reviewers: rsmith, Rakete1111

Reviewed By: Rakete1111

Subscribers: Rakete1111, cfe-commits

Tags: #clang

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337017 91177308-0d34-0410-b5e6-96231b3b80d8