]> granicus.if.org Git - clang/log
clang
7 years agoExplicitly initialize ForceEnableInt128 to avoid UB
Ilya Biryukov [Mon, 26 Feb 2018 12:06:05 +0000 (12:06 +0000)]
Explicitly initialize ForceEnableInt128 to avoid UB

This fixes an uninitialized value read found by msan.

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

7 years agoRevert "[Support] Replace HashString with djbHash."
Jonas Devlieghere [Mon, 26 Feb 2018 12:05:18 +0000 (12:05 +0000)]
Revert "[Support] Replace HashString with djbHash."

It looks like some of our tests depend on the ordering of hashed values.
I'm reverting my changes while I try to reproduce and fix this locally.

Failing builds:

  lab.llvm.org:8011/builders/lld-x86_64-darwin13/builds/18388
  lab.llvm.org:8011/builders/clang-cmake-x86_64-sde-avx512-linux/builds/6743
  lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/15607

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

7 years ago[Support] Replace HashString with djbHash.
Jonas Devlieghere [Mon, 26 Feb 2018 11:30:13 +0000 (11:30 +0000)]
[Support] Replace HashString with djbHash.

This removes the HashString function from StringExtraces and replaces
its uses with calls to djbHash from DJB.h

This is *almost* NFC. While the algorithm is identical, the djbHash
implementation in StringExtras used 0 as its seed while the
implementation in DJB uses 5381. The latter has been shown to result in
less collisions and improved avalanching.

https://reviews.llvm.org/D43615
(cherry picked from commit 77f7f965bc9499a9ae768a296ca5a1f7347d1d2c)

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

7 years ago[www] Update link to analyzer's "Building a Checker in 24 hours" video
Devin Coughlin [Mon, 26 Feb 2018 00:39:25 +0000 (00:39 +0000)]
[www] Update link to analyzer's "Building a Checker in 24 hours" video

The video is now uploaded to YouTube.

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

7 years agoWhen diagnosing the arguments to alloc_size, report the failing argument using a...
Aaron Ballman [Sun, 25 Feb 2018 20:40:06 +0000 (20:40 +0000)]
When diagnosing the arguments to alloc_size, report the failing argument using a 1-based index instead of a 0-based index for consistency.

Patch by Joel Denny.

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

7 years agoFix a failing assertion with the pointer_with_type_tag attribute when the function...
Aaron Ballman [Sun, 25 Feb 2018 20:28:10 +0000 (20:28 +0000)]
Fix a failing assertion with the pointer_with_type_tag attribute when the function the attribute appertains to is variadic.

Patch by Joel Denny.

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

7 years agoSwitch the default behavior of the Clang<> spelling to opt-in to the C2x attribute...
Aaron Ballman [Sun, 25 Feb 2018 15:34:17 +0000 (15:34 +0000)]
Switch the default behavior of the Clang<> spelling to opt-in to the C2x attribute spellings. NFC to the attribute spellings themselves.

The Clang<> spelling helper generates a spelling for C++11, GNU, and C2x attribute spellings. Previously, users had to manually opt in to the C2x spelling while we cautiously added attributes to that spelling. Now that majority of attributes are exposed in C2x, we can switch the default.

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

7 years agoDocument why the consumed attributes (consumable, callable_when, et al) are not expos...
Aaron Ballman [Sun, 25 Feb 2018 14:54:25 +0000 (14:54 +0000)]
Document why the consumed attributes (consumable, callable_when, et al) are not exposed with a C2x spelling. NFC.

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

7 years agoAdd a C2x spelling for the external_source_symbol and internal_linkage attributes...
Aaron Ballman [Sun, 25 Feb 2018 14:43:45 +0000 (14:43 +0000)]
Add a C2x spelling for the external_source_symbol and internal_linkage attributes in the clang vendor namespace.

Both of these attributes have existing meaning in C code, so there was no reason to exclude them from using the new spelling.

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

7 years agoAdd a C++11 and C2x spelling for the type safety attribute (argument_with_type_tag...
Aaron Ballman [Sun, 25 Feb 2018 14:01:04 +0000 (14:01 +0000)]
Add a C++11 and C2x spelling for the type safety attribute (argument_with_type_tag, pointer_with_type_tag, and type_tag_for_datatype) in the clang vendor namespace.

The TypeTagForDatatype attribute had custom parsing rules that previously prevented it from being supported with square bracket notation. The ArgumentWithTypeTag attribute previously had unnecessary custom parsing that could be handled declaratively.

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

7 years ago[RISCV] Enable __int128_t and __uint128_t through clang flag
Mandeep Singh Grang [Sun, 25 Feb 2018 03:58:23 +0000 (03:58 +0000)]
[RISCV] Enable __int128_t and __uint128_t through clang flag

Summary:
If the flag -fforce-enable-int128 is passed, it will enable support for __int128_t and __uint128_t types.
This flag can then be used to build compiler-rt for RISCV32.

Reviewers: asb, kito-cheng, apazos, efriedma

Reviewed By: asb, efriedma

Subscribers: shiva0217, efriedma, jfb, dschuff, sdardis, sbc100, jgravelle-google, aheejin, rbar, johnrusso, simoncook, jordy.potman.lists, sabuasal, niosHD, cfe-commits

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

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

7 years ago[X86] Remove some masked cvt builtins that can be replaced with legacy sse/avx buiilt...
Craig Topper [Sat, 24 Feb 2018 18:55:13 +0000 (18:55 +0000)]
[X86] Remove some masked cvt builtins that can be replaced with legacy sse/avx buiiltins and a select.

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

7 years agoAdd a C++11 and C2x spelling for the objc_bridge_related attribute in the clang vendo...
Aaron Ballman [Sat, 24 Feb 2018 17:37:37 +0000 (17:37 +0000)]
Add a C++11 and C2x spelling for the objc_bridge_related attribute in the clang vendor namespace.

This attribute has custom parsing rules that previously prevented it from being supported with square bracket notation.

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

7 years agoAdd a C++11 and C2x spelling for the availability attribute in the clang vendor names...
Aaron Ballman [Sat, 24 Feb 2018 17:16:42 +0000 (17:16 +0000)]
Add a C++11 and C2x spelling for the availability attribute in the clang vendor namespace.

This attribute has custom parsing rules that previously prevented it from being supported with square bracket notation. Rework the clang attribute argument parsing to be more easily extended for other custom-parsed attributes.

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

7 years agoRemove unused variable. We should be warning-free.
Daniel Jasper [Sat, 24 Feb 2018 06:57:47 +0000 (06:57 +0000)]
Remove unused variable. We should be warning-free.

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

7 years agoMake module use diagnostics refer to the top-level module
Daniel Jasper [Sat, 24 Feb 2018 06:54:09 +0000 (06:54 +0000)]
Make module use diagnostics refer to the top-level module

All use declarations need to be directly placed in the top-level module
anyway, knowing the submodule doesn't really help. The header that has
the offending #include can easily be seen in the diagnostics source
location.

Review: https://reviews.llvm.org/D43673

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

7 years ago[X86] Remove __builtin_ia32_permvarsf256_mask and __builtin_ia32_permvarsi256_mask...
Craig Topper [Sat, 24 Feb 2018 06:46:42 +0000 (06:46 +0000)]
[X86] Remove __builtin_ia32_permvarsf256_mask and __builtin_ia32_permvarsi256_mask and use the avx2 unmasked versions and a select instead.

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

7 years ago[CFG] Keep speculatively working around an MSVC compiler crash.
Artem Dergachev [Sat, 24 Feb 2018 03:54:22 +0000 (03:54 +0000)]
[CFG] Keep speculatively working around an MSVC compiler crash.

Replace if() with a switch(). Because random changes in the code seem to
suppress the crash.

Story so far:
r325966 - Crash introduced.
r325969 - Speculative fix had no effect.
r325978 - Tried to bisect the offending function, crash suddenly disappeared.
r326016 - After another random change in the code, bug appeared again.

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

7 years ago[CFG] Provide construction contexts for temporaries in conditional operators.
Artem Dergachev [Sat, 24 Feb 2018 03:10:15 +0000 (03:10 +0000)]
[CFG] Provide construction contexts for temporaries in conditional operators.

When a lifetime-extended temporary is on a branch of a conditional operator,
materialization of such temporary occurs after the condition is resolved.

This change allows us to understand, by including the MaterializeTemporaryExpr
in the construction context, the target for temporary materialization in such
cases.

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

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

7 years ago[CFG] Provide construction contexts for temporaries bound to const references.
Artem Dergachev [Sat, 24 Feb 2018 02:07:50 +0000 (02:07 +0000)]
[CFG] Provide construction contexts for temporaries bound to const references.

In order to bind a temporary to a const lvalue reference, a no-op cast is added
to make the temporary itself const, and only then the reference is taken
(materialized). Skip the no-op cast when looking for the construction context.

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

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

7 years ago[CFG] Provide construction contexts for functional cast-like constructors.
Artem Dergachev [Sat, 24 Feb 2018 02:05:11 +0000 (02:05 +0000)]
[CFG] Provide construction contexts for functional cast-like constructors.

When a constructor of a temporary with a single argument is treated
as a functional cast expression, skip the functional cast expression
and provide the correct construction context for the temporary.

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

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

7 years ago[CFG] Provide construction contexts for lifetime-extended temporaries.
Artem Dergachev [Sat, 24 Feb 2018 02:00:30 +0000 (02:00 +0000)]
[CFG] Provide construction contexts for lifetime-extended temporaries.

When constructing a temporary that is going to be lifetime-extended through a
MaterializeTemporaryExpr later, CFG elements for the respective constructor
can now be queried to obtain the reference to that MaterializeTemporaryExpr
and therefore gain information about lifetime extension.

This may produce multi-layered construction contexts when information about
both temporary destruction and lifetime extension is available.

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

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

7 years agoAdd another test for PR36157.
Richard Smith [Sat, 24 Feb 2018 00:00:58 +0000 (00:00 +0000)]
Add another test for PR36157.

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

7 years ago[ExprConstant] Fix crash when initialize an indirect field with another field.
Volodymyr Sapsai [Fri, 23 Feb 2018 23:59:20 +0000 (23:59 +0000)]
[ExprConstant] Fix crash when initialize an indirect field with another field.

When indirect field is initialized with another field, you have
MemberExpr with CXXThisExpr that corresponds to the field's immediate
anonymous parent. But 'this' was referring to the non-anonymous parent.
So when we were building LValue Designator, it was incorrect as it had
wrong starting point. Usage of such designator would cause unexpected
APValue changes and crashes.

The fix is in adjusting 'this' for indirect fields from non-anonymous
parent to the field's immediate parent.

Discovered by OSS-Fuzz:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=4985

rdar://problem/36359187

Reviewers: rsmith, efriedma

Reviewed By: rsmith

Subscribers: cfe-commits, jkorous-apple

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

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

7 years agobpf: Hook target feature "alu32" with LLVM
Yonghong Song [Fri, 23 Feb 2018 23:55:29 +0000 (23:55 +0000)]
bpf: Hook target feature "alu32" with LLVM

LLVM has supported a new target feature "alu32" which could be enabled or
disabled by "-mattr=[+|-]alu32" when using llc.

This patch link Clang with it, so it could be also done by passing related
options to Clang, for example:

  -Xclang -target-feature -Xclang +alu32

Signed-off-by: Jiong Wang <jiong.wang@netronome.com>
Reviewed-by: Yonghong Song <yhs@fb.com>
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@325996 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Sema][ObjC] Process category attributes before checking protocol uses
Alex Lorenz [Fri, 23 Feb 2018 23:49:43 +0000 (23:49 +0000)]
[Sema][ObjC] Process category attributes before checking protocol uses

This ensures that any availability attributes are attached to the
category before the availability for the referenced protocols is checked.

rdar://37829755

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

7 years ago[CFG] Try to narrow down MSVC compiler crash via binary search.
Artem Dergachev [Fri, 23 Feb 2018 23:38:41 +0000 (23:38 +0000)]
[CFG] Try to narrow down MSVC compiler crash via binary search.

Split the presumably offending function in two to see which part of it causes
the crash to occur.

The crash was introduced in r325966.
r325969 did not help.

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

7 years ago[analyzer] Relax the assert used when traversing the node graph.
George Karpenkov [Fri, 23 Feb 2018 23:26:57 +0000 (23:26 +0000)]
[analyzer] Relax the assert used when traversing the node graph.

The assertion gets exposed when changing the exploration order.
This is a quick hacky fix, but the intention is that if the nodes do
merge, it should not matter which predecessor should be traverse.
A proper fix would be not to traverse predecessors at all, as all
information relevant for any decision should be avilable locally.

rdar://37540480

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

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

7 years ago[analyzer] mark returns of functions where the region passed as parameter was not...
George Karpenkov [Fri, 23 Feb 2018 23:26:56 +0000 (23:26 +0000)]
[analyzer] mark returns of functions where the region passed as parameter was not initialized

In the wild, many cases of null pointer dereference, or uninitialized
value read occur because the value was meant to be initialized by the
inlined function, but did not, most often due to error condition in the
inlined function.
This change highlights the return branch taken by the inlined function,
in order to help user understand the error report and see why the value
was uninitialized.

rdar://36287652

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

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

7 years ago[analyzer] Consider switch- and goto- labels when constructing the set of executed...
George Karpenkov [Fri, 23 Feb 2018 23:26:54 +0000 (23:26 +0000)]
[analyzer] Consider switch- and goto- labels when constructing the set of executed lines

When viewing the report in the collapsed mode the label signifying where
did the execution go is often necessary for properly understanding the
context.

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

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

7 years ago[CFG] NFC: Speculative attempt to fix MSVC internal compiler error on buildbot.
Artem Dergachev [Fri, 23 Feb 2018 22:49:25 +0000 (22:49 +0000)]
[CFG] NFC: Speculative attempt to fix MSVC internal compiler error on buildbot.

Don't use fancy initialization and member access in a DenseMap.

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

7 years ago[CFG] [analyzer] NFC: Allow more complicated construction contexts.
Artem Dergachev [Fri, 23 Feb 2018 22:20:39 +0000 (22:20 +0000)]
[CFG] [analyzer] NFC: Allow more complicated construction contexts.

ConstructionContexts introduced in D42672 are an additional piece of information
included with CFGConstructor elements that help the client of the CFG (such as
the Static Analyzer) understand where the newly constructed object is stored.

The patch refactors the ConstructionContext class to prepare for including
multi-layered contexts that are being constructed gradually, layer-by-layer,
as the AST is traversed.

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

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

7 years agoSet Module Metadata "RtLibUseGOT" when fno-plt is used.
Sriraman Tallam [Fri, 23 Feb 2018 21:27:33 +0000 (21:27 +0000)]
Set Module Metadata "RtLibUseGOT" when fno-plt is used.

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

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

7 years ago[Driver] Make -fno-common default for Fuchsia
Petr Hosek [Fri, 23 Feb 2018 20:10:14 +0000 (20:10 +0000)]
[Driver] Make -fno-common default for Fuchsia

We never want to generate common symbols on Fuchsia.

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

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

7 years agoReally fix test on windows.
Rafael Espindola [Fri, 23 Feb 2018 19:38:41 +0000 (19:38 +0000)]
Really fix test on windows.

Sorry for the noise.

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

7 years agoFix one last test on a windows host.
Rafael Espindola [Fri, 23 Feb 2018 19:36:20 +0000 (19:36 +0000)]
Fix one last test on a windows host.

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

7 years agoBring r325915 back.
Rafael Espindola [Fri, 23 Feb 2018 19:30:48 +0000 (19:30 +0000)]
Bring r325915 back.

The tests that failed on a windows host have been fixed.

Original message:

Start setting dso_local for COFF.

With this there are still some GVs where we don't set dso_local
because setGVProperties is never called. I intend to fix that in
followup commits. This is just the bare minimum to teach
shouldAssumeDSOLocal what it should do for COFF.

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

7 years agoConvert test to FileCheck. NFC.
Rafael Espindola [Fri, 23 Feb 2018 18:18:01 +0000 (18:18 +0000)]
Convert test to FileCheck. NFC.

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

7 years agoRevert "Start setting dso_local for COFF."
Rafael Espindola [Fri, 23 Feb 2018 18:09:29 +0000 (18:09 +0000)]
Revert "Start setting dso_local for COFF."

This reverts commit r325915.

It will take some time to fix the failures on a windows host.

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

7 years agoRevert "[Darwin] Add a test to check clang produces accelerator tables."
Paul Robinson [Fri, 23 Feb 2018 16:36:48 +0000 (16:36 +0000)]
Revert "[Darwin] Add a test to check clang produces accelerator tables."

This reverts commit 7e24e5f8bff77b7e78da3bfcc68abf42457a66c9.
aka r325850.  Clang should not have end-to-end tests.

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

7 years agoStart setting dso_local for COFF.
Rafael Espindola [Fri, 23 Feb 2018 15:32:32 +0000 (15:32 +0000)]
Start setting dso_local for COFF.

With this there are still some GVs where we don't set dso_local
because setGVProperties is never called. I intend to fix that in
followup commits. This is just the bare minimum to teach
shouldAssumeDSOLocal what it should do for COFF.

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

7 years agoSupport for the mno-stack-arg-probe flag
Hans Wennborg [Fri, 23 Feb 2018 13:47:36 +0000 (13:47 +0000)]
Support for the mno-stack-arg-probe flag

Adds support for this flag. There is also another piece for llvm
(separate review). More info:
https://bugs.llvm.org/show_bug.cgi?id=36221

By Ruslan Nikolaev!

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

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

7 years ago[mips] Revert r325872
Stefan Maksimovic [Fri, 23 Feb 2018 13:46:14 +0000 (13:46 +0000)]
[mips] Revert r325872

There are still outstanding issues with byVal arguments
that prevent this from being committed. Revert for now.

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

7 years ago[mips] Reland r310704
Stefan Maksimovic [Fri, 23 Feb 2018 08:37:48 +0000 (08:37 +0000)]
[mips] Reland r310704

Recommit this change which was previously reverted
for the 5.0.0 release since the failures identified
were dealt with in r325782.

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

7 years agoAdd a test to ensure we don't permit mutable access on temporaries outside the evalua...
Richard Smith [Fri, 23 Feb 2018 02:03:26 +0000 (02:03 +0000)]
Add a test to ensure we don't permit mutable access on temporaries outside the evaluation in which they were created.

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

7 years ago[Darwin] Add a test to check clang produces accelerator tables.
Davide Italiano [Fri, 23 Feb 2018 01:25:03 +0000 (01:25 +0000)]
[Darwin] Add a test to check clang produces accelerator tables.

This test was previously in lldb, and was only checking that clang
was emitting the correct section. So, it belongs here and not
in the debugger.

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

7 years agoSimplify setting dso_local. NFC.
Rafael Espindola [Fri, 23 Feb 2018 00:22:15 +0000 (00:22 +0000)]
Simplify setting dso_local. NFC.

The value of dso_local can be computed from just IR properties and
global information (object file type, command line options, etc).

With this patch we no longer pass in the Decl. It was almost unused
and making it fully unused guarantees that dso_local is consistent
with the rest of the IR.

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

7 years ago[Sema] Fix some Clang-tidy modernize and Include What You Use warnings; other minor...
Eugene Zelenko [Thu, 22 Feb 2018 22:35:17 +0000 (22:35 +0000)]
[Sema] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

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

7 years ago[OpenMP] Limit reduction support for pragma 'distribute' when combined with pragma...
Carlo Bertolli [Thu, 22 Feb 2018 19:38:14 +0000 (19:38 +0000)]
[OpenMP] Limit reduction support for pragma 'distribute' when combined with pragma 'simd'

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

This is a bug fix that removes the emission of reduction support for pragma 'distribute' when found alone or in combinations without simd.
Pragma 'distribute' does not have a reduction clause, but when combined with pragma 'simd' we need to emit the support for simd's reduction clause as part of code generation for distribute. This guard is similar to the one used for reduction support earlier in the same code gen function.

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

7 years ago[CUDA] Added missing functions.
Artem Belevich [Thu, 22 Feb 2018 18:40:52 +0000 (18:40 +0000)]
[CUDA] Added missing functions.

Initial commit missed sincos(float), llabs() and few atomics that we
used to pull in from device_functions.hpp, which we no longer include.

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

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

7 years ago[OPENMP] Require valid SourceLocation in function call, NFC.
Alexey Bataev [Thu, 22 Feb 2018 18:33:31 +0000 (18:33 +0000)]
[OPENMP] Require valid SourceLocation in function call, NFC.

Removed default empty SourceLocation argument from `emitCall` function
and require valid location.

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

7 years ago[docs] Regenerate command line reference
Jonas Hahnfeld [Thu, 22 Feb 2018 17:10:28 +0000 (17:10 +0000)]
[docs] Regenerate command line reference

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

7 years ago[docs] Improve help for OpenMP options, NFC.
Jonas Hahnfeld [Thu, 22 Feb 2018 17:06:35 +0000 (17:06 +0000)]
[docs] Improve help for OpenMP options, NFC.

 * Add HelpText for -fopenmp so that it appears in clang --help.
 * Hide -fno-openmp-simd, only list the positive option.
 * Hide -fopenmp-relocatable-target and -fopenmp-use-tls from
   clang --help and from ClangCommandLineReference.
 * Improve MetaVarName for -Xopenmp-target=<...>.

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

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

7 years ago[docs] Fix duplicate arguments for JoinedAndSeparate
Jonas Hahnfeld [Thu, 22 Feb 2018 17:06:27 +0000 (17:06 +0000)]
[docs] Fix duplicate arguments for JoinedAndSeparate

We can't see how many arguments are in the meta var name, so just
assume that it is the right number.

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

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

7 years ago[OpenCL] Add '-cl-uniform-work-group-size' compile option
Alexey Sotkin [Thu, 22 Feb 2018 11:54:14 +0000 (11:54 +0000)]
[OpenCL] Add '-cl-uniform-work-group-size' compile option

Summary:
OpenCL 2.0 specification defines '-cl-uniform-work-group-size' option,
which requires that the global work-size be a multiple of the work-group
size specified to clEnqueueNDRangeKernel and allows optimizations that
are made possible by this restriction.

The patch introduces the support of this option.

To keep information about whether an OpenCL kernel has uniform work
group size or not, clang generates 'uniform-work-group-size' function
attribute for every kernel:
- "uniform-work-group-size"="true" for OpenCL 1.2 and lower,
- "uniform-work-group-size"="true" for OpenCL 2.0 and higher if
 '-cl-uniform-work-group-size' option was specified,
- "uniform-work-group-size"="false" for OpenCL 2.0 and higher if no
 '-cl-uniform-work-group-size' options was specified.

If the function is not an OpenCL kernel, 'uniform-work-group-size'
attribute isn't generated.

Patch by: krisb

Reviewers: yaxunl, Anastasia, b-sumner

Reviewed By: yaxunl, Anastasia

Subscribers: nhaehnle, yaxunl, Anastasia, cfe-commits

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

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

7 years ago[NFC] fix trivial typos in comments
Hiroshi Inoue [Thu, 22 Feb 2018 07:49:13 +0000 (07:49 +0000)]
[NFC] fix trivial typos in comments

"a a"->"a"

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

7 years agoRevert part of D43378 in this file
Kamil Rytarowski [Thu, 22 Feb 2018 07:00:29 +0000 (07:00 +0000)]
Revert part of D43378 in this file

It causes failure on clang-x86_64-debian-fast.

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

7 years agoRevert part of r. 325746 D43378
Kamil Rytarowski [Thu, 22 Feb 2018 06:48:34 +0000 (06:48 +0000)]
Revert part of r. 325746 D43378

test/Driver/XRay/xray-shared-noxray.cpp fails on !Linux hosts.

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

7 years agoFreeBSD driver / Xray flags moving pthread to compile flags.
Kamil Rytarowski [Thu, 22 Feb 2018 06:31:40 +0000 (06:31 +0000)]
FreeBSD driver / Xray flags moving pthread to compile flags.

Summary:
- Using -lpthread instead, with -pthread the linkage does not work.
-Warning about the -fxray-instrument usage outside of the working cases.

Patch by: David CARLIER

Reviewers: krytarowski, vitalybuka, dberris, emaste

Reviewed By: krytarowski, emaste

Subscribers: srhines, emaste, cfe-commits

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

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

7 years ago[ODRHash] Fix hashing for friend functions.
Richard Trieu [Thu, 22 Feb 2018 05:50:29 +0000 (05:50 +0000)]
[ODRHash] Fix hashing for friend functions.

When hashing a templated function, use the hash of the function it was
instantiated from.

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

7 years ago[ODRHash] Handle some template weirdness.
Richard Trieu [Thu, 22 Feb 2018 05:32:25 +0000 (05:32 +0000)]
[ODRHash] Handle some template weirdness.

Build the index off of DeclarationName instead of Decl pointers.  When finding
an UnresolvedLookupExprClass, hash it as if it were a DeclRefExpr.  This will
allow methods to be hashed.

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

7 years ago[Driver] Generate .eh_frame_hdr for static executables too.
Dan Albert [Wed, 21 Feb 2018 22:36:51 +0000 (22:36 +0000)]
[Driver] Generate .eh_frame_hdr for static executables too.

Summary: libgcc won't unwind without an .eh_frame_hdr section.

Reviewers: srhines, chandlerc

Reviewed By: chandlerc

Subscribers: chandlerc, cfe-commits

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

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

7 years agoCodeGen: handle blocks correctly when inalloca'ed
Saleem Abdulrasool [Wed, 21 Feb 2018 21:47:51 +0000 (21:47 +0000)]
CodeGen: handle blocks correctly when inalloca'ed

When using blocks with C++ on Windows x86, it is possible to have the
block literal be pushed into the inalloca'ed parameters.  Teach IRGen to
handle the case properly by extracting the block literal from the
inalloca parameter.  This fixes the use of blocks with C++ on Windows
x86.

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

7 years ago[clang-format] Fix regression when getStyle() called with empty filename
Ben Hamilton [Wed, 21 Feb 2018 21:27:27 +0000 (21:27 +0000)]
[clang-format] Fix regression when getStyle() called with empty filename

Summary:
D43522 caused an assertion failure when getStyle() was called with
an empty filename:

P8065

This adds a test to reproduce the failure and fixes the issue by
ensuring we never pass an empty filename to
Environment::CreateVirtualEnvironment().

Test Plan: New test added. Ran test with:
  % make -j12 FormatTests && ./tools/clang/unittests/Format/FormatTests
  Before diff, test failed with P8065. Now, test passes.

Reviewers: vsapsai, jolesiak, krasimir

Reviewed By: vsapsai

Subscribers: klimek, cfe-commits

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

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

7 years agoReplace incorrect usage of isInvalidDecl with intended setInvalidDecl
Erich Keane [Wed, 21 Feb 2018 20:29:05 +0000 (20:29 +0000)]
Replace incorrect usage of isInvalidDecl with intended setInvalidDecl

This typo would cause an attempt to multiversion 'main' to issue an
error, but not mark the function as invalid.  This patch fixes it.

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

7 years ago[analyzer] Prevent AnalyzerStatsChecker from crash
Peter Szecsi [Wed, 21 Feb 2018 16:06:56 +0000 (16:06 +0000)]
[analyzer] Prevent AnalyzerStatsChecker from crash

The checker marks the locations where the analyzer creates sinks. However, it
can happen that the sink was created because of a loop which does not contain
condition statement, only breaks in the body. The exhausted block is the block
which should contain the condition but empty, in this case.
This change only emits this marking in order to avoid the undefined behavior.

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

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

7 years agoRemove use of the 'gmlt' term from the -fsplit-dwarf-inlining flag description to...
David Blaikie [Wed, 21 Feb 2018 16:00:50 +0000 (16:00 +0000)]
Remove use of the 'gmlt' term from the -fsplit-dwarf-inlining flag description to make it more readily legible

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

7 years ago[clang-format] New API guessLanguage()
Ben Hamilton [Wed, 21 Feb 2018 15:54:31 +0000 (15:54 +0000)]
[clang-format] New API guessLanguage()

Summary:
For clients which don't have a filesystem, calling getStyle() doesn't
make much sense (there's no .clang-format files to search for).

In this diff, I hoist out the language-guessing logic from getStyle()
and move it into a new API guessLanguage().

I also added support for guessing the language of files which have no
extension (they could be C++ or ObjC).

Test Plan: New tests added. Ran tests with:
  % make -j12 FormatTests && ./tools/clang/unittests/Format/FormatTests

Reviewers: jolesiak, krasimir

Reviewed By: jolesiak, krasimir

Subscribers: klimek, cfe-commits, sammccall

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

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

7 years ago[ASTMatchers] Regenerate documentation after r325678
Eric Liu [Wed, 21 Feb 2018 14:22:42 +0000 (14:22 +0000)]
[ASTMatchers] Regenerate documentation after r325678

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

7 years ago[ASTMatchers] isTemplateInstantiation: also match explicit instantiation declaration.
Eric Liu [Wed, 21 Feb 2018 13:51:27 +0000 (13:51 +0000)]
[ASTMatchers] isTemplateInstantiation: also match explicit instantiation declaration.

Summary:
Example:
template <typename T> class X {}; class A {};
// Explicit instantiation declaration.
extern template class X<A>;

Reviewers: bkramer

Subscribers: klimek, cfe-commits

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

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

7 years ago[Sema] Classify conversions from enum to float as narrowing
Mikhail Maltsev [Wed, 21 Feb 2018 10:08:18 +0000 (10:08 +0000)]
[Sema] Classify conversions from enum to float as narrowing

Summary:
According to [dcl.init.list]p7:
  A narrowing conversion is an implicit conversion
  - ...
  - from an integer type or unscoped enumeration type to a
    floating-point type, except where the source is a constant
    expression and the actual value after conversion will fit into
    the target type and will produce the original value when
    converted back to the original type, or
  - ...

Currently clang does not handle the 'unscoped enumeration' case. This
patch fixes the corresponding check.

Reviewers: faisalv, rsmith, rogfer01

Reviewed By: rogfer01

Subscribers: rogfer01, cfe-commits

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

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

7 years ago[Fuchsia] Include libClang and clang-include-fixer in the toolchain
Petr Hosek [Wed, 21 Feb 2018 04:39:15 +0000 (04:39 +0000)]
[Fuchsia] Include libClang and clang-include-fixer in the toolchain

libClang is used by other Clang based tools such as cquery while
clang-include-fixer is generally a useful tool.

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

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

7 years agoIn C++14 onwards, it is permitted to read mutable members in constant
Richard Smith [Wed, 21 Feb 2018 03:38:30 +0000 (03:38 +0000)]
In C++14 onwards, it is permitted to read mutable members in constant
expressions, if their lifetime began during the evaluation of the expression.

This is technically not allowed in C++11, though we could consider permitting
it there too, as an extension.

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

7 years agoClean up use of C allocation functions
Serge Pavlov [Wed, 21 Feb 2018 02:02:39 +0000 (02:02 +0000)]
Clean up use of C allocation functions

If the value returned by `malloc`, `calloc` or `realloc` is not checked
for null pointer, this change replaces them for `safe_malloc`,
`safe_calloc` or `safe_realloc`, which are defined in the namespace `llvm`.
These function report fatal error on out of memory.

In the plain C files, assertion statements are added to ensure that memory
is successfully allocated.

The aim of this change is to get better diagnostics of OOM on Windows.

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

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

7 years ago[Sema] Fix some Clang-tidy modernize and Include What You Use warnings; other minor...
Eugene Zelenko [Wed, 21 Feb 2018 01:45:26 +0000 (01:45 +0000)]
[Sema] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

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

7 years ago[X86] Disable CLWB in Cannon Lake
Craig Topper [Wed, 21 Feb 2018 00:16:50 +0000 (00:16 +0000)]
[X86] Disable CLWB in Cannon Lake

Cannon Lake does not support CLWB, therefore it
does not include all features listed under SKX.

Patch by Gabor Buella

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

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

7 years ago[mips] Spectre variant two mitigation for MIPSR2
Simon Dardis [Wed, 21 Feb 2018 00:05:05 +0000 (00:05 +0000)]
[mips] Spectre variant two mitigation for MIPSR2

This patch provides mitigation for CVE-2017-5715, Spectre variant two,
which affects the P5600 and P6600. It provides the option
-mindirect-jump=hazard, which instructs the LLVM backend to replace
indirect branches with their hazard barrier variants.

This option is accepted when targeting MIPS revision two or later.

The migitation strategy suggested by MIPS for these processors is to
use two hazard barrier instructions. 'jalr.hb' and 'jr.hb' are hazard
barrier variants of the 'jalr' and 'jr' instructions respectively.

These instructions impede the execution of instruction stream until
architecturally defined hazards (changes to the instruction stream,
privileged registers which may affect execution) are cleared. These
instructions in MIPS' designs are not speculated past.

These instructions are used with the option -mindirect-jump=hazard
when branching indirectly and for indirect function calls.

These instructions are defined by the MIPS32R2 ISA, so this mitigation
method is not compatible with processors which implement an earlier
revision of the MIPS ISA.

Implementation note: I've opted to provide this as an
-mindirect-jump={hazard,...} style option in case alternative
mitigation methods are required for other implementations of the MIPS
ISA in future, e.g. retpoline style solutions.

Reviewers: atanasyan

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

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

7 years agoFix assert when template argument deduction's original call arg checking triggers...
Richard Smith [Tue, 20 Feb 2018 23:47:12 +0000 (23:47 +0000)]
Fix assert when template argument deduction's original call arg checking triggers class template instantiation.

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

7 years agoWhen multiple sanitizers are enabled (ubsan + something else), use all relevant black...
Richard Smith [Tue, 20 Feb 2018 23:17:41 +0000 (23:17 +0000)]
When multiple sanitizers are enabled (ubsan + something else), use all relevant blacklists.

Ideally, we'd only use the ubsan blacklist for ubsan sanitizers, and only use
the other-sanitizer blacklist for its sanitizers, but this at least enables the
intended suppressions.

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

7 years ago[NFC] In Multiversion Check function, switch to return Diag
Erich Keane [Tue, 20 Feb 2018 22:25:28 +0000 (22:25 +0000)]
[NFC] In Multiversion Check function, switch to return Diag

This function did a lot of 'Diag, return true' stuff.  This resulted in needing
to introduce scopes in quite a few places.  This patch replaces useages of a
single "S.Diag" followed by return true with simply "return S.Diag".

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

7 years ago[CUDA] Added missing __threadfence_system() function for CUDA9.
Artem Belevich [Tue, 20 Feb 2018 21:25:30 +0000 (21:25 +0000)]
[CUDA] Added missing __threadfence_system() function for CUDA9.

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

7 years agoCorrect multiversion unsupported target behavior, add a test.
Erich Keane [Tue, 20 Feb 2018 18:44:50 +0000 (18:44 +0000)]
Correct multiversion unsupported target behavior, add a test.

Multiversioning SEMA failed to set the declaration as invalid on unsupported
targets.  This patch does that.

Additionally, I noticed that there is no test to validate this error message.
This patch adds one, and uses 'mips' as the test architecture.

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

7 years agoPR36442: Correct description of -fsplit-dwarf-inlining
David Blaikie [Tue, 20 Feb 2018 16:35:08 +0000 (16:35 +0000)]
PR36442: Correct description of -fsplit-dwarf-inlining

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

7 years agoStop linking sanitized applications with -lutil and -lkvm on NetBSD
Kamil Rytarowski [Tue, 20 Feb 2018 16:27:28 +0000 (16:27 +0000)]
Stop linking sanitized applications with -lutil and -lkvm on NetBSD

The proper approach is to rebuild libutil and libkvm with a desired sanitizer.
An alternative approach to reimplement these functions (and other ones like
curses(3), editline(3) etc) does not scale and enforces linkage every single
binary with these libraries.

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

7 years agoRevert r325375 "[MS] Make constexpr static data members implicitly inline"
Hans Wennborg [Tue, 20 Feb 2018 12:43:02 +0000 (12:43 +0000)]
Revert r325375 "[MS] Make constexpr static data members implicitly inline"

This broke Clang bootstrap on Windows, PR36453.

> This handles them exactly the same way that we handle const integral
> static data members with inline definitions, which is what MSVC does.
>
> As a follow-up, now that we have a way to mark variables inline in the
> AST, we should consider marking them implicitly inline there instead of
> only treating them as inline in CodeGen. Unfortunately, this breaks a
> lot of dllimport test cases, so that is future work for now.
>
> Fixes PR36125.

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

7 years ago[CodeGen] Fix generation of TBAA tags for may-alias accesses
Ivan A. Kosarev [Tue, 20 Feb 2018 12:33:04 +0000 (12:33 +0000)]
[CodeGen] Fix generation of TBAA tags for may-alias accesses

This patch fixes creating TBAA access descriptors for
may_alias-marked access types. Currently, for such types we
generate ordinary descriptors with char as its access type. The
patch changes this to produce proper may-alias descriptors.

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

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

7 years agoclang-cl: Make /d1PP an alias for -dD (PR36446)
Hans Wennborg [Tue, 20 Feb 2018 10:47:14 +0000 (10:47 +0000)]
clang-cl: Make /d1PP an alias for -dD (PR36446)

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

7 years agoclang-format plugin: Add missing semicolon in list of file extensions (PR36383)
Hans Wennborg [Tue, 20 Feb 2018 09:26:38 +0000 (09:26 +0000)]
clang-format plugin: Add missing semicolon in list of file extensions (PR36383)

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

7 years ago[X86] Remove mask from 512 bit pmulhrsw/pmulhw/pmulhuw builtins.
Craig Topper [Tue, 20 Feb 2018 07:28:18 +0000 (07:28 +0000)]
[X86] Remove mask from 512 bit pmulhrsw/pmulhw/pmulhuw builtins.

We now use a vselect node in IR around an unmasked builtin. This makes it consistent with the 128 and 256 bit versions.

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

7 years ago[Sema] Fix -Wunused-variable
Sam McCall [Tue, 20 Feb 2018 07:21:56 +0000 (07:21 +0000)]
[Sema] Fix -Wunused-variable

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

7 years agoFix some -Wexceptions false positives.
Richard Smith [Tue, 20 Feb 2018 02:32:30 +0000 (02:32 +0000)]
Fix some -Wexceptions false positives.

Reimplement the "noexcept function actually throws" warning to properly handle
nested try-blocks. In passing, change 'throw;' handling to treat any enclosing
try block as being sufficient to suppress the warning rather than requiring a
'catch (...)'; the warning is intended to be conservatively-correct.

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

7 years ago[Sema] Fix some Clang-tidy modernize and Include What You Use warnings; other minor...
Eugene Zelenko [Tue, 20 Feb 2018 02:16:28 +0000 (02:16 +0000)]
[Sema] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

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

7 years agoFix test failure on target where size_t is long long.
Richard Smith [Mon, 19 Feb 2018 22:50:50 +0000 (22:50 +0000)]
Fix test failure on target where size_t is long long.

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

7 years agoAdd several more attributes to be parsed in C with [[]] when -fdouble-square-bracket...
Aaron Ballman [Mon, 19 Feb 2018 17:32:07 +0000 (17:32 +0000)]
Add several more attributes to be parsed in C with [[]] when -fdouble-square-bracket-attributes is specified.

Also flags a few attributes that should not be available with the C spelling as they only matter in C++.

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

7 years ago[clang-format] Fix text proto extension scope opening detection
Krasimir Georgiev [Mon, 19 Feb 2018 16:00:21 +0000 (16:00 +0000)]
[clang-format] Fix text proto extension scope opening detection

Summary:
This fixes the detection of scope openers in text proto extensions; previously
they were not detected correctly leading to instances like:
```
msg {
  [aa.bb
] {
key: value
}
}
```

Subscribers: klimek, cfe-commits

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

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

7 years ago[clang-format] Fixup a case of text proto message attributes
Krasimir Georgiev [Mon, 19 Feb 2018 15:31:25 +0000 (15:31 +0000)]
[clang-format] Fixup a case of text proto message attributes

Summary: This patch fixes a case where a proto message attribute is wrongly identified as an text proto extension.

Subscribers: klimek, cfe-commits

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

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

7 years ago[CodeComplete] Avoid name clashes of 'Kind' inside CodeCompletionContext. NFC
Ilya Biryukov [Mon, 19 Feb 2018 13:53:49 +0000 (13:53 +0000)]
[CodeComplete] Avoid name clashes of 'Kind' inside CodeCompletionContext. NFC

CodeCompletionContext had declarations of field and enum inside, both named 'Kind'.
It caused gcc 4.8 to give an incorrent warning when refering to enum as
`enum CodeCompletionContext::Kind`.

Avoid that warning by renaming the private field to CCKind.

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

7 years ago[ARM] disable FPU features when using soft floating point.
Keith Walker [Mon, 19 Feb 2018 12:40:26 +0000 (12:40 +0000)]
[ARM] disable FPU features when using soft floating point.

To be compatible with GCC if soft floating point is in effect any FPU
specified is effectively ignored, eg,

  -mfloat-abi=soft -fpu=neon

If any floating point features which require FPU hardware are enabled
they must be disable.

There was some support for doing this for NEON, but it did not handle
VFP, nor did it prevent the backend from emitting the build attribute
Tag_FP_arch describing the generated code as using the floating point
hardware if a FPU was specified (even though soft float does not use
the FPU).

Disabling the hardware floating point features for targets which are
compiling for soft float has meant that some tests which were incorrectly
checking for hardware support also needed to be updated. In such cases,
where appropriate the tests have been updated to check compiling for
soft float and a non-soft float variant (usually softfp). This was
usually because the target specified in the test defaulted to soft float.

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

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

7 years ago[CodeComplete] Add a helper to print CodeCompletionContext::Kind
Ilya Biryukov [Mon, 19 Feb 2018 12:35:33 +0000 (12:35 +0000)]
[CodeComplete] Add a helper to print CodeCompletionContext::Kind

Summary: Will be used in clangd. See D43377.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: ioeric, cfe-commits

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

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

7 years agoclang-format: [JS] fix `of` detection.
Martin Probst [Mon, 19 Feb 2018 12:32:13 +0000 (12:32 +0000)]
clang-format: [JS] fix `of` detection.

Summary:
`of` is only a keyword when after an identifier, but not when after
an actual keyword.

Before:
    return of (a, b, c);
After:
    return of(a, b, c);

Reviewers: djasper

Subscribers: cfe-commits, klimek

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

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