]> granicus.if.org Git - clang/log
clang
5 years ago[analyzer] [RetainCountChecker] [NFC] Remove redundant enum items *Msg, as the object...
George Karpenkov [Thu, 10 Jan 2019 18:14:12 +0000 (18:14 +0000)]
[analyzer] [RetainCountChecker] [NFC] Remove redundant enum items *Msg, as the object type is already communicated by a separate field

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

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

5 years ago[analyzer] [NFC] Track object type with ArgEffect in RetainCountChecker.
George Karpenkov [Thu, 10 Jan 2019 18:13:59 +0000 (18:13 +0000)]
[analyzer] [NFC] Track object type with ArgEffect in RetainCountChecker.

This would be needed in the future.

https://reviews.llvm.org/D56040

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

5 years ago[analyzer] [NFC] Move ObjKind into a separate top-level enum in RetainSummaryManager.
George Karpenkov [Thu, 10 Jan 2019 18:13:46 +0000 (18:13 +0000)]
[analyzer] [NFC] Move ObjKind into a separate top-level enum in RetainSummaryManager.

Allows using it in future outside of RetEffect.

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

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

5 years agoSplit -Wdelete-non-virtual-dtor into two groups
Erik Pilkington [Thu, 10 Jan 2019 18:03:07 +0000 (18:03 +0000)]
Split -Wdelete-non-virtual-dtor into two groups

This group controls two diagnostics: deleting an abstract class with
a non-virtual dtor, which is a guaranteed crash, and deleting a
non-abstract polymorphic class with a non-virtual dtor, which is just
suspicious.

rdar://40380564

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

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

5 years ago[analyzer][CrossTU][NFC] Generalize to external definitions instead of external functions
Rafael Stahl [Thu, 10 Jan 2019 17:44:04 +0000 (17:44 +0000)]
[analyzer][CrossTU][NFC] Generalize to external definitions instead of external functions

Summary: This is just changing naming and documentation to be general about external definitions that can be imported for cross translation unit analysis. There is at least a plan to add VarDecls: D46421

Reviewers: NoQ, xazax.hun, martong, a.sidorin, george.karpenkov, serge-sans-paille

Reviewed By: xazax.hun, martong

Subscribers: mgorny, whisperity, baloghadamsoftware, szepet, rnkovacs, mikhail.ramalho, Szelethus, donat.nagy, dkrupp, cfe-commits

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

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

5 years agoCorrect the spelling of helpURI to helpUri.
Aaron Ballman [Thu, 10 Jan 2019 13:19:48 +0000 (13:19 +0000)]
Correct the spelling of helpURI to helpUri.

JSON is case sensitive and the SARIF spec uses the corrected spelling.

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

5 years ago[libclang] Fix clang_Cursor_isAnonymous
Ivan Donchevskii [Thu, 10 Jan 2019 09:34:44 +0000 (09:34 +0000)]
[libclang] Fix clang_Cursor_isAnonymous

Use the same logic as in TypePrinter::printTag to determine that the tag is anonymous and the separate check for namespaces.

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

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

5 years ago[AMDGPU] Separate feature dot-insts
Stanislav Mekhanoshin [Thu, 10 Jan 2019 03:25:47 +0000 (03:25 +0000)]
[AMDGPU] Separate feature dot-insts

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

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

5 years agoRefactor declarations of ASTContext allocate functions into its own header.
Richard Trieu [Thu, 10 Jan 2019 03:23:25 +0000 (03:23 +0000)]
Refactor declarations of ASTContext allocate functions into its own header.

Forward declarations of the allocate functions combine with the forward
declaration of the ASTContext class is enough information for some headers
without pulling in ASTContext.h in its entirety.  Pull the existing
declarations from AttrIterator.h into a new header.  Also place the default
alignment size into this header.  Previously, new had its default in
AttrIterator.h while new[] had its default in ASTContext.h.  Add new header
includes where it is needed.  Specifically to ASTVector.h to make it a
standalone header, unlike previously which it was standalone as long as
none of its functions were called.

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

5 years ago[X86] Really make the pointer arguments to avx512 gather/scatter intrinsics 'void...
Craig Topper [Thu, 10 Jan 2019 00:47:25 +0000 (00:47 +0000)]
[X86] Really make the pointer arguments to avx512 gather/scatter intrinsics 'void*' to match gcc and Intel's documentation.

The avx2 gather intrinsics are documented to use 'int', 'long long', 'float', or 'double' *. So I'm leaving those. This matches gcc.

I tried to do this in r350696, but I only updated the header not the builtin definition.

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

5 years agoIn nothrow new-expressions, null-check the result if we're going to
Richard Smith [Thu, 10 Jan 2019 00:03:29 +0000 (00:03 +0000)]
In nothrow new-expressions, null-check the result if we're going to
apply sanitizers to it.

This avoids a sanitizer false positive that we are initializing a null
pointer.

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

5 years ago[Sema] Mark target of __attribute__((alias("target"))) used for C
Nick Desaulniers [Wed, 9 Jan 2019 23:54:55 +0000 (23:54 +0000)]
[Sema] Mark target of __attribute__((alias("target"))) used for C

Summary:
Prevents -Wunneeded-internal-delcaration warnings when the target has no
other references. This occurs frequently in device drivers in the Linux
kernel.

Sema would need to invoke the demangler on the target, since in C++ the
target name is mangled:

int f() { return 42; }
int g() __attribute__((alias("_Z1fv")));

Sema does not have the ability to demangle names at this time.

https://bugs.llvm.org/show_bug.cgi?id=39088
https://github.com/ClangBuiltLinux/linux/issues/232

Reviewers: rsmith, rjmccall

Reviewed By: rsmith

Subscribers: erik.pilkington, cfe-commits, pirama, srhines

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

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

5 years ago[ObjC] Allow the use of implemented unavailable methods from within
Alex Lorenz [Wed, 9 Jan 2019 22:31:37 +0000 (22:31 +0000)]
[ObjC] Allow the use of implemented unavailable methods from within
the @implementation context

In Objective-C, it's common for some frameworks to mark some methods like init
as unavailable in the @interface to prohibit their usage. However, these
frameworks then often implemented said method and refer to it in another method
that acts as a factory for that object. The recent change to how messages to
self are type checked in clang (r349841) introduced a regression which started
to prohibit this pattern with an X is unavailable error. This commit addresses
the aforementioned regression.

rdar://47134898

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

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

5 years ago[OpenMP] Avoid remainder operations for loop index values on a collapsed loop nest.
Gheorghe-Teodor Bercea [Wed, 9 Jan 2019 20:45:26 +0000 (20:45 +0000)]
[OpenMP] Avoid remainder operations for loop index values on a collapsed loop nest.

Summary: Change the strategy for computing loop index variables after collapsing a loop nest via the collapse clause by replacing the expensive remainder operation with multiplications and additions.

Reviewers: ABataev, caomhin

Reviewed By: ABataev

Subscribers: guansong, arphaman, cfe-commits

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

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

5 years ago[OpenMP] Add flag for preventing the extension to 64 bits for the collapse loop counter
Gheorghe-Teodor Bercea [Wed, 9 Jan 2019 20:38:35 +0000 (20:38 +0000)]
[OpenMP] Add flag for preventing the extension to 64 bits for the collapse loop counter

Summary: Introduce a compiler flag for cases when the user knows that the collapsed loop counter can be safely represented using at most 32 bits. This will prevent the emission of expensive mathematical operations (such as the div operation) on the iteration variable using 64 bits where 32 bit operations are sufficient.

Reviewers: ABataev, caomhin

Reviewed By: ABataev

Subscribers: hfinkel, kkwli0, guansong, cfe-commits

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

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

5 years ago[OPENMP][DOCS]Release notes/OpenMP support updates, NFC.
Alexey Bataev [Wed, 9 Jan 2019 20:32:56 +0000 (20:32 +0000)]
[OPENMP][DOCS]Release notes/OpenMP support updates, NFC.

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

5 years agoRemoving an include that was not necessary; NFC.
Aaron Ballman [Wed, 9 Jan 2019 20:15:10 +0000 (20:15 +0000)]
Removing an include that was not necessary; NFC.

The include also had a using namespace llvm in it, so this adds qualifiers where needed as well.

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

5 years ago[CodeGen] Clarify comment about COFF common symbol alignment
Shoaib Meenai [Wed, 9 Jan 2019 20:05:16 +0000 (20:05 +0000)]
[CodeGen] Clarify comment about COFF common symbol alignment

After a discussion on the commit thread, it seems the 32 byte alignment
limitation is an MSVC toolchain artifact, not an inherent COFF
restriction. Clarify the comment accordingly, since saying COFF in the
comment but using isKnownWindowsMSVCEnvironment in the conditional is
confusing. Also add a newline before the comment, which is consistent
with the local style.

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

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

5 years ago[AST] Move back BasePathSize to the bit-fields of CastExpr
Bruno Ricci [Wed, 9 Jan 2019 16:41:33 +0000 (16:41 +0000)]
[AST] Move back BasePathSize to the bit-fields of CastExpr

The number of trailing CXXBaseSpecifiers in CastExpr was moved from
CastExprBitfields to a trailing object in r338489 (D50050). At this time these
bit-fields classes were only 32 bits wide. However later r345459 widened these
bit-field classes to 64 bits.

The reason for this change was that on 64 bit archs alignment requirements
caused 4 bytes of padding after the Stmt sub-object in nearly all expression
classes. Reusing this padding yielded an >10% reduction in the size used by all
statement/expressions when parsing all of Boost (on a 64 bit arch). This
increased the size of statement/expressions for 32 bits archs, but this can be
mitigated by moving more data to the bit-fields of Stmt (and moreover most
people now care about 64 bits archs as a host).

Therefore move back the number of CXXBaseSpecifiers in CastExpr to the
bit-fields of Stmt. This in effect mostly revert r338489 while keeping the
added test.

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

Reviewed By: lebedev.ri

Reviewers: lebedev.ri, rjmccall

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

5 years agoIncorrect implicit data-sharing for nested tasks
Alexey Bataev [Wed, 9 Jan 2019 15:58:05 +0000 (15:58 +0000)]
Incorrect implicit data-sharing for nested tasks

Summary:
There is a minor issue in how the implicit data-sharings for nested tasks are computed.

For the following example:
```
int x;
#pragma omp task shared(x)
#pragma omp task
x++;
```
We compute an implicit data-sharing of shared for `x` in the second task although I think that it should be firstprivate. Below you can find the part of the OpenMP spec that covers this example:
- // In a task generating construct, if no default clause is present, a variable for which the data-sharing attribute is not determined by the rules above and that in the enclosing context is determined to be shared by all implicit tasks bound to the current team is shared.//
- //In a task generating construct, if no default clause is present, a variable for which the data-sharing attribute is not determined by the rules above is firstprivate.//

Since each implicit-task has its own copy of `x`, we shouldn't apply the first rule.

Reviewers: ABataev

Reviewed By: ABataev

Subscribers: cfe-commits, rogfer01

Tags: #openmp

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

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

5 years ago[AST] Store the results in OverloadExpr in a trailing array
Bruno Ricci [Wed, 9 Jan 2019 15:43:19 +0000 (15:43 +0000)]
[AST] Store the results in OverloadExpr in a trailing array

Use the newly available space in the bit-fields of Stmt to pack
OverloadExpr, UnresolvedLookupExpr and UnresolvedMemberExpr.

Additionally store the results in the overload set in a trailing array.
This saves 1 pointer + 8 bytes per UnresolvedLookupExpr and
UnresolvedMemberExpr.

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

Reviewed By: rjmccall

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

5 years agoRemove dependency-related arguments in clang-check.
Alexander Kornienko [Wed, 9 Jan 2019 15:00:06 +0000 (15:00 +0000)]
Remove dependency-related arguments in clang-check.

This is the default behavior of clang tools, but clang-check overrides default
argument adjusters for some reason.

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

5 years agoFix typo in comment
Nico Weber [Wed, 9 Jan 2019 14:19:16 +0000 (14:19 +0000)]
Fix typo in comment

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

5 years agoRevert r350648: "Fix clang for r350647: Missed a function rename"
Florian Hahn [Wed, 9 Jan 2019 13:30:47 +0000 (13:30 +0000)]
Revert r350648: "Fix clang for r350647: Missed a function rename"

The related commit r350647 breaks thread sanitizer on some macOS builders, e.g.
http://green.lab.llvm.org/green/job/clang-stage1-configure-RA/52725/

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

5 years ago[Driver] Fix libcxx detection on Darwin with clang run as ./clang
Ilya Biryukov [Wed, 9 Jan 2019 13:08:11 +0000 (13:08 +0000)]
[Driver] Fix libcxx detection on Darwin with clang run as ./clang

Summary:
By using '..' instead of fs::parent_path.

The intention of the code was to go from 'path/to/clang/bin' to
'path/to/clang/include'. In most cases parent_path works, however it
would fail when clang is run as './clang'.

This was noticed in Chromium's bug tracker, see
https://bugs.chromium.org/p/chromium/issues/detail?id=919761

Reviewers: arphaman, thakis, EricWF

Reviewed By: arphaman, thakis

Subscribers: christof, cfe-commits

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

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

5 years agoUse DeclSpec for quals in DeclaratorChunk::FunctionTypeInfo.
Anastasia Stulova [Wed, 9 Jan 2019 11:25:09 +0000 (11:25 +0000)]
Use DeclSpec for quals in DeclaratorChunk::FunctionTypeInfo.

Rather than duplicating data fields, use DeclSpec directly to store
the qualifiers for the functions/methods. This change doesn't handle
attributes yet and has to be extended further.

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

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

5 years ago[X86] Make the pointer arguments to avx512 gather/scatter intrinsics 'void*' to match...
Craig Topper [Wed, 9 Jan 2019 07:36:01 +0000 (07:36 +0000)]
[X86] Make the pointer arguments to avx512 gather/scatter intrinsics 'void*' to match gcc and Intel's documentation.

The avx2 gather intrinsics are documented to use 'int', 'long long', 'float', or 'double' *. So I'm leaving those. This matches gcc.

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

5 years ago[libclang] Fix the mismatched delete operator for ExprEvalResult
Alex Lorenz [Tue, 8 Jan 2019 23:28:37 +0000 (23:28 +0000)]
[libclang] Fix the mismatched delete operator for ExprEvalResult

The '.stringVal' field in ExprEvalResult is allocated using new[],
but was freed using a regular delete. That caused memory leaks in
the test from r350666.

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

5 years ago[ASTDump] NFC: Move dumpDeclRef to NodeDumper
Stephen Kelly [Tue, 8 Jan 2019 23:11:24 +0000 (23:11 +0000)]
[ASTDump] NFC: Move dumpDeclRef to NodeDumper

Reviewers: aaron.ballman

Subscribers: cfe-commits

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

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

5 years ago[Driver] Default to -fno-addrsig on Android.
Dan Albert [Tue, 8 Jan 2019 22:33:59 +0000 (22:33 +0000)]
[Driver] Default to -fno-addrsig on Android.

Summary: The Android NDK still uses GNU binutils by default.

Reviewers: srhines, pirama

Reviewed By: srhines

Subscribers: cfe-commits

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

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

5 years ago[libclang] Recommit r336590 with a fix for the memory leak in the test
Alex Lorenz [Tue, 8 Jan 2019 22:32:51 +0000 (22:32 +0000)]
[libclang] Recommit r336590 with a fix for the memory leak in the test

The original commit had a memory leak in the test has a leak as it doesn't
dispose of the evaluated cursor result.

This also contains the follow-up NFC refactoring commit r336591.

rdar://45893054

Original commit message:

[libclang] evalute compound statement cursors before trying to evaluate
the cursor like a declaration

This change fixes a bug in libclang in which it tries to evaluate a statement
cursor as a declaration cursor, because that statement still has a pointer to
the declaration parent.

rdar://38888477

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

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

5 years agoImplement the TreeStructure interface through the TextNodeDumper
Stephen Kelly [Tue, 8 Jan 2019 22:32:48 +0000 (22:32 +0000)]
Implement the TreeStructure interface through the TextNodeDumper

Summary:
This way, when the generic ASTTraverser is extracted from ASTDumper,
there can't be any problem related to ordering of class members, a
concern that was raised in https://reviews.llvm.org/D55337.

This will also preserve the property that the generic traverser does not
enforce any coupling between the NodeDumper and the TreeStructure.

 https://godbolt.org/z/PEtT1_

Reviewers: aaron.ballman, erichkeane

Subscribers: cfe-commits

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

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

5 years agoAndroid is not GNU, so don't claim that it is.
Dan Albert [Tue, 8 Jan 2019 22:31:19 +0000 (22:31 +0000)]
Android is not GNU, so don't claim that it is.

Reviewers: pirama, srhines

Reviewed By: srhines

Subscribers: kristina, cfe-commits

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

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

5 years ago[Sema] Teach Clang that aligned allocation is not supported with macosx10.13
Louis Dionne [Tue, 8 Jan 2019 20:26:56 +0000 (20:26 +0000)]
[Sema] Teach Clang that aligned allocation is not supported with macosx10.13

Summary:
r306722 added diagnostics when aligned allocation is used with deployment
targets that do not support it, but the first macosx supporting aligned
allocation was incorrectly set to 10.13. In reality, the dylib shipped
with macosx10.13 does not support aligned allocation, but the dylib
shipped with macosx10.14 does.

Reviewers: ahatanak

Subscribers: christof, jkorous, dexonsmith, cfe-commits

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

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

5 years agoFix clang for r350647: Missed a function rename
Philip Pfaffe [Tue, 8 Jan 2019 20:00:55 +0000 (20:00 +0000)]
Fix clang for r350647: Missed a function rename

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

5 years agoFix opencl test broken on windows by r350643.
Erich Keane [Tue, 8 Jan 2019 19:10:43 +0000 (19:10 +0000)]
Fix opencl test broken on windows by r350643.

Windows doesn't allow common with alignment >32 bits, so these tests
were broken in windows mode.  This patch makes 'common' optional in
these cases.

Change-Id: I4d5fdd07ecdafc3570ef9b09cd816c2e5e4ed15e

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

5 years ago[NFC] Don't over-eagerly check block alignment
JF Bastien [Tue, 8 Jan 2019 18:51:38 +0000 (18:51 +0000)]
[NFC] Don't over-eagerly check block alignment

Alignment of __block isn't relevant to this test, remove its checking.

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

5 years agoLimit COFF 'common' emission to <=32 alignment types.
Erich Keane [Tue, 8 Jan 2019 18:44:22 +0000 (18:44 +0000)]
Limit COFF 'common' emission to <=32 alignment types.

As reported in PR33035, LLVM crashes if given a common object with an
alignment of greater than 32 bits. This is because the COFF file format
does not support these alignments, so emitting them is broken anyway.

This patch changes any global definitions greater than 32 bit alignment
to no longer be in 'common'.

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

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

Change-Id: I48609289753b7f3b58c5e2bc1712756750fbd45a

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

5 years ago__has_feature(pragma_clang_attribute_namespaces) should be __has_extension
Erik Pilkington [Tue, 8 Jan 2019 18:24:39 +0000 (18:24 +0000)]
__has_feature(pragma_clang_attribute_namespaces) should be __has_extension

Thanks to Richard Smith for pointing this out.

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

5 years agoRename DIFlagFixedEnum to DIFlagEnumClass. NFC
Paul Robinson [Tue, 8 Jan 2019 17:52:29 +0000 (17:52 +0000)]
Rename DIFlagFixedEnum to DIFlagEnumClass. NFC

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

5 years agoRevert "Split -Wdelete-non-virtual-dtor into -Wdelete-abstract-non-virtual-dtor"
Erik Pilkington [Tue, 8 Jan 2019 17:04:38 +0000 (17:04 +0000)]
Revert "Split -Wdelete-non-virtual-dtor into -Wdelete-abstract-non-virtual-dtor"

This reverts commit r350585. There was some late post-commit review
on phab.

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

5 years agoFix use-after-free bug in Tooling.
Alexander Kornienko [Tue, 8 Jan 2019 16:55:13 +0000 (16:55 +0000)]
Fix use-after-free bug in Tooling.

Summary:
`buildASTFromCodeWithArgs()` was creating a memory buffer referencing a
stack-allocated string.  This diff changes the implementation to copy the code
string into the memory buffer so that said buffer owns the memory.

Patch by Yitzhak Mandelbaum.

Reviewers: alexfh

Reviewed By: alexfh

Subscribers: cfe-commits, EricWF

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

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

5 years agoDon't emit DW_AT_enum_class unless it's actually an 'enum class'.
Paul Robinson [Tue, 8 Jan 2019 16:28:11 +0000 (16:28 +0000)]
Don't emit DW_AT_enum_class unless it's actually an 'enum class'.

Finishes off the functional part of PR36168.

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

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

5 years ago[AST][NFC] Pack CXXScalarValueInitExpr
Bruno Ricci [Tue, 8 Jan 2019 16:08:54 +0000 (16:08 +0000)]
[AST][NFC] Pack CXXScalarValueInitExpr

Use the newly available space in the bit-fields of Stmt.
This saves one pointer per CXXScalarValueInitExpr. NFC.

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

5 years ago[OPENMP]Fix PR40191: Do not allow orphaned cancellation constructs.
Alexey Bataev [Tue, 8 Jan 2019 15:53:42 +0000 (15:53 +0000)]
[OPENMP]Fix PR40191: Do not allow orphaned cancellation constructs.

Prohibited use of the orphaned cancellation directives.

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

5 years ago[AST][NFC] Pack CXXNoexceptExpr and SubstNonTypeTemplateParmExpr
Bruno Ricci [Tue, 8 Jan 2019 14:44:34 +0000 (14:44 +0000)]
[AST][NFC] Pack CXXNoexceptExpr and SubstNonTypeTemplateParmExpr

Use the newly available space in the bit-fields of Stmt.
This saves one pointer per CXXNoexceptExpr/SubstNonTypeTemplateParmExpr.

Use this opportunity to run clang-format on these two classes and
fix some style issues. NFC overall.

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

5 years ago[AST] Pack CXXDependentScopeMemberExpr
Bruno Ricci [Tue, 8 Jan 2019 14:17:00 +0000 (14:17 +0000)]
[AST] Pack CXXDependentScopeMemberExpr

Use the newly available space in the bit-fields of Stmt. Additionally store
FirstQualifierFoundInScope as a trailing object since it is most of the time
null (non-null for 2 of the 35446 CXXDependentScopeMemberExpr when parsing
all of Boost).

It would be possible to move the data for the nested-name-specifier to a
trailing object too to save another 2 pointers, however doing so did actually
regress the time taken to parse all of Boost slightly.

This saves 8 bytes + 1 pointer per CXXDependentScopeMemberExpr in the vast
majority of cases.

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

Reviewed By: rjmccall

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

5 years ago[Sema] Diagnose array access preceding the array bounds even when the base type is...
Bruno Ricci [Tue, 8 Jan 2019 13:52:54 +0000 (13:52 +0000)]
[Sema] Diagnose array access preceding the array bounds even when the base type is incomplete.

When the type of the base expression after IgnoreParenCasts is incomplete,
it is still possible to diagnose an array access which precedes the array
bounds.

This is a follow-up on D55862 which added an early return when the type of
the base expression after IgnoreParenCasts was incomplete.

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

Reviewed By: efriedma

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

5 years ago[X86] Add shift-by-immediate tests for non-immediate/out-of-range values
Simon Pilgrim [Tue, 8 Jan 2019 12:59:15 +0000 (12:59 +0000)]
[X86] Add shift-by-immediate tests for non-immediate/out-of-range values

As noted on PR40203, for gcc compatibility we need to support non-immediate values in the 'slli/srli/srai' shift by immediate vector intrinsics.

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

5 years ago[ASTMatchers] Improve assert message for broken parent map.
Sam McCall [Tue, 8 Jan 2019 07:29:46 +0000 (07:29 +0000)]
[ASTMatchers] Improve assert message for broken parent map.

Summary:
This assert catches places where the AST (as seen by RecursiveASTVisitor)
becomes disconnected due to incomplete traversal.
Making it print the actual parent-less node is a lot more helpful - it's
possible to work out which part of the tree wasn't traversed.

Reviewers: ilya-biryukov

Subscribers: cfe-commits

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

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

5 years agoSplit -Wdelete-non-virtual-dtor into -Wdelete-abstract-non-virtual-dtor
Erik Pilkington [Tue, 8 Jan 2019 00:21:05 +0000 (00:21 +0000)]
Split -Wdelete-non-virtual-dtor into -Wdelete-abstract-non-virtual-dtor

-Wdelete-non-virtual-dtor previously controlled two diagnostics: 1)
calling a non-virtual dtor from an abstract class, and 2) calling a
non-virtual dtor from a polymorphic class. 1) is a lot more severe
than 2), since 1) is a guaranteed crash, but 2) is just "code smell".
Previously, projects compiled with -Wall -Wno-delete-non-virtual-dtor,
which is somewhat reasonable, silently crashed on 1).

rdar://40380564

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

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

5 years agoNFC: Replace asserts with if() in SourceLocation accessors
Stephen Kelly [Mon, 7 Jan 2019 21:57:30 +0000 (21:57 +0000)]
NFC: Replace asserts with if() in SourceLocation accessors

Summary:
Nowhere else in the AST classes assert on these kinds of accessors.

This way, we can call the accessors and check the validity of the result
instead of externally duplicating the conditions.  This generality will
make it possible to introspect instances for source locations:

 http://ec2-18-191-7-3.us-east-2.compute.amazonaws.com:10240/z/iiaWhw

Reviewers: aaron.ballman

Subscribers: cfe-commits

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

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

5 years agoAdd a __has_feature check for namespaces on #pragma clang attribute.
Erik Pilkington [Mon, 7 Jan 2019 21:54:00 +0000 (21:54 +0000)]
Add a __has_feature check for namespaces on #pragma clang attribute.

Support for this was added in r349845.

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

5 years ago[OPENMP]Add call to __kmpc_push_target_tripcount() function.
Alexey Bataev [Mon, 7 Jan 2019 21:30:43 +0000 (21:30 +0000)]
[OPENMP]Add call to __kmpc_push_target_tripcount() function.

Each we create the target regions with the teams distribute inner
region, we can better estimate number of the teams required to execute
the target region. Function __kmpc_push_target_tripcount() is used for
purpose, which accepts device_id and the number of the iterations,
performed by the associated loop.

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

5 years agoRecommit r350555 "[X86] Use funnel shift intrinsics for the VBMI2 vshld/vshrd builtins."
Craig Topper [Mon, 7 Jan 2019 21:00:41 +0000 (21:00 +0000)]
Recommit r350555 "[X86] Use funnel shift intrinsics for the VBMI2 vshld/vshrd builtins."

The MSVC limit hit in AutoUpgrade.cpp has been worked around for now.

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

5 years agoRevert r350555 "[X86] Use funnel shift intrinsics for the VBMI2 vshld/vshrd builtins."
Craig Topper [Mon, 7 Jan 2019 19:39:25 +0000 (19:39 +0000)]
Revert r350555 "[X86] Use funnel shift intrinsics for the VBMI2 vshld/vshrd builtins."

Had to revert the LLVM patch this depends on to fix a MSVC compiler limit in AutoUpgrade.cpp

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

5 years ago[X86] Use funnel shift intrinsics for the VBMI2 vshld/vshrd builtins.
Craig Topper [Mon, 7 Jan 2019 19:10:22 +0000 (19:10 +0000)]
[X86] Use funnel shift intrinsics for the VBMI2 vshld/vshrd builtins.

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

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

5 years ago[OPENMP][NVPTX]Reduce number of barriers in reductions.
Alexey Bataev [Mon, 7 Jan 2019 15:45:09 +0000 (15:45 +0000)]
[OPENMP][NVPTX]Reduce number of barriers in reductions.

After the fix for the syncthreads we don't need to generate extra
barriers for the parallel reductions.

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

5 years ago[Sema] Fix unused variable warning in Release builds
Benjamin Kramer [Mon, 7 Jan 2019 15:22:08 +0000 (15:22 +0000)]
[Sema] Fix unused variable warning in Release builds

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

5 years ago[analyzer] Pass the correct loc Expr from VisitIncDecOp to evalStore
Rafael Stahl [Mon, 7 Jan 2019 15:07:01 +0000 (15:07 +0000)]
[analyzer] Pass the correct loc Expr from VisitIncDecOp to evalStore

Summary: The LocationE parameter of evalStore is documented as "The location expression that is stored to". When storing from an increment / decrement operator this was not satisfied. In user code this causes an inconsistency between the SVal and Stmt parameters of checkLocation.

Reviewers: NoQ, dcoughlin, george.karpenkov

Reviewed By: NoQ

Subscribers: xazax.hun, baloghadamsoftware, szepet, a.sidorin, mikhail.ramalho, Szelethus, donat.nagy, dkrupp, cfe-commits

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

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

5 years ago[AST] Store some data of CXXNewExpr as trailing objects
Bruno Ricci [Mon, 7 Jan 2019 15:04:45 +0000 (15:04 +0000)]
[AST] Store some data of CXXNewExpr as trailing objects

Store the optional array size expression, optional initialization expression
and optional placement new arguments in a trailing array. Additionally store
the range for the parenthesized type-id in a trailing object if needed since
in the vast majority of cases the type is not parenthesized (not a single new
expression in the translation unit of SemaDecl.cpp has a parenthesized type-id).

This saves 2 pointers per CXXNewExpr in all cases, and 2 pointers + 8 bytes
per CXXNewExpr in the common case where the type is not parenthesized.

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

Reviewed By: rjmccall

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

5 years ago[AST][NFC] Pack DependentScopeDeclRefExpr and CXXUnresolvedConstructExpr
Bruno Ricci [Mon, 7 Jan 2019 14:27:04 +0000 (14:27 +0000)]
[AST][NFC] Pack DependentScopeDeclRefExpr and CXXUnresolvedConstructExpr

Use the newly available space in the bit-fields of Stmt.
This saves 1 pointer per DependentScopeDeclRefExpr/CXXUnresolvedConstructExpr.

Additionally rename "TypeSourceInfo *Type;" to "TypeSourceInfo *TSI;"
as was done in D56022 (r350003) (but this is an internal detail anyway),
and clang-format both classes. NFC.

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

5 years ago[clang] Add AST matcher for initializer list members
Hyrum Wright [Mon, 7 Jan 2019 14:14:36 +0000 (14:14 +0000)]
[clang] Add AST matcher for initializer list members

Summary:
Much like hasArg for various call expressions, this allows LibTooling users to
match against a member of an initializer list.

This is currently being used as part of the abseil-duration-scale clang-tidy
check.

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

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

5 years ago[CTU] Make loadExternalAST return with non nullptr on success
Gabor Marton [Mon, 7 Jan 2019 14:05:19 +0000 (14:05 +0000)]
[CTU] Make loadExternalAST return with non nullptr on success

Summary:
In loadExternalAST we return with either an error or with a valid
ASTUnit pointer which should not be a nullptr.
This prevents in the call site any superfluous check for being a nullptr.

Reviewers: xazax.hun, a_sidorin, Szelethus, balazske

Subscribers: rnkovacs, dkrupp, gamesh411, cfe-commits

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

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

5 years ago[AST][NFC] Pack OpaqueValueExpr
Bruno Ricci [Mon, 7 Jan 2019 13:39:26 +0000 (13:39 +0000)]
[AST][NFC] Pack OpaqueValueExpr

Use the newly available space in the bit-fields of Stmt.
This saves 1 pointer per OpaqueValueExpr. NFC.

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

5 years agoclang-format: [JS] support goog.requireType.
Martin Probst [Mon, 7 Jan 2019 13:12:50 +0000 (13:12 +0000)]
clang-format: [JS] support goog.requireType.

Summary:
It's a new primitive for importing symbols, and should be treated like
the (previously handled) `goog.require` and `goog.forwardDeclare`.

Reviewers: krasimir

Subscribers: cfe-commits

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

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

5 years ago[X86] Update VBMI2 vshld/vshrd tests to use an immediate that doesn't require a modulo.
Craig Topper [Mon, 7 Jan 2019 06:01:58 +0000 (06:01 +0000)]
[X86] Update VBMI2 vshld/vshrd tests to use an immediate that doesn't require a modulo.

Planning to replace these with funnel shift intrinsics which would mask out the extra bits. This will help minimize test diffs.

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

5 years agoDR674, PR38883, PR40238: Qualified friend lookup should look for a
Richard Smith [Mon, 7 Jan 2019 06:00:46 +0000 (06:00 +0000)]
DR674, PR38883, PR40238: Qualified friend lookup should look for a
template specialization if there is no matching non-template function.

This exposed a couple of related bugs:
 - we would sometimes substitute into a friend template instead of a
   suitable non-friend declaration; this would now crash because we'd
   decide the specialization of the friend is a redeclaration of itself
 - ADL failed to properly handle the case where an invisible local
   extern declaration redeclares an invisible friend

Both are fixed herein: in particular, we now never make invisible
friends or local extern declarations visible to name lookup unless
they are the only declaration of the entity. (We already mostly did
this for local extern declarations.)

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

5 years ago[SemaCXX] Fix ICE for unexpanded parameter pack
Brian Gesiak [Mon, 7 Jan 2019 03:25:59 +0000 (03:25 +0000)]
[SemaCXX] Fix ICE for unexpanded parameter pack

Summary:
The documentation for RecursiveASTVisitor::TraverseDecl states that the
Decl being traversed may be null. In fact, this is the case when a
CXXCatchStmt with no exception decl is traversed. Because the visitor
for diagnosing unexpanded parameter packs does not check for null, it
ends up crashing when it attempts to call the Decl::isParameterPack
method on a null Decl pointer.

Add a null check to prevent an ICE, and a test case that would crash
otherwise. Also, because the test requires C++ exceptions and C++14,
change the test parameters for the entire test file. (Alternatively, I
thought about adding a new test file, but went with this approach for my
own convenience.)

Co-authored-by: Andreas Molzer <andreas.molzer@gmx.de>
Co-authored-by: Mara Bos <m-ou.se@m-ou.se>
Reviewers: rsmith

Reviewed By: rsmith

Subscribers: cfe-commits

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

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

5 years agoFix bug in test found by the diagnostic added in r350340.
Nico Weber [Sun, 6 Jan 2019 15:57:18 +0000 (15:57 +0000)]
Fix bug in test found by the diagnostic added in r350340.

I meant to commit this change in 350341 but failed to do so (since it's
in test/CodeGenCXX, not in test/Frontend).

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

5 years ago[CMake] Use hidden visibility for static libc++ in Fuchsia
Petr Hosek [Sun, 6 Jan 2019 08:23:56 +0000 (08:23 +0000)]
[CMake] Use hidden visibility for static libc++ in Fuchsia

This is enables the use of libc++ in contexts such as device drivers.

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

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

5 years agoHave MSVC Visualizer for DeducedTemplateSpecializationType show both the original...
Mike Spertus [Sun, 6 Jan 2019 04:58:48 +0000 (04:58 +0000)]
Have MSVC Visualizer for DeducedTemplateSpecializationType show both the original template and deduced specialization

Now appears in the Autos window something like

- MyType DeducedTemplateSpecializationType  {struct Y<int>}
|- Template template<typename T> struct Y;
|- Deduced As struct Y<int>
|- isDeduced true bool
|- TypeClass DeducedTemplateSpecialization (36)
|- Flags No TypeBits set beyond TypeClass
|- Canonical RecordType  {struct Y<int>}

Also changed QualType visualization to auto-expand the BaseType

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

5 years ago[CMake][Fuchsia] Enable build ID, relaxations for first stage
Petr Hosek [Sun, 6 Jan 2019 04:14:51 +0000 (04:14 +0000)]
[CMake][Fuchsia] Enable build ID, relaxations for first stage

We want these to be used for the second stage compiler as well.

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

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

5 years agoRevert "[CMake][Fuchsia] Enable experimental new pass manager by default"
Petr Hosek [Sat, 5 Jan 2019 23:45:31 +0000 (23:45 +0000)]
Revert "[CMake][Fuchsia] Enable experimental new pass manager by default"

This reverts commit r350461 as it causes many of the Clang tests to fail.

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

5 years agoFix MSVC Visualization for TemplateTypeParmType and TemplateTypeParmDecl
Mike Spertus [Sat, 5 Jan 2019 23:15:30 +0000 (23:15 +0000)]
Fix MSVC Visualization for TemplateTypeParmType and TemplateTypeParmDecl

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

5 years agoCodeGen: fix autolink emission on ELF
Saleem Abdulrasool [Sat, 5 Jan 2019 19:27:12 +0000 (19:27 +0000)]
CodeGen: fix autolink emission on ELF

The autolinking extension for ELF uses a slightly different format for
encoding the autolink information compared to COFF and MachO.  Account
for this in the CGM to ensure that we do not assert when emitting
assembly or an object file.

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

5 years agoCodeGen: switch iteration to range based for loop (NFC)
Saleem Abdulrasool [Sat, 5 Jan 2019 18:39:32 +0000 (18:39 +0000)]
CodeGen: switch iteration to range based for loop (NFC)

Change a loop to range based instead while working on cleaning up some
modules autolinking issues on Linux.  NFC.

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

5 years agoImprove MSVC type visualizations
Mike Spertus [Sat, 5 Jan 2019 17:01:34 +0000 (17:01 +0000)]
Improve MSVC type visualizations

Display TypeBits in a single line.
Fix bit rot in template visualizations
Rudimentary support for deduced types

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

5 years ago[python] Make the collections import future-proof
Serge Guelton [Sat, 5 Jan 2019 12:07:36 +0000 (12:07 +0000)]
[python] Make the collections import future-proof

On Python 3.7 the old code raises a warning:

DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
     class ArgumentsIterator(collections.Sequence):

On Python 3.8 it wouldn't work anymore.

Commited on behalf of Jakub Stasiak.

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

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

5 years ago[CMake][Fuchsia] Enable experimental new pass manager by default
Petr Hosek [Sat, 5 Jan 2019 07:57:53 +0000 (07:57 +0000)]
[CMake][Fuchsia] Enable experimental new pass manager by default

This change enableds experimental new pass manager.

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

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

5 years ago[CMake][Fuchsia] Enable x86 relaxation by default
Petr Hosek [Sat, 5 Jan 2019 07:57:46 +0000 (07:57 +0000)]
[CMake][Fuchsia] Enable x86 relaxation by default

This enables x86 relaxation by default. This depends on a linker new
enough to support the new reloc types but since we default to lld we
don't worry about host system linkers that might be too old to support
the new reloc types.

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

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

5 years ago[CMake][Fuchsia] Enable --build-id linker flag by default
Petr Hosek [Sat, 5 Jan 2019 07:57:38 +0000 (07:57 +0000)]
[CMake][Fuchsia] Enable --build-id linker flag by default

This enables passing --build-id to linker by default.

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

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

5 years agoLet new test from r350340 still pass even after r350451.
Nico Weber [Sat, 5 Jan 2019 01:19:14 +0000 (01:19 +0000)]
Let new test from r350340 still pass even after r350451.

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

5 years agoMove -add-plugin validation after -load was executed.
Nico Weber [Sat, 5 Jan 2019 01:10:20 +0000 (01:10 +0000)]
Move -add-plugin validation after -load was executed.

Moves the code added in r350340 around a bit, to hopefully make the existing
plugin tests pass when clang is built with examples enabled.

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

5 years ago[OpenMP] Refactor const restriction for linear
Joel E. Denny [Fri, 4 Jan 2019 22:12:13 +0000 (22:12 +0000)]
[OpenMP] Refactor const restriction for linear

As discussed in D56113, this patch refactors the implementation of the
const restriction for linear to reuse a function introduced by D56113.
A side effect is that, if a variable has mutable members, this
diagnostic is now skipped, and the diagnostic for the variable not
being an integer or pointer is reported instead.

Reviewed By: ABataev

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

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

5 years ago[OpenMP] Refactor const restriction for reductions
Joel E. Denny [Fri, 4 Jan 2019 22:11:56 +0000 (22:11 +0000)]
[OpenMP] Refactor const restriction for reductions

As discussed in D56113, this patch refactors the implementation of the
const restriction for reductions to reuse a function introduced by
D56113.  A side effect is that diagnostics sometimes now say
"variable" instead of "list item" when a list item is a variable.

Reviewed By: ABataev

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

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

5 years ago[OpenMP] Replace predetermined shared for const variable
Joel E. Denny [Fri, 4 Jan 2019 22:11:31 +0000 (22:11 +0000)]
[OpenMP] Replace predetermined shared for const variable

The following appears in OpenMP 3.1 sec. 2.9.1.1 as a predetermined
data-sharing attribute:

> Variables with const-qualified type having no mutable member are
> shared.

It does not appear in OpenmP 4.0, 4.5, or 5.0.  This patch removes the
implementation of that attribute when the requested OpenMP version is
greater than 3.1.

One effect of that removal is that `default(none)` affects const
variables without mutable members.

Also, without this patch, if a const variable without mutable members
was explicitly lastprivate or private, it was an error because it was
predetermined shared.  Now, clang instead complains that it's const
without mutable fields, which is a more intelligible diagnostic.  That
should be fine for all of the above versions because they all have
something like the following, which is quoted from OpenMP 5.0
sec. 2.19.3:

> A variable that is privatized must not have a const-qualified type
> unless it is of class type with a mutable member. This restriction does
> not apply to the firstprivate clause.

reduction and linear clauses already have separate checks for const
variables.  Future patches will merge the implementations.

Reviewed By: ABataev

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

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

5 years agoFix default-function-attr.c so that it works on Windows.
Peter Collingbourne [Fri, 4 Jan 2019 20:51:54 +0000 (20:51 +0000)]
Fix default-function-attr.c so that it works on Windows.

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

5 years agohwasan: Implement lazy thread initialization for the interceptor ABI.
Peter Collingbourne [Fri, 4 Jan 2019 19:27:04 +0000 (19:27 +0000)]
hwasan: Implement lazy thread initialization for the interceptor ABI.

The problem is similar to D55986 but for threads: a process with the
interceptor hwasan library loaded might have some threads started by
instrumented libraries and some by uninstrumented libraries, and we
need to be able to run instrumented code on the latter.

The solution is to perform per-thread initialization lazily. If a
function needs to access shadow memory or add itself to the per-thread
ring buffer its prologue checks to see whether the value in the
sanitizer TLS slot is null, and if so it calls __hwasan_thread_enter
and reloads from the TLS slot. The runtime does the same thing if it
needs to access this data structure.

This change means that the code generator needs to know whether we
are targeting the interceptor runtime, since we don't want to pay
the cost of lazy initialization when targeting a platform with native
hwasan support. A flag -fsanitize-hwaddress-abi={interceptor,platform}
has been introduced for selecting the runtime ABI to target. The
default ABI is set to interceptor since it's assumed that it will
be more common that users will be compiling application code than
platform code.

Because we can no longer assume that the TLS slot is initialized,
the pthread_create interceptor is no longer necessary, so it has
been removed.

Ideally, lazy initialization should only cost one instruction in the
hot path, but at present the call may cause us to spill arguments
to the stack, which means more instructions in the hot path (or
theoretically in the cold path if the spills are moved with shrink
wrapping). With an appropriately chosen calling convention for
the per-thread initialization function (TODO) the hot path should
always need just one instruction and the cold path should need two
instructions with no spilling required.

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

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

5 years ago[HIP][DRIVER][OFFLOAD] Do not unbundle unsupported file types
Aaron Enye Shi [Fri, 4 Jan 2019 19:09:20 +0000 (19:09 +0000)]
[HIP][DRIVER][OFFLOAD] Do not unbundle unsupported file types

The offload bundler action should not unbundle the input file types that does not match the action type. This fixes an issue where .so files are unbundled when the action type is object files.

Reviewers: yaxunl

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

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

5 years ago[HIP][DRIVER][OFFLOAD] Do not unbundle unsupported file types
Aaron Enye Shi [Fri, 4 Jan 2019 19:05:41 +0000 (19:05 +0000)]
[HIP][DRIVER][OFFLOAD] Do not unbundle unsupported file types

The offload bundler action should not unbundle the input file types that does not match the action type. This fixes an issue where .so files are unbundled when the action type is object files.

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

5 years ago[ThinLTO] Clang changes to utilize new pass to handle chains of aliases
Teresa Johnson [Fri, 4 Jan 2019 19:05:01 +0000 (19:05 +0000)]
[ThinLTO] Clang changes to utilize new pass to handle chains of aliases

Summary:
As with NameAnonGlobals, invoke the new CanonicalizeAliases via clang
when using the new PM.

Depends on D54507.

Reviewers: pcc, davidxl

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

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

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

5 years ago[ObjCARC] Add an new attribute, objc_externally_retained
Erik Pilkington [Fri, 4 Jan 2019 18:33:06 +0000 (18:33 +0000)]
[ObjCARC] Add an new attribute, objc_externally_retained

This attribute, called "objc_externally_retained", exposes clang's
notion of pseudo-__strong variables in ARC. Pseudo-strong variables
"borrow" their initializer, meaning that they don't retain/release
it, instead assuming that someone else is keeping their value alive.

If a function is annotated with this attribute, implicitly strong
parameters of that function aren't implicitly retained/released in
the function body, and are implicitly const. This is useful to expose
for performance reasons, most functions don't need the extra safety
of the retain/release, so programmers can opt out as needed.

This attribute can also apply to declarations of local variables,
with similar effect.

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

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

5 years ago[OPENMP][NVPTX]Use new functions from the runtime library.
Alexey Bataev [Fri, 4 Jan 2019 17:25:09 +0000 (17:25 +0000)]
[OPENMP][NVPTX]Use new functions from the runtime library.

Updated codegen to use the new functions from the runtime library.

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

5 years agoAdd two new pragmas for controlling software pipelining optimizations.
Aaron Ballman [Fri, 4 Jan 2019 17:20:00 +0000 (17:20 +0000)]
Add two new pragmas for controlling software pipelining optimizations.

This patch adds #pragma clang loop pipeline and #pragma clang loop pipeline_initiation_interval for debugging or reducing compile time purposes. It is possible to disable SWP for concrete loops to save compilation time or to find bugs by not doing SWP to certain loops. It is possible to set value of initiation interval to concrete number to save compilation time by not doing extra pipeliner passes or to check created schedule for specific initiation interval.

Patch by Alexey Lapshin.

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

5 years agoRefactor the way we handle diagnosing unused expression results.
Aaron Ballman [Fri, 4 Jan 2019 16:58:14 +0000 (16:58 +0000)]
Refactor the way we handle diagnosing unused expression results.

Rather than sprinkle calls to DiagnoseUnusedExprResult() around in places where we want diagnostics, we now diagnose unused expression statements and full expressions in a more generic way when acting on the final expression statement. This results in more appropriate diagnostics for [[nodiscard]] where we were previously lacking them, such as when the body of a for loop is not a compound statement.

This patch fixes PR39837.

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

5 years agoPrevent unreachable when checking invalid multiversion decls.
Erich Keane [Fri, 4 Jan 2019 15:24:06 +0000 (15:24 +0000)]
Prevent unreachable when checking invalid multiversion decls.

CPUSpecifc/CPUDispatch call resolution assumed that all declarations
that would be passed are valid, however this was an invalid assumption.
This patch deals with those situations by making the valid version take
priority.  Note that the checked ordering is arbitrary, since both are
replaced by calls to the resolver later.

Change-Id: I7ff2ec88c55a721d51bc1f39ea1a1fe242b4e45f

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

5 years ago[Basic] Extend DiagnosticEngine to store and format Qualifiers.
Anastasia Stulova [Fri, 4 Jan 2019 11:50:36 +0000 (11:50 +0000)]
[Basic] Extend DiagnosticEngine to store and format Qualifiers.

Qualifiers can now be streamed into the DiagnosticEngine using
regular << operator. If Qualifiers are empty 'unqualified' will
be printed in the diagnostic otherwise regular qual syntax is
used.

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

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

5 years agoAdopt SwiftABIInfo for WebAssembly.
Daniel Dunbar [Thu, 3 Jan 2019 23:24:50 +0000 (23:24 +0000)]
Adopt SwiftABIInfo for WebAssembly.

Summary:
 - This adopts SwiftABIInfo as the base class for WebAssemblyABIInfo, which is in keeping with what is done for other targets for which Swift is supported.

 - This is a minimal patch to unblock exploration of WASM support for Swift (https://bugs.swift.org/browse/SR-9307)

Reviewers: rjmccall, sunfish

Reviewed By: rjmccall

Subscribers: ahti, dschuff, sbc100, jgravelle-google, aheejin, cfe-commits

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

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

5 years agoFix MSVC visualizations for ActionResult and OpaquePtr
Mike Spertus [Thu, 3 Jan 2019 23:24:39 +0000 (23:24 +0000)]
Fix MSVC visualizations for ActionResult and OpaquePtr

Mainly just fixing buggy code. Also removed unnecessary visualizers
for specializations of OpaquePtr

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