Commit Graph

47303 Commits

Author SHA1 Message Date
Kostya Serebryany 1a02d8bc8d [sanitizer-coverage] deprecate -fsanitize-coverage=8bit-counters
llvm-svn: 300744
2017-04-19 20:15:58 +00:00
David Blaikie 6e2ec5f10e Parse backend options during thinlto backend compile actions
llvm-svn: 300741
2017-04-19 20:08:21 +00:00
Kostya Serebryany 9d1ed13b53 [sanitizer-coverage] deprecate some of the stale coverage variants
llvm-svn: 300738
2017-04-19 19:57:16 +00:00
Vedant Kumar f224d707df [Coverage] Don't emit mappings for functions in dependent contexts (fixes PR32679)
The coverage implementation marks functions which won't be emitted as
'deferred', so that it can emit empty coverage regions for them later
(once their linkages are known).

Functions in dependent contexts are an exception: if there isn't a full
instantiation of a function, it shouldn't be marked 'deferred'. We've
been breaking that rule without much consequence because we just ended
up with useless, extra, empty coverage mappings. With PR32679, this
behavior finally caused a crash, because clang marked a partial template
specialization as 'deferred', causing the MS mangler to choke in its
delayed-template-parsing mode:

  error: cannot mangle this template type parameter type yet
  (http://bugs.llvm.org/show_bug.cgi?id=32679)

Fix this by checking if a decl's context is a dependent context before
marking it 'deferred'.

Based on a patch by Adam Folwarczny!

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

llvm-svn: 300723
2017-04-19 17:58:30 +00:00
Akira Hatanaka 3901377c22 [Sema][ObjC] Disallow jumping into ObjC fast enumeration loops.
rdar://problem/31635406

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

llvm-svn: 300722
2017-04-19 17:54:08 +00:00
Reid Kleckner 9d16fa09c6 Prefer addAttr(Attribute::AttrKind) over the AttributeList overload
This should simplify the call sites, which typically want to tweak one
attribute at a time. It should also avoid creating ephemeral
AttributeLists that live forever.

llvm-svn: 300718
2017-04-19 17:28:52 +00:00
Alex Lorenz 24952fbc6f Add #pragma clang attribute support to the external_source_symbol attribute
Prior to this commit the external_source_symbol attribute wasn't supported by
#pragma clang attribute for the following two reasons:

- The Named attribute subject hasn't been supported by TableGen.
- There was no way to specify a subject match rule for #pragma clang attribute
 that could operate on a set of attribute subjects (e.g. the ones that derive
 from NamedDecl).

This commit fixes the two issues and thus adds external_source_symbol support to
#pragma clang attribute.

rdar://31169028

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

llvm-svn: 300712
2017-04-19 15:52:11 +00:00
Gabor Horvath 10a837a27e Remove unnecessary condition as suggested by clang-tidy. NFC
Patch by: Gergely Angeli!

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

llvm-svn: 300703
2017-04-19 15:11:10 +00:00
Jonas Hahnfeld 8ea76fa9b4 [Driver] Unify linking of OpenMP runtime. NFCI.
While at it, extend test for FreeBSD and check for -lrt iff on Linux.

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

llvm-svn: 300689
2017-04-19 13:55:39 +00:00
Roger Ferrer Ibanez cb89513bc7 Avoid assert when a non-static member function is qualified with __unaligned
Under -fms-extensions __unaligned is a type-qualifier that can be applied to a
non-static member function declaration.

This causes an assertion when mangling the name under Itanium, where that
qualifier is not mangled.

This patch justs makes the minimal change to avoid the crash and avoid mangling
__unaligned, as it currently happens with non-member functions.

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

llvm-svn: 300686
2017-04-19 12:23:28 +00:00
Alex Lorenz 1be800c511 Add support for editor placeholders to Clang
This commit teaches Clang to recognize editor placeholders that are produced
when an IDE like Xcode inserts a code-completion result that includes a
placeholder. Now when the lexer sees a placeholder token, it emits an
'editor placeholder in source file' error and creates an identifier token
that represents the placeholder. The parser/sema can now recognize the
placeholders and can suppress the diagnostics related to the placeholders. This
ensures that live issues in an IDE like Xcode won't get spurious diagnostics
related to placeholders.

This commit also adds a new compiler option named '-fallow-editor-placeholders'
that silences the 'editor placeholder in source file' error. This is useful
for an IDE like Xcode as we don't want to display those errors in live issues.

rdar://31581400

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

llvm-svn: 300667
2017-04-19 08:58:56 +00:00
Daniel Jasper 47d58ea681 clang-format: Properly match parens of macro parameter lists.
No tests yet, but this will be tested by the upcoming:
https://reviews.llvm.org/D28462

llvm-svn: 300661
2017-04-19 06:06:38 +00:00
Chandler Carruth bd186c0787 Revert r300653 and r300650. The underlying commit fixes one issue with
modules but exposes much more widespread issues. Example and more
information is on the review thread for r300650.

Original commit summary:
[modules] Properly look up the owning module for an instantiation of a merged template.

llvm-svn: 300659
2017-04-19 05:25:13 +00:00
Craig Topper 73daaa8fb2 [CodeGen] Use APInt::lshrInPlace instead of APInt::lshr. NFC
llvm-svn: 300658
2017-04-19 05:17:33 +00:00
Richard Smith eb86173f7b Fix member function call with null 'this' pointer.
llvm-svn: 300653
2017-04-19 02:19:21 +00:00
Richard Smith 5aacc4021b [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.

llvm-svn: 300650
2017-04-19 01:36:43 +00:00
Reid Kleckner cdd26794a9 Use less temporary AttributeLists NFC
llvm-svn: 300628
2017-04-18 23:50:03 +00:00
Richard Smith 34e485f922 [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.)

llvm-svn: 300611
2017-04-18 21:55:37 +00:00
Richard Smith 4c132e576b Do not warn about whitespace between ??/ trigraph and newline in line comments if trigraphs are disabled in the current language.
llvm-svn: 300609
2017-04-18 21:45:04 +00:00
Vassil Vassilev a0320b97fa PR30508: Downgrade error to warning if the umbrella folder doesn't exist.
Patch by Yuka Takahashi (D32119)!

llvm-svn: 300594
2017-04-18 20:57:29 +00:00
Alex Lorenz 26b476502c 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.

llvm-svn: 300591
2017-04-18 20:54:23 +00:00
Ekaterina Romanova 0a40d67b20 [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.

llvm-svn: 300578
2017-04-18 19:44:07 +00:00
Reid Kleckner cc7a035a2e 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

llvm-svn: 300572
2017-04-18 17:44:41 +00:00
Manoj Gupta bb75b35811 [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

llvm-svn: 300571
2017-04-18 17:36:10 +00:00
Alex Lorenz 47fd10c3b5 [ASTPrinter] Print template parameter lists for out-of-line functions
llvm-svn: 300560
2017-04-18 15:12:34 +00:00
Alex Lorenz 9e7bf161ea 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

llvm-svn: 300556
2017-04-18 14:33:39 +00:00
Martell Malone f9799c70a3 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

llvm-svn: 300555
2017-04-18 14:27:36 +00:00
Oliver Stannard 692dc54b0d [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

llvm-svn: 300550
2017-04-18 13:21:05 +00:00
Oliver Stannard 233310f3e6 [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.

llvm-svn: 300549
2017-04-18 13:12:36 +00:00
Alex Lorenz 3bfe962afa 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.

llvm-svn: 300543
2017-04-18 10:46:41 +00:00
Alex Lorenz 787fbd7add Fix one more 'not all control paths return a value' MSVC warning
The warning was caused by r300539.

llvm-svn: 300542
2017-04-18 10:17:41 +00:00
Alex Lorenz 0a849f47d2 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

llvm-svn: 300539
2017-04-18 09:41:47 +00:00
Eric Fiselier c512875ff6 Assert that a valid operator new/delete signature is always found by the coroutine body
llvm-svn: 300529
2017-04-18 05:30:39 +00:00
Eric Fiselier f747f53238 Speculatively attempt to fix bot failures caused by recent coroutine changes.
llvm-svn: 300528
2017-04-18 05:08:08 +00:00
Eric Fiselier f692e7db51 [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

llvm-svn: 300524
2017-04-18 03:12:48 +00:00
Adrian Prantl c3782a1a6f 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

llvm-svn: 300523
2017-04-18 01:22:01 +00:00
Richard Smith 1d2ae94b5d 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.

llvm-svn: 300515
2017-04-17 23:44:51 +00:00
Eric Fiselier 47ee0f4d31 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.

llvm-svn: 300511
2017-04-17 22:40:44 +00:00
Vedant Kumar dbbdda4d23 [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%)
  -------------------------------------

llvm-svn: 300509
2017-04-17 22:26:10 +00:00
Vedant Kumar 379d9c1dc6 [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%)
  -------------------------------------

llvm-svn: 300508
2017-04-17 22:26:07 +00:00
Eric Fiselier fb289ecde0 [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

llvm-svn: 300504
2017-04-17 22:06:13 +00:00
Benjamin Kramer dcb52b167a 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.

llvm-svn: 300497
2017-04-17 20:57:40 +00:00
Yaxun Liu d7523283a7 CodeGen: Let byval parameter use alloca address space
Differential Revision: https://reviews.llvm.org/D32133

llvm-svn: 300487
2017-04-17 20:10:44 +00:00
Yaxun Liu 7f7f323e4f CodeGen: Let lifetime intrinsic use alloca address space
Differential Revision: https://reviews.llvm.org/D31717

llvm-svn: 300485
2017-04-17 20:03:11 +00:00
David Blaikie 0a0c033295 Use default ref capture to simplify local lambdas, use a template to avoid std::function overhead, other cleanup
llvm-svn: 300461
2017-04-17 17:16:19 +00:00
Akira Hatanaka b5d1ea44af [ObjC] Mark loads from __NSArray0 and __NSDictionary0 as invariant.load.
Also, simplify code by calling MakeNaturalAlignAddrLValue.

This is a follow-up to r300396.

llvm-svn: 300454
2017-04-17 15:21:55 +00:00
Yaron Keren 27e2ff964f 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

llvm-svn: 300443
2017-04-17 08:51:20 +00:00
Alexander Shaposhnikov ae33dfac6e [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

llvm-svn: 300427
2017-04-16 19:05:17 +00:00
Yaron Keren 9370ea2058 Use setUsedForHeaderGuard() accessor function instead of direcly accessing UsedForHeaderGuard.
llvm-svn: 300423
2017-04-16 15:53:19 +00:00
Eric Fiselier 1bcc937b56 Revert r300420 - [coroutines] Fix building of new/delete expressions when get_return_object_on_allocation_failure() is present
llvm-svn: 300421
2017-04-16 09:34:28 +00:00