]> granicus.if.org Git - clang/log
clang
5 years agoDefer capture initialization for blocks until after we've left the
Richard Smith [Fri, 31 May 2019 00:45:09 +0000 (00:45 +0000)]
Defer capture initialization for blocks until after we've left the
function scope.

This removes one of the last few cases where we build expressions in the
wrong function scope context. No functionality change intended.

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

5 years agoRefactor OpenMP stack management.
Richard Smith [Thu, 30 May 2019 23:21:14 +0000 (23:21 +0000)]
Refactor OpenMP stack management.

Instead of duplicating access to the directive stack throughout
SemaOpenMP.cpp, consolidate it to a few methods and call those
everywhere else. In passing, simplify adjacent code where possible.

No functionality change intended.

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

5 years agoFix "fallthrough annotation in unreachable code" warning.
Richard Smith [Thu, 30 May 2019 23:21:13 +0000 (23:21 +0000)]
Fix "fallthrough annotation in unreachable code" warning.

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

5 years agoAdd enums as global variables in the IR metadata.
Amy Huang [Thu, 30 May 2019 22:04:11 +0000 (22:04 +0000)]
Add enums as global variables in the IR metadata.

Summary:
Keeps track of the enums that were used by saving them as DIGlobalVariables,
since CodeView emits debug info for global constants.

Reviewers: rnk

Subscribers: aprantl, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

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

5 years ago[Remarks][NFC] Move the serialization to lib/Remarks
Francis Visoiu Mistrih [Thu, 30 May 2019 21:45:59 +0000 (21:45 +0000)]
[Remarks][NFC] Move the serialization to lib/Remarks

Separate the remark serialization to YAML from the LLVM Diagnostics.

This adds a new serialization abstraction: remarks::Serializer. It's
completely independent from lib/IR and it provides an easy way to
replace YAML by providing a new remarks::Serializer.

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

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

5 years agoFix constexpr __builtin_*_overflow issue when unsigned->signed operand.
Erich Keane [Thu, 30 May 2019 21:35:32 +0000 (21:35 +0000)]
Fix constexpr __builtin_*_overflow issue when unsigned->signed operand.

As reported here https://bugs.llvm.org/show_bug.cgi?id=42000, it was
possible to get the constexpr version of __builtin_*_overflow to give
the wrong answer.

This was because when extending the operands to fit the largest type (so
that the math could be done), the decision on whether to sign/zero
extend the operands was based on the result signedness, not on the
operands signedness.

In the reported case, (unsigned char)255 - (int)100 needed
to have each extended to the int in order to do the math.  However, when
extending the first operand to 'int', we incorrectly sign extended it
instead of zero extending.  Thus, the result didnt fit back into the
unsigned char.

The fix for this was simply to choose zero/sign extension based on the
sign of the operand itself.

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

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

5 years ago[c++2a] Fix assertion failure if we would walk over more than one level
Richard Smith [Thu, 30 May 2019 20:45:12 +0000 (20:45 +0000)]
[c++2a] Fix assertion failure if we would walk over more than one level
of derived-to-base conversion path when implicitly starting union
subobject lifetimes in constant evaluation.

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

5 years agoMark test as requiring an ARM target.
Douglas Yung [Thu, 30 May 2019 20:02:51 +0000 (20:02 +0000)]
Mark test as requiring an ARM target.

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

5 years ago[GWP-ASan] Mutex implementation [2].
Mitch Phillips [Thu, 30 May 2019 19:45:32 +0000 (19:45 +0000)]
[GWP-ASan] Mutex implementation [2].

Summary:
See D60593 for further information.
This patch pulls out the mutex implementation and the required definitions file.

We implement our own mutex for GWP-ASan currently, because:

1. We must be compatible with the sum of the most restrictive elements of the supporting allocator's build system. Current targets for GWP-ASan include Scudo (on Linux and Fuchsia), and bionic (on Android).
2. Scudo specifies `-nostdlib++ -nonodefaultlibs`, meaning we can't use `std::mutex` or `mtx_t`.
3. We can't use `sanitizer_common`'s mutex, as the supporting allocators cannot afford the extra maintenance (Android, Fuchsia) and code size (Fuchsia) overheads that this would incur.

In future, we would like to implement a shared base mutex for GWP-ASan, Scudo and sanitizer_common. This will likely happen when both GWP-ASan and Scudo standalone are not in the development phase, at which point they will have stable requirements.

Reviewers: vlad.tsyrklevich, morehouse, jfb

Reviewed By: morehouse

Subscribers: dexonsmith, srhines, cfe-commits, kubamracek, mgorny, cryptoad, jfb, #sanitizers, llvm-commits, vitalybuka, eugenis

Tags: #sanitizers, #llvm, #clang

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

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

5 years agoReapply: LLVM IR: update Clang tests for byval being a typed attribute.
Tim Northover [Thu, 30 May 2019 18:49:19 +0000 (18:49 +0000)]
Reapply: LLVM IR: update Clang tests for byval being a typed attribute.

Since byval is now a typed attribute it gets sorted slightly differently by
LLVM when the order of attributes is being canonicalized. This updates the few
Clang tests that depend on the old order.

Clang patch is unchanged.

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

5 years agoAdd Attribute NoThrow as an Exception Specifier Type
Erich Keane [Thu, 30 May 2019 17:31:54 +0000 (17:31 +0000)]
Add Attribute NoThrow as an Exception Specifier Type

In response to https://bugs.llvm.org/show_bug.cgi?id=33235, it became
clear that the current mechanism of hacking through checks for the
exception specification of a function gets confused really quickly when
there are alternate exception specifiers.

This patch introcues EST_NoThrow, which is the equivilent of
EST_noexcept when caused by EST_noThrow. The existing implementation is
left in place to cover functions with no FunctionProtoType.

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

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

5 years ago[Docs] Modernize references to macOS
J. Ryan Stinnett [Thu, 30 May 2019 16:46:22 +0000 (16:46 +0000)]
[Docs] Modernize references to macOS

Summary:
This updates all places in documentation that refer to "Mac OS X", "OS X", etc.
to instead use the modern name "macOS" when no specific version number is
mentioned.

If a specific version is mentioned, this attempts to use the OS name at the time
of that version:

* Mac OS X for 10.0 - 10.7
* OS X for 10.8 - 10.11
* macOS for 10.12 - present

Reviewers: JDevlieghere

Subscribers: mgorny, christof, arphaman, cfe-commits, lldb-commits, libcxx-commits, llvm-commits

Tags: #clang, #lldb, #libc, #llvm

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

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

5 years agoRevert "clang support gnu asm goto."
Erich Keane [Thu, 30 May 2019 15:38:02 +0000 (15:38 +0000)]
Revert "clang support gnu asm goto."

This reverts commit 954ec09aed4f2be04bb5f4e10dbb4ea8bd19ef9a.

Reverting due to test failures as requested by Jennifer Yu.

Conflicts:
clang/test/CodeGen/asm-goto.c

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

5 years ago[OpenCL] Fix OpenCL/SPIR version metadata in C++ mode.
Anastasia Stulova [Thu, 30 May 2019 15:18:07 +0000 (15:18 +0000)]
[OpenCL] Fix OpenCL/SPIR version metadata in C++ mode.

C++ is derived from OpenCL v2.0 therefore set the versions
identically.

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

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

5 years ago[analyzer] print() JSONify chain: Fix possible build-bot breaks
Csaba Dabis [Thu, 30 May 2019 15:15:57 +0000 (15:15 +0000)]
[analyzer] print() JSONify chain: Fix possible build-bot breaks

Summary:
Printing constructing_objects could be non-deterministic as it is a map.

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

5 years agoFollow up of r362096
Sjoerd Meijer [Thu, 30 May 2019 15:04:06 +0000 (15:04 +0000)]
Follow up of r362096

The new tests were failing, because I missed dependent patch D60697.
I have removed the failing cases for now, which I will restore once
D60697 is in.

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

5 years ago[analyzer] print() JSONify chain: Fix build-bot breaks
Csaba Dabis [Thu, 30 May 2019 14:48:43 +0000 (14:48 +0000)]
[analyzer] print() JSONify chain: Fix build-bot breaks

Summary:
Printing out a map structure different in different environments so that
this patch generalize the test-case to check for the 'no stmt'-case
anywhere in the Store.

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

5 years ago[ARM] Add CLI support for Armv8.1-M and MVE
Sjoerd Meijer [Thu, 30 May 2019 14:22:26 +0000 (14:22 +0000)]
[ARM] Add CLI support for Armv8.1-M and MVE

Given the existing infrastructure in LLVM side for +fp and +fp.dp,
this is more or less trivial, needing only one tiny source change and
a couple of tests.

Patch by Simon Tatham.

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

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

5 years ago[OpenCL] Support logical vector operators in C++ mode
Sven van Haastregt [Thu, 30 May 2019 12:35:19 +0000 (12:35 +0000)]
[OpenCL] Support logical vector operators in C++ mode

Support logical operators on vectors in C++ for OpenCL mode, to
preserve backwards compatibility with OpenCL C.

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

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

5 years agoFix Wdocumentation warning. NFCI.
Simon Pilgrim [Thu, 30 May 2019 10:44:36 +0000 (10:44 +0000)]
Fix Wdocumentation warning. NFCI.

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

5 years agoRevert "asm goto: fix out-of-bounds read of Constraints after rC362045"
Fangrui Song [Thu, 30 May 2019 10:05:52 +0000 (10:05 +0000)]
Revert "asm goto: fix out-of-bounds read of Constraints after rC362045"

It was fixed by rC362062.

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

5 years agoFix MSVC "not all control paths return a value" warning.
Simon Pilgrim [Thu, 30 May 2019 09:39:45 +0000 (09:39 +0000)]
Fix MSVC "not all control paths return a value" warning.

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

5 years agoasm goto: fix out-of-bounds read of Constraints after rC362045
Fangrui Song [Thu, 30 May 2019 08:03:02 +0000 (08:03 +0000)]
asm goto: fix out-of-bounds read of Constraints after rC362045

When parsing goto labels, Names and Exprs are expanded but Constraints
is not, this may cause a out-of-bounds read later in:

// GCCAsmStmt::GCCAsmStmt
// `constraints` has only `NumExprs - NumLabels` elements
  Constraints = new (C) StringLiteral*[NumExprs];
  std::copy(constraints, constraints + NumExprs, Constraints);

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

5 years ago[AST] asm goto labels don't have constraints, don't try to copy them.
Benjamin Kramer [Thu, 30 May 2019 07:21:08 +0000 (07:21 +0000)]
[AST] asm goto labels don't have constraints, don't try to copy them.

Found by asan.

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

5 years agoMark CodeGen/asm-goto.c as x86 specific after r362045
Fangrui Song [Thu, 30 May 2019 06:48:13 +0000 (06:48 +0000)]
Mark CodeGen/asm-goto.c as x86 specific after r362045

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

5 years agoAdd the `objc_class_stub` attribute.
John McCall [Thu, 30 May 2019 04:09:01 +0000 (04:09 +0000)]
Add the `objc_class_stub` attribute.

Swift requires certain classes to be not just initialized lazily on first
use, but actually allocated lazily using information that is only available
at runtime.  This is incompatible with ObjC class initialization, or at least
not efficiently compatible, because there is no meaningful class symbol
that can be put in a class-ref variable at load time.  This leaves ObjC
code unable to access such classes, which is undesirable.

objc_class_stub says that class references should be resolved by calling
a new ObjC runtime function with a pointer to a new "class stub" structure.
Non-ObjC compilers (like Swift) can simply emit this structure when ObjC
interop is required for a class that cannot be statically allocated,
then apply this attribute to the `@interface` in the generated ObjC header
for the class.

This attribute can be thought of as a generalization of the existing
`objc_runtime_visible` attribute which permits more efficient class
resolution as well as supporting the additon of categories to the class.
Subclassing these classes from ObjC is currently not allowed.

Patch by Slava Pestov!

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

5 years ago[Driver] Render target options (e.g. -fuse-init-array) for -fembed-bitcode
Fangrui Song [Thu, 30 May 2019 02:30:04 +0000 (02:30 +0000)]
[Driver] Render target options (e.g. -fuse-init-array) for -fembed-bitcode

Modern ELF platforms use -fuse-init-array to emit .init_array instead of
.ctors .  ld.bfd and gold --ctors-in-init-array merge .init_array and
.ctors into .init_array but lld doesn't do that.

If crtbegin*.o crtend*.o don't provide .ctors/.dtors, such .ctors in
user object files can lead to crash (see PR42002. The first and the last
elements in .ctors/.dtors are ignored - they are traditionally provided
by crtbegin*.o crtend*.o).

Call addClangTargetOptions() to ensure -fuse-init-array is rendered on
modern ELF platforms. On Hexagon, this renders -target-feature
+reserved-r19 for -ffixed-r19.

Reviewed By: compnerd

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

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

5 years ago[PowerPC] Set the default PLT mode on musl to Secure PLT
Fangrui Song [Thu, 30 May 2019 02:13:15 +0000 (02:13 +0000)]
[PowerPC] Set the default PLT mode on musl to Secure PLT

The musl libc only supports Secure PLT.

Patch by A. Wilcox!

Reviewed By: jhibbits

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

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

5 years ago[Driver] -static-pie: add -z text
Fangrui Song [Thu, 30 May 2019 01:55:43 +0000 (01:55 +0000)]
[Driver] -static-pie: add -z text

This matches gcc -static-pie. The intention is to prevent dynamic
relocations in read-only segments.

In ld.bfd and gold, -z notext is the default. If text relocations are needed:

* -z notext: allow and emit DF_TEXTREL.
  DF_TEXTREL is not emitted if there is no text relocation.
* -z text: error

In lld, -z text is the default (this change is a no-op).

* -z text: error on text relocations
* -z notext: allow text relocations, and emit DF_TEXTREL no matter whether
  text relocations exist.

Reviewed By: sivachandra

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

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

5 years agoclang support gnu asm goto.
Jennifer Yu [Thu, 30 May 2019 01:05:46 +0000 (01:05 +0000)]
clang support gnu asm goto.
Syntax:
  asm [volatile] goto ( AssemblerTemplate
                      :
                      : InputOperands
                      : Clobbers
                      : GotoLabels)

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

New llvm IR is "callbr" for inline asm goto instead "call" for inline asm
For:
asm goto("testl %0, %0; jne %l1;" :: "r"(cond)::label_true, loop);
IR:
callbr void asm sideeffect "testl $0, $0; jne ${1:l};", "r,X,X,~{dirflag},~{fpsr},~{flags}"(i32 %0, i8* blockaddress(@foo, %label_true), i8* blockaddress(@foo, %loop)) #1
          to label %asm.fallthrough [label %label_true, label %loop], !srcloc !3

asm.fallthrough:

Compiler need to generate:
1> a dummy constarint 'X' for each label.
2> an unique fallthrough label for each asm goto stmt " asm.fallthrough%number".

Diagnostic
1> duplicate asm operand name are used in output, input and label.
2> goto out of scope.

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

5 years agoCodeView - add static data members to global variable debug info.
Amy Huang [Wed, 29 May 2019 21:45:34 +0000 (21:45 +0000)]
CodeView - add static data members to global variable debug info.

Summary:
Add static data members to IR debug info's list of global variables
so that they are emitted as S_CONSTANT records.

Related to https://bugs.llvm.org/show_bug.cgi?id=41615.

Reviewers: rnk

Subscribers: aprantl, cfe-commits, llvm-commits, thakis

Tags: #clang, #llvm

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

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

5 years ago[ObjC] Fix encoding of ObjC pointer types that are pointers to typedefs
Akira Hatanaka [Wed, 29 May 2019 21:23:30 +0000 (21:23 +0000)]
[ObjC] Fix encoding of ObjC pointer types that are pointers to typedefs

clang was encoding pointers to typedefs as if they were pointers to
structs because that is apparently what gcc is doing.

For example:

```
@class Class1;

typedef NSArray<Class1 *> MyArray;

void foo1(void) {
  const char *s0 = @encode(MyArray *); // "^{NSArray=#}"
  const char *s1 = @encode(NSArray<Class1 *> *); // "@"
}
```

This commit removes the code that was there to make clang compatible
with gcc and make clang emit the correct encoding for ObjC pointers,
which is "@".

rdar://problem/50563529

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

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

5 years ago[analyzer] Remove EndPath function as it is dead code
Csaba Dabis [Wed, 29 May 2019 20:47:27 +0000 (20:47 +0000)]
[analyzer] Remove EndPath function as it is dead code

Summary: -

Reviewers: george.karpenkov

Reviewed By: george.karpenkov

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

Tags: #clang

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

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

5 years agoRevert "LLVM IR: update Clang tests for byval being a typed attribute."
Tim Northover [Wed, 29 May 2019 20:45:32 +0000 (20:45 +0000)]
Revert "LLVM IR: update Clang tests for byval being a typed attribute."

The underlying LLVM change couldn't cope with llvm-link and broke LTO builds.

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

5 years ago[analyzer] ConditionBRVisitor: Boolean support
Csaba Dabis [Wed, 29 May 2019 20:34:29 +0000 (20:34 +0000)]
[analyzer] ConditionBRVisitor: Boolean support

Summary: -

Reviewers: NoQ, george.karpenkov

Reviewed By: NoQ, george.karpenkov

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

Tags: #clang

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

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

5 years ago[analyzer] ConditionBRVisitor: MemberExpr support
Csaba Dabis [Wed, 29 May 2019 20:29:02 +0000 (20:29 +0000)]
[analyzer] ConditionBRVisitor: MemberExpr support

Summary: -

Reviewers: NoQ, george.karpenkov

Reviewed By: NoQ

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

Tags: #clang

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

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

5 years ago[analyzer] ConditionBRVisitor: Remove duplicated code
Csaba Dabis [Wed, 29 May 2019 20:18:07 +0000 (20:18 +0000)]
[analyzer] ConditionBRVisitor: Remove duplicated code

Summary: -

Reviewers: NoQ, george.karpenkov

Reviewed By: NoQ

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

Tags: #clang

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

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

5 years ago[analyzer] ConditionBRVisitor: Test 'add-pop-up-notes=false'
Csaba Dabis [Wed, 29 May 2019 20:13:29 +0000 (20:13 +0000)]
[analyzer] ConditionBRVisitor: Test 'add-pop-up-notes=false'

Summary: -

Reviewers: NoQ, alexfh

Reviewed By: alexfh

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

Tags: #clang

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

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

5 years ago[analyzer] ConditionBRVisitor: Enhance to write out more information
Csaba Dabis [Wed, 29 May 2019 20:06:09 +0000 (20:06 +0000)]
[analyzer] ConditionBRVisitor: Enhance to write out more information

Summary:
Add extra messages to the bug report to inform the user why the analyzer
`Taking true/false branch`.

Reviewers: NoQ, george.karpenkov

Reviewed By: NoQ

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

Tags: #clang

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

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

5 years ago[analyzer] [NFC] PathDiagnostic: Create PathDiagnosticPopUpPiece
Csaba Dabis [Wed, 29 May 2019 19:21:59 +0000 (19:21 +0000)]
[analyzer] [NFC] PathDiagnostic: Create PathDiagnosticPopUpPiece

Summary:
This new piece is similar to our macro expansion printing in HTML reports:
On mouse-hover event it pops up on variables. Similar to note pieces it
supports `plist` diagnostics as well.

It is optional, on by default: `add-pop-up-notes=true`.

Extra: In HTML reports `background-color: LemonChiffon` was too light,
changed to `PaleGoldenRod`.

Reviewers: NoQ, alexfh

Reviewed By: NoQ

Subscribers: cfe-commits, gerazo, gsd, george.karpenkov, alexfh, xazax.hun,
             baloghadamsoftware, szepet, a.sidorin, mikhail.ramalho,
             Szelethus, donat.nagy, dkrupp

Tags: #clang

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

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

5 years agoLLVM IR: update Clang tests for byval being a typed attribute.
Tim Northover [Wed, 29 May 2019 19:13:29 +0000 (19:13 +0000)]
LLVM IR: update Clang tests for byval being a typed attribute.

Since byval is now a typed attribute it gets sorted slightly differently by
LLVM when the order of attributes is being canonicalized. This updates the few
Clang tests that depend on the old order.

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

5 years ago[analyzer] print() JSONify chain: Generic stmt_id
Csaba Dabis [Wed, 29 May 2019 18:58:41 +0000 (18:58 +0000)]
[analyzer] print() JSONify chain: Generic stmt_id

Summary: Some environment create less statements so make them generic.

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

5 years ago[analyzer] SATestBuild.py: Use driver for analyzing single-file tests.
Artem Dergachev [Wed, 29 May 2019 18:49:31 +0000 (18:49 +0000)]
[analyzer] SATestBuild.py: Use driver for analyzing single-file tests.

Don't bother coming up with a -cc1 run-line ourselves.

This, in particular, gets rid of a macOS-specific code path.

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

5 years ago[analyzer] print() JSONify: SVal implementation
Csaba Dabis [Wed, 29 May 2019 18:38:52 +0000 (18:38 +0000)]
[analyzer] print() JSONify: SVal implementation

Summary: -

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

Reviewed By: NoQ

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

Tags: #clang

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

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

5 years agoFix an unused-variable error.
Haojian Wu [Wed, 29 May 2019 18:36:54 +0000 (18:36 +0000)]
Fix an unused-variable error.

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

5 years ago[WebAssembly] Support VPtr sanitizer for Emscripten
Thomas Lively [Wed, 29 May 2019 18:31:50 +0000 (18:31 +0000)]
[WebAssembly] Support VPtr sanitizer for Emscripten

Summary:
After https://github.com/emscripten-core/emscripten/pull/8651, Emscripten
supports the full UBSan runtime. This includes the VPtr sanitizer.

This diff allows clang to generate code that uses the VPtr sanitizer for
Emscripten.

Patch by Guanzhong Chen

Reviewers: tlively, aheejin

Reviewed By: aheejin

Subscribers: dschuff, sbc100, jgravelle-google, sunfish, cfe-commits

Tags: #clang

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

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

5 years ago[analyzer] print() JSONify: CFG implementation
Csaba Dabis [Wed, 29 May 2019 18:29:31 +0000 (18:29 +0000)]
[analyzer] print() JSONify: CFG implementation

Summary: -

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

Reviewed By: NoQ

Subscribers: cfe-commits, szepet, rnkovacs, a.sidorin, mikhail.ramalho,
             donat.nagy, dkrupp

Tags: #clang

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

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

5 years ago[analyzer] print() JSONify: Decl revision
Csaba Dabis [Wed, 29 May 2019 18:21:14 +0000 (18:21 +0000)]
[analyzer] print() JSONify: Decl revision

Summary: -

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

Reviewed By: NoQ

Subscribers: cfe-commits, szepet, rnkovacs, a.sidorin, mikhail.ramalho,
             donat.nagy, dkrupp

Tags: #clang

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

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

5 years ago[analyzer][AST] print() JSONify: Stmt implementation
Csaba Dabis [Wed, 29 May 2019 18:17:18 +0000 (18:17 +0000)]
[analyzer][AST] print() JSONify: Stmt implementation

Summary:
This patch also adds a function called `JsonFormat()` which:
- Flattens the string so removes the new-lines.
- Escapes double quotes.

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

Reviewed By: NoQ

Subscribers: cfe-commits, szepet, rnkovacs, a.sidorin, mikhail.ramalho,
             donat.nagy, dkrupp

Tags: #clang

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

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

5 years ago[analyzer] print() JSONify: getNodeLabel implementation
Csaba Dabis [Wed, 29 May 2019 18:05:53 +0000 (18:05 +0000)]
[analyzer] print() JSONify: getNodeLabel implementation

Summary: This patch also rewrites the ProgramPoint printing.

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

Reviewed By: NoQ

Subscribers: cfe-commits, szepet, rnkovacs, a.sidorin, mikhail.ramalho,
             donat.nagy, dkrupp

Tags: #clang

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

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

5 years ago[Index] Compute correct symbol kind for variable templates
Ilya Biryukov [Wed, 29 May 2019 17:49:30 +0000 (17:49 +0000)]
[Index] Compute correct symbol kind for variable templates

Summary:
The index library itself seems to never pass variable templates as
input, however clangd does.

Reviewers: kadircet

Reviewed By: kadircet

Subscribers: jkorous, arphaman, cfe-commits

Tags: #clang

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

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

5 years ago[CUDA][HIP] Skip setting `externally_initialized` for static device variables.
Michael Liao [Wed, 29 May 2019 17:23:27 +0000 (17:23 +0000)]
[CUDA][HIP] Skip setting `externally_initialized` for static device variables.

Summary:
- By declaring device variables as `static`, we assume they won't be
  addressable from the host side. Thus, no `externally_initialized` is
  required.

Reviewers: yaxunl

Subscribers: cfe-commits

Tags: #clang

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

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

5 years agoAdd curley brackets to case statement that declares a variable.
Erich Keane [Wed, 29 May 2019 17:04:48 +0000 (17:04 +0000)]
Add curley brackets to case statement that declares a variable.

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

5 years ago[clang-format] Allow configuring list of function-like macros that resolve to a type
Francois Ferrand [Wed, 29 May 2019 16:30:47 +0000 (16:30 +0000)]
[clang-format] Allow configuring list of function-like macros that resolve to a type

Summary:
Adds a `TypenameMacros` configuration option that causes certain identifiers to be handled in a way similar to `typeof()`.

This is enough to:
- Prevent misinterpreting declarations of pointers to such types as expressions (`STACK_OF(int) * foo` -> `STACK_OF(int) *foo`),
- Avoid surprising line breaks in variable/struct field declarations (`STACK_OF(int)\nfoo;` -> `STACK_OF(int) foo;`, see https://bugs.llvm.org/show_bug.cgi?id=30353).

Reviewers: Typz, krasimir, djasper

Reviewed By: Typz

Subscribers: cfe-commits

Tags: #clang

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

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

5 years ago[NFC] clang-format: Use LLVM style in NamespaceEndCommentsFixerTest
Francois Ferrand [Wed, 29 May 2019 16:22:43 +0000 (16:22 +0000)]
[NFC] clang-format: Use LLVM style in NamespaceEndCommentsFixerTest

As pointed out in https://reviews.llvm.org/D37813#inline-555026, the
code which is formatted does not match LLVM formatting style.

Technically this is not a problem since these tests bypass most of the
formatter, but it can be misleading.

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

5 years ago[analyzer] print() JSONify: Program state implementation
Csaba Dabis [Wed, 29 May 2019 16:22:21 +0000 (16:22 +0000)]
[analyzer] print() JSONify: Program state implementation

Summary: -

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

Reviewed By: NoQ

Subscribers: szepet, rnkovacs, a.sidorin, mikhail.ramalho, donat.nagy,
             dkrupp

Tags: #clang

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

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

5 years ago[analyzer] print() JSONify: Checker messages implementation
Csaba Dabis [Wed, 29 May 2019 16:02:33 +0000 (16:02 +0000)]
[analyzer] print() JSONify: Checker messages implementation

Summary: -

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

Reviewed By: NoQ

Subscribers: szepet, rnkovacs, a.sidorin, mikhail.ramalho, donat.nagy,
             dkrupp

Tags: #clang

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

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

5 years ago[analyzer] print() JSONify: Constructing objects implementation
Csaba Dabis [Wed, 29 May 2019 15:58:26 +0000 (15:58 +0000)]
[analyzer] print() JSONify: Constructing objects implementation

Summary: -

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

Reviewed By: NoQ

Subscribers: szepet, rnkovacs, a.sidorin, mikhail.ramalho, donat.nagy,
             dkrupp

Tags: #clang

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

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

5 years ago[analyzer] print() JSONify: Type information implementation
Csaba Dabis [Wed, 29 May 2019 15:53:12 +0000 (15:53 +0000)]
[analyzer] print() JSONify: Type information implementation

Summary: -

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

Reviewed By: NoQ

Subscribers: szepet, rnkovacs, a.sidorin, mikhail.ramalho, donat.nagy,
             dkrupp

Tags: #clang

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

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

5 years ago[analyzer] print() JSONify: Constraints implementation
Csaba Dabis [Wed, 29 May 2019 15:43:26 +0000 (15:43 +0000)]
[analyzer] print() JSONify: Constraints implementation

Summary: -

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

Reviewed By: NoQ

Subscribers: szepet, rnkovacs, a.sidorin, mikhail.ramalho, donat.nagy,
             dkrupp

Tags: #clang

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

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

5 years ago[analyzer] print() JSONify: Environment implementation
Csaba Dabis [Wed, 29 May 2019 15:36:58 +0000 (15:36 +0000)]
[analyzer] print() JSONify: Environment implementation

Summary: -

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

Reviewed By: NoQ

Subscribers: szepet, rnkovacs, a.sidorin, mikhail.ramalho, donat.nagy,
             dkrupp

Tags: #clang

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

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

5 years ago[CodeComplete] Add semicolon when completing patterns for 'static_assert' and 'typedef
Ilya Biryukov [Wed, 29 May 2019 15:32:17 +0000 (15:32 +0000)]
[CodeComplete] Add semicolon when completing patterns for 'static_assert' and 'typedef

This is a trivial follow-up to r360042, which added semicolons to other
pattern completions, so sending without review.

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

5 years ago[analyzer] print() JSONify: Store implementation
Csaba Dabis [Wed, 29 May 2019 15:25:19 +0000 (15:25 +0000)]
[analyzer] print() JSONify: Store implementation

Summary: -

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

Reviewed By: NoQ

Subscribers: szepet, rnkovacs, a.sidorin, mikhail.ramalho, donat.nagy,
             dkrupp

Tags: #clang

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

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

5 years ago[mips] Check argument for __builtin_msa_ctcmsa / __builtin_msa_cfcmsa
Simon Atanasyan [Wed, 29 May 2019 14:59:32 +0000 (14:59 +0000)]
[mips] Check argument for __builtin_msa_ctcmsa / __builtin_msa_cfcmsa

The `__builtin_msa_ctcmsa` and `__builtin_msa_cfcmsa` builtins are mapped
to the `ctcmsa` and `cfcmsa` instructions respectively. While MSA
control registers have indexes in 0..7 range, the instructions accept
register index in 0..31 range [1].

[1] MIPS Architecture for Programmers Volume IV-j:
    The MIPS64 SIMD Architecture Module
https://www.mips.com/?do-download=the-mips64-simd-architecture-module

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

5 years agoclang-cl: Fix mangling of catchable types with names longer than 4kiB
Nico Weber [Wed, 29 May 2019 13:48:19 +0000 (13:48 +0000)]
clang-cl: Fix mangling of catchable types with names longer than 4kiB

The mangling used to contain the MD5 name of both the RTTI type
descriptor and the name of the copy ctor in MSVC2013, but it changed
to just the former in 2015. It looks like it changed back to the old
mangling in VS2017 version 15.7 and onwards, including VS2019 (version
16.0). VS2017 version 15.0 still has the VS2015 mangling. Versions
between 15.0 and 15.7 are't on godbolt. I found 15.4 (_MSC_VER 1911)
locally and that uses the 15.0 mangling still, but I didn't find 15.5 or
15.6, so I'm not sure where exactly it changed back.

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

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

5 years ago[LibTooling] Add `before` and `after` selectors for selecting point-ranges relative...
Yitzhak Mandelbaum [Wed, 29 May 2019 12:40:36 +0000 (12:40 +0000)]
[LibTooling] Add `before` and `after` selectors for selecting point-ranges relative to nodes.

Summary:
The `before` and `after` selectors allow users to specify a zero-length range --
a point -- at the relevant location in an AST-node's source.  Point ranges can
be useful, for example, to insert a change using an API that takes a range to be
modified (e.g. `tooling::change()`).

Reviewers: ilya-biryukov

Subscribers: cfe-commits

Tags: #clang

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

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

5 years ago[Index] Correctly set symbol kind of IndirectFieldDecl
Ilya Biryukov [Wed, 29 May 2019 10:11:14 +0000 (10:11 +0000)]
[Index] Correctly set symbol kind of IndirectFieldDecl

Summary: The kind has been 'unknown' before, now it is 'field'.

Reviewers: kadircet

Reviewed By: kadircet

Subscribers: jkorous, arphaman, cfe-commits

Tags: #clang

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

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

5 years agoFix test added in r361903 to work on Windows.
Douglas Yung [Wed, 29 May 2019 09:20:01 +0000 (09:20 +0000)]
Fix test added in r361903 to work on Windows.

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

5 years ago[X86] Fix i386 struct and union parameter alignment
Pengfei Wang [Wed, 29 May 2019 08:42:35 +0000 (08:42 +0000)]
[X86] Fix i386 struct and union parameter alignment

According to i386 System V ABI 2.1: Structures and unions assume the
alignment of their most strictly aligned component. But current
implementation always takes them as 4-byte aligned which will result
in incorrect code, e.g:

 1 #include <immintrin.h>
 2 typedef union {
 3         int d[4];
 4         __m128 m;
 5 } M128;
 6 extern void foo(int, ...);
 7 void test(void)
 8 {
 9   M128 a;
10   foo(1, a);
11   foo(1, a.m);
12 }

The first call (line 10) takes the second arg as 4-byte aligned while
the second call (line 11) takes the second arg as 16-byte aligned.
There is oxymoron for the alignment of the 2 calls because they should
be the same.

This patch fixes the bug by following i386 System V ABI and apply it to
Linux only since other System V OS (e.g Darwin, PS4 and FreeBSD) don't
want to spend any effort dealing with the ramifications of ABI breaks
at present.

Patch by Wei Xiao (wxiao3)

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

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

5 years agorevert rC361928: [PowerPC] [Clang] Port SSE intrinsics to PowerPC
Zi Xuan Wu [Wed, 29 May 2019 07:09:54 +0000 (07:09 +0000)]
revert rC361928: [PowerPC] [Clang] Port SSE intrinsics to PowerPC

Because test fails in other targets rather than PowerPC

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

5 years ago[PowerPC] [Clang] Port SSE intrinsics to PowerPC
Zi Xuan Wu [Wed, 29 May 2019 05:17:03 +0000 (05:17 +0000)]
[PowerPC] [Clang] Port SSE intrinsics to PowerPC

Port xmmintrin.h which include Intel SSE intrinsics implementation to PowerPC platform (using Altivec).

The new headers containing those implemenations are located into a directory named ppc_wrappers
which has higher priority when the platform is PowerPC on Linux. They are mainly developed by Steven Munroe,
with contributions from Paul Clarke, Bill Schmidt, Jinsong Ji and Zixuan Wu.

Patched by: Qiu Chaofan <qiucf@cn.ibm.com>
Reviewed By: Jinsong Ji

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

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

5 years agoMake __has_builtin work with __builtin_LINE and friends.
Eric Fiselier [Wed, 29 May 2019 03:15:36 +0000 (03:15 +0000)]
Make __has_builtin work with __builtin_LINE and friends.

The source location builtins are implemented as keywords, but
__has_builtin should still report true for them.

This patch also fixes a test failure on systemz where the alignment
of string literals is 2 not 1.

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

5 years agoFix failure of lit test dependent-libs.cu
Yaxun Liu [Wed, 29 May 2019 01:34:44 +0000 (01:34 +0000)]
Fix failure of lit test dependent-libs.cu

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

5 years ago[Driver] Search the toolchain dir with -print-file-name
Petr Hosek [Wed, 29 May 2019 00:01:05 +0000 (00:01 +0000)]
[Driver] Search the toolchain dir with -print-file-name

This is useful when looking for directories or files relative to the
toolchain root, e.g. include/c++/v1. This change also adds a test
to make sure this functionality doesn't regress in the future.

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

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

5 years ago[X86] Fix the Sema checks for getmant builtins to only allow 4 and 8 for rounding...
Craig Topper [Tue, 28 May 2019 23:26:22 +0000 (23:26 +0000)]
[X86] Fix the Sema checks for getmant builtins to only allow 4 and 8 for rounding immediates.

These don't support embedded rounding so we shouldn't be setting HasRC. That way we only
allow current direction and suppress all exceptions.

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

5 years agoFix r361893 to also update a recently-added test.
Richard Smith [Tue, 28 May 2019 23:20:52 +0000 (23:20 +0000)]
Fix r361893 to also update a recently-added test.

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

5 years agoDefer creating fields for captures until we finish building the
Richard Smith [Tue, 28 May 2019 23:09:46 +0000 (23:09 +0000)]
Defer creating fields for captures until we finish building the
capturing expression or statement.

No functionality change yet. The intent is that we will also delay
building the initialization expression until the enclosing context, so
that:
a) we build the initialization expression in the right context, and
b) we can elide captures that are not odr-used, as suggested by P0588R1.

This also consolidates some duplicated code building capture fields into
a single place.

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

5 years agoSimplify clang::Capture. No functionality change intended.
Richard Smith [Tue, 28 May 2019 23:09:45 +0000 (23:09 +0000)]
Simplify clang::Capture. No functionality change intended.

We don't need to pack flags into the bottom bits of pointers here; we
have plenty of trailing bits in this type.

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

5 years agoIf capturing a variable fails, add a capture anyway (and mark it
Richard Smith [Tue, 28 May 2019 23:09:44 +0000 (23:09 +0000)]
If capturing a variable fails, add a capture anyway (and mark it
invalid) so that we can avoid repeated diagnostics for the same capture.

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

5 years agoMove code to mark a variable as odr-used adjacement to all the related
Richard Smith [Tue, 28 May 2019 23:09:42 +0000 (23:09 +0000)]
Move code to mark a variable as odr-used adjacement to all the related
code.

No functional change intended.

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

5 years ago[Driver] Fix -working-directory issues
Michael J. Spencer [Tue, 28 May 2019 22:21:47 +0000 (22:21 +0000)]
[Driver] Fix -working-directory issues

Currently the `-working-directory` option does not actually impact the working
directory for all of the clang driver, it only impacts how files are looked up
to make sure they exist.  This means that that clang passes the wrong paths
to -fdebug-compilation-dir and -coverage-notes-file.

This patch fixes that by changing all the places in the driver where we convert
to absolute paths to use the VFS, and then calling setCurrentWorkingDirectory on
the VFS.  This also changes the default VFS for `Driver` to use a virtualized
working directory, instead of changing the process's working directory.

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

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

5 years ago[CUDA][HIP] Emit dependent libs for host only
Yaxun Liu [Tue, 28 May 2019 21:18:59 +0000 (21:18 +0000)]
[CUDA][HIP] Emit dependent libs for host only

Recently D60274 was introduced to allow lld to handle dependent libs. However current
usage of dependent libs (e.g. pragma comment(lib, *) in windows header files) are intended
for host only. Emitting the metadata in device IR causes link error in device path.

Until there is a way to different it dependent libs for device or host, metadata for dependent
libs should be emitted for host only. This patch enforces that.

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

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

5 years ago[clang] Handle lrint/llrint builtins
Adhemerval Zanella [Tue, 28 May 2019 21:16:04 +0000 (21:16 +0000)]
[clang] Handle lrint/llrint builtins

As for other floating-point rounding builtins that can be optimized
when build with -fno-math-errno, this patch adds support for lrint
and llrint.  It currently only optimize for AArch64 backend.

Reviewed By: craig.topper

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

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

5 years ago[OpenMP] Set pragma start loc to `#pragma` loc
Joel E. Denny [Tue, 28 May 2019 19:27:19 +0000 (19:27 +0000)]
[OpenMP] Set pragma start loc to `#pragma` loc

This patch adjusts `PragmaOpenMPHandler` to set the location of
`tok::annot_pragma_openmp` to the `#pragma` location instead of the
`omp` location so that the former becomes the start location of the
OpenMP AST node.  This can be useful when, for example, rewriting a
directive using Clang's Rewrite facility.  Most of this patch updates
tests for changes to locations in diagnostics and `-ast-dump` output.

Reviewed By: ABataev, lebedev.ri, Meinersbur, aaron.ballman

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

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

5 years agoDriver: support `/Zc:char8_t` and `/Zc:char8_t-`
Saleem Abdulrasool [Tue, 28 May 2019 18:26:00 +0000 (18:26 +0000)]
Driver: support `/Zc:char8_t` and `/Zc:char8_t-`

Update the `cl` emulation to support the `/Zc:char8_t[-]?` options as per the
MSVC 2019.1 toolset.  These are aliases for `-fchar8_t` and `-fno-char8_t`.

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

5 years ago[ARM] Replace fp-only-sp and d16 with fp64 and d32.
Simon Tatham [Tue, 28 May 2019 16:13:20 +0000 (16:13 +0000)]
[ARM] Replace fp-only-sp and d16 with fp64 and d32.

Those two subtarget features were awkward because their semantics are
reversed: each one indicates the _lack_ of support for something in
the architecture, rather than the presence. As a consequence, you
don't get the behavior you want if you combine two sets of feature
bits.

Each SubtargetFeature for an FP architecture version now comes in four
versions, one for each combination of those options. So you can still
say (for example) '+vfp2' in a feature string and it will mean what
it's always meant, but there's a new string '+vfp2d16sp' meaning the
version without those extra options.

A lot of this change is just mechanically replacing positive checks
for the old features with negative checks for the new ones. But one
more interesting change is that I've rearranged getFPUFeatures() so
that the main FPU feature is appended to the output list *before*
rather than after the features derived from the Restriction field, so
that -fp64 and -d32 can override defaults added by the main feature.

Reviewers: dmgreen, samparker, SjoerdMeijer

Subscribers: srhines, javed.absar, eraman, kristof.beyls, hiraditya, zzheng, Petar.Avramovic, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

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

5 years ago[CodeComplete] Set preferred type for qualified-id
Ilya Biryukov [Tue, 28 May 2019 15:21:03 +0000 (15:21 +0000)]
[CodeComplete] Set preferred type for qualified-id

Reviewers: kadircet

Reviewed By: kadircet

Subscribers: cfe-commits

Tags: #clang

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

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

5 years ago[CodeComplete] Consistently break after '{' in multi-line patterns
Ilya Biryukov [Tue, 28 May 2019 14:33:16 +0000 (14:33 +0000)]
[CodeComplete] Consistently break after '{' in multi-line patterns

Summary:
Completion can return multi-line patterns in some cases, e.g.

    for (<#init#>; <#cond#>; <#inc#>) {
    <#body#>
    }

However, most patterns break the line only before closing brace,
resulting in code like:

    namespace <#name#> { <#decls#>
    }

While some (e.g. the 'for' example above) are breaking lines after the
opening brace too.

This change ensures all patterns consistently break after the opening
brace, this leads to nicer UX when using those in an actual editor.

Reviewers: gribozavr

Reviewed By: gribozavr

Subscribers: cfe-commits

Tags: #clang

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

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

5 years agoAdd release note entries for recent typo correction changes
Nico Weber [Tue, 28 May 2019 14:04:48 +0000 (14:04 +0000)]
Add release note entries for recent typo correction changes

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

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

5 years ago[Analyzer] Replace `CXXSelfAssignmentBRVisitor` with `NoteTags`
Adam Balogh [Tue, 28 May 2019 13:07:09 +0000 (13:07 +0000)]
[Analyzer] Replace `CXXSelfAssignmentBRVisitor` with `NoteTags`

The `cplusplus.SelfAssignment` checker has a visitor that is added
to every `BugReport` to mark the to branch of the self assignment
operator with e.g. `rhs == *this` and `rhs != *this`. With the new
`NoteTag` feature this visitor is not needed anymore. Instead the
checker itself marks the two branches using the `NoteTag`s.

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

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

5 years agoRe-commit r357452 (take 2): "SimplifyCFG SinkCommonCodeFromPredecessors: Also sink...
Hans Wennborg [Tue, 28 May 2019 12:19:38 +0000 (12:19 +0000)]
Re-commit r357452 (take 2): "SimplifyCFG SinkCommonCodeFromPredecessors: Also sink function calls without used results (PR41259)"

This was reverted in r360086 as it was supected of causing mysterious test
failures internally. However, it was never concluded that this patch was the
root cause.

> The code was previously checking that candidates for sinking had exactly
> one use or were a store instruction (which can't have uses). This meant
> we could sink call instructions only if they had a use.
>
> That limitation seemed a bit arbitrary, so this patch changes it to
> "instruction has zero or one use" which seems more natural and removes
> the need to special-case stores.
>
> Differential revision: https://reviews.llvm.org/D59936

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

5 years agoRevert [test] Fix plugin tests
Don Hinton [Tue, 28 May 2019 06:38:16 +0000 (06:38 +0000)]
Revert [test] Fix plugin tests

This reverts r361790 (git commit fe5eaab2b5b4523886bd63aebcfea8cfce586fa1)

It's causing buildbot breakage, so reverting while I investigate.

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

5 years ago[test] Fix plugin tests
Don Hinton [Tue, 28 May 2019 06:26:58 +0000 (06:26 +0000)]
[test] Fix plugin tests

Summary:
The following changes were required to fix these tests:

1) Change LLVM_ENABLE_PLUGINS to an option and move it to
   llvm/CMakeLists.txt with an appropriate default -- which matches
   the original default behavior.

2) Move the plugins directory from clang/test/Analysis
   clang/lib/Analysis.  It's not enough to add an exclude to the
   lit.local.cfg file because add_lit_testsuites recurses the tree and
   automatically adds the appropriate `check-` targets, which don't
   make sense for the plugins because they aren't tests and don't
   have `RUN` statements.

   Here's a list of the `clang-check-anlysis*` targets with this
   change:

```
  $ ninja -t targets all| sed -n "s/.*\/\(check[^:]*\):.*/\1/p" | sort -u | grep clang-analysis
  check-clang-analysis
  check-clang-analysis-checkers
  check-clang-analysis-copypaste
  check-clang-analysis-diagnostics
  check-clang-analysis-engine
  check-clang-analysis-exploration_order
  check-clang-analysis-html_diagnostics
  check-clang-analysis-html_diagnostics-relevant_lines
  check-clang-analysis-inlining
  check-clang-analysis-objc
  check-clang-analysis-unified-sources
  check-clang-analysis-z3
```

3) Simplify the logic and only include the subdirectories under
   clang/lib/Analysis/plugins if LLVM_ENABLE_PLUGINS is set.

Reviewed By: NoQ

Tags: #clang, #llvm

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

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

5 years ago[Driver] Change layout of per-target runtimes to resemble multiarch
Petr Hosek [Mon, 27 May 2019 23:23:50 +0000 (23:23 +0000)]
[Driver] Change layout of per-target runtimes to resemble multiarch

This is a follow up to r361432, changing the layout of per-target
runtimes to more closely resemble multiarch. While before, we used
the following layout:

[RESOURCE_DIR]/<target>/lib/libclang_rt.<runtime>.<ext>

Now we use the following layout:

[RESOURCE_DIR]/lib/<target>/libclang_rt.<runtime>.<ext>

This also more closely resembles the existing "non-per-target" layout:

[RESOURCE_DIR]/lib/<os>/libclang_rt.<runtime>-<arch>.<ext>

This change will enable further simplification of the driver logic
in follow up changes.

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

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

5 years ago[Preprocessor] Fix crash emitting note with framework location for "file not found...
Volodymyr Sapsai [Mon, 27 May 2019 19:15:30 +0000 (19:15 +0000)]
[Preprocessor] Fix crash emitting note with framework location for "file not found" error.

A filename can be remapped with a header map to point to a framework
header and we can find the corresponding framework without the header.
But if the original filename doesn't have a remapped framework name,
we'll fail to find its location and will dereference a null pointer
during diagnostics emission.

Fix by tracking remappings better and emit the note only if a framework
is found before any of the remappings.

rdar://problem/48883447

Reviewers: arphaman, erik.pilkington, jkorous

Reviewed By: arphaman

Subscribers: dexonsmith, cfe-commits

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

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

5 years ago[clang] Respect TerseOutput when printing lambdas
Kadir Cetinkaya [Mon, 27 May 2019 16:20:45 +0000 (16:20 +0000)]
[clang] Respect TerseOutput when printing lambdas

Reviewers: ilya-biryukov, hokein, sammccall

Subscribers: cfe-commits

Tags: #clang

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

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

5 years agoWhen dumping the AST to JSON, dump the type information from a typeid expression...
Aaron Ballman [Mon, 27 May 2019 14:34:31 +0000 (14:34 +0000)]
When dumping the AST to JSON, dump the type information from a typeid expression with a type operand.

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

5 years agoWhen dumping the AST to JSON, dump whether a function is variadic or not.
Aaron Ballman [Mon, 27 May 2019 14:29:10 +0000 (14:29 +0000)]
When dumping the AST to JSON, dump whether a function is variadic or not.

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

5 years agoWhen dumping the AST to JSON, dump the declared name of a MemberExpr operand.
Aaron Ballman [Mon, 27 May 2019 14:25:04 +0000 (14:25 +0000)]
When dumping the AST to JSON, dump the declared name of a MemberExpr operand.

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

5 years agoWhen dumping the AST to JSON, dump the argument name to a sizeof pack expression.
Aaron Ballman [Mon, 27 May 2019 14:17:32 +0000 (14:17 +0000)]
When dumping the AST to JSON, dump the argument name to a sizeof pack expression.

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