]> granicus.if.org Git - clang/log
clang
7 years ago[CodeGen] Use APInt::lshrInPlace instead of APInt::lshr. NFC
Craig Topper [Wed, 19 Apr 2017 05:17:33 +0000 (05:17 +0000)]
[CodeGen] Use APInt::lshrInPlace instead of APInt::lshr. NFC

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

7 years agoFix member function call with null 'this' pointer.
Richard Smith [Wed, 19 Apr 2017 02:19:21 +0000 (02:19 +0000)]
Fix member function call with null 'this' pointer.

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

7 years ago[modules] Properly look up the owning module for an instantiation of a merged template.
Richard Smith [Wed, 19 Apr 2017 01:36:43 +0000 (01:36 +0000)]
[modules] Properly look up the owning module for an instantiation of a merged template.

When looking for the template instantiation pattern of a templated entity,
consistently select the definition of the pattern if there is one. This means
we'll pick the same owning module when we start instantiating a template that
we'll later pick when determining which modules are visible during that
instantiation.

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

7 years agoUse less temporary AttributeLists NFC
Reid Kleckner [Tue, 18 Apr 2017 23:50:03 +0000 (23:50 +0000)]
Use less temporary AttributeLists NFC

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

7 years ago[modules-ts] Fold together -x c++ and -x c++-module at -cc1 level.
Richard Smith [Tue, 18 Apr 2017 21:55:37 +0000 (21:55 +0000)]
[modules-ts] Fold together -x c++ and -x c++-module at -cc1 level.

The driver needs to know whether it's building a module interface or
implementation unit because it affects which outputs it produces and how it
builds the command pipeline. But the frontend doesn't need to know and should
not care: all it needs to know is what action it is being asked to perform on
the input.

(This is in preparation for permitting -emit-obj to be used on a module
interface unit to produce object code without going via a "full" PCM file.)

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

7 years agoDo not warn about whitespace between ??/ trigraph and newline in line comments if...
Richard Smith [Tue, 18 Apr 2017 21:45:04 +0000 (21:45 +0000)]
Do not warn about whitespace between ??/ trigraph and newline in line comments if trigraphs are disabled in the current language.

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

7 years agoPR30508: Downgrade error to warning if the umbrella folder doesn't exist.
Vassil Vassilev [Tue, 18 Apr 2017 20:57:29 +0000 (20:57 +0000)]
PR30508: Downgrade error to warning if the umbrella folder doesn't exist.

Patch by Yuka Takahashi (D32119)!

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

7 years agoThe SubjectMatchRule enum should not be used as a DenseMap key to avoid
Alex Lorenz [Tue, 18 Apr 2017 20:54:23 +0000 (20:54 +0000)]
The SubjectMatchRule enum should not be used as a DenseMap key to avoid
UBSAN 'invalid value' failures

The commit r300556 introduced a UBSAN issue that was caught by
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap. The DenseMap
failed to create an empty/tombstone value as the empty/tombstone values for the
SubjectMatchRule enum were not valid enum constants.

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

7 years ago[DOXYGEN] Minor improvements in doxygen comments.
Ekaterina Romanova [Tue, 18 Apr 2017 19:44:07 +0000 (19:44 +0000)]
[DOXYGEN] Minor improvements in doxygen comments.

- To be consistent with the rest of the intrinsics headers, I removed the tags <i> .. </i> for marking instruction names in italics in in smmintrin.h.

- Formatting changes to fit into 80 characters.

I got an OK from Eric Christopher to commit doxygen comments without prior code
review upstream.

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

7 years agoRemove unused varible
Reid Kleckner [Tue, 18 Apr 2017 17:44:41 +0000 (17:44 +0000)]
Remove unused varible

The Result variable is unused both in Sema::CheckARMBuiltinFunctionCall
and Sema::CheckAArch64BuiltinFunctionCall, remove it.

Patch by Wei-Ren Chen!

Reviewers: craig.topper, rnk

Reviewed By: rnk

Subscribers: aemerson, cfe-commits, rengolin

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

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

7 years ago[AArch64][clang] Pass cpu/arch information to assembler for AArch64.
Manoj Gupta [Tue, 18 Apr 2017 17:36:10 +0000 (17:36 +0000)]
[AArch64][clang] Pass cpu/arch information to assembler for AArch64.

Summary:
Pass Cpu/Arch options to assembler for AArch64 with no-integrated-as.
This fixes PR20019.

Reviewers: richard.barton.arm, kristof.beyls, rengolin

Reviewed By: rengolin

Subscribers: srhines, pirama, aemerson, rengolin, cfe-commits

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

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

7 years agoTesting commit access.
Manoj Gupta [Tue, 18 Apr 2017 17:34:46 +0000 (17:34 +0000)]
Testing commit access.

Summary: Test commit access.

Reviewers: gbiv, george.burgess.iv

Reviewed By: george.burgess.iv

Subscribers: cfe-commits

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

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

7 years agomingw-w64: enable support for __declspec(selectany)
Martell Malone [Tue, 18 Apr 2017 15:56:24 +0000 (15:56 +0000)]
mingw-w64: enable support for __declspec(selectany)

Add selectany as a GCC spelling for mingw-w64

Reviewers: rnk

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

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

7 years ago[ASTPrinter] Print template parameter lists for out-of-line functions
Alex Lorenz [Tue, 18 Apr 2017 15:12:34 +0000 (15:12 +0000)]
[ASTPrinter] Print template parameter lists for out-of-line functions

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

7 years agoAdd #pragma clang attribute
Alex Lorenz [Tue, 18 Apr 2017 14:33:39 +0000 (14:33 +0000)]
Add #pragma clang attribute

This is a recommit of r300539 that was reverted in r300543 due to test failures.
The original commit message is displayed below:

The new '#pragma clang attribute' directive can be used to apply attributes to
multiple declarations. An attribute must satisfy the following conditions to
be supported by the pragma:
- It must have a subject list that's defined in the TableGen file.
- It must be documented.
- It must not be late parsed.
- It must have a GNU/C++11 spelling.

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

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

7 years agoDriver: Better detection of mingw-gcc
Martell Malone [Tue, 18 Apr 2017 14:27:36 +0000 (14:27 +0000)]
Driver: Better detection of mingw-gcc

Stop blindly searching for "gcc.exe" on windows.
Stop assuming "/usr" on unix, fixes cross compiling.

Reviewers: mati865, yaron.keren

Subscribers: ismail, rnk

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

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

7 years ago[ARM] Add hardware build attributes in assembler
Oliver Stannard [Tue, 18 Apr 2017 13:21:05 +0000 (13:21 +0000)]
[ARM] Add hardware build attributes in assembler

This passes an option to the ARM assembly parser to emit build
attributes for the hardware selected by command line options, when
assembling an assembly file.

This is not enabled for C/C++, as this would result in duplicate build
attribute directives being emitted in each inline assembly block, when
emitting assembly.

This also adds an option to allow disabling this behaviour for assembly
files, for users who were relying on the old behaviour.

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

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

7 years ago[ARM,AArch64] Define __ELF__ for arm-none-eabihf and AArch64
Oliver Stannard [Tue, 18 Apr 2017 13:12:36 +0000 (13:12 +0000)]
[ARM,AArch64] Define __ELF__ for arm-none-eabihf and AArch64

This macro is defined for arm-none-eabi as of r266625, but it should also be
defined for eabihf and aarch64.

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

7 years agoRevert r300539 - Add #pragma clang attribute
Alex Lorenz [Tue, 18 Apr 2017 10:46:41 +0000 (10:46 +0000)]
Revert r300539 - Add #pragma clang attribute

Some tests fail on the Windows buildbots. I will have to investigate more.
This commit reverts r300539, r300540 and r300542.

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

7 years agoFix one more 'not all control paths return a value' MSVC warning
Alex Lorenz [Tue, 18 Apr 2017 10:17:41 +0000 (10:17 +0000)]
Fix one more 'not all control paths return a value' MSVC warning

The warning was caused by r300539.

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

7 years ago[TableGen] Fix MSVC warning that occurs in TableGen generated function
Alex Lorenz [Tue, 18 Apr 2017 09:59:27 +0000 (09:59 +0000)]
[TableGen] Fix MSVC warning that occurs in TableGen generated function

This should fix the Windows buildbot failure that happened after r300539.

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

7 years agoAdd #pragma clang attribute
Alex Lorenz [Tue, 18 Apr 2017 09:41:47 +0000 (09:41 +0000)]
Add #pragma clang attribute

The new '#pragma clang attribute' directive can be used to apply attributes to
multiple declarations. An attribute must satisfy the following conditions to
be supported by the pragma:
- It must have a subject list that's defined in the TableGen file.
- It must be documented.
- It must not be late parsed.
- It must have a GNU/C++11 spelling.

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

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

7 years agoAssert that a valid operator new/delete signature is always found by the coroutine...
Eric Fiselier [Tue, 18 Apr 2017 05:30:39 +0000 (05:30 +0000)]
Assert that a valid operator new/delete signature is always found by the coroutine body

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

7 years agoSpeculatively attempt to fix bot failures caused by recent coroutine changes.
Eric Fiselier [Tue, 18 Apr 2017 05:08:08 +0000 (05:08 +0000)]
Speculatively attempt to fix bot failures caused by recent coroutine changes.

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

7 years ago[coroutines] Fix building of new/delete expressions when get_return_object_on_allocat...
Eric Fiselier [Tue, 18 Apr 2017 03:12:48 +0000 (03:12 +0000)]
[coroutines] Fix building of new/delete expressions when get_return_object_on_allocation_failure() is present.

Summary:
This patch implements [dcl.fct.def.coroutine]p8:
> The unqualified-id get_return_object_on_allocation_failure is looked up in the scope of
> class P by class member access lookup (3.4.5). If a declaration is found, ..., and if a
> global allocation function is selected, the ::operator new(size_t, nothrow_t) form shall be used.
> [...]
> The allocation function used in this case must have a non-throwing noexcept-specification.

Reviewers: GorNishanov, rsmith, majnemer, aaron.ballman

Reviewed By: GorNishanov

Subscribers: cfe-commits

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

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

7 years agoDebug Info: Remove special-casing of indirect function argument handling.
Adrian Prantl [Tue, 18 Apr 2017 01:22:01 +0000 (01:22 +0000)]
Debug Info: Remove special-casing of indirect function argument handling.

LLVM has changed the semantics of dbg.declare for describing function
arguments. After this patch a dbg.declare always takes the *address*
of a variable as the first argument, even if the argument is not an
alloca.

https://bugs.llvm.org/show_bug.cgi?id=32382
rdar://problem/31205000

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

7 years agoFix mishandling of escaped newlines followed by newlines or nuls.
Richard Smith [Mon, 17 Apr 2017 23:44:51 +0000 (23:44 +0000)]
Fix mishandling of escaped newlines followed by newlines or nuls.

Previously, if an escaped newline was followed by a newline or a nul, we'd lex
the escaped newline as a bogus space character. This led to a bunch of
different broken corner cases:

For the pattern "\\\n\0#", we would then have a (horizontal) space whose
spelling ends in a newline, and would decide that the '#' is at the start of a
line, and incorrectly start preprocessing a directive in the middle of a
logical source line. If we were already in the middle of a directive, this
would result in our attempting to process multiple directives at the same time!
This resulted in crashes, asserts, and hangs on invalid input, as discovered by
fuzz-testing.

For the pattern "\\\n" at EOF (with an implicit following nul byte), we would
produce a bogus trailing space character with spelling "\\\n". This was mostly
harmless, but would lead to clang-format getting confused and misformatting in
rare cases. We now produce a trailing EOF token with spelling "\\\n",
consistent with our handling for other similar cases -- an escaped newline is
always part of the token containing the next character, if any.

For the pattern "\\\n\n", this was somewhat more benign, but would produce an
extraneous whitespace token to clients who care about preserving whitespace.
However, it turns out that our lexing for line comments was relying on this bug
due to an off-by-one error in its computation of the end of the comment, on the
slow path where the comment might contain escaped newlines.

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

7 years agoRename coroutine warning when unhandled_exception() is missing
Eric Fiselier [Mon, 17 Apr 2017 23:28:02 +0000 (23:28 +0000)]
Rename coroutine warning when unhandled_exception() is missing

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

7 years agoRevert r300504 - [coroutines] Fix rebuilding of implicit and dependent coroutine...
Eric Fiselier [Mon, 17 Apr 2017 22:40:44 +0000 (22:40 +0000)]
Revert r300504 - [coroutines] Fix rebuilding of implicit and dependent coroutine statements.

I have no idea what's happening here. The tests that fail on all of the bots
pass on my machine. Further investigation needed.

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

7 years ago[ubsan] Skip null checks if they are constant-folded away
Vedant Kumar [Mon, 17 Apr 2017 22:26:10 +0000 (22:26 +0000)]
[ubsan] Skip null checks if they are constant-folded away

The IR builder can constant-fold null checks if the pointer operand
points to a constant. If the "is-non-null" check is folded away to
"true", don't emit the null check + branch.

Testing: check-clang, check-ubsan.

This slightly reduces the amount of null checks we emit when compiling
X86ISelLowering.cpp. Here are the numbers from patched/unpatched clangs
based on r300371.

  -------------------------------------
  | Setup          | # of null checks |
  -------------------------------------
  | unpatched, -O0 |            25251 |
  | patched, -O0   |            23925 | (-5.3%)
  -------------------------------------

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

7 years ago[ubsan] Skip null checks on pointers to the start of an alloca
Vedant Kumar [Mon, 17 Apr 2017 22:26:07 +0000 (22:26 +0000)]
[ubsan] Skip null checks on pointers to the start of an alloca

Pointers to the start of an alloca are non-null, so we don't need to
emit runtime null checks for them.

Testing: check-clang, check-ubsan.

This significantly reduces the amount of null checks we emit when
compiling X86ISelLowering.cpp. Here are the numbers from patched /
unpatched clangs based on r300371.

  -------------------------------------
  | Setup          | # of null checks |
  -------------------------------------
  | unpatched, -O0 |            45439 |
  | patched, -O0   |            25251 | (-44.4%)
  -------------------------------------

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

7 years ago[coroutines] Fix rebuilding of implicit and dependent coroutine statements.
Eric Fiselier [Mon, 17 Apr 2017 22:06:13 +0000 (22:06 +0000)]
[coroutines] Fix rebuilding of implicit and dependent coroutine statements.

Summary:
Certain implicitly generated coroutine statements, such as the calls to 'return_value()' or `return_void()` or `get_return_object_on_allocation_failure()`, cannot be built until the promise type is no longer dependent. This means they are not built until after the coroutine body statement has been transformed.

This patch fixes an issue where these statements would never be built for coroutine templates.

It also fixes a small issue where diagnostics about `get_return_object_on_allocation_failure()` were incorrectly suppressed.

Reviewers: rsmith, majnemer, GorNishanov, aaron.ballman

Reviewed By: GorNishanov

Subscribers: cfe-commits

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

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

7 years agoclang-cl: Support the /Zc:twoPhase[-] command-line option (PR32680)
Hans Wennborg [Mon, 17 Apr 2017 21:28:36 +0000 (21:28 +0000)]
clang-cl: Support the /Zc:twoPhase[-] command-line option (PR32680)

It sounds like MSVC is adding support for two-phase name lookup in a
future version, enabled by this flag (see bug).

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

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

7 years agoRevert "Address http://bugs.llvm.org/pr30994 so that a non-friend can properly replac...
Benjamin Kramer [Mon, 17 Apr 2017 20:57:40 +0000 (20:57 +0000)]
Revert "Address http://bugs.llvm.org/pr30994 so that a non-friend can properly replace a friend, and a visible friend can properly replace an invisible friend but not vice verse, and definitions are not replaced. This fixes the two FIXME in SemaTemplate/friend-template.cpp."

This reverts commit r300443. Breaks compiling libc++ with modules in
some configurations.

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

7 years agoCodeGen: Let byval parameter use alloca address space
Yaxun Liu [Mon, 17 Apr 2017 20:10:44 +0000 (20:10 +0000)]
CodeGen: Let byval parameter use alloca address space

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

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

7 years agoCodeGen: Let lifetime intrinsic use alloca address space
Yaxun Liu [Mon, 17 Apr 2017 20:03:11 +0000 (20:03 +0000)]
CodeGen: Let lifetime intrinsic use alloca address space

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

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

7 years agoUse default ref capture to simplify local lambdas, use a template to avoid std::funct...
David Blaikie [Mon, 17 Apr 2017 17:16:19 +0000 (17:16 +0000)]
Use default ref capture to simplify local lambdas, use a template to avoid std::function overhead, other cleanup

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

7 years ago[ObjC] Mark loads from __NSArray0 and __NSDictionary0 as invariant.load.
Akira Hatanaka [Mon, 17 Apr 2017 15:21:55 +0000 (15:21 +0000)]
[ObjC] Mark loads from __NSArray0 and __NSDictionary0 as invariant.load.

Also, simplify code by calling MakeNaturalAlignAddrLValue.

This is a follow-up to r300396.

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

7 years agoAddress http://bugs.llvm.org/pr30994 so that a non-friend can properly replace a...
Yaron Keren [Mon, 17 Apr 2017 08:51:20 +0000 (08:51 +0000)]
Address http://bugs.llvm.org/pr30994 so that a non-friend can properly replace a friend, and a visible friend can properly replace an invisible friend but not vice verse, and definitions are not replaced. This fixes the two FIXME in SemaTemplate/friend-template.cpp.

The code implements Richard Smith suggestion in comment 3 of the PR.

reviewer: Vassil Vassilev

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

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

7 years ago[clang] Register isConstexpr matcher
Alexander Shaposhnikov [Sun, 16 Apr 2017 19:05:17 +0000 (19:05 +0000)]
[clang] Register isConstexpr matcher

This diff registers isConstexpr matcher.

Test plan:
make check-all
check that "match varDecl(isConstexpr())"
works in clang-query

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

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

7 years agoUse setUsedForHeaderGuard() accessor function instead of direcly accessing UsedForHea...
Yaron Keren [Sun, 16 Apr 2017 15:53:19 +0000 (15:53 +0000)]
Use setUsedForHeaderGuard() accessor function instead of direcly accessing UsedForHeaderGuard.

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

7 years agoRevert r300420 - [coroutines] Fix building of new/delete expressions when get_return_...
Eric Fiselier [Sun, 16 Apr 2017 09:34:28 +0000 (09:34 +0000)]
Revert r300420 - [coroutines] Fix building of new/delete expressions when get_return_object_on_allocation_failure() is present

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

7 years ago[coroutines] Fix building of new/delete expressions when get_return_object_on_allocat...
Eric Fiselier [Sun, 16 Apr 2017 09:19:59 +0000 (09:19 +0000)]
[coroutines] Fix building of new/delete expressions when get_return_object_on_allocation_failure() is present.

Summary:
This patch implements [dcl.fct.def.coroutine]p8:
> The unqualified-id get_return_object_on_allocation_failure is looked up in the scope of
> class P by class member access lookup (3.4.5). If a declaration is found, ..., and if a
> global allocation function is selected, the ::operator new(size_t, nothrow_t) form shall be used.
> [...]
> The allocation function used in this case must have a non-throwing noexcept-specification.

Reviewers: GorNishanov, rsmith, majnemer, aaron.ballman

Reviewed By: GorNishanov

Subscribers: cfe-commits

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

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

7 years agoAdd isStaticStorageClass to the dynamic matcher registry so that it can be used from...
Aaron Ballman [Sat, 15 Apr 2017 12:53:20 +0000 (12:53 +0000)]
Add isStaticStorageClass to the dynamic matcher registry so that it can be used from clang-query.

Patch by Dave Lee.

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

7 years ago[ObjC] Use empty Objective-C collection literal constants when
Akira Hatanaka [Sat, 15 Apr 2017 06:42:00 +0000 (06:42 +0000)]
[ObjC] Use empty Objective-C collection literal constants when
available.

Original patch by Douglas Gregor with minor modifications.

This recommits r300389, which broke bots because there have been API
changes since the original patch was written.

rdar://problem/20689633

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

7 years agoWhen we turn on vsx it should also turn on altivec explicitly, same
Eric Christopher [Sat, 15 Apr 2017 06:15:00 +0000 (06:15 +0000)]
When we turn on vsx it should also turn on altivec explicitly, same
with disabling it as well as disabling all vsx specific features when
turning off altivec.

Fixes PR32663.

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

7 years agoDo not run tests for crash recovery if libstdc++ safe mode is enabled
Serge Pavlov [Sat, 15 Apr 2017 05:53:49 +0000 (05:53 +0000)]
Do not run tests for crash recovery if libstdc++ safe mode is enabled

If expensive checks are enabled, safe mode of libstdc++ is enabled too.
In this mode the library uses more complex data that allow additional
checks, for instance, a container may keep list of iterators that points
to it. If a code crashes it can leave these complex library objects in
inconsistent state. It occurs in a few tests that check error recovery
if compiler crashes. These test hang in expensive check mode, as the
library tries to synchronize access to the iterators pointing to some
container, but corresponding mutex remains locked after the crash.

This fix marks these tests as unsupported if clang is built with
libstdc++ safe mode enabled.

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

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

7 years agoRevert "[ObjC] Use empty Objective-C collection literal constants when"
Akira Hatanaka [Sat, 15 Apr 2017 05:44:27 +0000 (05:44 +0000)]
Revert "[ObjC] Use empty Objective-C collection literal constants when"

This reverts commit r300389. There were mistakes in the changes I made
to CodeGen.

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

7 years ago[ObjC] Use empty Objective-C collection literal constants when
Akira Hatanaka [Sat, 15 Apr 2017 05:31:35 +0000 (05:31 +0000)]
[ObjC] Use empty Objective-C collection literal constants when
available.

Original patch by Douglas Gregor with minor modifications.

rdar://problem/20689633

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

7 years ago[Coverage] Use the new getInstrProfSectionName API (NFC)
Vedant Kumar [Sat, 15 Apr 2017 00:10:05 +0000 (00:10 +0000)]
[Coverage] Use the new getInstrProfSectionName API (NFC)

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

7 years agoModules: Do not serialize #pragma pack state
Duncan P. N. Exon Smith [Sat, 15 Apr 2017 00:07:57 +0000 (00:07 +0000)]
Modules: Do not serialize #pragma pack state

The modules side of r299226, which serializes #pragma pack state,
doesn't work well.

The main purpose was to make -include and -include-pch match semantics
(the PCH side).  We also started serializing #pragma pack in PCMs, in
the hopes of making modules and non-modules builds more consistent.  But
consider:

    $ cat a.h
    $ cat b.h
    #pragma pack(push, 2)
    $ cat module.modulemap
    module M {
        module a { header "a.h" }
        module b { header "b.h" }
    }
    $ cat t.cpp
    #include "a.h"
    #pragma pack(show)

As of r299226, the #pragma pack(show) gives "2", even though we've only
included "a.h".

- With -fmodules-local-submodule-visibility, this is clearly wrong.  We
  should get the default state (8 on x86_64).

- Without -fmodules-local-submodule-visibility, this kind of matches how
  other things work (as if include-the-whole-module), but it's still
  really terrible, and it doesn't actually make modules and non-modules
  builds more consistent.

This commit disables the serialization for modules, essentially a
partial revert of r299226.

Going forward:

 1. Having this #pragma pack stuff escape is terrible design (or, more
    often, a horrible bug).  We should prioritize adding warnings (maybe
    -Werror by default?).

 2. If we eventually reintroduce this for modules, it should only apply
    to -fmodules-local-submodule-visibility, and it should be tracked on
    a per-submodule basis.

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

7 years ago[ubsan] Don't check alignment if the alignment is 1
Vedant Kumar [Fri, 14 Apr 2017 22:03:37 +0000 (22:03 +0000)]
[ubsan] Don't check alignment if the alignment is 1

If a pointer is 1-byte aligned, there's no use in checking its
alignment. Somewhat surprisingly, ubsan can spend a significant amount
of time doing just that!

This loosely depends on D30283.

Testing: check-clang, check-ubsan, and a stage2 ubsan build.

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

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

7 years ago[ubsan] Reduce alignment checking of C++ object pointers
Vedant Kumar [Fri, 14 Apr 2017 22:03:34 +0000 (22:03 +0000)]
[ubsan] Reduce alignment checking of C++ object pointers

This patch teaches ubsan to insert an alignment check for the 'this'
pointer at the start of each method/lambda. This allows clang to emit
significantly fewer alignment checks overall, because if 'this' is
aligned, so are its fields.

This is essentially the same thing r295515 does, but for the alignment
check instead of the null check. One difference is that we keep the
alignment checks on member expressions where the base is a DeclRefExpr.
There's an opportunity to diagnose unaligned accesses in this situation
(as pointed out by Eli, see PR32630).

Testing: check-clang, check-ubsan, and a stage2 ubsan build.

Along with the patch from D30285, this roughly halves the amount of
alignment checks we emit when compiling X86FastISel.cpp. Here are the
numbers from patched/unpatched clangs based on r298160.

  ------------------------------------------
  | Setup          | # of alignment checks |
  ------------------------------------------
  | unpatched, -O0 |                 24326 |
  | patched, -O0   |                 12717 | (-47.7%)
  ------------------------------------------

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

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

7 years agoRemoving a redundant, but harmless, %s; NFC.
Aaron Ballman [Fri, 14 Apr 2017 17:37:29 +0000 (17:37 +0000)]
Removing a redundant, but harmless, %s; NFC.

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

7 years ago[ObjC] Fix lifetime markers of loop variable in EmitObjCForCollectionStmt [take 2]
Kuba Mracek [Fri, 14 Apr 2017 16:53:25 +0000 (16:53 +0000)]
[ObjC] Fix lifetime markers of loop variable in EmitObjCForCollectionStmt [take 2]

CodeGenFunction::EmitObjCForCollectionStmt currently emits lifetime markers for the loop variable in an inconsistent way:  lifetime.start is emitted before the loop is entered, but lifetime.end is emitted inside the loop. AddressSanitizer uses these markers to track out-of-scope accesses to local variables, and we get false positives in Obj-C foreach loops (in the 2nd iteration of the loop). This patch keeps the loop variable alive for the whole loop by extending ForScope and registering the cleanup function inside EmitAutoVarAlloca.

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

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

7 years agoMake Gentoo GNU GCC Config override whitespace tolerant
Erich Keane [Fri, 14 Apr 2017 15:21:18 +0000 (15:21 +0000)]
Make Gentoo GNU GCC Config override whitespace tolerant

The config-*triple* file handling isn't tolerant of
leading/trailing whitespace, making it not terribly
obvious when a single extraneous tab/space/etc will
cause the override to be ignored. This patch simply
trims the lines to ensure that it is tolerant of
whitespace.

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

7 years ago[X86][SSE] Update MOVNTDQA non-temporal loads to generic implementation (clang)
Simon Pilgrim [Fri, 14 Apr 2017 15:05:57 +0000 (15:05 +0000)]
[X86][SSE] Update MOVNTDQA non-temporal loads to generic implementation (clang)

MOVNTDQA non-temporal aligned vector loads can be correctly represented using generic builtin loads, allowing us to remove the existing x86 intrinsics.

LLVM companion patch: D31767.

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

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

7 years agoPR32280: Do not crash on nested initializers.
Vassil Vassilev [Fri, 14 Apr 2017 08:48:08 +0000 (08:48 +0000)]
PR32280: Do not crash on nested initializers.

Patch by Yuka Takahashi (D31591)!

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

7 years ago[AMDGPU][GFX9] Set +fp32-denormals for >=gfx900 unless -cl-denorms-are-zero is set
Konstantin Zhuravlyov [Fri, 14 Apr 2017 05:33:57 +0000 (05:33 +0000)]
[AMDGPU][GFX9] Set +fp32-denormals for >=gfx900 unless -cl-denorms-are-zero is set

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

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

7 years agoFix use after free error
Xinliang David Li [Fri, 14 Apr 2017 04:14:29 +0000 (04:14 +0000)]
Fix use after free error

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

7 years agoclang/test/CoverageMapping/unused_names.c: Relax an expression for targeting PECOFF.
NAKAMURA Takumi [Fri, 14 Apr 2017 03:16:48 +0000 (03:16 +0000)]
clang/test/CoverageMapping/unused_names.c: Relax an expression for targeting PECOFF.

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

7 years agoRemove unused function /nfc
Xinliang David Li [Fri, 14 Apr 2017 03:01:25 +0000 (03:01 +0000)]
Remove unused function /nfc

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

7 years agoRemove empty test directory for nonexistent standard clause.
Richard Smith [Fri, 14 Apr 2017 02:04:44 +0000 (02:04 +0000)]
Remove empty test directory for nonexistent standard clause.

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

7 years ago[docs] UBSan: Mention that print_stacktrace=1 is unsupported on Darwin
Vedant Kumar [Fri, 14 Apr 2017 01:59:44 +0000 (01:59 +0000)]
[docs] UBSan: Mention that print_stacktrace=1 is unsupported on Darwin

Printing out stack traces along with UBSan diagnostics is unsupported on
Darwin. That's because it isn't possible to use the fast unwinder or the
slow unwinder.

Apparently, it's inappropriate to use the fast unwinder for UBSan
issues. I'm not exactly sure why (see the comment in ubsan_diag.cc).
Forcing use of the fast unwinder produces decent results, AFAICT.

Darwin also does not appear to have a slow unwinder suitable for use
with the sanitizers. Apparently that's because of PR20800 [1][2]. But
that bug has been fixed. I'm not sure if there is anything preventing
use of the slow unwinder now.

Currently, passing UBSAN_OPTIONS=print_stacktrace=1 does nothing on
Darwin. This isn't good, but it might be a while before we can fix the
situation, so we should at least document it.

[1] https://github.com/google/sanitizers/issues/137
"We can't use the slow unwinder on OSX now, because Clang produces
incorrect unwind info for the ASan runtime functions on OSX
(http://llvm.org/PR20800)."

[2] https://bugs.llvm.org/show_bug.cgi?id=20800
Bug 20800 - Invalid compact unwind info generated for a function without
frame pointers on OSX

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

7 years agoRevert r300287.
Kuba Mracek [Fri, 14 Apr 2017 01:00:03 +0000 (01:00 +0000)]
Revert r300287.

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

7 years ago[ObjC] Fix lifetime markers of loop variable in EmitObjCForCollectionStmt
Kuba Mracek [Fri, 14 Apr 2017 00:32:43 +0000 (00:32 +0000)]
[ObjC] Fix lifetime markers of loop variable in EmitObjCForCollectionStmt

CodeGenFunction::EmitObjCForCollectionStmt currently emits lifetime markers for the loop variable in an inconsistent way:  lifetime.start is emitted before the loop is entered, but lifetime.end is emitted inside the loop.  AddressSanitizer uses these markers to track out-of-scope accesses to local variables, and we get false positives in Obj-C foreach loops (in the 2nd iteration of the loop). The markers of the loop variable need to be either both inside the loop (so that we poison and unpoison the variable in each iteration), or both outside. This patch implements the "both inside" approach.

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

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

7 years agoFix PR31934: forming refs to functions with enable_if attrs.
George Burgess IV [Thu, 13 Apr 2017 23:47:08 +0000 (23:47 +0000)]
Fix PR31934: forming refs to functions with enable_if attrs.

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

7 years ago[Profile] PE binary coverage bug fix
Xinliang David Li [Thu, 13 Apr 2017 23:37:21 +0000 (23:37 +0000)]
[Profile] PE binary coverage bug fix

PR/32584

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

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

7 years ago[IR] Make getParamAttributes take argument numbers, not ArgNo+1
Reid Kleckner [Thu, 13 Apr 2017 23:12:13 +0000 (23:12 +0000)]
[IR] Make getParamAttributes take argument numbers, not ArgNo+1

Add hasParamAttribute() and use it instead of hasAttribute(ArgNo+1,
Kind) everywhere.

The fact that the AttributeList index for an argument is ArgNo+1 should
be a hidden implementation detail.

NFC

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

7 years ago[docs] Regenerate diagnostics reference.
Richard Smith [Thu, 13 Apr 2017 22:44:22 +0000 (22:44 +0000)]
[docs] Regenerate diagnostics reference.

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

7 years ago[docs] Fix a couple of typos in command line flag help text and regenerate documentation.
Richard Smith [Thu, 13 Apr 2017 22:39:49 +0000 (22:39 +0000)]
[docs] Fix a couple of typos in command line flag help text and regenerate documentation.

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

7 years agoAdd test for anonymous struct containing an implicitly private data member.
Richard Smith [Thu, 13 Apr 2017 21:51:04 +0000 (21:51 +0000)]
Add test for anonymous struct containing an implicitly private data member.

Patch by Jacob Young!

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

7 years agoDiagnose attempt to take address of bitfield members in anonymous structs.
Richard Smith [Thu, 13 Apr 2017 21:49:46 +0000 (21:49 +0000)]
Diagnose attempt to take address of bitfield members in anonymous structs.

Patch by Jacob Young!

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

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

7 years agoPR32185: Revert r291512 and add a testcase for PR32185.
Richard Smith [Thu, 13 Apr 2017 21:37:24 +0000 (21:37 +0000)]
PR32185: Revert r291512 and add a testcase for PR32185.

This reverts an attempt to check that types match when matching a
dependently-typed non-type template parameter. (This comes up when matching the
parameters of a template template parameter against the parameters of a
template template argument.)

The matching rules here are murky at best. Our behavior after this revert is
definitely wrong for certain C++17 features (for 'auto' template parameter
types within the parameter list of a template template argument in particular),
but our behavior before this revert is wrong for some pre-existing testcases,
so reverting to our prior behavior seems like our best option.

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

7 years ago[CMake] Support building Fuchsia toolchain on Darwin
Petr Hosek [Thu, 13 Apr 2017 21:09:42 +0000 (21:09 +0000)]
[CMake] Support building Fuchsia toolchain on Darwin

This is already supported on Linux but on Darwin it requires some
extra flags.

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

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

7 years agoclang-format-vs licence.txt: drop svn:executable
Hans Wennborg [Thu, 13 Apr 2017 20:09:18 +0000 (20:09 +0000)]
clang-format-vs licence.txt: drop svn:executable

Not sure how it ended up with that property in the first place.

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

7 years agoFollow-up to r300225: update ClangFormat.csproj too
Hans Wennborg [Thu, 13 Apr 2017 18:15:00 +0000 (18:15 +0000)]
Follow-up to r300225: update ClangFormat.csproj too

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

7 years agoFollow-up to r300225: update ClangFormat.sln to VS2017
Hans Wennborg [Thu, 13 Apr 2017 17:47:47 +0000 (17:47 +0000)]
Follow-up to r300225: update ClangFormat.sln to VS2017

This got lost in the previous patch somehow.

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

7 years agoWarning-free clang-format plugin install for VS 15.0
Hans Wennborg [Thu, 13 Apr 2017 17:42:45 +0000 (17:42 +0000)]
Warning-free clang-format plugin install for VS 15.0

With the new release of VS, it's required that all plugins migrate to
the new VSIX manifest format. The new format is backwards compatible
with all versions newer that Visual Studio 2012, so this migration
effectively drops support for older versions of the IDE.

It's also required that these new extensions are built with Visual
Studio 2017, so unfortunately it was necessary to migrate the project
and solution. Also removed COM references to EnvDTE and
Microsoft.VisualStudio.TextManager.Interop from the csproj, as they seem
to both be unnecessary and would trigger build warnings because of
changes to GAC.

Patch by Hugo Puhlmann!

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

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

7 years agoclang-format-vs: Use a separate license.txt copy
Hans Wennborg [Thu, 13 Apr 2017 17:37:17 +0000 (17:37 +0000)]
clang-format-vs: Use a separate license.txt copy

The regular file used to display very poorly in the VSIX installer due
to long lines, wrapping etc.

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

7 years agoUse the clang-cl recognized spelling of --target=
Reid Kleckner [Thu, 13 Apr 2017 16:36:28 +0000 (16:36 +0000)]
Use the clang-cl recognized spelling of --target=

This fixes a warning. The test was passing without this change.

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

7 years agoRe-land "[clang-cl] Make all sanitizer flags available in clang-cl"
Reid Kleckner [Thu, 13 Apr 2017 16:32:26 +0000 (16:32 +0000)]
Re-land "[clang-cl] Make all sanitizer flags available in clang-cl"

Adding RUN lines with %clang_cl was causing these tests to fail on Mac
because absolute paths there tend to start with "/User/", which is
recognized as the "/U" flag.

Re-lands r300122

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

7 years ago[analyzer] Enforce super-region classes for various memory regions.
Artem Dergachev [Thu, 13 Apr 2017 09:56:07 +0000 (09:56 +0000)]
[analyzer] Enforce super-region classes for various memory regions.

We now check the type of the super-region pointer for most SubRegion classes
in compile time; some checks are run-time though.

This is an API-breaking change (we now require explicit casts to specific region
sub-classes), but in practice very few checkers are affected.

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

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

7 years ago[analyzer] Add numerous assertions to SVal, SymExpr, and MemRegion classes.
Artem Dergachev [Thu, 13 Apr 2017 09:48:05 +0000 (09:48 +0000)]
[analyzer] Add numerous assertions to SVal, SymExpr, and MemRegion classes.

Clean up vtable anchors (remove anchors for regions that have regular
out-of-line virtual methods, add anchors for regions that don't have those).

Fix private/public methods (all constructors should now be private for leaf
classes, protected for abstract classes).

No functional change intended, only extra sanity checks and cleanups.

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

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

7 years agoRevert "[clang-cl] Make all sanitizer flags available in clang-cl"
Akira Hatanaka [Thu, 13 Apr 2017 08:02:29 +0000 (08:02 +0000)]
Revert "[clang-cl] Make all sanitizer flags available in clang-cl"

This reverts commit 47979b20b475664013d19382fc6875b5b9f3ed9d.

This was causing a couple of bots to fail.

http://lab.llvm.org:8080/green/job/clang-stage1-configure-RA_check/30152

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

7 years ago[analyzer] Simplify values in binary operations a bit more aggressively.
Artem Dergachev [Thu, 13 Apr 2017 07:20:04 +0000 (07:20 +0000)]
[analyzer] Simplify values in binary operations a bit more aggressively.

SValBuilder tries to constant-fold symbols in the left-hand side of the symbolic
expression whenever it fails to evaluate the expression directly. However, it
only constant-folds them when they are atomic expressions, not when they are
complicated expressions themselves. This patch adds recursive constant-folding
to the left-hand side subexpression (there's a lack of symmetry because we're
trying to have symbols on the left and constants on the right). As an example,
we'd now be able to handle operations similar to "$x + 1 < $y", when $x is
constrained to a constant.

rdar://problem/31354676

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

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

7 years ago[IR] Take func, ret, and arg attrs separately in AttributeList::get
Reid Kleckner [Thu, 13 Apr 2017 00:58:09 +0000 (00:58 +0000)]
[IR] Take func, ret, and arg attrs separately in AttributeList::get

This seems like a much more natural API, based on Derek Schuff's
comments on r300015. It further hides the implementation detail of
AttributeList that function attributes come last and appear at index
~0U, which is easy for the user to screw up. git diff says it saves code
as well: 97 insertions(+), 137 deletions(-)

This also makes it easier to change the implementation, which I want to
do next.

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

7 years agoFix broken test. We can't assume that 2MB of args is enough to require a response...
Richard Smith [Thu, 13 Apr 2017 00:46:50 +0000 (00:46 +0000)]
Fix broken test. We can't assume that 2MB of args is enough to require a response file.

This test has apparently been broken for years, but we never noticed before
because it's a long test and long tests approximately never get run.

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

7 years agoExternalASTMerger.cpp: Silence another warning. [-Wunused-lambda-capture]
NAKAMURA Takumi [Thu, 13 Apr 2017 00:17:28 +0000 (00:17 +0000)]
ExternalASTMerger.cpp: Silence another warning. [-Wunused-lambda-capture]

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

7 years agoUpdate to match LLVM r300135.
Richard Smith [Wed, 12 Apr 2017 23:21:25 +0000 (23:21 +0000)]
Update to match LLVM r300135.

Remove "REQUIRES: long_tests" from test/Driver/response-file.c since it is now about 10x faster. (We can add that back if it's still too slow for some buildbot.)

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

7 years ago[clang-cl] Make all sanitizer flags available in clang-cl
Reid Kleckner [Wed, 12 Apr 2017 22:50:51 +0000 (22:50 +0000)]
[clang-cl] Make all sanitizer flags available in clang-cl

Summary:
Use a tablegen let {} block so that new sanitizer flags are available by
default in all driver modes. This should cut down on time wasted with
bugs like http://crbug.com/710928.

Reviewers: vitalybuka, hans

Subscribers: kcc, llvm-commits

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

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

7 years ago[Sema] Add __is_aggregate type-trait
Eric Fiselier [Wed, 12 Apr 2017 22:12:15 +0000 (22:12 +0000)]
[Sema] Add __is_aggregate type-trait

Summary:
[LWG 2911](http://cplusplus.github.io/LWG/lwg-defects.html#2911) adds `std::is_aggregate` to the library, which requires a new builtin trait. This patch implements `__is_aggregate`.

Reviewers: rsmith, majnemer, aaron.ballman

Reviewed By: aaron.ballman

Subscribers: STL_MSFT, cfe-commits

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

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

7 years ago[analyzer] Add a check for IvarRegion in getExtraInvalidatedValues
Alexander Shaposhnikov [Wed, 12 Apr 2017 22:00:13 +0000 (22:00 +0000)]
[analyzer] Add a check for IvarRegion in getExtraInvalidatedValues

This diff adds a defensive check in getExtraInvalidatedValues
for the case when there are no regions for the ivar associated with
a property. Corresponding test case added.

Test plan:
make check-clang
make check-clang-analysis

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

7 years ago[modules] Delay calling DeclMustBeEmitted until it's safe.
Vassil Vassilev [Wed, 12 Apr 2017 21:56:05 +0000 (21:56 +0000)]
[modules] Delay calling DeclMustBeEmitted until it's safe.

This patch implements the suggestion in D29753 that calling DeclMustBeEmitted in
the middle of deserialization should be avoided and that the actual check should
be deferred until it's safe to do so.

This patch fixes a crash when accessing the invalid redecl chains while trying
to evaluate the value of a const VarDecl that contains a function call.

Patch by Raphael Isemann (D30793)!

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

7 years ago[Driver] Add compiler option to generate a reproducer
Bruno Cardoso Lopes [Wed, 12 Apr 2017 21:46:20 +0000 (21:46 +0000)]
[Driver] Add compiler option to generate a reproducer

One way to currently test the reproducers is to setup
"FORCE_CLANG_DIAGNOSTICS_CRASH=1" before invoking clang. This simulates
a crash and produces the same contents needed by the reproducers.  The
reproducers are specially useful when triaging Modules issues, not only
on crashes, but also for reproducing misleading warnings, errors, etc.

Add a '-gen-reproducer' driver option to clang (or any similar name) and
give users a flag option.

Note that clang already has a -fno-crash-diagnostics, which disables the
crash reproducers. I've decided not to propose "-fcrash-diagnostics"
since it doesn't convey the ideia of reproduction despite a crash.

rdar://problem/24114619

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

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

7 years ago[Modules] Enable local submodule visibility for ObjC/C
Bruno Cardoso Lopes [Wed, 12 Apr 2017 21:46:16 +0000 (21:46 +0000)]
[Modules] Enable local submodule visibility for ObjC/C

Remove the restriction where this is only valid with C++

rdar://problem/29055656

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

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

7 years agoModular Codegen: Include testing for inline asm as well as some commentary on the...
David Blaikie [Wed, 12 Apr 2017 21:14:04 +0000 (21:14 +0000)]
Modular Codegen: Include testing for inline asm as well as some commentary on the implementaiton choice.

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

7 years agoFix up test to handle the now split -fmodules-codegen and -fmodules-debuginfo flags
David Blaikie [Wed, 12 Apr 2017 21:09:34 +0000 (21:09 +0000)]
Fix up test to handle the now split -fmodules-codegen and -fmodules-debuginfo flags

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

7 years agoModular Codegen: Separate flags for function and debug info support
David Blaikie [Wed, 12 Apr 2017 20:58:33 +0000 (20:58 +0000)]
Modular Codegen: Separate flags for function and debug info support

This allows using and testing these two features separately. (noteably,
debug info is, so far as I know, always a win (basically). But function
modular codegen is currently a loss for highly optimized code - where
most of the linkonce_odr definitions are optimized away, so providing
weak_odr definitions is only overhead)

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

7 years agoRevert r300001 "Revert r298824 & r298816, recommit r298742 & r298754"
Hans Wennborg [Wed, 12 Apr 2017 16:40:26 +0000 (16:40 +0000)]
Revert r300001 "Revert r298824 & r298816, recommit r298742 & r298754"

It caused PR32640.

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