]> granicus.if.org Git - clang/log
clang
7 years ago[CodeGen] Check key function for typeinfo import
Shoaib Meenai [Tue, 4 Jul 2017 01:02:19 +0000 (01:02 +0000)]
[CodeGen] Check key function for typeinfo import

If the imported class does not have a key function, we should emit its
typeinfo locally instead of attempting to import it.

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

7 years ago[Sema] Make BreakContinueFinder handle nested loops.
Eli Friedman [Tue, 4 Jul 2017 00:52:24 +0000 (00:52 +0000)]
[Sema] Make BreakContinueFinder handle nested loops.

We don't care about break or continue statements that aren't
associated with the current loop, so make sure the visitor
doesn't find them.

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

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

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

7 years ago[clang] Implement -Wcast-qual for C++
Roman Lebedev [Mon, 3 Jul 2017 17:59:22 +0000 (17:59 +0000)]
[clang] Implement -Wcast-qual for C++

Summary:
This way, the behavior of that warning flag
more closely resembles that of GCC.

Do note that there is at least one false-negative (see FIXME in tests).

Fixes PR4802.

Testing:
```
ninja check-clang-sema check-clang-semacxx
```

Reviewers: dblaikie, majnemer, rnk

Reviewed By: dblaikie, rnk

Subscribers: mclow.lists, cfe-commits, alexfh, rnk

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

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

7 years agoRevert "clang-format: [JS] space between pseudo keywords and template literals."
Martin Probst [Mon, 3 Jul 2017 15:31:28 +0000 (15:31 +0000)]
Revert "clang-format: [JS] space between pseudo keywords and template literals."

This reverts commit 71d3b5cd916106005ef23467e3f6c7fbca7bc499.

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

7 years ago[clang-format] Support text proto messages
Krasimir Georgiev [Mon, 3 Jul 2017 15:05:14 +0000 (15:05 +0000)]
[clang-format] Support text proto messages

Summary: This patch adds support for textual protocol buffer messages.

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits, klimek, mgorny

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

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

7 years agoclang-format: [JS] space between pseudo keywords and template literals.
Martin Probst [Mon, 3 Jul 2017 14:29:13 +0000 (14:29 +0000)]
clang-format: [JS] space between pseudo keywords and template literals.

Summary:
Before:
    yield`foo`;

After:
    yield `foo`;

Reviewers: djasper

Subscribers: klimek

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

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

7 years ago[index] Remove 'implicit' role for message sends in implicit ObjC
Alex Lorenz [Mon, 3 Jul 2017 10:34:46 +0000 (10:34 +0000)]
[index] Remove 'implicit' role for message sends in implicit ObjC
property references

rdar://32375673

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

7 years agoAdd a fixit for -Wobjc-protocol-property-synthesis
Alex Lorenz [Mon, 3 Jul 2017 10:12:24 +0000 (10:12 +0000)]
Add a fixit for -Wobjc-protocol-property-synthesis

rdar://32132756

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

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

7 years agofix trivial typos in comments; NFC
Hiroshi Inoue [Mon, 3 Jul 2017 08:49:44 +0000 (08:49 +0000)]
fix trivial typos in comments; NFC

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

7 years agofix trivial typos in comments; NFC
Hiroshi Inoue [Sun, 2 Jul 2017 06:12:49 +0000 (06:12 +0000)]
fix trivial typos in comments; NFC

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

7 years agoAdd an option group for deprecated warnings. Add the removed
Joerg Sonnenberger [Sat, 1 Jul 2017 21:36:21 +0000 (21:36 +0000)]
Add an option group for deprecated warnings. Add the removed
-fslp-vectorize-aggressive and -fno-slp-vectorize-aggressive flags back
under this group and test for the warning. Document the future removal
in the ReleaseNotes.

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

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

7 years ago[modules] Teach clang how to merge typedef over anonymous structs in C mode.
Vassil Vassilev [Sat, 1 Jul 2017 20:44:49 +0000 (20:44 +0000)]
[modules] Teach clang how to merge typedef over anonymous structs in C mode.

In C mode clang fails to merge the textually included definition with the one imported from a module. The C lookup rules fail to find the imported definition because its linkage is internal in non C++ mode.

This patch reinstates some of the ODR merging rules for typedefs of anonymous tags for languages other than C++.

Patch by Raphael Isemann and me (D34510).

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

7 years ago[Bash-autocompletion] Add support for older bash version.
Yuka Takahashi [Sat, 1 Jul 2017 18:32:55 +0000 (18:32 +0000)]
[Bash-autocompletion] Add support for older bash version.

Summary:
OS X seems to use older bash version which doesn't suport
_init_completion and compopt, so add support for this.

Reviewers: ruiu, v.g.vassilev, teemperor

Subscribers: cfe-commits

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

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

7 years ago[Bash-completion] Fixed a bug that ~ doesn't expanded to $HOME
Yuka Takahashi [Sat, 1 Jul 2017 16:30:02 +0000 (16:30 +0000)]
[Bash-completion] Fixed a bug that ~ doesn't expanded to $HOME

Summary: `~/build/bin/clang -f[tab]` was executed without ~ expanded to $HOME, so changed this by expanding ~ to path using eval.

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

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

7 years ago[OpenMP] Fix mapping of scalars for combined directives
Jonas Hahnfeld [Sat, 1 Jul 2017 10:40:50 +0000 (10:40 +0000)]
[OpenMP] Fix mapping of scalars for combined directives

Combined directives like 'target parallel' have two captured statements.
Sema has to check the right one from the right direction.

Previously, Sema::IsOpenMPCapturedByRef would return false for mapped
scalars on combined directives. This results in a wrong signature of
the outlined function which triggers an assertion:
void llvm::CallInst::init(llvm::FunctionType *, llvm::Value *, ArrayRef<llvm::Value *>, ArrayRef<OperandBundleDef>, const llvm::Twine &): Assertion `(i >= FTy->getNumParams() || FTy->getParamType(i) == Args[i]->getType()) && "Calling a function with a bad signature!"' failed.

Fixes PR30975 (and PR31985). New function was taken from clang-ykt.

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

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

7 years agofix trivial typos; NFC
Hiroshi Inoue [Sat, 1 Jul 2017 08:46:43 +0000 (08:46 +0000)]
fix trivial typos; NFC

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

7 years agoChanged Opts.EABIVersion type string to llvm::EABI enum class
Yuka Takahashi [Sat, 1 Jul 2017 07:57:23 +0000 (07:57 +0000)]
Changed Opts.EABIVersion type string to llvm::EABI enum class

Summary:
Changed EABIVersion type from string to llvm::EABI.
It seems it was just a typo and this is intended implementation.

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

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

7 years agoUn-revert "[Driver] Add -fdiagnostics-hotness-threshold"
Brian Gesiak [Sat, 1 Jul 2017 05:45:26 +0000 (05:45 +0000)]
Un-revert "[Driver] Add -fdiagnostics-hotness-threshold"

Summary:
Un-revert https://reviews.llvm.org/D34868, but with a slight tweak to the
documentation to fix an error -- I had used the wrong syntax for a link.

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

7 years agoRevert "[Driver] Add -fdiagnostics-hotness-threshold"
Brian Gesiak [Sat, 1 Jul 2017 04:54:53 +0000 (04:54 +0000)]
Revert "[Driver] Add -fdiagnostics-hotness-threshold"

Summary:
The commit caused a documentation breakage.

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

7 years ago[Driver] Add -fdiagnostics-hotness-threshold
Brian Gesiak [Sat, 1 Jul 2017 04:44:38 +0000 (04:44 +0000)]
[Driver] Add -fdiagnostics-hotness-threshold

Summary:
Depends on https://reviews.llvm.org/D34867.

Add a Clang frontend option to enable optimization remark hotness
thresholds, which were added to LLVM in https://reviews.llvm.org/D34867.
This prevents diagnostics that do not meet a minimum hotness
threshold from being output. When generating optimization remarks for large
codebases with a ton of cold code paths, this option can be used
to limit the optimization remark output at a reasonable size.
Discussion of this change can be read here:
http://lists.llvm.org/pipermail/llvm-dev/2017-June/114377.html

Reviewers: anemet, davidxl, hfinkel

Reviewed By: anemet

Subscribers: fhahn, cfe-commits

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

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

7 years agoFix indentation.
Akira Hatanaka [Sat, 1 Jul 2017 04:37:54 +0000 (04:37 +0000)]
Fix indentation.

This is an attempt to fix a failing bot:

http://lab.llvm.org:8011/builders/ubuntu-gcc7.1-werror

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

7 years agoUpdate clang support for -mexecute-only/-mpure-code for backend change to use subtarg...
Eric Christopher [Sat, 1 Jul 2017 02:55:23 +0000 (02:55 +0000)]
Update clang support for -mexecute-only/-mpure-code for backend change to use subtarget feature rather than command line option.

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

7 years ago[ODRHash] Revert r305104 - Skip inline namespaces when hashing.
Richard Trieu [Sat, 1 Jul 2017 02:00:05 +0000 (02:00 +0000)]
[ODRHash] Revert r305104 - Skip inline namespaces when hashing.

Test inline namespaces and handle them in the ODR hash again.

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

7 years ago[Driver] Check that the iOS deployment target is iOS 10 or earlier if
Akira Hatanaka [Sat, 1 Jul 2017 00:57:52 +0000 (00:57 +0000)]
[Driver] Check that the iOS deployment target is iOS 10 or earlier if
the target is 32-bit.

The following changes are made to the driver since 32-bit apps do not
run on iOS 11 or later:

- If the deployment target is set explicitly, either with a command-line
  option or an environment variable, the driver should report an error
  if the version is greater than iOS 10.

- In the case where the deployment target is not set explicitly and the
  default is inferred from the target triple or SDK version, it should
  use a maximum default of iOS 10.99.99.

rdar://problem/32230613

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

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

7 years ago[Modules] Implement ODR-like semantics for tag types in C/ObjC
Bruno Cardoso Lopes [Sat, 1 Jul 2017 00:06:47 +0000 (00:06 +0000)]
[Modules] Implement ODR-like semantics for tag types in C/ObjC

Allow ODR for ObjC/C in the sense that we won't keep more that
one definition around (merge them). However, ensure the decl
pass the structural compatibility check in C11 6.2.7/1, for that,
reuse the structural equivalence checks used by the ASTImporter.

Few other considerations:
- Create error diagnostics for tag types mismatches and thread
them into the structural equivalence checks.
- Note that by doing this we only support redefinition between types
that are considered "compatible types" by C.

This is mixed approach of the suggestions discussed in
http://lists.llvm.org/pipermail/cfe-dev/2017-March/053257.html

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

rdar://problem/31909368

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

7 years agoChange enumerator default linkage type for C
Bruno Cardoso Lopes [Sat, 1 Jul 2017 00:06:27 +0000 (00:06 +0000)]
Change enumerator default linkage type for C

Redeclaration lookup should never find hidden enumerators in C, because
they do not have linkage (C11 6.2.2/6)

The linkage of an enumerator should be VisibleNoLinkage, and
isHiddenDeclarationVisible should be checking hasExternalFormalLinkage.

This is was reviewed as part of D31778, but splitted into a different
commit for clarity.

rdar://problem/31909368

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

7 years agoFix PR 33189: Clang assertion on template destructor declaration
Hubert Tong [Fri, 30 Jun 2017 22:43:54 +0000 (22:43 +0000)]
Fix PR 33189: Clang assertion on template destructor declaration

Summary:
This patch aims to fix the bug reported at
https://bugs.llvm.org/show_bug.cgi?id=33189. Clang hits an assertion
when a template destructor declaration is present. This is caused by
later processing that does not expect to encounter a template when
looking at a destructor. The resolution is to treat the destructor as
being not declared when later processing is interested in the properties
of the destructor of a class.

Reviewers: rcraik, hubert.reinterpretcast, aaron.ballman, rsmith

Reviewed By: rsmith

Subscribers: rsmith, cfe-commits

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

Patch by Kuang He!

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

7 years ago[ODRHash] Support Type TemplateArgument
Richard Trieu [Fri, 30 Jun 2017 22:40:33 +0000 (22:40 +0000)]
[ODRHash] Support Type TemplateArgument

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

7 years agoReinstate "Load lazily the template specialization in multi-module setups."
Vassil Vassilev [Fri, 30 Jun 2017 22:40:17 +0000 (22:40 +0000)]
Reinstate "Load lazily the template specialization in multi-module setups."

It was reverted in r305460 but the issue appears to only break our self-host
libcxx modules bot. Reapplying it will give us a chance to get a reproducer and
fix the issue.

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

7 years ago[Parse] Use normalized attr name for late-parsing checks.
George Burgess IV [Fri, 30 Jun 2017 22:33:24 +0000 (22:33 +0000)]
[Parse] Use normalized attr name for late-parsing checks.

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

7 years ago[Profile] Do not assign counters to functions without bodies
Vedant Kumar [Fri, 30 Jun 2017 21:02:14 +0000 (21:02 +0000)]
[Profile] Do not assign counters to functions without bodies

The root cause of the issues reported in D32406 and D34680 is that clang
instruments functions without bodies. Make it stop doing that, and also
teach it how to use old (incorrectly generated) profiles without
crashing.

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

7 years agoFix a typo. NFC.
Vedant Kumar [Fri, 30 Jun 2017 21:02:14 +0000 (21:02 +0000)]
Fix a typo. NFC.

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

7 years agoFix ODR violations due to abuse of LLVM_YAML_IS_(FLOW_)?SEQUENCE_VECTOR
Richard Smith [Fri, 30 Jun 2017 20:57:39 +0000 (20:57 +0000)]
Fix ODR violations due to abuse of LLVM_YAML_IS_(FLOW_)?SEQUENCE_VECTOR

This is a short-term fix for PR33650 aimed to get the modules build bots green again.

Remove all the places where we use the LLVM_YAML_IS_(FLOW_)?SEQUENCE_VECTOR
macros to try to locally specialize a global template for a global type. That's
not how C++ works.

Instead, we now centrally define how to format vectors of fundamental types and
of string (std::string and StringRef). We use flow formatting for the former
cases, since that's the obvious right thing to do; in the latter case, it's
less clear what the right choice is, but flow formatting is really bad for some
cases (due to very long strings), so we pick block formatting. (Many of the
cases that were using flow formatting for strings are improved by this change.)

Other than the flow -> block formatting change for some vectors of strings,
this should result in no functionality change.

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

Corresponding LLVM change is r306878.

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

7 years agoclang-format: add options to merge empty record body
Francois Ferrand [Fri, 30 Jun 2017 20:25:55 +0000 (20:25 +0000)]
clang-format: add options to merge empty record body

Summary:
This patch introduces a few extra BraceWrapping options, similar to
`SplitEmptyFunction`, to allow merging empty 'record' bodies (e.g.
class, struct, union and namespace):
* SplitEmptyClass
* SplitEmptyStruct
* SplitEmptyUnion
* SplitEmptyNamespace

The `SplitEmptyFunction` option name has also been simplified/
shortened (from `SplitEmptyFunctionBody`).

These options are helpful when the correspond AfterXXX option is
enabled, to allow merging the empty record:

  class Foo
  {};

In addition, this fixes an unexpected merging of short records, when
the AfterXXXX options are used, which caused to be formatted like
this:

  class Foo
  { void Foo(); };

This is now properly formatted as:

  class Foo
  {
     void Foo();
  };

Reviewers: djasper, krasimir

Reviewed By: djasper

Subscribers: cfe-commits, klimek

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

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

7 years ago[clang-rename] Just return instead of calling exit(3) from main.
Benjamin Kramer [Fri, 30 Jun 2017 20:24:32 +0000 (20:24 +0000)]
[clang-rename] Just return instead of calling exit(3) from main.

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

7 years agoclang-format: Do not binpack initialization lists
Francois Ferrand [Fri, 30 Jun 2017 20:00:02 +0000 (20:00 +0000)]
clang-format: Do not binpack initialization lists

Summary:
This patch tries to avoid binpacking when initializing lists/arrays, to allow things like:

  static int types[] = {
      registerType1(),
      registerType2(),
      registerType3(),
  };
  std::map<int, std::string> x = {
      { 0, "foo fjakfjaklf kljj" },
      { 1, "bar fjakfjaklf kljj" },
      { 2, "stuff fjakfjaklf kljj" },
  };

This is similar to how dictionnaries are formatted, and actually corresponds to the same conditions: when initializing a container (and not just 'calling' a constructor).

Such formatting involves 2 things:
* Line breaks around the content of the block. This can be forced by adding a comma or comment after the last element
* Elements should not be binpacked

This patch considers the block is an initializer list if it either ends with a comma, or follows an assignment, which seems to provide a sensible approximation.

Reviewers: krasimir, djasper

Reviewed By: djasper

Subscribers: malcolm.parsons, klimek, cfe-commits

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

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

7 years ago[ORE] Use LLVM's "diagnostics hotness" spelling
Brian Gesiak [Fri, 30 Jun 2017 19:37:11 +0000 (19:37 +0000)]
[ORE] Use LLVM's "diagnostics hotness" spelling

Summary:
Depends on https://reviews.llvm.org/D34864.

To unify Clang and LLVM's spelling of "diagnostic[s] hotness", use the
new "diagnostics hotness" spelling in LLVM, which was added in
https://reviews.llvm.org/D34864.

Reviewers: anemet, davidxl

Reviewed By: anemet

Subscribers: cfe-commits

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

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

7 years ago[X86] Add RDRND feature to Goldmont. Add MOVBE to all Atom CPUs.
Craig Topper [Fri, 30 Jun 2017 18:14:04 +0000 (18:14 +0000)]
[X86] Add RDRND feature to Goldmont. Add MOVBE to all Atom CPUs.

Diffential Revision: https://reviews.llvm.org/D34842

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

7 years ago[X86] Add a break to the last case of a few switches to prevent accidents in the...
Craig Topper [Fri, 30 Jun 2017 18:14:02 +0000 (18:14 +0000)]
[X86] Add a break to the last case of a few switches to prevent accidents in the future. NFC

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

7 years ago[X86] Move all atom CPUs to the same section of the switch and use fallthroughs like...
Craig Topper [Fri, 30 Jun 2017 18:14:01 +0000 (18:14 +0000)]
[X86] Move all atom CPUs to the same section of the switch and use fallthroughs like we do for other CPU generations. NFC

This is prep work to add MOVBE to all Atom CPUs. This instruction didn't come in to the Nehalem/Westmere/SandyBridge/etc. line until later so there's no natural place to overlap the Atom CPUs into that part of the switch.

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

7 years agoAttempt to fix the linkage error caused by r306840 on the mingw-RA-on-linux bot
Alex Lorenz [Fri, 30 Jun 2017 17:15:48 +0000 (17:15 +0000)]
Attempt to fix the linkage error caused by r306840 on the mingw-RA-on-linux bot

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

7 years agoMove ClassReplacements.cpp test from clang-rename tests to the
Alex Lorenz [Fri, 30 Jun 2017 16:58:36 +0000 (16:58 +0000)]
Move ClassReplacements.cpp test from clang-rename tests to the
clang-apply-replacements tests

The ClassReplacements.cpp test in the clang-rename tests uses
clang-apply-replacements. I moved it back to the clang-tools-extra repository
for now to ensure that the clang-rename tests can pass when clang is compiled
without clang-tools-extra.

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

7 years agoUse add_clang_unittest in the CMakeLists.txt for the moved unittest
Alex Lorenz [Fri, 30 Jun 2017 16:43:00 +0000 (16:43 +0000)]
Use add_clang_unittest in the CMakeLists.txt for the moved unittest

The unittest was moved in r306840

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

7 years ago[refactor] Move clang-rename into the clang repository
Alex Lorenz [Fri, 30 Jun 2017 16:36:09 +0000 (16:36 +0000)]
[refactor] Move clang-rename into the clang repository

The core engine of clang-rename will be used for local and global renames in the
new refactoring engine, as mentioned in
http://lists.llvm.org/pipermail/cfe-dev/2017-June/054286.html.

The clang-rename tool is still supported but might get deprecated in the future.

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

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

7 years ago[objc] Don't require null-check and don't emit memset when result is ignored for...
Kuba Mracek [Fri, 30 Jun 2017 16:28:15 +0000 (16:28 +0000)]
[objc] Don't require null-check and don't emit memset when result is ignored for struct-returning method calls [clang part]

This fixes an issue with the emission of lifetime markers for struct-returning Obj-C msgSend calls. When the result of a struct-returning call is ignored, the temporary storage is only marked with lifetime markers in one of the two branches of the nil-receiver-check. The check is, however, not required when the result is unused. If we still need to emit the check (due to consumer arguments), let's not emit the memset to zero out the result if it's unused. This fixes a use-after-scope false positive with AddressSanitizer.

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

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

7 years ago[MS] Test that deleting destructor thunks are not exported
Reid Kleckner [Fri, 30 Jun 2017 16:12:14 +0000 (16:12 +0000)]
[MS] Test that deleting destructor thunks are not exported

The MSVC linker emits the LNK4102 warning if they are.

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

7 years agoRevert "[CodeGen] Propagate dllexport to thunks"
Reid Kleckner [Fri, 30 Jun 2017 16:11:49 +0000 (16:11 +0000)]
Revert "[CodeGen] Propagate dllexport to thunks"

This reverts r306770, it causes LNK4102 warnings in MSVC builds.

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

7 years agoDriver: fix option declaration
Saleem Abdulrasool [Fri, 30 Jun 2017 15:15:39 +0000 (15:15 +0000)]
Driver: fix option declaration

The option is a "joined" argument.  Fix silly copy-paste error.  This
allows the parsing to work at runtime.

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

7 years agoDriver: honor -nostdinc and -isystem-after on CrossWindows
Saleem Abdulrasool [Fri, 30 Jun 2017 15:15:38 +0000 (15:15 +0000)]
Driver: honor -nostdinc and -isystem-after on CrossWindows

This changes CrossWindows to look for -nostdinc instead of -nostdlibinc.
In addition, fixes a bug where -isystem-after options would be dropped
when called with -nostdinc.

Patch by Dave Lee!

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

7 years ago[OpenCL] Add function name to extension diagnostic
Joey Gouly [Fri, 30 Jun 2017 14:23:01 +0000 (14:23 +0000)]
[OpenCL] Add function name to extension diagnostic

Slightly improve the diagnostic by including the function name.

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

7 years ago[OPENMP] Initial support for taskloop reductions.
Alexey Bataev [Fri, 30 Jun 2017 13:50:13 +0000 (13:50 +0000)]
[OPENMP] Initial support for taskloop reductions.

Add sema/parsupping ort for taskloop [simd] reductions.

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

7 years ago[Driver] Actually report errors during parsing instead of stopping when there's an...
Benjamin Kramer [Fri, 30 Jun 2017 13:21:27 +0000 (13:21 +0000)]
[Driver] Actually report errors during parsing instead of stopping when there's an error somewhere.

This is a more principled version of r303756. That change was both very
brittle about the state of the Diags object going into the driver and
also broke tooling in funny ways.

In particular it prevented tools from capturing diagnostics properly and
made the compilation database logic fail to provide arguments to the
tool, falling back to scanning directories for JSON files.

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

7 years agoAmbiguity might be also uninitialized. Use llvm::Optional.
Vassil Vassilev [Fri, 30 Jun 2017 09:25:43 +0000 (09:25 +0000)]
Ambiguity might be also uninitialized. Use llvm::Optional.

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

7 years agoARMV8-A archkind and target defines helper functions
Sjoerd Meijer [Fri, 30 Jun 2017 08:07:34 +0000 (08:07 +0000)]
ARMV8-A archkind and target defines helper functions

This introduces helper functions that set target defines for different ARMV8-A
architecture kinds. It fixes an issue that the v8.1 define ARM_FEATURE_QRDMX
was not set for v8.2. These helper functions make things more “scalable” if we
want to add ARMv8.3 at some point, and a cleanup has been done to hold the
architecture kind in one variable (instead of one for each).

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

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

7 years agoFix heap use after free introduced by r306769.
Daniel Jasper [Fri, 30 Jun 2017 08:02:37 +0000 (08:02 +0000)]
Fix heap use after free introduced by r306769.

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

7 years agoFold exception-warnings.cpp into warn-throw-out-noexcept-func.cpp
Stephan Bergmann [Fri, 30 Jun 2017 07:22:02 +0000 (07:22 +0000)]
Fold exception-warnings.cpp into warn-throw-out-noexcept-func.cpp

I had failed to notice the latter existed when I recently introduced the former.

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

7 years agoAdd -no-canonical-prefixes to the test line so that we can handle different build...
Eric Christopher [Fri, 30 Jun 2017 06:03:47 +0000 (06:03 +0000)]
Add -no-canonical-prefixes to the test line so that we can handle different build modes.

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

7 years agofix trivial typos, NFC
Hiroshi Inoue [Fri, 30 Jun 2017 05:40:31 +0000 (05:40 +0000)]
fix trivial typos, NFC

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

7 years agoRemove Clang support for '-fvectorize-slp-aggressive' which used LLVM's
Chandler Carruth [Fri, 30 Jun 2017 05:13:31 +0000 (05:13 +0000)]
Remove Clang support for '-fvectorize-slp-aggressive' which used LLVM's
basic block vectorizer. This vectorizer has had no known users for many,
many years and is completely surpassed by the normal
'-fvectorize-slp'-controlled SLP vectorizer in LLVM.

Hal proposed this back in 2014 to no objections:
http://lists.llvm.org/pipermail/llvm-dev/2014-November/079091.html

While this patch completely removes the flag, Joerg is working on
a patch that will add it back in a way that warns users and ignores the
flag in a clear and well factored way (so that we can keep doing this
going forward).

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

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

7 years agoRemove test commit.
Don Hinton [Fri, 30 Jun 2017 03:03:28 +0000 (03:03 +0000)]
Remove test commit.

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

7 years agoTest Commit
Don Hinton [Fri, 30 Jun 2017 02:57:34 +0000 (02:57 +0000)]
Test Commit

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

7 years ago[WebAssembly] Add throw/rethrow builtins for exception handling
Heejin Ahn [Fri, 30 Jun 2017 00:44:01 +0000 (00:44 +0000)]
[WebAssembly] Add throw/rethrow builtins for exception handling

Summary:
Add new builtins for throw/rethrow instructions. This follows exception handling
handling proposal in
https://github.com/WebAssembly/exception-handling/blob/master/proposals/Exceptions.md

Reviewers: sunfish, dschuff

Reviewed By: dschuff

Subscribers: jfb, dschuff, sbc100, jgravelle-google

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

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

7 years ago[CodeGen] Propagate dllexport to thunks
Shoaib Meenai [Fri, 30 Jun 2017 00:07:54 +0000 (00:07 +0000)]
[CodeGen] Propagate dllexport to thunks

Under Windows Itanium, we need to export virtual and non-virtual thunks
if the functions being thunked are exported. These thunks would
previously inherit their dllexport attribute from the declaration, but
r298330 changed declarations to not have dllexport attributes. We
therefore need to add the dllexport attribute to the definition
ourselves now.

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

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

7 years agoUnified logic for computing target ABI in backend and front end by moving this common...
Eric Christopher [Fri, 30 Jun 2017 00:03:56 +0000 (00:03 +0000)]
Unified logic for computing target ABI in backend and front end by moving this common code to Support/TargetParser.

Modeled Triple::GNU after front end code (aapcs abi) and updated tests that expect apcs abi.

Patch by Ana Pazos!

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

7 years ago[PM] Add support for sample PGO in the new pass manager (clang-side)
Dehao Chen [Thu, 29 Jun 2017 23:33:13 +0000 (23:33 +0000)]
[PM] Add support for sample PGO in the new pass manager (clang-side)

Summary: This implements the clang bits of https://reviews.llvm.org/D34720, and add corresponding test to verify if it worked.

Reviewers: chandlerc, davidxl, davide, tejohnson

Reviewed By: chandlerc, tejohnson

Subscribers: tejohnson, sanjoy, mehdi_amini, eraman, cfe-commits

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

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

7 years agoTeach ASTReader how to read only the Preprocessor state from an AST file, not the...
Richard Smith [Thu, 29 Jun 2017 23:23:46 +0000 (23:23 +0000)]
Teach ASTReader how to read only the Preprocessor state from an AST file, not the ASTContext state.

We use this when running a preprocessor-only action on an AST file in order to
avoid paying the runtime cost of loading the extra information.

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

7 years ago[clang-format] Switch to case-insensitive header matching and use it to
Chandler Carruth [Thu, 29 Jun 2017 23:20:54 +0000 (23:20 +0000)]
[clang-format] Switch to case-insensitive header matching and use it to
improve support for LLVM-style include sorting.

This really is a collection of improvements to the rules for LLVM
include sorting:
- We have gmock headers now, so it adds support for those to one of the
  categories.
- LLVM does use 'FooTest.cpp' files to test 'Foo.h' so it adds that
  suffix for finding a main header.
- At times the test file's case may not match the header file's case, so
  switch to case-insensitive regex matching of header names.

With this set of changes, I can't spot any misbehaviors when re-sorting
all of LLVM's unittest '#include' lines.

Thanks to Eric and Daniel for help testing and refining the patch during
review!

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

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

7 years ago[NewPM] Add Clang cc1 flag -fdebug-pass-manager for printing debug information.
Tim Shen [Thu, 29 Jun 2017 23:10:13 +0000 (23:10 +0000)]
[NewPM] Add Clang cc1 flag -fdebug-pass-manager for printing debug information.

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

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

7 years ago[ThinkLTO] Invoke build(Thin)?LTOPreLinkDefaultPipeline.
Tim Shen [Thu, 29 Jun 2017 23:08:38 +0000 (23:08 +0000)]
[ThinkLTO] Invoke build(Thin)?LTOPreLinkDefaultPipeline.

Previously it doesn't actually invoke the designated new PM builder
functions.

This patch moves NameAnonGlobalPass out from PassBuilder, as Chandler
points out that PassBuilder is used for non-O0 builds, and for
optimizations only.

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

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

7 years ago[ODRHash] Improve typedef handling.
Richard Trieu [Thu, 29 Jun 2017 22:53:04 +0000 (22:53 +0000)]
[ODRHash] Improve typedef handling.

Follow typedef chains to find the root type when processing types, and also
keep track of qualifiers.

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

7 years agoFix openmp-offload.c test on Windows
Reid Kleckner [Thu, 29 Jun 2017 22:31:16 +0000 (22:31 +0000)]
Fix openmp-offload.c test on Windows

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

7 years agoInsert llvm_unreachable at the end of a function to silence gcc's
Akira Hatanaka [Thu, 29 Jun 2017 20:44:20 +0000 (20:44 +0000)]
Insert llvm_unreachable at the end of a function to silence gcc's
-Werror=return-type error.

This is an attempt to fix the following failing bot:

http://lab.llvm.org:8011/builders/ubuntu-gcc7.1-werror

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

7 years ago[libFuzzer] Add Fuzzer to the list of sanitizers which support coverage.
George Karpenkov [Thu, 29 Jun 2017 19:58:20 +0000 (19:58 +0000)]
[libFuzzer] Add Fuzzer to the list of sanitizers which support coverage.

Without this change, additional coverage flags specified after
-fsanitize=fuzzer would get discarded.

https://reviews.llvm.org/D34794

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

7 years ago[libFuzzer] Do not link in libFuzzer with -fsanitize=fuzzer when producing a shared...
George Karpenkov [Thu, 29 Jun 2017 19:52:33 +0000 (19:52 +0000)]
[libFuzzer] Do not link in libFuzzer with -fsanitize=fuzzer when producing a shared object

https://reviews.llvm.org/D34791

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

7 years ago[ASTReader] Add test for previous change r306583 / 145692e.
Graydon Hoare [Thu, 29 Jun 2017 19:42:35 +0000 (19:42 +0000)]
[ASTReader] Add test for previous change r306583 / 145692e.

Summary:
Add a test for the change to ASTReader that reproduces the
logic for consolidating multiple ObjC interface definitions to the
case of multiple ObjC protocol definitions.

This test is a modified copy of the test that accompanied the original
change to interfaces, in 2ba1979.

Reviewers: bruno

Reviewed By: bruno

Subscribers: cfe-commits

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

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

7 years ago[OpenMP] Fix test for revision D29645. NFC
Gheorghe-Teodor Bercea [Thu, 29 Jun 2017 18:49:16 +0000 (18:49 +0000)]
[OpenMP] Fix test for revision D29645. NFC

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

7 years ago[Sema] Issue diagnostics if a new/delete expression generates a call to
Akira Hatanaka [Thu, 29 Jun 2017 18:48:40 +0000 (18:48 +0000)]
[Sema] Issue diagnostics if a new/delete expression generates a call to
a c++17 aligned allocation/deallocation function that is unavailable in
the standard library on Apple platforms.

The aligned functions are implemented only in the following versions or
later versions of the OSes, so clang issues diagnostics if the deployment
target being targeted is older than these:

macosx: 10.13
ios: 11.0
tvos: 11.0
watchos: 4.0

The diagnostics are issued whenever the aligned functions are selected
except when the selected function has a definition in the same file.
If there is a user-defined function available somewhere else, option
-Wno-aligned-allocation-unavailable can be used to silence the
diagnostics.

rdar://problem/32664169

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

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

7 years agoCodeGen: Fix invalid bitcast for coerced function argument
Yaxun Liu [Thu, 29 Jun 2017 18:47:45 +0000 (18:47 +0000)]
CodeGen: Fix invalid bitcast for coerced function argument

Clang assumes coerced function argument is in address space 0, which is not always true and results in invalid bitcasts.

This patch fixes failure in OpenCL conformance test api/get_kernel_arg_info with amdgcn---amdgizcl triple, where non-zero alloca address space is used.

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

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

7 years agoFixed -Wexceptions derived-to-base false positives
Stephan Bergmann [Thu, 29 Jun 2017 17:58:59 +0000 (17:58 +0000)]
Fixed -Wexceptions derived-to-base false positives

...as introduced with recent <https://reviews.llvm.org/D33333> "Emit warning
when throw exception in destruct or dealloc functions which has a (possible
implicit) noexcept specifier".  (The equivalent of the goodReference case hit
when building LibreOffice.)

(These warnings are apparently only emitted when no errors have yet been
encountered, so it didn't work to add the test code to the end of the existing
clang/test/SemaCXX/exceptions.cpp.)

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

7 years ago[OPENMP][DEBUG] Generate second function with correct arg types.
Alexey Bataev [Thu, 29 Jun 2017 16:43:05 +0000 (16:43 +0000)]
[OPENMP][DEBUG] Generate second function with correct arg types.

Currently, if the some of the parameters are captured by value, this
argument is converted to uintptr_t type and thus we loosing the debug
info about real type of the argument (captured variable):
```
void @.outlined_function.(uintptr %par);

...
%a = alloca i32
%a.casted = alloca uintptr
%cast = bitcast uintptr* %a.casted to i32*
%a.val = load i32, i32 *%a
store i32 %a.val, i32 *%cast
%a.casted.val = load uintptr, uintptr* %a.casted
call void @.outlined_function.(uintptr %a.casted.val)
...
```

To resolve this problem, in debug mode a speciall external wrapper
function is generated, that calls the outlined function with the correct
parameters types:
```
void @.wrapper.(uintptr %par) {
  %a = alloca i32
  %cast = bitcast i32* %a to uintptr*
  store uintptr %par, uintptr *%cast
  %a.val = load i32, i32* %a
  call void @.outlined_function.(i32 %a)
  ret void
}
void @.outlined_function.(i32 %par);

...
%a = alloca i32
%a.casted = alloca uintptr
%cast = bitcast uintptr* %a.casted to i32*
%a.val = load i32, i32 *%a
store i32 %a.val, i32 *%cast
%a.casted.val = load uintptr, uintptr* %a.casted
call void @.wrapper.(uintptr %a.casted.val)
...
```

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

7 years agoInitialize variable and silence potentially uninitialized warning.
Vassil Vassilev [Thu, 29 Jun 2017 16:08:10 +0000 (16:08 +0000)]
Initialize variable and silence potentially uninitialized warning.

Patch by Liza Sakellari!

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

7 years ago[OpenMP] Pass -fopenmp-is-device to preprocessing and machine specific code generatio...
Gheorghe-Teodor Bercea [Thu, 29 Jun 2017 15:59:19 +0000 (15:59 +0000)]
[OpenMP] Pass -fopenmp-is-device to preprocessing and machine specific code generation stages

Summary: The preprocessing and code generation and optimization stages of the compiler are also passed the "-fopenmp-is-device" flag. This is used to trigger machine specific preprocessing and code generation when performing device offloading to an NVIDIA GPU via OpenMP directives.

Reviewers: arpith-jacob, caomhin, carlo.bertolli, Hahnfeld, hfinkel, tstellar

Reviewed By: Hahnfeld

Subscribers: Hahnfeld, rengolin

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

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

7 years ago[OpenMP] Add support for auxiliary triple specification
Gheorghe-Teodor Bercea [Thu, 29 Jun 2017 15:49:03 +0000 (15:49 +0000)]
[OpenMP] Add support for auxiliary triple specification

Summary: Device offloading requires the specification of an additional flag containing the triple of the //other// architecture the code is being compiled on if such an architecture exists. If compiling for the host, the auxiliary triple flag will contain the triple describing the device and vice versa.

Reviewers: arpith-jacob, sfantao, caomhin, carlo.bertolli, ABataev, Hahnfeld, jlebar, hfinkel, tstellar

Reviewed By: Hahnfeld

Subscribers: rengolin, cfe-commits

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

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

7 years agoFix NSAPI constants to reflect the current state of
Alex Lorenz [Thu, 29 Jun 2017 14:18:26 +0000 (14:18 +0000)]
Fix NSAPI constants to reflect the current state of
NSStringMethodKind/NSDictionaryMethodKind enums

Patch by Vladimir Voskresensky!

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

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

7 years ago[Clang][X86][Goldmont]Adding new target-cpu: Goldmont
Michael Zuckerman [Thu, 29 Jun 2017 13:41:04 +0000 (13:41 +0000)]
[Clang][X86][Goldmont]Adding new target-cpu: Goldmont

[Clang-side] Connecting the GoldMont processor to his feature.

Reviewers:
1. igorb
2. delena
3. zvi

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

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

7 years ago[clang-format] Fix parsing of msg{field}-style proto options
Krasimir Georgiev [Thu, 29 Jun 2017 13:30:41 +0000 (13:30 +0000)]
[clang-format] Fix parsing of msg{field}-style proto options

Summary:
This patch makes the `{` in `msg_field{field: OK}` in a proto option scope be
treated as an assignment operator. Previosly the added test case was formatted
as:
```
option (MyProto.options) = {
  field_a: OK
  field_b{field_c: OK} field_d: OKOKOK field_e: OK
}
```

Reviewers: djasper

Reviewed By: djasper

Subscribers: klimek, cfe-commits

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

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

7 years agoRevert r306653, "[OpenCL] Allow function declaration with empty argument list."
NAKAMURA Takumi [Thu, 29 Jun 2017 10:47:23 +0000 (10:47 +0000)]
Revert r306653, "[OpenCL] Allow function declaration with empty argument list."

It broke bots.

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

7 years ago[Tooling] FixedCompilationDatabase should be able to strip positional
Alex Lorenz [Thu, 29 Jun 2017 10:43:44 +0000 (10:43 +0000)]
[Tooling] FixedCompilationDatabase should be able to strip positional
arguments when `-fsyntax-only` is used

Previously, Clang failed to create a fixed compilation database when the
compilation arguments use -fsyntax-only instead of -c. This commit fixes the
issue by forcing Clang to look at the compilation job when stripping the
positional arguments.

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

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

7 years ago[OpenCL] Allow function declaration with empty argument list.
Alexey Bader [Thu, 29 Jun 2017 08:44:10 +0000 (08:44 +0000)]
[OpenCL] Allow function declaration with empty argument list.

Summary:
does it make sense to enable K&R function declaration style for OpenCL?
clang throws following error message for the declaration w/o arguments:

```
int my_func();
error: function with no prototype cannot use the spir_function calling convention
```

Current way to fix this issue is to specify that parameter list is empty by using 'void':

```
int my_func(void);
```

Let me know what do you think about this patch.

Reviewers: Anastasia, yaxunl

Reviewed By: Anastasia

Subscribers: cfe-commits, echuraev

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

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

7 years agoFactor out a functionality from isBeforeInTranslationUnit
Gabor Horvath [Thu, 29 Jun 2017 06:53:13 +0000 (06:53 +0000)]
Factor out a functionality from isBeforeInTranslationUnit

The first user of this API will be the cross translation unit
functionality of the Static Analyzer which will be committed in a
follow-up patch.

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

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

7 years agoTrack the set of module maps read while building a .pcm file and reload those when...
Richard Smith [Thu, 29 Jun 2017 02:19:42 +0000 (02:19 +0000)]
Track the set of module maps read while building a .pcm file and reload those when preprocessing from that .pcm file.

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

7 years agoCodeGen: handle missed case of COMDAT handling
Saleem Abdulrasool [Thu, 29 Jun 2017 00:54:44 +0000 (00:54 +0000)]
CodeGen: handle missed case of COMDAT handling

When Protocol references are constructed, we need to add the reference
symbol to a COMDAT group on non-MachO object file formats (MachO handles
this by having a coalesced attribute).  This adds the missing case.

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

7 years ago[ASTReader] Treat multiple defns of ObjC protocols the same as interfaces.
Graydon Hoare [Wed, 28 Jun 2017 18:36:27 +0000 (18:36 +0000)]
[ASTReader] Treat multiple defns of ObjC protocols the same as interfaces.

Summary:
In change 2ba19793512, the ASTReader logic for ObjC interfaces was modified to
preserve the first definition-data read, "merging" later definitions into it
rather than overwriting it (though this "merging" is, in practice, a no-op that
discards the later definition-data).

Unfortunately this change was only made to ObjC interfaces, not protocols; this
means that when (for example) loading a protocol that references an interface,
if both the protocol and interface are multiply defined (as can easily happen
if the same header is read from multiple contexts), an _inconsistent_ pair of
definitions is loaded: first-read for the interface and last-read for the
protocol.

This in turn causes very subtle downstream bugs in the Swift ClangImporter,
which filters the results of name lookups based on the owning module of a
definition; inconsistency between a pair of related definitions causes name
lookup failures at various stages of compilation.

To fix these downstream issues, this change replicates the logic applied to
interfaces in change 2ba19793512, but for ObjC protocols.

rdar://30851899

Reviewers: doug.gregor, rsmith

Reviewed By: doug.gregor

Subscribers: jordan_rose, cfe-commits

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

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

7 years ago[Bash-autocompletion] Invoke clang where user called
Yuka Takahashi [Wed, 28 Jun 2017 16:29:26 +0000 (16:29 +0000)]
[Bash-autocompletion] Invoke clang where user called

Summary:
When user build clang and used completion Eg. `build/bin/clang -fno[tab]`, we want to invoke `build/bin/clang --autocomplete=-fno`, rather than `clang --autocomplete=-fno`.

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

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

7 years ago[Bash-autocompletion] Check clang version in Bash
Yuka Takahashi [Wed, 28 Jun 2017 15:59:55 +0000 (15:59 +0000)]
[Bash-autocompletion] Check clang version in Bash

Summary:
Add check if user's clang version supports --autocomplete or not.
If not, we just autocomplete files.

Reviewers: ruiu, v.g.vassilev, teemperor

Subscribers: cfe-commits

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

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

7 years agoUse vfs::FileSystem in ASTUnit when creating CompilerInvocation.
Ilya Biryukov [Wed, 28 Jun 2017 15:06:34 +0000 (15:06 +0000)]
Use vfs::FileSystem in ASTUnit when creating CompilerInvocation.

Summary: It used to always call into the RealFileSystem before.

Reviewers: bkramer, krasimir, klimek, bruno

Reviewed By: klimek

Subscribers: bruno, cfe-commits

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

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

7 years agoFix crash in clang while handling __has_trivial_destructor.
Karthik Bhat [Wed, 28 Jun 2017 08:52:08 +0000 (08:52 +0000)]
Fix crash in clang while handling __has_trivial_destructor.

Fix crash in clang when an array of unknown bounds of an incomplete type is passed to __has_trivial_destructor.

Patch by Puneetha
https://reviews.llvm.org/D34198

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

7 years agoDiagnosticRenderer.h: Prune \param SM, corresponding to rL306384. [-Wdocumentation]
NAKAMURA Takumi [Wed, 28 Jun 2017 06:46:23 +0000 (06:46 +0000)]
DiagnosticRenderer.h: Prune \param SM, corresponding to rL306384. [-Wdocumentation]

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

7 years agoRemove a redundant call to ArgList::hasFlag. NFC.
Vedant Kumar [Wed, 28 Jun 2017 01:56:07 +0000 (01:56 +0000)]
Remove a redundant call to ArgList::hasFlag. NFC.

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

7 years ago[CodeGen] Fix assertion failure in EmitCallArg.
Akira Hatanaka [Wed, 28 Jun 2017 00:42:48 +0000 (00:42 +0000)]
[CodeGen] Fix assertion failure in EmitCallArg.

The assertion was failing when a method of a parameterized class was
called and the types of the argument and parameter didn't match. To fix
the failure, move the assertion in EmitCallArg to its only caller
EmitCallArgs and require the argument and parameter types match only
when the method is not parameterized.

rdar://problem/32874473

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

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