]> granicus.if.org Git - clang/log
clang
7 years ago[ObjC++] Conversions from specialized to non-specialized Objective-C generic
Alex Lorenz [Thu, 6 Apr 2017 13:06:34 +0000 (13:06 +0000)]
[ObjC++] Conversions from specialized to non-specialized Objective-C generic
object types should be preferred over conversions to other object pointers

This change ensures that Clang will select the correct overload for the
following code sample:

  void overload(Base *b);
  void overload(Derived *d);
  void test(Base<Base *> b) {
    overload(b); // Select overload(Base *), not overload(Derived *)
  }

rdar://20124827

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

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

7 years agoFix lambda to block conversion in C++17 by avoiding copy elision for the
Alex Lorenz [Thu, 6 Apr 2017 12:53:43 +0000 (12:53 +0000)]
Fix lambda to block conversion in C++17 by avoiding copy elision for the
lambda capture used by the created block

The commit r288866 introduced guaranteed copy elision to C++ 17. This
unfortunately broke the lambda to block conversion in C++17 (the compiler
crashes when performing IRGen). This commit fixes the conversion by avoiding
copy elision for the capture that captures the lambda that's used in the block
created by the lambda to block conversion process.

rdar://31385153

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

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

7 years ago[Sema] Retarget test to a specific platform for consistent datasizes
Simon Dardis [Thu, 6 Apr 2017 11:12:14 +0000 (11:12 +0000)]
[Sema] Retarget test to a specific platform for consistent datasizes

Attempt to satisfy llvm-clang-x86_64-expensive-checks-win by targeting
x86_64-apple-darwin10 for Sema/vector-ops.c. The underlying failure is
due to datatype differences between platforms.

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

7 years ago[Sema] Extend GetSignedVectorType to deal with non ExtVector types
Simon Dardis [Thu, 6 Apr 2017 10:38:03 +0000 (10:38 +0000)]
[Sema] Extend GetSignedVectorType to deal with non ExtVector types

This improves some error messages which would otherwise refer to
ext_vector_type types in contexts where there are no such types.

Factored out from D25866 at reviewer's request.

Reviewers: bruno

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

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

7 years agoPR16106: Correct the docs to reflect the actual behavior of the interface.
Vassil Vassilev [Thu, 6 Apr 2017 10:05:46 +0000 (10:05 +0000)]
PR16106: Correct the docs to reflect the actual behavior of the interface.

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

7 years ago[Sema] Update CheckOverload docs
George Burgess IV [Thu, 6 Apr 2017 00:23:31 +0000 (00:23 +0000)]
[Sema] Update CheckOverload docs

- Replace documented return values (true/false) with what's actually
  returned
- Doxygenify the comment
- Reflow said comment to 80 cols

Not overly familiar with Doxygen, so nits are welcome. :)

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

7 years agoSimplify. NFC.
George Burgess IV [Thu, 6 Apr 2017 00:08:35 +0000 (00:08 +0000)]
Simplify. NFC.

Two simplifications:
- We check `!Previous.empty()` above and only use `Previous` in const
  contexts after that check, so the `!Previous.empty()` check seems
  redundant.
- The null check looks pointless, as well: AFAICT, `LookupResults`
  should never contain null entries, and `OldDecl` should always be
  non-null if `Redeclaration` is true.

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

7 years ago[Driver] Print a newline when invoking `-print-resource-dir`
Meador Inge [Wed, 5 Apr 2017 22:27:20 +0000 (22:27 +0000)]
[Driver] Print a newline when invoking `-print-resource-dir`

The commit yesterday (r299473) to add the `-print-resource-dir`
option was supposed to emit a newline after the resource dir.

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

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

7 years ago[lit] Fix Analysis test format pickling error
Reid Kleckner [Wed, 5 Apr 2017 18:56:48 +0000 (18:56 +0000)]
[lit] Fix Analysis test format pickling error

Move the test format into a standalone .py file and add it to the site
module search path. This allows us to run the test on Windows, and it
makes it compatible with the multiprocessing.Pool lit test execution
strategy.

I think this test was only passing everywhere else because
multiprocessing uses 'fork' to spawn workers, so the test format never
needs to be pickled.

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

7 years agoclang-format: Support formatting utf-8 character literals in C++11+ mode.
Nico Weber [Wed, 5 Apr 2017 18:10:42 +0000 (18:10 +0000)]
clang-format: Support formatting utf-8 character literals in C++11+ mode.

clang-format <<END
auto c1 = u8'a';
auto c2 = u'a';
END

Before:
  auto c1 = u8 'a';
  auto c2 = u'a';

Now:
  auto c1 = u8'a';
  auto c2 = u'a';

Patch from Denis Gladkikh <llvm@denis.gladkikh.email>!

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

7 years agoRevert "[analyzer] Add a modular constraint system to the CloneDetector"
Artem Dergachev [Wed, 5 Apr 2017 15:06:17 +0000 (15:06 +0000)]
Revert "[analyzer] Add a modular constraint system to the CloneDetector"

This reverts commit r299544.

Crashes on tests on some buildbots.

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

7 years ago[analyzer] Add a modular constraint system to the CloneDetector
Artem Dergachev [Wed, 5 Apr 2017 14:17:36 +0000 (14:17 +0000)]
[analyzer] Add a modular constraint system to the CloneDetector

A big part of the clone detection code is functionality for filtering clones and
clone groups based on different criteria. So far this filtering process was
hardcoded into the CloneDetector class, which made it hard to understand and,
ultimately, to extend.

This patch splits the CloneDetector's logic into a sequence of reusable
constraints that are used for filtering clone groups. These constraints
can be turned on and off and reodreder at will, and new constraints are easy
to implement if necessary.

Unit tests are added for the new constraint interface.

This is a refactoring patch - no functional change intended.

Patch by Raphael Isemann!

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

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

7 years agoclang-format-vsix: Add "Format on Save" feature
Antonio Maiorano [Wed, 5 Apr 2017 14:13:45 +0000 (14:13 +0000)]
clang-format-vsix: Add "Format on Save" feature

This change adds a feature to the clang-format VS extension that optionally
enables the automatic formatting of documents when saving. Since developers
always need to save their files, this eases the workflow of making sure source
files are properly formatted.

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

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

7 years ago-Wunreachable-code: 'true' and 'false' should not be treated as configuration
Alex Lorenz [Wed, 5 Apr 2017 14:07:21 +0000 (14:07 +0000)]
-Wunreachable-code: 'true' and 'false' should not be treated as configuration
macros

Clang should emit -Wunreachable-code warnings in C mode for code that's
unreachable because of a 'false' or '!true' condition.

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

7 years ago[OpenCL] Extended diagnostics for atomic initialization
Egor Churaev [Wed, 5 Apr 2017 12:47:10 +0000 (12:47 +0000)]
[OpenCL] Extended diagnostics for atomic initialization

Summary:
I saw the same changes in the following review: https://reviews.llvm.org/D17438

I don't know in that way I could determine that atomic variable was initialized by macro ATOMIC_VAR_INIT. Anyway I added check that atomic variables can be initialize only in global scope.
I think that we can discuss this change.

Reviewers: Anastasia, cfe-commits

Reviewed By: Anastasia

Subscribers: bader, yaxunl

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

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

7 years agoclang-format: [JS] fix whitespace around "of" operator.
Martin Probst [Wed, 5 Apr 2017 10:56:07 +0000 (10:56 +0000)]
clang-format: [JS] fix whitespace around "of" operator.

Summary:
Previously:
    import {of } from 'x';
    of (null);

Now:
    import {of} from 'x';
    of(null);

Reviewers: djasper

Subscribers: cfe-commits, klimek

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

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

7 years ago[OpenCL] Enables passing sampler initializer to function argument
Egor Churaev [Wed, 5 Apr 2017 09:02:56 +0000 (09:02 +0000)]
[OpenCL] Enables passing sampler initializer to function argument

Reviewers: Anastasia, cfe-commits

Reviewed By: Anastasia

Subscribers: yaxunl, bader

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

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

7 years ago[analyzer] alpha.core.Conversion - Fix false positive for 'U32 += S16;' expression...
Daniel Marjamaki [Wed, 5 Apr 2017 08:57:04 +0000 (08:57 +0000)]
[analyzer] alpha.core.Conversion - Fix false positive for 'U32 += S16;' expression, that is not unsafe

Summary:
The alpha.core.Conversion was too strict about compound assignments and could warn even though there is no problem.

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

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

7 years agoDon't issue a warning if the shadowing declaration is in a class
Stephan Bergmann [Wed, 5 Apr 2017 08:36:58 +0000 (08:36 +0000)]
Don't issue a warning if the shadowing declaration is in a class

Follow-up to r299363 "Enhance -Wshadow to warn when shadowing typedefs or type
aliases".

Patch by Ahmed Asadi.

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

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

7 years ago[coroutines] Add coro.end handling
Gor Nishanov [Wed, 5 Apr 2017 04:55:03 +0000 (04:55 +0000)]
[coroutines] Add coro.end handling

Summary:
For WinEH, We add a funclet bundle to a coro.end call, so that CoroSplit in LLVM can replace it with cleanup ret and cut the rest out.
For landing pad, we add a branch to resume block if coro.end returns true.

LLVM Part: https://reviews.llvm.org/D25445

Reviewers: majnemer

Reviewed By: majnemer

Subscribers: EricWF, cfe-commits, rsmith, mehdi_amini

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

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

7 years agoAnother attempt to fix the sphinx warning from r299470
Adam Nemet [Tue, 4 Apr 2017 23:46:34 +0000 (23:46 +0000)]
Another attempt to fix the sphinx warning from r299470

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

7 years agoFix sphinx warning from r299470
Adam Nemet [Tue, 4 Apr 2017 22:45:20 +0000 (22:45 +0000)]
Fix sphinx warning from r299470

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

7 years ago[Driver] Add option to print the resource directory
Meador Inge [Tue, 4 Apr 2017 21:46:50 +0000 (21:46 +0000)]
[Driver] Add option to print the resource directory

This patch adds the option -print-resource-dir. It simply
prints the resource directory. This information will eventually
be used in compiler-rt to setup COMPILER_RT_LIBRARY_INSTALL_DIR.

Patch by Catherine Moore!

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

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

7 years agoAdd #pragma clang fp
Adam Nemet [Tue, 4 Apr 2017 21:18:36 +0000 (21:18 +0000)]
Add #pragma clang fp

This adds the new pragma and the first variant, contract(on/off/fast).

The pragma has the same block scope rules as STDC FP_CONTRACT, i.e. it can be
placed at the beginning of a compound statement or at file scope.

Similarly to STDC FP_CONTRACT there is no need to use attributes.  First an
annotate token is inserted with the parsed details of the pragma.  Then the
annotate token is parsed in the proper contexts and the Sema is updated with
the corresponding FPOptions using the shared ActOn function with STDC
FP_CONTRACT.

After this the FPOptions from the Sema is propagated into the AST expression
nodes.  There is no change here.

I was going to add a 'default' option besides 'on/off/fast' similar to STDC
FP_CONTRACT but then decided against it. I think that we'd have to make option
uppercase then to avoid using 'default' the keyword.  Also because of the
scoped activation of pragma I am not sure there is really a need a for this.

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

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

7 years agoSet FMF for -ffp-contract=fast
Adam Nemet [Tue, 4 Apr 2017 21:18:30 +0000 (21:18 +0000)]
Set FMF for -ffp-contract=fast

With this, FMF(contract) becomes an alternative way to express the request to
contract.

These are currently only propagated for FMul, FAdd and FSub.  The rest will be
added as more FMFs are hooked up for this.

This is toward fixing PR25721.

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

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

7 years ago[clang-format] fix crash in NamespaceEndCommentsFixer (PR32438)
Matthias Gehre [Tue, 4 Apr 2017 20:11:13 +0000 (20:11 +0000)]
[clang-format] fix crash in NamespaceEndCommentsFixer (PR32438)

Summary:
The new test case was crashing before. Now it passes
as expected.

Reviewers: djasper

Subscribers: klimek, cfe-commits

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

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

7 years ago[analyzer] Add new Z3 constraint manager backend
Dominic Chen [Tue, 4 Apr 2017 19:52:25 +0000 (19:52 +0000)]
[analyzer] Add new Z3 constraint manager backend

Summary: Implement new Z3 constraint manager backend.

Reviewers: zaks.anna, dcoughlin, NoQ, xazax.hun

Subscribers: mgorny, cfe-commits

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

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

7 years ago[fixup][X86][inline-asm] Add support for MS 'EVEN' directive
Coby Tayree [Tue, 4 Apr 2017 19:20:21 +0000 (19:20 +0000)]
[fixup][X86][inline-asm] Add support for MS 'EVEN' directive

refining tested targets resolution, to amend failures caused by rL299454

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

7 years ago[X86][inline-asm] Add support for MS 'EVEN' directive
Coby Tayree [Tue, 4 Apr 2017 17:58:28 +0000 (17:58 +0000)]
[X86][inline-asm] Add support for MS 'EVEN' directive

MS assembly syntax provide us with the 'EVEN' directive as a synonymous to at&t '.even'.
This patch include the (small, simple) changes need to allow it.

llvm-side:
https://reviews.llvm.org/D27417

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

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

7 years ago[Bug 25404] Fix crash on typedef in OpenCL 2.0
Anastasia Stulova [Tue, 4 Apr 2017 16:50:46 +0000 (16:50 +0000)]
[Bug 25404] Fix crash on typedef in OpenCL 2.0

Fixed the assertion due to absence of source location for
implicitly defined types (using addImplicitTypedef()).
During Sema checks the source location is being expected
and therefore an assertion is triggered.

The change is not specific to OpenCL. But it is particularly
common for OpenCL types to be declared implicitly in Clang
to support the mode without the standard header.

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

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

7 years agoPreserve vec3 type.
Jin-Gu Kang [Tue, 4 Apr 2017 16:40:25 +0000 (16:40 +0000)]
Preserve vec3 type.

Summary: Preserve vec3 type with CodeGen option.

Reviewers: Anastasia, bruno

Reviewed By: Anastasia

Subscribers: bruno, ahatanak, cfe-commits

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

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

7 years agoFix problem with test.
Michael Zuckerman [Tue, 4 Apr 2017 15:44:06 +0000 (15:44 +0000)]
Fix problem with test.

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

7 years ago[X86][Clang] Converting __mm{|256|512}_movm_epi{8|16|32|64} LLVMIR call into generic...
Michael Zuckerman [Tue, 4 Apr 2017 13:29:53 +0000 (13:29 +0000)]
[X86][Clang] Converting __mm{|256|512}_movm_epi{8|16|32|64} LLVMIR call into generic intrinsics.

This patch is a part two of two reviews, one for the clang and the other for LLVM.
In this patch, I covered the clang side, by introducing the intrinsic to the front end.
This is done by creating a generic replacement.

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

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

7 years ago[X86] Remove some code that tries to disable HLE feature. This feature flag was remov...
Craig Topper [Tue, 4 Apr 2017 06:38:44 +0000 (06:38 +0000)]
[X86] Remove some code that tries to disable HLE feature. This feature flag was removed from the backend.

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

7 years agoModules/builtins.m requires shell.
Galina Kistanova [Tue, 4 Apr 2017 02:50:40 +0000 (02:50 +0000)]
Modules/builtins.m requires shell.

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

7 years agoRecommit r299321 '[X86] Add __extension__ to f16c macro intrinsics to suppress warnin...
Craig Topper [Mon, 3 Apr 2017 22:59:30 +0000 (22:59 +0000)]
Recommit r299321 '[X86] Add __extension__ to f16c macro intrinsics to suppress warnings about compound literals when compiled for with earlier language standards enabled.'

The bot didn't recover after the revert. So it looks like this wasn't the issue.

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

7 years agoRevert r299355 "[ASTImporter] Fix for importing unnamed structs"
Gabor Horvath [Mon, 3 Apr 2017 21:06:45 +0000 (21:06 +0000)]
Revert r299355 "[ASTImporter] Fix for importing unnamed structs"

It breaks windows bots.

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

7 years agoRevert r299321 '[X86] Add __extension__ to f16c macro intrinsics to suppress warnings...
Craig Topper [Mon, 3 Apr 2017 19:43:47 +0000 (19:43 +0000)]
Revert r299321 '[X86] Add __extension__ to f16c macro intrinsics to suppress warnings about compound literals when compiled for with earlier language standards enabled.' to see if recovers a fuzzer bot.

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

7 years ago[coroutines] Fix rebuilding of implicit and dependent coroutine statements.
Eric Fiselier [Mon, 3 Apr 2017 19:21:00 +0000 (19:21 +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@299380 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[TargetInfo] Use llvm::alignOf() instead of rewriting it. NFCI.
Davide Italiano [Mon, 3 Apr 2017 16:51:39 +0000 (16:51 +0000)]
[TargetInfo] Use llvm::alignOf() instead of rewriting it. NFCI.

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

7 years agoEnhance -Wshadow to warn when shadowing typedefs or type aliases
Alex Lorenz [Mon, 3 Apr 2017 16:43:21 +0000 (16:43 +0000)]
Enhance -Wshadow to warn when shadowing typedefs or type aliases

Enhance -Wshadow to emit a warning when typedefs or type aliases are shadowed.

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

Patch by Ahmed Asadi.

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

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

7 years ago[ASTImporter] Fix for importing unnamed structs
Gabor Horvath [Mon, 3 Apr 2017 11:57:11 +0000 (11:57 +0000)]
[ASTImporter] Fix for importing unnamed structs

Patch by Peter Szecsi!

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

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

7 years ago[ASTImporter] Lookup SearchName instead of Name
Gabor Horvath [Mon, 3 Apr 2017 09:30:20 +0000 (09:30 +0000)]
[ASTImporter] Lookup SearchName instead of Name

When the SearchName is already calculated we should use that for the lookup.

Patch by Peter Szecsi!

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

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

7 years ago[AVX-512] Fix a couple more intrinsic macros I missed in r299346.
Craig Topper [Mon, 3 Apr 2017 03:51:57 +0000 (03:51 +0000)]
[AVX-512] Fix a couple more intrinsic macros I missed in r299346.

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

7 years ago[AVX-512] Fix some intrinsic macros that use the wrong macro parameter names and...
Craig Topper [Mon, 3 Apr 2017 03:41:29 +0000 (03:41 +0000)]
[AVX-512] Fix some intrinsic macros that use the wrong macro parameter names and don't have parentheses around them.

Thanks to Matthew Barr for reporting this issue.

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

7 years ago[X86] Add __extension__ to f16c macro intrinsics to suppress warnings about compound...
Craig Topper [Sun, 2 Apr 2017 03:02:53 +0000 (03:02 +0000)]
[X86] Add __extension__ to f16c macro intrinsics to suppress warnings about compound literals when compiled for with earlier language standards enabled.

Fixes PR32491.

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

7 years ago[NFC, Scoped Enum] Convert Sema::ExpressionEvaluationContext into a scoped Enum
Faisal Vali [Sat, 1 Apr 2017 21:30:49 +0000 (21:30 +0000)]
[NFC, Scoped Enum] Convert Sema::ExpressionEvaluationContext into a scoped Enum

- also replace direct equality checks against the ConstantEvaluated enumerator  with isConstantEvaluted(), in anticipation of adding finer granularity to the various ConstantEvaluated contexts and reinstating certain restrictions on where lambda expressions can occur in C++17.

- update the clang tablegen backend that uses these Enumerators, and add the relevant scope where needed.

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

7 years ago[Driver] Don't crash on invalid values of -mrelocation-model=.
Davide Italiano [Sat, 1 Apr 2017 21:07:07 +0000 (21:07 +0000)]
[Driver] Don't crash on invalid values of -mrelocation-model=.

This is handled in a similar way we handle invalid -mcode-model.

PR: 31840

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

7 years ago[ObjC++] Use the correct EH personality in GNU mode
Benjamin Kramer [Sat, 1 Apr 2017 17:59:01 +0000 (17:59 +0000)]
[ObjC++] Use the correct EH personality in GNU mode

Previously, it would just always use the ObjC DWARF personality, even with SjLj
or SEH exceptions.

Patch by Jonathan Schleifer, test case by me.

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

7 years ago[coroutines] Add cleanup for compiler injected objects/allocations in coroutine body
Gor Nishanov [Sat, 1 Apr 2017 00:22:47 +0000 (00:22 +0000)]
[coroutines] Add cleanup for compiler injected objects/allocations in coroutine body

Summary:
* Use pushCleanup to emit freeing coroutine memory on normal and EH exits.
* Surround emitted code with CodeGenFunction::RunCleanupsScope.

Reviewers: rsmith, rnk, EricWF

Reviewed By: rnk

Subscribers: cfe-commits

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

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

7 years ago[ThinLTO] Handle -emit-llvm* in ThinLTO backends
Teresa Johnson [Fri, 31 Mar 2017 22:35:47 +0000 (22:35 +0000)]
[ThinLTO] Handle -emit-llvm* in ThinLTO backends

Summary:
Use PreCodeGenModuleHook to invoke the correct writer when emitting LLVM
IR, returning false to skip codegen from within thinBackend.

Reviewers: pcc, mehdi_amini

Subscribers: Prazek, cfe-commits

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

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

7 years agoAdd/update PIE defaults for OpenBSD.
Brad Smith [Fri, 31 Mar 2017 22:13:17 +0000 (22:13 +0000)]
Add/update PIE defaults for OpenBSD.

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

7 years ago[Sema][X86] Update immediate check for gather/scatter prefetch instructions to match...
Craig Topper [Fri, 31 Mar 2017 17:22:30 +0000 (17:22 +0000)]
[Sema][X86] Update immediate check for gather/scatter prefetch instructions to match the _MM_HINT_T0/T1 constant definitions

Our _MM_HINT_T0/T1 constant values are 3/2 which matches gcc, but not icc or Intel documentation. Interestingly gcc had this same bug on their implementation of the gather/scatter builtins at one point too.

Fixes PR32411.

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

7 years ago[mips][msa] Range adjustment for ldi_b builtin function operand
Petar Jovanovic [Fri, 31 Mar 2017 16:16:43 +0000 (16:16 +0000)]
[mips][msa] Range adjustment for ldi_b builtin function operand

Reasoning behind this change was allowing the function to accept all values
from range [-128, 255] since all of them can be encoded in an 8bit wide
value.
This differs from the prior state where only range [-128, 127] was accepted,
where values were assumed to be signed, whereas now the actual
interpretation of the immediate is deferred to the consumer as required.

Patch by Stefan Maksimovic.

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

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

7 years ago[Modules][PCH] Serialize #pragma pack
Alex Lorenz [Fri, 31 Mar 2017 15:36:21 +0000 (15:36 +0000)]
[Modules][PCH] Serialize #pragma pack

This patch serializes the state of #pragma pack. It preserves the state of the
pragma from a PCH/from modules in a file that uses that PCH/those modules.

rdar://21359084

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

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

7 years agoAdd back test for r299152
Teresa Johnson [Fri, 31 Mar 2017 13:48:18 +0000 (13:48 +0000)]
Add back test for r299152

I am hoping the bot failures are addressed by using cc1 for the ThinLTO
backend invocations as well.

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

7 years agoclang-format: Fix post-commit review comment of r299204, use Style.isCpp().
Daniel Jasper [Fri, 31 Mar 2017 13:30:24 +0000 (13:30 +0000)]
clang-format: Fix post-commit review comment of r299204, use Style.isCpp().

Also, while at it, s/IsCpp/isCpp/ so that it follows LLVM style.

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

7 years agoclang-format vs plugin support for Visual Studio 2017
Hans Wennborg [Fri, 31 Mar 2017 12:50:42 +0000 (12:50 +0000)]
clang-format vs plugin support for Visual Studio 2017

With the release of Visual Studio 2017, we need to at the very least
claim support for it in the current manifest file. With the changes
introducted in this patch we can install the extension again, but a
warning message will be shown stating that it's not supported
(https://twitter.com/parsley72/status/846558416751411200).

To get the rid of the warning more work is necessary, as VS 2017 changed
some things about extensions, see more here:
https://docs.microsoft.com/en-us/visualstudio/extensibility/how-to-migrate-extensibility-projects-to-visual-studio-2017.
While working on those changes, it has been suggested in the
mail list that this first patch is integrated in the meantime.

Patch by Hugo Puhlmann!

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

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

7 years agoclang-format: [JavaScript] Ignore QT keywords.
Daniel Jasper [Fri, 31 Mar 2017 12:04:37 +0000 (12:04 +0000)]
clang-format: [JavaScript] Ignore QT keywords.

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

7 years agoSpelling mistakes in comments. NFCI.
Simon Pilgrim [Fri, 31 Mar 2017 11:00:53 +0000 (11:00 +0000)]
Spelling mistakes in comments. NFCI.

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

7 years agoStrip trailing whitespace
Simon Pilgrim [Fri, 31 Mar 2017 10:40:56 +0000 (10:40 +0000)]
Strip trailing whitespace

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

7 years ago[OpenCL] Do not generate "kernel_arg_type_qual" metadata for non-pointer args
Egor Churaev [Fri, 31 Mar 2017 10:14:52 +0000 (10:14 +0000)]
[OpenCL] Do not generate "kernel_arg_type_qual" metadata for non-pointer args

Summary:
"kernel_arg_type_qual" metadata should contain const/volatile/restrict
tags only for pointer types to match the corresponding requirement of
the OpenCL specification.

OpenCL 2.0 spec 5.9.3 Kernel Object Queries:

CL_KERNEL_ARG_TYPE_VOLATILE is returned if the argument is a pointer
and the referenced type is declared with the volatile qualifier.
[...]
Similarly, CL_KERNEL_ARG_TYPE_CONST is returned if the argument is a
pointer and the referenced type is declared with the restrict or const
qualifier.
[...]
CL_KERNEL_ARG_TYPE_RESTRICT will be returned if the pointer type is
marked restrict.

Reviewers: Anastasia, cfe-commits

Reviewed By: Anastasia

Subscribers: bader, yaxunl

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

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

7 years ago[msan] Turn off lifetime markers even when use after scope checking is on.
Benjamin Kramer [Fri, 31 Mar 2017 09:19:25 +0000 (09:19 +0000)]
[msan] Turn off lifetime markers even when use after scope checking is on.

Since r299174 use after scope checking is on by default. Even though
msan doesn't check for use after scope it gets confused by the lifetime
markers emitted for it, making unit tests fail. This is covered by
ninja check-msan.

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

7 years agoRevert test added in r299152
Teresa Johnson [Fri, 31 Mar 2017 04:29:07 +0000 (04:29 +0000)]
Revert test added in r299152

Removing the test until I can figure out how to get the ThinLTO backend
invocation of clang to use the correct target.

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

7 years agoAdd target-cpu
Teresa Johnson [Fri, 31 Mar 2017 03:49:52 +0000 (03:49 +0000)]
Add target-cpu

Sigh, another follow-on fix needed for test in r299152 causing bot
failures. We also need the target-cpu for the ThinLTO BE clang
invocation.

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

7 years agoAdd more target triples to test
Teresa Johnson [Fri, 31 Mar 2017 03:27:47 +0000 (03:27 +0000)]
Add more target triples to test

Third and hopefully final fix to test for r299152 that is causing bot
failures: make sure the target triple specified for the ThinLTO backend
clang invocations as well.

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

7 years ago[asan] Turn -fsanitize-address-use-after-scope on by default [clang part]
Kuba Mracek [Fri, 31 Mar 2017 03:00:09 +0000 (03:00 +0000)]
[asan] Turn -fsanitize-address-use-after-scope on by default [clang part]

AddressSanitizer has an optional compile-time flag, -fsanitize-address-use-after-scope, which enables detection of use-after-scope bugs. We'd like to have this feature on by default, because it is already very well tested, it's used in several projects already (LLVM automatically enables it when using -DLLVM_USE_SANITIZER=Address), it's low overhead and there are no known issues or incompatibilities.

This patch enables use-after-scope by default via the Clang driver, where we set true as the default value for AsanUseAfterScope. This also causes the lifetime markers to be generated whenever fsanitize=address is used. This has some nice consequences, e.g. we now have line numbers for all local variables.

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

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

7 years agoFix new compile command in test
Teresa Johnson [Fri, 31 Mar 2017 02:55:31 +0000 (02:55 +0000)]
Fix new compile command in test

My previous attempt to fix bot failures from r299152 didn't add the
necessary option to get bitcode out of the cc1 step.

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

7 years agoAdd triple to new test
Teresa Johnson [Fri, 31 Mar 2017 02:36:47 +0000 (02:36 +0000)]
Add triple to new test

Attempt to fix bot errors from r299152 by using clang_cc1 and specifying
target triple to compile step.

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

7 years ago[ThinLTO] Set up lto::Config properly for codegen in ThinLTO backends
Teresa Johnson [Fri, 31 Mar 2017 02:05:15 +0000 (02:05 +0000)]
[ThinLTO] Set up lto::Config properly for codegen in ThinLTO backends

Summary:
This involved refactoring out pieces of
EmitAssemblyHelper::CreateTargetMachine for use in runThinLTOBackend.

Subsumes D31114.

Reviewers: mehdi_amini, pcc

Subscribers: Prazek, cfe-commits

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

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

7 years agoUpdate x86-64 ABI link with the one from linuxbase.org since the other
Eric Christopher [Fri, 31 Mar 2017 01:59:40 +0000 (01:59 +0000)]
Update x86-64 ABI link with the one from linuxbase.org since the other
seems to be down.

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

7 years agoFix typo, defind -> defined.
Eric Christopher [Fri, 31 Mar 2017 01:45:39 +0000 (01:45 +0000)]
Fix typo, defind -> defined.

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

7 years agofixup: use CHECK for non-atttribute sets
Dean Michael Berris [Thu, 30 Mar 2017 22:46:49 +0000 (22:46 +0000)]
fixup: use CHECK for non-atttribute sets

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

7 years ago[XRay][clang] Fix the -fxray-instruction-threshold flag processing
Dean Michael Berris [Thu, 30 Mar 2017 22:46:45 +0000 (22:46 +0000)]
[XRay][clang] Fix the -fxray-instruction-threshold flag processing

Summary:
The refactoring introduced a regression in the flag processing for
-fxray-instruction-threshold which causes it to not get passed properly.
This change should restore the previous behaviour.

Reviewers: rnk, pelikan

Subscribers: cfe-commits

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

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

7 years agoClang changes for alloc_align attribute
Erich Keane [Thu, 30 Mar 2017 21:48:55 +0000 (21:48 +0000)]
Clang changes for alloc_align attribute

GCC has the alloc_align attribute, which is similar to assume_aligned, except the attribute's parameter is the index of the integer parameter that needs aligning to.

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

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

7 years agoCorrecting a typo; NFC.
Aaron Ballman [Thu, 30 Mar 2017 18:11:20 +0000 (18:11 +0000)]
Correcting a typo; NFC.

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

7 years agoSpelling mistakes in comments. NFCI. (PR27635)
Simon Pilgrim [Thu, 30 Mar 2017 14:13:19 +0000 (14:13 +0000)]
Spelling mistakes in comments. NFCI. (PR27635)

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

7 years ago[ARC][ObjC++] Use ObjC semantic rules for comparisons between a pointer and
Alex Lorenz [Thu, 30 Mar 2017 13:48:33 +0000 (13:48 +0000)]
[ARC][ObjC++] Use ObjC semantic rules for comparisons between a pointer and
an ObjC object pointer

When ARC is enabled in Objective-C++, comparisons between a pointer and
Objective-C object pointer typically result in errors like this:
"invalid operands to a binary expression". This error message can be quite
confusing as it doesn't provide a solution to the problem, unlike the non-C++
diagnostic: "implicit conversion of Objective-C pointer type 'id' to C pointer
type 'void *' requires a bridged cast" (it also provides fix-its). This commit
forces comparisons between pointers and Objective-C object pointers in ARC to
use the Objective-C semantic rules to ensure that a better diagnostic is
reported.

rdar://31103857

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

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

7 years agoMove NumRegParameters Module Flag. NFCI.
Nirav Dave [Thu, 30 Mar 2017 13:41:44 +0000 (13:41 +0000)]
Move NumRegParameters Module Flag. NFCI.

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

7 years ago[Sema][ObjC] Avoid the "type of property does not match type of accessor"
Alex Lorenz [Thu, 30 Mar 2017 13:33:51 +0000 (13:33 +0000)]
[Sema][ObjC] Avoid the "type of property does not match type of accessor"
warning for methods that resemble the setters of readonly properties

rdar://30415679

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

7 years agoAdd `replace` interface with range in AtomicChange.
Haojian Wu [Thu, 30 Mar 2017 13:07:38 +0000 (13:07 +0000)]
Add `replace` interface with range in AtomicChange.

Reviewers: ioeric

Reviewed By: ioeric

Subscribers: alexshap, klimek, cfe-commits

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

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

7 years ago[APInt] Remove references to integerPartWidth and integerPart outside of APFloat...
Craig Topper [Thu, 30 Mar 2017 05:48:58 +0000 (05:48 +0000)]
[APInt] Remove references to integerPartWidth and integerPart outside of APFloat implentation.

Turns out integerPartWidth only explicitly defines the width of the tc functions in the APInt class. Functions that aren't used by APInt implementation itself. Many places in the code base already assume APInt is made up of 64-bit pieces. Explicitly assuming 64-bit here doesn't make that situation much worse. A full audit would need to be done if it ever changes.

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

7 years agoUse 'unsigned' for enum bitfields
Reid Kleckner [Thu, 30 Mar 2017 01:12:08 +0000 (01:12 +0000)]
Use 'unsigned' for enum bitfields

Fixes this clang warning on Windows:

warning: implicit truncation from 'clang::LangOptions::FPContractModeKind' to bit-field changes value from 2 to -2 [-Wbitfield-constant-conversion]
    fp_contract = LangOptions::FPC_Fast;
                ^ ~~~~~~~~~~~~~~~~~~~~~

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

7 years ago[XRay][clang] Use llvm::to_string instead of std::string
Dean Michael Berris [Thu, 30 Mar 2017 01:05:09 +0000 (01:05 +0000)]
[XRay][clang] Use llvm::to_string instead of std::string

This should unbreak some bots.

Follow-up on D30388.

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

7 years ago[XRay] Add -fxray-{always,never}-instrument= flags to clang
Dean Michael Berris [Thu, 30 Mar 2017 00:29:36 +0000 (00:29 +0000)]
[XRay] Add -fxray-{always,never}-instrument= flags to clang

Summary:
The -fxray-always-instrument= and -fxray-never-instrument= flags take
filenames that are used to imbue the XRay instrumentation attributes
using a whitelist mechanism (similar to the sanitizer special cases
list). We use the same syntax and semantics as the sanitizer blacklists
files in the implementation.

As implemented, we respect the attributes that are already defined in
the source file (i.e. those that have the
[[clang::xray_{always,never}_instrument]] attributes) before applying
the always/never instrument lists.

Reviewers: rsmith, chandlerc

Subscribers: jfb, mgorny, cfe-commits

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

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

7 years agoAdd the -grecord-gcc-switches option and pass the flags down on the compile unit.
Eric Christopher [Wed, 29 Mar 2017 23:34:20 +0000 (23:34 +0000)]
Add the -grecord-gcc-switches option and pass the flags down on the compile unit.

Patch by Zhizhou Yang

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

7 years agoUse FPContractModeKind universally
Adam Nemet [Wed, 29 Mar 2017 21:54:24 +0000 (21:54 +0000)]
Use FPContractModeKind universally

FPContractModeKind is the codegen option flag which is already ternary (off,
on, fast).  This makes it universally the type for the contractable info
across the front-end:

* In FPOptions (i.e. in the Sema + in the expression nodes).
* In LangOpts::DefaultFPContractMode which is the option that initializes
FPOptions in the Sema.

Another way to look at this change is that before fp-contractable on/off were
the only states handled to the front-end:
 * For "on", FMA folding was performed by  the front-end
 * For "fast", we simply forwarded the flag to TargetOptions to handle it in
 LLVM

Now off/on/fast are all exposed because for fast we will generate
fast-math-flags during CodeGen.

This is toward moving fp-contraction=fast from an LLVM TargetOption to a
FastMathFlag in order to fix PR25721.

---
This is a recommit of r299027 with an adjustment to the test
CodeGenCUDA/fp-contract.cu.  The test assumed that even
though -ffp-contract=on is passed FE-based folding of FMA won't happen.

This is obviously wrong since the user is asking for this explicitly with the
option.  CUDA is different that -ffp-contract=fast is on by default.

The test used to "work" because contract=fast and contract=on were maintained
separately and we didn't fold in the FE because contract=fast was on due to
the target-default.  This patch consolidates the contract=on/fast/off state
into a ternary state hence the change in behavior.
---

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

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

7 years agoRevert "Use FPContractModeKind universally"
Adam Nemet [Wed, 29 Mar 2017 21:24:19 +0000 (21:24 +0000)]
Revert "Use FPContractModeKind universally"

This reverts commit r299027.

It's causing a test failure in clang's CodeGenCUDE/fp-contract.cu

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

7 years agoUse FPContractModeKind universally
Adam Nemet [Wed, 29 Mar 2017 20:39:49 +0000 (20:39 +0000)]
Use FPContractModeKind universally

FPContractModeKind is the codegen option flag which is already ternary (off,
on, fast).  This makes it universally the type for the contractable info
across the front-end:

* In FPOptions (i.e. in the Sema + in the expression nodes).
* In LangOpts::DefaultFPContractMode which is the option that initializes
FPOptions in the Sema.

Another way to look at this change is that before fp-contractable on/off were
the only states handled to the front-end:
 * For "on", FMA folding was performed by  the front-end
 * For "fast", we simply forwarded the flag to TargetOptions to handle it in
 LLVM

Now off/on/fast are all exposed because for fast we will generate
fast-math-flags during CodeGen.

This is toward moving fp-contraction=fast from an LLVM TargetOption to a
FastMathFlag in order to fix PR25721.

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

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

7 years ago[Objective-C] Miscellaneous -fobjc-weak Fixes
Brian Kelley [Wed, 29 Mar 2017 18:16:38 +0000 (18:16 +0000)]
[Objective-C] Miscellaneous -fobjc-weak Fixes

Summary: After examining the remaining uses of LangOptions.ObjCAutoRefCount, found a some additional places to also check for ObjCWeak not covered by previous test cases. Added a test file to verify all the code paths that were changed.

Reviewers: rsmith, doug.gregor, rjmccall

Reviewed By: rjmccall

Subscribers: cfe-commits

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

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

7 years ago[Objective-C] Fix "weak-unavailable" warning with -fobjc-weak
Brian Kelley [Wed, 29 Mar 2017 18:09:02 +0000 (18:09 +0000)]
[Objective-C] Fix "weak-unavailable" warning with -fobjc-weak

Summary: clang should produce the same errors Objective-C classes that cannot be assigned to weak pointers under both -fobjc-arc and -fobjc-weak. Check for ObjCWeak along with ObjCAutoRefCount when analyzing pointer conversions. Add an -fobjc-weak pass to the existing arc-unavailable-for-weakref test cases to verify the behavior is the same.

Reviewers: rsmith, doug.gregor, rjmccall

Reviewed By: rjmccall

Subscribers: cfe-commits

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

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

7 years agoUnbreak windows bot.
Graydon Hoare [Wed, 29 Mar 2017 17:58:41 +0000 (17:58 +0000)]
Unbreak windows bot.

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

7 years ago[Objective-C] Fix "repeated use of weak" warning with -fobjc-weak
Brian Kelley [Wed, 29 Mar 2017 17:55:11 +0000 (17:55 +0000)]
[Objective-C] Fix "repeated use of weak" warning with -fobjc-weak

Summary: -Warc-repeated-use-of-weak should produce the same warnings with -fobjc-weak as it does with -objc-arc. Also check for ObjCWeak along with ObjCAutoRefCount when recording the use of an evaluated weak variable. Add a -fobjc-weak run to the existing arc-repeated-weak test case and adapt it slightly to work in both modes.

Reviewers: rsmith, doug.gregor, jordan_rose, rjmccall

Reviewed By: rjmccall

Subscribers: arphaman, rjmccall, cfe-commits

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

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

7 years ago[Objective-C] Fix __weak type traits with -fobjc-weak
Brian Kelley [Wed, 29 Mar 2017 17:40:35 +0000 (17:40 +0000)]
[Objective-C] Fix __weak type traits with -fobjc-weak

Summary: Similar to ARC, in ObjCWeak Objective-C object pointers qualified with a weak lifetime are not POD or trivial types. Update the type trait code to reflect this. Copy and adapt the arc-type-traits.mm test case to verify correctness.

Reviewers: rsmith, doug.gregor, rjmccall

Reviewed By: rjmccall

Subscribers: cfe-commits

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

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

7 years ago[PCH] Attach instance's dependency collectors to PCH external AST sources.
Graydon Hoare [Wed, 29 Mar 2017 17:33:09 +0000 (17:33 +0000)]
[PCH] Attach instance's dependency collectors to PCH external AST sources.

Summary:
When a PCH is included via -include-pch, clang should treat the
current TU as dependent on the sourcefile that the PCH was generated from.

This is currently _partly_ accomplished by InitializePreprocessor calling
AddImplicitIncludePCH to synthesize an implicit #include of the sourcefile,
into the preprocessor's Predefines buffer.

For FrontendActions such as PreprocessOnlyAction (which is, curiously, what the
driver winds up running one of in response to a plain clang -M) this is
sufficient: the preprocessor cranks over its Predefines and emits a dependency
reference to the initial sourcefile.

For other FrontendActions (for example -emit-obj or -fsyntax-only) the
Predefines buffer is reset to the suggested predefines buffer from the PCH, so
the dependency edge is lost. The result is that clang emits a .d file in those
cases that lacks a reference to the .h file responsible for the input (and in
Swift's case, our .swiftdeps file winds up not including a reference to the
source file for a PCH bridging header.)

This patch fixes the problem by taking a different tack: ignoring the
Predefines buffer (which seems a bit like a hack anyways) and directly
attaching the CompilerInstance's DependencyCollectors (and legacy
DependencyFileGenerator) to the ASTReader for the external AST.

This approach is similar to the one chosen in earlier consultation with Bruno
and Ben, and I think it's the least-bad solution, given several options.

Reviewers: bruno, benlangmuir, doug.gregor

Reviewed By: bruno, doug.gregor

Subscribers: cfe-commits

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

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

7 years ago[Objective-C] C++ Classes with __weak Members non-POD Types when using -fobjc-weak
Brian Kelley [Wed, 29 Mar 2017 17:31:42 +0000 (17:31 +0000)]
[Objective-C] C++ Classes with __weak Members non-POD Types when using -fobjc-weak

Summary: When adding an Objective-C retainable type member to a C++ class, also check the LangOpts.ObjCWeak flag and the lifetime qualifier so __weak qualified Objective-C pointer members cause the class to be a non-POD type with non-trivial special members, so the compiler always emits the necessary runtime calls for copying, moving, and destroying the weak member. Otherwise, Objective-C++ classes with weak Objective-C pointer members compiled with -fobjc-weak exhibit undefined behavior if the C++ class is classified as a POD type.

Reviewers: rsmith, benlangmuir, doug.gregor, rjmccall

Reviewed By: rjmccall

Subscribers: cfe-commits

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

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

7 years agoTest Commit
Brian Kelley [Wed, 29 Mar 2017 17:18:05 +0000 (17:18 +0000)]
Test Commit

Remove trailing whitespace.

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

7 years agoReapplied r298976 [OpenCL] Added parsing for OpenCL vector types.
Egor Churaev [Wed, 29 Mar 2017 12:09:39 +0000 (12:09 +0000)]
Reapplied r298976 [OpenCL] Added parsing for OpenCL vector types.

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

7 years agoReverted r298976 [OpenCL] Added parsing for OpenCL vector types.
Egor Churaev [Wed, 29 Mar 2017 05:40:45 +0000 (05:40 +0000)]
Reverted r298976 [OpenCL] Added parsing for OpenCL vector types.

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

7 years ago[OpenCL] Added parsing for OpenCL vector types.
Egor Churaev [Wed, 29 Mar 2017 05:08:18 +0000 (05:08 +0000)]
[OpenCL] Added parsing for OpenCL vector types.

Reviewers: cfe-commits, Anastasia

Reviewed By: Anastasia

Subscribers: yaxunl, bader

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

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