[PATCH] D44609: [Clang-Format] New option BeforeLambdaBody to manage lambda line break inside function parameter call (in Allman style)

2018-09-28 Thread Zhihao Yuan via Phabricator via cfe-commits
lichray added a comment.

In https://reviews.llvm.org/D44609#1059675, @Wawha wrote:

> In my case, the main requirement is to be able **avoid** a lambda in one line.


That doesn't work for me.  I would like short lambdas still be formatted in one 
line, when `AllowShortFunctionsOnASingleLine` or a new option is on.


Repository:
  rC Clang

https://reviews.llvm.org/D44609



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D52401: Remove redundant null pointer check in operator delete

2018-09-28 Thread Zhihao Yuan via Phabricator via cfe-commits
lichray reopened this revision.
lichray added a comment.
This revision is now accepted and ready to land.

LGTM as well, unless @mclow.lists can tell us some history like interactions 
with K libc :)


Repository:
  rL LLVM

https://reviews.llvm.org/D52401



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D51714: CMake: Deprecate using llvm-config to detect llvm installation

2018-09-28 Thread Tom Stellard via Phabricator via cfe-commits
tstellar added a comment.

In https://reviews.llvm.org/D51714#1248643, @smeenai wrote:

> Is there anything holding this up?


No hold up, I just wanted to address the review comment.  I'll commit on Monday 
if there are no other comments.


Repository:
  rC Clang

https://reviews.llvm.org/D51714



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D50403: [clang-format]AlignConsecutiveAssignments

2018-09-28 Thread Kristina Brooks via Phabricator via cfe-commits
kristina added subscribers: djasper, klimek, kristina.
kristina added a comment.

Please upload your diffs with full context (use `-U9` when doing the diff) 
and update them. I don't think there is a code owner for this part but @klimek 
and @djasper do most reviews to do with clang-format, so you may consider 
adding them as reviewers.


Repository:
  rC Clang

https://reviews.llvm.org/D50403



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D52673: [HIP] Remove disabled irif library

2018-09-28 Thread Kristina Brooks via Phabricator via cfe-commits
kristina added a comment.

If you don't mind, can you please do another revision with full context 
(`-U9`), makes it easier to review and makes it less likely that `svn 
patch` screws up.


Repository:
  rC Clang

https://reviews.llvm.org/D52673



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r343285 - [cxx2a] P0641R2: (Some) type mismatches on defaulted functions only

2018-09-28 Thread Vitaly Buka via cfe-commits
https://reviews.llvm.org/rL343369

On Fri, Sep 28, 2018 at 4:51 PM Galina Kistanova via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Hello Richard,
>
> This commit broke couple of our builders:
>
> http://lab.llvm.org:8011/builders/clang-with-thin-lto-ubuntu/builds/12924
> http://lab.llvm.org:8011/builders/clang-with-lto-ubuntu/builds/10475
> . . .
> FAILED:
> lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/DataFlowSanitizer.cpp.o
>
> /home/buildslave/ps4-buildslave1/clang-with-thin-lto-ubuntu/install/stage1/bin/clang++
> -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS
> -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
> -Ilib/Transforms/Instrumentation
> -I/home/buildslave/ps4-buildslave1/clang-with-thin-lto-ubuntu/llvm.src/lib/Transforms/Instrumentation
> -Iinclude
> -I/home/buildslave/ps4-buildslave1/clang-with-thin-lto-ubuntu/llvm.src/include
> -fPIC -fvisibility-inlines-hidden -Werror -Werror=date-time
> -Werror=unguarded-availability-new -std=c++11 -Wall -Wextra
> -Wno-unused-parameter -Wwrite-strings -Wcast-qual
> -Wmissing-field-initializers -pedantic -Wno-long-long
> -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor
> -Wdelete-non-virtual-dtor -Wstring-conversion -fdiagnostics-color
> -ffunction-sections -fdata-sections -O3-UNDEBUG  -fno-exceptions
> -fno-rtti -MD -MT
> lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/DataFlowSanitizer.cpp.o
> -MF
> lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/DataFlowSanitizer.cpp.o.d
> -o
> lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/DataFlowSanitizer.cpp.o
> -c
> /home/buildslave/ps4-buildslave1/clang-with-thin-lto-ubuntu/llvm.src/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
> /home/buildslave/ps4-buildslave1/clang-with-thin-lto-ubuntu/llvm.src/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp:231:24:
> error: explicitly defaulted move assignment operator is implicitly deleted
> [-Werror,-Wdefaulted-function-deleted]
>   TransformedFunction& operator=(TransformedFunction&&) = default;
>^
> /home/buildslave/ps4-buildslave1/clang-with-thin-lto-ubuntu/llvm.src/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp:234:23:
> note: move assignment operator of 'TransformedFunction' is implicitly
> deleted because field 'OriginalType' is of const-qualified type
> 'llvm::FunctionType *const'
>   FunctionType* const OriginalType;
>   ^
> 1 error generated.
>
> Please have a look?
>
> Thanks
>
> Galina
>
> On Thu, Sep 27, 2018 at 6:18 PM Richard Smith via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> Author: rsmith
>> Date: Thu Sep 27 18:16:43 2018
>> New Revision: 343285
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=343285=rev
>> Log:
>> [cxx2a] P0641R2: (Some) type mismatches on defaulted functions only
>> render the function deleted instead of rendering the program ill-formed.
>>
>> This change also adds an enabled-by-default warning for the case where
>> an explicitly-defaulted special member function of a non-template class
>> is implicitly deleted by the type checking rules. (This fires either due
>> to this language change or due to pre-C++20 reasons for the member being
>> implicitly deleted). I've tested this on a large codebase and found only
>> bugs (where the program means something that's clearly different from
>> what the programmer intended), so this is enabled by default, but we
>> should revisit this if there are problems with this being enabled by
>> default.
>>
>> Modified:
>> cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
>> cfe/trunk/lib/Sema/SemaDeclCXX.cpp
>> cfe/trunk/test/CXX/class.derived/class.abstract/p16.cpp
>> cfe/trunk/test/CXX/dcl.decl/dcl.fct.def/dcl.fct.def.default/p1.cpp
>> cfe/trunk/test/CXX/drs/dr6xx.cpp
>> cfe/trunk/test/CXX/special/class.copy/p12-0x.cpp
>> cfe/trunk/test/CXX/special/class.copy/p23-cxx11.cpp
>> cfe/trunk/test/CXX/special/class.ctor/p5-0x.cpp
>> cfe/trunk/test/CXX/special/class.dtor/p5-0x.cpp
>> cfe/trunk/test/SemaCUDA/implicit-member-target.cu
>> cfe/trunk/test/SemaCXX/cxx0x-deleted-default-ctor.cpp
>> cfe/trunk/test/SemaCXX/cxx17-compat.cpp
>> cfe/trunk/test/SemaCXX/dr1301.cpp
>> cfe/trunk/test/SemaCXX/microsoft-dtor-lookup-cxx11.cpp
>> cfe/trunk/test/SemaTemplate/exception-spec-crash.cpp
>> cfe/trunk/www/cxx_status.html
>>
>> Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=343285=343284=343285=diff
>>
>> ==
>> --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
>> +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Thu Sep 27
>> 18:16:43 2018
>> @@ -7760,9 +7760,19 @@ def err_incorrect_defaulted_exception_sp
>>  def err_incorrect_defaulted_constexpr : 

r343369 - [cxx2a] Fix warning triggered by r343285

2018-09-28 Thread Vitaly Buka via cfe-commits
Author: vitalybuka
Date: Fri Sep 28 19:17:12 2018
New Revision: 343369

URL: http://llvm.org/viewvc/llvm-project?rev=343369=rev
Log:
[cxx2a] Fix warning triggered by r343285

Modified:
cfe/trunk/include/clang/AST/DeclBase.h

Modified: cfe/trunk/include/clang/AST/DeclBase.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclBase.h?rev=343369=343368=343369=diff
==
--- cfe/trunk/include/clang/AST/DeclBase.h (original)
+++ cfe/trunk/include/clang/AST/DeclBase.h Fri Sep 28 19:17:12 2018
@@ -1212,7 +1212,6 @@ public:
 value_type SingleElement;
 
   public:
-iterator() = default;
 explicit iterator(pointer Pos, value_type Single = nullptr)
 : IteratorBase(Pos), SingleElement(Single) {}
 


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] r343369 - [cxx2a] Fix warning triggered by r343285

2018-09-28 Thread Vitaly Buka via cfe-commits
Author: vitalybuka
Date: Fri Sep 28 19:17:12 2018
New Revision: 343369

URL: http://llvm.org/viewvc/llvm-project?rev=343369=rev
Log:
[cxx2a] Fix warning triggered by r343285

Modified:
clang-tools-extra/trunk/clang-doc/BitcodeWriter.h

Modified: clang-tools-extra/trunk/clang-doc/BitcodeWriter.h
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-doc/BitcodeWriter.h?rev=343369=343368=343369=diff
==
--- clang-tools-extra/trunk/clang-doc/BitcodeWriter.h (original)
+++ clang-tools-extra/trunk/clang-doc/BitcodeWriter.h Fri Sep 28 19:17:12 2018
@@ -169,7 +169,6 @@ private:
   Stream.EnterSubblock(ID, BitCodeConstants::SubblockIDSize);
 }
 
-StreamSubBlockGuard() = default;
 StreamSubBlockGuard(const StreamSubBlockGuard &) = delete;
 StreamSubBlockGuard =(const StreamSubBlockGuard &) = delete;
 


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D52660: [CMake][Fuchsia] Use libc++ ABIv2 for Fuchsia toolchain

2018-09-28 Thread Kristina Brooks via Phabricator via cfe-commits
kristina added a comment.

My misunderstanding then, I was eventually hoping for a feature freeze of ABIv2 
to a point where it's considered stable so any alterations to things like 
internal layout of std::string (ie. like SBO that came with ABIv2) happen in 
`unstable/std::__3` as this allows for major ABI breaking changes to slowly 
start integrating into various other downstream projects. If it remains 
unstable then there is more hesitation when it comes to vendors switching ABIs; 
perhaps in a major OS release, while still providing ABIv1 libraries for 
compatibility. I'm not really involved in libc++ evolution but it seems logical 
that adoption of ABIv2 should begin somewhere (even if Fuchisa remains on 
unstable for the time being) since it does bring notable benefits.

In https://reviews.llvm.org/D52660#1249761, @ldionne wrote:

> I don't think we've ever had plans to freeze the ABI v2 into something stable 
> -- this is the first time I hear about it. I'm not saying it does not make 
> sense, by the way, just that I haven't heard any plans about this. Does 
> Fuchsia have a desire to stabilize the ABI of libc++?


Well as I said, I have no say in how C++ language or standards or libc++(abi) 
evolve, but it seems to be the next logical step (though perhaps it could wait 
until Clang 8 and C++20 since that may require breaking changes which make 
sense to do within ABIv2 while it's still unstable). Otherwise aside from 
unreleased operating systems, having it formalized may encourage downstream 
vendors, especially Linux based ones, where fragmentation is normal to slowly 
begin adopting it.

Anyway, sorry for straying offtopic, patch itself LG.


Repository:
  rC Clang

https://reviews.llvm.org/D52660



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D52675: [clang] Properly apply attributes on explicit instantiations of static data members

2018-09-28 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

This seems reasonable to me, but I'd feel most comfortable if @rsmith also 
signed off on it.


Repository:
  rC Clang

https://reviews.llvm.org/D52675



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Buildbot numbers for the week of 9/16/2018 - 9/22/2018

2018-09-28 Thread Galina Kistanova via cfe-commits
Hello everyone,

Below are some buildbot numbers for the last week of 9/16/2018 - 9/22/2018.

Please see the same data in attached csv files:

The longest time each builder was red during the week;
"Status change ratio" by active builder (percent of builds that changed the
builder status from greed to red or from red to green);
Count of commits by project;
Number of completed builds, failed builds and average build time for
successful builds per active builder;
Average waiting time for a revision to get build result per active builder
(response time).

Thanks

Galina


The longest time each builder was red during the week:
  buildername  | was_red
---+-
 clang-x64-ninja-win7  | 98:02:14
 clang-x86_64-debian-fast  | 70:23:36
 clang-cmake-armv7-global-isel | 58:47:49
 clang-cmake-armv7-quick   | 56:10:38
 clang-cmake-armv7-selfhost| 55:09:35
 clang-cmake-armv7-selfhost-neon   | 55:09:34
 clang-cmake-x86_64-avx2-linux | 26:39:49
 clang-cmake-x86_64-sde-avx512-linux   | 25:41:32
 sanitizer-x86_64-linux| 22:13:03
 clang-x86_64-linux-selfhost-modules   | 22:08:12
 sanitizer-ppc64le-linux   | 22:01:01
 libcxx-libcxxabi-libunwind-x86_64-linux-debian| 20:54:22
 clang-lld-x86_64-2stage   | 16:37:25
 clang-cmake-aarch64-full  | 15:17:37
 clang-with-lto-ubuntu | 08:48:30
 libcxx-libcxxabi-libunwind-aarch64-linux-noexceptions | 07:27:07
 libcxx-libcxxabi-libunwind-armv7-linux-noexceptions   | 07:26:54
 libcxx-libcxxabi-libunwind-armv7-linux| 07:26:51
 libcxx-libcxxabi-libunwind-armv8-linux| 07:26:45
 libcxx-libcxxabi-libunwind-aarch64-linux  | 07:26:12
 libcxx-libcxxabi-libunwind-armv8-linux-noexceptions   | 07:25:30
 clang-cmake-thumbv7-full-sh   | 07:04:34
 clang-with-thin-lto-ubuntu| 07:01:29
 sanitizer-x86_64-linux-fast   | 06:54:37
 llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast  | 06:44:20
 clang-cmake-armv8-selfhost-neon   | 06:41:13
 clang-ppc64le-linux-multistage| 06:32:38
 llvm-clang-x86_64-expensive-checks-win| 06:21:12
 clang-x86-windows-msvc2015| 06:20:49
 sanitizer-x86_64-linux-bootstrap  | 05:49:19
 libcxx-libcxxabi-x86_64-linux-ubuntu-gcc49-cxx11  | 05:44:30
 libcxx-libcxxabi-x86_64-linux-ubuntu-cxx14| 05:40:15
 libcxx-libcxxabi-x86_64-linux-ubuntu-cxx11| 05:39:57
 libcxx-libcxxabi-x86_64-linux-ubuntu-cxx17| 05:38:14
 libcxx-libcxxabi-x86_64-linux-ubuntu-cxx2a| 05:38:12
 lld-x86_64-freebsd| 05:03:38
 lld-x86_64-darwin13   | 05:03:37
 clang-cuda-build  | 04:58:55
 sanitizer-x86_64-linux-bootstrap-msan | 04:46:18
 clang-ppc64le-linux-lnt   | 04:36:58
 clang-ppc64be-linux-multistage| 04:32:03
 clang-s390x-linux-lnt | 04:27:17
 llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast| 04:24:26
 clang-ppc64le-linux   | 04:18:00
 clang-s390x-linux-multistage  | 04:17:37
 lld-perf-testsuite| 04:13:58
 clang-s390x-linux | 04:12:05
 clang-ppc64be-linux   | 04:11:15
 sanitizer-x86_64-linux-bootstrap-ubsan| 04:10:57
 clang-ppc64be-linux-lnt   | 04:08:02
 sanitizer-ppc64be-linux   | 03:54:48
 clang-cmake-armv7-full| 03:52:27
 clang-cmake-armv8-global-isel | 03:38:56
 polly-amd64-linux | 03:23:47
 clang-cmake-aarch64-global-isel   | 03:09:35
 lldb-amd64-ninja-netbsd8  | 03:03:42
 clang-cmake-armv8-quick   | 03:02:57
 clang-cmake-armv8-full| 03:01:52
 clang-cmake-aarch64-quick | 02:21:31
 clang-cmake-x86_64-avx2-linux-perf| 02:19:10
 libcxx-libcxxabi-x86_64-linux-ubuntu-cxx03| 02:12:13
 clang-cmake-armv7-lnt | 01:55:55
 lldb-x86_64-ubuntu-14.04-buildserver  | 01:43:34
 clang-x86_64-linux-abi-test   | 01:23:54
 

Buildbot numbers for the week of 9/09/2018 - 9/15/2018

2018-09-28 Thread Galina Kistanova via cfe-commits
Hello everyone,

Below are some buildbot numbers for the week of 9/09/2018 - 9/15/2018.

Please see the same data in attached csv files:

The longest time each builder was red during the week;
"Status change ratio" by active builder (percent of builds that changed the
builder status from greed to red or from red to green);
Count of commits by project;
Number of completed builds, failed builds and average build time for
successful builds per active builder;
Average waiting time for a revision to get build result per active builder
(response time).

Thanks

Galina


The longest time each builder was red during the week:
 buildername | was_red
-+-
 clang-x86-windows-msvc2015  | 63:34:16
 reverse-iteration   | 59:50:16
 polly-amd64-linux   | 59:40:26
 clang-x64-ninja-win7| 59:25:27
 polly-arm-linux | 59:22:49
 libcxx-libcxxabi-x86_64-linux-debian-noexceptions   | 55:00:10
 aosp-O3-polly-before-vectorizer-unprofitable| 48:00:39
 clang-x86_64-linux-selfhost-modules | 22:18:00
 clang-cmake-aarch64-full| 21:43:14
 lld-x86_64-darwin13 | 16:45:19
 clang-lld-x86_64-2stage | 12:29:15
 clang-cmake-armv8-selfhost-neon | 10:21:33
 clang-cmake-thumbv8-full-sh | 09:30:04
 clang-cmake-thumbv7-full-sh | 08:52:10
 clang-ppc64le-linux-multistage  | 08:15:49
 sanitizer-x86_64-linux-bootstrap| 07:35:09
 clang-with-lto-ubuntu   | 07:25:58
 llvm-clang-x86_64-expensive-checks-win  | 07:05:17
 clang-with-thin-lto-ubuntu  | 06:55:52
 sanitizer-x86_64-linux-bootstrap-ubsan  | 06:54:46
 clang-x86_64-linux-abi-test | 06:36:31
 clang-cmake-armv8-quick | 06:23:59
 clang-cmake-armv8-full  | 06:03:55
 lldb-amd64-ninja-netbsd8| 05:58:16
 clang-cmake-x86_64-avx2-linux   | 05:07:25
 openmp-clang-x86_64-linux-debian| 04:58:49
 clang-x86_64-debian-fast| 04:58:39
 clang-cmake-armv8-global-isel   | 04:58:12
 clang-cmake-aarch64-quick   | 04:48:28
 clang-cuda-build| 04:42:19
 sanitizer-x86_64-linux-fast | 04:32:32
 sanitizer-x86_64-linux-autoconf | 04:31:27
 llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast  | 04:25:03
 clang-cmake-armv7-full  | 04:24:48
 clang-cmake-aarch64-global-isel | 04:24:16
 libcxx-libcxxabi-libunwind-armv8-linux  | 04:19:08
 lld-x86_64-freebsd  | 04:19:02
 clang-ppc64be-linux-multistage  | 04:17:06
 clang-cmake-x86_64-sde-avx512-linux | 03:57:19
 sanitizer-x86_64-linux-bootstrap-msan   | 03:46:03
 clang-cmake-x86_64-avx2-linux-perf  | 03:44:50
 clang-ppc64be-linux | 03:42:44
 clang-ppc64be-linux-lnt | 03:42:24
 clang-ppc64le-linux-lnt | 03:40:28
 llvm-hexagon-elf| 03:38:01
 clang-hexagon-elf   | 03:32:09
 clang-ppc64le-linux | 03:09:03
 llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast| 03:07:37
 sanitizer-ppc64be-linux | 02:58:07
 sanitizer-ppc64le-linux | 02:44:50
 sanitizer-x86_64-linux-fuzzer   | 02:42:28
 clang-s390x-linux-multistage| 02:30:39
 lldb-x86-windows-msvc2015   | 02:10:15
 libcxx-libcxxabi-libunwind-armv7-linux-noexceptions | 02:00:50
 clang-cmake-armv7-lnt   | 01:46:15
 clang-cmake-armv8-lnt   | 01:43:58
 sanitizer-x86_64-linux  | 01:33:59
 lld-perf-testsuite  | 01:27:05
 lldb-x86_64-ubuntu-14.04-buildserver| 01:17:01
 clang-s390x-linux-lnt   | 01:02:27
 clang-aarch64-linux-build-cache | 01:01:03
 clang-armv7-linux-build-cache   | 00:59:18
 sanitizer-x86_64-linux-android  | 00:50:51
 clang-s390x-linux   | 00:50:45
 lldb-amd64-ninja-freebsd11  | 00:50:06
 sanitizer-windows   | 00:35:44
(66 rows)


"Status 

[PATCH] D52675: [clang] Properly apply attributes on explicit instantiations of static data members

2018-09-28 Thread Erik Pilkington via Phabricator via cfe-commits
erik.pilkington added reviewers: rsmith, rjmccall.
erik.pilkington added a comment.

Add some reviewers.


Repository:
  rC Clang

https://reviews.llvm.org/D52675



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D52660: [CMake][Fuchsia] Use libc++ ABIv2 for Fuchsia toolchain

2018-09-28 Thread Jake Ehrlich via cfe-commits
We have no such desire. I think we're fine being the test subjects for
ABIv2 however.

On Fri, Sep 28, 2018, 4:51 PM Louis Dionne via Phabricator <
revi...@reviews.llvm.org> wrote:

> ldionne added a comment.
>
> In https://reviews.llvm.org/D52660#1249709, @kristina wrote:
>
> > LGTM. Can we formalize ABIv2 as stable and make it distinct from
> unstable (soon to be ABIv3) or are there are any rough corners still left
> before ABIv2 and unstable can split in a feature freeze? I'm not an expert
> on libc++ related matters but @ldionne suggested that ABIv2 still wasn't
> ready on IRC (unless I misunderstood him).
>
>
> I don't think we've ever had plans to freeze the ABI v2 into something
> stable -- this is the first time I hear about it. I'm not saying it does
> not make sense, by the way, just that I haven't heard any plans about this.
> Does Fuchsia have a desire to stabilize the ABI of libc++?
>
>
> Repository:
>   rC Clang
>
> https://reviews.llvm.org/D52660
>
>
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D52660: [CMake][Fuchsia] Use libc++ ABIv2 for Fuchsia toolchain

2018-09-28 Thread Louis Dionne via Phabricator via cfe-commits
ldionne added a comment.

In https://reviews.llvm.org/D52660#1249709, @kristina wrote:

> LGTM. Can we formalize ABIv2 as stable and make it distinct from unstable 
> (soon to be ABIv3) or are there are any rough corners still left before ABIv2 
> and unstable can split in a feature freeze? I'm not an expert on libc++ 
> related matters but @ldionne suggested that ABIv2 still wasn't ready on IRC 
> (unless I misunderstood him).


I don't think we've ever had plans to freeze the ABI v2 into something stable 
-- this is the first time I hear about it. I'm not saying it does not make 
sense, by the way, just that I haven't heard any plans about this. Does Fuchsia 
have a desire to stabilize the ABI of libc++?


Repository:
  rC Clang

https://reviews.llvm.org/D52660



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r343285 - [cxx2a] P0641R2: (Some) type mismatches on defaulted functions only

2018-09-28 Thread Galina Kistanova via cfe-commits
Hello Richard,

This commit broke couple of our builders:

http://lab.llvm.org:8011/builders/clang-with-thin-lto-ubuntu/builds/12924
http://lab.llvm.org:8011/builders/clang-with-lto-ubuntu/builds/10475
. . .
FAILED:
lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/DataFlowSanitizer.cpp.o

/home/buildslave/ps4-buildslave1/clang-with-thin-lto-ubuntu/install/stage1/bin/clang++
-DGTEST_HAS_RTTI=0 -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS
-D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
-Ilib/Transforms/Instrumentation
-I/home/buildslave/ps4-buildslave1/clang-with-thin-lto-ubuntu/llvm.src/lib/Transforms/Instrumentation
-Iinclude
-I/home/buildslave/ps4-buildslave1/clang-with-thin-lto-ubuntu/llvm.src/include
-fPIC -fvisibility-inlines-hidden -Werror -Werror=date-time
-Werror=unguarded-availability-new -std=c++11 -Wall -Wextra
-Wno-unused-parameter -Wwrite-strings -Wcast-qual
-Wmissing-field-initializers -pedantic -Wno-long-long
-Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor
-Wdelete-non-virtual-dtor -Wstring-conversion -fdiagnostics-color
-ffunction-sections -fdata-sections -O3-UNDEBUG  -fno-exceptions
-fno-rtti -MD -MT
lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/DataFlowSanitizer.cpp.o
-MF
lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/DataFlowSanitizer.cpp.o.d
-o
lib/Transforms/Instrumentation/CMakeFiles/LLVMInstrumentation.dir/DataFlowSanitizer.cpp.o
-c
/home/buildslave/ps4-buildslave1/clang-with-thin-lto-ubuntu/llvm.src/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
/home/buildslave/ps4-buildslave1/clang-with-thin-lto-ubuntu/llvm.src/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp:231:24:
error: explicitly defaulted move assignment operator is implicitly deleted
[-Werror,-Wdefaulted-function-deleted]
  TransformedFunction& operator=(TransformedFunction&&) = default;
   ^
/home/buildslave/ps4-buildslave1/clang-with-thin-lto-ubuntu/llvm.src/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp:234:23:
note: move assignment operator of 'TransformedFunction' is implicitly
deleted because field 'OriginalType' is of const-qualified type
'llvm::FunctionType *const'
  FunctionType* const OriginalType;
  ^
1 error generated.

Please have a look?

Thanks

Galina

On Thu, Sep 27, 2018 at 6:18 PM Richard Smith via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: rsmith
> Date: Thu Sep 27 18:16:43 2018
> New Revision: 343285
>
> URL: http://llvm.org/viewvc/llvm-project?rev=343285=rev
> Log:
> [cxx2a] P0641R2: (Some) type mismatches on defaulted functions only
> render the function deleted instead of rendering the program ill-formed.
>
> This change also adds an enabled-by-default warning for the case where
> an explicitly-defaulted special member function of a non-template class
> is implicitly deleted by the type checking rules. (This fires either due
> to this language change or due to pre-C++20 reasons for the member being
> implicitly deleted). I've tested this on a large codebase and found only
> bugs (where the program means something that's clearly different from
> what the programmer intended), so this is enabled by default, but we
> should revisit this if there are problems with this being enabled by
> default.
>
> Modified:
> cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
> cfe/trunk/lib/Sema/SemaDeclCXX.cpp
> cfe/trunk/test/CXX/class.derived/class.abstract/p16.cpp
> cfe/trunk/test/CXX/dcl.decl/dcl.fct.def/dcl.fct.def.default/p1.cpp
> cfe/trunk/test/CXX/drs/dr6xx.cpp
> cfe/trunk/test/CXX/special/class.copy/p12-0x.cpp
> cfe/trunk/test/CXX/special/class.copy/p23-cxx11.cpp
> cfe/trunk/test/CXX/special/class.ctor/p5-0x.cpp
> cfe/trunk/test/CXX/special/class.dtor/p5-0x.cpp
> cfe/trunk/test/SemaCUDA/implicit-member-target.cu
> cfe/trunk/test/SemaCXX/cxx0x-deleted-default-ctor.cpp
> cfe/trunk/test/SemaCXX/cxx17-compat.cpp
> cfe/trunk/test/SemaCXX/dr1301.cpp
> cfe/trunk/test/SemaCXX/microsoft-dtor-lookup-cxx11.cpp
> cfe/trunk/test/SemaTemplate/exception-spec-crash.cpp
> cfe/trunk/www/cxx_status.html
>
> Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=343285=343284=343285=diff
>
> ==
> --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
> +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Thu Sep 27
> 18:16:43 2018
> @@ -7760,9 +7760,19 @@ def err_incorrect_defaulted_exception_sp
>  def err_incorrect_defaulted_constexpr : Error<
>"defaulted definition of %sub{select_special_member_kind}0 "
>"is not constexpr">;
> +def warn_defaulted_method_deleted : Warning<
> +  "explicitly defaulted %sub{select_special_member_kind}0 is implicitly "
> +  "deleted">, InGroup>;
>  def 

[PATCH] D52248: [SEMA] ignore duplicate declaration specifiers from typeof exprs

2018-09-28 Thread Nick Desaulniers via Phabricator via cfe-commits
nickdesaulniers added inline comments.



Comment at: test/FixIt/fixit.c:50
-// CHECK: const typedef int int_t;
-const typedef typedef int int_t; // expected-warning {{duplicate 'typedef'}}
-

Ah, this was a case I should add one last test for.  I think reviewers can 
still start reviewing the rest.  This should just add one additional test case.


Repository:
  rC Clang

https://reviews.llvm.org/D52248



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D52248: [SEMA] ignore duplicate declaration specifiers from typeof exprs

2018-09-28 Thread Nick Desaulniers via Phabricator via cfe-commits
nickdesaulniers added a comment.

Ok, I think this is ready for rereview.




Comment at: test/Parser/atomic.c:5
 typedef _Atomic int atomic_int;
-typedef _Atomic _Atomic _Atomic(int) atomic_int; // expected-warning 
{{duplicate '_Atomic' declaration specifier}}
 

Note to reviewers: this deletion was intentional. It is not copied over to the 
new test file test/Sema/dupl-declspec.c because we now DONT want to warn for 
duplicates in C99+, and `_Atomic` was not available before C11.



Comment at: test/Sema/declspec.c:43
-volatile volatile int pr8264_2;  // expected-warning {{duplicate 'volatile' 
declaration specifier}}
-char * restrict restrict pr8264_3;  // expected-warning {{duplicate 'restrict' 
declaration specifier}}
-

Note to reviewers; this deletion was intentional.  It is not copied over to the 
new test file test/Sema/dupl-declspec.c with the rest of the PR8264 cases 
because we now DONT want to warn for duplicates in C99+, and `restrict` was not 
available before then (ie. C90).

The rest of these cases were moved to the new test file 
test/Sema/dupl-declspec.c and exhaustively tested against all current C 
standards.


Repository:
  rC Clang

https://reviews.llvm.org/D52248



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D52248: [SEMA] ignore duplicate declaration specifiers from typeof exprs

2018-09-28 Thread Nick Desaulniers via Phabricator via cfe-commits
nickdesaulniers updated this revision to Diff 167565.
nickdesaulniers added a comment.
Herald added a subscriber: jfb.

- split duplicate_declspec into Extension and Extwarn from Extwarn.
- rename ext_duplicate_declspec to be the Extension, not the Extwarn.
- Fix C++ case.
- Use tablegen'd Extension rather than checking Pedantic diag option.
- Update tests that started failing due to this change.
- Consolidate checks for duplicate declspecs into 1 file.
- Move cases for PR8264 into my added test case, extending them for various 
language standards.
- Update my tests/rename the new test file name.


Repository:
  rC Clang

https://reviews.llvm.org/D52248

Files:
  include/clang/Basic/DiagnosticSemaKinds.td
  lib/Parse/ParseDecl.cpp
  lib/Sema/DeclSpec.cpp
  lib/Sema/SemaType.cpp
  test/FixIt/fixit-eof-space.c
  test/FixIt/fixit.c
  test/Parser/atomic.c
  test/Sema/declspec.c
  test/Sema/dupl-declspec.c

Index: test/Sema/dupl-declspec.c
===
--- /dev/null
+++ test/Sema/dupl-declspec.c
@@ -0,0 +1,198 @@
+/*
+RUN: not %clang_cc1 %s -std=c89 -fsyntax-only 2>&1 | FileCheck -check-prefix=CHECK-C89 %s
+RUN: not %clang_cc1 %s -std=c89 -pedantic -fsyntax-only 2>&1 | FileCheck -check-prefix=CHECK-C89-PEDANTIC %s
+RUN: not %clang_cc1 %s -std=c99 -fsyntax-only 2>&1 | FileCheck -check-prefix=CHECK-C99 %s
+RUN: not %clang_cc1 %s -std=c99 -pedantic -fsyntax-only 2>&1 | FileCheck -check-prefix=CHECK-C99-PEDANTIC %s
+RUN: not %clang_cc1 %s -std=c11 -fsyntax-only 2>&1 | FileCheck -check-prefix=CHECK-C11 %s
+RUN: not %clang_cc1 %s -std=c11 -pedantic -fsyntax-only 2>&1 | FileCheck -check-prefix=CHECK-C11-PEDANTIC %s
+RUN: not %clang_cc1 %s -std=c17 -fsyntax-only 2>&1 | FileCheck -check-prefix=CHECK-C17 %s
+RUN: not %clang_cc1 %s -std=c17 -pedantic -fsyntax-only 2>&1 | FileCheck -check-prefix=CHECK-C17-PEDANTIC %s
+
+RUN: %clang_cc1 %s -std=gnu89 -fsyntax-only 2>&1 | FileCheck -check-prefix=CHECK-GNU89 -allow-empty %s
+RUN: %clang_cc1 %s -std=gnu89 -pedantic -fsyntax-only 2>&1 | FileCheck -check-prefix=CHECK-GNU89-PEDANTIC %s
+RUN: %clang_cc1 %s -std=gnu99 -fsyntax-only 2>&1 | FileCheck -check-prefix=CHECK-GNU99 -allow-empty %s
+RUN: %clang_cc1 %s -std=gnu99 -pedantic -fsyntax-only 2>&1 | FileCheck -check-prefix=CHECK-GNU99-PEDANTIC %s
+RUN: %clang_cc1 %s -std=gnu11 -fsyntax-only 2>&1 | FileCheck -check-prefix=CHECK-GNU11 -allow-empty %s
+RUN: %clang_cc1 %s -std=gnu11 -pedantic -fsyntax-only 2>&1 | FileCheck -check-prefix=CHECK-GNU11-PEDANTIC %s
+RUN: %clang_cc1 %s -std=gnu17 -fsyntax-only 2>&1 | FileCheck -check-prefix=CHECK-GNU17 -allow-empty %s
+RUN: %clang_cc1 %s -std=gnu17 -pedantic -fsyntax-only 2>&1 | FileCheck -check-prefix=CHECK-GNU17-PEDANTIC %s
+*/
+
+const const int pr8264_1;
+/*
+CHECK-C89-NOT: 21:7: warning: duplicate 'const' declaration specifier
+CHECK-C89-PEDANTIC: 21:7: warning: duplicate 'const' declaration specifier
+  ^ NOTE: special case
+CHECK-C99-NOT: 21:7: warning: duplicate 'const' declaration specifier
+CHECK-C99-PEDANTIC-NOT: 21:7: warning: duplicate 'const' declaration specifier
+CHECK-C11-NOT: 21:7: warning: duplicate 'const' declaration specifier
+CHECK-C11-PEDANTIC-NOT: 21:7: warning: duplicate 'const' declaration specifier
+CHECK-C17-NOT: 21:7: warning: duplicate 'const' declaration specifier
+CHECK-C17-PEDANTIC-NOT: 21:7: warning: duplicate 'const' declaration specifier
+
+CHECK-GNU89-NOT: 21:7: warning: duplicate 'const' declaration specifier
+CHECK-GNU89-PEDANTIC: 21:7: warning: duplicate 'const' declaration specifier
+^ NOTE: special case
+CHECK-GNU99-NOT: 21:7: warning: duplicate 'const' declaration specifier
+CHECK-GNU99-PEDANTIC-NOT: 21:7: warning: duplicate 'const' declaration specifier
+CHECK-GNU11-NOT: 21:7: warning: duplicate 'const' declaration specifier
+CHECK-GNU11-PEDANTIC-NOT: 21:7: warning: duplicate 'const' declaration specifier
+CHECK-GNU17-NOT: 21:7: warning: duplicate 'const' declaration specifier
+CHECK-GNU17-PEDANTIC-NOT: 21:7: warning: duplicate 'const' declaration specifier
+*/
+
+typedef const int t;
+const t c_i;
+/*
+CHECK-C89-NOT: 45:1: warning: duplicate 'const' declaration specifier
+CHECK-C89-PEDANTIC: 45:1: warning: duplicate 'const' declaration specifier
+  ^ NOTE: special case
+CHECK-C99-NOT: 45:1: warning: duplicate 'const' declaration specifier
+CHECK-C99-PEDANTIC-NOT: 45:1: warning: duplicate 'const' declaration specifier
+CHECK-C11-NOT: 45:1: warning: duplicate 'const' declaration specifier
+CHECK-C11-PEDANTIC-NOT: 45:1: warning: duplicate 'const' declaration specifier
+CHECK-C17-NOT: 45:1: warning: duplicate 'const' declaration specifier
+CHECK-C17-PEDANTIC-NOT: 45:1: warning: duplicate 'const' declaration specifier
+
+CHECK-GNU89-NOT: 45:1: warning: duplicate 'const' declaration specifier
+CHECK-GNU89-PEDANTIC: 45:1: warning: duplicate 'const' declaration specifier
+^ NOTE: special case
+CHECK-GNU99-NOT: 45:1: warning: duplicate 'const' declaration 

[PATCH] D52320: AMDGPU: add __builtin_amdgcn_update_dpp

2018-09-28 Thread Brian Sumner via Phabricator via cfe-commits
b-sumner added inline comments.



Comment at: lib/CodeGen/CGBuiltin.cpp:11313-11315
+  case AMDGPU::BI__builtin_amdgcn_update_dpp: {
+llvm::SmallVector Args;
+for (unsigned I = 0; I != 6; ++I)

arsenm wrote:
> The only difference between this and mov_dpp is the argument count and the 
> intrinsic ID, so you can combine the cases
We should really drop mov_dpp.  It will be easier to do so if we keep the cases 
separate. 


https://reviews.llvm.org/D52320



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D52660: [CMake][Fuchsia] Use libc++ ABIv2 for Fuchsia toolchain

2018-09-28 Thread Kristina Brooks via Phabricator via cfe-commits
kristina added a comment.

LGTM. Can we formalize ABIv2 as stable and make it distinct from unstable (soon 
to be ABIv3) or are there are any rough corners still left before ABIv2 and 
unstable can split in a feature freeze?


Repository:
  rC Clang

https://reviews.llvm.org/D52660



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D52674: [AST] Add Obj-C discriminator to MS ABI RTTI

2018-09-28 Thread Shoaib Meenai via Phabricator via cfe-commits
smeenai updated this revision to Diff 167555.
smeenai added a comment.

arc fail


Repository:
  rC Clang

https://reviews.llvm.org/D52674

Files:
  lib/AST/MicrosoftMangle.cpp
  test/CodeGenObjCXX/msabi-objc-exceptions-gnustep.mm


Index: test/CodeGenObjCXX/msabi-objc-exceptions-gnustep.mm
===
--- /dev/null
+++ test/CodeGenObjCXX/msabi-objc-exceptions-gnustep.mm
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 -triple i686-windows-msvc -fobjc-runtime=gnustep-2.0 
-fexceptions -fobjc-exceptions -emit-llvm -o - %s | FileCheck -check-prefix=X86 
%s
+// RUN: %clang_cc1 -triple x86_64-windows-msvc -fobjc-runtime=gnustep-2.0 
-fexceptions -fobjc-exceptions -emit-llvm -o - %s | FileCheck -check-prefix=X64 
%s
+
+// Ensure we have the .objc discriminator in the RTTI and the RTTI name.
+// X86-DAG: @"??_R0objc.PAUobjc_object@@@8" = linkonce_odr global %{{[^ ]+}} { 
i8** @"??_7type_info@@6B@", i8* null, [23 x i8] c".objc.PAUobjc_object@@\00" }, 
comdat
+// X64-DAG: @"??_R0objc.PEAUobjc_object@@@8" = linkonce_odr global %{{[^ ]+}} 
{ i8** @"??_7type_info@@6B@", i8* null, [24 x i8] c".objc.PEAUobjc_object@@\00" 
}, comdat
+
+@class I;
+// X86-DAG: @"??_R0objc.PAUI@@@8" = linkonce_odr global %{{[^ ]+}} { i8** 
@"??_7type_info@@6B@", i8* null, [13 x i8] c".objc.PAUI@@\00" }, comdat
+// X64-DAG: @"??_R0objc.PEAUI@@@8" = linkonce_odr global %{{[^ ]+}} { i8** 
@"??_7type_info@@6B@", i8* null, [14 x i8] c".objc.PEAUI@@\00" }, comdat
+
+void f();
+void g() {
+  @try {
+f();
+  } @catch (I *) {
+  } @catch (id) {
+  }
+}
Index: lib/AST/MicrosoftMangle.cpp
===
--- lib/AST/MicrosoftMangle.cpp
+++ lib/AST/MicrosoftMangle.cpp
@@ -3001,14 +3001,22 @@
   msvc_hashing_ostream MHO(Out);
   MicrosoftCXXNameMangler Mangler(*this, MHO);
   Mangler.getStream() << "??_R0";
+  // Obj-C classes are mangled as C++ structs with the same name, but we want 
to
+  // be able to distinguish a C++ struct X from an Obj-C class X for the
+  // purposes of exception handling, so we add a discriminator.
+  if (T->isObjCObjectPointerType())
+Mangler.getStream() << "objc.";
   Mangler.mangleType(T, SourceRange(), MicrosoftCXXNameMangler::QMM_Result);
   Mangler.getStream() << "@8";
 }
 
 void MicrosoftMangleContextImpl::mangleCXXRTTIName(QualType T,
raw_ostream ) {
   MicrosoftCXXNameMangler Mangler(*this, Out);
   Mangler.getStream() << '.';
+  // See the comment in MicrosoftMangleContextImpl::mangleCXXRTTI.
+  if (T->isObjCObjectPointerType())
+Mangler.getStream() << "objc.";
   Mangler.mangleType(T, SourceRange(), MicrosoftCXXNameMangler::QMM_Result);
 }
 


Index: test/CodeGenObjCXX/msabi-objc-exceptions-gnustep.mm
===
--- /dev/null
+++ test/CodeGenObjCXX/msabi-objc-exceptions-gnustep.mm
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 -triple i686-windows-msvc -fobjc-runtime=gnustep-2.0 -fexceptions -fobjc-exceptions -emit-llvm -o - %s | FileCheck -check-prefix=X86 %s
+// RUN: %clang_cc1 -triple x86_64-windows-msvc -fobjc-runtime=gnustep-2.0 -fexceptions -fobjc-exceptions -emit-llvm -o - %s | FileCheck -check-prefix=X64 %s
+
+// Ensure we have the .objc discriminator in the RTTI and the RTTI name.
+// X86-DAG: @"??_R0objc.PAUobjc_object@@@8" = linkonce_odr global %{{[^ ]+}} { i8** @"??_7type_info@@6B@", i8* null, [23 x i8] c".objc.PAUobjc_object@@\00" }, comdat
+// X64-DAG: @"??_R0objc.PEAUobjc_object@@@8" = linkonce_odr global %{{[^ ]+}} { i8** @"??_7type_info@@6B@", i8* null, [24 x i8] c".objc.PEAUobjc_object@@\00" }, comdat
+
+@class I;
+// X86-DAG: @"??_R0objc.PAUI@@@8" = linkonce_odr global %{{[^ ]+}} { i8** @"??_7type_info@@6B@", i8* null, [13 x i8] c".objc.PAUI@@\00" }, comdat
+// X64-DAG: @"??_R0objc.PEAUI@@@8" = linkonce_odr global %{{[^ ]+}} { i8** @"??_7type_info@@6B@", i8* null, [14 x i8] c".objc.PEAUI@@\00" }, comdat
+
+void f();
+void g() {
+  @try {
+f();
+  } @catch (I *) {
+  } @catch (id) {
+  }
+}
Index: lib/AST/MicrosoftMangle.cpp
===
--- lib/AST/MicrosoftMangle.cpp
+++ lib/AST/MicrosoftMangle.cpp
@@ -3001,14 +3001,22 @@
   msvc_hashing_ostream MHO(Out);
   MicrosoftCXXNameMangler Mangler(*this, MHO);
   Mangler.getStream() << "??_R0";
+  // Obj-C classes are mangled as C++ structs with the same name, but we want to
+  // be able to distinguish a C++ struct X from an Obj-C class X for the
+  // purposes of exception handling, so we add a discriminator.
+  if (T->isObjCObjectPointerType())
+Mangler.getStream() << "objc.";
   Mangler.mangleType(T, SourceRange(), MicrosoftCXXNameMangler::QMM_Result);
   Mangler.getStream() << "@8";
 }
 
 void MicrosoftMangleContextImpl::mangleCXXRTTIName(QualType T,
raw_ostream ) {
   MicrosoftCXXNameMangler Mangler(*this, Out);
   

[PATCH] D52581: [AST] Revert mangling changes from r339428

2018-09-28 Thread Shoaib Meenai via Phabricator via cfe-commits
smeenai added a comment.

https://reviews.llvm.org/D52674 adds the RTTI Obj-C discriminator. I put it up 
as a separate change so it could be reviewed independently and more thoroughly.


Repository:
  rC Clang

https://reviews.llvm.org/D52581



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D52674: [AST] Add Obj-C discriminator to MS ABI RTTI

2018-09-28 Thread Shoaib Meenai via Phabricator via cfe-commits
smeenai created this revision.
smeenai added reviewers: compnerd, DHowett-MSFT, rjmccall, rnk, theraven.
Herald added a subscriber: erik.pilkington.

Obj-C classes are mangled as C++ structs with the same name (in both the
Itanium and the Microsoft ABIs), but we want to be able to distinguish
them for the purposes of exception handling, so we need to add a
discriminator to the RTTI and the RTTI name.

The chosen discriminator (`.objc`) is fairly arbitrary, and I'm open to
other suggestions. It's also perhaps not ideal to have the discriminator
as a prefix, since then the RTTI won't demangle (RTTI names never
demangle anyway, so that's less of a concern). Having it infix would
make for a cleaner mangling, but it would also require keeping some
state around in the mangler to indicate when we're mangling for RTTI,
which seems like a much uglier implementation and not worth it.


Repository:
  rC Clang

https://reviews.llvm.org/D52674

Files:
  lib/AST/MicrosoftMangle.cpp
  test/CodeGenObjCXX/arc-marker-funclet.mm
  test/CodeGenObjCXX/microsoft-abi-arc-param-order.mm
  test/CodeGenObjCXX/msabi-objc-exceptions-gnustep.mm
  test/CodeGenObjCXX/msabi-objc-extensions.mm
  test/CodeGenObjCXX/msabi-objc-types.mm

Index: test/CodeGenObjCXX/msabi-objc-types.mm
===
--- test/CodeGenObjCXX/msabi-objc-types.mm
+++ test/CodeGenObjCXX/msabi-objc-types.mm
@@ -3,166 +3,166 @@
 @class I;
 
 id kid;
-// CHECK: @"?kid@@3PAU.objc_object@@A" =  dso_local global
+// CHECK: @"?kid@@3PAUobjc_object@@A" =  dso_local global
 
 Class klass;
-// CHECK: @"?klass@@3PAU.objc_class@@A" = dso_local global
+// CHECK: @"?klass@@3PAUobjc_class@@A" = dso_local global
 
 I *kI;
-// CHECK: @"?kI@@3PAU.objc_cls_I@@A" = dso_local global
+// CHECK: @"?kI@@3PAUI@@A" = dso_local global
 
 void f(I *) {}
-// CHECK-LABEL: "?f@@YAXPAU.objc_cls_I@@@Z"
+// CHECK-LABEL: "?f@@YAXPAUI@@@Z"
 
 void f(const I *) {}
-// CHECK-LABEL: "?f@@YAXPBU.objc_cls_I@@@Z"
+// CHECK-LABEL: "?f@@YAXPBUI@@@Z"
 
 void f(I &) {}
-// CHECK-LABEL: "?f@@YAXAAU.objc_cls_I@@@Z"
+// CHECK-LABEL: "?f@@YAXAAUI@@@Z"
 
 void f(const I &) {}
-// CHECK-LABEL: "?f@@YAXABU.objc_cls_I@@@Z"
+// CHECK-LABEL: "?f@@YAXABUI@@@Z"
 
 void f(const I &&) {}
-// CHECK-LABEL: "?f@@YAX$$QBU.objc_cls_I@@@Z"
+// CHECK-LABEL: "?f@@YAX$$QBUI@@@Z"
 
 void g(id) {}
-// CHECK-LABEL: "?g@@YAXPAU.objc_object@@@Z"
+// CHECK-LABEL: "?g@@YAXPAUobjc_object@@@Z"
 
 void g(id &) {}
-// CHECK-LABEL: "?g@@YAXAAPAU.objc_object@@@Z"
+// CHECK-LABEL: "?g@@YAXAAPAUobjc_object@@@Z"
 
 void g(const id &) {}
-// CHECK-LABEL: "?g@@YAXABQAU.objc_object@@@Z"
+// CHECK-LABEL: "?g@@YAXABQAUobjc_object@@@Z"
 
 void g(id &&) {}
-// CHECK-LABEL: "?g@@YAX$$QAPAU.objc_object@@@Z"
+// CHECK-LABEL: "?g@@YAX$$QAPAUobjc_object@@@Z"
 
 void h(Class) {}
-// CHECK-LABEL: "?h@@YAXPAU.objc_class@@@Z"
+// CHECK-LABEL: "?h@@YAXPAUobjc_class@@@Z"
 
 void h(Class &) {}
-// CHECK-LABEL: "?h@@YAXAAPAU.objc_class@@@Z"
+// CHECK-LABEL: "?h@@YAXAAPAUobjc_class@@@Z"
 
 void h(const Class &) {}
-// CHECK-LABEL: "?h@@YAXABQAU.objc_class@@@Z"
+// CHECK-LABEL: "?h@@YAXABQAUobjc_class@@@Z"
 
 void h(Class &&) {}
-// CHECK-LABEL: "?h@@YAX$$QAPAU.objc_class@@@Z"
+// CHECK-LABEL: "?h@@YAX$$QAPAUobjc_class@@@Z"
 
 I *i() { return nullptr; }
-// CHECK-LABEL: "?i@@YAPAU.objc_cls_I@@XZ"
+// CHECK-LABEL: "?i@@YAPAUI@@XZ"
 
 const I *j() { return nullptr; }
-// CHECK-LABEL: "?j@@YAPBU.objc_cls_I@@XZ"
+// CHECK-LABEL: "?j@@YAPBUI@@XZ"
 
 I () { return *kI; }
-// CHECK-LABEL: "?k@@YAAAU.objc_cls_I@@XZ"
+// CHECK-LABEL: "?k@@YAAAUI@@XZ"
 
 const I () { return *kI; }
-// CHECK-LABEL: "?l@@YAABU.objc_cls_I@@XZ"
+// CHECK-LABEL: "?l@@YAABUI@@XZ"
 
 void m(const id) {}
-// CHECK-LABEL: "?m@@YAXQAU.objc_object@@@Z"
+// CHECK-LABEL: "?m@@YAXQAUobjc_object@@@Z"
 
 void m(const I *) {}
-// CHECK-LABEL: "?m@@YAXPBU.objc_cls_I@@@Z"
+// CHECK-LABEL: "?m@@YAXPBUI@@@Z"
 
 void n(SEL) {}
-// CHECK-LABEL: "?n@@YAXPAU.objc_selector@@@Z"
+// CHECK-LABEL: "?n@@YAXPAUobjc_selector@@@Z"
 
 void n(SEL *) {}
-// CHECK-LABEL: "?n@@YAXPAPAU.objc_selector@@@Z"
+// CHECK-LABEL: "?n@@YAXPAPAUobjc_selector@@@Z"
 
 void n(const SEL *) {}
-// CHECK-LABEL: "?n@@YAXPBQAU.objc_selector@@@Z"
+// CHECK-LABEL: "?n@@YAXPBQAUobjc_selector@@@Z"
 
 void n(SEL &) {}
-// CHECK-LABEL: "?n@@YAXAAPAU.objc_selector@@@Z"
+// CHECK-LABEL: "?n@@YAXAAPAUobjc_selector@@@Z"
 
 void n(const SEL &) {}
-// CHECK-LABEL: "?n@@YAXABQAU.objc_selector@@@Z"
+// CHECK-LABEL: "?n@@YAXABQAUobjc_selector@@@Z"
 
 void n(SEL &&) {}
-// CHECK-LABEL: "?n@@YAX$$QAPAU.objc_selector@@@Z"
+// CHECK-LABEL: "?n@@YAX$$QAPAUobjc_selector@@@Z"
 
 struct __declspec(dllexport) s {
   struct s =(const struct s &) = delete;
 
   void m(I *) {}
-  // CHECK-LABEL: "?m@s@@QAAXPAU.objc_cls_I@@@Z"
+  // CHECK-LABEL: "?m@s@@QAAXPAUI@@@Z"
 
   void m(const I *) {}
-  // CHECK-LABEL: "?m@s@@QAAXPBU.objc_cls_I@@@Z"
+  // CHECK-LABEL: "?m@s@@QAAXPBUI@@@Z"
 
   void m(I &) {}
-  // CHECK-LABEL: 

[PATCH] D52334: [clang-tidy] Build it even without static analyzer

2018-09-28 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

I think that we need some sort of developer documentation change that explains 
1) that this option exists when configuring clang-tidy, and 2) that this 
impacts the MPI module as well as the static analyzer.




Comment at: clang-tidy/CMakeLists.txt:29
+if(CLANG_ENABLE_STATIC_ANALYZER)
+target_link_libraries(clangTidy PRIVATE
+  clangStaticAnalyzerCore

Indentation looks off here, same below.



Comment at: clang-tidy/ClangTidy.cpp:93
 };
+#endif
 

Please add comments to the end of the endif so that it's easier to know what 
the guarding condition is. Same elsewhere.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D52334



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D52670: [clang-tidy] Add new 'readability-uppercase-literal-suffix' check (CERT DCL16-C, MISRA C:2012, 7.3, MISRA C++:2008, 2-13-4)

2018-09-28 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri updated this revision to Diff 167552.
lebedev.ri added a comment.

- Deduplicate one test.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D52670

Files:
  clang-tidy/cert/CERTTidyModule.cpp
  clang-tidy/cert/CMakeLists.txt
  clang-tidy/readability/CMakeLists.txt
  clang-tidy/readability/MagicNumbersCheck.cpp
  clang-tidy/readability/MagicNumbersCheck.h
  clang-tidy/readability/ReadabilityTidyModule.cpp
  clang-tidy/readability/UppercaseLiteralSuffixCheck.cpp
  clang-tidy/readability/UppercaseLiteralSuffixCheck.h
  clang-tidy/utils/ASTUtils.cpp
  clang-tidy/utils/ASTUtils.h
  docs/ReleaseNotes.rst
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/readability-uppercase-literal-suffix.rst
  test/clang-tidy/readability-uppercase-literal-suffix-floating-point.cpp
  
test/clang-tidy/readability-uppercase-literal-suffix-hexadecimal-floating-point.cpp
  test/clang-tidy/readability-uppercase-literal-suffix-integer.cpp

Index: test/clang-tidy/readability-uppercase-literal-suffix-integer.cpp
===
--- /dev/null
+++ test/clang-tidy/readability-uppercase-literal-suffix-integer.cpp
@@ -0,0 +1,218 @@
+// RUN: %check_clang_tidy %s readability-uppercase-literal-suffix %t
+// RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp
+// RUN: clang-tidy %t.cpp -checks='-*,readability-uppercase-literal-suffix' -fix
+// RUN: clang-tidy %t.cpp -checks='-*,readability-uppercase-literal-suffix' -warnings-as-errors='-*,readability-uppercase-literal-suffix'
+
+template 
+struct integral_constant {
+  static constexpr T value = v;
+  typedef T value_type;
+  typedef integral_constant type; // using injected-class-name
+  constexpr operator value_type() const noexcept { return value; }
+};
+
+using false_type = integral_constant;
+using true_type = integral_constant;
+
+template 
+struct is_same : false_type {};
+
+template 
+struct is_same : true_type {};
+
+void integer_suffix() {
+  static constexpr auto v0 = __LINE__; // synthetic
+  static_assert(v0 == 24 || v0 == 20, "");
+
+  static constexpr auto v1 = __cplusplus; // synthetic, long
+
+  static constexpr auto v2 = 1; // no literal
+  static_assert(is_same::value, "");
+  static_assert(v2 == 1, "");
+
+  // Unsigned
+
+  static constexpr auto v3 = 1u;
+  // CHECK-MESSAGES: :[[@LINE-1]]:30: warning: integer literal suffix 'u' is not upper-case [readability-uppercase-literal-suffix]
+  // CHECK-MESSAGES-NEXT: static constexpr auto v3 = 1u;
+  // CHECK-MESSAGES-NEXT: ^~
+  // CHECK-MESSAGES-NEXT: {{^ *}}U{{$}}
+  // CHECK-FIXES: static constexpr auto v3 = 1U;
+  static_assert(is_same::value, "");
+  static_assert(v3 == 1, "");
+
+  static constexpr auto v4 = 1U; // OK.
+  static_assert(is_same::value, "");
+  static_assert(v4 == 1, "");
+
+  // Long
+
+  static constexpr auto v5 = 1l;
+  // CHECK-MESSAGES: :[[@LINE-1]]:30: warning: integer literal suffix 'l' is not upper-case [readability-uppercase-literal-suffix]
+  // CHECK-MESSAGES-NEXT: static constexpr auto v5 = 1l;
+  // CHECK-MESSAGES-NEXT: ^~
+  // CHECK-MESSAGES-NEXT: {{^ *}}L{{$}}
+  // CHECK-FIXES: static constexpr auto v5 = 1L;
+  static_assert(is_same::value, "");
+  static_assert(v5 == 1, "");
+
+  static constexpr auto v6 = 1L; // OK.
+  static_assert(is_same::value, "");
+  static_assert(v6 == 1, "");
+
+  // Long Long
+
+  static constexpr auto v7 = 1ll;
+  // CHECK-MESSAGES: :[[@LINE-1]]:30: warning: integer literal suffix 'll' is not upper-case [readability-uppercase-literal-suffix]
+  // CHECK-MESSAGES-NEXT: static constexpr auto v7 = 1ll;
+  // CHECK-MESSAGES-NEXT: ^~~
+  // CHECK-MESSAGES-NEXT: {{^ *}}LL{{$}}
+  // CHECK-FIXES: static constexpr auto v7 = 1LL;
+  static_assert(is_same::value, "");
+  static_assert(v7 == 1, "");
+
+  static constexpr auto v8 = 1LL; // OK.
+  static_assert(is_same::value, "");
+  static_assert(v8 == 1, "");
+
+  // Unsigned Long
+
+  static constexpr auto v9 = 1ul;
+  // CHECK-MESSAGES: :[[@LINE-1]]:30: warning: integer literal suffix 'ul' is not upper-case [readability-uppercase-literal-suffix]
+  // CHECK-MESSAGES-NEXT: static constexpr auto v9 = 1ul;
+  // CHECK-MESSAGES-NEXT: ^~~
+  // CHECK-MESSAGES-NEXT: {{^ *}}UL{{$}}
+  // CHECK-FIXES: static constexpr auto v9 = 1UL;
+  static_assert(is_same::value, "");
+  static_assert(v9 == 1, "");
+
+  static constexpr auto v10 = 1uL;
+  // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: integer literal suffix 'uL' is not upper-case [readability-uppercase-literal-suffix]
+  // CHECK-MESSAGES-NEXT: static constexpr auto v10 = 1uL;
+  // CHECK-MESSAGES-NEXT: ^~~
+  // CHECK-MESSAGES-NEXT: {{^ *}}UL{{$}}
+  // CHECK-FIXES: static constexpr auto v10 = 1UL;
+  static_assert(is_same::value, "");
+  static_assert(v10 == 1, "");
+
+  static constexpr auto v11 = 1Ul;
+  // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: integer literal suffix 'Ul' is not upper-case [readability-uppercase-literal-suffix]
+  // CHECK-MESSAGES-NEXT: static constexpr auto v11 = 1Ul;
+  // 

[PATCH] D52670: [clang-tidy] Add new 'readability-uppercase-literal-suffix' check (CERT DCL16-C, MISRA C:2012, 7.3, MISRA C++:2008, 2-13-4)

2018-09-28 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri added inline comments.



Comment at: docs/ReleaseNotes.rst:96
 
+- New alias :doc:`cert-dcl16-c
+  ` to 
:doc:`readability-uppercase-literal-suffix

Eugene.Zelenko wrote:
> Please move alias after new checks.
BTW, is there some tool to actually add this alias? I didn't find it, and had 
to do it by hand..


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D52670



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D52670: [clang-tidy] Add new 'readability-uppercase-literal-suffix' check (CERT DCL16-C, MISRA C:2012, 7.3, MISRA C++:2008, 2-13-4)

2018-09-28 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri updated this revision to Diff 167547.
lebedev.ri marked an inline comment as done.
lebedev.ri added a comment.

Move alias to after the new check,


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D52670

Files:
  clang-tidy/cert/CERTTidyModule.cpp
  clang-tidy/cert/CMakeLists.txt
  clang-tidy/readability/CMakeLists.txt
  clang-tidy/readability/MagicNumbersCheck.cpp
  clang-tidy/readability/MagicNumbersCheck.h
  clang-tidy/readability/ReadabilityTidyModule.cpp
  clang-tidy/readability/UppercaseLiteralSuffixCheck.cpp
  clang-tidy/readability/UppercaseLiteralSuffixCheck.h
  clang-tidy/utils/ASTUtils.cpp
  clang-tidy/utils/ASTUtils.h
  docs/ReleaseNotes.rst
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/readability-uppercase-literal-suffix.rst
  test/clang-tidy/readability-uppercase-literal-suffix-floating-point.cpp
  
test/clang-tidy/readability-uppercase-literal-suffix-hexadecimal-floating-point.cpp
  test/clang-tidy/readability-uppercase-literal-suffix-integer.cpp

Index: test/clang-tidy/readability-uppercase-literal-suffix-integer.cpp
===
--- /dev/null
+++ test/clang-tidy/readability-uppercase-literal-suffix-integer.cpp
@@ -0,0 +1,218 @@
+// RUN: %check_clang_tidy %s readability-uppercase-literal-suffix %t
+// RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp
+// RUN: clang-tidy %t.cpp -checks='-*,readability-uppercase-literal-suffix' -fix
+// RUN: clang-tidy %t.cpp -checks='-*,readability-uppercase-literal-suffix' -warnings-as-errors='-*,readability-uppercase-literal-suffix'
+
+template 
+struct integral_constant {
+  static constexpr T value = v;
+  typedef T value_type;
+  typedef integral_constant type; // using injected-class-name
+  constexpr operator value_type() const noexcept { return value; }
+};
+
+using false_type = integral_constant;
+using true_type = integral_constant;
+
+template 
+struct is_same : false_type {};
+
+template 
+struct is_same : true_type {};
+
+void integer_suffix() {
+  static constexpr auto v0 = __LINE__; // synthetic
+  static_assert(v0 == 24 || v0 == 20, "");
+
+  static constexpr auto v1 = __cplusplus; // synthetic, long
+
+  static constexpr auto v2 = 1; // no literal
+  static_assert(is_same::value, "");
+  static_assert(v2 == 1, "");
+
+  // Unsigned
+
+  static constexpr auto v3 = 1u;
+  // CHECK-MESSAGES: :[[@LINE-1]]:30: warning: integer literal suffix 'u' is not upper-case [readability-uppercase-literal-suffix]
+  // CHECK-MESSAGES-NEXT: static constexpr auto v3 = 1u;
+  // CHECK-MESSAGES-NEXT: ^~
+  // CHECK-MESSAGES-NEXT: {{^ *}}U{{$}}
+  // CHECK-FIXES: static constexpr auto v3 = 1U;
+  static_assert(is_same::value, "");
+  static_assert(v3 == 1, "");
+
+  static constexpr auto v4 = 1U; // OK.
+  static_assert(is_same::value, "");
+  static_assert(v4 == 1, "");
+
+  // Long
+
+  static constexpr auto v5 = 1l;
+  // CHECK-MESSAGES: :[[@LINE-1]]:30: warning: integer literal suffix 'l' is not upper-case [readability-uppercase-literal-suffix]
+  // CHECK-MESSAGES-NEXT: static constexpr auto v5 = 1l;
+  // CHECK-MESSAGES-NEXT: ^~
+  // CHECK-MESSAGES-NEXT: {{^ *}}L{{$}}
+  // CHECK-FIXES: static constexpr auto v5 = 1L;
+  static_assert(is_same::value, "");
+  static_assert(v5 == 1, "");
+
+  static constexpr auto v6 = 1L; // OK.
+  static_assert(is_same::value, "");
+  static_assert(v6 == 1, "");
+
+  // Long Long
+
+  static constexpr auto v7 = 1ll;
+  // CHECK-MESSAGES: :[[@LINE-1]]:30: warning: integer literal suffix 'll' is not upper-case [readability-uppercase-literal-suffix]
+  // CHECK-MESSAGES-NEXT: static constexpr auto v7 = 1ll;
+  // CHECK-MESSAGES-NEXT: ^~~
+  // CHECK-MESSAGES-NEXT: {{^ *}}LL{{$}}
+  // CHECK-FIXES: static constexpr auto v7 = 1LL;
+  static_assert(is_same::value, "");
+  static_assert(v7 == 1, "");
+
+  static constexpr auto v8 = 1LL; // OK.
+  static_assert(is_same::value, "");
+  static_assert(v8 == 1, "");
+
+  // Unsigned Long
+
+  static constexpr auto v9 = 1ul;
+  // CHECK-MESSAGES: :[[@LINE-1]]:30: warning: integer literal suffix 'ul' is not upper-case [readability-uppercase-literal-suffix]
+  // CHECK-MESSAGES-NEXT: static constexpr auto v9 = 1ul;
+  // CHECK-MESSAGES-NEXT: ^~~
+  // CHECK-MESSAGES-NEXT: {{^ *}}UL{{$}}
+  // CHECK-FIXES: static constexpr auto v9 = 1UL;
+  static_assert(is_same::value, "");
+  static_assert(v9 == 1, "");
+
+  static constexpr auto v10 = 1uL;
+  // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: integer literal suffix 'uL' is not upper-case [readability-uppercase-literal-suffix]
+  // CHECK-MESSAGES-NEXT: static constexpr auto v10 = 1uL;
+  // CHECK-MESSAGES-NEXT: ^~~
+  // CHECK-MESSAGES-NEXT: {{^ *}}UL{{$}}
+  // CHECK-FIXES: static constexpr auto v10 = 1UL;
+  static_assert(is_same::value, "");
+  static_assert(v10 == 1, "");
+
+  static constexpr auto v11 = 1Ul;
+  // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: integer literal suffix 'Ul' is not upper-case [readability-uppercase-literal-suffix]
+  // 

[PATCH] D52670: [clang-tidy] Add new 'readability-uppercase-literal-suffix' check (CERT DCL16-C, MISRA C:2012, 7.3, MISRA C++:2008, 2-13-4)

2018-09-28 Thread Eugene Zelenko via Phabricator via cfe-commits
Eugene.Zelenko added a comment.

May be we should also create MISRA module?


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D52670



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D52670: [clang-tidy] Add new 'readability-uppercase-literal-suffix' check (CERT DCL16-C, MISRA C:2012, 7.3, MISRA C++:2008, 2-13-4)

2018-09-28 Thread Eugene Zelenko via Phabricator via cfe-commits
Eugene.Zelenko added inline comments.



Comment at: docs/ReleaseNotes.rst:96
 
+- New alias :doc:`cert-dcl16-c
+  ` to 
:doc:`readability-uppercase-literal-suffix

Please move alias after new checks.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D52670



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D52673: [HIP] Remove disabled irif library

2018-09-28 Thread Aaron Enye Shi via Phabricator via cfe-commits
ashi1 created this revision.
ashi1 added reviewers: yaxunl, b-sumner, scchan.
Herald added a subscriber: cfe-commits.

Device Libraries has removed irif.amdgcn.bc, so we need to remove this 
requirement from HIP Toolchains. Also a few header functions need to be updated.


Repository:
  rC Clang

https://reviews.llvm.org/D52673

Files:
  lib/Driver/ToolChains/HIP.cpp
  test/Driver/hip-device-libs.hip


Index: test/Driver/hip-device-libs.hip
===
--- test/Driver/hip-device-libs.hip
+++ test/Driver/hip-device-libs.hip
@@ -21,7 +21,7 @@


 // COM: [[LLVM_LINK:"*.llvm-link"]]
-// COM-SAME: {{.*}} "{{.*}}ocml.amdgcn.bc" "{{.*}}ockl.amdgcn.bc" 
"{{.*}}irif.amdgcn.bc"
+// COM-SAME: {{.*}} "{{.*}}ocml.amdgcn.bc" "{{.*}}ockl.amdgcn.bc"
 // FLUSHD-SAME: {{.*}} "{{.*}}oclc_daz_opt_on.amdgcn.bc"
 // NOFLUSHD-SAME: {{.*}} "{{.*}}oclc_daz_opt_off.amdgcn.bc"
 // COM-SAME: {{.*}} "-o" "{{.*}}-gfx900-linked-{{.*bc}}"
Index: lib/Driver/ToolChains/HIP.cpp
===
--- lib/Driver/ToolChains/HIP.cpp
+++ lib/Driver/ToolChains/HIP.cpp
@@ -82,7 +82,7 @@
   FlushDenormalControlBC = "oclc_daz_opt_off.amdgcn.bc";

 BCLibs.append({"opencl.amdgcn.bc",
-   "ocml.amdgcn.bc", "ockl.amdgcn.bc", "irif.amdgcn.bc",
+   "ocml.amdgcn.bc", "ockl.amdgcn.bc",
"oclc_finite_only_off.amdgcn.bc",
FlushDenormalControlBC,
"oclc_correctly_rounded_sqrt_on.amdgcn.bc",


Index: test/Driver/hip-device-libs.hip
===
--- test/Driver/hip-device-libs.hip
+++ test/Driver/hip-device-libs.hip
@@ -21,7 +21,7 @@


 // COM: [[LLVM_LINK:"*.llvm-link"]]
-// COM-SAME: {{.*}} "{{.*}}ocml.amdgcn.bc" "{{.*}}ockl.amdgcn.bc" "{{.*}}irif.amdgcn.bc"
+// COM-SAME: {{.*}} "{{.*}}ocml.amdgcn.bc" "{{.*}}ockl.amdgcn.bc"
 // FLUSHD-SAME: {{.*}} "{{.*}}oclc_daz_opt_on.amdgcn.bc"
 // NOFLUSHD-SAME: {{.*}} "{{.*}}oclc_daz_opt_off.amdgcn.bc"
 // COM-SAME: {{.*}} "-o" "{{.*}}-gfx900-linked-{{.*bc}}"
Index: lib/Driver/ToolChains/HIP.cpp
===
--- lib/Driver/ToolChains/HIP.cpp
+++ lib/Driver/ToolChains/HIP.cpp
@@ -82,7 +82,7 @@
   FlushDenormalControlBC = "oclc_daz_opt_off.amdgcn.bc";

 BCLibs.append({"opencl.amdgcn.bc",
-   "ocml.amdgcn.bc", "ockl.amdgcn.bc", "irif.amdgcn.bc",
+   "ocml.amdgcn.bc", "ockl.amdgcn.bc",
"oclc_finite_only_off.amdgcn.bc",
FlushDenormalControlBC,
"oclc_correctly_rounded_sqrt_on.amdgcn.bc",
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


LLVM buildmaster will be restarted tonight

2018-09-28 Thread Galina Kistanova via cfe-commits
 Hello everyone,

LLVM buildmaster will be updated and restarted after 7PM Pacific time today.

Thanks

Galina
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D52650: [clangd] NFC: Migrate to LLVM STLExtras API where possible

2018-09-28 Thread Kirill Bobyrev via Phabricator via cfe-commits
kbobyrev added a comment.

In https://reviews.llvm.org/D52650#1249556, @sammccall wrote:

> I think it's fine to update others too, this is a trivially-safe change and
>  a nice readability improvement.
>  No need to put everything in the same patch though.


Great, thanks! I'll submit the patch once I'm home and I will make 
modifications in the other parts of clang-tools-extra.

Also, this making these transformations automatically might be a great idea for 
Clang-Tidy llvm-check (and a separate check with std::ranges later on).


https://reviews.llvm.org/D52650



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D52670: [clang-tidy] Add new 'readability-uppercase-literal-suffix' check (CERT DCL16-C, MISRA C:2012, 7.3, MISRA C++:2008, 2-13-4)

2018-09-28 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri created this revision.
lebedev.ri added reviewers: JonasToth, aaron.ballman, alexfh, hokein, xazax.hun.
lebedev.ri added a project: clang-tools-extra.
Herald added subscribers: rnkovacs, mgorny.

Detects when the integral literal or floating point (decimal or hexadecimal)
literal has non-uppercase suffix, and suggests to make the suffix uppercase,
with fix-it.

All valid combinations of suffixes are supported.

  auto x = 1;  // OK, no suffix.
  
  auto x = 1u; // warning: integer literal suffix 'u' is not upper-case
  
  auto x = 1U; // OK, suffix is uppercase.
  
  ...

References:

- CERT DCL16-C 

- MISRA C:2012, 7.3 - The lowercase character "l" shall not be used in a 
literal suffix
- MISRA C++:2008, 2-13-4 - Literal suffixes shall be upper case


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D52670

Files:
  clang-tidy/cert/CERTTidyModule.cpp
  clang-tidy/cert/CMakeLists.txt
  clang-tidy/readability/CMakeLists.txt
  clang-tidy/readability/MagicNumbersCheck.cpp
  clang-tidy/readability/MagicNumbersCheck.h
  clang-tidy/readability/ReadabilityTidyModule.cpp
  clang-tidy/readability/UppercaseLiteralSuffixCheck.cpp
  clang-tidy/readability/UppercaseLiteralSuffixCheck.h
  clang-tidy/utils/ASTUtils.cpp
  clang-tidy/utils/ASTUtils.h
  docs/ReleaseNotes.rst
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/readability-uppercase-literal-suffix.rst
  test/clang-tidy/readability-uppercase-literal-suffix-floating-point.cpp
  
test/clang-tidy/readability-uppercase-literal-suffix-hexadecimal-floating-point.cpp
  test/clang-tidy/readability-uppercase-literal-suffix-integer.cpp

Index: test/clang-tidy/readability-uppercase-literal-suffix-integer.cpp
===
--- /dev/null
+++ test/clang-tidy/readability-uppercase-literal-suffix-integer.cpp
@@ -0,0 +1,218 @@
+// RUN: %check_clang_tidy %s readability-uppercase-literal-suffix %t
+// RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp
+// RUN: clang-tidy %t.cpp -checks='-*,readability-uppercase-literal-suffix' -fix
+// RUN: clang-tidy %t.cpp -checks='-*,readability-uppercase-literal-suffix' -warnings-as-errors='-*,readability-uppercase-literal-suffix'
+
+template 
+struct integral_constant {
+  static constexpr T value = v;
+  typedef T value_type;
+  typedef integral_constant type; // using injected-class-name
+  constexpr operator value_type() const noexcept { return value; }
+};
+
+using false_type = integral_constant;
+using true_type = integral_constant;
+
+template 
+struct is_same : false_type {};
+
+template 
+struct is_same : true_type {};
+
+void integer_suffix() {
+  static constexpr auto v0 = __LINE__; // synthetic
+  static_assert(v0 == 24 || v0 == 20, "");
+
+  static constexpr auto v1 = __cplusplus; // synthetic, long
+
+  static constexpr auto v2 = 1; // no literal
+  static_assert(is_same::value, "");
+  static_assert(v2 == 1, "");
+
+  // Unsigned
+
+  static constexpr auto v3 = 1u;
+  // CHECK-MESSAGES: :[[@LINE-1]]:30: warning: integer literal suffix 'u' is not upper-case [readability-uppercase-literal-suffix]
+  // CHECK-MESSAGES-NEXT: static constexpr auto v3 = 1u;
+  // CHECK-MESSAGES-NEXT: ^~
+  // CHECK-MESSAGES-NEXT: {{^ *}}U{{$}}
+  // CHECK-FIXES: static constexpr auto v3 = 1U;
+  static_assert(is_same::value, "");
+  static_assert(v3 == 1, "");
+
+  static constexpr auto v4 = 1U; // OK.
+  static_assert(is_same::value, "");
+  static_assert(v4 == 1, "");
+
+  // Long
+
+  static constexpr auto v5 = 1l;
+  // CHECK-MESSAGES: :[[@LINE-1]]:30: warning: integer literal suffix 'l' is not upper-case [readability-uppercase-literal-suffix]
+  // CHECK-MESSAGES-NEXT: static constexpr auto v5 = 1l;
+  // CHECK-MESSAGES-NEXT: ^~
+  // CHECK-MESSAGES-NEXT: {{^ *}}L{{$}}
+  // CHECK-FIXES: static constexpr auto v5 = 1L;
+  static_assert(is_same::value, "");
+  static_assert(v5 == 1, "");
+
+  static constexpr auto v6 = 1L; // OK.
+  static_assert(is_same::value, "");
+  static_assert(v6 == 1, "");
+
+  // Long Long
+
+  static constexpr auto v7 = 1ll;
+  // CHECK-MESSAGES: :[[@LINE-1]]:30: warning: integer literal suffix 'll' is not upper-case [readability-uppercase-literal-suffix]
+  // CHECK-MESSAGES-NEXT: static constexpr auto v7 = 1ll;
+  // CHECK-MESSAGES-NEXT: ^~~
+  // CHECK-MESSAGES-NEXT: {{^ *}}LL{{$}}
+  // CHECK-FIXES: static constexpr auto v7 = 1LL;
+  static_assert(is_same::value, "");
+  static_assert(v7 == 1, "");
+
+  static constexpr auto v8 = 1LL; // OK.
+  static_assert(is_same::value, "");
+  static_assert(v8 == 1, "");
+
+  // Unsigned Long
+
+  static constexpr auto v9 = 1ul;
+  // CHECK-MESSAGES: :[[@LINE-1]]:30: warning: integer literal suffix 'ul' is not upper-case [readability-uppercase-literal-suffix]
+  // CHECK-MESSAGES-NEXT: static constexpr auto v9 = 1ul;
+  // CHECK-MESSAGES-NEXT: ^~~
+  // CHECK-MESSAGES-NEXT: {{^ *}}UL{{$}}
+  // CHECK-FIXES: static constexpr 

[PATCH] D52339: Support enums with a fixed underlying type in all language modes

2018-09-28 Thread Erik Pilkington via Phabricator via cfe-commits
erik.pilkington added a comment.

In https://reviews.llvm.org/D52339#1249457, @aaron.ballman wrote:

> However, short of that concern, this LGTM. I've spoken with the paper author 
> for the WG14 paper and I think this approach fits their general proposal, so 
> I don't think we'll have divergence here.


Okay, great! Thanks for verifying that.


Repository:
  rC Clang

https://reviews.llvm.org/D52339



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r343360 - Support enums with a fixed underlying type in all language modes.

2018-09-28 Thread Erik Pilkington via cfe-commits
Author: epilk
Date: Fri Sep 28 13:24:58 2018
New Revision: 343360

URL: http://llvm.org/viewvc/llvm-project?rev=343360=rev
Log:
Support enums with a fixed underlying type in all language modes.

Previously we supported these in C++, ObjC, and C with -fms-extensions.

rdar://43831380

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

Added:
cfe/trunk/test/Sema/fixed-enum.c
Modified:
cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
cfe/trunk/include/clang/Basic/Features.def
cfe/trunk/lib/Parse/ParseDecl.cpp
cfe/trunk/test/SemaObjC/enum-fixed-type.m

Modified: cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td?rev=343360=343359=343360=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td Fri Sep 28 13:24:58 
2018
@@ -88,9 +88,12 @@ def err_enumerator_unnamed_no_def : Erro
 def ext_cxx11_enum_fixed_underlying_type : Extension<
   "enumeration types with a fixed underlying type are a C++11 extension">,
   InGroup;
-def ext_c_enum_fixed_underlying_type : Extension<
+def ext_ms_c_enum_fixed_underlying_type : Extension<
   "enumeration types with a fixed underlying type are a Microsoft extension">,
   InGroup;
+def ext_clang_c_enum_fixed_underlying_type : Extension<
+  "enumeration types with a fixed underlying type are a Clang extension">,
+  InGroup>;
 def warn_cxx98_compat_enum_fixed_underlying_type : Warning<
   "enumeration types with a fixed underlying type are incompatible with 
C++98">,
   InGroup, DefaultIgnore;

Modified: cfe/trunk/include/clang/Basic/Features.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Features.def?rev=343360=343359=343360=diff
==
--- cfe/trunk/include/clang/Basic/Features.def (original)
+++ cfe/trunk/include/clang/Basic/Features.def Fri Sep 28 13:24:58 2018
@@ -89,7 +89,7 @@ FEATURE(objc_arc, LangOpts.ObjCAutoRefCo
 FEATURE(objc_arc_fields, true)
 FEATURE(objc_arc_weak, LangOpts.ObjCWeak)
 FEATURE(objc_default_synthesize_properties, LangOpts.ObjC2)
-FEATURE(objc_fixed_enum, LangOpts.ObjC2)
+FEATURE(objc_fixed_enum, true)
 FEATURE(objc_instancetype, LangOpts.ObjC2)
 FEATURE(objc_kindof, LangOpts.ObjC2)
 FEATURE(objc_modules, LangOpts.ObjC2 &)
@@ -232,6 +232,7 @@ EXTENSION(cxx_range_for, LangOpts.CPlusP
 EXTENSION(cxx_reference_qualified_functions, LangOpts.CPlusPlus)
 EXTENSION(cxx_rvalue_references, LangOpts.CPlusPlus)
 EXTENSION(cxx_variadic_templates, LangOpts.CPlusPlus)
+EXTENSION(cxx_fixed_enum, true)
 // C++14 features supported by other languages as extensions.
 EXTENSION(cxx_binary_literals, true)
 EXTENSION(cxx_init_captures, LangOpts.CPlusPlus11)

Modified: cfe/trunk/lib/Parse/ParseDecl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDecl.cpp?rev=343360=343359=343360=diff
==
--- cfe/trunk/lib/Parse/ParseDecl.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDecl.cpp Fri Sep 28 13:24:58 2018
@@ -4153,15 +4153,11 @@ void Parser::ParseEnumSpecifier(SourceLo
   // Enum definitions should not be parsed in a trailing-return-type.
   bool AllowDeclaration = DSC != DeclSpecContext::DSC_trailing;
 
-  bool AllowFixedUnderlyingType = AllowDeclaration &&
-(getLangOpts().CPlusPlus11 || getLangOpts().MicrosoftExt ||
- getLangOpts().ObjC2);
-
   CXXScopeSpec  = DS.getTypeSpecScope();
   if (getLangOpts().CPlusPlus) {
 // "enum foo : bar;" is not a potential typo for "enum foo::bar;"
 // if a fixed underlying type is allowed.
-ColonProtectionRAIIObject X(*this, AllowFixedUnderlyingType);
+ColonProtectionRAIIObject X(*this, AllowDeclaration);
 
 CXXScopeSpec Spec;
 if (ParseOptionalCXXScopeSpecifier(Spec, nullptr,
@@ -4183,7 +4179,7 @@ void Parser::ParseEnumSpecifier(SourceLo
 
   // Must have either 'enum name' or 'enum {...}'.
   if (Tok.isNot(tok::identifier) && Tok.isNot(tok::l_brace) &&
-  !(AllowFixedUnderlyingType && Tok.is(tok::colon))) {
+  !(AllowDeclaration && Tok.is(tok::colon))) {
 Diag(Tok, diag::err_expected_either) << tok::identifier << tok::l_brace;
 
 // Skip the rest of this declarator, up until the comma or semicolon.
@@ -4216,7 +4212,7 @@ void Parser::ParseEnumSpecifier(SourceLo
 
   // Parse the fixed underlying type.
   bool CanBeBitfield = getCurScope()->getFlags() & Scope::ClassScope;
-  if (AllowFixedUnderlyingType && Tok.is(tok::colon)) {
+  if (AllowDeclaration && Tok.is(tok::colon)) {
 bool PossibleBitfield = false;
 if (CanBeBitfield) {
   // If we're in class scope, this can either be an enum declaration with
@@ -4276,13 +4272,15 @@ void Parser::ParseEnumSpecifier(SourceLo
   SourceRange Range;
   BaseType = 

[PATCH] D52339: Support enums with a fixed underlying type in all language modes

2018-09-28 Thread Phabricator via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rC343360: Support enums with a fixed underlying type in all 
language modes. (authored by epilk, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D52339?vs=166397=167538#toc

Repository:
  rC Clang

https://reviews.llvm.org/D52339

Files:
  include/clang/Basic/DiagnosticParseKinds.td
  include/clang/Basic/Features.def
  lib/Parse/ParseDecl.cpp
  test/Sema/fixed-enum.c
  test/SemaObjC/enum-fixed-type.m

Index: include/clang/Basic/DiagnosticParseKinds.td
===
--- include/clang/Basic/DiagnosticParseKinds.td
+++ include/clang/Basic/DiagnosticParseKinds.td
@@ -88,9 +88,12 @@
 def ext_cxx11_enum_fixed_underlying_type : Extension<
   "enumeration types with a fixed underlying type are a C++11 extension">,
   InGroup;
-def ext_c_enum_fixed_underlying_type : Extension<
+def ext_ms_c_enum_fixed_underlying_type : Extension<
   "enumeration types with a fixed underlying type are a Microsoft extension">,
   InGroup;
+def ext_clang_c_enum_fixed_underlying_type : Extension<
+  "enumeration types with a fixed underlying type are a Clang extension">,
+  InGroup>;
 def warn_cxx98_compat_enum_fixed_underlying_type : Warning<
   "enumeration types with a fixed underlying type are incompatible with C++98">,
   InGroup, DefaultIgnore;
Index: include/clang/Basic/Features.def
===
--- include/clang/Basic/Features.def
+++ include/clang/Basic/Features.def
@@ -89,7 +89,7 @@
 FEATURE(objc_arc_fields, true)
 FEATURE(objc_arc_weak, LangOpts.ObjCWeak)
 FEATURE(objc_default_synthesize_properties, LangOpts.ObjC2)
-FEATURE(objc_fixed_enum, LangOpts.ObjC2)
+FEATURE(objc_fixed_enum, true)
 FEATURE(objc_instancetype, LangOpts.ObjC2)
 FEATURE(objc_kindof, LangOpts.ObjC2)
 FEATURE(objc_modules, LangOpts.ObjC2 &)
@@ -232,6 +232,7 @@
 EXTENSION(cxx_reference_qualified_functions, LangOpts.CPlusPlus)
 EXTENSION(cxx_rvalue_references, LangOpts.CPlusPlus)
 EXTENSION(cxx_variadic_templates, LangOpts.CPlusPlus)
+EXTENSION(cxx_fixed_enum, true)
 // C++14 features supported by other languages as extensions.
 EXTENSION(cxx_binary_literals, true)
 EXTENSION(cxx_init_captures, LangOpts.CPlusPlus11)
Index: test/Sema/fixed-enum.c
===
--- test/Sema/fixed-enum.c
+++ test/Sema/fixed-enum.c
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 -Weverything -xc++ -std=c++11 -DCXX11 -verify %s
+// RUN: %clang_cc1 -Weverything -xc++ -std=c++03 -DCXX03 -verify %s
+// RUN: %clang_cc1 -Weverything -xobjective-c -DOBJC -verify %s
+// RUN: %clang_cc1 -Weverything -std=c11 -xc -DC11 -verify %s
+// RUN: %clang_cc1 -Weverything -std=c11 -xc -fms-extensions -DMS -verify %s
+
+enum X : int {e};
+#if defined(CXX11)
+// expected-warning@-2{{enumeration types with a fixed underlying type are incompatible with C++98}}
+#elif defined(CXX03)
+// expected-warning@-4{{enumeration types with a fixed underlying type are a C++11 extension}}
+#elif defined(OBJC)
+// expected-no-diagnostics
+#elif defined(C11)
+// expected-warning@-8{{enumeration types with a fixed underlying type are a Clang extension}}
+#elif defined(MS)
+// expected-warning@-10{{enumeration types with a fixed underlying type are a Microsoft extension}}
+#endif
Index: test/SemaObjC/enum-fixed-type.m
===
--- test/SemaObjC/enum-fixed-type.m
+++ test/SemaObjC/enum-fixed-type.m
@@ -1,9 +1,14 @@
 // RUN: %clang_cc1 -fsyntax-only -pedantic -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify -xc %s
 
 #if !__has_feature(objc_fixed_enum)
 #  error Enumerations with a fixed underlying type are not supported
 #endif
 
+#if !__has_extension(cxx_fixed_enum)
+#  error Enumerations with a fixed underlying type are not supported
+#endif
+
 typedef long Integer;
 
 typedef enum : Integer { Enumerator1, Enumerator2 } Enumeration;
Index: lib/Parse/ParseDecl.cpp
===
--- lib/Parse/ParseDecl.cpp
+++ lib/Parse/ParseDecl.cpp
@@ -4153,15 +4153,11 @@
   // Enum definitions should not be parsed in a trailing-return-type.
   bool AllowDeclaration = DSC != DeclSpecContext::DSC_trailing;
 
-  bool AllowFixedUnderlyingType = AllowDeclaration &&
-(getLangOpts().CPlusPlus11 || getLangOpts().MicrosoftExt ||
- getLangOpts().ObjC2);
-
   CXXScopeSpec  = DS.getTypeSpecScope();
   if (getLangOpts().CPlusPlus) {
 // "enum foo : bar;" is not a potential typo for "enum foo::bar;"
 // if a fixed underlying type is allowed.
-ColonProtectionRAIIObject X(*this, AllowFixedUnderlyingType);
+ColonProtectionRAIIObject X(*this, AllowDeclaration);
 
 CXXScopeSpec Spec;
 if (ParseOptionalCXXScopeSpecifier(Spec, nullptr,
@@ -4183,7 +4179,7 @@
 
   // Must have either 'enum name' or 'enum {...}'.
   if (Tok.isNot(tok::identifier) && 

[PATCH] D52339: Support enums with a fixed underlying type in all language modes

2018-09-28 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

In https://reviews.llvm.org/D52339#1249531, @rsmith wrote:

> In https://reviews.llvm.org/D52339#1249457, @aaron.ballman wrote:
>
> > In https://reviews.llvm.org/D52339#1249432, @erik.pilkington wrote:
> >
> > > Ping! This doesn't really affect CUDA or OpenCL more than any change to 
> > > the compiler, so I don't think it makes sense to block this until we hear 
> > > from them.
> >
> >
> > It impacts them insomuch as they're standards and they may want to opt out 
> > of extensions for keeping code portable to other compilers.
>
>
> My view is that that's what `-pedantic` / `-pedantic-errors` are for. We want 
> Clang to have a consistent user experience across languages, so if we're 
> supporting fixed underlying types as an official Clang extension in languages 
> that don't have it as a feature, that should apply everywhere it makes sense.


That sounds like a reasonable approach to me. I'll switch my LGTM to RLGTM 
(Really LGTM). :-)


Repository:
  rC Clang

https://reviews.llvm.org/D52339



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r343356 - [OPENMP]Fix PR39084: Check datasharing attributes of reduction variables only.

2018-09-28 Thread Alexey Bataev via cfe-commits
Author: abataev
Date: Fri Sep 28 12:33:14 2018
New Revision: 343356

URL: http://llvm.org/viewvc/llvm-project?rev=343356=rev
Log:
[OPENMP]Fix PR39084: Check datasharing attributes of reduction variables only.

According to OpenMP, the reduction item must be shared in parent region.
But the item can be an array section or array subscript. In this case,
we should not check for the datasharing of the base declaration.

Modified:
cfe/trunk/lib/Sema/SemaOpenMP.cpp
cfe/trunk/test/OpenMP/for_ast_print.cpp
cfe/trunk/test/OpenMP/for_reduction_messages.cpp

Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOpenMP.cpp?rev=343356=343355=343356=diff
==
--- cfe/trunk/lib/Sema/SemaOpenMP.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOpenMP.cpp Fri Sep 28 12:33:14 2018
@@ -10631,65 +10631,68 @@ static bool actOnOMPReductionKindClause(
   }
   continue;
 }
+
+OpenMPDirectiveKind CurrDir = Stack->getCurrentDirective();
 // OpenMP [2.9.3.6, Restrictions, C/C++, p.4]
 //  If a list-item is a reference type then it must bind to the same object
 //  for all threads of the team.
-if (!ASE && !OASE && VD) {
-  VarDecl *VDDef = VD->getDefinition();
-  if (VD->getType()->isReferenceType() && VDDef && VDDef->hasInit()) {
-DSARefChecker Check(Stack);
-if (Check.Visit(VDDef->getInit())) {
-  S.Diag(ELoc, diag::err_omp_reduction_ref_type_arg)
-  << getOpenMPClauseName(ClauseKind) << ERange;
-  S.Diag(VDDef->getLocation(), diag::note_defined_here) << VDDef;
-  continue;
+if (!ASE && !OASE) {
+  if (VD) {
+VarDecl *VDDef = VD->getDefinition();
+if (VD->getType()->isReferenceType() && VDDef && VDDef->hasInit()) {
+  DSARefChecker Check(Stack);
+  if (Check.Visit(VDDef->getInit())) {
+S.Diag(ELoc, diag::err_omp_reduction_ref_type_arg)
+<< getOpenMPClauseName(ClauseKind) << ERange;
+S.Diag(VDDef->getLocation(), diag::note_defined_here) << VDDef;
+continue;
+  }
 }
   }
-}
-
-// OpenMP [2.14.1.1, Data-sharing Attribute Rules for Variables Referenced
-// in a Construct]
-//  Variables with the predetermined data-sharing attributes may not be
-//  listed in data-sharing attributes clauses, except for the cases
-//  listed below. For these exceptions only, listing a predetermined
-//  variable in a data-sharing attribute clause is allowed and overrides
-//  the variable's predetermined data-sharing attributes.
-// OpenMP [2.14.3.6, Restrictions, p.3]
-//  Any number of reduction clauses can be specified on the directive,
-//  but a list item can appear only once in the reduction clauses for that
-//  directive.
-DSAStackTy::DSAVarData DVar = Stack->getTopDSA(D, /*FromParent=*/false);
-if (DVar.CKind == OMPC_reduction) {
-  S.Diag(ELoc, diag::err_omp_once_referenced)
-  << getOpenMPClauseName(ClauseKind);
-  if (DVar.RefExpr)
-S.Diag(DVar.RefExpr->getExprLoc(), diag::note_omp_referenced);
-  continue;
-}
-if (DVar.CKind != OMPC_unknown) {
-  S.Diag(ELoc, diag::err_omp_wrong_dsa)
-  << getOpenMPClauseName(DVar.CKind)
-  << getOpenMPClauseName(OMPC_reduction);
-  reportOriginalDsa(S, Stack, D, DVar);
-  continue;
-}
 
-// OpenMP [2.14.3.6, Restrictions, p.1]
-//  A list item that appears in a reduction clause of a worksharing
-//  construct must be shared in the parallel regions to which any of the
-//  worksharing regions arising from the worksharing construct bind.
-OpenMPDirectiveKind CurrDir = Stack->getCurrentDirective();
-if (isOpenMPWorksharingDirective(CurrDir) &&
-!isOpenMPParallelDirective(CurrDir) &&
-!isOpenMPTeamsDirective(CurrDir)) {
-  DVar = Stack->getImplicitDSA(D, true);
-  if (DVar.CKind != OMPC_shared) {
-S.Diag(ELoc, diag::err_omp_required_access)
-<< getOpenMPClauseName(OMPC_reduction)
-<< getOpenMPClauseName(OMPC_shared);
+  // OpenMP [2.14.1.1, Data-sharing Attribute Rules for Variables 
Referenced
+  // in a Construct]
+  //  Variables with the predetermined data-sharing attributes may not be
+  //  listed in data-sharing attributes clauses, except for the cases
+  //  listed below. For these exceptions only, listing a predetermined
+  //  variable in a data-sharing attribute clause is allowed and overrides
+  //  the variable's predetermined data-sharing attributes.
+  // OpenMP [2.14.3.6, Restrictions, p.3]
+  //  Any number of reduction clauses can be specified on the directive,
+  //  but a list item can appear only once in the reduction clauses for 
that
+  //  directive.
+  DSAStackTy::DSAVarData DVar = Stack->getTopDSA(D, 

[PATCH] D52650: [clangd] NFC: Migrate to LLVM STLExtras API where possible

2018-09-28 Thread Sam McCall via Phabricator via cfe-commits
sammccall added subscribers: ioeric, kbobyrev.
sammccall added a comment.

I think it's fine to update others too, this is a trivially-safe change and
a nice readability improvement.
No need to put everything in the same patch though.


https://reviews.llvm.org/D52650



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D52650: [clangd] NFC: Migrate to LLVM STLExtras API where possible

2018-09-28 Thread Sam McCall via cfe-commits
I think it's fine to update others too, this is a trivially-safe change and
a nice readability improvement.
No need to put everything in the same patch though.

On Fri, Sep 28, 2018, 16:23 Kirill Bobyrev via Phabricator <
revi...@reviews.llvm.org> wrote:

> kbobyrev added a comment.
>
> Also, I'm not sure whether I should update Clang-Tidy and other tools in
> the scope of this patch. It makes sense to me, but I don't know whether the
> maintainers of these projects are happy with the change. WDYT?
>
>
> https://reviews.llvm.org/D52650
>
>
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D52664: Update CMakeLists.txt snippet so that example compiles

2018-09-28 Thread Shoaib Meenai via Phabricator via cfe-commits
smeenai added a comment.

Yep, that's my doing (https://reviews.llvm.org/rL319840). I didn't think about 
the documentation, whoops.


Repository:
  rC Clang

https://reviews.llvm.org/D52664



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D52538: [MinGW] Allow using ASan

2018-09-28 Thread Martin Storsjö via Phabricator via cfe-commits
mstorsjo added a comment.

Ping @rnk in case you have time to look at it despite CppCon


Repository:
  rC Clang

https://reviews.llvm.org/D52538



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D52640: [analyzer] [NFC] Remove unused parameters, as found by -Wunused-parameter

2018-09-28 Thread George Karpenkov via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rC343353: [analyzer] [NFC] Remove unused parameters, as found 
by -Wunused-parameter (authored by george.karpenkov, committed by ).
Herald added a subscriber: cfe-commits.

Changed prior to commit:
  https://reviews.llvm.org/D52640?vs=167422=167527#toc

Repository:
  rC Clang

https://reviews.llvm.org/D52640

Files:
  include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h
  include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h
  include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
  include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h
  include/clang/StaticAnalyzer/Core/PathSensitive/Store.h
  include/clang/StaticAnalyzer/Core/PathSensitive/SubEngine.h
  include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h
  lib/StaticAnalyzer/Checkers/DeleteWithNonVirtualDtorChecker.cpp
  lib/StaticAnalyzer/Checkers/DynamicTypeChecker.cpp
  lib/StaticAnalyzer/Checkers/DynamicTypePropagation.cpp
  lib/StaticAnalyzer/Checkers/InnerPointerChecker.cpp
  lib/StaticAnalyzer/Checkers/LocalizationChecker.cpp
  lib/StaticAnalyzer/Checkers/MPI-Checker/MPIBugReporter.cpp
  lib/StaticAnalyzer/Checkers/MPI-Checker/MPIBugReporter.h
  lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp
  lib/StaticAnalyzer/Checkers/MallocChecker.cpp
  lib/StaticAnalyzer/Checkers/MisusedMovedObjectChecker.cpp
  lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp
  lib/StaticAnalyzer/Checkers/ObjCSuperDeallocChecker.cpp
  lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.cpp
  lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.h
  lib/StaticAnalyzer/Checkers/TestAfterDivZeroChecker.cpp
  lib/StaticAnalyzer/Checkers/ValistChecker.cpp
  lib/StaticAnalyzer/Checkers/VirtualCallChecker.cpp
  lib/StaticAnalyzer/Core/BugReporter.cpp
  lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
  lib/StaticAnalyzer/Core/CoreEngine.cpp
  lib/StaticAnalyzer/Core/ExprEngine.cpp
  lib/StaticAnalyzer/Core/ExprEngineObjC.cpp
  lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
  lib/StaticAnalyzer/Core/MemRegion.cpp
  lib/StaticAnalyzer/Core/PathDiagnostic.cpp
  lib/StaticAnalyzer/Core/ProgramState.cpp
  lib/StaticAnalyzer/Core/RegionStore.cpp
  lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp

Index: lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
===
--- lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
+++ lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
@@ -179,15 +179,14 @@
 //===--===//
 
 std::shared_ptr
-BugReporterVisitor::getEndPath(BugReporterContext ,
-   const ExplodedNode *EndPathNode, BugReport ) {
+BugReporterVisitor::getEndPath(BugReporterContext &,
+   const ExplodedNode *, BugReport &) {
   return nullptr;
 }
 
 void
-BugReporterVisitor::finalizeVisitor(BugReporterContext ,
-const ExplodedNode *EndPathNode,
-BugReport ) {}
+BugReporterVisitor::finalizeVisitor(BugReporterContext &,
+const ExplodedNode *, BugReport &) {}
 
 std::shared_ptr BugReporterVisitor::getDefaultEndPath(
 BugReporterContext , const ExplodedNode *EndPathNode, BugReport ) {
@@ -303,9 +302,8 @@
   }
 
   std::shared_ptr VisitNode(const ExplodedNode *N,
- const ExplodedNode *PrevN,
- BugReporterContext ,
- BugReport ) override {
+ BugReporterContext ,
+ BugReport &) override {
 
 const LocationContext *Ctx = N->getLocationContext();
 const StackFrameContext *SCtx = Ctx->getStackFrame();
@@ -317,7 +315,7 @@
   return nullptr;
 
 CallEventRef<> Call =
-BRC.getStateManager().getCallEventManager().getCaller(SCtx, State);
+BR.getStateManager().getCallEventManager().getCaller(SCtx, State);
 
 if (SM.isInSystemHeader(Call->getDecl()->getSourceRange().getBegin()))
   return nullptr;
@@ -668,7 +666,6 @@
 ValueAtDereference(V) {}
 
   std::shared_ptr VisitNode(const ExplodedNode *N,
- const ExplodedNode *PrevN,
  BugReporterContext ,
  BugReport ) override {
 if (WasModified)
@@ -679,7 +676,7 @@
   return nullptr;
 
 const SourceManager  = BRC.getSourceManager();
-if (auto Loc = matchAssignment(N, BRC)) {
+if (auto Loc = matchAssignment(N)) {
   if (isFunctionMacroExpansion(*Loc, SMgr)) {
 std::string MacroName = getMacroName(*Loc, BRC);
   

[PATCH] D52637: [analyzer] Provide an option to dump generated exploded graphs to a given file.

2018-09-28 Thread George Karpenkov via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rC343352: [analyzer] Provide an option to dump generated 
exploded graphs to a given file. (authored by george.karpenkov, committed by ).
Herald added a subscriber: cfe-commits.

Changed prior to commit:
  https://reviews.llvm.org/D52637?vs=167516=167526#toc

Repository:
  rC Clang

https://reviews.llvm.org/D52637

Files:
  include/clang/Driver/CC1Options.td
  include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
  include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
  lib/Frontend/CompilerInvocation.cpp
  lib/StaticAnalyzer/Core/ExprEngine.cpp
  lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
  test/Analysis/dump_egraph.c

Index: include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
===
--- include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
+++ include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
@@ -140,6 +140,9 @@
 
   std::string AnalyzeSpecificFunction;
 
+  /// File path to which the exploded graph should be dumped.
+  std::string DumpExplodedGraphTo;
+
   /// Store full compiler invocation for reproducible instructions in the
   /// generated report.
   std::string FullCompilerInvocation;
Index: include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
===
--- include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
+++ include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
@@ -204,6 +204,18 @@
   void enqueueEndOfPath(ExplodedNodeSet );
   void GenerateCallExitNode(ExplodedNode *N);
 
+
+  /// Dump graph to the specified filename.
+  /// If filename is empty, generate a temporary one.
+  /// \return The filename the graph is written into.
+  std::string DumpGraph(bool trim = false, StringRef Filename="");
+
+  /// Dump the graph consisting of the given nodes to a specified filename.
+  /// Generate a temporary filename if it's not provided.
+  /// \return The filename the graph is written into.
+  std::string DumpGraph(ArrayRef Nodes,
+StringRef Filename = "");
+
   /// Visualize the ExplodedGraph created by executing the simulation.
   void ViewGraph(bool trim = false);
 
Index: include/clang/Driver/CC1Options.td
===
--- include/clang/Driver/CC1Options.td
+++ include/clang/Driver/CC1Options.td
@@ -80,6 +80,9 @@
   HelpText<"Only show error-related paths in the analysis graph">;
 def analyzer_viz_egraph_graphviz : Flag<["-"], "analyzer-viz-egraph-graphviz">,
   HelpText<"Display exploded graph using GraphViz">;
+def analyzer_dump_egraph : Separate<["-"], "analyzer-dump-egraph">,
+  HelpText<"Dump exploded graph to the specified file">;
+def analyzer_dump_egraph_EQ : Joined<["-"], "analyzer-dump-egraph=">, Alias;
 
 def analyzer_inline_max_stack_depth : Separate<["-"], "analyzer-inline-max-stack-depth">,
   HelpText<"Bound on stack depth while inlining (4 by default)">;
Index: test/Analysis/dump_egraph.c
===
--- test/Analysis/dump_egraph.c
+++ test/Analysis/dump_egraph.c
@@ -0,0 +1,15 @@
+// RUN: %clang_analyze_cc1 -analyzer-checker=core -analyzer-dump-egraph=%t.dot %s
+// RUN: cat %t.dot | FileCheck %s
+// REQUIRES: asserts
+
+int getJ();
+
+int foo() {
+  int *x = 0;
+  return *x;
+}
+
+// CHECK: digraph "Exploded Graph" {
+// CHECK: Edge: (B2, B1)
+// CHECK: Block Entrance: B1
+// CHECK: Bug report attached
Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -284,6 +284,7 @@
 
   Opts.visualizeExplodedGraphWithGraphViz =
 Args.hasArg(OPT_analyzer_viz_egraph_graphviz);
+  Opts.DumpExplodedGraphTo = Args.getLastArgValue(OPT_analyzer_dump_egraph);
   Opts.NoRetryExhausted = Args.hasArg(OPT_analyzer_disable_retry_exhausted);
   Opts.AnalyzeAll = Args.hasArg(OPT_analyzer_opt_analyze_headers);
   Opts.AnalyzerDisplayProgress = Args.hasArg(OPT_analyzer_display_progress);
Index: lib/StaticAnalyzer/Core/ExprEngine.cpp
===
--- lib/StaticAnalyzer/Core/ExprEngine.cpp
+++ lib/StaticAnalyzer/Core/ExprEngine.cpp
@@ -3058,6 +3058,23 @@
 
 void ExprEngine::ViewGraph(bool trim) {
 #ifndef NDEBUG
+  std::string Filename = DumpGraph(trim);
+  llvm::DisplayGraph(Filename, false, llvm::GraphProgram::DOT);
+#endif
+  llvm::errs() << "Warning: viewing graph requires assertions" << "\n";
+}
+
+
+void ExprEngine::ViewGraph(ArrayRef Nodes) {
+#ifndef NDEBUG
+  std::string Filename = DumpGraph(Nodes);
+  llvm::DisplayGraph(Filename, false, llvm::GraphProgram::DOT);
+#endif
+  llvm::errs() << "Warning: viewing graph requires assertions" << "\n";
+}
+
+std::string ExprEngine::DumpGraph(bool trim, StringRef Filename) {
+#ifndef NDEBUG
   

[PATCH] D52339: Support enums with a fixed underlying type in all language modes

2018-09-28 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith added a comment.

In https://reviews.llvm.org/D52339#1249457, @aaron.ballman wrote:

> In https://reviews.llvm.org/D52339#1249432, @erik.pilkington wrote:
>
> > Ping! This doesn't really affect CUDA or OpenCL more than any change to the 
> > compiler, so I don't think it makes sense to block this until we hear from 
> > them.
>
>
> It impacts them insomuch as they're standards and they may want to opt out of 
> extensions for keeping code portable to other compilers.


My view is that that's what `-pedantic` / `-pedantic-errors` are for. We want 
Clang to have a consistent user experience across languages, so if we're 
supporting fixed underlying types as an official Clang extension in languages 
that don't have it as a feature, that should apply everywhere it makes sense.


Repository:
  rC Clang

https://reviews.llvm.org/D52339



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r343353 - [analyzer] [NFC] Remove unused parameters, as found by -Wunused-parameter

2018-09-28 Thread George Karpenkov via cfe-commits
Author: george.karpenkov
Date: Fri Sep 28 11:49:41 2018
New Revision: 343353

URL: http://llvm.org/viewvc/llvm-project?rev=343353=rev
Log:
[analyzer] [NFC] Remove unused parameters, as found by -Wunused-parameter

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

Modified:

cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h
cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h
cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h
cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h
cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SubEngine.h
cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h
cfe/trunk/lib/StaticAnalyzer/Checkers/DeleteWithNonVirtualDtorChecker.cpp
cfe/trunk/lib/StaticAnalyzer/Checkers/DynamicTypeChecker.cpp
cfe/trunk/lib/StaticAnalyzer/Checkers/DynamicTypePropagation.cpp
cfe/trunk/lib/StaticAnalyzer/Checkers/InnerPointerChecker.cpp
cfe/trunk/lib/StaticAnalyzer/Checkers/LocalizationChecker.cpp
cfe/trunk/lib/StaticAnalyzer/Checkers/MPI-Checker/MPIBugReporter.cpp
cfe/trunk/lib/StaticAnalyzer/Checkers/MPI-Checker/MPIBugReporter.h
cfe/trunk/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp
cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
cfe/trunk/lib/StaticAnalyzer/Checkers/MisusedMovedObjectChecker.cpp
cfe/trunk/lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp
cfe/trunk/lib/StaticAnalyzer/Checkers/ObjCSuperDeallocChecker.cpp

cfe/trunk/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.cpp

cfe/trunk/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.h
cfe/trunk/lib/StaticAnalyzer/Checkers/TestAfterDivZeroChecker.cpp
cfe/trunk/lib/StaticAnalyzer/Checkers/ValistChecker.cpp
cfe/trunk/lib/StaticAnalyzer/Checkers/VirtualCallChecker.cpp
cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp
cfe/trunk/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
cfe/trunk/lib/StaticAnalyzer/Core/CoreEngine.cpp
cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp
cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineObjC.cpp
cfe/trunk/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
cfe/trunk/lib/StaticAnalyzer/Core/MemRegion.cpp
cfe/trunk/lib/StaticAnalyzer/Core/PathDiagnostic.cpp
cfe/trunk/lib/StaticAnalyzer/Core/ProgramState.cpp
cfe/trunk/lib/StaticAnalyzer/Core/RegionStore.cpp
cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp

Modified: 
cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h?rev=343353=343352=343353=diff
==
--- 
cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h 
(original)
+++ 
cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h 
Fri Sep 28 11:49:41 2018
@@ -58,7 +58,7 @@ public:
   /// The last parameter can be used to register a new visitor with the given
   /// BugReport while processing a node.
   virtual std::shared_ptr
-  VisitNode(const ExplodedNode *Succ, const ExplodedNode *Pred,
+  VisitNode(const ExplodedNode *Succ, 
 BugReporterContext , BugReport ) = 0;
 
   /// Last function called on the visitor, no further calls to VisitNode
@@ -107,7 +107,6 @@ public:
   void Profile(llvm::FoldingSetNodeID ) const override;
 
   std::shared_ptr VisitNode(const ExplodedNode *N,
- const ExplodedNode *PrevN,
  BugReporterContext ,
  BugReport ) override;
 };
@@ -134,7 +133,6 @@ public:
   static const char *getTag();
 
   std::shared_ptr VisitNode(const ExplodedNode *N,
- const ExplodedNode *PrevN,
  BugReporterContext ,
  BugReport ) override;
 
@@ -153,7 +151,6 @@ public:
   }
 
   std::shared_ptr VisitNode(const ExplodedNode *N,
- const ExplodedNode *PrevN,
  BugReporterContext ,
  BugReport ) override;
 
@@ -179,12 +176,10 @@ public:
   static const char *getTag();
 
   std::shared_ptr VisitNode(const ExplodedNode *N,
- const ExplodedNode *Prev,
  BugReporterContext ,
  BugReport ) override;
 
   std::shared_ptr VisitNodeImpl(const ExplodedNode *N,
-

r343352 - [analyzer] Provide an option to dump generated exploded graphs to a given file.

2018-09-28 Thread George Karpenkov via cfe-commits
Author: george.karpenkov
Date: Fri Sep 28 11:49:21 2018
New Revision: 343352

URL: http://llvm.org/viewvc/llvm-project?rev=343352=rev
Log:
[analyzer] Provide an option to dump generated exploded graphs to a given file.

Dumping graphs instead of opening them is often very useful,
e.g. for transfer or converting to SVG.

Basic sanity check for generated exploded graphs.

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

Added:
cfe/trunk/test/Analysis/dump_egraph.c
Modified:
cfe/trunk/include/clang/Driver/CC1Options.td
cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp
cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp

Modified: cfe/trunk/include/clang/Driver/CC1Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CC1Options.td?rev=343352=343351=343352=diff
==
--- cfe/trunk/include/clang/Driver/CC1Options.td (original)
+++ cfe/trunk/include/clang/Driver/CC1Options.td Fri Sep 28 11:49:21 2018
@@ -80,6 +80,9 @@ def trim_egraph : Flag<["-"], "trim-egra
   HelpText<"Only show error-related paths in the analysis graph">;
 def analyzer_viz_egraph_graphviz : Flag<["-"], "analyzer-viz-egraph-graphviz">,
   HelpText<"Display exploded graph using GraphViz">;
+def analyzer_dump_egraph : Separate<["-"], "analyzer-dump-egraph">,
+  HelpText<"Dump exploded graph to the specified file">;
+def analyzer_dump_egraph_EQ : Joined<["-"], "analyzer-dump-egraph=">, 
Alias;
 
 def analyzer_inline_max_stack_depth : Separate<["-"], 
"analyzer-inline-max-stack-depth">,
   HelpText<"Bound on stack depth while inlining (4 by default)">;

Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h?rev=343352=343351=343352=diff
==
--- cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h (original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h Fri Sep 28 
11:49:21 2018
@@ -140,6 +140,9 @@ public:
 
   std::string AnalyzeSpecificFunction;
 
+  /// File path to which the exploded graph should be dumped.
+  std::string DumpExplodedGraphTo;
+
   /// Store full compiler invocation for reproducible instructions in the
   /// generated report.
   std::string FullCompilerInvocation;

Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h?rev=343352=343351=343352=diff
==
--- cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h 
(original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h Fri 
Sep 28 11:49:21 2018
@@ -204,6 +204,18 @@ public:
   void enqueueEndOfPath(ExplodedNodeSet );
   void GenerateCallExitNode(ExplodedNode *N);
 
+
+  /// Dump graph to the specified filename.
+  /// If filename is empty, generate a temporary one.
+  /// \return The filename the graph is written into.
+  std::string DumpGraph(bool trim = false, StringRef Filename="");
+
+  /// Dump the graph consisting of the given nodes to a specified filename.
+  /// Generate a temporary filename if it's not provided.
+  /// \return The filename the graph is written into.
+  std::string DumpGraph(ArrayRef Nodes,
+StringRef Filename = "");
+
   /// Visualize the ExplodedGraph created by executing the simulation.
   void ViewGraph(bool trim = false);
 

Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=343352=343351=343352=diff
==
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Fri Sep 28 11:49:21 2018
@@ -284,6 +284,7 @@ static bool ParseAnalyzerArgs(AnalyzerOp
 
   Opts.visualizeExplodedGraphWithGraphViz =
 Args.hasArg(OPT_analyzer_viz_egraph_graphviz);
+  Opts.DumpExplodedGraphTo = Args.getLastArgValue(OPT_analyzer_dump_egraph);
   Opts.NoRetryExhausted = Args.hasArg(OPT_analyzer_disable_retry_exhausted);
   Opts.AnalyzeAll = Args.hasArg(OPT_analyzer_opt_analyze_headers);
   Opts.AnalyzerDisplayProgress = Args.hasArg(OPT_analyzer_display_progress);

Modified: cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp?rev=343352=343351=343352=diff
==
--- 

[PATCH] D52667: [analyzer] Fix conversion from LocAsInteger to Loc symbol.

2018-09-28 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ created this revision.
NoQ added reviewers: dcoughlin, xazax.hun, a.sidorin, george.karpenkov, szepet, 
rnkovacs.
Herald added subscribers: cfe-commits, Szelethus, mikhail.ramalho, 
baloghadamsoftware.

The thing i promised to fix in the last bullet of 
https://reviews.llvm.org/D44347:

> `SymbolReaper::markElementIndicesLive()` scans an array symbol, which is 
> always a NonLoc. However, it may still be a nonloc::LocAsInteger, and in this 
> case descend to the symbolic base would be necessary, as demonstrated by 
> `test_loc_as_integer_element_index_lifetime()`. This test, however, is not 
> fixed by the current patch, due to `getAsLocSymbol()` incorrectly failing to 
> pass its IncludeBaseRegions argument into the recursive call. But i decided 
> not to investigate it further today, because, well, enough is enough.


Repository:
  rC Clang

https://reviews.llvm.org/D52667

Files:
  lib/StaticAnalyzer/Core/SVals.cpp
  test/Analysis/symbol-reaper.c


Index: test/Analysis/symbol-reaper.c
===
--- test/Analysis/symbol-reaper.c
+++ test/Analysis/symbol-reaper.c
@@ -85,8 +85,7 @@
 x = (int)&(s->field);
 ptr = [x];
 if (s) {}
-  // FIXME: Should not warn. The symbol is still alive within the ptr's index.
-  } while (0); // expected-warning{{SYMBOL DEAD}}
+  } while (0);
 }
 
 // Test below checks lifetime of SymbolRegionValue in certain conditions.
Index: lib/StaticAnalyzer/Core/SVals.cpp
===
--- lib/StaticAnalyzer/Core/SVals.cpp
+++ lib/StaticAnalyzer/Core/SVals.cpp
@@ -85,7 +85,7 @@
 SymbolRef SVal::getAsLocSymbol(bool IncludeBaseRegions) const {
   // FIXME: should we consider SymbolRef wrapped in CodeTextRegion?
   if (Optional X = getAs())
-return X->getLoc().getAsLocSymbol();
+return X->getLoc().getAsLocSymbol(IncludeBaseRegions);
 
   if (Optional X = getAs()) {
 const MemRegion *R = X->getRegion();


Index: test/Analysis/symbol-reaper.c
===
--- test/Analysis/symbol-reaper.c
+++ test/Analysis/symbol-reaper.c
@@ -85,8 +85,7 @@
 x = (int)&(s->field);
 ptr = [x];
 if (s) {}
-  // FIXME: Should not warn. The symbol is still alive within the ptr's index.
-  } while (0); // expected-warning{{SYMBOL DEAD}}
+  } while (0);
 }
 
 // Test below checks lifetime of SymbolRegionValue in certain conditions.
Index: lib/StaticAnalyzer/Core/SVals.cpp
===
--- lib/StaticAnalyzer/Core/SVals.cpp
+++ lib/StaticAnalyzer/Core/SVals.cpp
@@ -85,7 +85,7 @@
 SymbolRef SVal::getAsLocSymbol(bool IncludeBaseRegions) const {
   // FIXME: should we consider SymbolRef wrapped in CodeTextRegion?
   if (Optional X = getAs())
-return X->getLoc().getAsLocSymbol();
+return X->getLoc().getAsLocSymbol(IncludeBaseRegions);
 
   if (Optional X = getAs()) {
 const MemRegion *R = X->getRegion();
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r343350 - [cxx2a] P0614R1: Support init-statements in range-based for loops.

2018-09-28 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Fri Sep 28 11:44:09 2018
New Revision: 343350

URL: http://llvm.org/viewvc/llvm-project?rev=343350=rev
Log:
[cxx2a] P0614R1: Support init-statements in range-based for loops.

We don't yet support this for the case where a range-based for loop is
implicitly rewritten to an ObjC for..in statement.

Added:
cfe/trunk/test/CodeGenCXX/cxx2a-init-statement.cpp
cfe/trunk/test/PCH/cxx2a-for-init-statement.cpp
cfe/trunk/test/Parser/cxx2a-init-statement.cpp
Modified:
cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
cfe/trunk/include/clang/AST/StmtCXX.h
cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/include/clang/Parse/Parser.h
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/AST/ASTImporter.cpp
cfe/trunk/lib/AST/ExprConstant.cpp
cfe/trunk/lib/AST/StmtCXX.cpp
cfe/trunk/lib/AST/StmtPrinter.cpp
cfe/trunk/lib/Analysis/CFG.cpp
cfe/trunk/lib/CodeGen/CGStmt.cpp
cfe/trunk/lib/CodeGen/CodeGenPGO.cpp
cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp
cfe/trunk/lib/Parse/ParseExprCXX.cpp
cfe/trunk/lib/Parse/ParseStmt.cpp
cfe/trunk/lib/Parse/ParseTentative.cpp
cfe/trunk/lib/Sema/SemaStmt.cpp
cfe/trunk/lib/Sema/TreeTransform.h
cfe/trunk/lib/Serialization/ASTReaderStmt.cpp
cfe/trunk/lib/Serialization/ASTWriterStmt.cpp
cfe/trunk/test/Analysis/Inputs/expected-plists/cxx-for-range.cpp.plist
cfe/trunk/test/Analysis/cxx-for-range.cpp
cfe/trunk/test/Analysis/scopes-cfg-output.cpp
cfe/trunk/test/Import/cxx-for-range/Inputs/F.cpp
cfe/trunk/test/Import/cxx-for-range/test.cpp
cfe/trunk/test/SemaCXX/constant-expression-cxx2a.cpp
cfe/trunk/test/SemaCXX/cxx17-compat.cpp
cfe/trunk/test/SemaObjCXX/foreach.mm
cfe/trunk/www/cxx_status.html

Modified: cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/RecursiveASTVisitor.h?rev=343350=343349=343350=diff
==
--- cfe/trunk/include/clang/AST/RecursiveASTVisitor.h (original)
+++ cfe/trunk/include/clang/AST/RecursiveASTVisitor.h Fri Sep 28 11:44:09 2018
@@ -2180,6 +2180,8 @@ DEF_TRAVERSE_STMT(ObjCAutoreleasePoolStm
 
 DEF_TRAVERSE_STMT(CXXForRangeStmt, {
   if (!getDerived().shouldVisitImplicitCode()) {
+if (S->getInit())
+  TRY_TO_TRAVERSE_OR_ENQUEUE_STMT(S->getInit());
 TRY_TO_TRAVERSE_OR_ENQUEUE_STMT(S->getLoopVarStmt());
 TRY_TO_TRAVERSE_OR_ENQUEUE_STMT(S->getRangeInit());
 TRY_TO_TRAVERSE_OR_ENQUEUE_STMT(S->getBody());

Modified: cfe/trunk/include/clang/AST/StmtCXX.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/StmtCXX.h?rev=343350=343349=343350=diff
==
--- cfe/trunk/include/clang/AST/StmtCXX.h (original)
+++ cfe/trunk/include/clang/AST/StmtCXX.h Fri Sep 28 11:44:09 2018
@@ -118,14 +118,15 @@ public:
 };
 
 /// CXXForRangeStmt - This represents C++0x [stmt.ranged]'s ranged for
-/// statement, represented as 'for (range-declarator : range-expression)'.
+/// statement, represented as 'for (range-declarator : range-expression)'
+/// or 'for (init-statement range-declarator : range-expression)'.
 ///
 /// This is stored in a partially-desugared form to allow full semantic
 /// analysis of the constituent components. The original syntactic components
 /// can be extracted using getLoopVariable and getRangeInit.
 class CXXForRangeStmt : public Stmt {
   SourceLocation ForLoc;
-  enum { RANGE, BEGINSTMT, ENDSTMT, COND, INC, LOOPVAR, BODY, END };
+  enum { INIT, RANGE, BEGINSTMT, ENDSTMT, COND, INC, LOOPVAR, BODY, END };
   // SubExprs[RANGE] is an expression or declstmt.
   // SubExprs[COND] and SubExprs[INC] are expressions.
   Stmt *SubExprs[END];
@@ -135,16 +136,17 @@ class CXXForRangeStmt : public Stmt {
 
   friend class ASTStmtReader;
 public:
-  CXXForRangeStmt(DeclStmt *Range, DeclStmt *Begin, DeclStmt *End,
-  Expr *Cond, Expr *Inc, DeclStmt *LoopVar, Stmt *Body,
-  SourceLocation FL, SourceLocation CAL, SourceLocation CL,
-  SourceLocation RPL);
+  CXXForRangeStmt(Stmt *InitStmt, DeclStmt *Range, DeclStmt *Begin,
+  DeclStmt *End, Expr *Cond, Expr *Inc, DeclStmt *LoopVar,
+  Stmt *Body, SourceLocation FL, SourceLocation CAL,
+  SourceLocation CL, SourceLocation RPL);
   CXXForRangeStmt(EmptyShell Empty) : Stmt(CXXForRangeStmtClass, Empty) { }
 
-
+  Stmt *getInit() { return SubExprs[INIT]; }
   VarDecl *getLoopVariable();
   Expr *getRangeInit();
 
+  const Stmt *getInit() const { return SubExprs[INIT]; }
   const VarDecl *getLoopVariable() const;
   const Expr *getRangeInit() const;
 
@@ -179,6 +181,7 @@ public:
   }
   const Stmt *getBody() const { return SubExprs[BODY]; }
 
+  void setInit(Stmt *S) { SubExprs[INIT] = S; }
 

[PATCH] D52664: Update CMakeLists.txt snippet so that example compiles

2018-09-28 Thread Stephen Kelly via Phabricator via cfe-commits
steveire accepted this revision.
steveire added a comment.
This revision is now accepted and ready to land.

Yes, `add_llvm_executable` uses `target_link_libraries` with `PRIVATE` for 
`LLVM_PTHREAD_LIB`. It is designed so that if you use the 
`PUBLIC|PRIVATE|INTERFACE` keyword with a target once, you have to do it at 
each location.


Repository:
  rC Clang

https://reviews.llvm.org/D52664



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D51949: [clang-tidy] new check 'readability-isolate-declaration'

2018-09-28 Thread Jonas Toth via Phabricator via cfe-commits
JonasToth updated this revision to Diff 167523.
JonasToth added a comment.

- simplify matcher slighty, as initStmt in if/switch don't have a compundstmt 
as parent, add suggested tests


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D51949

Files:
  clang-tidy/bugprone/ArgumentCommentCheck.cpp
  clang-tidy/bugprone/SuspiciousSemicolonCheck.cpp
  clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp
  clang-tidy/readability/CMakeLists.txt
  clang-tidy/readability/IsolateDeclarationCheck.cpp
  clang-tidy/readability/IsolateDeclarationCheck.h
  clang-tidy/readability/ReadabilityTidyModule.cpp
  clang-tidy/utils/FixItHintUtils.cpp
  clang-tidy/utils/LexerUtils.cpp
  clang-tidy/utils/LexerUtils.h
  docs/ReleaseNotes.rst
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/readability-isolate-declaration.rst
  test/clang-tidy/readability-isolate-declaration-cxx17.cpp
  test/clang-tidy/readability-isolate-declaration-fixing.cpp
  test/clang-tidy/readability-isolate-declaration.c
  test/clang-tidy/readability-isolate-declaration.cpp

Index: test/clang-tidy/readability-isolate-declaration.cpp
===
--- /dev/null
+++ test/clang-tidy/readability-isolate-declaration.cpp
@@ -0,0 +1,412 @@
+// RUN: %check_clang_tidy %s readability-isolate-declaration %t
+
+void f() {
+  int i;
+}
+
+void f2() {
+  int i, j, *k, lala = 42;
+  // CHECK-MESSAGES: [[@LINE-1]]:3: warning: multiple declarations in a single statement reduces readability
+  // CHECK-FIXES: int i;
+  // CHECK-FIXES: {{^  }}int j;
+  // CHECK-FIXES: {{^  }}int *k;
+  // CHECK-FIXES: {{^  }}int lala = 42;
+
+  int normal, weird = /* comment */ 42;
+  // CHECK-MESSAGES: [[@LINE-1]]:3: warning: multiple declarations in a single statement reduces readability
+  // CHECK-FIXES: int normal;
+  // CHECK-FIXES: {{^  }}int weird = /* comment */ 42;
+
+  int /* here is a comment */ v1,
+  // another comment
+  v2 = 42 // Ok, more comments
+  ;
+  // CHECK-MESSAGES: [[@LINE-4]]:3: warning: multiple declarations in a single statement reduces readability
+  // CHECK-FIXES: int /* here is a comment */ v1;
+  // CHECK-FIXES: {{^  }}int /* here is a comment */ // another comment
+  // CHECK-FIXES: {{^  }}v2 = 42 // Ok, more comments
+  // CHECK-FIXES: {{^  }};
+
+  auto int1 = 42, int2 = 0, int3 = 43;
+  // CHECK-MESSAGES: [[@LINE-1]]:3: warning: multiple declarations in a single statement reduces readability
+  // CHECK-FIXES: auto int1 = 42;
+  // CHECK-FIXES: {{^  }}auto int2 = 0;
+  // CHECK-FIXES: {{^  }}auto int3 = 43;
+
+  decltype(auto) ptr1 = , ptr2 = 
+  // CHECK-MESSAGES: [[@LINE-1]]:3: warning: multiple declarations in a single statement reduces readability
+  // CHECK-FIXES: decltype(auto) ptr1 = 
+  // CHECK-FIXES: {{^  }}decltype(auto) ptr2 = 
+
+  decltype(k) ptr3 = , ptr4 = 
+  // CHECK-MESSAGES: [[@LINE-1]]:3: warning: multiple declarations in a single statement reduces readability
+  // CHECK-FIXES: decltype(k) ptr3 = 
+  // CHECK-FIXES: {{^  }}decltype(k) ptr4 = 
+}
+
+void f3() {
+  int i, *pointer1;
+  // CHECK-MESSAGES: [[@LINE-1]]:3: warning: multiple declarations in a single statement reduces readability
+  // CHECK-FIXES: int i;
+  // CHECK-FIXES: {{^  }}int *pointer1;
+  //
+  int *pointer2 = nullptr, *pointer3 = 
+  // CHECK-MESSAGES: [[@LINE-1]]:3: warning: multiple declarations in a single statement reduces readability
+  // CHECK-FIXES: int *pointer2 = nullptr;
+  // CHECK-FIXES: {{^  }}int *pointer3 = 
+
+  int *(i_ptr) = nullptr, *((i_ptr2));
+  // CHECK-MESSAGES: [[@LINE-1]]:3: warning: multiple declarations in a single statement reduces readability
+  // CHECK-FIXES: int *(i_ptr) = nullptr;
+  // CHECK-FIXES: {{^  }}int *((i_ptr2));
+
+  float(*f_ptr)[42], (((f_value))) = 42;
+  // CHECK-MESSAGES: [[@LINE-1]]:3: warning: multiple declarations in a single statement reduces readability
+  // CHECK-FIXES: float (*f_ptr)[42];
+  // CHECK-FIXES: {{^  }}float (((f_value))) = 42;
+
+  float(((*f_ptr2)))[42], ((*f_ptr3)), f_value2 = 42.f;
+  // CHECK-MESSAGES: [[@LINE-1]]:3: warning: multiple declarations in a single statement reduces readability
+  // CHECK-FIXES: float (((*f_ptr2)))[42];
+  // CHECK-FIXES: {{^  }}float ((*f_ptr3));
+  // CHECK-FIXES: {{^  }}float f_value2 = 42.f;
+
+  float(((*f_ptr4)))[42], *f_ptr5, ((f_value3));
+  // CHECK-MESSAGES: [[@LINE-1]]:3: warning: multiple declarations in a single statement reduces readability
+  // CHECK-FIXES: float (((*f_ptr4)))[42];
+  // CHECK-FIXES: {{^  }}float *f_ptr5;
+  // CHECK-FIXES: {{^  }}float ((f_value3));
+
+  void(((*f2))(int)), (*g2)(int, float);
+  // CHECK-MESSAGES: [[@LINE-1]]:3: warning: multiple declarations in a single statement reduces readability
+  // CHECK-FIXES: void (((*f2))(int));
+  // CHECK-FIXES: {{^  }}void (*g2)(int, float);
+
+  float(*(*(*f_ptr6)))[42], (*f_ptr7);
+  // CHECK-MESSAGES: [[@LINE-1]]:3: warning: multiple declarations in a single statement reduces 

[PATCH] D51949: [clang-tidy] new check 'readability-isolate-declaration'

2018-09-28 Thread Eugene Zelenko via Phabricator via cfe-commits
Eugene.Zelenko added a comment.

How about creating CERT alias?




Comment at: clang-tidy/readability/IsolateDeclarationCheck.cpp:58
+  // number of transformations.
+  while (Indirections--) {
+Start = findPreviousAnyTokenKind(Start, SM, LangOpts, tok::star, tok::amp);

It'll be better to compare with 0 explicitly.



Comment at: clang-tidy/readability/IsolateDeclarationCheck.cpp:145
+  // future this should be relaxed and support various kinds of declarations.
+  VarDecl *FirstDecl = dyn_cast(*DS->decl_begin());
+

auto could be used here.



Comment at: clang-tidy/readability/IsolateDeclarationCheck.cpp:198
+  SourceLocation DeclBegin = Start;
+  for (auto It = DS->decl_begin(), End = DS->decl_end(); It != End; ++It) {
+VarDecl *CurrentDecl = dyn_cast(*It);

Will be good idea to use range loop.



Comment at: docs/ReleaseNotes.rst:60
 
+- The 'readability-isolate-decl' check was renamed to 
:doc:`readability-isolate-declaration
+  `

Do we really need this entry?


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D51949



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D52664: Update CMakeLists.txt snippet so that example compiles

2018-09-28 Thread Dan Zimmerman via Phabricator via cfe-commits
danzimm created this revision.
danzimm added a reviewer: modocache.
Herald added a subscriber: cfe-commits.

Previous to this the example didn't work out of the box, it seems some cmake 
config changed between when this was written and now.


Repository:
  rC Clang

https://reviews.llvm.org/D52664

Files:
  docs/LibASTMatchersTutorial.rst


Index: docs/LibASTMatchersTutorial.rst
===
--- docs/LibASTMatchersTutorial.rst
+++ docs/LibASTMatchersTutorial.rst
@@ -113,6 +113,7 @@
 LoopConvert.cpp
 )
   target_link_libraries(loop-convert
+PRIVATE
 clangTooling
 clangBasic
 clangASTMatchers


Index: docs/LibASTMatchersTutorial.rst
===
--- docs/LibASTMatchersTutorial.rst
+++ docs/LibASTMatchersTutorial.rst
@@ -113,6 +113,7 @@
 LoopConvert.cpp
 )
   target_link_libraries(loop-convert
+PRIVATE
 clangTooling
 clangBasic
 clangASTMatchers
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D52665: [X86] Add more of the icc unaligned load/store to/from 128 bit vector intrinsics

2018-09-28 Thread Craig Topper via Phabricator via cfe-commits
craig.topper created this revision.
craig.topper added reviewers: spatel, RKSimon.

This patch adds
_mm_loadu_si32
_mm_loadu_si16
_mm_storeu_si64
_mm_storeu_si32
_mm_storeu_si16

We already had _mm_load_si64.


https://reviews.llvm.org/D52665

Files:
  lib/Headers/emmintrin.h
  test/CodeGen/sse2-builtins.c

Index: test/CodeGen/sse2-builtins.c
===
--- test/CodeGen/sse2-builtins.c
+++ test/CodeGen/sse2-builtins.c
@@ -721,6 +721,30 @@
   return _mm_loadu_si64(A);
 }
 
+__m128i test_mm_loadu_si32(void const* A) {
+  // CHECK-LABEL: test_mm_loadu_si32
+  // CHECK: load i32, i32* %{{.*}}, align 1{{$}}
+  // CHECK: insertelement <4 x i32> undef, i32 %{{.*}}, i32 0
+  // CHECK: insertelement <4 x i32> %{{.*}}, i32 0, i32 1
+  // CHECK: insertelement <4 x i32> %{{.*}}, i32 0, i32 2
+  // CHECK: insertelement <4 x i32> %{{.*}}, i32 0, i32 3
+  return _mm_loadu_si32(A);
+}
+
+__m128i test_mm_loadu_si16(void const* A) {
+  // CHECK-LABEL: test_mm_loadu_si16
+  // CHECK: load i16, i16* %{{.*}}, align 1{{$}}
+  // CHECK: insertelement <8 x i16> undef, i16 %{{.*}}, i32 0
+  // CHECK: insertelement <8 x i16> %{{.*}}, i16 0, i32 1
+  // CHECK: insertelement <8 x i16> %{{.*}}, i16 0, i32 2
+  // CHECK: insertelement <8 x i16> %{{.*}}, i16 0, i32 3
+  // CHECK: insertelement <8 x i16> %{{.*}}, i16 0, i32 4
+  // CHECK: insertelement <8 x i16> %{{.*}}, i16 0, i32 5
+  // CHECK: insertelement <8 x i16> %{{.*}}, i16 0, i32 6
+  // CHECK: insertelement <8 x i16> %{{.*}}, i16 0, i32 7
+  return _mm_loadu_si16(A);
+}
+
 __m128i test_mm_madd_epi16(__m128i A, __m128i B) {
   // CHECK-LABEL: test_mm_madd_epi16
   // CHECK: call <4 x i32> @llvm.x86.sse2.pmadd.wd(<8 x i16> %{{.*}}, <8 x i16> %{{.*}})
@@ -1351,6 +1375,30 @@
   _mm_storeu_si128(A, B);
 }
 
+void test_mm_storeu_si64(void* A, __m128i B) {
+  // CHECK-LABEL: test_mm_storeu_si64
+  // CHECK: [[EXT:%.*]] = extractelement <2 x i64> %{{.*}}, i32 0
+  // CHECK: store i64 [[EXT]], i64* %{{.*}}, align 1{{$}}
+  // CHECK-NEXT: ret void
+  _mm_storeu_si64(A, B);
+}
+
+void test_mm_storeu_si32(void* A, __m128i B) {
+  // CHECK-LABEL: test_mm_storeu_si32
+  // CHECK: [[EXT:%.*]] = extractelement <4 x i32> %{{.*}}, i32 0
+  // CHECK: store i32 [[EXT]], i32* %{{.*}}, align 1{{$}}
+  // CHECK-NEXT: ret void
+  _mm_storeu_si32(A, B);
+}
+
+void test_mm_storeu_si16(void* A, __m128i B) {
+  // CHECK-LABEL: test_mm_storeu_si16
+  // CHECK: [[EXT:%.*]] = extractelement <8 x i16> %{{.*}}, i32 0
+  // CHECK: store i16 [[EXT]], i16* %{{.*}}, align 1{{$}}
+  // CHECK-NEXT: ret void
+  _mm_storeu_si16(A, B);
+}
+
 void test_mm_stream_pd(double *A, __m128d B) {
   // CHECK-LABEL: test_mm_stream_pd
   // CHECK: store <2 x double> %{{.*}}, <2 x double>* %{{.*}}, align 16, !nontemporal
Index: lib/Headers/emmintrin.h
===
--- lib/Headers/emmintrin.h
+++ lib/Headers/emmintrin.h
@@ -1675,7 +1675,49 @@
 long long __v;
   } __attribute__((__packed__, __may_alias__));
   long long __u = ((struct __loadu_si64*)__a)->__v;
-  return __extension__ (__m128i)(__v2di){__u, 0L};
+  return __extension__ (__m128i)(__v2di){__u, 0LL};
+}
+
+/// Loads a 32-bit integer value to the low element of a 128-bit integer
+///vector and clears the upper element.
+///
+/// \headerfile 
+///
+/// This intrinsic corresponds to the  VMOVD / MOVD  instruction.
+///
+/// \param __a
+///A pointer to a 32-bit memory location. The address of the memory
+///location does not have to be aligned.
+/// \returns A 128-bit vector of [4 x i32] containing the loaded value.
+static __inline__ __m128i __DEFAULT_FN_ATTRS
+_mm_loadu_si32(void const *__a)
+{
+  struct __loadu_si32 {
+int __v;
+  } __attribute__((__packed__, __may_alias__));
+  int __u = ((struct __loadu_si32*)__a)->__v;
+  return __extension__ (__m128i)(__v4si){__u, 0, 0, 0};
+}
+
+/// Loads a 16-bit integer value to the low element of a 128-bit integer
+///vector and clears the upper element.
+///
+/// \headerfile 
+///
+/// This intrinsic does not correspond to a specific instruction.
+///
+/// \param __a
+///A pointer to a 16-bit memory location. The address of the memory
+///location does not have to be aligned.
+/// \returns A 128-bit vector of [8 x i16] containing the loaded value.
+static __inline__ __m128i __DEFAULT_FN_ATTRS
+_mm_loadu_si16(void const *__a)
+{
+  struct __loadu_si16 {
+short __v;
+  } __attribute__((__packed__, __may_alias__));
+  short __u = ((struct __loadu_si16*)__a)->__v;
+  return __extension__ (__m128i)(__v8hi){__u, 0, 0, 0, 0, 0, 0, 0};
 }
 
 /// Loads a 64-bit double-precision value to the low element of a
@@ -3993,6 +4035,69 @@
   ((struct __storeu_si128*)__p)->__v = __b;
 }
 
+/// Stores a 64-bit integer value from the low element of a 128-bit integer
+///vector.
+///
+/// \headerfile 
+///
+/// This intrinsic corresponds to the  VMOVQ / MOVQ  instruction.
+///
+/// \param __p
+///

[PATCH] D52339: Support enums with a fixed underlying type in all language modes

2018-09-28 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

In https://reviews.llvm.org/D52339#1249432, @erik.pilkington wrote:

> Ping! This doesn't really affect CUDA or OpenCL more than any change to the 
> compiler, so I don't think it makes sense to block this until we hear from 
> them.


It impacts them insomuch as they're standards and they may want to opt out of 
extensions for keeping code portable to other compilers.

However, short of that concern, this LGTM. I've spoken with the paper author 
for the WG14 paper and I think this approach fits their general proposal, so I 
don't think we'll have divergence here.


Repository:
  rC Clang

https://reviews.llvm.org/D52339



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D51949: [clang-tidy] new check 'readability-isolate-declaration'

2018-09-28 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

Can you add some tests for cases like:

  // C code
  void (*signal(int sig, void (*func)(int)))(int); // One decl
  int i = sizeof(struct S { int i;}); // One decl
  int j = sizeof(struct T { int i;}), k; // Two decls
  void g(struct U { int i; } s); // One decl
  void h(struct V { int i; } s), m(int i, ...); // Two decls

and

  // C++ code
  void f() {
switch (int i = 12, j = 14; i) {} // Two decls, but don't transform
  }
  
  void g() try {
int i, j; // Two decls
  } catch (...) {}




Comment at: clang-tidy/readability/IsolateDeclarationCheck.cpp:24
+AST_MATCHER(DeclStmt, isSingleDecl) { return Node.isSingleDecl(); }
+AST_MATCHER(DeclStmt, isVariablesOnly) {
+  return std::all_of(Node.decl_begin(), Node.decl_end(),

The identifier reads strangely to my ears. How about: `onlyDeclaresVariables()`?



Comment at: clang-tidy/readability/IsolateDeclarationCheck.cpp:52
+ const LangOptions ) {
+  assert(Indirections >= 0 && "Indirections must be non-negative");
+  if (Indirections == 0)

This assertion suggests that `Indirections` should be `unsigned` and that you 
perform the assertion before doing a decrement to ensure it isn't trying to 
decrement past 0.



Comment at: clang-tidy/readability/IsolateDeclarationCheck.cpp:76-78
+const auto *Pointee =
+T->getPointeeType().getTypePtr()->getAs();
+assert(Pointee && "Expected FunctionType Pointer");

Use `castAs()` and remove the assert.



Comment at: clang-tidy/readability/IsolateDeclarationCheck.cpp:83-84
+
+  if (isa(T)) {
+const auto *AT = cast(T);
+// Note: Do not increment the 'Indirections' because it is not yet clear

`if (const auto *AT = dyn_cast(T))` rather than isa followed by cast.



Comment at: clang-tidy/readability/IsolateDeclarationCheck.cpp:150
+
+  // FIXME: Memberpointer are not transformed correctly right now, thats
+  // why they are treated as problematic here.

Memberpointer -> Member pointer
thats -> that's

(Same elsewhere)



Comment at: clang-tidy/readability/IsolateDeclarationCheck.cpp:199-200
+  for (auto It = DS->decl_begin(), End = DS->decl_end(); It != End; ++It) {
+VarDecl *CurrentDecl = dyn_cast(*It);
+assert(CurrentDecl && "Expect only VarDecls here");
+

Use `cast<>` instead of `dyn_cast` and an assert.



Comment at: clang-tidy/readability/IsolateDeclarationCheck.cpp:230
+  for (const auto  : Ranges) {
+auto CharRange = Lexer::getAsCharRange(
+CharSourceRange::getCharRange(Range.getBegin(), Range.getEnd()), SM,

Use of `auto`?



Comment at: clang-tidy/readability/IsolateDeclarationCheck.cpp:250
+
+/// Excepts a vector {TypeSnippet, Firstdecl, SecondDecl, ...}.
+static std::vector

Excepts -> Accepts



Comment at: clang-tidy/readability/IsolateDeclarationCheck.cpp:291
+  .str());
+  // llvm::dbgs() << Replacement << "\n";
+

Debugging code that can be removed.



Comment at: clang-tidy/utils/LexerUtils.cpp:85
+llvm::Optional Tok = Lexer::findNextToken(Loc, SM, LangOpts);
+assert(Tok && "Could not retrieve next token");
+

This seems like a bad assertion -- it's an optional for a reason, isn't it?



Comment at: clang-tidy/utils/LexerUtils.h:48
+Token T;
+bool FailedRetrievingToken = Lexer::getRawToken(L, T, SM, LangOpts);
+

No real need for this local.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D51949



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D52339: Support enums with a fixed underlying type in all language modes

2018-09-28 Thread Erik Pilkington via Phabricator via cfe-commits
erik.pilkington added a comment.

Ping! This doesn't really affect CUDA or OpenCL more than any change to the 
compiler, so I don't think it makes sense to block this until we hear from them.


Repository:
  rC Clang

https://reviews.llvm.org/D52339



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D52434: [OpenMP] Make default distribute schedule for NVPTX target regions in SPMD mode achieve coalescing

2018-09-28 Thread Gheorghe-Teodor Bercea via Phabricator via cfe-commits
gtbercea added a comment.

In https://reviews.llvm.org/D52434#1249186, @Hahnfeld wrote:

> In https://reviews.llvm.org/D52434#1249102, @gtbercea wrote:
>
> > You report a slow down which I am not able to reproduce actually. Do you 
> > use any additional clauses not present in your previous post?
>
>
> No, only `dist_schedule(static)` which is faster. Tested on a `Tesla P100` 
> with today's trunk version:
>
> | `#pragma omp target teams distribute parallel for` (new defaults) | 
> 190 - 250 GB/s |
> | adding clauses for old defaults: `schedule(static) dist_schedule(static)` | 
> 30 - 50 GB/s   |
> | same directive with only `dist_schedule(static)` added (fewer registers)  | 
> 320 - 400 GB/s |
> |


Which loop size you're using ? What runtime does nvprof report for these 
kernels?


Repository:
  rC Clang

https://reviews.llvm.org/D52434



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D52660: [CMake][Fuchsia] Use libc++ ABIv2 for Fuchsia toolchain

2018-09-28 Thread Roland McGrath via Phabricator via cfe-commits
mcgrathr accepted this revision.
mcgrathr added a comment.
This revision is now accepted and ready to land.

lgtm


Repository:
  rC Clang

https://reviews.llvm.org/D52660



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D52660: [CMake][Fuchsia] Use libc++ ABIv2 for Fuchsia toolchain

2018-09-28 Thread Petr Hosek via Phabricator via cfe-commits
phosek created this revision.
phosek added reviewers: mcgrathr, jakehehrlich.
Herald added subscribers: cfe-commits, mgorny.
Herald added a reviewer: EricWF.

We don't need to support legacy ABI and hence we can use the new one.


Repository:
  rC Clang

https://reviews.llvm.org/D52660

Files:
  clang/cmake/caches/Fuchsia-stage2.cmake


Index: clang/cmake/caches/Fuchsia-stage2.cmake
===
--- clang/cmake/caches/Fuchsia-stage2.cmake
+++ clang/cmake/caches/Fuchsia-stage2.cmake
@@ -57,6 +57,9 @@
   set(RUNTIMES_${target}-linux-gnu_LIBCXX_USE_COMPILER_RT ON CACHE BOOL "")
   set(RUNTIMES_${target}-linux-gnu_LIBCXX_ENABLE_SHARED OFF CACHE BOOL "")
   set(RUNTIMES_${target}-linux-gnu_LIBCXX_ENABLE_STATIC_ABI_LIBRARY ON 
CACHE BOOL "")
+  set(RUNTIMES_${target}-linux-gnu_LIBCXX_ABI_VERSION 2 ON CACHE STRING "")
+  # TODO: this is a workaround for PR39053 which was uncovered by D50652.
+  set(RUNTIMES_${target}-linux-gnu_LIBCXX_HIDE_FROM_ABI_PER_TU_BY_DEFAULT 
ON CACHE BOOL "")
   set(RUNTIMES_${target}-linux-gnu_SANITIZER_CXX_ABI "libc++" CACHE STRING 
"")
   set(RUNTIMES_${target}-linux-gnu_SANITIZER_CXX_ABI_INTREE ON CACHE BOOL 
"")
   set(RUNTIMES_${target}-linux-gnu_COMPILER_RT_USE_BUILTINS_LIBRARY ON 
CACHE BOOL "")
@@ -109,6 +112,7 @@
 set(RUNTIMES_${target}-fuchsia_LIBCXX_USE_COMPILER_RT ON CACHE BOOL "")
 set(RUNTIMES_${target}-fuchsia_LIBCXX_ENABLE_STATIC_ABI_LIBRARY ON CACHE 
BOOL "")
 
set(RUNTIMES_${target}-fuchsia_LIBCXX_STATICALLY_LINK_ABI_IN_SHARED_LIBRARY OFF 
CACHE BOOL "")
+set(RUNTIMES_${target}-fuchsia_LIBCXX_ABI_VERSION 2 ON CACHE STRING "")
 # TODO: this is a workaround for PR39053 which was uncovered by D50652.
 set(RUNTIMES_${target}-fuchsia_LIBCXX_HIDE_FROM_ABI_PER_TU_BY_DEFAULT ON 
CACHE BOOL "")
   endforeach()


Index: clang/cmake/caches/Fuchsia-stage2.cmake
===
--- clang/cmake/caches/Fuchsia-stage2.cmake
+++ clang/cmake/caches/Fuchsia-stage2.cmake
@@ -57,6 +57,9 @@
   set(RUNTIMES_${target}-linux-gnu_LIBCXX_USE_COMPILER_RT ON CACHE BOOL "")
   set(RUNTIMES_${target}-linux-gnu_LIBCXX_ENABLE_SHARED OFF CACHE BOOL "")
   set(RUNTIMES_${target}-linux-gnu_LIBCXX_ENABLE_STATIC_ABI_LIBRARY ON CACHE BOOL "")
+  set(RUNTIMES_${target}-linux-gnu_LIBCXX_ABI_VERSION 2 ON CACHE STRING "")
+  # TODO: this is a workaround for PR39053 which was uncovered by D50652.
+  set(RUNTIMES_${target}-linux-gnu_LIBCXX_HIDE_FROM_ABI_PER_TU_BY_DEFAULT ON CACHE BOOL "")
   set(RUNTIMES_${target}-linux-gnu_SANITIZER_CXX_ABI "libc++" CACHE STRING "")
   set(RUNTIMES_${target}-linux-gnu_SANITIZER_CXX_ABI_INTREE ON CACHE BOOL "")
   set(RUNTIMES_${target}-linux-gnu_COMPILER_RT_USE_BUILTINS_LIBRARY ON CACHE BOOL "")
@@ -109,6 +112,7 @@
 set(RUNTIMES_${target}-fuchsia_LIBCXX_USE_COMPILER_RT ON CACHE BOOL "")
 set(RUNTIMES_${target}-fuchsia_LIBCXX_ENABLE_STATIC_ABI_LIBRARY ON CACHE BOOL "")
 set(RUNTIMES_${target}-fuchsia_LIBCXX_STATICALLY_LINK_ABI_IN_SHARED_LIBRARY OFF CACHE BOOL "")
+set(RUNTIMES_${target}-fuchsia_LIBCXX_ABI_VERSION 2 ON CACHE STRING "")
 # TODO: this is a workaround for PR39053 which was uncovered by D50652.
 set(RUNTIMES_${target}-fuchsia_LIBCXX_HIDE_FROM_ABI_PER_TU_BY_DEFAULT ON CACHE BOOL "")
   endforeach()
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D52400: Improve -Wshadow warnings with enumerators

2018-09-28 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments.



Comment at: lib/Sema/SemaDecl.cpp:16320
+// Check for other kinds of shadowing not already handled.
+CheckShadow(New, PrevDecl, R);
+

erik.pilkington wrote:
> I don't think we should do this for scoped enums in C++, i.e. this should be 
> fine:
> ```
> int Foo;
> enum class X { Foo };
> ```
> 
> Can you enclose this in `if (!TheEnumDecl->isScoped())` and add a test? Other 
> than that, LGTM!
Thanks, that's a great point! I've corrected in an updated patch.


https://reviews.llvm.org/D52400



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D52400: Improve -Wshadow warnings with enumerators

2018-09-28 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman updated this revision to Diff 167507.
aaron.ballman marked an inline comment as done.
aaron.ballman added a comment.

Updating based on review feedback.


https://reviews.llvm.org/D52400

Files:
  lib/Sema/SemaDecl.cpp
  test/Sema/warn-shadow.c
  test/SemaCXX/warn-shadow.cpp


Index: test/SemaCXX/warn-shadow.cpp
===
--- test/SemaCXX/warn-shadow.cpp
+++ test/SemaCXX/warn-shadow.cpp
@@ -222,3 +222,6 @@
   };
 }
 }
+
+int PR24718;
+enum class X { PR24718 }; // Ok, not shadowing
Index: test/Sema/warn-shadow.c
===
--- test/Sema/warn-shadow.c
+++ test/Sema/warn-shadow.c
@@ -59,3 +59,8 @@
 void test8() {
   int bob; // expected-warning {{declaration shadows a variable in the global 
scope}}
 }
+
+enum PR24718_1{pr24718}; // expected-note {{previous declaration is here}}
+void PR24718(void) {
+  enum PR24718_2{pr24718}; // expected-warning {{declaration shadows a 
variable in the global scope}}
+}
Index: lib/Sema/SemaDecl.cpp
===
--- lib/Sema/SemaDecl.cpp
+++ lib/Sema/SemaDecl.cpp
@@ -16290,8 +16290,10 @@
 
   // Verify that there isn't already something declared with this name in this
   // scope.
-  NamedDecl *PrevDecl = LookupSingleName(S, Id, IdLoc, LookupOrdinaryName,
- ForVisibleRedeclaration);
+  LookupResult R(*this, Id, IdLoc, LookupOrdinaryName, 
ForVisibleRedeclaration);
+  LookupName(R, S);
+  NamedDecl *PrevDecl = R.getAsSingle();
+
   if (PrevDecl && PrevDecl->isTemplateParameter()) {
 // Maybe we will complain about the shadowed template parameter.
 DiagnoseTemplateParameterShadow(IdLoc, PrevDecl);
@@ -16314,6 +16316,11 @@
 return nullptr;
 
   if (PrevDecl) {
+if (!TheEnumDecl->isScoped()) {
+  // Check for other kinds of shadowing not already handled.
+  CheckShadow(New, PrevDecl, R);
+}
+
 // When in C++, we may get a TagDecl with the same name; in this case the
 // enum constant will 'hide' the tag.
 assert((getLangOpts().CPlusPlus || !isa(PrevDecl)) &&


Index: test/SemaCXX/warn-shadow.cpp
===
--- test/SemaCXX/warn-shadow.cpp
+++ test/SemaCXX/warn-shadow.cpp
@@ -222,3 +222,6 @@
   };
 }
 }
+
+int PR24718;
+enum class X { PR24718 }; // Ok, not shadowing
Index: test/Sema/warn-shadow.c
===
--- test/Sema/warn-shadow.c
+++ test/Sema/warn-shadow.c
@@ -59,3 +59,8 @@
 void test8() {
   int bob; // expected-warning {{declaration shadows a variable in the global scope}}
 }
+
+enum PR24718_1{pr24718}; // expected-note {{previous declaration is here}}
+void PR24718(void) {
+  enum PR24718_2{pr24718}; // expected-warning {{declaration shadows a variable in the global scope}}
+}
Index: lib/Sema/SemaDecl.cpp
===
--- lib/Sema/SemaDecl.cpp
+++ lib/Sema/SemaDecl.cpp
@@ -16290,8 +16290,10 @@
 
   // Verify that there isn't already something declared with this name in this
   // scope.
-  NamedDecl *PrevDecl = LookupSingleName(S, Id, IdLoc, LookupOrdinaryName,
- ForVisibleRedeclaration);
+  LookupResult R(*this, Id, IdLoc, LookupOrdinaryName, ForVisibleRedeclaration);
+  LookupName(R, S);
+  NamedDecl *PrevDecl = R.getAsSingle();
+
   if (PrevDecl && PrevDecl->isTemplateParameter()) {
 // Maybe we will complain about the shadowed template parameter.
 DiagnoseTemplateParameterShadow(IdLoc, PrevDecl);
@@ -16314,6 +16316,11 @@
 return nullptr;
 
   if (PrevDecl) {
+if (!TheEnumDecl->isScoped()) {
+  // Check for other kinds of shadowing not already handled.
+  CheckShadow(New, PrevDecl, R);
+}
+
 // When in C++, we may get a TagDecl with the same name; in this case the
 // enum constant will 'hide' the tag.
 assert((getLangOpts().CPlusPlus || !isa(PrevDecl)) &&
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r343343 - [X86] Add the movbe instruction intrinsics from icc.

2018-09-28 Thread Craig Topper via cfe-commits
Author: ctopper
Date: Fri Sep 28 10:09:51 2018
New Revision: 343343

URL: http://llvm.org/viewvc/llvm-project?rev=343343=rev
Log:
[X86] Add the movbe instruction intrinsics from icc.

These intrinsics exist in icc. They can be found on the Intel Intrinsics Guide 
website.

All the backend support is in place to pattern match a load+bswap or a 
bswap+store pattern to the MOVBE instructions. So we just need to get the 
frontend to emit the correct IR. The pointer arguments in icc are declared as 
void so I had to jump through a packed struct to forcing a specific alignment 
on the load/store. Same trick we use in the unaligned vector load/store 
intrinsics

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

Added:
cfe/trunk/test/CodeGen/movbe-builtins.c   (with props)
Modified:
cfe/trunk/lib/Basic/Targets/X86.cpp
cfe/trunk/lib/Headers/immintrin.h
cfe/trunk/test/Preprocessor/predefined-arch-macros.c

Modified: cfe/trunk/lib/Basic/Targets/X86.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/X86.cpp?rev=343343=343342=343343=diff
==
--- cfe/trunk/lib/Basic/Targets/X86.cpp (original)
+++ cfe/trunk/lib/Basic/Targets/X86.cpp Fri Sep 28 10:09:51 2018
@@ -1081,6 +1081,9 @@ void X86TargetInfo::getTargetDefines(con
   if (HasMWAITX)
 Builder.defineMacro("__MWAITX__");
 
+  if (HasMOVBE)
+Builder.defineMacro("__MOVBE__");
+
   switch (XOPLevel) {
   case XOP:
 Builder.defineMacro("__XOP__");

Modified: cfe/trunk/lib/Headers/immintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/immintrin.h?rev=343343=343342=343343=diff
==
--- cfe/trunk/lib/Headers/immintrin.h (original)
+++ cfe/trunk/lib/Headers/immintrin.h Fri Sep 28 10:09:51 2018
@@ -306,6 +306,65 @@ _writegsbase_u64(unsigned long long __V)
 #endif
 #endif /* __FSGSBASE__ */
 
+#if !defined(_MSC_VER) || __has_feature(modules) || defined(__MOVBE__)
+
+/* The structs used below are to force the load/store to be unaligned. This
+ * is accomplished with the __packed__ attribute. The __may_alias__ prevents
+ * tbaa metadata from being generated based on the struct and the type of the
+ * field inside of it.
+ */
+
+static __inline__ short __attribute__((__always_inline__, __nodebug__, 
__target__("movbe")))
+_loadbe_i16(void const * __P) {
+  struct __loadu_i16 {
+short __v;
+  } __attribute__((__packed__, __may_alias__));
+  return __builtin_bswap16(((struct __loadu_i16*)__P)->__v);
+}
+
+static __inline__ void __attribute__((__always_inline__, __nodebug__, 
__target__("movbe")))
+_storebe_i16(void * __P, short __D) {
+  struct __storeu_i16 {
+short __v;
+  } __attribute__((__packed__, __may_alias__));
+  ((struct __storeu_i16*)__P)->__v = __builtin_bswap16(__D);
+}
+
+static __inline__ int __attribute__((__always_inline__, __nodebug__, 
__target__("movbe")))
+_loadbe_i32(void const * __P) {
+  struct __loadu_i32 {
+int __v;
+  } __attribute__((__packed__, __may_alias__));
+  return __builtin_bswap32(((struct __loadu_i32*)__P)->__v);
+}
+
+static __inline__ void __attribute__((__always_inline__, __nodebug__, 
__target__("movbe")))
+_storebe_i32(void * __P, int __D) {
+  struct __storeu_i32 {
+int __v;
+  } __attribute__((__packed__, __may_alias__));
+  ((struct __storeu_i32*)__P)->__v = __builtin_bswap32(__D);
+}
+
+#ifdef __x86_64__
+static __inline__ long long __attribute__((__always_inline__, __nodebug__, 
__target__("movbe")))
+_loadbe_i64(void const * __P) {
+  struct __loadu_i64 {
+long long __v;
+  } __attribute__((__packed__, __may_alias__));
+  return __builtin_bswap64(((struct __loadu_i64*)__P)->__v);
+}
+
+static __inline__ void __attribute__((__always_inline__, __nodebug__, 
__target__("movbe")))
+_storebe_i64(void * __P, long long __D) {
+  struct __storeu_i64 {
+long long __v;
+  } __attribute__((__packed__, __may_alias__));
+  ((struct __storeu_i64*)__P)->__v = __builtin_bswap64(__D);
+}
+#endif
+#endif /* __MOVBE */
+
 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__RTM__)
 #include 
 #include 

Added: cfe/trunk/test/CodeGen/movbe-builtins.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/movbe-builtins.c?rev=343343=auto
==
--- cfe/trunk/test/CodeGen/movbe-builtins.c (added)
+++ cfe/trunk/test/CodeGen/movbe-builtins.c Fri Sep 28 10:09:51 2018
@@ -0,0 +1,49 @@
+// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-apple-darwin 
-target-feature +movbe -emit-llvm -o - | FileCheck %s 
--check-prefixes=CHECK,CHECK-X64
+// RUN: %clang_cc1 -ffreestanding %s -triple=i686-apple-darwin -target-feature 
+movbe -emit-llvm -o - | FileCheck %s
+
+
+#include 
+
+short test_loadbe_i16(const short *P) {
+  // CHECK-LABEL: @test_loadbe_i16
+  // CHECK: [[LOAD:%.*]] = load i16, i16* %{{.*}}, align 1
+  // CHECK: call i16 

[PATCH] D52586: [X86] Add the movbe instruction intrinsics from icc.

2018-09-28 Thread Phabricator via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL343343: [X86] Add the movbe instruction intrinsics from icc. 
(authored by ctopper, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D52586?vs=167416=167506#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D52586

Files:
  cfe/trunk/lib/Basic/Targets/X86.cpp
  cfe/trunk/lib/Headers/immintrin.h
  cfe/trunk/test/CodeGen/movbe-builtins.c
  cfe/trunk/test/Preprocessor/predefined-arch-macros.c

Index: cfe/trunk/test/CodeGen/movbe-builtins.c
===
--- cfe/trunk/test/CodeGen/movbe-builtins.c
+++ cfe/trunk/test/CodeGen/movbe-builtins.c
@@ -0,0 +1,49 @@
+// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +movbe -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK,CHECK-X64
+// RUN: %clang_cc1 -ffreestanding %s -triple=i686-apple-darwin -target-feature +movbe -emit-llvm -o - | FileCheck %s
+
+
+#include 
+
+short test_loadbe_i16(const short *P) {
+  // CHECK-LABEL: @test_loadbe_i16
+  // CHECK: [[LOAD:%.*]] = load i16, i16* %{{.*}}, align 1
+  // CHECK: call i16 @llvm.bswap.i16(i16 [[LOAD]])
+  return _loadbe_i16(P);
+}
+
+void test_storebe_i16(short *P, short D) {
+  // CHECK-LABEL: @test_storebe_i16
+  // CHECK: [[DATA:%.*]] = call i16 @llvm.bswap.i16(i16 %{{.*}})
+  // CHECK: store i16 [[DATA]], i16* %{{.*}}, align 1
+  _storebe_i16(P, D);
+}
+
+int test_loadbe_i32(const int *P) {
+  // CHECK-LABEL: @test_loadbe_i32
+  // CHECK: [[LOAD:%.*]] = load i32, i32* %{{.*}}, align 1
+  // CHECK: call i32 @llvm.bswap.i32(i32 [[LOAD]])
+  return _loadbe_i32(P);
+}
+
+void test_storebe_i32(int *P, int D) {
+  // CHECK-LABEL: @test_storebe_i32
+  // CHECK: [[DATA:%.*]] = call i32 @llvm.bswap.i32(i32 %{{.*}})
+  // CHECK: store i32 [[DATA]], i32* %{{.*}}, align 1
+  _storebe_i32(P, D);
+}
+
+#ifdef __x86_64__
+long long test_loadbe_i64(const long long *P) {
+  // CHECK-X64-LABEL: @test_loadbe_i64
+  // CHECK-X64: [[LOAD:%.*]] = load i64, i64* %{{.*}}, align 1
+  // CHECK-X64: call i64 @llvm.bswap.i64(i64 [[LOAD]])
+  return _loadbe_i64(P);
+}
+
+void test_storebe_i64(long long *P, long long D) {
+  // CHECK-X64-LABEL: @test_storebe_i64
+  // CHECK-X64: [[DATA:%.*]] = call i64 @llvm.bswap.i64(i64 %{{.*}})
+  // CHECK-X64: store i64 [[DATA]], i64* %{{.*}}, align 1
+  _storebe_i64(P, D);
+}
+#endif
Index: cfe/trunk/test/Preprocessor/predefined-arch-macros.c
===
--- cfe/trunk/test/Preprocessor/predefined-arch-macros.c
+++ cfe/trunk/test/Preprocessor/predefined-arch-macros.c
@@ -524,6 +524,7 @@
 // CHECK_CORE_AVX2_M32: #define __INVPCID__ 1
 // CHECK_CORE_AVX2_M32: #define __LZCNT__ 1
 // CHECK_CORE_AVX2_M32: #define __MMX__ 1
+// CHECK_CORE_AVX2_M32: #define __MOVBE__ 1
 // CHECK_CORE_AVX2_M32: #define __PCLMUL__ 1
 // CHECK_CORE_AVX2_M32: #define __POPCNT__ 1
 // CHECK_CORE_AVX2_M32: #define __RDRND__ 1
@@ -554,6 +555,7 @@
 // CHECK_CORE_AVX2_M64: #define __INVPCID__ 1
 // CHECK_CORE_AVX2_M64: #define __LZCNT__ 1
 // CHECK_CORE_AVX2_M64: #define __MMX__ 1
+// CHECK_CORE_AVX2_M64: #define __MOVBE__ 1
 // CHECK_CORE_AVX2_M64: #define __PCLMUL__ 1
 // CHECK_CORE_AVX2_M64: #define __POPCNT__ 1
 // CHECK_CORE_AVX2_M64: #define __RDRND__ 1
@@ -588,6 +590,7 @@
 // CHECK_BROADWELL_M32: #define __INVPCID__ 1
 // CHECK_BROADWELL_M32: #define __LZCNT__ 1
 // CHECK_BROADWELL_M32: #define __MMX__ 1
+// CHECK_BROADWELL_M32: #define __MOVBE__ 1
 // CHECK_BROADWELL_M32: #define __PCLMUL__ 1
 // CHECK_BROADWELL_M32: #define __POPCNT__ 1
 // CHECK_BROADWELL_M32: #define __PRFCHW__ 1
@@ -621,6 +624,7 @@
 // CHECK_BROADWELL_M64: #define __INVPCID__ 1
 // CHECK_BROADWELL_M64: #define __LZCNT__ 1
 // CHECK_BROADWELL_M64: #define __MMX__ 1
+// CHECK_BROADWELL_M64: #define __MOVBE__ 1
 // CHECK_BROADWELL_M64: #define __PCLMUL__ 1
 // CHECK_BROADWELL_M64: #define __POPCNT__ 1
 // CHECK_BROADWELL_M64: #define __PRFCHW__ 1
@@ -659,6 +663,7 @@
 // CHECK_SKL_M32: #define __INVPCID__ 1
 // CHECK_SKL_M32: #define __LZCNT__ 1
 // CHECK_SKL_M32: #define __MMX__ 1
+// CHECK_SKL_M32: #define __MOVBE__ 1
 // CHECK_SKL_M32: #define __MPX__ 1
 // CHECK_SKL_M32: #define __PCLMUL__ 1
 // CHECK_SKL_M32: #define __POPCNT__ 1
@@ -694,6 +699,7 @@
 // CHECK_SKL_M64: #define __INVPCID__ 1
 // CHECK_SKL_M64: #define __LZCNT__ 1
 // CHECK_SKL_M64: #define __MMX__ 1
+// CHECK_SKL_M64: #define __MOVBE__ 1
 // CHECK_SKL_M64: #define __MPX__ 1
 // CHECK_SKL_M64: #define __PCLMUL__ 1
 // CHECK_SKL_M64: #define __POPCNT__ 1
@@ -735,6 +741,7 @@
 // CHECK_KNL_M32: #define __FMA__ 1
 // CHECK_KNL_M32: #define __LZCNT__ 1
 // CHECK_KNL_M32: #define __MMX__ 1
+// CHECK_KNL_M32: #define __MOVBE__ 1
 // CHECK_KNL_M32: #define __PCLMUL__ 1
 // CHECK_KNL_M32: #define __POPCNT__ 1
 // CHECK_KNL_M32: #define __PREFETCHWT1__ 1
@@ -772,6 +779,7 @@
 // CHECK_KNL_M64: #define __FMA__ 1
 

[PATCH] D52586: [X86] Add the movbe instruction intrinsics from icc.

2018-09-28 Thread Phabricator via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rC343343: [X86] Add the movbe instruction intrinsics from icc. 
(authored by ctopper, committed by ).

Repository:
  rC Clang

https://reviews.llvm.org/D52586

Files:
  lib/Basic/Targets/X86.cpp
  lib/Headers/immintrin.h
  test/CodeGen/movbe-builtins.c
  test/Preprocessor/predefined-arch-macros.c

Index: test/CodeGen/movbe-builtins.c
===
--- test/CodeGen/movbe-builtins.c
+++ test/CodeGen/movbe-builtins.c
@@ -0,0 +1,49 @@
+// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +movbe -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK,CHECK-X64
+// RUN: %clang_cc1 -ffreestanding %s -triple=i686-apple-darwin -target-feature +movbe -emit-llvm -o - | FileCheck %s
+
+
+#include 
+
+short test_loadbe_i16(const short *P) {
+  // CHECK-LABEL: @test_loadbe_i16
+  // CHECK: [[LOAD:%.*]] = load i16, i16* %{{.*}}, align 1
+  // CHECK: call i16 @llvm.bswap.i16(i16 [[LOAD]])
+  return _loadbe_i16(P);
+}
+
+void test_storebe_i16(short *P, short D) {
+  // CHECK-LABEL: @test_storebe_i16
+  // CHECK: [[DATA:%.*]] = call i16 @llvm.bswap.i16(i16 %{{.*}})
+  // CHECK: store i16 [[DATA]], i16* %{{.*}}, align 1
+  _storebe_i16(P, D);
+}
+
+int test_loadbe_i32(const int *P) {
+  // CHECK-LABEL: @test_loadbe_i32
+  // CHECK: [[LOAD:%.*]] = load i32, i32* %{{.*}}, align 1
+  // CHECK: call i32 @llvm.bswap.i32(i32 [[LOAD]])
+  return _loadbe_i32(P);
+}
+
+void test_storebe_i32(int *P, int D) {
+  // CHECK-LABEL: @test_storebe_i32
+  // CHECK: [[DATA:%.*]] = call i32 @llvm.bswap.i32(i32 %{{.*}})
+  // CHECK: store i32 [[DATA]], i32* %{{.*}}, align 1
+  _storebe_i32(P, D);
+}
+
+#ifdef __x86_64__
+long long test_loadbe_i64(const long long *P) {
+  // CHECK-X64-LABEL: @test_loadbe_i64
+  // CHECK-X64: [[LOAD:%.*]] = load i64, i64* %{{.*}}, align 1
+  // CHECK-X64: call i64 @llvm.bswap.i64(i64 [[LOAD]])
+  return _loadbe_i64(P);
+}
+
+void test_storebe_i64(long long *P, long long D) {
+  // CHECK-X64-LABEL: @test_storebe_i64
+  // CHECK-X64: [[DATA:%.*]] = call i64 @llvm.bswap.i64(i64 %{{.*}})
+  // CHECK-X64: store i64 [[DATA]], i64* %{{.*}}, align 1
+  _storebe_i64(P, D);
+}
+#endif
Index: test/Preprocessor/predefined-arch-macros.c
===
--- test/Preprocessor/predefined-arch-macros.c
+++ test/Preprocessor/predefined-arch-macros.c
@@ -524,6 +524,7 @@
 // CHECK_CORE_AVX2_M32: #define __INVPCID__ 1
 // CHECK_CORE_AVX2_M32: #define __LZCNT__ 1
 // CHECK_CORE_AVX2_M32: #define __MMX__ 1
+// CHECK_CORE_AVX2_M32: #define __MOVBE__ 1
 // CHECK_CORE_AVX2_M32: #define __PCLMUL__ 1
 // CHECK_CORE_AVX2_M32: #define __POPCNT__ 1
 // CHECK_CORE_AVX2_M32: #define __RDRND__ 1
@@ -554,6 +555,7 @@
 // CHECK_CORE_AVX2_M64: #define __INVPCID__ 1
 // CHECK_CORE_AVX2_M64: #define __LZCNT__ 1
 // CHECK_CORE_AVX2_M64: #define __MMX__ 1
+// CHECK_CORE_AVX2_M64: #define __MOVBE__ 1
 // CHECK_CORE_AVX2_M64: #define __PCLMUL__ 1
 // CHECK_CORE_AVX2_M64: #define __POPCNT__ 1
 // CHECK_CORE_AVX2_M64: #define __RDRND__ 1
@@ -588,6 +590,7 @@
 // CHECK_BROADWELL_M32: #define __INVPCID__ 1
 // CHECK_BROADWELL_M32: #define __LZCNT__ 1
 // CHECK_BROADWELL_M32: #define __MMX__ 1
+// CHECK_BROADWELL_M32: #define __MOVBE__ 1
 // CHECK_BROADWELL_M32: #define __PCLMUL__ 1
 // CHECK_BROADWELL_M32: #define __POPCNT__ 1
 // CHECK_BROADWELL_M32: #define __PRFCHW__ 1
@@ -621,6 +624,7 @@
 // CHECK_BROADWELL_M64: #define __INVPCID__ 1
 // CHECK_BROADWELL_M64: #define __LZCNT__ 1
 // CHECK_BROADWELL_M64: #define __MMX__ 1
+// CHECK_BROADWELL_M64: #define __MOVBE__ 1
 // CHECK_BROADWELL_M64: #define __PCLMUL__ 1
 // CHECK_BROADWELL_M64: #define __POPCNT__ 1
 // CHECK_BROADWELL_M64: #define __PRFCHW__ 1
@@ -659,6 +663,7 @@
 // CHECK_SKL_M32: #define __INVPCID__ 1
 // CHECK_SKL_M32: #define __LZCNT__ 1
 // CHECK_SKL_M32: #define __MMX__ 1
+// CHECK_SKL_M32: #define __MOVBE__ 1
 // CHECK_SKL_M32: #define __MPX__ 1
 // CHECK_SKL_M32: #define __PCLMUL__ 1
 // CHECK_SKL_M32: #define __POPCNT__ 1
@@ -694,6 +699,7 @@
 // CHECK_SKL_M64: #define __INVPCID__ 1
 // CHECK_SKL_M64: #define __LZCNT__ 1
 // CHECK_SKL_M64: #define __MMX__ 1
+// CHECK_SKL_M64: #define __MOVBE__ 1
 // CHECK_SKL_M64: #define __MPX__ 1
 // CHECK_SKL_M64: #define __PCLMUL__ 1
 // CHECK_SKL_M64: #define __POPCNT__ 1
@@ -735,6 +741,7 @@
 // CHECK_KNL_M32: #define __FMA__ 1
 // CHECK_KNL_M32: #define __LZCNT__ 1
 // CHECK_KNL_M32: #define __MMX__ 1
+// CHECK_KNL_M32: #define __MOVBE__ 1
 // CHECK_KNL_M32: #define __PCLMUL__ 1
 // CHECK_KNL_M32: #define __POPCNT__ 1
 // CHECK_KNL_M32: #define __PREFETCHWT1__ 1
@@ -772,6 +779,7 @@
 // CHECK_KNL_M64: #define __FMA__ 1
 // CHECK_KNL_M64: #define __LZCNT__ 1
 // CHECK_KNL_M64: #define __MMX__ 1
+// CHECK_KNL_M64: #define __MOVBE__ 1
 // CHECK_KNL_M64: #define __PCLMUL__ 1
 // CHECK_KNL_M64: #define __POPCNT__ 1
 // CHECK_KNL_M64: #define 

r343338 - AST: add missing ObjC extensions to MS style name decoration

2018-09-28 Thread Saleem Abdulrasool via cfe-commits
Author: compnerd
Date: Fri Sep 28 09:47:53 2018
New Revision: 343338

URL: http://llvm.org/viewvc/llvm-project?rev=343338=rev
Log:
AST: add missing ObjC extensions to MS style name decoration

Add support for encoding type arguments for lightweight generics in
Objective-C++ mode.  Additionally, add support for the `__kindof` modifier.
This should complete the coverage of the ObjC extensions that clang currently
supports under the MS style name decoration scheme.

This is implemented similar to the Objective-C lifetime qualifiers decoration:
a template specialization in the `__ObjC` namespace so that we can interoperate
with Microsoft's tools as well as ensure that we do not accidentally collide
with new features in the Microsoft implementation.

Since the `__kindof` appertains to the type and not the pointer, we apply the
template specialization to the underlying type instead of the pointer type.

Unfortunately, until D52581 is resolved, the generated name is not really
compatible with the MS tools as well as breaks interoperability with
Objective-C++ and C++.

This resolves PR37754!

Modified:
cfe/trunk/lib/AST/MicrosoftMangle.cpp
cfe/trunk/test/CodeGenObjCXX/msabi-objc-extensions.mm

Modified: cfe/trunk/lib/AST/MicrosoftMangle.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/MicrosoftMangle.cpp?rev=343338=343337=343338=diff
==
--- cfe/trunk/lib/AST/MicrosoftMangle.cpp (original)
+++ cfe/trunk/lib/AST/MicrosoftMangle.cpp Fri Sep 28 09:47:53 2018
@@ -375,6 +375,8 @@ private:
   void mangleObjCProtocol(const ObjCProtocolDecl *PD);
   void mangleObjCLifetime(const QualType T, Qualifiers Quals,
   SourceRange Range);
+  void mangleObjCKindOfType(const ObjCObjectType *T, Qualifiers Quals,
+SourceRange Range);
 };
 }
 
@@ -1553,6 +1555,23 @@ void MicrosoftCXXNameMangler::mangleObjC
   mangleArtificalTagType(TTK_Struct, TemplateMangling, {"__ObjC"});
 }
 
+void MicrosoftCXXNameMangler::mangleObjCKindOfType(const ObjCObjectType *T,
+   Qualifiers Quals,
+   SourceRange Range) {
+  llvm::SmallString<64> TemplateMangling;
+  llvm::raw_svector_ostream Stream(TemplateMangling);
+  MicrosoftCXXNameMangler Extra(Context, Stream);
+
+  Stream << "?$";
+  Extra.mangleSourceName("KindOf");
+  Extra.mangleType(QualType(T, 0)
+   .stripObjCKindOfType(getASTContext())
+   ->getAs(),
+   Quals, Range);
+
+  mangleArtificalTagType(TTK_Struct, TemplateMangling, {"__ObjC"});
+}
+
 void MicrosoftCXXNameMangler::mangleQualifiers(Qualifiers Quals,
bool IsMember) {
   //  ::= [E] [F] [I] 
@@ -2624,9 +2643,12 @@ void MicrosoftCXXNameMangler::mangleType
   mangle(T->getDecl(), ".objc_cls_");
 }
 
-void MicrosoftCXXNameMangler::mangleType(const ObjCObjectType *T, Qualifiers,
- SourceRange Range) {
-  if (T->qual_empty())
+void MicrosoftCXXNameMangler::mangleType(const ObjCObjectType *T,
+ Qualifiers Quals, SourceRange Range) {
+  if (T->isKindOfType())
+return mangleObjCKindOfType(T, Quals, Range);
+
+  if (T->qual_empty() && !T->isSpecialized())
 return mangleType(T->getBaseType(), Range, QMM_Drop);
 
   ArgBackRefMap OuterArgsContext;
@@ -2647,6 +2669,11 @@ void MicrosoftCXXNameMangler::mangleType
 
   for (const auto  : T->quals())
 mangleObjCProtocol(Q);
+
+  if (T->isSpecialized())
+for (const auto  : T->getTypeArgs())
+  mangleType(TA, Range, QMM_Drop);
+
   Out << '@';
 
   Out << '@';

Modified: cfe/trunk/test/CodeGenObjCXX/msabi-objc-extensions.mm
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjCXX/msabi-objc-extensions.mm?rev=343338=343337=343338=diff
==
--- cfe/trunk/test/CodeGenObjCXX/msabi-objc-extensions.mm (original)
+++ cfe/trunk/test/CodeGenObjCXX/msabi-objc-extensions.mm Fri Sep 28 09:47:53 
2018
@@ -4,6 +4,7 @@
 @protocol Q;
 
 @class I;
+@class J;
 
 void f(id, id, id, id) {}
 // CHECK-LABEL: 
"?f@@YAXPAU?$.objc_object@U?$Protocol@UP@@@__ObjCPAU.objc_object@@01@Z"
@@ -64,3 +65,34 @@ S<__autoreleasing id> g() { return S<__a
 
 __autoreleasing id h() { return nullptr; }
 // CHECK-LABEL: "?h@@YAPAU.objc_object@@XZ"
+
+void f(I *) {}
+// CHECK-LABEL: "?f@@YAXPAU.objc_cls_I@@@Z"
+
+void f(__kindof I *) {}
+// CHECK-LABEL: "?f@@YAXPAU?$KindOf@U.objc_cls_I@@@__ObjC@@@Z"
+
+void f(__kindof I *) {}
+// CHECK-LABEL: 
"?f@@YAXPAU?$KindOf@U?$.objc_cls_I@U?$Protocol@UP@@@__ObjC@__ObjC@@@Z"
+
+void f(S) {}
+// CHECK-LABEL: "?f@@YAXU?$S@U?$Strong@PAU.objc_cls_I@@@__ObjC@Z"
+
+void f(S<__kindof I *>) {}
+// CHECK-LABEL: 

[PATCH] D52400: Improve -Wshadow warnings with enumerators

2018-09-28 Thread Erik Pilkington via Phabricator via cfe-commits
erik.pilkington added inline comments.



Comment at: lib/Sema/SemaDecl.cpp:16320
+// Check for other kinds of shadowing not already handled.
+CheckShadow(New, PrevDecl, R);
+

I don't think we should do this for scoped enums in C++, i.e. this should be 
fine:
```
int Foo;
enum class X { Foo };
```

Can you enclose this in `if (!TheEnumDecl->isScoped())` and add a test? Other 
than that, LGTM!


https://reviews.llvm.org/D52400



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D52384: [Sema] Fix redeclaration contexts for enumerators in C

2018-09-28 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments.



Comment at: lib/AST/DeclBase.cpp:1711-1712
+  // contexts are always skipped.
+  while (SkipRecords ? Ctx->isTransparentContext() || Ctx->isRecord()
+ : Ctx->isTransparentContext())
 Ctx = Ctx->getParent();

majnemer wrote:
> Seems simpler as:
>   while ((SkipRecords && Ctx->isRecord()) || Ctx->isTransparentContext())
Agreed; I've changed it.


https://reviews.llvm.org/D52384



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r343335 - [DRIVER][OFFLOAD] Do not invoke unbundler on unsupported file types.

2018-09-28 Thread Alexey Bataev via cfe-commits
Author: abataev
Date: Fri Sep 28 09:17:59 2018
New Revision: 343335

URL: http://llvm.org/viewvc/llvm-project?rev=343335=rev
Log:
[DRIVER][OFFLOAD] Do not invoke unbundler on unsupported file types.

clang-offload-bundler should not be invoked with the unbundling action
when the input file type does not match the action type. For example,
.so files should be unbundled during linking phase and should be linked
only with the host code.

Added:
cfe/trunk/test/Driver/Inputs/in.so
Modified:
cfe/trunk/lib/Driver/Driver.cpp
cfe/trunk/test/Driver/openmp-offload-gpu.c
cfe/trunk/test/Driver/openmp-offload.c

Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=343335=343334=343335=diff
==
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Fri Sep 28 09:17:59 2018
@@ -2568,6 +2568,8 @@ class OffloadingActionBuilder final {
 getDeviceDependences(OffloadAction::DeviceDependences ,
  phases::ID CurPhase, phases::ID FinalPhase,
  PhasesTy ) override {
+  if (OpenMPDeviceActions.empty())
+return ABRT_Inactive;
 
   // We should always have an action for each input.
   assert(OpenMPDeviceActions.size() == ToolChains.size() &&
@@ -2611,6 +2613,17 @@ class OffloadingActionBuilder final {
   // If this is an unbundling action use it as is for each OpenMP 
toolchain.
   if (auto *UA = dyn_cast(HostAction)) {
 OpenMPDeviceActions.clear();
+auto *IA = cast(UA->getInputs().back());
+std::string FileName = IA->getInputArg().getAsString(Args);
+// Check if the type of the file is the same as the action. Do not
+// unbundle it if it is not. Do not unbundle .so files, for example,
+// which are not object files.
+if (IA->getType() == types::TY_Object &&
+(!llvm::sys::path::has_extension(FileName) ||
+ types::lookupTypeForExtension(
+ llvm::sys::path::extension(FileName).drop_front()) !=
+ types::TY_Object))
+  return ABRT_Inactive;
 for (unsigned I = 0; I < ToolChains.size(); ++I) {
   OpenMPDeviceActions.push_back(UA);
   UA->registerDependentActionInfo(
@@ -2855,6 +2868,11 @@ public:
 OffloadKind |= SB->getAssociatedOffloadKind();
 }
 
+// Do not use unbundler if the Host does not depend on device action.
+if (OffloadKind == Action::OFK_None && CanUseBundler)
+  if (auto *UA = dyn_cast(HostAction))
+HostAction = UA->getInputs().back();
+
 return false;
   }
 

Added: cfe/trunk/test/Driver/Inputs/in.so
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/in.so?rev=343335=auto
==
--- cfe/trunk/test/Driver/Inputs/in.so (added)
+++ cfe/trunk/test/Driver/Inputs/in.so Fri Sep 28 09:17:59 2018
@@ -0,0 +1 @@
+

Modified: cfe/trunk/test/Driver/openmp-offload-gpu.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/openmp-offload-gpu.c?rev=343335=343334=343335=diff
==
--- cfe/trunk/test/Driver/openmp-offload-gpu.c (original)
+++ cfe/trunk/test/Driver/openmp-offload-gpu.c Fri Sep 28 09:17:59 2018
@@ -89,13 +89,15 @@
 /// Check cubin file unbundling and usage by nvlink
 // RUN:   touch %t.o
 // RUN:   %clang -### -target powerpc64le-unknown-linux-gnu -fopenmp=libomp 
-fopenmp-targets=nvptx64-nvidia-cuda \
-// RUN:  -no-canonical-prefixes -save-temps %t.o 2>&1 \
+// RUN:  -no-canonical-prefixes -save-temps %t.o %S/Inputs/in.so 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHK-CUBIN-UNBUNDLING-NVLINK %s
 
 /// Use DAG to ensure that cubin file has been unbundled.
+// CHK-CUBIN-UNBUNDLING-NVLINK-NOT: clang-offload-bundler{{.*}}" 
"-type=o"{{.*}}in.so
 // CHK-CUBIN-UNBUNDLING-NVLINK-DAG: nvlink{{.*}}" {{.*}}"[[CUBIN:.*\.cubin]]"
 // CHK-CUBIN-UNBUNDLING-NVLINK-DAG: clang-offload-bundler{{.*}}" "-type=o" 
{{.*}}"-outputs={{.*}}[[CUBIN]]
 // CHK-CUBIN-UNBUNDLING-NVLINK-DAG-SAME: "-unbundle"
+// CHK-CUBIN-UNBUNDLING-NVLINK-NOT: clang-offload-bundler{{.*}}" 
"-type=o"{{.*}}in.so
 
 /// ###
 

Modified: cfe/trunk/test/Driver/openmp-offload.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/openmp-offload.c?rev=343335=343334=343335=diff
==
--- cfe/trunk/test/Driver/openmp-offload.c (original)
+++ cfe/trunk/test/Driver/openmp-offload.c Fri Sep 28 09:17:59 2018
@@ -358,7 +358,7 @@
 /// ###
 
 /// Check separate compilation with offloading - bundling actions
-// RUN:   %clang -### 

[PATCH] D52658: [OpenCL] Remove PIPE_RESERVE_ID_VALID_BIT from the common header

2018-09-28 Thread Dmitry Sidorov via Phabricator via cfe-commits
sidorovd created this revision.
sidorovd added reviewers: Anastasia, yaxunl.
Herald added a subscriber: cfe-commits.

PIPE_RESERVE_ID_VALID_BIT is implementation defined, so lets not keep it in the 
header.

Previously the topic was discussed here: https://reviews.llvm.org/D32896


Repository:
  rC Clang

https://reviews.llvm.org/D52658

Files:
  lib/Headers/opencl-c.h


Index: lib/Headers/opencl-c.h
===
--- lib/Headers/opencl-c.h
+++ lib/Headers/opencl-c.h
@@ -15707,7 +15707,6 @@
 
 // OpenCL v2.0 s6.13.16 - Pipe Functions
 #if __OPENCL_C_VERSION__ >= CL_VERSION_2_0
-#define PIPE_RESERVE_ID_VALID_BIT (1U << 30)
 #define CLK_NULL_RESERVE_ID (__builtin_astype(((void*)(__SIZE_MAX__)), 
reserve_id_t))
 bool __ovld is_valid_reserve_id(reserve_id_t reserve_id);
 #endif //__OPENCL_C_VERSION__ >= CL_VERSION_2_0


Index: lib/Headers/opencl-c.h
===
--- lib/Headers/opencl-c.h
+++ lib/Headers/opencl-c.h
@@ -15707,7 +15707,6 @@
 
 // OpenCL v2.0 s6.13.16 - Pipe Functions
 #if __OPENCL_C_VERSION__ >= CL_VERSION_2_0
-#define PIPE_RESERVE_ID_VALID_BIT (1U << 30)
 #define CLK_NULL_RESERVE_ID (__builtin_astype(((void*)(__SIZE_MAX__)), reserve_id_t))
 bool __ovld is_valid_reserve_id(reserve_id_t reserve_id);
 #endif //__OPENCL_C_VERSION__ >= CL_VERSION_2_0
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D52384: [Sema] Fix redeclaration contexts for enumerators in C

2018-09-28 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman updated this revision to Diff 167496.
aaron.ballman marked an inline comment as done.
aaron.ballman added a comment.
Herald added a subscriber: jsji.

Updated based on review feedback.


https://reviews.llvm.org/D52384

Files:
  lib/AST/DeclBase.cpp
  test/Sema/enum.c


Index: test/Sema/enum.c
===
--- test/Sema/enum.c
+++ test/Sema/enum.c
@@ -135,3 +135,26 @@
   };
   int makeStructNonEmpty;
 };
+
+static int EnumRedecl; // expected-note 2 {{previous definition is here}}
+struct S {
+  enum {
+EnumRedecl = 4 // expected-error {{redefinition of 'EnumRedecl'}}
+  } e;
+};
+
+union U {
+  enum {
+EnumRedecl = 5 // expected-error {{redefinition of 'EnumRedecl'}}
+  } e;
+};
+
+enum PR15071 {
+  PR15071_One // expected-note {{previous definition is here}}
+};
+
+struct EnumRedeclStruct {
+  enum {
+PR15071_One // expected-error {{redefinition of enumerator 'PR15071_One'}}
+  } e;
+};
Index: lib/AST/DeclBase.cpp
===
--- lib/AST/DeclBase.cpp
+++ lib/AST/DeclBase.cpp
@@ -1700,8 +1700,15 @@
 
 DeclContext *DeclContext::getRedeclContext() {
   DeclContext *Ctx = this;
-  // Skip through transparent contexts.
-  while (Ctx->isTransparentContext())
+
+  // In C, the redeclaration context for enumerators is the translation unit,
+  // so we skip through transparent contexts as well as struct/union contexts.
+  bool SkipRecords = getDeclKind() == Decl::Kind::Enum &&
+ !getParentASTContext().getLangOpts().CPlusPlus;
+
+  // Skip through contexts to get to the redeclaration context. Transparent
+  // contexts are always skipped.
+  while ((SkipRecords && Ctx->isRecord()) || Ctx->isTransparentContext())
 Ctx = Ctx->getParent();
   return Ctx;
 }


Index: test/Sema/enum.c
===
--- test/Sema/enum.c
+++ test/Sema/enum.c
@@ -135,3 +135,26 @@
   };
   int makeStructNonEmpty;
 };
+
+static int EnumRedecl; // expected-note 2 {{previous definition is here}}
+struct S {
+  enum {
+EnumRedecl = 4 // expected-error {{redefinition of 'EnumRedecl'}}
+  } e;
+};
+
+union U {
+  enum {
+EnumRedecl = 5 // expected-error {{redefinition of 'EnumRedecl'}}
+  } e;
+};
+
+enum PR15071 {
+  PR15071_One // expected-note {{previous definition is here}}
+};
+
+struct EnumRedeclStruct {
+  enum {
+PR15071_One // expected-error {{redefinition of enumerator 'PR15071_One'}}
+  } e;
+};
Index: lib/AST/DeclBase.cpp
===
--- lib/AST/DeclBase.cpp
+++ lib/AST/DeclBase.cpp
@@ -1700,8 +1700,15 @@
 
 DeclContext *DeclContext::getRedeclContext() {
   DeclContext *Ctx = this;
-  // Skip through transparent contexts.
-  while (Ctx->isTransparentContext())
+
+  // In C, the redeclaration context for enumerators is the translation unit,
+  // so we skip through transparent contexts as well as struct/union contexts.
+  bool SkipRecords = getDeclKind() == Decl::Kind::Enum &&
+ !getParentASTContext().getLangOpts().CPlusPlus;
+
+  // Skip through contexts to get to the redeclaration context. Transparent
+  // contexts are always skipped.
+  while ((SkipRecords && Ctx->isRecord()) || Ctx->isTransparentContext())
 Ctx = Ctx->getParent();
   return Ctx;
 }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D51949: [clang-tidy] new check 'readability-isolate-declaration'

2018-09-28 Thread Jonas Toth via Phabricator via cfe-commits
JonasToth added inline comments.



Comment at: docs/clang-tidy/checks/readability-isolate-declaration.rst:33
+  for (int Begin = 0, End = 100; Begin < End; ++Begin);
+  it (int Begin = 42, Result = some_function(Begin); Begin == Result);
+

typo
mention `if () int i, j, k = function();` as well



Comment at: docs/clang-tidy/checks/readability-isolate-declaration.rst:87
+int Unconditional,
+#if CONFIGURATION
+IfConfigured = 42,

reduce indendation for PP directives


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D51949



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D51949: [clang-tidy] new check 'readability-isolate-declaration'

2018-09-28 Thread Jonas Toth via Phabricator via cfe-commits
JonasToth added a comment.

llvm and clang look fine as well. No miscompilation after fixing, tests run as 
well. (i do exclude all targets except x86 for build-speed)

F7327680: cfe_isolated_decl.patch 

F7327681: llvm_isolated_decl.patch 

From my side the functionality is complete. Thank you for the review and 
feedback so far!


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D51949



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D51949: [clang-tidy] new check 'readability-isolate-declaration'

2018-09-28 Thread Jonas Toth via Phabricator via cfe-commits
JonasToth updated this revision to Diff 167491.
JonasToth added a comment.
Herald added subscribers: jsji, kbarton, nemanjai.

- fix paren issue, introduced non-local changes i will extract and post in a 
separate patch
- remove debug output for paren search


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D51949

Files:
  clang-tidy/bugprone/ArgumentCommentCheck.cpp
  clang-tidy/bugprone/SuspiciousSemicolonCheck.cpp
  clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp
  clang-tidy/readability/CMakeLists.txt
  clang-tidy/readability/IsolateDeclarationCheck.cpp
  clang-tidy/readability/IsolateDeclarationCheck.h
  clang-tidy/readability/ReadabilityTidyModule.cpp
  clang-tidy/utils/FixItHintUtils.cpp
  clang-tidy/utils/LexerUtils.cpp
  clang-tidy/utils/LexerUtils.h
  docs/ReleaseNotes.rst
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/readability-isolate-declaration.rst
  test/clang-tidy/readability-isolate-declaration-cxx17.cpp
  test/clang-tidy/readability-isolate-declaration-fixing.cpp
  test/clang-tidy/readability-isolate-declaration.cpp

Index: test/clang-tidy/readability-isolate-declaration.cpp
===
--- /dev/null
+++ test/clang-tidy/readability-isolate-declaration.cpp
@@ -0,0 +1,404 @@
+// RUN: %check_clang_tidy %s readability-isolate-declaration %t
+
+void f() {
+  int i;
+}
+
+void f2() {
+  int i, j, *k, lala = 42;
+  // CHECK-MESSAGES: [[@LINE-1]]:3: warning: multiple declarations in a single statement reduces readability
+  // CHECK-FIXES: int i;
+  // CHECK-FIXES: {{^  }}int j;
+  // CHECK-FIXES: {{^  }}int *k;
+  // CHECK-FIXES: {{^  }}int lala = 42;
+
+  int normal, weird = /* comment */ 42;
+  // CHECK-MESSAGES: [[@LINE-1]]:3: warning: multiple declarations in a single statement reduces readability
+  // CHECK-FIXES: int normal;
+  // CHECK-FIXES: {{^  }}int weird = /* comment */ 42;
+
+  int /* here is a comment */ v1,
+  // another comment
+  v2 = 42 // Ok, more comments
+  ;
+  // CHECK-MESSAGES: [[@LINE-4]]:3: warning: multiple declarations in a single statement reduces readability
+  // CHECK-FIXES: int /* here is a comment */ v1;
+  // CHECK-FIXES: {{^  }}int /* here is a comment */ // another comment
+  // CHECK-FIXES: {{^  }}v2 = 42 // Ok, more comments
+  // CHECK-FIXES: {{^  }};
+
+  auto int1 = 42, int2 = 0, int3 = 43;
+  // CHECK-MESSAGES: [[@LINE-1]]:3: warning: multiple declarations in a single statement reduces readability
+  // CHECK-FIXES: auto int1 = 42;
+  // CHECK-FIXES: {{^  }}auto int2 = 0;
+  // CHECK-FIXES: {{^  }}auto int3 = 43;
+
+  decltype(auto) ptr1 = , ptr2 = 
+  // CHECK-MESSAGES: [[@LINE-1]]:3: warning: multiple declarations in a single statement reduces readability
+  // CHECK-FIXES: decltype(auto) ptr1 = 
+  // CHECK-FIXES: {{^  }}decltype(auto) ptr2 = 
+
+  decltype(k) ptr3 = , ptr4 = 
+  // CHECK-MESSAGES: [[@LINE-1]]:3: warning: multiple declarations in a single statement reduces readability
+  // CHECK-FIXES: decltype(k) ptr3 = 
+  // CHECK-FIXES: {{^  }}decltype(k) ptr4 = 
+}
+
+void f3() {
+  int i, *pointer1;
+  // CHECK-MESSAGES: [[@LINE-1]]:3: warning: multiple declarations in a single statement reduces readability
+  // CHECK-FIXES: int i;
+  // CHECK-FIXES: {{^  }}int *pointer1;
+  //
+  int *pointer2 = nullptr, *pointer3 = 
+  // CHECK-MESSAGES: [[@LINE-1]]:3: warning: multiple declarations in a single statement reduces readability
+  // CHECK-FIXES: int *pointer2 = nullptr;
+  // CHECK-FIXES: {{^  }}int *pointer3 = 
+
+  int *(i_ptr) = nullptr, *((i_ptr2));
+  // CHECK-MESSAGES: [[@LINE-1]]:3: warning: multiple declarations in a single statement reduces readability
+  // CHECK-FIXES: int *(i_ptr) = nullptr;
+  // CHECK-FIXES: {{^  }}int *((i_ptr2));
+
+  float(*f_ptr)[42], (((f_value))) = 42;
+  // CHECK-MESSAGES: [[@LINE-1]]:3: warning: multiple declarations in a single statement reduces readability
+  // CHECK-FIXES: float (*f_ptr)[42];
+  // CHECK-FIXES: {{^  }}float (((f_value))) = 42;
+
+  float(((*f_ptr2)))[42], ((*f_ptr3)), f_value2 = 42.f;
+  // CHECK-MESSAGES: [[@LINE-1]]:3: warning: multiple declarations in a single statement reduces readability
+  // CHECK-FIXES: float (((*f_ptr2)))[42];
+  // CHECK-FIXES: {{^  }}float ((*f_ptr3));
+  // CHECK-FIXES: {{^  }}float f_value2 = 42.f;
+
+  float(((*f_ptr4)))[42], *f_ptr5, ((f_value3));
+  // CHECK-MESSAGES: [[@LINE-1]]:3: warning: multiple declarations in a single statement reduces readability
+  // CHECK-FIXES: float (((*f_ptr4)))[42];
+  // CHECK-FIXES: {{^  }}float *f_ptr5;
+  // CHECK-FIXES: {{^  }}float ((f_value3));
+
+  void(((*f2))(int)), (*g2)(int, float);
+  // CHECK-MESSAGES: [[@LINE-1]]:3: warning: multiple declarations in a single statement reduces readability
+  // CHECK-FIXES: void (((*f2))(int));
+  // CHECK-FIXES: {{^  }}void (*g2)(int, float);
+
+  float(*(*(*f_ptr6)))[42], (*f_ptr7);
+  // CHECK-MESSAGES: [[@LINE-1]]:3: warning: multiple declarations in a 

[PATCH] D52434: [OpenMP] Make default distribute schedule for NVPTX target regions in SPMD mode achieve coalescing

2018-09-28 Thread Jonas Hahnfeld via Phabricator via cfe-commits
Hahnfeld added a comment.

In https://reviews.llvm.org/D52434#1249102, @gtbercea wrote:

> You report a slow down which I am not able to reproduce actually. Do you use 
> any additional clauses not present in your previous post?


No, only `dist_schedule(static)` which is faster. Tested on a `Tesla P100` with 
today's trunk version:

| `#pragma omp target teams distribute parallel for` (new defaults) | 
190 - 250 GB/s |
| adding clauses for old defaults: `schedule(static) dist_schedule(static)` | 
30 - 50 GB/s   |
| same directive with only `dist_schedule(static)` added (fewer registers)  | 
320 - 400 GB/s |


Repository:
  rC Clang

https://reviews.llvm.org/D52434



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D52654: [OpenCL][NFC] Unify ZeroToOCL* cast types

2018-09-28 Thread Alexey Sachkov via Phabricator via cfe-commits
AlexeySachkov added a comment.

This is an initial version. I guess there are some other enums related to 
CK_ZeroToOCL* which also can be merged.

Also, I'm not sure that `CK_ZeroToOCLOpaqueType` is a good name. Thoughts?


Repository:
  rC Clang

https://reviews.llvm.org/D52654



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D51949: [clang-tidy] new check 'readability-isolate-declaration'

2018-09-28 Thread Jonas Toth via Phabricator via cfe-commits
JonasToth added a comment.

Blender looks better now, code compiles after full transformation F7327473: 
blender_isolated_decls.patch 


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D51949



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D52654: [OpenCL][NFC] Unify ZeroToOCL* cast types

2018-09-28 Thread Alexey Sachkov via Phabricator via cfe-commits
AlexeySachkov created this revision.
AlexeySachkov added reviewers: Anastasia, yaxunl.

Repository:
  rC Clang

https://reviews.llvm.org/D52654

Files:
  include/clang/AST/OperationKinds.def
  lib/AST/Expr.cpp
  lib/AST/ExprConstant.cpp
  lib/CodeGen/CGExpr.cpp
  lib/CodeGen/CGExprAgg.cpp
  lib/CodeGen/CGExprComplex.cpp
  lib/CodeGen/CGExprConstant.cpp
  lib/CodeGen/CGExprScalar.cpp
  lib/Edit/RewriteObjCFoundationAPI.cpp
  lib/Sema/SemaCast.cpp
  lib/Sema/SemaExprCXX.cpp
  lib/Sema/SemaInit.cpp
  lib/StaticAnalyzer/Core/ExprEngineC.cpp

Index: lib/StaticAnalyzer/Core/ExprEngineC.cpp
===
--- lib/StaticAnalyzer/Core/ExprEngineC.cpp
+++ lib/StaticAnalyzer/Core/ExprEngineC.cpp
@@ -412,8 +412,7 @@
   case CK_BlockPointerToObjCPointerCast:
   case CK_AnyPointerToBlockPointerCast:
   case CK_ObjCObjectLValueCast:
-  case CK_ZeroToOCLEvent:
-  case CK_ZeroToOCLQueue:
+  case CK_ZeroToOCLOpaqueType:
   case CK_IntToOCLSampler:
   case CK_LValueBitCast: {
 state =
Index: lib/Sema/SemaInit.cpp
===
--- lib/Sema/SemaInit.cpp
+++ lib/Sema/SemaInit.cpp
@@ -5260,39 +5260,39 @@
   return true;
 }
 
-//
-// OpenCL 1.2 spec, s6.12.10
-//
-// The event argument can also be used to associate the
-// async_work_group_copy with a previous async copy allowing
-// an event to be shared by multiple async copies; otherwise
-// event should be zero.
-//
-static bool TryOCLZeroEventInitialization(Sema ,
-  InitializationSequence ,
-  QualType DestType,
-  Expr *Initializer) {
-  if (!S.getLangOpts().OpenCL || !DestType->isEventT() ||
-  !Initializer->isIntegerConstantExpr(S.getASTContext()) ||
-  (Initializer->EvaluateKnownConstInt(S.getASTContext()) != 0))
+static bool TryOCLZeroOpaqueTypeInitialization(Sema ,
+   InitializationSequence ,
+   QualType DestType,
+   Expr *Initializer) {
+  if (!S.getLangOpts().OpenCL)
 return false;
 
-  Sequence.AddOCLZeroEventStep(DestType);
-  return true;
-}
+  //
+  // OpenCL 1.2 spec, s6.12.10
+  //
+  // The event argument can also be used to associate the
+  // async_work_group_copy with a previous async copy allowing
+  // an event to be shared by multiple async copies; otherwise
+  // event should be zero.
+  //
+  if (DestType->isEventT()) {
+if (!Initializer->isIntegerConstantExpr(S.getASTContext()) ||
+(Initializer->EvaluateKnownConstInt(S.getASTContext()) != 0))
+  return false;
+Sequence.AddOCLZeroEventStep(DestType);
+return true;
+  }
 
-static bool TryOCLZeroQueueInitialization(Sema ,
-  InitializationSequence ,
-  QualType DestType,
-  Expr *Initializer) {
-  if (!S.getLangOpts().OpenCL || S.getLangOpts().OpenCLVersion < 200 ||
-  !DestType->isQueueT() ||
-  !Initializer->isIntegerConstantExpr(S.getASTContext()) ||
-  (Initializer->EvaluateKnownConstInt(S.getASTContext()) != 0))
-return false;
+  if (DestType->isQueueT() && S.getLangOpts().OpenCLVersion >= 200) {
+if (!Initializer->isIntegerConstantExpr(S.getASTContext()) ||
+(Initializer->EvaluateKnownConstInt(S.getASTContext()) != 0))
+  return false;
 
-  Sequence.AddOCLZeroQueueStep(DestType);
-  return true;
+Sequence.AddOCLZeroQueueStep(DestType);
+return true;
+  }
+
+  return false;
 }
 
 InitializationSequence::InitializationSequence(Sema ,
@@ -5566,12 +5566,9 @@
 if (TryOCLSamplerInitialization(S, *this, DestType, Initializer))
   return;
 
-if (TryOCLZeroEventInitialization(S, *this, DestType, Initializer))
+if (TryOCLZeroOpaqueTypeInitialization(S, *this, DestType, Initializer))
   return;
 
-if (TryOCLZeroQueueInitialization(S, *this, DestType, Initializer))
-   return;
-
 // Handle initialization in C
 AddCAssignmentStep(DestType);
 MaybeProduceObjCObject(S, *this, Entity);
@@ -8048,21 +8045,13 @@
   CK_IntToOCLSampler);
   break;
 }
-case SK_OCLZeroEvent: {
-  assert(Step->Type->isEventT() &&
- "Event initialization on non-event type.");
-
-  CurInit = S.ImpCastExprToType(CurInit.get(), Step->Type,
-CK_ZeroToOCLEvent,
-CurInit.get()->getValueKind());
-  break;
-}
+case SK_OCLZeroEvent:
 case SK_OCLZeroQueue: {
-  assert(Step->Type->isQueueT() &&
- "Event initialization on non queue type.");
+  assert((Step->Type->isEventT() || Step->Type->isQueueT()) &&
+ "Wrong type for initialization of 

[PATCH] D52434: [OpenMP] Make default distribute schedule for NVPTX target regions in SPMD mode achieve coalescing

2018-09-28 Thread Gheorghe-Teodor Bercea via Phabricator via cfe-commits
gtbercea added a comment.

In https://reviews.llvm.org/D52434#1248975, @Hahnfeld wrote:

> In https://reviews.llvm.org/D52434#1248974, @gtbercea wrote:
>
> > One big problem your code has is that the trip count is incredibly small, 
> > especially for STREAM and especially on GPUs. You need a much larger loop 
> > size otherwise the timings will be dominated by OpenMP setups costs.
>
>
> Sure, I'm not that dump. The real code has larger loops, this was just for 
> demonstration purposes. I don't expect the register count to change based on 
> loop size - is that too optimistic?


I checked the different combinations of schedules and the current default is 
the fastest compared to previous defaults. The old defaults are about 10x 
slower than the current set of defaults (dist_schedule(static, ) 
and schedule(static, 1)). The register allocation looks strange but it's just a 
consequence of using different schedules.

You report a slow down which I am not able to reproduce actually. Do you use 
any additional clauses not present in your previous post?


Repository:
  rC Clang

https://reviews.llvm.org/D52434



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r343305 - [ClangFormat] 'try' of function-try-block doesn't obey BraceWrapping

2018-09-28 Thread Owen Pan via cfe-commits
Author: owenpan
Date: Fri Sep 28 02:17:00 2018
New Revision: 343305

URL: http://llvm.org/viewvc/llvm-project?rev=343305=rev
Log:
[ClangFormat] 'try' of function-try-block doesn't obey BraceWrapping

It should respond to AfterFunction, not AfterControlStatement.

Fixes PR39067

Modified:
cfe/trunk/lib/Format/UnwrappedLineParser.cpp
cfe/trunk/unittests/Format/FormatTest.cpp

Modified: cfe/trunk/lib/Format/UnwrappedLineParser.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/UnwrappedLineParser.cpp?rev=343305=343304=343305=diff
==
--- cfe/trunk/lib/Format/UnwrappedLineParser.cpp (original)
+++ cfe/trunk/lib/Format/UnwrappedLineParser.cpp Fri Sep 28 02:17:00 2018
@@ -1266,6 +1266,8 @@ void UnwrappedLineParser::parseStructura
   break;
 case tok::kw_try:
   // We arrive here when parsing function-try blocks.
+  if (Style.BraceWrapping.AfterFunction)
+addUnwrappedLine();
   parseTryCatch();
   return;
 case tok::identifier: {

Modified: cfe/trunk/unittests/Format/FormatTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=343305=343304=343305=diff
==
--- cfe/trunk/unittests/Format/FormatTest.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTest.cpp Fri Sep 28 02:17:00 2018
@@ -2628,6 +2628,16 @@ TEST_F(FormatTest, MacroCallsWithoutTrai
"  A(X x)\n"
"  try : t(0) {} catch (...) {}\n"
"};"));
+  FormatStyle Style = getLLVMStyle();
+  Style.BreakBeforeBraces = FormatStyle::BS_Custom;
+  Style.BraceWrapping.AfterControlStatement = true;
+  Style.BraceWrapping.AfterFunction = true;
+  EXPECT_EQ("void f()\n"
+"try\n"
+"{\n"
+"}",
+format("void f() try {\n"
+   "}", Style));
   EXPECT_EQ("class SomeClass {\n"
 "public:\n"
 "  SomeClass() EXCLUSIVE_LOCK_FUNCTION(mu_);\n"


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D52650: [clangd] NFC: Migrate to LLVM STLExtras API where possible

2018-09-28 Thread Kirill Bobyrev via Phabricator via cfe-commits
kbobyrev added a comment.

Also, I'm not sure whether I should update Clang-Tidy and other tools in the 
scope of this patch. It makes sense to me, but I don't know whether the 
maintainers of these projects are happy with the change. WDYT?


https://reviews.llvm.org/D52650



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D52650: [clangd] NFC: Migrate to LLVM STLExtras API where possible

2018-09-28 Thread Kirill Bobyrev via Phabricator via cfe-commits
kbobyrev created this revision.
kbobyrev added reviewers: ioeric, sammccall.
kbobyrev added a project: clang-tools-extra.
Herald added subscribers: kadircet, arphaman, dexonsmith, mgrang, jkorous, 
MaskRay, javed.absar, ilya-biryukov.

This patch improves readability by migrating `std::function(ForwardIt start, 
ForwardIt end, ...)` to LLVM's STLExtras range-based equivalent 
`llvm::function(RangeT &, ...)`.

Similar change in Clang: https://reviews.llvm.org/D52576.


https://reviews.llvm.org/D52650

Files:
  clang-tools-extra/clangd/ClangdLSPServer.cpp
  clang-tools-extra/clangd/ClangdServer.cpp
  clang-tools-extra/clangd/CodeComplete.cpp
  clang-tools-extra/clangd/TUScheduler.cpp
  clang-tools-extra/clangd/XRefs.cpp
  clang-tools-extra/clangd/index/CanonicalIncludes.cpp
  clang-tools-extra/clangd/index/FileIndex.cpp
  clang-tools-extra/clangd/index/Index.cpp
  clang-tools-extra/clangd/index/Serialization.cpp
  clang-tools-extra/clangd/index/SymbolCollector.cpp
  clang-tools-extra/clangd/index/dex/Dex.cpp
  clang-tools-extra/clangd/index/dex/Iterator.cpp
  llvm/include/llvm/ADT/STLExtras.h

Index: llvm/include/llvm/ADT/STLExtras.h
===
--- llvm/include/llvm/ADT/STLExtras.h
+++ llvm/include/llvm/ADT/STLExtras.h
@@ -1139,6 +1139,12 @@
   return std::lower_bound(adl_begin(Range), adl_end(Range), I);
 }
 
+template 
+auto lower_bound(R &, ForwardIt I, Compare C)
+-> decltype(adl_begin(Range)) {
+  return std::lower_bound(adl_begin(Range), adl_end(Range), I, C);
+}
+
 /// Provide wrappers to std::upper_bound which take ranges instead of having to
 /// pass begin/end explicitly.
 template 
Index: clang-tools-extra/clangd/index/dex/Iterator.cpp
===
--- clang-tools-extra/clangd/index/dex/Iterator.cpp
+++ clang-tools-extra/clangd/index/dex/Iterator.cpp
@@ -8,7 +8,7 @@
 //===--===//
 
 #include "Iterator.h"
-#include 
+#include "llvm/ADT/STLExtras.h"
 #include 
 #include 
 
@@ -37,11 +37,10 @@
 // highest element starting from the front. When child iterators in the
 // beginning have smaller estimated size, the sync() will have less restarts
 // and become more effective.
-std::sort(begin(Children), end(Children),
-  [](const std::unique_ptr ,
- const std::unique_ptr ) {
-return LHS->estimateSize() < RHS->estimateSize();
-  });
+llvm::sort(Children, [](const std::unique_ptr ,
+const std::unique_ptr ) {
+  return LHS->estimateSize() < RHS->estimateSize();
+});
   }
 
   bool reachedEnd() const override { return ReachedEnd; }
Index: clang-tools-extra/clangd/index/dex/Dex.cpp
===
--- clang-tools-extra/clangd/index/dex/Dex.cpp
+++ clang-tools-extra/clangd/index/dex/Dex.cpp
@@ -110,8 +110,7 @@
 
   // Symbols are sorted by symbol qualities so that items in the posting lists
   // are stored in the descending order of symbol quality.
-  std::sort(begin(ScoredSymbols), end(ScoredSymbols),
-std::greater>());
+  llvm::sort(ScoredSymbols, std::greater>());
 
   // SymbolQuality was empty up until now.
   SymbolQuality.resize(Symbols.size());
Index: clang-tools-extra/clangd/index/SymbolCollector.cpp
===
--- clang-tools-extra/clangd/index/SymbolCollector.cpp
+++ clang-tools-extra/clangd/index/SymbolCollector.cpp
@@ -130,8 +130,7 @@
   // will include OUTER_INNER and exclude some_enum_constant.
   // FIXME: the heuristic relies on naming style (i.e. no underscore in
   // user-defined names) and can be improved.
-  return (ND.getKind() != Decl::EnumConstant) ||
- std::any_of(Name.begin(), Name.end(), islower);
+  return (ND.getKind() != Decl::EnumConstant) || llvm::any_of(Name, islower);
 }
 
 // We only collect #include paths for symbols that are suitable for global code
Index: clang-tools-extra/clangd/index/Serialization.cpp
===
--- clang-tools-extra/clangd/index/Serialization.cpp
+++ clang-tools-extra/clangd/index/Serialization.cpp
@@ -158,7 +158,7 @@
   // Finalize the table and write it to OS. No more strings may be added.
   void finalize(raw_ostream ) {
 Sorted = {Unique.begin(), Unique.end()};
-std::sort(Sorted.begin(), Sorted.end());
+llvm::sort(Sorted);
 for (unsigned I = 0; I < Sorted.size(); ++I)
   Index.try_emplace({Sorted[I].data(), Sorted[I].size()}, I);
 
Index: clang-tools-extra/clangd/index/Index.cpp
===
--- clang-tools-extra/clangd/index/Index.cpp
+++ clang-tools-extra/clangd/index/Index.cpp
@@ -84,10 +84,8 @@
 }
 
 SymbolSlab::const_iterator SymbolSlab::find(const SymbolID ) const {
-  auto It = 

[PATCH] D51464: clang: fix MIPS/N32 triple and paths

2018-09-28 Thread Simon Atanasyan via Phabricator via cfe-commits
atanasyan added inline comments.



Comment at: lib/Driver/ToolChains/Arch/Mips.cpp:85
 
   if (ABIName.empty() &&
   (Triple.getVendor() == llvm::Triple::MipsTechnologies ||

Is possible to rewrite this piece of code (lines 85-114) as follows?
```
  if (ABIName.empty() && (Triple.getEnvironment() == llvm::Triple::GNUABIN32))
ABIName = "n32";

  if (ABIName.empty() &&
  (Triple.getVendor() == llvm::Triple::MipsTechnologies ||
   Triple.getVendor() == llvm::Triple::ImaginationTechnologies)) {
ABIName = llvm::StringSwitch(CPUName)
  .Case("mips1", "o32")
  .Case("mips2", "o32")
  .Case("mips3", "n64")
  .Case("mips4", "n64")
  .Case("mips5", "n64")
  .Case("mips32", "o32")
  .Case("mips32r2", "o32")
  .Case("mips32r3", "o32")
  .Case("mips32r5", "o32")
  .Case("mips32r6", "o32")
  .Case("mips64", "n64")
  .Case("mips64r2", "n64")
  .Case("mips64r3", "n64")
  .Case("mips64r5", "n64")
  .Case("mips64r6", "n64")
  .Case("octeon", "n64")
  .Case("p5600", "o32")
  .Default("");
  }
```



Comment at: lib/Driver/ToolChains/Gnu.cpp:2082
 BiarchTripleAliases.append(begin(MIPSELTriples), end(MIPSELTriples));
-BiarchTripleAliases.append(begin(MIPSTriples), end(MIPSTriples));
+BiarchLibDirs.append(begin(MIPSN32ELLibDirs), end(MIPSN32ELLibDirs));
+BiarchTripleAliases.append(begin(MIPSN32ELTriples), end(MIPSN32ELTriples));

Why do you remove `BiarchTripleAliases.append(begin(MIPSTriples), 
end(MIPSTriples));` in that case only? Is it intended?


https://reviews.llvm.org/D51464



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D52586: [X86] Add the movbe instruction intrinsics from icc.

2018-09-28 Thread Sanjay Patel via Phabricator via cfe-commits
spatel accepted this revision.
spatel added a comment.
This revision is now accepted and ready to land.

LGTM


https://reviews.llvm.org/D52586



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D50850: clang: Add triples support for MIPS r6

2018-09-28 Thread Simon Atanasyan via Phabricator via cfe-commits
atanasyan added a comment.

Fine. Now this patch has modifications for LLVM (not Clang) and all these 
changes were applied at https://reviews.llvm.org/rL343185 already. Could you 
attach an actual patch brings https://reviews.llvm.org/source/compiler-rt/ 
support to the Clang driver?


https://reviews.llvm.org/D50850



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D52625: [OPENMP] Add 'unified_shared_memory' clause to OMP5 'requires' directive

2018-09-28 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev accepted this revision.
ABataev added a comment.
This revision is now accepted and ready to land.

LG


https://reviews.llvm.org/D52625



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D52625: [OPENMP] Add 'unified_shared_memory' clause to OMP5 'requires' directive

2018-09-28 Thread Patrick Lyster via Phabricator via cfe-commits
patricklyster updated this revision to Diff 167459.
patricklyster added a comment.

Added AST print test for `unified_shared_memory


https://reviews.llvm.org/D52625

Files:
  clang/include/clang/AST/OpenMPClause.h
  clang/include/clang/AST/RecursiveASTVisitor.h
  clang/include/clang/Basic/OpenMPKinds.def
  clang/include/clang/Sema/Sema.h
  clang/lib/AST/OpenMPClause.cpp
  clang/lib/AST/StmtPrinter.cpp
  clang/lib/AST/StmtProfile.cpp
  clang/lib/Basic/OpenMPKinds.cpp
  clang/lib/CodeGen/CGStmtOpenMP.cpp
  clang/lib/Parse/ParseOpenMP.cpp
  clang/lib/Sema/SemaOpenMP.cpp
  clang/lib/Sema/TreeTransform.h
  clang/lib/Serialization/ASTReader.cpp
  clang/lib/Serialization/ASTWriter.cpp
  clang/test/OpenMP/requires_unified_address_ast_print.cpp
  clang/test/OpenMP/requires_unified_address_messages.cpp
  clang/tools/libclang/CIndex.cpp

Index: clang/tools/libclang/CIndex.cpp
===
--- clang/tools/libclang/CIndex.cpp
+++ clang/tools/libclang/CIndex.cpp
@@ -2210,6 +2210,9 @@
 void OMPClauseEnqueue::VisitOMPUnifiedAddressClause(
 const OMPUnifiedAddressClause *) {}
 
+void OMPClauseEnqueue::VisitOMPUnifiedSharedMemoryClause(
+const OMPUnifiedSharedMemoryClause *) {}
+
 void OMPClauseEnqueue::VisitOMPDeviceClause(const OMPDeviceClause *C) {
   Visitor->AddStmt(C->getDevice());
 }
Index: clang/test/OpenMP/requires_unified_address_messages.cpp
===
--- clang/test/OpenMP/requires_unified_address_messages.cpp
+++ clang/test/OpenMP/requires_unified_address_messages.cpp
@@ -1,6 +1,10 @@
 // RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100  %s
 
-#pragma omp requires unified_address // expected-note {{unified_address clause previously used here}} expected-note {{unified_address clause previously used here}} expected-note {{unified_address clause previously used here}} expected-note {{unified_address clause previously used here}} expected-note {{unified_address clause previously used here}}
+#pragma omp requires unified_address // expected-note {{unified_address clause previously used here}} expected-note {{unified_address clause previously used here}} expected-note {{unified_address clause previously used here}} expected-note {{unified_address clause previously used here}} expected-note {{unified_address clause previously used here}} expected-note{{unified_address clause previously used here}}
+
+#pragma omp requires unified_shared_memory // expected-note {{unified_shared_memory clause previously used here}} expected-note{{unified_shared_memory clause previously used here}}
+
+#pragma omp requires unified_shared_memory, unified_shared_memory // expected-error {{Only one unified_shared_memory clause can appear on a requires directive in a single translation unit}} expected-error {{directive '#pragma omp requires' cannot contain more than one 'unified_shared_memory' clause}}
 
 #pragma omp requires unified_address // expected-error {{Only one unified_address clause can appear on a requires directive in a single translation unit}} 
 
@@ -16,6 +20,8 @@
 
 #pragma omp requires invalid_clause unified_address // expected-warning {{extra tokens at the end of '#pragma omp requires' are ignored}} expected-error {{expected at least one clause on '#pragma omp requires' directive}}
 
+#pragma omp requires unified_shared_memory, unified_address // expected-error {{Only one unified_shared_memory clause can appear on a requires directive in a single translation unit}} expected-error{{Only one unified_address clause can appear on a requires directive in a single translation unit}}
+
 namespace A {
   #pragma omp requires unified_address // expected-error {{Only one unified_address clause can appear on a requires directive in a single translation unit}}
   namespace B {
Index: clang/test/OpenMP/requires_unified_address_ast_print.cpp
===
--- clang/test/OpenMP/requires_unified_address_ast_print.cpp
+++ clang/test/OpenMP/requires_unified_address_ast_print.cpp
@@ -13,4 +13,7 @@
 #pragma omp requires unified_address 
 // CHECK:#pragma omp requires unified_address
 
+#pragma omp requires unified_shared_memory
+// CHECK:#pragma omp requires unified_shared_memory
+
 #endif
Index: clang/lib/Serialization/ASTWriter.cpp
===
--- clang/lib/Serialization/ASTWriter.cpp
+++ clang/lib/Serialization/ASTWriter.cpp
@@ -6932,3 +6932,6 @@
 }
 
 void OMPClauseWriter::VisitOMPUnifiedAddressClause(OMPUnifiedAddressClause *) {}
+
+void OMPClauseWriter::VisitOMPUnifiedSharedMemoryClause(
+OMPUnifiedSharedMemoryClause *) {}
Index: clang/lib/Serialization/ASTReader.cpp
===
--- clang/lib/Serialization/ASTReader.cpp
+++ clang/lib/Serialization/ASTReader.cpp
@@ -11723,6 +11723,9 @@
   case OMPC_unified_address:
 C = new (Context) 

[PATCH] D52625: [OPENMP] Add 'unified_shared_memory' clause to OMP5 'requires' directive

2018-09-28 Thread Patrick Lyster via Phabricator via cfe-commits
patricklyster added a comment.

In https://reviews.llvm.org/D52625#1248436, @ABataev wrote:

> I forgot to mention that you need an ast print test (the positive test)


Thanks for the reminder. I will add that


Repository:
  rC Clang

https://reviews.llvm.org/D52625



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r337453 - [CodeComplete] Fix accessibilty of protected members from base class.

2018-09-28 Thread Eric Liu via cfe-commits
PTAL: https://reviews.llvm.org/D52647

On Fri, Sep 28, 2018 at 2:13 PM Eric Liu  wrote:

> (Oops, forgot there was this thread. Pasting my response to r338255 here).
>
> > The code seemed obviously wrong there (calling accessibility checking,
> passing a possibly unrelated class) and the tests didn't break after
> reverting it.
> It turns out that this was due to my lacking LIT test skill.  LIT does
> partial string match... so "something" would match both "something" and
> "something (inaccessible)" XD
> > I actually tried to pass the correct derived scope to
> CodeCompletionDeclConsumer on construction, it was not a lot of code and I
> think this should fix the problem you're describing.
> > I'll send a patch.
> Any luck on this?
>
> On Tue, Jul 31, 2018 at 12:24 PM Ilya Biryukov 
> wrote:
>
>> I actually tried to pass the correct derived scope to
>> CodeCompletionDeclConsumer on construction, it was not a lot of code and I
>> think this should fix the problem you're describing.
>> I'll send a patch.
>>
>> On Tue, Jul 31, 2018 at 11:33 AM Eric Liu  wrote:
>>
>>> Thanks a lot for looking into this!
>>>
>>> You are right, the change in SemaAccess seemed to have done the job to
>>> fix the protected member bug in specific. I think I made the change in
>>> SemaCodeComplete before SemaAccess and didn't realized the previous one was
>>> unnecessary to fix the tests. I think the accessing context/naming class is
>>> still wrong though. Basically, we want the naming class to be the derived
>>> class instead of the base class if the access is from a derived class.
>>> Without this,  accessibility check is relaxed, but it probably doesn't have
>>> very negative impact on code completion experience, so I think it's okay to
>>> revert the change in SemaCodeComplete. Thanks again!
>>>
>>> On Mon, Jul 30, 2018 at 5:22 PM Ilya Biryukov 
>>> wrote:
>>>
 Prtially reverted the commit in r338255 to fix a very frequent crash.
 The code seemed obviously wrong there (calling accessibility checking,
 passing a possibly unrelated class) and the tests didn't break after
 reverting it.

 Let me know if I missed anything.

 On Thu, Jul 19, 2018 at 3:37 PM Eric Liu via cfe-commits <
 cfe-commits@lists.llvm.org> wrote:

> Author: ioeric
> Date: Thu Jul 19 06:32:00 2018
> New Revision: 337453
>
> URL: http://llvm.org/viewvc/llvm-project?rev=337453=rev
> Log:
> [CodeComplete] Fix accessibilty of protected members from base class.
>
> Summary:
> Currently, protected members from base classes are marked as
> inaccessible when completing in derived class. This patch fixes the
> problem by
> setting the naming class correctly when looking up results in base
> class
> according to [11.2.p5].
>
> Reviewers: aaron.ballman, sammccall, rsmith
>
> Reviewed By: aaron.ballman
>
> Subscribers: cfe-commits
>
> Differential Revision: https://reviews.llvm.org/D49421
>
> Modified:
> cfe/trunk/lib/Sema/SemaAccess.cpp
> cfe/trunk/lib/Sema/SemaCodeComplete.cpp
> cfe/trunk/test/Index/complete-access-checks.cpp
>
> Modified: cfe/trunk/lib/Sema/SemaAccess.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaAccess.cpp?rev=337453=337452=337453=diff
>
> ==
> --- cfe/trunk/lib/Sema/SemaAccess.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaAccess.cpp Thu Jul 19 06:32:00 2018
> @@ -11,6 +11,7 @@
>  //
>
>  
> //===--===//
>
> +#include "clang/Basic/Specifiers.h"
>  #include "clang/Sema/SemaInternal.h"
>  #include "clang/AST/ASTContext.h"
>  #include "clang/AST/CXXInheritance.h"
> @@ -1856,29 +1857,31 @@ void Sema::CheckLookupAccess(const Looku
>}
>  }
>
> -/// Checks access to Decl from the given class. The check will take
> access
> +/// Checks access to Target from the given class. The check will take
> access
>  /// specifiers into account, but no member access expressions and
> such.
>  ///
> -/// \param Decl the declaration to check if it can be accessed
> +/// \param Target the declaration to check if it can be accessed
>  /// \param Ctx the class/context from which to start the search
> -/// \return true if the Decl is accessible from the Class, false
> otherwise.
> -bool Sema::IsSimplyAccessible(NamedDecl *Decl, DeclContext *Ctx) {
> +/// \return true if the Target is accessible from the Class, false
> otherwise.
> +bool Sema::IsSimplyAccessible(NamedDecl *Target, DeclContext *Ctx) {
>if (CXXRecordDecl *Class = dyn_cast(Ctx)) {
> -if (!Decl->isCXXClassMember())
> +if (!Target->isCXXClassMember())
>return true;
>
> +if 

[PATCH] D52620: Added Support for StatOnly Files in VFS.

2018-09-28 Thread UTKARSH SAXENA via Phabricator via cfe-commits
usaxena95 added inline comments.



Comment at: lib/Basic/VirtualFileSystem.cpp:2097
 void YAMLVFSWriter::write(llvm::raw_ostream ) {
-  llvm::sort(Mappings, [](const YAMLVFSEntry , const YAMLVFSEntry ) {
+  llvm::sort(Mappings.begin(), Mappings.end(),
+ [](const YAMLVFSEntry , const YAMLVFSEntry ) {

kbobyrev wrote:
> This used `llvm::sort(Container &, Compare Comp)` before, I would think 
> that the range-based API is the preferred one. There's also a cleanup patch 
> migrating STL-like calls to idiomatic LLVM's STL Extension API: D52576.
I think these are some very recent changes and does not belong to my patch. 
Will sync these. Thanks for pointing out.


Repository:
  rC Clang

https://reviews.llvm.org/D52620



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D52647: [CodeComplete] Re-fix accessibilty of protected members from base class.

2018-09-28 Thread Eric Liu via Phabricator via cfe-commits
ioeric created this revision.
ioeric added a reviewer: ilya-biryukov.
Herald added a subscriber: cfe-commits.

The initial fix (r337453) had bug and was partially reverted (r338255).
This simplies the original fix by explicitly passing the naming class to the
completion consumer.


Repository:
  rC Clang

https://reviews.llvm.org/D52647

Files:
  lib/Sema/SemaCodeComplete.cpp
  lib/Sema/SemaLookup.cpp
  test/Index/complete-access-checks.cpp


Index: test/Index/complete-access-checks.cpp
===
--- test/Index/complete-access-checks.cpp
+++ test/Index/complete-access-checks.cpp
@@ -36,10 +36,10 @@
 
 // CHECK-SUPER-ACCESS: CXXMethod:{ResultType void}{TypedText 
doSomething}{LeftParen (}{RightParen )} (34)
 // CHECK-SUPER-ACCESS: CXXMethod:{ResultType void}{Informative X::}{TypedText 
func1}{LeftParen (}{RightParen )} (36)
-// CHECK-SUPER-ACCESS: CXXMethod:{ResultType void}{Informative X::}{TypedText 
func2}{LeftParen (}{RightParen )} (36)
+// CHECK-SUPER-ACCESS: CXXMethod:{ResultType void}{Informative X::}{TypedText 
func2}{LeftParen (}{RightParen )} (36){{$}}
 // CHECK-SUPER-ACCESS: CXXMethod:{ResultType void}{Informative X::}{TypedText 
func3}{LeftParen (}{RightParen )} (36) (inaccessible)
 // CHECK-SUPER-ACCESS: FieldDecl:{ResultType int}{Informative X::}{TypedText 
member1} (37)
-// CHECK-SUPER-ACCESS: FieldDecl:{ResultType int}{Informative X::}{TypedText 
member2} (37)
+// CHECK-SUPER-ACCESS: FieldDecl:{ResultType int}{Informative X::}{TypedText 
member2} (37){{$}}
 // CHECK-SUPER-ACCESS: FieldDecl:{ResultType int}{Informative X::}{TypedText 
member3} (37) (inaccessible)
 // CHECK-SUPER-ACCESS: CXXMethod:{ResultType Y &}{TypedText 
operator=}{LeftParen (}{Placeholder const Y &}{RightParen )} (79)
 // CHECK-SUPER-ACCESS: CXXMethod:{ResultType X &}{Text X::}{TypedText 
operator=}{LeftParen (}{Placeholder const X &}{RightParen )} (81)
Index: lib/Sema/SemaLookup.cpp
===
--- lib/Sema/SemaLookup.cpp
+++ lib/Sema/SemaLookup.cpp
@@ -3619,8 +3619,9 @@
 
   // Find results in this base class (and its bases).
   ShadowContextRAII Shadow(Visited);
-  LookupVisibleDecls(RD, Result, QualifiedNameLookup, true, Consumer,
- Visited, IncludeDependentBases, LoadExternal);
+  LookupVisibleDecls(RD, Result, QualifiedNameLookup, /*InBaseClass=*/true,
+ Consumer, Visited, IncludeDependentBases,
+ LoadExternal);
 }
   }
 
Index: lib/Sema/SemaCodeComplete.cpp
===
--- lib/Sema/SemaCodeComplete.cpp
+++ lib/Sema/SemaCodeComplete.cpp
@@ -10,6 +10,7 @@
 //  This file defines the code-completion semantic actions.
 //
 
//===--===//
+#include "clang/AST/Decl.h"
 #include "clang/AST/DeclCXX.h"
 #include "clang/AST/DeclObjC.h"
 #include "clang/AST/ExprCXX.h"
@@ -1295,18 +1296,29 @@
 ResultBuilder 
 DeclContext *CurContext;
 std::vector FixIts;
+// This is set to the record where the search starts, if this is a record
+// member completion.
+RecordDecl *MemberCompletionRecord = nullptr;
 
   public:
 CodeCompletionDeclConsumer(
 ResultBuilder , DeclContext *CurContext,
-std::vector FixIts = std::vector())
-: Results(Results), CurContext(CurContext), FixIts(std::move(FixIts)) 
{}
+std::vector FixIts = std::vector(),
+RecordDecl *MemberCompletionRecord = nullptr)
+: Results(Results), CurContext(CurContext), FixIts(std::move(FixIts)),
+  MemberCompletionRecord(MemberCompletionRecord) {}
 
 void FoundDecl(NamedDecl *ND, NamedDecl *Hiding, DeclContext *Ctx,
bool InBaseClass) override {
   bool Accessible = true;
-  if (Ctx)
-Accessible = Results.getSema().IsSimplyAccessible(ND, Ctx);
+  if (Ctx) {
+// Set the actual accessing context (i.e. naming class) to the record
+// context where the search starts. When `InBaseClass` is true, `Ctx`
+// will be the base class, which is not the actual naming class.
+DeclContext *AccessingCtx =
+MemberCompletionRecord ? MemberCompletionRecord : Ctx;
+Accessible = Results.getSema().IsSimplyAccessible(ND, AccessingCtx);
+  }
   ResultBuilder::Result Result(ND, Results.getBasePriority(ND), nullptr,
false, Accessible, FixIts);
   Results.AddResult(Result, CurContext, Hiding, InBaseClass);
@@ -4004,7 +4016,8 @@
   std::vector FixIts;
   if (AccessOpFixIt)
   FixIts.emplace_back(AccessOpFixIt.getValue());
-  CodeCompletionDeclConsumer Consumer(Results, SemaRef.CurContext, 
std::move(FixIts));
+  CodeCompletionDeclConsumer Consumer(Results, SemaRef.CurContext,
+  std::move(FixIts), RD);
   

[PATCH] D52620: Added Support for StatOnly Files in VFS.

2018-09-28 Thread UTKARSH SAXENA via Phabricator via cfe-commits
usaxena95 added a comment.

> it sounds like this is for record-replay.

Yes this is for record-replay purpose.

> What are these files in practice?

During loading a modules the files that were required to make the module are 
stat()ed and their sizes are used to verify that the module is still valid. 
There are occurrences of more stat() only files (apart from the use in modules) 
which I am not aware of.

> In the replayed compilation, we assume the accessed files are the same, is it 
> safe to assume we never read files we previously stat()ed?

I would call it a requirement instead of an assumption. The replay must be 
exactly the same (even the file stats and reads). If Clang reads the file in 
replay which was only stat()ed during compilation, it indicates non-determinism 
or something wrong (in clang or FS).
We currently deal with such files by adding empty buffers for them based on 
this assumption/requirement only.

> it seems like this could also be achieved with an overlayFS adding a simple 
> specialized FS that only provides the stat-only files. If this is a 
> relatively niche feature, cramming it into InMemoryFileSystem may not be the 
> best option. Any thoughts on the tradeoff here?

We can reuse the InMemoryFS to make another FS which just serves stat-only 
files. A tradeoff I can think of is: we might need to store a random buffer of 
required size to make final status of the file correct.


Repository:
  rC Clang

https://reviews.llvm.org/D52620



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D52434: [OpenMP] Make default distribute schedule for NVPTX target regions in SPMD mode achieve coalescing

2018-09-28 Thread Gheorghe-Teodor Bercea via Phabricator via cfe-commits
gtbercea added a comment.

In https://reviews.llvm.org/D52434#1248975, @Hahnfeld wrote:

> In https://reviews.llvm.org/D52434#1248974, @gtbercea wrote:
>
> > One big problem your code has is that the trip count is incredibly small, 
> > especially for STREAM and especially on GPUs. You need a much larger loop 
> > size otherwise the timings will be dominated by OpenMP setups costs.
>
>
> Sure, I'm not that dump. The real code has larger loops, this was just for 
> demonstration purposes. I don't expect the register count to change based on 
> loop size - is that too optimistic?


The register count will of course not change with loop size.


Repository:
  rC Clang

https://reviews.llvm.org/D52434



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D52434: [OpenMP] Make default distribute schedule for NVPTX target regions in SPMD mode achieve coalescing

2018-09-28 Thread Jonas Hahnfeld via Phabricator via cfe-commits
Hahnfeld added a comment.

In https://reviews.llvm.org/D52434#1248974, @gtbercea wrote:

> One big problem your code has is that the trip count is incredibly small, 
> especially for STREAM and especially on GPUs. You need a much larger loop 
> size otherwise the timings will be dominated by OpenMP setups costs.


Sure, I'm not that dump. The real code has larger loops, this was just for 
demonstration purposes. I don't expect the register count to change based on 
loop size - is that too optimistic?


Repository:
  rC Clang

https://reviews.llvm.org/D52434



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D52434: [OpenMP] Make default distribute schedule for NVPTX target regions in SPMD mode achieve coalescing

2018-09-28 Thread Gheorghe-Teodor Bercea via Phabricator via cfe-commits
gtbercea added a comment.

In https://reviews.llvm.org/D52434#1248844, @Hahnfeld wrote:

> Just tested this and got very weird results for register usage:
>
>   void func(double *a) {
> #pragma omp target teams distribute parallel for map(a[0:100]) // 
> dist_schedule(static)
> for (int i = 0; i < 100; i++) {
>   a[i]++;
> }
>   }
>
>
> Compiling with current trunk for `sm_60` (Pascal): 29 registers
>  Adding `dist_schedule(static)` (the previous default): 19 registers
>  For reference: `dist_schedule(static, 128)` also uses 29 registers
>
> Any ideas? This significantly slows down STREAM...


Jonas, without an explicit dist_schedule clause the program will run with 
schedule(static, ). It looks like that happens fine 
since you get the same register count in the explicit static chunk variant as 
in the default case.

The difference you see in register count is (I suspect) driven by the runtime 
code (less registers for non-chunked than for chunked). I am currently 
investigating this and trying to find ways to reduce this number.

One big problem your code has is that the trip count is incredibly small, 
especially for STREAM and especially on GPUs. You need a much larger loop size 
otherwise the timings will be dominated by OpenMP setups costs.


Repository:
  rC Clang

https://reviews.llvm.org/D52434



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r337453 - [CodeComplete] Fix accessibilty of protected members from base class.

2018-09-28 Thread Eric Liu via cfe-commits
(Oops, forgot there was this thread. Pasting my response to r338255 here).

> The code seemed obviously wrong there (calling accessibility checking,
passing a possibly unrelated class) and the tests didn't break after
reverting it.
It turns out that this was due to my lacking LIT test skill.  LIT does
partial string match... so "something" would match both "something" and
"something (inaccessible)" XD
> I actually tried to pass the correct derived scope to
CodeCompletionDeclConsumer on construction, it was not a lot of code and I
think this should fix the problem you're describing.
> I'll send a patch.
Any luck on this?

On Tue, Jul 31, 2018 at 12:24 PM Ilya Biryukov  wrote:

> I actually tried to pass the correct derived scope to
> CodeCompletionDeclConsumer on construction, it was not a lot of code and I
> think this should fix the problem you're describing.
> I'll send a patch.
>
> On Tue, Jul 31, 2018 at 11:33 AM Eric Liu  wrote:
>
>> Thanks a lot for looking into this!
>>
>> You are right, the change in SemaAccess seemed to have done the job to
>> fix the protected member bug in specific. I think I made the change in
>> SemaCodeComplete before SemaAccess and didn't realized the previous one was
>> unnecessary to fix the tests. I think the accessing context/naming class is
>> still wrong though. Basically, we want the naming class to be the derived
>> class instead of the base class if the access is from a derived class.
>> Without this,  accessibility check is relaxed, but it probably doesn't have
>> very negative impact on code completion experience, so I think it's okay to
>> revert the change in SemaCodeComplete. Thanks again!
>>
>> On Mon, Jul 30, 2018 at 5:22 PM Ilya Biryukov 
>> wrote:
>>
>>> Prtially reverted the commit in r338255 to fix a very frequent crash.
>>> The code seemed obviously wrong there (calling accessibility checking,
>>> passing a possibly unrelated class) and the tests didn't break after
>>> reverting it.
>>>
>>> Let me know if I missed anything.
>>>
>>> On Thu, Jul 19, 2018 at 3:37 PM Eric Liu via cfe-commits <
>>> cfe-commits@lists.llvm.org> wrote:
>>>
 Author: ioeric
 Date: Thu Jul 19 06:32:00 2018
 New Revision: 337453

 URL: http://llvm.org/viewvc/llvm-project?rev=337453=rev
 Log:
 [CodeComplete] Fix accessibilty of protected members from base class.

 Summary:
 Currently, protected members from base classes are marked as
 inaccessible when completing in derived class. This patch fixes the
 problem by
 setting the naming class correctly when looking up results in base class
 according to [11.2.p5].

 Reviewers: aaron.ballman, sammccall, rsmith

 Reviewed By: aaron.ballman

 Subscribers: cfe-commits

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

 Modified:
 cfe/trunk/lib/Sema/SemaAccess.cpp
 cfe/trunk/lib/Sema/SemaCodeComplete.cpp
 cfe/trunk/test/Index/complete-access-checks.cpp

 Modified: cfe/trunk/lib/Sema/SemaAccess.cpp
 URL:
 http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaAccess.cpp?rev=337453=337452=337453=diff

 ==
 --- cfe/trunk/lib/Sema/SemaAccess.cpp (original)
 +++ cfe/trunk/lib/Sema/SemaAccess.cpp Thu Jul 19 06:32:00 2018
 @@ -11,6 +11,7 @@
  //

  
 //===--===//

 +#include "clang/Basic/Specifiers.h"
  #include "clang/Sema/SemaInternal.h"
  #include "clang/AST/ASTContext.h"
  #include "clang/AST/CXXInheritance.h"
 @@ -1856,29 +1857,31 @@ void Sema::CheckLookupAccess(const Looku
}
  }

 -/// Checks access to Decl from the given class. The check will take
 access
 +/// Checks access to Target from the given class. The check will take
 access
  /// specifiers into account, but no member access expressions and such.
  ///
 -/// \param Decl the declaration to check if it can be accessed
 +/// \param Target the declaration to check if it can be accessed
  /// \param Ctx the class/context from which to start the search
 -/// \return true if the Decl is accessible from the Class, false
 otherwise.
 -bool Sema::IsSimplyAccessible(NamedDecl *Decl, DeclContext *Ctx) {
 +/// \return true if the Target is accessible from the Class, false
 otherwise.
 +bool Sema::IsSimplyAccessible(NamedDecl *Target, DeclContext *Ctx) {
if (CXXRecordDecl *Class = dyn_cast(Ctx)) {
 -if (!Decl->isCXXClassMember())
 +if (!Target->isCXXClassMember())
return true;

 +if (Target->getAccess() == AS_public)
 +  return true;
  QualType qType =
 Class->getTypeForDecl()->getCanonicalTypeInternal();
 +// The unprivileged access is AS_none as we don't know how the
 member was
 +// 

[PATCH] D51949: [clang-tidy] new check 'readability-isolate-declaration'

2018-09-28 Thread Jonas Toth via Phabricator via cfe-commits
JonasToth added a comment.

LLVM works, Blender doesn't, the offending piece is `float (((*f_ptr2)))[42], 
*f_ptr3, f_value2 = 42.f;` (parens around the pointer). I am trying to fix that.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D51949



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D52644: [ARM] Prevent DSP and SIM32 being set for v6m

2018-09-28 Thread Phabricator via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rC343309: [ARM] Prevent DSP and SIM32 being set for v6m 
(authored by sam_parker, committed by ).
Herald added a subscriber: cfe-commits.

Changed prior to commit:
  https://reviews.llvm.org/D52644?vs=167444=167448#toc

Repository:
  rC Clang

https://reviews.llvm.org/D52644

Files:
  lib/Basic/Targets/ARM.cpp
  test/Preprocessor/arm-acle-6.4.c


Index: test/Preprocessor/arm-acle-6.4.c
===
--- test/Preprocessor/arm-acle-6.4.c
+++ test/Preprocessor/arm-acle-6.4.c
@@ -174,15 +174,22 @@
 // CHECK-V7M: __ARM_FEATURE_SAT 1
 // CHECK-V7M: __ARM_FEATURE_UNALIGNED 1
 
+// RUN: %clang -target arm-none-linux-eabi -march=armv7-m -x c -E -dM %s -o - 
| FileCheck %s -check-prefix CHECK-M-NODSP
 // RUN: %clang -target arm-none-linux-eabi -march=armv7e-m -x c -E -dM %s -o - 
| FileCheck %s -check-prefix CHECK-M-DSP
+// RUN: %clang --target=arm-arm-none-eabi -mcpu=cortex-m3 -x c -E -dM %s -o - 
| FileCheck %s -check-prefix CHECK-M-NODSP
 // RUN: %clang --target=arm-arm-none-eabi -mcpu=cortex-m4 -x c -E -dM %s -o - 
| FileCheck %s -check-prefix CHECK-M-DSP
 // RUN: %clang --target=arm-arm-none-eabi -mcpu=cortex-m7 -x c -E -dM %s -o - 
| FileCheck %s -check-prefix CHECK-M-DSP
+// RUN: %clang --target=arm-arm-none-eabi -mcpu=cortex-m0plus -x c -E -dM %s 
-o - | FileCheck %s -check-prefix CHECK-M-NODSP
+// RUN: %clang --target=arm-arm-none-eabi -mcpu=cortex-m23 -x c -E -dM %s -o - 
| FileCheck %s -check-prefix CHECK-M-NODSP
 // RUN: %clang --target=arm-arm-none-eabi -mcpu=cortex-m33 -x c -E -dM %s -o - 
| FileCheck %s -check-prefix CHECK-M-DSP
 // RUN: %clang --target=arm-arm-none-eabi -march=armv8m.main+dsp -x c -E -dM 
%s -o - | FileCheck %s -check-prefix CHECK-M-DSP
 
 // CHECK-M-DSP: __ARM_FEATURE_DSP 1
 // CHECK-M-DSP: __ARM_FEATURE_SIMD32 1
 
+// CHECK-M-NODSP-NOT: __ARM_FEATURE_DSP 1
+// CHECK-M-NODSP-NOT: __ARM_FEATURE_SIMD32 1
+
 // RUN: %clang -target arm-none-linux-eabi -march=armv8-a -x c -E -dM %s -o - 
| FileCheck %s -check-prefix CHECK-V8A
 
 // CHECK-V8A: __ARM_ARCH 8
Index: lib/Basic/Targets/ARM.cpp
===
--- lib/Basic/Targets/ARM.cpp
+++ lib/Basic/Targets/ARM.cpp
@@ -663,7 +663,7 @@
   }
 
   // ACLE 6.4.9 32-bit SIMD instructions
-  if (ArchVersion >= 6 || (CPUProfile == "M" && DSP))
+  if ((CPUProfile != "M" && ArchVersion >= 6) || (CPUProfile == "M" && DSP))
 Builder.defineMacro("__ARM_FEATURE_SIMD32", "1");
 
   // ACLE 6.4.10 Hardware Integer Divide


Index: test/Preprocessor/arm-acle-6.4.c
===
--- test/Preprocessor/arm-acle-6.4.c
+++ test/Preprocessor/arm-acle-6.4.c
@@ -174,15 +174,22 @@
 // CHECK-V7M: __ARM_FEATURE_SAT 1
 // CHECK-V7M: __ARM_FEATURE_UNALIGNED 1
 
+// RUN: %clang -target arm-none-linux-eabi -march=armv7-m -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-M-NODSP
 // RUN: %clang -target arm-none-linux-eabi -march=armv7e-m -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-M-DSP
+// RUN: %clang --target=arm-arm-none-eabi -mcpu=cortex-m3 -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-M-NODSP
 // RUN: %clang --target=arm-arm-none-eabi -mcpu=cortex-m4 -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-M-DSP
 // RUN: %clang --target=arm-arm-none-eabi -mcpu=cortex-m7 -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-M-DSP
+// RUN: %clang --target=arm-arm-none-eabi -mcpu=cortex-m0plus -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-M-NODSP
+// RUN: %clang --target=arm-arm-none-eabi -mcpu=cortex-m23 -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-M-NODSP
 // RUN: %clang --target=arm-arm-none-eabi -mcpu=cortex-m33 -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-M-DSP
 // RUN: %clang --target=arm-arm-none-eabi -march=armv8m.main+dsp -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-M-DSP
 
 // CHECK-M-DSP: __ARM_FEATURE_DSP 1
 // CHECK-M-DSP: __ARM_FEATURE_SIMD32 1
 
+// CHECK-M-NODSP-NOT: __ARM_FEATURE_DSP 1
+// CHECK-M-NODSP-NOT: __ARM_FEATURE_SIMD32 1
+
 // RUN: %clang -target arm-none-linux-eabi -march=armv8-a -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-V8A
 
 // CHECK-V8A: __ARM_ARCH 8
Index: lib/Basic/Targets/ARM.cpp
===
--- lib/Basic/Targets/ARM.cpp
+++ lib/Basic/Targets/ARM.cpp
@@ -663,7 +663,7 @@
   }
 
   // ACLE 6.4.9 32-bit SIMD instructions
-  if (ArchVersion >= 6 || (CPUProfile == "M" && DSP))
+  if ((CPUProfile != "M" && ArchVersion >= 6) || (CPUProfile == "M" && DSP))
 Builder.defineMacro("__ARM_FEATURE_SIMD32", "1");
 
   // ACLE 6.4.10 Hardware Integer Divide
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r343309 - [ARM] Prevent DSP and SIM32 being set for v6m

2018-09-28 Thread Sam Parker via cfe-commits
Author: sam_parker
Date: Fri Sep 28 03:18:02 2018
New Revision: 343309

URL: http://llvm.org/viewvc/llvm-project?rev=343309=rev
Log:
[ARM] Prevent DSP and SIM32 being set for v6m

My previous change (rL340911) set the two features for architectures
>= 6, which wrongly includes v6m. Now set to >= 6 and not Cortex-M.

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

Modified:
cfe/trunk/lib/Basic/Targets/ARM.cpp
cfe/trunk/test/Preprocessor/arm-acle-6.4.c

Modified: cfe/trunk/lib/Basic/Targets/ARM.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/ARM.cpp?rev=343309=343308=343309=diff
==
--- cfe/trunk/lib/Basic/Targets/ARM.cpp (original)
+++ cfe/trunk/lib/Basic/Targets/ARM.cpp Fri Sep 28 03:18:02 2018
@@ -663,7 +663,7 @@ void ARMTargetInfo::getTargetDefines(con
   }
 
   // ACLE 6.4.9 32-bit SIMD instructions
-  if (ArchVersion >= 6 || (CPUProfile == "M" && DSP))
+  if ((CPUProfile != "M" && ArchVersion >= 6) || (CPUProfile == "M" && DSP))
 Builder.defineMacro("__ARM_FEATURE_SIMD32", "1");
 
   // ACLE 6.4.10 Hardware Integer Divide

Modified: cfe/trunk/test/Preprocessor/arm-acle-6.4.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/arm-acle-6.4.c?rev=343309=343308=343309=diff
==
--- cfe/trunk/test/Preprocessor/arm-acle-6.4.c (original)
+++ cfe/trunk/test/Preprocessor/arm-acle-6.4.c Fri Sep 28 03:18:02 2018
@@ -174,15 +174,22 @@
 // CHECK-V7M: __ARM_FEATURE_SAT 1
 // CHECK-V7M: __ARM_FEATURE_UNALIGNED 1
 
+// RUN: %clang -target arm-none-linux-eabi -march=armv7-m -x c -E -dM %s -o - 
| FileCheck %s -check-prefix CHECK-M-NODSP
 // RUN: %clang -target arm-none-linux-eabi -march=armv7e-m -x c -E -dM %s -o - 
| FileCheck %s -check-prefix CHECK-M-DSP
+// RUN: %clang --target=arm-arm-none-eabi -mcpu=cortex-m3 -x c -E -dM %s -o - 
| FileCheck %s -check-prefix CHECK-M-NODSP
 // RUN: %clang --target=arm-arm-none-eabi -mcpu=cortex-m4 -x c -E -dM %s -o - 
| FileCheck %s -check-prefix CHECK-M-DSP
 // RUN: %clang --target=arm-arm-none-eabi -mcpu=cortex-m7 -x c -E -dM %s -o - 
| FileCheck %s -check-prefix CHECK-M-DSP
+// RUN: %clang --target=arm-arm-none-eabi -mcpu=cortex-m0plus -x c -E -dM %s 
-o - | FileCheck %s -check-prefix CHECK-M-NODSP
+// RUN: %clang --target=arm-arm-none-eabi -mcpu=cortex-m23 -x c -E -dM %s -o - 
| FileCheck %s -check-prefix CHECK-M-NODSP
 // RUN: %clang --target=arm-arm-none-eabi -mcpu=cortex-m33 -x c -E -dM %s -o - 
| FileCheck %s -check-prefix CHECK-M-DSP
 // RUN: %clang --target=arm-arm-none-eabi -march=armv8m.main+dsp -x c -E -dM 
%s -o - | FileCheck %s -check-prefix CHECK-M-DSP
 
 // CHECK-M-DSP: __ARM_FEATURE_DSP 1
 // CHECK-M-DSP: __ARM_FEATURE_SIMD32 1
 
+// CHECK-M-NODSP-NOT: __ARM_FEATURE_DSP 1
+// CHECK-M-NODSP-NOT: __ARM_FEATURE_SIMD32 1
+
 // RUN: %clang -target arm-none-linux-eabi -march=armv8-a -x c -E -dM %s -o - 
| FileCheck %s -check-prefix CHECK-V8A
 
 // CHECK-V8A: __ARM_ARCH 8


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


  1   2   >