r285986 - [python bindings] Expose CXCursor_FriendDecl as CursorKind.FRIEND_DECL

2016-11-04 Thread Olivier Goffart via cfe-commits
Author: ogoffart
Date: Fri Nov  4 01:50:59 2016
New Revision: 285986

URL: http://llvm.org/viewvc/llvm-project?rev=285986&view=rev
Log:
[python bindings] Expose CXCursor_FriendDecl as CursorKind.FRIEND_DECL

CXCursor_FriendDecl was added in r285984

Modified:
cfe/trunk/bindings/python/clang/cindex.py

Modified: cfe/trunk/bindings/python/clang/cindex.py
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/bindings/python/clang/cindex.py?rev=285986&r1=285985&r2=285986&view=diff
==
--- cfe/trunk/bindings/python/clang/cindex.py (original)
+++ cfe/trunk/bindings/python/clang/cindex.py Fri Nov  4 01:50:59 2016
@@ -1317,6 +1317,8 @@ CursorKind.MODULE_IMPORT_DECL = CursorKi
 CursorKind.TYPE_ALIAS_TEMPLATE_DECL = CursorKind(601)
 # A static_assert or _Static_assert node
 CursorKind.STATIC_ASSERT = CursorKind(602)
+# A friend declaration
+CursorKind.FRIEND_DECL = CursorKind(603)
 
 # A code completion overload candidate.
 CursorKind.OVERLOAD_CANDIDATE = CursorKind(700)


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


Re: r285258 - Refactor call emission to package the function pointer together with

2016-11-04 Thread Yaron Keren via cfe-commits
Hi John,

clang warns on this:

/llvm/tools/zapccs/../clang/include/../lib/CodeGen/CGCall.h:79:7: warning:
anonymous types declared in an anonymous union are an extension
[-Wnested-anon-types]
  struct {
  ^
/llvm/tools/zapccs/../clang/include/../lib/CodeGen/CGCall.h:83:7: warning:
anonymous types declared in an anonymous union are an extension
[-Wnested-anon-types]
  struct {
  ^



2016-10-27 2:46 GMT+03:00 John McCall via cfe-commits <
cfe-commits@lists.llvm.org>:

> Author: rjmccall
> Date: Wed Oct 26 18:46:34 2016
> New Revision: 285258
>
> URL: http://llvm.org/viewvc/llvm-project?rev=285258&view=rev
> Log:
> Refactor call emission to package the function pointer together with
> abstract information about the callee.  NFC.
>
> The goal here is to make it easier to recognize indirect calls and
> trigger additional logic in certain cases.  That logic will come in
> a later patch; in the meantime, I felt that this was a significant
> improvement to the code.
>
> Modified:
> cfe/trunk/include/clang/AST/Expr.h
> cfe/trunk/include/clang/CodeGen/CGFunctionInfo.h
> cfe/trunk/lib/AST/Expr.cpp
> cfe/trunk/lib/CodeGen/CGAtomic.cpp
> cfe/trunk/lib/CodeGen/CGBlocks.cpp
> cfe/trunk/lib/CodeGen/CGBuiltin.cpp
> cfe/trunk/lib/CodeGen/CGCUDARuntime.cpp
> cfe/trunk/lib/CodeGen/CGCXX.cpp
> cfe/trunk/lib/CodeGen/CGCXXABI.cpp
> cfe/trunk/lib/CodeGen/CGCXXABI.h
> cfe/trunk/lib/CodeGen/CGCall.cpp
> cfe/trunk/lib/CodeGen/CGCall.h
> cfe/trunk/lib/CodeGen/CGClass.cpp
> cfe/trunk/lib/CodeGen/CGDecl.cpp
> cfe/trunk/lib/CodeGen/CGException.cpp
> cfe/trunk/lib/CodeGen/CGExpr.cpp
> cfe/trunk/lib/CodeGen/CGExprCXX.cpp
> cfe/trunk/lib/CodeGen/CGExprComplex.cpp
> cfe/trunk/lib/CodeGen/CGObjC.cpp
> cfe/trunk/lib/CodeGen/CGObjCGNU.cpp
> cfe/trunk/lib/CodeGen/CGObjCMac.cpp
> cfe/trunk/lib/CodeGen/CGVTables.cpp
> cfe/trunk/lib/CodeGen/CodeGenFunction.h
> cfe/trunk/lib/CodeGen/CodeGenModule.h
> cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
> cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp
>
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


RE: r273191 - [OpenCL] Include opencl-c.h by default as a clang module

2016-11-04 Thread Anastasia Stulova via cfe-commits
Hi Richard,

I guess the problem is that the header file itself is really large and we have 
all these configurations that depending on versions/extensions expose different 
builtin libraries. They are all based on the core part though which is already 
large.

Ideally it would be nice to test the full functionality but I agree the price 
is probably quite high at the moment. Something we could immediately cut down 
though is all configurations with –fblocks. I think we are implicitly setting 
it now with –std=CL2.0.

Also I am not sure why we are testing different targets. I don’t think we have 
many target specific bits in the header? Apart from the common code I can I 
only see AMD specific part. Perhaps testing for SPIR and AMD targets only 
should be enough? Also the tests doesn’t really check for anything AMD 
specific. Perhaps that could be improved as well…

Cheers,
Anastasia

From: cfe-commits [mailto:cfe-commits-boun...@lists.llvm.org] On Behalf Of 
Richard Smith via cfe-commits
Sent: 03 November 2016 22:10
To: Yaxun Liu
Cc: cfe-commits
Subject: Re: r273191 - [OpenCL] Include opencl-c.h by default as a clang module

Hi,

This test (test/Headers/opencl-c-header.cl) is 
*extremely* slow -- it parses the 17KLoC opencl-c.h header 40 times, and on my 
Debug builds it's the slowest test by far, taking nearly 2 minutes to run 
*alone*. (For reference, the *entire clang test suite* finishes in 90s on my 
machine with this test removed.)

Please can you do something about this? Do we really need to parse this header 
in 40 configurations here?

On Mon, Jun 20, 2016 at 12:26 PM, Yaxun Liu via cfe-commits 
mailto:cfe-commits@lists.llvm.org>> wrote:
Author: yaxunl
Date: Mon Jun 20 14:26:00 2016
New Revision: 273191

URL: http://llvm.org/viewvc/llvm-project?rev=273191&view=rev
Log:
[OpenCL] Include opencl-c.h by default as a clang module

Include opencl-c.h by default as a module to utilize the automatic AST caching 
mechanism of clang modules.

Add an option -finclude-default-header to enable default header for OpenCL, 
which is off by default.

Differential Revision: http://reviews.llvm.org/D20444

Modified:
cfe/trunk/include/clang/Basic/LangOptions.def
cfe/trunk/include/clang/Driver/CC1Options.td
cfe/trunk/include/clang/Frontend/CompilerInvocation.h
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/lib/Headers/module.modulemap
cfe/trunk/test/Headers/opencl-c-header.cl

Modified: cfe/trunk/include/clang/Basic/LangOptions.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/LangOptions.def?rev=273191&r1=273190&r2=273191&view=diff
==
--- cfe/trunk/include/clang/Basic/LangOptions.def (original)
+++ cfe/trunk/include/clang/Basic/LangOptions.def Mon Jun 20 14:26:00 2016
@@ -218,7 +218,7 @@ LANGOPT(ObjCWeak, 1, 0, "Obj
 LANGOPT(ObjCSubscriptingLegacyRuntime , 1, 0, "Subscripting support in 
legacy ObjectiveC runtime")
 LANGOPT(FakeAddressSpaceMap , 1, 0, "OpenCL fake address space map")
 ENUM_LANGOPT(AddressSpaceMapMangling , AddrSpaceMapMangling, 2, ASMM_Target, 
"OpenCL address space map mangling mode")
-
+LANGOPT(IncludeDefaultHeader, 1, 0, "Include default header file for OpenCL")
 BENIGN_LANGOPT(DelayedTemplateParsing , 1, 0, "delayed template parsing")
 LANGOPT(BlocksRuntimeOptional , 1, 0, "optional blocks runtime")


Modified: cfe/trunk/include/clang/Driver/CC1Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CC1Options.td?rev=273191&r1=273190&r2=273191&view=diff
==
--- cfe/trunk/include/clang/Driver/CC1Options.td (original)
+++ cfe/trunk/include/clang/Driver/CC1Options.td Mon Jun 20 14:26:00 2016
@@ -612,6 +612,8 @@ def fallow_half_arguments_and_returns :
   HelpText<"Allow function arguments and returns of type half">;
 def fdefault_calling_conv_EQ : Joined<["-"], "fdefault-calling-conv=">,
   HelpText<"Set default MS calling convention">;
+def finclude_default_header : Flag<["-"], "finclude-default-header">,
+  HelpText<"Include the default header file for OpenCL">;

 // C++ TSes.
 def fcoroutines : Flag<["-"], "fcoroutines">,

Modified: cfe/trunk/include/clang/Frontend/CompilerInvocation.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/CompilerInvocation.h?rev=273191&r1=273190&r2=273191&view=diff
==
--- cfe/trunk/include/clang/Frontend/CompilerInvocation.h (original)
+++ cfe/trunk/include/clang/Frontend/CompilerInvocation.h Mon Jun 20 14:26:00 
2016
@@ -155,9 +155,10 @@ public:
   /// \param Opts - The LangOptions object to set up.
   /// \param IK - The input language.
   /// \param T - The target triple.
+  /// \param PPOpts - The PreprocessorOptions affected.
   /// \param LangStd - The in

Re: r285979 - Do not print enum underlying type if language is not C++11

2016-11-04 Thread Aaron Ballman via cfe-commits
On Fri, Nov 4, 2016 at 2:03 AM, Serge Pavlov via cfe-commits
 wrote:
> Author: sepavloff
> Date: Fri Nov  4 01:03:34 2016
> New Revision: 285979
>
> URL: http://llvm.org/viewvc/llvm-project?rev=285979&view=rev
> Log:
> Do not print enum underlying type if language is not C++11
>
> Output generated by option '-ast-print' must not contains enum
> base type specifications if source language does not include C++11.
>
> Modified:
> cfe/trunk/lib/AST/DeclPrinter.cpp

Test case?

~Aaron

>
> Modified: cfe/trunk/lib/AST/DeclPrinter.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclPrinter.cpp?rev=285979&r1=285978&r2=285979&view=diff
> ==
> --- cfe/trunk/lib/AST/DeclPrinter.cpp (original)
> +++ cfe/trunk/lib/AST/DeclPrinter.cpp Fri Nov  4 01:03:34 2016
> @@ -407,7 +407,7 @@ void DeclPrinter::VisitEnumDecl(EnumDecl
>}
>Out << *D;
>
> -  if (D->isFixed())
> +  if (D->isFixed() && D->getASTContext().getLangOpts().CPlusPlus11)
>  Out << " : " << D->getIntegerType().stream(Policy);
>
>if (D->isCompleteDefinition()) {
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r285994 - [test] Test that static_assert is properly visited in liblcang

2016-11-04 Thread Olivier Goffart via cfe-commits
Author: ogoffart
Date: Fri Nov  4 07:04:16 2016
New Revision: 285994

URL: http://llvm.org/viewvc/llvm-project?rev=285994&view=rev
Log:
[test] Test that static_assert is properly visited in liblcang

Added:
cfe/trunk/test/Index/load-staticassert.cpp

Added: cfe/trunk/test/Index/load-staticassert.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/load-staticassert.cpp?rev=285994&view=auto
==
--- cfe/trunk/test/Index/load-staticassert.cpp (added)
+++ cfe/trunk/test/Index/load-staticassert.cpp Fri Nov  4 07:04:16 2016
@@ -0,0 +1,11 @@
+
+static_assert(2 + 2 == 4, "Simple maths");
+
+// RUN: c-index-test -test-load-source all -fno-delayed-template-parsing 
-std=c++11 %s | FileCheck %s
+// CHECK: load-staticassert.cpp:2:1: StaticAssert=:2:1 (Definition) 
Extent=[2:1 - 2:42]
+// CHECK: load-staticassert.cpp:2:15: BinaryOperator= Extent=[2:15 - 2:25]
+// CHECK: load-staticassert.cpp:2:15: BinaryOperator= Extent=[2:15 - 2:20]
+// CHECK: load-staticassert.cpp:2:15: IntegerLiteral= Extent=[2:15 - 2:16]
+// CHECK: load-staticassert.cpp:2:19: IntegerLiteral= Extent=[2:19 - 2:20]
+// CHECK: load-staticassert.cpp:2:24: IntegerLiteral= Extent=[2:24 - 2:25]
+// CHECK: load-staticassert.cpp:2:27: StringLiteral="Simple maths" 
Extent=[2:27 - 2:41]


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


Re: r285979 - Do not print enum underlying type if language is not C++11

2016-11-04 Thread Serge Pavlov via cfe-commits
This following commit r285981 (Enhancement to test for -ast-print tests)
tests this change. Without it the test 'Coverage/ast-printing.c' fails on
Windows.

Thanks,
--Serge

2016-11-04 19:09 GMT+07:00 Aaron Ballman :

> On Fri, Nov 4, 2016 at 2:03 AM, Serge Pavlov via cfe-commits
>  wrote:
> > Author: sepavloff
> > Date: Fri Nov  4 01:03:34 2016
> > New Revision: 285979
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=285979&view=rev
> > Log:
> > Do not print enum underlying type if language is not C++11
> >
> > Output generated by option '-ast-print' must not contains enum
> > base type specifications if source language does not include C++11.
> >
> > Modified:
> > cfe/trunk/lib/AST/DeclPrinter.cpp
>
> Test case?
>
> ~Aaron
>
> >
> > Modified: cfe/trunk/lib/AST/DeclPrinter.cpp
> > URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/
> DeclPrinter.cpp?rev=285979&r1=285978&r2=285979&view=diff
> > 
> ==
> > --- cfe/trunk/lib/AST/DeclPrinter.cpp (original)
> > +++ cfe/trunk/lib/AST/DeclPrinter.cpp Fri Nov  4 01:03:34 2016
> > @@ -407,7 +407,7 @@ void DeclPrinter::VisitEnumDecl(EnumDecl
> >}
> >Out << *D;
> >
> > -  if (D->isFixed())
> > +  if (D->isFixed() && D->getASTContext().getLangOpts().CPlusPlus11)
> >  Out << " : " << D->getIntegerType().stream(Policy);
> >
> >if (D->isCompleteDefinition()) {
> >
> >
> > ___
> > cfe-commits mailing list
> > cfe-commits@lists.llvm.org
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r285979 - Do not print enum underlying type if language is not C++11

2016-11-04 Thread Aaron Ballman via cfe-commits
On Fri, Nov 4, 2016 at 8:50 AM, Serge Pavlov  wrote:
> This following commit r285981 (Enhancement to test for -ast-print tests)
> tests this change. Without it the test 'Coverage/ast-printing.c' fails on
> Windows.

Ah, thank you! :-)

~Aaron

>
> Thanks,
> --Serge
>
> 2016-11-04 19:09 GMT+07:00 Aaron Ballman :
>>
>> On Fri, Nov 4, 2016 at 2:03 AM, Serge Pavlov via cfe-commits
>>  wrote:
>> > Author: sepavloff
>> > Date: Fri Nov  4 01:03:34 2016
>> > New Revision: 285979
>> >
>> > URL: http://llvm.org/viewvc/llvm-project?rev=285979&view=rev
>> > Log:
>> > Do not print enum underlying type if language is not C++11
>> >
>> > Output generated by option '-ast-print' must not contains enum
>> > base type specifications if source language does not include C++11.
>> >
>> > Modified:
>> > cfe/trunk/lib/AST/DeclPrinter.cpp
>>
>> Test case?
>>
>> ~Aaron
>>
>> >
>> > Modified: cfe/trunk/lib/AST/DeclPrinter.cpp
>> > URL:
>> > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclPrinter.cpp?rev=285979&r1=285978&r2=285979&view=diff
>> >
>> > ==
>> > --- cfe/trunk/lib/AST/DeclPrinter.cpp (original)
>> > +++ cfe/trunk/lib/AST/DeclPrinter.cpp Fri Nov  4 01:03:34 2016
>> > @@ -407,7 +407,7 @@ void DeclPrinter::VisitEnumDecl(EnumDecl
>> >}
>> >Out << *D;
>> >
>> > -  if (D->isFixed())
>> > +  if (D->isFixed() && D->getASTContext().getLangOpts().CPlusPlus11)
>> >  Out << " : " << D->getIntegerType().stream(Policy);
>> >
>> >if (D->isCompleteDefinition()) {
>> >
>> >
>> > ___
>> > cfe-commits mailing list
>> > cfe-commits@lists.llvm.org
>> > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


RE: r273191 - [OpenCL] Include opencl-c.h by default as a clang module

2016-11-04 Thread Liu, Yaxun (Sam) via cfe-commits
Hi Richard/Anastasia,

I agree some tests are redundant. I will try to remove them.

Thanks.

Sam

From: Anastasia Stulova [mailto:anastasia.stul...@arm.com]
Sent: Friday, November 04, 2016 7:43 AM
To: Richard Smith ; Liu, Yaxun (Sam) 
Cc: nd ; cfe-commits@lists.llvm.org
Subject: RE: r273191 - [OpenCL] Include opencl-c.h by default as a clang module

Hi Richard,

I guess the problem is that the header file itself is really large and we have 
all these configurations that depending on versions/extensions expose different 
builtin libraries. They are all based on the core part though which is already 
large.

Ideally it would be nice to test the full functionality but I agree the price 
is probably quite high at the moment. Something we could immediately cut down 
though is all configurations with –fblocks. I think we are implicitly setting 
it now with –std=CL2.0.

Also I am not sure why we are testing different targets. I don’t think we have 
many target specific bits in the header? Apart from the common code I can I 
only see AMD specific part. Perhaps testing for SPIR and AMD targets only 
should be enough? Also the tests doesn’t really check for anything AMD 
specific. Perhaps that could be improved as well…

Cheers,
Anastasia

From: cfe-commits [mailto:cfe-commits-boun...@lists.llvm.org] On Behalf Of 
Richard Smith via cfe-commits
Sent: 03 November 2016 22:10
To: Yaxun Liu
Cc: cfe-commits
Subject: Re: r273191 - [OpenCL] Include opencl-c.h by default as a clang module

Hi,

This test (test/Headers/opencl-c-header.cl) is 
*extremely* slow -- it parses the 17KLoC opencl-c.h header 40 times, and on my 
Debug builds it's the slowest test by far, taking nearly 2 minutes to run 
*alone*. (For reference, the *entire clang test suite* finishes in 90s on my 
machine with this test removed.)

Please can you do something about this? Do we really need to parse this header 
in 40 configurations here?

On Mon, Jun 20, 2016 at 12:26 PM, Yaxun Liu via cfe-commits 
mailto:cfe-commits@lists.llvm.org>> wrote:
Author: yaxunl
Date: Mon Jun 20 14:26:00 2016
New Revision: 273191

URL: http://llvm.org/viewvc/llvm-project?rev=273191&view=rev
Log:
[OpenCL] Include opencl-c.h by default as a clang module

Include opencl-c.h by default as a module to utilize the automatic AST caching 
mechanism of clang modules.

Add an option -finclude-default-header to enable default header for OpenCL, 
which is off by default.

Differential Revision: http://reviews.llvm.org/D20444

Modified:
cfe/trunk/include/clang/Basic/LangOptions.def
cfe/trunk/include/clang/Driver/CC1Options.td
cfe/trunk/include/clang/Frontend/CompilerInvocation.h
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/lib/Headers/module.modulemap
cfe/trunk/test/Headers/opencl-c-header.cl

Modified: cfe/trunk/include/clang/Basic/LangOptions.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/LangOptions.def?rev=273191&r1=273190&r2=273191&view=diff
==
--- cfe/trunk/include/clang/Basic/LangOptions.def (original)
+++ cfe/trunk/include/clang/Basic/LangOptions.def Mon Jun 20 14:26:00 2016
@@ -218,7 +218,7 @@ LANGOPT(ObjCWeak, 1, 0, "Obj
 LANGOPT(ObjCSubscriptingLegacyRuntime , 1, 0, "Subscripting support in 
legacy ObjectiveC runtime")
 LANGOPT(FakeAddressSpaceMap , 1, 0, "OpenCL fake address space map")
 ENUM_LANGOPT(AddressSpaceMapMangling , AddrSpaceMapMangling, 2, ASMM_Target, 
"OpenCL address space map mangling mode")
-
+LANGOPT(IncludeDefaultHeader, 1, 0, "Include default header file for OpenCL")
 BENIGN_LANGOPT(DelayedTemplateParsing , 1, 0, "delayed template parsing")
 LANGOPT(BlocksRuntimeOptional , 1, 0, "optional blocks runtime")


Modified: cfe/trunk/include/clang/Driver/CC1Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CC1Options.td?rev=273191&r1=273190&r2=273191&view=diff
==
--- cfe/trunk/include/clang/Driver/CC1Options.td (original)
+++ cfe/trunk/include/clang/Driver/CC1Options.td Mon Jun 20 14:26:00 2016
@@ -612,6 +612,8 @@ def fallow_half_arguments_and_returns :
   HelpText<"Allow function arguments and returns of type half">;
 def fdefault_calling_conv_EQ : Joined<["-"], "fdefault-calling-conv=">,
   HelpText<"Set default MS calling convention">;
+def finclude_default_header : Flag<["-"], "finclude-default-header">,
+  HelpText<"Include the default header file for OpenCL">;

 // C++ TSes.
 def fcoroutines : Flag<["-"], "fcoroutines">,

Modified: cfe/trunk/include/clang/Frontend/CompilerInvocation.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/CompilerInvocation.h?rev=273191&r1=273190&r2=273191&view=diff
==
--- cfe/trunk/include/clang/Frontend/CompilerIn

RE: r273191 - [OpenCL] Include opencl-c.h by default as a clang module

2016-11-04 Thread Anastasia Stulova via cfe-commits
Great! Thanks!

From: Liu, Yaxun (Sam) [mailto:yaxun@amd.com]
Sent: 04 November 2016 13:52
To: Anastasia Stulova; Richard Smith
Cc: nd; cfe-commits@lists.llvm.org
Subject: RE: r273191 - [OpenCL] Include opencl-c.h by default as a clang module

Hi Richard/Anastasia,

I agree some tests are redundant. I will try to remove them.

Thanks.

Sam

From: Anastasia Stulova [mailto:anastasia.stul...@arm.com]
Sent: Friday, November 04, 2016 7:43 AM
To: Richard Smith mailto:rich...@metafoo.co.uk>>; Liu, 
Yaxun (Sam) mailto:yaxun@amd.com>>
Cc: nd mailto:n...@arm.com>>; 
cfe-commits@lists.llvm.org
Subject: RE: r273191 - [OpenCL] Include opencl-c.h by default as a clang module

Hi Richard,

I guess the problem is that the header file itself is really large and we have 
all these configurations that depending on versions/extensions expose different 
builtin libraries. They are all based on the core part though which is already 
large.

Ideally it would be nice to test the full functionality but I agree the price 
is probably quite high at the moment. Something we could immediately cut down 
though is all configurations with –fblocks. I think we are implicitly setting 
it now with –std=CL2.0.

Also I am not sure why we are testing different targets. I don’t think we have 
many target specific bits in the header? Apart from the common code I can I 
only see AMD specific part. Perhaps testing for SPIR and AMD targets only 
should be enough? Also the tests doesn’t really check for anything AMD 
specific. Perhaps that could be improved as well…

Cheers,
Anastasia

From: cfe-commits [mailto:cfe-commits-boun...@lists.llvm.org] On Behalf Of 
Richard Smith via cfe-commits
Sent: 03 November 2016 22:10
To: Yaxun Liu
Cc: cfe-commits
Subject: Re: r273191 - [OpenCL] Include opencl-c.h by default as a clang module

Hi,

This test (test/Headers/opencl-c-header.cl) is 
*extremely* slow -- it parses the 17KLoC opencl-c.h header 40 times, and on my 
Debug builds it's the slowest test by far, taking nearly 2 minutes to run 
*alone*. (For reference, the *entire clang test suite* finishes in 90s on my 
machine with this test removed.)

Please can you do something about this? Do we really need to parse this header 
in 40 configurations here?

On Mon, Jun 20, 2016 at 12:26 PM, Yaxun Liu via cfe-commits 
mailto:cfe-commits@lists.llvm.org>> wrote:
Author: yaxunl
Date: Mon Jun 20 14:26:00 2016
New Revision: 273191

URL: http://llvm.org/viewvc/llvm-project?rev=273191&view=rev
Log:
[OpenCL] Include opencl-c.h by default as a clang module

Include opencl-c.h by default as a module to utilize the automatic AST caching 
mechanism of clang modules.

Add an option -finclude-default-header to enable default header for OpenCL, 
which is off by default.

Differential Revision: http://reviews.llvm.org/D20444

Modified:
cfe/trunk/include/clang/Basic/LangOptions.def
cfe/trunk/include/clang/Driver/CC1Options.td
cfe/trunk/include/clang/Frontend/CompilerInvocation.h
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/lib/Headers/module.modulemap
cfe/trunk/test/Headers/opencl-c-header.cl

Modified: cfe/trunk/include/clang/Basic/LangOptions.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/LangOptions.def?rev=273191&r1=273190&r2=273191&view=diff
==
--- cfe/trunk/include/clang/Basic/LangOptions.def (original)
+++ cfe/trunk/include/clang/Basic/LangOptions.def Mon Jun 20 14:26:00 2016
@@ -218,7 +218,7 @@ LANGOPT(ObjCWeak, 1, 0, "Obj
 LANGOPT(ObjCSubscriptingLegacyRuntime , 1, 0, "Subscripting support in 
legacy ObjectiveC runtime")
 LANGOPT(FakeAddressSpaceMap , 1, 0, "OpenCL fake address space map")
 ENUM_LANGOPT(AddressSpaceMapMangling , AddrSpaceMapMangling, 2, ASMM_Target, 
"OpenCL address space map mangling mode")
-
+LANGOPT(IncludeDefaultHeader, 1, 0, "Include default header file for OpenCL")
 BENIGN_LANGOPT(DelayedTemplateParsing , 1, 0, "delayed template parsing")
 LANGOPT(BlocksRuntimeOptional , 1, 0, "optional blocks runtime")


Modified: cfe/trunk/include/clang/Driver/CC1Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CC1Options.td?rev=273191&r1=273190&r2=273191&view=diff
==
--- cfe/trunk/include/clang/Driver/CC1Options.td (original)
+++ cfe/trunk/include/clang/Driver/CC1Options.td Mon Jun 20 14:26:00 2016
@@ -612,6 +612,8 @@ def fallow_half_arguments_and_returns :
   HelpText<"Allow function arguments and returns of type half">;
 def fdefault_calling_conv_EQ : Joined<["-"], "fdefault-calling-conv=">,
   HelpText<"Set default MS calling convention">;
+def finclude_default_header : Flag<["-"], "finclude-default-header">,
+  HelpText<"Include the default header file for OpenCL">;

 // C++ TSes.
 def fcorouti

RE: D26157: [OpenCL] always use SPIR address spaces for kernel_arg_addr_space MD

2016-11-04 Thread Liu, Yaxun (Sam) via cfe-commits
Even if we use string for address space MD, we still need to define them 
somewhere. On the other hand, if we use SPIR enum, we just need to refer to the 
SPIR spec in the documenting comments.

Sam

-Original Message-
From: Pekka Jääskeläinen [mailto:pekka.jaaskelai...@gmail.com] 
Sent: Thursday, November 03, 2016 4:24 PM
To: pekka.jaaskelai...@gmail.com; Stellard, Thomas ; 
anastasia.stul...@arm.com; Liu, Yaxun (Sam) 
Cc: alexey.ba...@intel.com; xiuli...@outlook.com; cfe-commits@lists.llvm.org; 
Ding, Wei 
Subject: [PATCH] D26157: [OpenCL] always use SPIR address spaces for 
kernel_arg_addr_space MD

pekka.jaaskelainen added a comment.

Indeed, it requires wider scale discussion to get it right, and e.g. to pass 
the info to AA. But to be honest, I think OpenCL and CUDA are still considered 
'minority' languages in Clang/LLVM which makes me usually lean towards least 
intrusive implementation solutions whenever possible.

The matter was discussed 5 years ago: 
http://clang-developers.42468.n3.nabble.com/OpenCL-Address-Spaces-and-Runtimes-td2814865.html

The current situation of having the target AS in the MD is clearly not the way 
to go due to the loss of info for flat AS machines, so I think this discussion 
should be mostly about what should those designated IDs be.

Sure, we could use strings such as "opencl.global" there instead, but I'm not 
sure how much that adds value to simply having known integer IDs instead. SPIR 
1.2-2.0 is based on LLVM and designed to store info of OpenCL C kernels, 
therefore I thought the SPIR IDs are logical as we can just refer to SPIR specs 
in this case. Other alternative might be to retain the Clang's logical IDs, but 
I recall there was some special semantics/handling for AS IDs > 255. I might be 
wrong though.


Repository:
  rL LLVM

https://reviews.llvm.org/D26157



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


[clang-tools-extra] r285999 - [clang-tidy] Fixed readability-else-after-return for cascade statements

2016-11-04 Thread Malcolm Parsons via cfe-commits
Author: malcolm.parsons
Date: Fri Nov  4 11:32:14 2016
New Revision: 285999

URL: http://llvm.org/viewvc/llvm-project?rev=285999&view=rev
Log:
[clang-tidy] Fixed readability-else-after-return for cascade statements

Summary:
Fix generated by this check changed program semantics
in the case where 'if' was a part (direct child) of other statement.

Fixes PR30652.

Patch by Paweł Żukowski.

Reviewers: malcolm.parsons, alexfh, djasper

Subscribers: mgehre, omtcyfz, cfe-commits

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

Modified:
clang-tools-extra/trunk/clang-tidy/readability/ElseAfterReturnCheck.cpp
clang-tools-extra/trunk/test/clang-tidy/readability-else-after-return.cpp

Modified: 
clang-tools-extra/trunk/clang-tidy/readability/ElseAfterReturnCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/readability/ElseAfterReturnCheck.cpp?rev=285999&r1=285998&r2=285999&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/readability/ElseAfterReturnCheck.cpp 
(original)
+++ clang-tools-extra/trunk/clang-tidy/readability/ElseAfterReturnCheck.cpp Fri 
Nov  4 11:32:14 2016
@@ -23,7 +23,7 @@ void ElseAfterReturnCheck::registerMatch
   stmt(anyOf(returnStmt().bind("return"), continueStmt().bind("continue"),
  breakStmt().bind("break"), cxxThrowExpr().bind("throw")));
   Finder->addMatcher(
-  stmt(forEach(
+  compoundStmt(forEach(
   ifStmt(hasThen(stmt(
  anyOf(ControlFlowInterruptorMatcher,
compoundStmt(has(ControlFlowInterruptorMatcher),

Modified: 
clang-tools-extra/trunk/test/clang-tidy/readability-else-after-return.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-else-after-return.cpp?rev=285999&r1=285998&r2=285999&view=diff
==
--- clang-tools-extra/trunk/test/clang-tidy/readability-else-after-return.cpp 
(original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-else-after-return.cpp 
Fri Nov  4 11:32:14 2016
@@ -29,32 +29,60 @@ void f(int a) {
   else if (a > 10)
 return;
   else // comment-2
-  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: do not use 'else' after 'return'
-  // CHECK-FIXES: {{^}}  // comment-2
+  // CHECK-FIXES-NOT: {{^}}  // comment-2
 f(0);
+
+  if (a > 0)
+if (a < 10)
+  return;
+else // comment-3
+// CHECK-FIXES-NOT: {{^}}// comment-3
+  f(0);
+  else
+if (a > 10)
+  return;
+else // comment-4
+// CHECK-FIXES-NOT: {{^}}// comment-4
+  f(0);
+
+  if (a > 0) {
+if (a < 10)
+  return;
+else // comment-5
+// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: do not use 'else' after 
'return'
+// CHECK-FIXES: {{^}}// comment-5
+  f(0);
+  } else {
+if (a > 10)
+  return;
+else // comment-6
+// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: do not use 'else' after 
'return'
+// CHECK-FIXES: {{^}}// comment-6
+  f(0);
+  }
 }
 
 void foo() {
   for (unsigned x = 0; x < 42; ++x) {
 if (x) {
   continue;
-} else { // comment-3
+} else { // comment-7
 // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: do not use 'else' after 
'continue'
-// CHECK-FIXES: {{^}}} // comment-3
+// CHECK-FIXES: {{^}}} // comment-7
   x++;
 }
 if (x) {
   break;
-} else { // comment-4
+} else { // comment-8
 // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: do not use 'else' after 'break'
-// CHECK-FIXES: {{^}}} // comment-4
+// CHECK-FIXES: {{^}}} // comment-8
   x++;
 }
 if (x) {
   throw 42;
-} else { // comment-5
+} else { // comment-9
 // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: do not use 'else' after 'throw'
-// CHECK-FIXES: {{^}}} // comment-5
+// CHECK-FIXES: {{^}}} // comment-9
   x++;
 }
   }


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


[PATCH] D26302: [OpenCL] Remove redundant test for OpenCL header file

2016-11-04 Thread Yaxun Liu via cfe-commits
yaxunl created this revision.
yaxunl added a reviewer: Anastasia.
yaxunl added subscribers: cfe-commits, rsmith.

https://reviews.llvm.org/D26302

Files:
  test/Headers/opencl-c-header.cl


Index: test/Headers/opencl-c-header.cl
===
--- test/Headers/opencl-c-header.cl
+++ test/Headers/opencl-c-header.cl
@@ -1,33 +1,6 @@
 // RUN: %clang_cc1 -triple spir-unknown-unknown -internal-isystem 
../../lib/Headers -include opencl-c.h -emit-llvm -o - %s | FileCheck %s
 // RUN: %clang_cc1 -triple spir-unknown-unknown -internal-isystem 
../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -cl-std=CL1.1| 
FileCheck %s
-// RUN: %clang_cc1 -triple spir-unknown-unknown -internal-isystem 
../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -cl-std=CL1.2| 
FileCheck %s
-// RUN: %clang_cc1 -triple spir-unknown-unknown -internal-isystem 
../../lib/Headers -include opencl-c.h -fblocks -emit-llvm -o - %s 
-cl-std=CL2.0| FileCheck --check-prefix=CHECK20 %s
-// RUN: %clang_cc1 -triple spir64-unknown-unknown -internal-isystem 
../../lib/Headers -include opencl-c.h -emit-llvm -o - %s | FileCheck %s
-// RUN: %clang_cc1 -triple spir64-unknown-unknown -internal-isystem 
../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -cl-std=CL1.1| 
FileCheck %s
-// RUN: %clang_cc1 -triple spir64-unknown-unknown -internal-isystem 
../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -cl-std=CL1.2| 
FileCheck %s
-// RUN: %clang_cc1 -triple spir64-unknown-unknown -internal-isystem 
../../lib/Headers -include opencl-c.h -fblocks -emit-llvm -o - %s 
-cl-std=CL2.0| FileCheck --check-prefix=CHECK20 %s
-// RUN: %clang_cc1 -triple amdgcn-unknown-amdhsa -internal-isystem 
../../lib/Headers -include opencl-c.h -emit-llvm -o - %s | FileCheck %s
-// RUN: %clang_cc1 -triple amdgcn-unknown-amdhsa -internal-isystem 
../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -cl-std=CL1.1| 
FileCheck %s
-// RUN: %clang_cc1 -triple amdgcn-unknown-amdhsa -internal-isystem 
../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -cl-std=CL1.2| 
FileCheck %s
-// RUN: %clang_cc1 -triple amdgcn-unknown-amdhsa -internal-isystem 
../../lib/Headers -include opencl-c.h -fblocks -emit-llvm -o - %s 
-cl-std=CL2.0| FileCheck --check-prefix=CHECK20 %s
-// RUN: %clang_cc1 -triple ppc64-unknown-unknown -internal-isystem 
../../lib/Headers -include opencl-c.h -emit-llvm -o - %s | FileCheck %s
-// RUN: %clang_cc1 -triple ppc64-unknown-unknown -internal-isystem 
../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -cl-std=CL1.1| 
FileCheck %s
-// RUN: %clang_cc1 -triple ppc64-unknown-unknown -internal-isystem 
../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -cl-std=CL1.2| 
FileCheck %s
-// RUN: %clang_cc1 -triple ppc64-unknown-unknown -internal-isystem 
../../lib/Headers -include opencl-c.h -fblocks -emit-llvm -o - %s 
-cl-std=CL2.0| FileCheck --check-prefix=CHECK20 %s
-// RUN: %clang_cc1 -triple powerpc-unknown-unknown -internal-isystem 
../../lib/Headers -include opencl-c.h -emit-llvm -o - %s | FileCheck %s
-// RUN: %clang_cc1 -triple powerpc-unknown-unknown -internal-isystem 
../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -cl-std=CL1.1| 
FileCheck %s
-// RUN: %clang_cc1 -triple powerpc-unknown-unknown -internal-isystem 
../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -cl-std=CL1.2| 
FileCheck %s
-// RUN: %clang_cc1 -triple powerpc-unknown-unknown -internal-isystem 
../../lib/Headers -include opencl-c.h -fblocks -emit-llvm -o - %s 
-cl-std=CL2.0| FileCheck --check-prefix=CHECK20 %s
-// RUN: %clang_cc1 -triple nvptx-unknown-unknown -internal-isystem 
../../lib/Headers -include opencl-c.h -emit-llvm -o - %s | FileCheck %s
-// RUN: %clang_cc1 -triple nvptx-unknown-unknown -internal-isystem 
../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -cl-std=CL1.1| 
FileCheck %s
-// RUN: %clang_cc1 -triple nvptx-unknown-unknown -internal-isystem 
../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -cl-std=CL1.2| 
FileCheck %s
-// RUN: %clang_cc1 -triple nvptx-unknown-unknown -internal-isystem 
../../lib/Headers -include opencl-c.h -fblocks -emit-llvm -o - %s 
-cl-std=CL2.0| FileCheck --check-prefix=CHECK20 %s
-// RUN: %clang_cc1 -triple nvptx64-unknown-unknown -internal-isystem 
../../lib/Headers -include opencl-c.h -emit-llvm -o - %s | FileCheck %s
-// RUN: %clang_cc1 -triple nvptx64-unknown-unknown -internal-isystem 
../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -cl-std=CL1.1| 
FileCheck %s
-// RUN: %clang_cc1 -triple nvptx64-unknown-unknown -internal-isystem 
../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -cl-std=CL1.2| 
FileCheck %s
-// RUN: %clang_cc1 -triple nvptx64-unknown-unknown -internal-isystem 
../../lib/Headers -include opencl-c.h -fblocks -emit-llvm -o - %s 
-cl-std=CL2.0| FileCheck --check-prefix=CHECK20 %s
 
-// RUN: %clang_cc1 -triple x86_64-unknown-unknown -finclude-default-header 
-emit-llvm -o - %s | FileCheck %s
 // CHECK: _Z16con

[PATCH] D26301: [clang-tidy] Fix a regression issue introduced by r285239.

2016-11-04 Thread Haojian Wu via cfe-commits
hokein created this revision.
hokein added a reviewer: alexfh.
hokein added a subscriber: cfe-commits.

r285239 changes the behavior of AST CXXDefaultArgExpr node.

Update `modernize-use-nullptr` to handle CXXDefaultArgExpr correctly.


https://reviews.llvm.org/D26301

Files:
  clang-tidy/modernize/UseNullptrCheck.cpp
  test/clang-tidy/modernize-use-nullptr.cpp


Index: test/clang-tidy/modernize-use-nullptr.cpp
===
--- test/clang-tidy/modernize-use-nullptr.cpp
+++ test/clang-tidy/modernize-use-nullptr.cpp
@@ -217,3 +217,14 @@
 // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: use nullptr
 // CHECK-FIXES: C c;
 #undef F
+
+// Test default argument expression.
+struct D {
+  explicit D(void *t, int *c = NULL) {}
+  // CHECK-MESSAGES: :[[@LINE-1]]:32: warning: use nullptr
+  // CHECK-FIXES: explicit D(void *t, int *c = nullptr) {}
+};
+
+void test_default_argument() {
+  D(nullptr);
+}
Index: clang-tidy/modernize/UseNullptrCheck.cpp
===
--- clang-tidy/modernize/UseNullptrCheck.cpp
+++ clang-tidy/modernize/UseNullptrCheck.cpp
@@ -190,13 +190,21 @@
   // within a cast expression.
   bool VisitStmt(Stmt *S) {
 CastExpr *C = dyn_cast(S);
+// Catch the castExpr inside cxxDefaultArgExpr.
+if (CXXDefaultArgExpr *E = dyn_cast(S))
+  C = dyn_cast(E->getExpr());
 if (!C) {
   FirstSubExpr = nullptr;
   return true;
 }
+
 if (!FirstSubExpr)
   FirstSubExpr = C->getSubExpr()->IgnoreParens();
 
+// Ignore the expr if it is already a nullptr literal expr.
+if (isa(FirstSubExpr))
+  return true;
+
 if (C->getCastKind() != CK_NullToPointer &&
 C->getCastKind() != CK_NullToMemberPointer) {
   return true;


Index: test/clang-tidy/modernize-use-nullptr.cpp
===
--- test/clang-tidy/modernize-use-nullptr.cpp
+++ test/clang-tidy/modernize-use-nullptr.cpp
@@ -217,3 +217,14 @@
 // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: use nullptr
 // CHECK-FIXES: C c;
 #undef F
+
+// Test default argument expression.
+struct D {
+  explicit D(void *t, int *c = NULL) {}
+  // CHECK-MESSAGES: :[[@LINE-1]]:32: warning: use nullptr
+  // CHECK-FIXES: explicit D(void *t, int *c = nullptr) {}
+};
+
+void test_default_argument() {
+  D(nullptr);
+}
Index: clang-tidy/modernize/UseNullptrCheck.cpp
===
--- clang-tidy/modernize/UseNullptrCheck.cpp
+++ clang-tidy/modernize/UseNullptrCheck.cpp
@@ -190,13 +190,21 @@
   // within a cast expression.
   bool VisitStmt(Stmt *S) {
 CastExpr *C = dyn_cast(S);
+// Catch the castExpr inside cxxDefaultArgExpr.
+if (CXXDefaultArgExpr *E = dyn_cast(S))
+  C = dyn_cast(E->getExpr());
 if (!C) {
   FirstSubExpr = nullptr;
   return true;
 }
+
 if (!FirstSubExpr)
   FirstSubExpr = C->getSubExpr()->IgnoreParens();
 
+// Ignore the expr if it is already a nullptr literal expr.
+if (isa(FirstSubExpr))
+  return true;
+
 if (C->getCastKind() != CK_NullToPointer &&
 C->getCastKind() != CK_NullToMemberPointer) {
   return true;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D26207: [ClangTidy - performance-unnecessary-value-param] Only add "const" when current parameter is not already const qualified

2016-11-04 Thread Felix Berger via cfe-commits
flx added a comment.

Aaron, do you have any other comments or does the patch look good to you?


https://reviews.llvm.org/D26207



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


[PATCH] D26125: [clang-tidy] Fixed readability-else-after-return for cascade statements

2016-11-04 Thread Malcolm Parsons via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL285999: [clang-tidy] Fixed readability-else-after-return for 
cascade statements (authored by malcolm.parsons).

Changed prior to commit:
  https://reviews.llvm.org/D26125?vs=76604&id=76924#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D26125

Files:
  clang-tools-extra/trunk/clang-tidy/readability/ElseAfterReturnCheck.cpp
  clang-tools-extra/trunk/test/clang-tidy/readability-else-after-return.cpp


Index: clang-tools-extra/trunk/clang-tidy/readability/ElseAfterReturnCheck.cpp
===
--- clang-tools-extra/trunk/clang-tidy/readability/ElseAfterReturnCheck.cpp
+++ clang-tools-extra/trunk/clang-tidy/readability/ElseAfterReturnCheck.cpp
@@ -23,7 +23,7 @@
   stmt(anyOf(returnStmt().bind("return"), continueStmt().bind("continue"),
  breakStmt().bind("break"), cxxThrowExpr().bind("throw")));
   Finder->addMatcher(
-  stmt(forEach(
+  compoundStmt(forEach(
   ifStmt(hasThen(stmt(
  anyOf(ControlFlowInterruptorMatcher,
compoundStmt(has(ControlFlowInterruptorMatcher),
Index: clang-tools-extra/trunk/test/clang-tidy/readability-else-after-return.cpp
===
--- clang-tools-extra/trunk/test/clang-tidy/readability-else-after-return.cpp
+++ clang-tools-extra/trunk/test/clang-tidy/readability-else-after-return.cpp
@@ -29,32 +29,60 @@
   else if (a > 10)
 return;
   else // comment-2
-  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: do not use 'else' after 'return'
-  // CHECK-FIXES: {{^}}  // comment-2
+  // CHECK-FIXES-NOT: {{^}}  // comment-2
 f(0);
+
+  if (a > 0)
+if (a < 10)
+  return;
+else // comment-3
+// CHECK-FIXES-NOT: {{^}}// comment-3
+  f(0);
+  else
+if (a > 10)
+  return;
+else // comment-4
+// CHECK-FIXES-NOT: {{^}}// comment-4
+  f(0);
+
+  if (a > 0) {
+if (a < 10)
+  return;
+else // comment-5
+// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: do not use 'else' after 
'return'
+// CHECK-FIXES: {{^}}// comment-5
+  f(0);
+  } else {
+if (a > 10)
+  return;
+else // comment-6
+// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: do not use 'else' after 
'return'
+// CHECK-FIXES: {{^}}// comment-6
+  f(0);
+  }
 }
 
 void foo() {
   for (unsigned x = 0; x < 42; ++x) {
 if (x) {
   continue;
-} else { // comment-3
+} else { // comment-7
 // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: do not use 'else' after 
'continue'
-// CHECK-FIXES: {{^}}} // comment-3
+// CHECK-FIXES: {{^}}} // comment-7
   x++;
 }
 if (x) {
   break;
-} else { // comment-4
+} else { // comment-8
 // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: do not use 'else' after 'break'
-// CHECK-FIXES: {{^}}} // comment-4
+// CHECK-FIXES: {{^}}} // comment-8
   x++;
 }
 if (x) {
   throw 42;
-} else { // comment-5
+} else { // comment-9
 // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: do not use 'else' after 'throw'
-// CHECK-FIXES: {{^}}} // comment-5
+// CHECK-FIXES: {{^}}} // comment-9
   x++;
 }
   }


Index: clang-tools-extra/trunk/clang-tidy/readability/ElseAfterReturnCheck.cpp
===
--- clang-tools-extra/trunk/clang-tidy/readability/ElseAfterReturnCheck.cpp
+++ clang-tools-extra/trunk/clang-tidy/readability/ElseAfterReturnCheck.cpp
@@ -23,7 +23,7 @@
   stmt(anyOf(returnStmt().bind("return"), continueStmt().bind("continue"),
  breakStmt().bind("break"), cxxThrowExpr().bind("throw")));
   Finder->addMatcher(
-  stmt(forEach(
+  compoundStmt(forEach(
   ifStmt(hasThen(stmt(
  anyOf(ControlFlowInterruptorMatcher,
compoundStmt(has(ControlFlowInterruptorMatcher),
Index: clang-tools-extra/trunk/test/clang-tidy/readability-else-after-return.cpp
===
--- clang-tools-extra/trunk/test/clang-tidy/readability-else-after-return.cpp
+++ clang-tools-extra/trunk/test/clang-tidy/readability-else-after-return.cpp
@@ -29,32 +29,60 @@
   else if (a > 10)
 return;
   else // comment-2
-  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: do not use 'else' after 'return'
-  // CHECK-FIXES: {{^}}  // comment-2
+  // CHECK-FIXES-NOT: {{^}}  // comment-2
 f(0);
+
+  if (a > 0)
+if (a < 10)
+  return;
+else // comment-3
+// CHECK-FIXES-NOT: {{^}}// comment-3
+  f(0);
+  else
+if (a > 10)
+  return;
+else // comment-4
+// CHECK-FIXES-NOT: {{^}}// comment-4
+  f(0);
+
+  if (a > 0) {
+if (a < 10)
+  return;
+else // comment-5
+// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: do not use

[PATCH] D26302: [OpenCL] Remove redundant test for OpenCL header file

2016-11-04 Thread Anastasia Stulova via cfe-commits
Anastasia added inline comments.



Comment at: test/Headers/opencl-c-header.cl:48
-// ===
-// Compile for OpenCL 1.0 for the first time. A module should be generated.
-// RUN: %clang_cc1 -triple spir-unknown-unknown -emit-llvm -o - 
-finclude-default-header -fmodules -fimplicit-module-maps 
-fmodules-cache-path=%t -fdisable-module-hash -ftime-report %s 2>&1 | FileCheck 
--check-prefix=CHECK --check-prefix=CHECK-MOD %s

Considering that the above change removes around 30 parse times of CL header 
already, would it makes sense to keep this bit checking the modules for 
different versions are regenerated while for the same version are kept? This 
adds only 2 extra parsing of the header as I can see.

Are we sure such bits are covered by testing elsewhere?


https://reviews.llvm.org/D26302



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


[PATCH] D26196: AMDGPU: Translate null pointers in private and local addr space

2016-11-04 Thread Yaxun Liu via cfe-commits
yaxunl added a comment.

In https://reviews.llvm.org/D26196#586433, @rjmccall wrote:

> I think there are a number of conceptual questions here, chiefly among them 
> whether an llvm::ConstantPointerNull in an address-space type should have the 
> correct representation for the target.  If the decision for that is "no", 
> then ok, we can produce an explicit representation in IRGen; however, we will 
> need to update quite a bit of code in order to do so correctly.


As Tom and Matt pointed out, llvm::ConstantPointerNull is the desired 
representation for a null pointer. However, currently LLVM assumes that it has 
0 value extensively, and there is no plan to change that in a foreseeable 
future. This patch is intended to provide a workaround for this restriction by 
representing non-zero null pointer in an alternative way.

> In general, frontend address spaces don't necessarily correspond to IR 
> address spaces.  All of your address-space operations need to be 
> parameterized with a frontend address space (or both a source and dest 
> address space for conversions).  The question you should be keeping in mind 
> when designing these APIs is "what if there were an address space defined to 
> be exactly the generic address space, only with a different null value?"

Since non-zero null pointer is usually resulted from target restrictions (as in 
the case of amdgpu target), whether a null pointer needs a special 
representation only depends on the target or IR address space. Therefore we do 
not need to consider the address space in the source language. Hopefully this 
can simplify the implementation.


https://reviews.llvm.org/D26196



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


[PATCH] D26195: Ignore incomplete types when determining whether they are expensive to copy

2016-11-04 Thread Felix Berger via cfe-commits
flx removed rL LLVM as the repository for this revision.
flx updated this revision to Diff 76928.

https://reviews.llvm.org/D26195

Files:
  clang-tidy/utils/TypeTraits.cpp
  test/clang-tidy/performance-unnecessary-value-param.cpp


Index: test/clang-tidy/performance-unnecessary-value-param.cpp
===
--- test/clang-tidy/performance-unnecessary-value-param.cpp
+++ test/clang-tidy/performance-unnecessary-value-param.cpp
@@ -1,4 +1,4 @@
-// RUN: %check_clang_tidy %s performance-unnecessary-value-param %t
+// RUN: %check_clang_tidy %s performance-unnecessary-value-param %t -- 
-fix-errors -- --std=c++11
 
 // CHECK-FIXES: #include 
 
@@ -237,3 +237,8 @@
   ExpensiveToCopyType B;
   B = A;
 }
+
+struct IncompleteType;
+void NegativeForIncompleteType(IncompleteType I) {
+  // CHECK-MESSAGES: [[@LINE-1]]:47: error: variable has incomplete type 
'IncompleteType' [clang-diagnostic-error]
+}
Index: clang-tidy/utils/TypeTraits.cpp
===
--- clang-tidy/utils/TypeTraits.cpp
+++ clang-tidy/utils/TypeTraits.cpp
@@ -41,7 +41,7 @@
 
 llvm::Optional isExpensiveToCopy(QualType Type,
const ASTContext &Context) {
-  if (Type->isDependentType())
+  if (Type->isDependentType() || Type->isIncompleteType())
 return llvm::None;
   return !Type.isTriviallyCopyableType(Context) &&
  !classHasTrivialCopyAndDestroy(Type) &&


Index: test/clang-tidy/performance-unnecessary-value-param.cpp
===
--- test/clang-tidy/performance-unnecessary-value-param.cpp
+++ test/clang-tidy/performance-unnecessary-value-param.cpp
@@ -1,4 +1,4 @@
-// RUN: %check_clang_tidy %s performance-unnecessary-value-param %t
+// RUN: %check_clang_tidy %s performance-unnecessary-value-param %t -- -fix-errors -- --std=c++11
 
 // CHECK-FIXES: #include 
 
@@ -237,3 +237,8 @@
   ExpensiveToCopyType B;
   B = A;
 }
+
+struct IncompleteType;
+void NegativeForIncompleteType(IncompleteType I) {
+  // CHECK-MESSAGES: [[@LINE-1]]:47: error: variable has incomplete type 'IncompleteType' [clang-diagnostic-error]
+}
Index: clang-tidy/utils/TypeTraits.cpp
===
--- clang-tidy/utils/TypeTraits.cpp
+++ clang-tidy/utils/TypeTraits.cpp
@@ -41,7 +41,7 @@
 
 llvm::Optional isExpensiveToCopy(QualType Type,
const ASTContext &Context) {
-  if (Type->isDependentType())
+  if (Type->isDependentType() || Type->isIncompleteType())
 return llvm::None;
   return !Type.isTriviallyCopyableType(Context) &&
  !classHasTrivialCopyAndDestroy(Type) &&
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D26195: Ignore incomplete types when determining whether they are expensive to copy

2016-11-04 Thread Felix Berger via cfe-commits
flx added a comment.

In https://reviews.llvm.org/D26195#585917, @aaron.ballman wrote:

> In https://reviews.llvm.org/D26195#585198, @flx wrote:
>
> > In https://reviews.llvm.org/D26195#585091, @aaron.ballman wrote:
> >
> > > In https://reviews.llvm.org/D26195#584958, @flx wrote:
> > >
> > > > In https://reviews.llvm.org/D26195#584730, @aaron.ballman wrote:
> > > >
> > > > > In https://reviews.llvm.org/D26195#584724, @flx wrote:
> > > > >
> > > > > > In https://reviews.llvm.org/D26195#584712, @aaron.ballman wrote:
> > > > > >
> > > > > > > Please add a test case with an incomplete type that would 
> > > > > > > exercise this code path, otherwise, LGTM.
> > > > > >
> > > > > >
> > > > > > Hi Aaron,
> > > > > >
> > > > > > do you have any advise on how to add an incomplete type? When 
> > > > > > debugging this I had a compilation unit that failed to compile 
> > > > > > causing it, but I'm not sure this is a good way to add a test case.
> > > > >
> > > > >
> > > > > A type like `class C;` is an incomplete type, as is `void`, so 
> > > > > perhaps you can find a check that would let such a construct call 
> > > > > through to `isExpensiveToCopy()`.
> > > >
> > > >
> > > > Great, this works and I was able to see the check produce a false 
> > > > positive without the proposed change here, but the test code introduces 
> > > > a compile error now due to the incomplete type used in the function 
> > > > definition. Is there a way to suppress that?
> > >
> > >
> > > Unlikely -- fixing the compile error likely makes the type not expensive 
> > > to copy by using a pointer (or reference). This may be tricky to test 
> > > because the times when you would call `isExpensiveToCopy()` is with types 
> > > that are going to be logically required to be complete. I am not certain 
> > > the compile error is actually a problem though -- I would imagine your 
> > > existing false-positives (that you mentioned in the patch summary) are 
> > > cases where there is a compile error *and* a clang-tidy diagnostic, so 
> > > the test may simply be "check that there's only a compile error and no 
> > > clang-tidy diagnostic where there used to be a false-positive one."
> >
> >
> > That's exactly the case, my question here is how can I make the test 
> > succeed in the face of a compile error, i.e. by expecting the error as well?
>
>
> Doesn't `// CHECK-MESSAGES: :[[@LINE-1]]:3: error: blah blah blah` work?


Yes, that was needed. I also had to change the run command to add "-fix-errors" 
to still apply fixes in the face of compile errors. I also added you as 
reviewer, Aaron.


https://reviews.llvm.org/D26195



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


[PATCH] D26304: [Power9] vector load/store with length - clang portion

2016-11-04 Thread Zaara Syeda via cfe-commits
syzaara created this revision.
syzaara added reviewers: nemanjai, kbarton, amehsan, sfertile, jtony, lei.
syzaara added subscribers: echristo, cfe-commits.

Add builtin functions for prototypes:

vector signed char vec_xl_len (signed char *, size_t);
vector unsigned char vec_xl_len (unsigned char *, size_t);
vector signed int vec_xl_len (signed int *, size_t);
vector unsigned int vec_xl_len (unsigned int *, size_t);
vector signed __int128 vec_xl_len (signed __int128 *, size_t);
vector unsigned __int128 vec_xl_len (unsigned __int128 *, size_t);
vector signed long long vec_xl_len (signed long long *, size_t);
vector unsigned long long vec_xl_len (unsigned long long *, size_t);
vector signed short vec_xl_len (signed short *, size_t);
vector unsigned short vec_xl_len (unsigned short *, size_t);
vector double vec_xl_len (double *, size_t);
vector float vec_xl_len (float *, size_t);

vector unsigned char vec_xl_len_r (unsigned char *, size_t);

void vec_xst_len (vector signed char, signed char *, size_t);
void vec_xst_len (vector unsigned char, unsigned char *, size_t);
void vec_xst_len (vector signed int, signed int *, size_t);
void vec_xst_len (vector unsigned int, unsigned int *, size_t);
void vec_xst_len (vector signed __int128, signed __int128 *, size_t);
void vec_xst_len (vector unsigned __int128, unsigned __int128 *, size_t);
void vec_xst_len (vector signed long long, signed long long *, size_t);
void vec_xst_len (vector unsigned long long, unsigned long long *, size_t);
void vec_xst_len (vector signed short, signed short *, size_t);
void vec_xst_len (vector unsigned short, unsigned short *, size_t);
void vec_xst_len (vector double, double *, size_t);
void vec_xst_len (vector float, float *, size_t);

void vec_xst_len_r (vector unsigned char, unsigned char *, size_t);


https://reviews.llvm.org/D26304

Files:
  include/clang/Basic/BuiltinsPPC.def
  lib/CodeGen/CGBuiltin.cpp
  lib/Headers/altivec.h
  test/CodeGen/builtins-ppc-p9vector.c

Index: test/CodeGen/builtins-ppc-p9vector.c
===
--- test/CodeGen/builtins-ppc-p9vector.c
+++ test/CodeGen/builtins-ppc-p9vector.c
@@ -26,6 +26,23 @@
 vector unsigned __int128 vui128a, vui128b;
 vector signed __int128 vsi128a, vsi128b;
 
+float af[4] = {23.4f, 56.7f, 89.0f, 12.3f};
+double ad[2] = {23.4, 56.7};
+signed char asc[16] = { -8,  9, -10, 11, -12, 13, -14, 15,
+-0,  1,  -2,  3,  -4,  5,  -6,  7};
+unsigned char auc[16] = { 8,  9, 10, 11, 12, 13, 14, 15,
+  0,  1,  2,  3,  4,  5,  6,  7};
+signed short ass[8] = { -1, 2, -3, 4, -5, 6, -7, 8 };
+unsigned short aus[8] = { 0, 1, 2, 3, 4, 5, 6, 7 };
+signed int asi[4] = { -1, 2, -3, 4 };
+unsigned int aui[4] = { 0, 1, 2, 3 };
+signed long asl[2] = { -1L, 2L };
+unsigned long aul[2] = { 1L, 2L };
+signed long long asll[2] = {1LL, 1LL};
+unsigned long long aull[2] = {-1LL, 1LL};
+signed __int128 asint128[1] = {-1};
+unsigned __int128 auint128[1] = {1};
+
 unsigned test1(void) {
 // CHECK-BE: @llvm.ppc.altivec.vcmpequb(<16 x i8>
 // CHECK-BE: @llvm.ctlz.v2i64(<2 x i64>
@@ -827,4 +844,181 @@
 // CHECK-NEXT: ret <16 x i8>
   return vec_srv (vuca, vucb);
 }
+vector unsigned char test74(void) {
+// CHECK-BE: @llvm.ppc.vsx.lxvl(i8* %{{.+}}, i32
+// CHECK-BE-NEXT-NEXT: ret <16 x i8>
+// CHECK: @llvm.ppc.vsx.lxvl(i8* %{{.+}}, i32
+// CHECK-NEXT-NEXT: ret <16 x i8>
+  return vec_xl_len(auc,0);
+}
+vector signed char test75(void) {
+// CHECK-BE: @llvm.ppc.vsx.lxvl(i8* %{{.+}}, i32
+// CHECK-BE-NEXT-NEXT: ret <16 x i8>
+// CHECK: @llvm.ppc.vsx.lxvl(i8* %{{.+}}, i32
+// CHECK-NEXT-NEXT: ret <16 x i8>
+  return vec_xl_len(asc,0);
+}
+vector unsigned short test76(void) {
+// CHECK-BE: @llvm.ppc.vsx.lxvl(i8* %{{.+}}, i32
+// CHECK-BE-NEXT-NEXT: ret <8 x i16>
+// CHECK: @llvm.ppc.vsx.lxvl(i8* %{{.+}}, i32
+// CHECK-NEXT-NEXT: ret <8 x i16>
+  return vec_xl_len(aus,0);
+}
+vector signed short test77(void) {
+// CHECK-BE: @llvm.ppc.vsx.lxvl(i8* %{{.+}}, i32
+// CHECK-BE-NEXT-NEXT: ret <8 x i16>
+// CHECK: @llvm.ppc.vsx.lxvl(i8* %{{.+}}, i32
+// CHECK-NEXT-NEXT: ret <8 x i16>
+  return vec_xl_len(ass,0);
+}
+vector unsigned int test78(void) {
+// CHECK-BE: @llvm.ppc.vsx.lxvl(i8* %{{.+}}, i32
+// CHECK-BE-NEXT: ret <4 x i32>
+// CHECK: @llvm.ppc.vsx.lxvl(i8* %{{.+}}, i32
+// CHECK-NEXT: ret <4 x i32>
+  return vec_xl_len(aui,0);
+}
+
+vector signed int test79(void) {
+// CHECK-BE: @llvm.ppc.vsx.lxvl(i8* %{{.+}}, i32
+// CHECK-BE-NEXT: ret <4 x i32>
+// CHECK: @llvm.ppc.vsx.lxvl(i8* %{{.+}}, i32
+// CHECK-NEXT: ret <4 x i32>
+  return vec_xl_len(asi,0);
+}
+
+vector float test80(void) {
+// CHECK-BE: @llvm.ppc.vsx.lxvl(i8* %{{.+}}, i32
+// CHECK-BE-NEXT-NEXT: ret <4 x i32>
+// CHECK: @llvm.ppc.vsx.lxvl(i8* %{{.+}}, i32
+// CHECK-NEXT-NEXT: ret <4 x i32>
+  return vec_xl_len(af,0);
+}
+
+vector unsigned long long test81(void) {
+// CHECK-BE: @llvm.ppc.vsx.lxvl(i8* %{{.+}}, i32
+// CHECK-BE-NEXT-NEXT: ret <2 x i64>
+// CHECK: @llvm.pp

[PATCH] D26207: [ClangTidy - performance-unnecessary-value-param] Only add "const" when current parameter is not already const qualified

2016-11-04 Thread Aaron Ballman via cfe-commits
aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

LGTM!




Comment at: test/clang-tidy/performance-unnecessary-value-param.cpp:242
+// Case where parameter in declaration is already const-qualified but not in
+// implementation. Make sure a second 'const' is not added to the declaration.
+void PositiveConstDeclaration(const ExpensiveToCopyType A);

flx wrote:
> aaron.ballman wrote:
> > flx wrote:
> > > aaron.ballman wrote:
> > > > flx wrote:
> > > > > aaron.ballman wrote:
> > > > > > This comment doesn't really match the test cases. The original code 
> > > > > > has two *different* declarations (only one of which is a 
> > > > > > definition), not one declaration and one redeclaration with the 
> > > > > > definition.
> > > > > > 
> > > > > > I think what is really happening is that it is adding the `&` 
> > > > > > qualifier to the first declaration, and adding the `const` and `&` 
> > > > > > qualifiers to the second declaration, and the result is that you 
> > > > > > get harmonization. But it brings up a question to me; what happens 
> > > > > > with:
> > > > > > ```
> > > > > > void f1(ExpensiveToCopyType A) {
> > > > > > }
> > > > > > 
> > > > > > void f1(const ExpensiveToCopyType A) {
> > > > > > 
> > > > > > }
> > > > > > ```
> > > > > > Does the fix-it try to create two definitions of the same function?
> > > > > Good catch. I added the reverse case as well and modified the check 
> > > > > slightly to make that case work as well.
> > > > Can you add a test like this as well?
> > > > ```
> > > > void f1(ExpensiveToCopyType A); // Declared, not defined
> > > > 
> > > > void f1(const ExpensiveToCopyType A) {}
> > > > void f1(const ExpensiveToCopyType &A) {}
> > > > ```
> > > > I'm trying to make sure this check does not suggest a fixit that breaks 
> > > > existing code because of overload sets. I would expect a diagnostic for 
> > > > the first two declarations, but no fixit suggestion for `void f1(const 
> > > > ExpensiveToCopyType A)` because that would result in an ambiguous 
> > > > function definition.
> > > The current code suggests the following fixes:
> > > 
> > > -void f1(ExpensiveToCopyType A); // Declared, not defined
> > > +void f1(const ExpensiveToCopyType& A); // Declared, not defined
> > >  
> > > -void f1(const ExpensiveToCopyType A) {}
> > > +void f1(const ExpensiveToCopyType& A) {}
> > >  void f1(const ExpensiveToCopyType &A) {}
> > > 
> > > and we get a warning message for the void f1(const ExpensiveToCopyType A) 
> > > {}
> > > 
> > > I think the compiler sees "void f1(const ExpensiveToCopyType A) {}" as 
> > > definition of "void f1(ExpensiveToCopyType A); // Declared, not defined" 
> > > and thus both places get fixed.
> > > 
> > > Since the check is catching cases where the value argument is either 
> > > modified or could be moved it and this is not the case here it is worth 
> > > raising this issue of what looks like a very subtle difference in 
> > > overrides.
> > > 
> > > My inclination is to leave this as is. What do you suggest we do?
> > > 
> > I think this behavior isn't new with your changes, so we can leave it as 
> > is. However, we should file a bug report about the bad behavior with 
> > overload sets (and provide the example that's failing) so that we don't 
> > forget to come back and fix the functionality.
> Filed to track this: https://llvm.org/bugs/show_bug.cgi?id=30902 (
Thank you for filing the bug report.


https://reviews.llvm.org/D26207



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


[PATCH] D26195: Ignore incomplete types when determining whether they are expensive to copy

2016-11-04 Thread Aaron Ballman via cfe-commits
aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

LGTM, modulo a small commenting request.




Comment at: test/clang-tidy/performance-unnecessary-value-param.cpp:242
+struct IncompleteType;
+void NegativeForIncompleteType(IncompleteType I) {
+  // CHECK-MESSAGES: [[@LINE-1]]:47: error: variable has incomplete type 
'IncompleteType' [clang-diagnostic-error]

You should put a comment before this function that explains why this 
seemingly-incongruous test lives here. Something along the lines of "Ensure 
that incomplete types result in an error from the frontend and not a clang-tidy 
diagnostic about IncompleteType being expensive to copy."


https://reviews.llvm.org/D26195



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


[PATCH] D26267: [Modules] Include builtins with #include instead of #import for ObjC

2016-11-04 Thread Bruno Cardoso Lopes via cfe-commits
bruno marked an inline comment as done.
bruno added a comment.

In https://reviews.llvm.org/D26267#586971, @v.g.vassilev wrote:

> Could you include more context when creating the diff eg. git diff -U, or 
> equivalent.


I did, -U9 actually, not sure why you're not getting it...




Comment at: include/clang/Lex/ModuleMap.h:278
+  /// headers.
+  static bool isBuiltinHeader(StringRef FileName);
+

v.g.vassilev wrote:
> It seems this is in the private section and it is accessed by 
> FrontendActions.cpp:224.
Oops!


https://reviews.llvm.org/D26267



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


[PATCH] D26267: [Modules] Include builtins with #include instead of #import for ObjC

2016-11-04 Thread Bruno Cardoso Lopes via cfe-commits
bruno updated this revision to Diff 76931.
bruno marked an inline comment as done.
bruno added a comment.

Update patch after Vassil's comments!


https://reviews.llvm.org/D26267

Files:
  include/clang/Lex/ModuleMap.h
  lib/Frontend/FrontendActions.cpp
  lib/Lex/ModuleMap.cpp
  test/Modules/Inputs/libc-libcxx/sysroot/usr/include/c++/v1/cstddef
  test/Modules/Inputs/libc-libcxx/sysroot/usr/include/c++/v1/math.h
  test/Modules/Inputs/libc-libcxx/sysroot/usr/include/c++/v1/module.modulemap
  test/Modules/Inputs/libc-libcxx/sysroot/usr/include/c++/v1/stddef.h
  test/Modules/Inputs/libc-libcxx/sysroot/usr/include/c++/v1/type_traits
  test/Modules/Inputs/libc-libcxx/sysroot/usr/include/module.modulemap
  test/Modules/Inputs/libc-libcxx/sysroot/usr/include/stddef.h
  test/Modules/Inputs/libc-libcxx/sysroot/usr/include/sys/_types/_ptrdiff_t.h
  test/Modules/Inputs/libc-libcxx/sysroot/usr/include/sys/_types/_types.h
  test/Modules/builtin-import.mm

Index: test/Modules/builtin-import.mm
===
--- /dev/null
+++ test/Modules/builtin-import.mm
@@ -0,0 +1,6 @@
+// REQUIRES: system-darwin
+
+// RUN: rm -rf %t
+// RUN: %clang -cc1 -fsyntax-only -nostdinc++ -isysroot %S/Inputs/libc-libcxx/sysroot -isystem %S/Inputs/libc-libcxx/sysroot/usr/include/c++/v1 -F%S/Inputs/libc-libcxx/sysroot/Frameworks -std=c++11 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -x objective-c++ -fmodules-local-submodule-visibility %s
+
+#include 
Index: test/Modules/Inputs/libc-libcxx/sysroot/usr/include/sys/_types/_types.h
===
--- /dev/null
+++ test/Modules/Inputs/libc-libcxx/sysroot/usr/include/sys/_types/_types.h
@@ -0,0 +1,6 @@
+#ifndef _SYS_TYPES_UMBRELLA
+#define _SYS_TYPES_UMBRELLA
+
+#include "_ptrdiff_t.h"
+
+#endif
Index: test/Modules/Inputs/libc-libcxx/sysroot/usr/include/sys/_types/_ptrdiff_t.h
===
--- /dev/null
+++ test/Modules/Inputs/libc-libcxx/sysroot/usr/include/sys/_types/_ptrdiff_t.h
@@ -0,0 +1,4 @@
+#ifndef _PTRDIFF_T
+#define _PTRDIFF_T
+typedef int * ptrdiff_t;
+#endif /* _PTRDIFF_T */
Index: test/Modules/Inputs/libc-libcxx/sysroot/usr/include/stddef.h
===
--- test/Modules/Inputs/libc-libcxx/sysroot/usr/include/stddef.h
+++ test/Modules/Inputs/libc-libcxx/sysroot/usr/include/stddef.h
@@ -1 +1,6 @@
-// stddef.h
+#ifndef __STDDEF_H__
+#define __STDDEF_H__
+
+#include "sys/_types/_ptrdiff_t.h"
+
+#endif
Index: test/Modules/Inputs/libc-libcxx/sysroot/usr/include/module.modulemap
===
--- test/Modules/Inputs/libc-libcxx/sysroot/usr/include/module.modulemap
+++ test/Modules/Inputs/libc-libcxx/sysroot/usr/include/module.modulemap
@@ -5,4 +5,12 @@
   module stdint { header "stdint.h" export * }
   module stdio { header "stdio.h" export * }
   module util { header "util.h" export * }
+  module POSIX {
+module sys {
+  module types {
+umbrella header "sys/_types/_types.h"
+export *
+  }
+}
+  }
 }
Index: test/Modules/Inputs/libc-libcxx/sysroot/usr/include/c++/v1/type_traits
===
--- /dev/null
+++ test/Modules/Inputs/libc-libcxx/sysroot/usr/include/c++/v1/type_traits
@@ -0,0 +1,6 @@
+#ifndef _LIBCPP_TYPE_TRAITS
+#define _LIBCPP_TYPE_TRAITS
+
+#include 
+
+#endif
Index: test/Modules/Inputs/libc-libcxx/sysroot/usr/include/c++/v1/stddef.h
===
--- test/Modules/Inputs/libc-libcxx/sysroot/usr/include/c++/v1/stddef.h
+++ test/Modules/Inputs/libc-libcxx/sysroot/usr/include/c++/v1/stddef.h
@@ -2,5 +2,6 @@
 #define LIBCXX_STDDEF_H
 
 #include <__config>
+#include_next 
 
 #endif
Index: test/Modules/Inputs/libc-libcxx/sysroot/usr/include/c++/v1/module.modulemap
===
--- test/Modules/Inputs/libc-libcxx/sysroot/usr/include/c++/v1/module.modulemap
+++ test/Modules/Inputs/libc-libcxx/sysroot/usr/include/c++/v1/module.modulemap
@@ -6,5 +6,7 @@
   // FIXME: remove "textual" from stdint module below once the issue
   // between umbrella headers and builtins is resolved.
   module stdint { textual header "stdint.h" export * }
+  module type_traits { header "type_traits" export * }
+  module cstddef { header "cstddef" export * }
   module __config { header "__config" export * }
 }
Index: test/Modules/Inputs/libc-libcxx/sysroot/usr/include/c++/v1/math.h
===
--- test/Modules/Inputs/libc-libcxx/sysroot/usr/include/c++/v1/math.h
+++ test/Modules/Inputs/libc-libcxx/sysroot/usr/include/c++/v1/math.h
@@ -4,4 +4,6 @@
 #include_next 
 template T abs(T t) { return (t < 0) ? -t : t; }
 
+#include 
+
 #endif
Index: test/Modules/Inputs/libc-libcxx/sysroot/usr/include

[PATCH] D24933: Enable configuration files in clang

2016-11-04 Thread Michał Górny via cfe-commits
mgorny added a comment.

I don't agree with the argumentation of @hans; however, I have my own concerns. 
I personally dislike the idea of reusing command-line option format for this. 
While I can see this is the simplest solution, it brings at least a few 
problems and questions. I'm afraid that this would result in a poor solution 
that gradually gets worse as people try to workaround its limitations.

Maybe it'd be better to take a step back and attempt to create a regular, 
.ini/.conf-style configuration file. One particular advantage of that is that 
we can precisely decide which options to support and how to support them. I 
think this could be better both for opponents of 'free configuration' (since it 
will be less powerful and more controlled), and for proponents of nice 
configuration files (such as me).

For example, the advantage of this is that `-std=` will no longer magically 
apply to all source types. If we decide to have a default -std= control via 
system configuration, we can add separate options for each language (which 
wouldn't be really useful as command-line options).


https://reviews.llvm.org/D24933



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


[PATCH] D26302: [OpenCL] Remove redundant test for OpenCL header file

2016-11-04 Thread Yaxun Liu via cfe-commits
yaxunl updated this revision to Diff 76932.
yaxunl added a comment.

Revised as Anastasia suggested.


https://reviews.llvm.org/D26302

Files:
  test/Headers/opencl-c-header.cl


Index: test/Headers/opencl-c-header.cl
===
--- test/Headers/opencl-c-header.cl
+++ test/Headers/opencl-c-header.cl
@@ -1,33 +1,6 @@
 // RUN: %clang_cc1 -triple spir-unknown-unknown -internal-isystem 
../../lib/Headers -include opencl-c.h -emit-llvm -o - %s | FileCheck %s
 // RUN: %clang_cc1 -triple spir-unknown-unknown -internal-isystem 
../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -cl-std=CL1.1| 
FileCheck %s
-// RUN: %clang_cc1 -triple spir-unknown-unknown -internal-isystem 
../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -cl-std=CL1.2| 
FileCheck %s
-// RUN: %clang_cc1 -triple spir-unknown-unknown -internal-isystem 
../../lib/Headers -include opencl-c.h -fblocks -emit-llvm -o - %s 
-cl-std=CL2.0| FileCheck --check-prefix=CHECK20 %s
-// RUN: %clang_cc1 -triple spir64-unknown-unknown -internal-isystem 
../../lib/Headers -include opencl-c.h -emit-llvm -o - %s | FileCheck %s
-// RUN: %clang_cc1 -triple spir64-unknown-unknown -internal-isystem 
../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -cl-std=CL1.1| 
FileCheck %s
-// RUN: %clang_cc1 -triple spir64-unknown-unknown -internal-isystem 
../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -cl-std=CL1.2| 
FileCheck %s
-// RUN: %clang_cc1 -triple spir64-unknown-unknown -internal-isystem 
../../lib/Headers -include opencl-c.h -fblocks -emit-llvm -o - %s 
-cl-std=CL2.0| FileCheck --check-prefix=CHECK20 %s
-// RUN: %clang_cc1 -triple amdgcn-unknown-amdhsa -internal-isystem 
../../lib/Headers -include opencl-c.h -emit-llvm -o - %s | FileCheck %s
-// RUN: %clang_cc1 -triple amdgcn-unknown-amdhsa -internal-isystem 
../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -cl-std=CL1.1| 
FileCheck %s
-// RUN: %clang_cc1 -triple amdgcn-unknown-amdhsa -internal-isystem 
../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -cl-std=CL1.2| 
FileCheck %s
-// RUN: %clang_cc1 -triple amdgcn-unknown-amdhsa -internal-isystem 
../../lib/Headers -include opencl-c.h -fblocks -emit-llvm -o - %s 
-cl-std=CL2.0| FileCheck --check-prefix=CHECK20 %s
-// RUN: %clang_cc1 -triple ppc64-unknown-unknown -internal-isystem 
../../lib/Headers -include opencl-c.h -emit-llvm -o - %s | FileCheck %s
-// RUN: %clang_cc1 -triple ppc64-unknown-unknown -internal-isystem 
../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -cl-std=CL1.1| 
FileCheck %s
-// RUN: %clang_cc1 -triple ppc64-unknown-unknown -internal-isystem 
../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -cl-std=CL1.2| 
FileCheck %s
-// RUN: %clang_cc1 -triple ppc64-unknown-unknown -internal-isystem 
../../lib/Headers -include opencl-c.h -fblocks -emit-llvm -o - %s 
-cl-std=CL2.0| FileCheck --check-prefix=CHECK20 %s
-// RUN: %clang_cc1 -triple powerpc-unknown-unknown -internal-isystem 
../../lib/Headers -include opencl-c.h -emit-llvm -o - %s | FileCheck %s
-// RUN: %clang_cc1 -triple powerpc-unknown-unknown -internal-isystem 
../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -cl-std=CL1.1| 
FileCheck %s
-// RUN: %clang_cc1 -triple powerpc-unknown-unknown -internal-isystem 
../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -cl-std=CL1.2| 
FileCheck %s
-// RUN: %clang_cc1 -triple powerpc-unknown-unknown -internal-isystem 
../../lib/Headers -include opencl-c.h -fblocks -emit-llvm -o - %s 
-cl-std=CL2.0| FileCheck --check-prefix=CHECK20 %s
-// RUN: %clang_cc1 -triple nvptx-unknown-unknown -internal-isystem 
../../lib/Headers -include opencl-c.h -emit-llvm -o - %s | FileCheck %s
-// RUN: %clang_cc1 -triple nvptx-unknown-unknown -internal-isystem 
../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -cl-std=CL1.1| 
FileCheck %s
-// RUN: %clang_cc1 -triple nvptx-unknown-unknown -internal-isystem 
../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -cl-std=CL1.2| 
FileCheck %s
-// RUN: %clang_cc1 -triple nvptx-unknown-unknown -internal-isystem 
../../lib/Headers -include opencl-c.h -fblocks -emit-llvm -o - %s 
-cl-std=CL2.0| FileCheck --check-prefix=CHECK20 %s
-// RUN: %clang_cc1 -triple nvptx64-unknown-unknown -internal-isystem 
../../lib/Headers -include opencl-c.h -emit-llvm -o - %s | FileCheck %s
-// RUN: %clang_cc1 -triple nvptx64-unknown-unknown -internal-isystem 
../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -cl-std=CL1.1| 
FileCheck %s
-// RUN: %clang_cc1 -triple nvptx64-unknown-unknown -internal-isystem 
../../lib/Headers -include opencl-c.h -emit-llvm -o - %s -cl-std=CL1.2| 
FileCheck %s
-// RUN: %clang_cc1 -triple nvptx64-unknown-unknown -internal-isystem 
../../lib/Headers -include opencl-c.h -fblocks -emit-llvm -o - %s 
-cl-std=CL2.0| FileCheck --check-prefix=CHECK20 %s
 
-// RUN: %clang_cc1 -triple x86_64-unknown-unknown -finclude-default-header 
-emit-llvm -o - %s | FileCheck %s
 // CHECK: _Z16convert_char_r

[PATCH] D26294: [libcxx] [test] Replace _LIBCPP_STD_VER with TEST_STD_VER.

2016-11-04 Thread Eric Fiselier via cfe-commits
EricWF accepted this revision.
EricWF added a comment.
This revision is now accepted and ready to land.

LGTM. Holy crap. Thanks STL!

Just a note `_LIBCPP_STD_VER` is set to 11 in C++03 mode, it's silly but that's 
the way it is. So that makes me wonder if some of the `_LIBCPP_STD_VER > 11` 
really should be `TEST_STD_VER >= 11`, since they may have just been disabling 
the test in C++03. Either way this preserves the status quo.


https://reviews.llvm.org/D26294



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


[PATCH] D25985: [analyzer] Export coverage information from the analyzer.

2016-11-04 Thread Gábor Horváth via cfe-commits
xazax.hun updated this revision to Diff 76933.
xazax.hun marked 5 inline comments as done.
xazax.hun added a comment.

- Improved performance.
- Fixed an off by one error.
- Also export unexecuted lines.
- Added context.


https://reviews.llvm.org/D25985

Files:
  include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
  lib/StaticAnalyzer/Core/AnalyzerOptions.cpp
  lib/StaticAnalyzer/Core/ExprEngine.cpp
  test/Analysis/analyzer-config.c
  test/Analysis/analyzer-config.cpp
  test/Analysis/record-coverage.cpp
  test/Analysis/record-coverage.cpp.expected

Index: test/Analysis/record-coverage.cpp.expected
===
--- /dev/null
+++ test/Analysis/record-coverage.cpp.expected
@@ -0,0 +1,9 @@
+// CHECK:  -:4:int main() {
+// CHECK-NEXT: 1:5:  int i = 2;
+// CHECK-NEXT: 1:6:  ++i;
+// CHECK-NEXT: 1:7:  if (i != 0) {
+// CHECK-NEXT: 1:8:++i;
+// CHECK-NEXT: -:9:  } else {
+// CHECK-NEXT: #:10:--i;
+// CHECK-NEXT: -:11:  }
+// CHECK-NEXT: -:12:}
Index: test/Analysis/record-coverage.cpp
===
--- /dev/null
+++ test/Analysis/record-coverage.cpp
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-config record-coverage=%T %s
+// RUN: FileCheck -input-file %T/%s.gcov %s.expected
+
+int main() {
+  int i = 2;
+  ++i;
+  if (i != 0) {
+++i;
+  } else {
+--i;
+  }
+}
Index: test/Analysis/analyzer-config.cpp
===
--- test/Analysis/analyzer-config.cpp
+++ test/Analysis/analyzer-config.cpp
@@ -35,7 +35,8 @@
 // CHECK-NEXT: max-times-inline-large = 32
 // CHECK-NEXT: min-cfg-size-treat-functions-as-large = 14
 // CHECK-NEXT: mode = deep
+// CHECK-NEXT: record-coverage =
 // CHECK-NEXT: region-store-small-struct-limit = 2
 // CHECK-NEXT: widen-loops = false
 // CHECK-NEXT: [stats]
-// CHECK-NEXT: num-entries = 20
+// CHECK-NEXT: num-entries = 21
Index: test/Analysis/analyzer-config.c
===
--- test/Analysis/analyzer-config.c
+++ test/Analysis/analyzer-config.c
@@ -24,8 +24,9 @@
 // CHECK-NEXT: max-times-inline-large = 32
 // CHECK-NEXT: min-cfg-size-treat-functions-as-large = 14
 // CHECK-NEXT: mode = deep
+// CHECK-NEXT: record-coverage =
 // CHECK-NEXT: region-store-small-struct-limit = 2
 // CHECK-NEXT: widen-loops = false
 // CHECK-NEXT: [stats]
-// CHECK-NEXT: num-entries = 15
+// CHECK-NEXT: num-entries = 16
 
Index: lib/StaticAnalyzer/Core/ExprEngine.cpp
===
--- lib/StaticAnalyzer/Core/ExprEngine.cpp
+++ lib/StaticAnalyzer/Core/ExprEngine.cpp
@@ -28,8 +28,13 @@
 #include "clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/LoopWidening.h"
 #include "llvm/ADT/Statistic.h"
+#include "llvm/Support/FileSystem.h"
+#include "llvm/Support/LineIterator.h"
+#include "llvm/Support/Path.h"
 #include "llvm/Support/SaveAndRestore.h"
 #include "llvm/Support/raw_ostream.h"
+#include "llvm/Support/raw_os_ostream.h"
+#include 
 
 #ifndef NDEBUG
 #include "llvm/Support/GraphWriter.h"
@@ -251,6 +256,45 @@
   return State;
 }
 
+// Mapping from file to line indexed hit count vector.
+static llvm::DenseMap> CoverageInfo;
+
+static void dumpCoverageInfo(llvm::SmallVectorImpl &Path,
+ SourceManager &SM) {
+  for (auto &Entry : CoverageInfo) {
+SmallString<128> FilePath;
+const FileEntry *FE = Entry.getFirst();
+llvm::sys::path::append(FilePath, Path, FE->getName() + ".gcov");
+SmallString<128> DirPath = FilePath;
+llvm::sys::path::remove_filename(DirPath);
+llvm::sys::fs::create_directories(DirPath);
+bool Invalid = false;
+llvm::MemoryBuffer *Buf = SM.getMemoryBufferForFile(FE, &Invalid);
+if (Invalid)
+  continue;
+std::ofstream OutFile(FilePath.c_str());
+if (!OutFile) {
+  llvm::errs() << FilePath << " Fuck!\n";
+  continue;
+}
+llvm::raw_os_ostream Out(OutFile);
+Out << "-:0:Source:" << FE->getName() << '\n';
+Out << "-:0:Runs:1\n";
+Out << "-:0:Programs:1\n";
+for (llvm::line_iterator LI(*Buf, false); !LI.is_at_eof(); ++LI) {
+  int Count = Entry.getSecond()[LI.line_number() - 1];
+  if (Count > 0) {
+Out << Count;
+  } else if (Count < 0) {
+Out << "#";
+  } else {
+Out << '-';
+  }
+  Out << ':' << LI.line_number() << ':' << *LI << '\n';
+}
+  }
+}
+
 //===--===//
 // Top-level transfer function logic (Dispatcher).
 //===--===//
@@ -282,6 +326,12 @@
 }
 
 void ExprEngine::processEndWorklist(bool hasWorkRemaining) {
+  if (!AMgr.options.coverageExportDir().empty()) {
+SmallString<128> Path = AMgr.options.coverageExportDir();
+Source

[PATCH] D25985: [analyzer] Export coverage information from the analyzer.

2016-11-04 Thread Gábor Horváth via cfe-commits
xazax.hun added a comment.

In https://reviews.llvm.org/D25985#580270, @zaks.anna wrote:

> Please, add multi-file tests and tests where a line is covered more than once.


Ok, I will add it in the next iteration.




Comment at: lib/StaticAnalyzer/Core/ExprEngine.cpp:262
+
+static void dumpCoverageInfo(llvm::SmallVectorImpl &Path,
+ SourceManager &SM) {

zaks.anna wrote:
> Can this be a debug checker?
You mean the dumping part or also collecting the coverage? It can be a debug 
checker if we add a new callback like "checkBasicBlockBegin". I did not want to 
add such callback just for a debug check. However, it is possible to move only 
the dumping part to a separate checker. What would you prefer?



Comment at: lib/StaticAnalyzer/Core/ExprEngine.cpp:281
+llvm::raw_os_ostream Out(OutFile);
+Out << "-:0:Source:" << FE->getName() << '\n';
+Out << "-:0:Runs:1\n";

zaks.anna wrote:
> What does '-' mean in this case? Why is it needed?
The `-` means lines without executable code. `##` means lines that contains 
executable code but unexecuted. The lines that has "0" as the line number are 
attributes to help the tools consume the gcov file.



Comment at: test/Analysis/record-coverage.cpp.expected:2
+// CHECK:  -:4:int main() {
+// CHECK-NEXT: -:5:  int i = 2;
+// CHECK-NEXT: 1:6:  ++i;

zaks.anna wrote:
> Does '-' mean not covered? If so, why the first 2 statements are not covered?
There was an off by one error that I fixed.


https://reviews.llvm.org/D25985



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


[PATCH] D26195: Ignore incomplete types when determining whether they are expensive to copy

2016-11-04 Thread Felix Berger via cfe-commits
flx updated this revision to Diff 76934.

https://reviews.llvm.org/D26195

Files:
  clang-tidy/utils/TypeTraits.cpp
  test/clang-tidy/performance-unnecessary-value-param.cpp


Index: test/clang-tidy/performance-unnecessary-value-param.cpp
===
--- test/clang-tidy/performance-unnecessary-value-param.cpp
+++ test/clang-tidy/performance-unnecessary-value-param.cpp
@@ -1,4 +1,4 @@
-// RUN: %check_clang_tidy %s performance-unnecessary-value-param %t
+// RUN: %check_clang_tidy %s performance-unnecessary-value-param %t -- 
-fix-errors -- --std=c++11
 
 // CHECK-FIXES: #include 
 
@@ -237,3 +237,10 @@
   ExpensiveToCopyType B;
   B = A;
 }
+
+// Ensure that incomplete types result in an error from the frontend and not a
+// clang-tidy diagnostic about IncompleteType being expensive to copy.
+struct IncompleteType;
+void NegativeForIncompleteType(IncompleteType I) {
+  // CHECK-MESSAGES: [[@LINE-1]]:47: error: variable has incomplete type 
'IncompleteType' [clang-diagnostic-error]
+}
Index: clang-tidy/utils/TypeTraits.cpp
===
--- clang-tidy/utils/TypeTraits.cpp
+++ clang-tidy/utils/TypeTraits.cpp
@@ -41,7 +41,7 @@
 
 llvm::Optional isExpensiveToCopy(QualType Type,
const ASTContext &Context) {
-  if (Type->isDependentType())
+  if (Type->isDependentType() || Type->isIncompleteType())
 return llvm::None;
   return !Type.isTriviallyCopyableType(Context) &&
  !classHasTrivialCopyAndDestroy(Type) &&


Index: test/clang-tidy/performance-unnecessary-value-param.cpp
===
--- test/clang-tidy/performance-unnecessary-value-param.cpp
+++ test/clang-tidy/performance-unnecessary-value-param.cpp
@@ -1,4 +1,4 @@
-// RUN: %check_clang_tidy %s performance-unnecessary-value-param %t
+// RUN: %check_clang_tidy %s performance-unnecessary-value-param %t -- -fix-errors -- --std=c++11
 
 // CHECK-FIXES: #include 
 
@@ -237,3 +237,10 @@
   ExpensiveToCopyType B;
   B = A;
 }
+
+// Ensure that incomplete types result in an error from the frontend and not a
+// clang-tidy diagnostic about IncompleteType being expensive to copy.
+struct IncompleteType;
+void NegativeForIncompleteType(IncompleteType I) {
+  // CHECK-MESSAGES: [[@LINE-1]]:47: error: variable has incomplete type 'IncompleteType' [clang-diagnostic-error]
+}
Index: clang-tidy/utils/TypeTraits.cpp
===
--- clang-tidy/utils/TypeTraits.cpp
+++ clang-tidy/utils/TypeTraits.cpp
@@ -41,7 +41,7 @@
 
 llvm::Optional isExpensiveToCopy(QualType Type,
const ASTContext &Context) {
-  if (Type->isDependentType())
+  if (Type->isDependentType() || Type->isIncompleteType())
 return llvm::None;
   return !Type.isTriviallyCopyableType(Context) &&
  !classHasTrivialCopyAndDestroy(Type) &&
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] r286008 - [clang-tidy] Ignore incomplete types when determining whether they are expensive to copy

2016-11-04 Thread Felix Berger via cfe-commits
Author: flx
Date: Fri Nov  4 15:29:22 2016
New Revision: 286008

URL: http://llvm.org/viewvc/llvm-project?rev=286008&view=rev
Log:
[clang-tidy] Ignore incomplete types when determining whether they are 
expensive to copy

Summary: IsExpensiveToCopy can return false positives for incomplete types, so 
ignore them.

All existing ClangTidy tests that depend on this function still pass as the 
types are complete.

Reviewers: alexfh, aaron.ballman

Subscribers: cfe-commits

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

Modified:
clang-tools-extra/trunk/clang-tidy/utils/TypeTraits.cpp

clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param.cpp

Modified: clang-tools-extra/trunk/clang-tidy/utils/TypeTraits.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/utils/TypeTraits.cpp?rev=286008&r1=286007&r2=286008&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/utils/TypeTraits.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/utils/TypeTraits.cpp Fri Nov  4 15:29:22 
2016
@@ -41,7 +41,7 @@ bool hasDeletedCopyConstructor(QualType
 
 llvm::Optional isExpensiveToCopy(QualType Type,
const ASTContext &Context) {
-  if (Type->isDependentType())
+  if (Type->isDependentType() || Type->isIncompleteType())
 return llvm::None;
   return !Type.isTriviallyCopyableType(Context) &&
  !classHasTrivialCopyAndDestroy(Type) &&

Modified: 
clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param.cpp?rev=286008&r1=286007&r2=286008&view=diff
==
--- 
clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param.cpp 
(original)
+++ 
clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param.cpp 
Fri Nov  4 15:29:22 2016
@@ -1,4 +1,4 @@
-// RUN: %check_clang_tidy %s performance-unnecessary-value-param %t
+// RUN: %check_clang_tidy %s performance-unnecessary-value-param %t -- 
-fix-errors -- --std=c++11
 
 // CHECK-FIXES: #include 
 
@@ -237,3 +237,10 @@ void PositiveConstRefNotMoveAssignable(E
   ExpensiveToCopyType B;
   B = A;
 }
+
+// Ensure that incomplete types result in an error from the frontend and not a
+// clang-tidy diagnostic about IncompleteType being expensive to copy.
+struct IncompleteType;
+void NegativeForIncompleteType(IncompleteType I) {
+  // CHECK-MESSAGES: [[@LINE-1]]:47: error: variable has incomplete type 
'IncompleteType' [clang-diagnostic-error]
+}


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


[PATCH] D26195: Ignore incomplete types when determining whether they are expensive to copy

2016-11-04 Thread Felix Berger via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL286008: [clang-tidy] Ignore incomplete types when 
determining whether they are… (authored by flx).

Changed prior to commit:
  https://reviews.llvm.org/D26195?vs=76934&id=76935#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D26195

Files:
  clang-tools-extra/trunk/clang-tidy/utils/TypeTraits.cpp
  
clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param.cpp


Index: 
clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param.cpp
===
--- 
clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param.cpp
+++ 
clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param.cpp
@@ -1,4 +1,4 @@
-// RUN: %check_clang_tidy %s performance-unnecessary-value-param %t
+// RUN: %check_clang_tidy %s performance-unnecessary-value-param %t -- 
-fix-errors -- --std=c++11
 
 // CHECK-FIXES: #include 
 
@@ -237,3 +237,10 @@
   ExpensiveToCopyType B;
   B = A;
 }
+
+// Ensure that incomplete types result in an error from the frontend and not a
+// clang-tidy diagnostic about IncompleteType being expensive to copy.
+struct IncompleteType;
+void NegativeForIncompleteType(IncompleteType I) {
+  // CHECK-MESSAGES: [[@LINE-1]]:47: error: variable has incomplete type 
'IncompleteType' [clang-diagnostic-error]
+}
Index: clang-tools-extra/trunk/clang-tidy/utils/TypeTraits.cpp
===
--- clang-tools-extra/trunk/clang-tidy/utils/TypeTraits.cpp
+++ clang-tools-extra/trunk/clang-tidy/utils/TypeTraits.cpp
@@ -41,7 +41,7 @@
 
 llvm::Optional isExpensiveToCopy(QualType Type,
const ASTContext &Context) {
-  if (Type->isDependentType())
+  if (Type->isDependentType() || Type->isIncompleteType())
 return llvm::None;
   return !Type.isTriviallyCopyableType(Context) &&
  !classHasTrivialCopyAndDestroy(Type) &&


Index: clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param.cpp
===
--- clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param.cpp
+++ clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param.cpp
@@ -1,4 +1,4 @@
-// RUN: %check_clang_tidy %s performance-unnecessary-value-param %t
+// RUN: %check_clang_tidy %s performance-unnecessary-value-param %t -- -fix-errors -- --std=c++11
 
 // CHECK-FIXES: #include 
 
@@ -237,3 +237,10 @@
   ExpensiveToCopyType B;
   B = A;
 }
+
+// Ensure that incomplete types result in an error from the frontend and not a
+// clang-tidy diagnostic about IncompleteType being expensive to copy.
+struct IncompleteType;
+void NegativeForIncompleteType(IncompleteType I) {
+  // CHECK-MESSAGES: [[@LINE-1]]:47: error: variable has incomplete type 'IncompleteType' [clang-diagnostic-error]
+}
Index: clang-tools-extra/trunk/clang-tidy/utils/TypeTraits.cpp
===
--- clang-tools-extra/trunk/clang-tidy/utils/TypeTraits.cpp
+++ clang-tools-extra/trunk/clang-tidy/utils/TypeTraits.cpp
@@ -41,7 +41,7 @@
 
 llvm::Optional isExpensiveToCopy(QualType Type,
const ASTContext &Context) {
-  if (Type->isDependentType())
+  if (Type->isDependentType() || Type->isIncompleteType())
 return llvm::None;
   return !Type.isTriviallyCopyableType(Context) &&
  !classHasTrivialCopyAndDestroy(Type) &&
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D26282: [PowerPC] Implement plain VSX load/store builtins.

2016-11-04 Thread Nemanja Ivanovic via cfe-commits
nemanjai added inline comments.



Comment at: lib/Headers/altivec.h:15618
+
+#if defined(__POWER8_VECTOR__) && defined(__powerpc64__)
+static inline __ATTRS_o_ai vector signed __int128

Please move the __int128 overloads below the 64-bit ones to keep the overloads 
ordered by size.


https://reviews.llvm.org/D26282



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


[PATCH] D26306: [AVX-512] Make VBMI instruction set enabling imply that the BWI instruction set is also enabled.

2016-11-04 Thread Craig Topper via cfe-commits
craig.topper created this revision.
craig.topper added reviewers: delena, zvi.
craig.topper added a subscriber: cfe-commits.

This is needed to make the v64i8 and v32i16 types legal for the 512-bit VBMI 
instructions. Fixes PR30912.


https://reviews.llvm.org/D26306

Files:
  lib/Basic/Targets.cpp
  test/Preprocessor/x86_target_features.c


Index: test/Preprocessor/x86_target_features.c
===
--- test/Preprocessor/x86_target_features.c
+++ test/Preprocessor/x86_target_features.c
@@ -196,6 +196,7 @@
 // RUN: %clang -target i386-unknown-unknown -march=atom -mavx512vbmi -x c -E 
-dM -o - %s | FileCheck -match-full-lines --check-prefix=AVX512VBMI %s
 
 // AVX512VBMI: #define __AVX2__ 1
+// AVX512VBMI: #define __AVX512BW__ 1
 // AVX512VBMI: #define __AVX512F__ 1
 // AVX512VBMI: #define __AVX512VBMI__ 1
 // AVX512VBMI: #define __AVX__ 1
@@ -208,6 +209,11 @@
 // AVX512VBMI: #define __SSE__ 1
 // AVX512VBMI: #define __SSSE3__ 1
 
+// RUN: %clang -target i386-unknown-unknown -march=atom -mavx512vbmi 
-mno-avx512vbmi -x c -E -dM -o - %s | FileCheck -match-full-lines 
--check-prefix=AVX512VBMINOAVX512BW %s
+
+// AVX512VBMINOAVX512BW-NOT: #define __AVX512BW__ 1
+// AVX512VBMINOAVX512BW-NOT: #define __AVX512VBMI__ 1
+
 // RUN: %clang -target i386-unknown-unknown -march=atom -msse4.2 -x c -E -dM 
-o - %s | FileCheck -match-full-lines --check-prefix=SSE42POPCNT %s
 
 // SSE42POPCNT: #define __POPCNT__ 1
Index: lib/Basic/Targets.cpp
===
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -3350,6 +3350,12 @@
  Name == "avx512vbmi" || Name == "avx512ifma") {
 if (Enabled)
   setSSELevel(Features, AVX512F, Enabled);
+// Enable BWI instruction is VBMI is being enabled.
+if (Name == "avx512vbmi" && Enabled)
+  Features["avx512bw"] = true;
+// Also disable VBMI if BWI is being disabled.
+if (Name == "avx512bw" && !Enabled)
+  Features["avx512vbmi"] = false;
   } else if (Name == "fma") {
 if (Enabled)
   setSSELevel(Features, AVX, Enabled);


Index: test/Preprocessor/x86_target_features.c
===
--- test/Preprocessor/x86_target_features.c
+++ test/Preprocessor/x86_target_features.c
@@ -196,6 +196,7 @@
 // RUN: %clang -target i386-unknown-unknown -march=atom -mavx512vbmi -x c -E -dM -o - %s | FileCheck -match-full-lines --check-prefix=AVX512VBMI %s
 
 // AVX512VBMI: #define __AVX2__ 1
+// AVX512VBMI: #define __AVX512BW__ 1
 // AVX512VBMI: #define __AVX512F__ 1
 // AVX512VBMI: #define __AVX512VBMI__ 1
 // AVX512VBMI: #define __AVX__ 1
@@ -208,6 +209,11 @@
 // AVX512VBMI: #define __SSE__ 1
 // AVX512VBMI: #define __SSSE3__ 1
 
+// RUN: %clang -target i386-unknown-unknown -march=atom -mavx512vbmi -mno-avx512vbmi -x c -E -dM -o - %s | FileCheck -match-full-lines --check-prefix=AVX512VBMINOAVX512BW %s
+
+// AVX512VBMINOAVX512BW-NOT: #define __AVX512BW__ 1
+// AVX512VBMINOAVX512BW-NOT: #define __AVX512VBMI__ 1
+
 // RUN: %clang -target i386-unknown-unknown -march=atom -msse4.2 -x c -E -dM -o - %s | FileCheck -match-full-lines --check-prefix=SSE42POPCNT %s
 
 // SSE42POPCNT: #define __POPCNT__ 1
Index: lib/Basic/Targets.cpp
===
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -3350,6 +3350,12 @@
  Name == "avx512vbmi" || Name == "avx512ifma") {
 if (Enabled)
   setSSELevel(Features, AVX512F, Enabled);
+// Enable BWI instruction is VBMI is being enabled.
+if (Name == "avx512vbmi" && Enabled)
+  Features["avx512bw"] = true;
+// Also disable VBMI if BWI is being disabled.
+if (Name == "avx512bw" && !Enabled)
+  Features["avx512vbmi"] = false;
   } else if (Name == "fma") {
 if (Enabled)
   setSSELevel(Features, AVX, Enabled);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D26294: [libcxx] [test] Replace _LIBCPP_STD_VER with TEST_STD_VER.

2016-11-04 Thread Stephan T. Lavavej via cfe-commits
STL_MSFT closed this revision.
STL_MSFT added a comment.

Committed as r286007.


https://reviews.llvm.org/D26294



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


[clang-tools-extra] r286010 - [ClangTidy - performance-unnecessary-value-param] Only add "const" when current parameter is not already const qualified

2016-11-04 Thread Felix Berger via cfe-commits
Author: flx
Date: Fri Nov  4 15:51:31 2016
New Revision: 286010

URL: http://llvm.org/viewvc/llvm-project?rev=286010&view=rev
Log:
[ClangTidy - performance-unnecessary-value-param] Only add "const" when current 
parameter is not already const qualified

Reviewers: alexfh, sbenza, aaron.ballman

Subscribers: cfe-commits

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

Modified:

clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryValueParamCheck.cpp

clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param.cpp

Modified: 
clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryValueParamCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryValueParamCheck.cpp?rev=286010&r1=286009&r2=286010&view=diff
==
--- 
clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryValueParamCheck.cpp 
(original)
+++ 
clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryValueParamCheck.cpp 
Fri Nov  4 15:51:31 2016
@@ -128,7 +128,10 @@ void UnnecessaryValueParamCheck::check(c
 const auto &CurrentParam = *FunctionDecl->getParamDecl(Index);
 Diag << utils::fixit::changeVarDeclToReference(CurrentParam,
*Result.Context);
-if (!IsConstQualified)
+// The parameter of each declaration needs to be checked individually as to
+// whether it is const or not as constness can differ between definition 
and
+// declaration.
+if (!CurrentParam.getType().getCanonicalType().isConstQualified())
   Diag << utils::fixit::changeVarDeclToConst(CurrentParam);
   }
 }

Modified: 
clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param.cpp?rev=286010&r1=286009&r2=286010&view=diff
==
--- 
clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param.cpp 
(original)
+++ 
clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param.cpp 
Fri Nov  4 15:51:31 2016
@@ -244,3 +244,19 @@ struct IncompleteType;
 void NegativeForIncompleteType(IncompleteType I) {
   // CHECK-MESSAGES: [[@LINE-1]]:47: error: variable has incomplete type 
'IncompleteType' [clang-diagnostic-error]
 }
+
+// Case where parameter in declaration is already const-qualified but not in
+// implementation. Make sure a second 'const' is not added to the declaration.
+void PositiveConstDeclaration(const ExpensiveToCopyType A);
+// CHECK-FIXES: void PositiveConstDeclaration(const ExpensiveToCopyType& A);
+void PositiveConstDeclaration(ExpensiveToCopyType A) {
+  // CHECK-MESSAGES: [[@LINE-1]]:51: warning: the parameter 'A' is copied
+  // CHECK-FIXES: void PositiveConstDeclaration(const ExpensiveToCopyType& A) {
+}
+
+void PositiveNonConstDeclaration(ExpensiveToCopyType A);
+// CHECK-FIXES: void PositiveNonConstDeclaration(const ExpensiveToCopyType& A);
+void PositiveNonConstDeclaration(const ExpensiveToCopyType A) {
+  // CHECK-MESSAGES: [[@LINE-1]]:60: warning: the const qualified parameter 'A'
+  // CHECK-FIXES: void PositiveNonConstDeclaration(const ExpensiveToCopyType& 
A) {
+}


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


[PATCH] D26207: [ClangTidy - performance-unnecessary-value-param] Only add "const" when current parameter is not already const qualified

2016-11-04 Thread Felix Berger via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL286010: [ClangTidy - performance-unnecessary-value-param] 
Only add "const" when current… (authored by flx).

Changed prior to commit:
  https://reviews.llvm.org/D26207?vs=76877&id=76940#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D26207

Files:
  clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryValueParamCheck.cpp
  
clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param.cpp


Index: 
clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryValueParamCheck.cpp
===
--- 
clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryValueParamCheck.cpp
+++ 
clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryValueParamCheck.cpp
@@ -128,7 +128,10 @@
 const auto &CurrentParam = *FunctionDecl->getParamDecl(Index);
 Diag << utils::fixit::changeVarDeclToReference(CurrentParam,
*Result.Context);
-if (!IsConstQualified)
+// The parameter of each declaration needs to be checked individually as to
+// whether it is const or not as constness can differ between definition 
and
+// declaration.
+if (!CurrentParam.getType().getCanonicalType().isConstQualified())
   Diag << utils::fixit::changeVarDeclToConst(CurrentParam);
   }
 }
Index: 
clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param.cpp
===
--- 
clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param.cpp
+++ 
clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param.cpp
@@ -244,3 +244,19 @@
 void NegativeForIncompleteType(IncompleteType I) {
   // CHECK-MESSAGES: [[@LINE-1]]:47: error: variable has incomplete type 
'IncompleteType' [clang-diagnostic-error]
 }
+
+// Case where parameter in declaration is already const-qualified but not in
+// implementation. Make sure a second 'const' is not added to the declaration.
+void PositiveConstDeclaration(const ExpensiveToCopyType A);
+// CHECK-FIXES: void PositiveConstDeclaration(const ExpensiveToCopyType& A);
+void PositiveConstDeclaration(ExpensiveToCopyType A) {
+  // CHECK-MESSAGES: [[@LINE-1]]:51: warning: the parameter 'A' is copied
+  // CHECK-FIXES: void PositiveConstDeclaration(const ExpensiveToCopyType& A) {
+}
+
+void PositiveNonConstDeclaration(ExpensiveToCopyType A);
+// CHECK-FIXES: void PositiveNonConstDeclaration(const ExpensiveToCopyType& A);
+void PositiveNonConstDeclaration(const ExpensiveToCopyType A) {
+  // CHECK-MESSAGES: [[@LINE-1]]:60: warning: the const qualified parameter 'A'
+  // CHECK-FIXES: void PositiveNonConstDeclaration(const ExpensiveToCopyType& 
A) {
+}


Index: clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryValueParamCheck.cpp
===
--- clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryValueParamCheck.cpp
+++ clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryValueParamCheck.cpp
@@ -128,7 +128,10 @@
 const auto &CurrentParam = *FunctionDecl->getParamDecl(Index);
 Diag << utils::fixit::changeVarDeclToReference(CurrentParam,
*Result.Context);
-if (!IsConstQualified)
+// The parameter of each declaration needs to be checked individually as to
+// whether it is const or not as constness can differ between definition and
+// declaration.
+if (!CurrentParam.getType().getCanonicalType().isConstQualified())
   Diag << utils::fixit::changeVarDeclToConst(CurrentParam);
   }
 }
Index: clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param.cpp
===
--- clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param.cpp
+++ clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param.cpp
@@ -244,3 +244,19 @@
 void NegativeForIncompleteType(IncompleteType I) {
   // CHECK-MESSAGES: [[@LINE-1]]:47: error: variable has incomplete type 'IncompleteType' [clang-diagnostic-error]
 }
+
+// Case where parameter in declaration is already const-qualified but not in
+// implementation. Make sure a second 'const' is not added to the declaration.
+void PositiveConstDeclaration(const ExpensiveToCopyType A);
+// CHECK-FIXES: void PositiveConstDeclaration(const ExpensiveToCopyType& A);
+void PositiveConstDeclaration(ExpensiveToCopyType A) {
+  // CHECK-MESSAGES: [[@LINE-1]]:51: warning: the parameter 'A' is copied
+  // CHECK-FIXES: void PositiveConstDeclaration(const ExpensiveToCopyType& A) {
+}
+
+void PositiveNonConstDeclaration(ExpensiveToCopyType A);
+// CHECK-FIXES: void PositiveNonConstDeclaration(const ExpensiveToCopyType& A);
+void PositiveNonConstDeclaration(const ExpensiveToCopyType A) {
+  // CHECK-MESSAGES: [

[PATCH] D26308: [PowerPC] Add vector conversion builtins to altivec.h - clang portion

2016-11-04 Thread Nemanja Ivanovic via cfe-commits
nemanjai created this revision.
nemanjai added reviewers: hfinkel, echristo, kbarton, amehsan, syzaara, 
sfertile, jtony, lei.
nemanjai added a subscriber: cfe-commits.
nemanjai set the repository for this revision to rL LLVM.
Herald added a subscriber: mehdi_amini.

This patch adds the following interfaces:

vector double vec_double (vector signed long long);
vector double vec_double (vector unsigned long long);
vector double vec_doublee (vector signed int);
vector double vec_doublee (vector unsigned int);
vector double vec_doublee (vector float);
vector double vec_doubleh (vector signed int);
vector double vec_doubleh (vector unsigned int);
vector double vec_doubleh (vector float);
vector double vec_doublel (vector signed int);
vector double vec_doublel (vector unsigned int);
vector double vec_doublel (vector float);
vector double vec_doubleo (vector signed int);
vector double vec_doubleo (vector unsigned int);
vector double vec_doubleo (vector float);
vector float vec_float (vector signed int);
vector float vec_float (vector unsigned int);
vector float vec_float2 (vector signed long long, vector signed long long);
vector float vec_float2 (vector unsigned long long, vector unsigned long long);
vector float vec_float2 (vector double, vector double);
vector float vec_floate (vector signed long long);
vector float vec_floate (vector unsigned long long);
vector float vec_floate (vector double);
vector float vec_floato (vector signed long long);
vector float vec_floato (vector unsigned long long);
vector float vec_floato (vector double);
vector signed int vec_signed (vector float);
vector signed long long vec_signed (vector double);
vector signed int vec_signed2 (vector double, vector double);
vector signed int vec_signede (vector double);
vector signed int vec_signedo (vector double);
vector unsigned int vec_unsigned (vector float);
vector unsigned long long vec_unsigned (vector double);
vector unsigned int vec_unsigned2 (vector double, vector double);
vector unsigned int vec_unsignede (vector double);
vector unsigned int vec_unsignedo (vector double);


Repository:
  rL LLVM

https://reviews.llvm.org/D26308

Files:
  include/clang/Basic/BuiltinsPPC.def
  lib/Headers/altivec.h
  test/CodeGen/builtins-ppc-altivec.c
  test/CodeGen/builtins-ppc-p8vector.c
  test/CodeGen/builtins-ppc-vsx.c

Index: test/CodeGen/builtins-ppc-vsx.c
===
--- test/CodeGen/builtins-ppc-vsx.c
+++ test/CodeGen/builtins-ppc-vsx.c
@@ -1081,6 +1081,380 @@
 // CHECK-LE: uitofp <2 x i64> %{{.*}} to <2 x double>
 // CHECK-LE: fmul <2 x double>
 
+  res_vsll = vec_signed(vd);
+// CHECK: fptosi <2 x double>
+// CHECK-LE: fptosi <2 x double>
+
+  res_vsi = vec_signed2(vd, vd);
+// CHECK: extractelement <2 x double>
+// CHECK: fptosi double
+// CHECK: insertelement <4 x i32>
+// CHECK: extractelement <2 x double>
+// CHECK: fptosi double
+// CHECK: insertelement <4 x i32>
+// CHECK: extractelement <2 x double>
+// CHECK: fptosi double
+// CHECK: insertelement <4 x i32>
+// CHECK: extractelement <2 x double>
+// CHECK: fptosi double
+// CHECK: insertelement <4 x i32>
+// CHECK-LE: extractelement <2 x double>
+// CHECK-LE: fptosi double
+// CHECK-LE: insertelement <4 x i32>
+// CHECK-LE: extractelement <2 x double>
+// CHECK-LE: fptosi double
+// CHECK-LE: insertelement <4 x i32>
+// CHECK-LE: extractelement <2 x double>
+// CHECK-LE: fptosi double
+// CHECK-LE: insertelement <4 x i32>
+// CHECK-LE: extractelement <2 x double>
+// CHECK-LE: fptosi double
+// CHECK-LE: insertelement <4 x i32>
+
+  res_vsi = vec_signede(vd);
+// CHECK: @llvm.ppc.vsx.xvcvdpsxws(<2 x double>
+// CHECK-LE: @llvm.ppc.vsx.xvcvdpsxws(<2 x double>
+// CHECK-LE: sub nsw i32 16
+// CHECK-LE: sub nsw i32 17
+// CHECK-LE: sub nsw i32 18
+// CHECK-LE: sub nsw i32 31
+// CHECK-LE: @llvm.ppc.altivec.vperm
+
+  res_vsi = vec_signedo(vd);
+// CHECK: @llvm.ppc.vsx.xvcvdpsxws(<2 x double>
+// CHECK: add nsw i32 {{[0-9a-zA-Z%.]+}}, 1
+// CHECK: add nsw i32 {{[0-9a-zA-Z%.]+}}, 2
+// CHECK: add nsw i32 {{[0-9a-zA-Z%.]+}}, 3
+// CHECK: add nsw i32 {{[0-9a-zA-Z%.]+}}, 15
+// CHECK: @llvm.ppc.altivec.vperm
+// CHECK-LE: @llvm.ppc.vsx.xvcvdpsxws(<2 x double>
+
+  res_vull = vec_unsigned(vd);
+// CHECK: fptoui <2 x double>
+// CHECK-LE: fptoui <2 x double>
+
+  res_vui = vec_unsigned2(vd, vd);
+// CHECK: extractelement <2 x double>
+// CHECK: fptoui double
+// CHECK: insertelement <4 x i32>
+// CHECK: extractelement <2 x double>
+// CHECK: fptoui double
+// CHECK: insertelement <4 x i32>
+// CHECK: extractelement <2 x double>
+// CHECK: fptoui double
+// CHECK: insertelement <4 x i32>
+// CHECK: extractelement <2 x double>
+// CHECK: fptoui double
+// CHECK: insertelement <4 x i32>
+// CHECK-LE: extractelement <2 x double>
+// CHECK-LE: fptoui double
+// CHECK-LE: insertelement <4 x i32>
+// CHECK-LE: extractelement <2 x double>
+// CHECK-LE: fptoui double
+// CHECK-LE: insertelement <4 x i32>
+// CHECK-LE: extractelement <2 x dou

[PATCH] D26310: Add a method to get the list of registered static analyzer checkers.

2016-11-04 Thread Alexander Kornienko via cfe-commits
alexfh created this revision.
alexfh added a reviewer: zaks.anna.
alexfh added a subscriber: cfe-commits.

This provides a better interface for clang-tidy and encapsulates the knowledge
about experimental checkers instead of leaving this to the clients.


https://reviews.llvm.org/D26310

Files:
  include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
  lib/StaticAnalyzer/Core/AnalyzerOptions.cpp
  unittests/StaticAnalyzer/AnalyzerOptionsTest.cpp


Index: unittests/StaticAnalyzer/AnalyzerOptionsTest.cpp
===
--- unittests/StaticAnalyzer/AnalyzerOptionsTest.cpp
+++ unittests/StaticAnalyzer/AnalyzerOptionsTest.cpp
@@ -14,6 +14,23 @@
 namespace clang {
 namespace ento {
 
+TEST(StaticAnalyzerOptions, getRegisteredCheckers) {
+  auto IsDebugChecker = [](StringRef CheckerName) {
+return CheckerName.startswith("debug");
+  };
+  auto IsAlphaChecker = [](StringRef CheckerName) {
+return CheckerName.startswith("alpha");
+  };
+  const auto &AllCheckers =
+  AnalyzerOptions::getRegisteredCheckers(/*IncludeExperimental=*/true);
+  EXPECT_TRUE(llvm::any_of(AllCheckers, IsDebugChecker));
+  EXPECT_TRUE(llvm::any_of(AllCheckers, IsAlphaChecker));
+
+  const auto &StableCheckers = AnalyzerOptions::getRegisteredCheckers();
+  EXPECT_FALSE(llvm::any_of(StableCheckers, IsDebugChecker));
+  EXPECT_FALSE(llvm::any_of(StableCheckers, IsAlphaChecker));
+}
+
 TEST(StaticAnalyzerOptions, SearchInParentPackageTests) {
   AnalyzerOptions Opts;
   Opts.Config["Outer.Inner.CheckerOne:Option"] = "true";
Index: lib/StaticAnalyzer/Core/AnalyzerOptions.cpp
===
--- lib/StaticAnalyzer/Core/AnalyzerOptions.cpp
+++ lib/StaticAnalyzer/Core/AnalyzerOptions.cpp
@@ -23,6 +23,25 @@
 using namespace ento;
 using namespace llvm;
 
+std::vector
+AnalyzerOptions::getRegisteredCheckers(bool IncludeExperimental /* = false */) 
{
+  static const StringRef StaticAnalyzerChecks[] = {
+#define GET_CHECKERS
+#define CHECKER(FULLNAME, CLASS, DESCFILE, HELPTEXT, GROUPINDEX, HIDDEN)   
\
+  FULLNAME,
+#include "clang/StaticAnalyzer/Checkers/Checkers.inc"
+#undef CHECKER
+#undef GET_CHECKERS
+  };
+  std::vector Result;
+  for (StringRef CheckName : StaticAnalyzerChecks) {
+if (IncludeExperimental ||
+(!CheckName.startswith("debug.") && !CheckName.startswith("alpha.")))
+  Result.push_back(CheckName);
+  }
+  return Result;
+}
+
 AnalyzerOptions::UserModeKind AnalyzerOptions::getUserMode() {
   if (UserMode == UMK_NotSet) {
 StringRef ModeStr =
Index: include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
===
--- include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
+++ include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
@@ -125,6 +125,9 @@
 public:
   typedef llvm::StringMap ConfigTable;
 
+  static std::vector
+  getRegisteredCheckers(bool IncludeExperimental = false);
+
   /// \brief Pair of checker name and enable/disable.
   std::vector > CheckersControlList;
   


Index: unittests/StaticAnalyzer/AnalyzerOptionsTest.cpp
===
--- unittests/StaticAnalyzer/AnalyzerOptionsTest.cpp
+++ unittests/StaticAnalyzer/AnalyzerOptionsTest.cpp
@@ -14,6 +14,23 @@
 namespace clang {
 namespace ento {
 
+TEST(StaticAnalyzerOptions, getRegisteredCheckers) {
+  auto IsDebugChecker = [](StringRef CheckerName) {
+return CheckerName.startswith("debug");
+  };
+  auto IsAlphaChecker = [](StringRef CheckerName) {
+return CheckerName.startswith("alpha");
+  };
+  const auto &AllCheckers =
+  AnalyzerOptions::getRegisteredCheckers(/*IncludeExperimental=*/true);
+  EXPECT_TRUE(llvm::any_of(AllCheckers, IsDebugChecker));
+  EXPECT_TRUE(llvm::any_of(AllCheckers, IsAlphaChecker));
+
+  const auto &StableCheckers = AnalyzerOptions::getRegisteredCheckers();
+  EXPECT_FALSE(llvm::any_of(StableCheckers, IsDebugChecker));
+  EXPECT_FALSE(llvm::any_of(StableCheckers, IsAlphaChecker));
+}
+
 TEST(StaticAnalyzerOptions, SearchInParentPackageTests) {
   AnalyzerOptions Opts;
   Opts.Config["Outer.Inner.CheckerOne:Option"] = "true";
Index: lib/StaticAnalyzer/Core/AnalyzerOptions.cpp
===
--- lib/StaticAnalyzer/Core/AnalyzerOptions.cpp
+++ lib/StaticAnalyzer/Core/AnalyzerOptions.cpp
@@ -23,6 +23,25 @@
 using namespace ento;
 using namespace llvm;
 
+std::vector
+AnalyzerOptions::getRegisteredCheckers(bool IncludeExperimental /* = false */) {
+  static const StringRef StaticAnalyzerChecks[] = {
+#define GET_CHECKERS
+#define CHECKER(FULLNAME, CLASS, DESCFILE, HELPTEXT, GROUPINDEX, HIDDEN)   \
+  FULLNAME,
+#include "clang/StaticAnalyzer/Checkers/Checkers.inc"
+#undef CHECKER
+#undef GET_CHECKERS
+  };
+  std::vector Result;
+  for (StringRef CheckName : StaticAnalyzerChecks) {
+if (IncludeExperimental ||
+(!CheckName.startswith("deb

[PATCH] D26311: Use AnalyzerOptions::getRegisteredCheckers() instead of clang/StaticAnalyzer/Checkers/Checkers.inc

2016-11-04 Thread Alexander Kornienko via cfe-commits
alexfh created this revision.
alexfh added reviewers: zaks.anna, hokein.
alexfh added a subscriber: cfe-commits.
alexfh added a dependency: D26310: Add a method to get the list of registered 
static analyzer checkers..

Depends on https://reviews.llvm.org/D26310.


https://reviews.llvm.org/D26311

Files:
  clang-tidy/ClangTidy.cpp
  clang-tidy/ClangTidy.h

Index: clang-tidy/ClangTidy.h
===
--- clang-tidy/ClangTidy.h
+++ clang-tidy/ClangTidy.h
@@ -204,9 +204,6 @@
   ClangTidyOptions::OptionMap getCheckOptions();
 
 private:
-  typedef std::vector> CheckersList;
-  CheckersList getCheckersControlList(GlobList &Filter);
-
   ClangTidyContext &Context;
   std::unique_ptr CheckFactories;
 };
Index: clang-tidy/ClangTidy.cpp
===
--- clang-tidy/ClangTidy.cpp
+++ clang-tidy/ClangTidy.cpp
@@ -56,15 +56,6 @@
 namespace {
 static const char *AnalyzerCheckNamePrefix = "clang-analyzer-";
 
-static const StringRef StaticAnalyzerChecks[] = {
-#define GET_CHECKERS
-#define CHECKER(FULLNAME, CLASS, DESCFILE, HELPTEXT, GROUPINDEX, HIDDEN)   \
-  FULLNAME,
-#include "clang/StaticAnalyzer/Checkers/Checkers.inc"
-#undef CHECKER
-#undef GET_CHECKERS
-};
-
 class AnalyzerDiagnosticConsumer : public ento::PathDiagnosticConsumer {
 public:
   AnalyzerDiagnosticConsumer(ClangTidyContext &Context) : Context(Context) {}
@@ -296,6 +287,37 @@
   }
 }
 
+typedef std::vector> CheckersList;
+
+static CheckersList getCheckersControlList(GlobList &Filter) {
+  CheckersList List;
+
+  const bool IncludeExperimentalCheckers = false;
+  const auto &RegisteredCheckers =
+  AnalyzerOptions::getRegisteredCheckers(IncludeExperimentalCheckers);
+  bool AnalyzerChecksEnabled = false;
+  for (StringRef CheckName : RegisteredCheckers) {
+std::string ClangTidyCheckName((AnalyzerCheckNamePrefix + CheckName).str());
+AnalyzerChecksEnabled |= Filter.contains(ClangTidyCheckName);
+  }
+
+  if (!AnalyzerChecksEnabled)
+return List;
+
+  // List all static analyzer checkers that our filter enables.
+  //
+  // Always add all core checkers if any other static analyzer check is enabled.
+  // This is currently necessary, as other path sensitive checks rely on the
+  // core checkers.
+  for (StringRef CheckName : RegisteredCheckers) {
+std::string ClangTidyCheckName((AnalyzerCheckNamePrefix + CheckName).str());
+
+if (CheckName.startswith("core") || Filter.contains(ClangTidyCheckName))
+  List.emplace_back(CheckName, true);
+  }
+  return List;
+}
+
 std::unique_ptr
 ClangTidyASTConsumerFactory::CreateASTConsumer(
 clang::CompilerInstance &Compiler, StringRef File) {
@@ -379,37 +401,6 @@
   return Options;
 }
 
-ClangTidyASTConsumerFactory::CheckersList
-ClangTidyASTConsumerFactory::getCheckersControlList(GlobList &Filter) {
-  CheckersList List;
-
-  bool AnalyzerChecksEnabled = false;
-  for (StringRef CheckName : StaticAnalyzerChecks) {
-std::string Checker((AnalyzerCheckNamePrefix + CheckName).str());
-AnalyzerChecksEnabled =
-AnalyzerChecksEnabled ||
-(!CheckName.startswith("debug") && Filter.contains(Checker));
-  }
-
-  if (AnalyzerChecksEnabled) {
-// Run our regex against all possible static analyzer checkers.  Note that
-// debug checkers print values / run programs to visualize the CFG and are
-// thus not applicable to clang-tidy in general.
-//
-// Always add all core checkers if any other static analyzer checks are
-// enabled. This is currently necessary, as other path sensitive checks
-// rely on the core checkers.
-for (StringRef CheckName : StaticAnalyzerChecks) {
-  std::string Checker((AnalyzerCheckNamePrefix + CheckName).str());
-
-  if (CheckName.startswith("core") ||
-  (!CheckName.startswith("debug") && Filter.contains(Checker)))
-List.push_back(std::make_pair(CheckName, true));
-}
-  }
-  return List;
-}
-
 DiagnosticBuilder ClangTidyCheck::diag(SourceLocation Loc, StringRef Message,
DiagnosticIDs::Level Level) {
   return Context->diag(CheckName, Loc, Message, Level);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D26196: AMDGPU: Translate null pointers in private and local addr space

2016-11-04 Thread John McCall via cfe-commits
rjmccall added a comment.

In https://reviews.llvm.org/D26196#587135, @yaxunl wrote:

> In https://reviews.llvm.org/D26196#586433, @rjmccall wrote:
>
> > I think there are a number of conceptual questions here, chiefly among them 
> > whether an llvm::ConstantPointerNull in an address-space type should have 
> > the correct representation for the target.  If the decision for that is 
> > "no", then ok, we can produce an explicit representation in IRGen; however, 
> > we will need to update quite a bit of code in order to do so correctly.
>
>
> As Tom and Matt pointed out, llvm::ConstantPointerNull is the desired 
> representation for a null pointer. However, currently LLVM assumes that it 
> has 0 value extensively, and there is no plan to change that in a foreseeable 
> future. This patch is intended to provide a workaround for this restriction 
> by representing non-zero null pointer in an alternative way.


Yes, I understand the goal of this patch, and I am fine with working around the 
LLVM limitation in the frontend.  I will, however, point out that Clang's 
assumptions about the representation of null are not necessarily any less 
extensive than LLVM's.

>> In general, frontend address spaces don't necessarily correspond to IR 
>> address spaces.  All of your address-space operations need to be 
>> parameterized with a frontend address space (or both a source and dest 
>> address space for conversions).  The question you should be keeping in mind 
>> when designing these APIs is "what if there were an address space defined to 
>> be exactly the generic address space, only with a different null value?"
> 
> Since non-zero null pointer is usually resulted from target restrictions (as 
> in the case of amdgpu target), whether a null pointer needs a special 
> representation only depends on the target or IR address space. Therefore we 
> do not need to consider the address space in the source language. Hopefully 
> this can simplify the implementation.

Please do as I laid out and base this decision on the source-language address 
space.  It will not significantly complicate the implementation.


https://reviews.llvm.org/D26196



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


[PATCH] D26304: [Power9] vector load/store with length - clang portion

2016-11-04 Thread Nemanja Ivanovic via cfe-commits
nemanjai added a comment.

Zaara, prior to committing this patch, can you write a test case that will 
actually use these builtins in an executable test case and confirm the results. 
We'll then run it on the simulator to ensure functional correctness.




Comment at: lib/Headers/altivec.h:38
 #define __ATTRS_o_ai __attribute__((__overloadable__, __always_inline__))
+#include 
 

I think size_t is only used for the load/store with length which are Power9 
specific. I think we should guard this include with that macro as well to avoid 
changing behaviour of existing code inadvertently.



Comment at: lib/Headers/altivec.h:2609
+vec_xl_len(signed char * __a, size_t __b) {
+  return (vector signed char)__builtin_vsx_lxvl(__a, (__b << 56));
+}

This is undefined behaviour in 32-bit mode. Please guard for 64-bit mode unless 
this is already in such a block.



Comment at: test/CodeGen/builtins-ppc-p9vector.c:29
 
+float af[4] = {23.4f, 56.7f, 89.0f, 12.3f};
+double ad[2] = {23.4, 56.7};

I don't think we need to initialize these. And if we keep the initialization, 
let's use the same formatting (i.e. left curly brace, space, list of 
initializers, space, right curly brace).



Comment at: test/CodeGen/builtins-ppc-p9vector.c:35
+  0,  1,  2,  3,  4,  5,  6,  7};
+signed short ass[8] = { -1, 2, -3, 4, -5, 6, -7, 8 };
+unsigned short aus[8] = { 0, 1, 2, 3, 4, 5, 6, 7 };

Please select a naming scheme that does not lead to such unfortunate variable 
names.


https://reviews.llvm.org/D26304



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


[PATCH] D26314: [libcxx] [test] Fix MSVC warning C4189 "local variable is initialized but not referenced".

2016-11-04 Thread Stephan T. Lavavej via cfe-commits
STL_MSFT created this revision.
STL_MSFT added reviewers: EricWF, mclow.lists.
STL_MSFT added a subscriber: cfe-commits.

test/std/depr/depr.c.headers/inttypes_h.pass.cpp
test/std/input.output/file.streams/c.files/cinttypes.pass.cpp
test/std/input.output/iostream.forward/iosfwd.pass.cpp
Add test() to avoid a bunch of void-casts, although we still need a few.

test/std/input.output/iostream.format/quoted.manip/quoted.pass.cpp
skippingws was unused (it's unclear to me whether this was mistakenly 
copy-pasted from round_trip() below).

test/std/localization/locale.categories/category.collate/locale.collate/types.pass.cpp
test/std/localization/locale.categories/category.ctype/facet.ctype.special/types.pass.cpp
test/std/localization/locale.categories/category.ctype/locale.codecvt/types_char.pass.cpp
test/std/localization/locale.categories/category.ctype/locale.codecvt/types_wchar_t.pass.cpp
test/std/localization/locale.categories/category.ctype/locale.ctype/types.pass.cpp
test/std/localization/locale.categories/facet.numpunct/locale.numpunct/types.pass.cpp
test/std/localization/locales/locale.global.templates/use_facet.pass.cpp
When retrieving facets, the references are unused.

test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_long.pass.cpp
test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_unsigned_long.pass.cpp
"std::ios_base::iostate err = ios.goodbit;" was completely unused here.

test/std/localization/locale.categories/category.time/locale.time.get/time_base.pass.cpp
test/std/numerics/c.math/ctgmath.pass.cpp
test/std/numerics/rand/rand.device/entropy.pass.cpp
test/std/numerics/rand/rand.device/eval.pass.cpp
test/std/strings/basic.string/string.modifiers/string_copy/copy.pass.cpp
test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/eof.pass.cpp
test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/eof.pass.cpp
test/std/thread/futures/futures.promise/dtor.pass.cpp
test/std/thread/futures/futures.task/futures.task.members/dtor.pass.cpp
test/std/thread/thread.condition/thread.condition.condvar/wait_for_pred.pass.cpp
These variables are verifying types but are otherwise unused.

test/std/strings/basic.string/string.capacity/reserve.pass.cpp
old_cap was unused (it's unclear to me whether it was intended to be used).

test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char/eq.pass.cpp
test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/eq.pass.cpp
test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/lt.pass.cpp
test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/eq.pass.cpp
test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/lt.pass.cpp
test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.wchar.t/eq.pass.cpp
test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.wchar.t/lt.pass.cpp
These tests contained unused characters.


https://reviews.llvm.org/D26314

Files:
  test/std/depr/depr.c.headers/inttypes_h.pass.cpp
  test/std/input.output/file.streams/c.files/cinttypes.pass.cpp
  test/std/input.output/iostream.format/quoted.manip/quoted.pass.cpp
  test/std/input.output/iostream.forward/iosfwd.pass.cpp
  
test/std/localization/locale.categories/category.collate/locale.collate/types.pass.cpp
  
test/std/localization/locale.categories/category.ctype/facet.ctype.special/types.pass.cpp
  
test/std/localization/locale.categories/category.ctype/locale.codecvt/types_char.pass.cpp
  
test/std/localization/locale.categories/category.ctype/locale.codecvt/types_wchar_t.pass.cpp
  
test/std/localization/locale.categories/category.ctype/locale.ctype/types.pass.cpp
  
test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_long.pass.cpp
  
test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_unsigned_long.pass.cpp
  
test/std/localization/locale.categories/category.time/locale.time.get/time_base.pass.cpp
  
test/std/localization/locale.categories/facet.numpunct/locale.numpunct/types.pass.cpp
  test/std/localization/locales/locale.global.templates/use_facet.pass.cpp
  test/std/numerics/c.math/ctgmath.pass.cpp
  test/std/numerics/rand/rand.device/entropy.pass.cpp
  test/std/numerics/rand/rand.device/eval.pass.cpp
  test/std/strings/basic.string/string.capacity/reserve.pass.cpp
  test/std/strings/basic.string/string.modifiers/string_copy/copy.pass.cpp
  
test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char/eq.pass.cpp
  
test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/eof.pass.cpp
  
test/std/strings/char.traits/char.traits.specialization

[PATCH] D26057: [coroutines] Add DependentCoawaitExpr and fix re-building CoroutineBodyStmt.

2016-11-04 Thread Eric Fiselier via cfe-commits
EricWF retitled this revision from "[coroutines] Add CoawaitDependentExpr AST 
node and use it to properly build await_transform." to "[coroutines] Add 
DependentCoawaitExpr and fix re-building CoroutineBodyStmt.".
EricWF updated the summary for this revision.
EricWF updated this revision to Diff 76952.
EricWF marked an inline comment as done.
EricWF added a comment.

- Address review comments about `DependentCoawaitExpr` and using 
`UnresolvedLookupExpr`.
- Fix building of the initial/final coroutine suspends points.
- Fix transformation of `CoroutineBodyStmt` so that it transforms the 
final/initial suspend points instead of rebuilding them fully.

@rsmith: This change is a little big, but it's not trivial for me to split it 
up. Please let me know if you would prefer this submitted as multiple patches.


https://reviews.llvm.org/D26057

Files:
  include/clang/AST/ExprCXX.h
  include/clang/AST/RecursiveASTVisitor.h
  include/clang/AST/StmtCXX.h
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/Basic/StmtNodes.td
  include/clang/Sema/ScopeInfo.h
  include/clang/Sema/Sema.h
  lib/AST/Expr.cpp
  lib/AST/ExprClassification.cpp
  lib/AST/ExprConstant.cpp
  lib/AST/ItaniumMangle.cpp
  lib/AST/StmtPrinter.cpp
  lib/AST/StmtProfile.cpp
  lib/Parse/ParseStmt.cpp
  lib/Sema/ScopeInfo.cpp
  lib/Sema/SemaCoroutine.cpp
  lib/Sema/SemaDecl.cpp
  lib/Sema/SemaExceptionSpec.cpp
  lib/Sema/SemaTemplateInstantiateDecl.cpp
  lib/Sema/TreeTransform.h
  lib/Serialization/ASTReaderStmt.cpp
  lib/Serialization/ASTWriterStmt.cpp
  lib/StaticAnalyzer/Core/ExprEngine.cpp
  test/SemaCXX/coroutines.cpp
  tools/libclang/CXCursor.cpp

Index: tools/libclang/CXCursor.cpp
===
--- tools/libclang/CXCursor.cpp
+++ tools/libclang/CXCursor.cpp
@@ -231,6 +231,7 @@
   case Stmt::TypeTraitExprClass:
   case Stmt::CoroutineBodyStmtClass:
   case Stmt::CoawaitExprClass:
+  case Stmt::DependentCoawaitExprClass:
   case Stmt::CoreturnStmtClass:
   case Stmt::CoyieldExprClass:
   case Stmt::CXXBindTemporaryExprClass:
Index: test/SemaCXX/coroutines.cpp
===
--- test/SemaCXX/coroutines.cpp
+++ test/SemaCXX/coroutines.cpp
@@ -59,25 +59,25 @@
 template 
 struct std::experimental::coroutine_traits {};
 
-int no_promise_type() {
-  co_await a; // expected-error {{this function cannot be a coroutine: 'std::experimental::coroutine_traits' has no member named 'promise_type'}}
+int no_promise_type() { // expected-error {{this function cannot be a coroutine: 'std::experimental::coroutine_traits' has no member named 'promise_type'}}
+  co_await a;
 }
 
 template <>
 struct std::experimental::coroutine_traits { typedef int promise_type; };
-double bad_promise_type(double) {
-  co_await a; // expected-error {{this function cannot be a coroutine: 'experimental::coroutine_traits::promise_type' (aka 'int') is not a class}}
+double bad_promise_type(double) { // expected-error {{this function cannot be a coroutine: 'experimental::coroutine_traits::promise_type' (aka 'int') is not a class}}
+  co_await a;
 }
 
 template <>
 struct std::experimental::coroutine_traits {
   struct promise_type {};
 };
-double bad_promise_type_2(int) {
-  co_yield 0; // expected-error {{no member named 'yield_value' in 'std::experimental::coroutine_traits::promise_type'}}
+double bad_promise_type_2(int) { // expected-error {{no member named 'initial_suspend'}}
+  co_yield 0;// expected-error {{no member named 'yield_value'}}
 }
 
-struct promise; // expected-note 2{{forward declaration}}
+struct promise; // expected-note {{forward declaration}}
 struct promise_void;
 struct void_tag {};
 template 
@@ -94,9 +94,7 @@
 }
 
 // FIXME: This diagnostic is terrible.
-void undefined_promise() { // expected-error {{variable has incomplete type 'promise_type'}}
-  // FIXME: This diagnostic doesn't make any sense.
-  // expected-error@-2 {{incomplete definition of type 'promise'}}
+void undefined_promise() { // expected-error {{this function cannot be a coroutine: 'experimental::coroutine_traits::promise_type' (aka 'promise') is an incomplete type}}
   co_await a;
 }
 
@@ -217,6 +215,13 @@
 }
 
 struct outer {};
+struct await_arg_1 {};
+struct await_arg_2 {};
+
+namespace adl_ns {
+struct coawait_arg_type {};
+awaitable operator co_await(coawait_arg_type);
+}
 
 namespace dependent_operator_co_await_lookup {
   template void await_template(T t) {
@@ -239,6 +244,94 @@
   };
   template void await_template(outer); // expected-note {{instantiation}}
   template void await_template_2(outer);
+
+  struct transform_awaitable {};
+  struct transformed {};
+
+  struct transform_promise {
+typedef transform_awaitable await_arg;
+coro get_return_object();
+transformed initial_suspend();
+::adl_ns::coawait_arg_type final_suspend();
+transformed await_transform(transform_awaitable);
+  };
+  template 
+  struct basic_promise {
+typed

[PATCH] D26057: [coroutines] Add DependentCoawaitExpr and fix re-building CoroutineBodyStmt.

2016-11-04 Thread Eric Fiselier via cfe-commits
EricWF updated this revision to Diff 76953.
EricWF added a comment.

- Address review comments about `DependentCoawaitExpr` and using 
`UnresolvedLookupExpr`.
- Fix building of the initial/final coroutine suspends points.
- Fix transformation of `CoroutineBodyStmt` so that it transforms the 
final/initial suspend points instead of rebuilding them fully.

@rsmith: This change is a little big, but it's not trivial for me to split it 
up. Please let me know if you would prefer this submitted as multiple patches.


https://reviews.llvm.org/D26057

Files:
  include/clang/AST/ExprCXX.h
  include/clang/AST/RecursiveASTVisitor.h
  include/clang/AST/StmtCXX.h
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/Basic/StmtNodes.td
  include/clang/Sema/ScopeInfo.h
  include/clang/Sema/Sema.h
  lib/AST/Expr.cpp
  lib/AST/ExprClassification.cpp
  lib/AST/ExprConstant.cpp
  lib/AST/ItaniumMangle.cpp
  lib/AST/StmtPrinter.cpp
  lib/AST/StmtProfile.cpp
  lib/Parse/ParseStmt.cpp
  lib/Sema/ScopeInfo.cpp
  lib/Sema/SemaCoroutine.cpp
  lib/Sema/SemaDecl.cpp
  lib/Sema/SemaExceptionSpec.cpp
  lib/Sema/SemaTemplateInstantiateDecl.cpp
  lib/Sema/TreeTransform.h
  lib/Serialization/ASTReaderStmt.cpp
  lib/Serialization/ASTWriterStmt.cpp
  lib/StaticAnalyzer/Core/ExprEngine.cpp
  test/SemaCXX/coroutines.cpp
  tools/libclang/CXCursor.cpp

Index: tools/libclang/CXCursor.cpp
===
--- tools/libclang/CXCursor.cpp
+++ tools/libclang/CXCursor.cpp
@@ -231,6 +231,7 @@
   case Stmt::TypeTraitExprClass:
   case Stmt::CoroutineBodyStmtClass:
   case Stmt::CoawaitExprClass:
+  case Stmt::DependentCoawaitExprClass:
   case Stmt::CoreturnStmtClass:
   case Stmt::CoyieldExprClass:
   case Stmt::CXXBindTemporaryExprClass:
Index: test/SemaCXX/coroutines.cpp
===
--- test/SemaCXX/coroutines.cpp
+++ test/SemaCXX/coroutines.cpp
@@ -59,25 +59,25 @@
 template 
 struct std::experimental::coroutine_traits {};
 
-int no_promise_type() {
-  co_await a; // expected-error {{this function cannot be a coroutine: 'std::experimental::coroutine_traits' has no member named 'promise_type'}}
+int no_promise_type() { // expected-error {{this function cannot be a coroutine: 'std::experimental::coroutine_traits' has no member named 'promise_type'}}
+  co_await a;
 }
 
 template <>
 struct std::experimental::coroutine_traits { typedef int promise_type; };
-double bad_promise_type(double) {
-  co_await a; // expected-error {{this function cannot be a coroutine: 'experimental::coroutine_traits::promise_type' (aka 'int') is not a class}}
+double bad_promise_type(double) { // expected-error {{this function cannot be a coroutine: 'experimental::coroutine_traits::promise_type' (aka 'int') is not a class}}
+  co_await a;
 }
 
 template <>
 struct std::experimental::coroutine_traits {
   struct promise_type {};
 };
-double bad_promise_type_2(int) {
-  co_yield 0; // expected-error {{no member named 'yield_value' in 'std::experimental::coroutine_traits::promise_type'}}
+double bad_promise_type_2(int) { // expected-error {{no member named 'initial_suspend'}}
+  co_yield 0;// expected-error {{no member named 'yield_value'}}
 }
 
-struct promise; // expected-note 2{{forward declaration}}
+struct promise; // expected-note {{forward declaration}}
 struct promise_void;
 struct void_tag {};
 template 
@@ -94,9 +94,7 @@
 }
 
 // FIXME: This diagnostic is terrible.
-void undefined_promise() { // expected-error {{variable has incomplete type 'promise_type'}}
-  // FIXME: This diagnostic doesn't make any sense.
-  // expected-error@-2 {{incomplete definition of type 'promise'}}
+void undefined_promise() { // expected-error {{this function cannot be a coroutine: 'experimental::coroutine_traits::promise_type' (aka 'promise') is an incomplete type}}
   co_await a;
 }
 
@@ -217,6 +215,13 @@
 }
 
 struct outer {};
+struct await_arg_1 {};
+struct await_arg_2 {};
+
+namespace adl_ns {
+struct coawait_arg_type {};
+awaitable operator co_await(coawait_arg_type);
+}
 
 namespace dependent_operator_co_await_lookup {
   template void await_template(T t) {
@@ -239,6 +244,94 @@
   };
   template void await_template(outer); // expected-note {{instantiation}}
   template void await_template_2(outer);
+
+  struct transform_awaitable {};
+  struct transformed {};
+
+  struct transform_promise {
+typedef transform_awaitable await_arg;
+coro get_return_object();
+transformed initial_suspend();
+::adl_ns::coawait_arg_type final_suspend();
+transformed await_transform(transform_awaitable);
+  };
+  template 
+  struct basic_promise {
+typedef AwaitArg await_arg;
+coro get_return_object();
+awaitable initial_suspend();
+awaitable final_suspend();
+  };
+
+  awaitable operator co_await(await_arg_1);
+
+  template 
+  coro await_template_3(U t) {
+co_await t;
+  }
+
+  template coro> await_template_3>(await_arg_1);
+
+  tem

[PATCH] D26316: [coroutines] Build and pass coroutine_handle to await_suspend.

2016-11-04 Thread Eric Fiselier via cfe-commits
EricWF created this revision.
EricWF added reviewers: rsmith, GorNishanov.
EricWF added a subscriber: cfe-commits.
Herald added a subscriber: mehdi_amini.

This patch adds passing a `coroutine_handle` object to `await_suspend` calls.

It builds the `coroutine_handle`  using 
`coroutine_handle::from_address(__builtin_coro_frame())`.


https://reviews.llvm.org/D26316

Files:
  include/clang/Basic/DiagnosticSemaKinds.td
  lib/Sema/SemaCoroutine.cpp
  test/CodeGenCoroutines/coro-alloc.cpp
  test/SemaCXX/coroutines.cpp

Index: test/SemaCXX/coroutines.cpp
===
--- test/SemaCXX/coroutines.cpp
+++ test/SemaCXX/coroutines.cpp
@@ -16,33 +16,26 @@
   // expected-error@-1 {{use of undeclared identifier 'a'}}
 }
 
-
-struct awaitable {
-  bool await_ready();
-  void await_suspend(); // FIXME: coroutine_handle
-  void await_resume();
-} a;
-
-struct suspend_always {
-  bool await_ready() { return false; }
-  void await_suspend() {}
-  void await_resume() {}
-};
-
-struct suspend_never {
-  bool await_ready() { return true; }
-  void await_suspend() {}
-  void await_resume() {}
-};
-
 void no_coroutine_traits() {
-  co_await a; // expected-error {{need to include }}
+  co_await 4; // expected-error {{need to include }}
 }
 
 namespace std {
 namespace experimental {
 template 
 struct coroutine_traits; // expected-note {{declared here}}
+
+template 
+struct coroutine_handle {
+  static coroutine_handle from_address(void *);
+};
+
+template <>
+struct coroutine_handle {
+  template 
+  coroutine_handle(coroutine_handle);
+  static coroutine_handle from_address(void *);
+};
 }
 }
 
@@ -52,6 +45,24 @@
   using promise_type = Promise;
 };
 
+struct awaitable {
+  bool await_ready();
+  void await_suspend(std::experimental::coroutine_handle<>); // FIXME: coroutine_handle
+  void await_resume();
+} a;
+
+struct suspend_always {
+  bool await_ready() { return false; }
+  void await_suspend(std::experimental::coroutine_handle<>) {}
+  void await_resume() {}
+};
+
+struct suspend_never {
+  bool await_ready() { return true; }
+  void await_suspend(std::experimental::coroutine_handle<>) {}
+  void await_resume() {}
+};
+
 void no_specialization() {
   co_await a; // expected-error {{implicit instantiation of undefined template 'std::experimental::coroutine_traits'}}
 }
@@ -86,13 +97,6 @@
 struct std::experimental::coroutine_traits
 { using promise_type = promise_void; };
 
-namespace std {
-namespace experimental {
-template 
-struct coroutine_handle;
-}
-}
-
 // FIXME: This diagnostic is terrible.
 void undefined_promise() { // expected-error {{this function cannot be a coroutine: 'experimental::coroutine_traits::promise_type' (aka 'promise') is an incomplete type}}
   co_await a;
Index: test/CodeGenCoroutines/coro-alloc.cpp
===
--- test/CodeGenCoroutines/coro-alloc.cpp
+++ test/CodeGenCoroutines/coro-alloc.cpp
@@ -4,12 +4,26 @@
 namespace experimental {
 template 
 struct coroutine_traits; // expected-note {{declared here}}
+
+template 
+struct coroutine_handle {
+  coroutine_handle() = default;
+  static coroutine_handle from_address(void *) { return {}; }
+};
+
+template <>
+struct coroutine_handle {
+  static coroutine_handle from_address(void *) { return {}; }
+  coroutine_handle() = default;
+  template 
+  coroutine_handle(coroutine_handle) {}
+};
 }
 }
 
 struct suspend_always {
   bool await_ready() { return false; }
-  void await_suspend() {}
+  void await_suspend(std::experimental::coroutine_handle<>) {}
   void await_resume() {}
 };
 
Index: lib/Sema/SemaCoroutine.cpp
===
--- lib/Sema/SemaCoroutine.cpp
+++ lib/Sema/SemaCoroutine.cpp
@@ -116,6 +116,53 @@
   return PromiseType;
 }
 
+/// Look up the std::coroutine_traits<...>::promise_type for the given
+/// function type.
+static QualType lookupCoroutineHandleType(Sema &S, QualType PromiseType,
+  SourceLocation Loc) {
+  if (PromiseType.isNull())
+return QualType();
+
+  NamespaceDecl *StdExp = S.lookupStdExperimentalNamespace();
+  assert(StdExp && "Should already be diagnosed");
+
+  LookupResult Result(S, &S.PP.getIdentifierTable().get("coroutine_handle"),
+  Loc, Sema::LookupOrdinaryName);
+  if (!S.LookupQualifiedName(Result, StdExp)) {
+S.Diag(Loc, diag::err_implied_std_coroutine_traits_not_found);
+return QualType();
+  }
+
+  ClassTemplateDecl *CoroHandle = Result.getAsSingle();
+  if (!CoroHandle) {
+Result.suppressDiagnostics();
+// We found something weird. Complain about the first thing we found.
+NamedDecl *Found = *Result.begin();
+S.Diag(Found->getLocation(), diag::err_malformed_std_coroutine_handle);
+return QualType();
+  }
+
+  // Form template argument list for coroutine_traits.
+  TemplateArgumentListInfo Args(Loc, Loc);
+  Args.addArgument(TemplateArgumentLoc(
+  Te

[PATCH] D26317: Fix use-of-temporary with StringRef in code coverage

2016-11-04 Thread Jordan Rose via cfe-commits
jordan_rose created this revision.
jordan_rose added a reviewer: vsk.
jordan_rose added a subscriber: cfe-commits.
jordan_rose set the repository for this revision to rL LLVM.

The fixed code is basically identical to the same loop below, which might 
indicate an opportunity for refactoring. I just wanted to fix the 
use-of-temporary issue.

Caught by adding a similar check to StringRef as r283798 did for ArrayRef. I'll 
be upstreaming that soon.


Repository:
  rL LLVM

https://reviews.llvm.org/D26317

Files:
  lib/CodeGen/CoverageMappingGen.cpp


Index: lib/CodeGen/CoverageMappingGen.cpp
===
--- lib/CodeGen/CoverageMappingGen.cpp
+++ lib/CodeGen/CoverageMappingGen.cpp
@@ -1034,10 +1034,15 @@
 std::vector Filenames;
 std::vector Expressions;
 std::vector Regions;
+llvm::SmallVector FilenameStrs;
 llvm::SmallVector FilenameRefs;
+FilenameStrs.resize(FileEntries.size());
 FilenameRefs.resize(FileEntries.size());
-for (const auto &Entry : FileEntries)
-  FilenameRefs[Entry.second] = normalizeFilename(Entry.first->getName());
+for (const auto &Entry : FileEntries) {
+  auto I = Entry.second;
+  FilenameStrs[I] = normalizeFilename(Entry.first->getName());
+  FilenameRefs[I] = FilenameStrs[I];
+}
 RawCoverageMappingReader Reader(CoverageMapping, FilenameRefs, Filenames,
 Expressions, Regions);
 if (Reader.read())


Index: lib/CodeGen/CoverageMappingGen.cpp
===
--- lib/CodeGen/CoverageMappingGen.cpp
+++ lib/CodeGen/CoverageMappingGen.cpp
@@ -1034,10 +1034,15 @@
 std::vector Filenames;
 std::vector Expressions;
 std::vector Regions;
+llvm::SmallVector FilenameStrs;
 llvm::SmallVector FilenameRefs;
+FilenameStrs.resize(FileEntries.size());
 FilenameRefs.resize(FileEntries.size());
-for (const auto &Entry : FileEntries)
-  FilenameRefs[Entry.second] = normalizeFilename(Entry.first->getName());
+for (const auto &Entry : FileEntries) {
+  auto I = Entry.second;
+  FilenameStrs[I] = normalizeFilename(Entry.first->getName());
+  FilenameRefs[I] = FilenameStrs[I];
+}
 RawCoverageMappingReader Reader(CoverageMapping, FilenameRefs, Filenames,
 Expressions, Regions);
 if (Reader.read())
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D26186: Allow using libsupc++ with LIBCXX_ENABLE_STATIC_ABI_LIBRARY

2016-11-04 Thread Eric Fiselier via cfe-commits
EricWF accepted this revision.
EricWF added a comment.
This revision is now accepted and ready to land.

LGTM. It seems like it was added to libstdc++ in 4.9, which works for me since 
building with GCC 4.8 isn't really supported.


https://reviews.llvm.org/D26186



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


[PATCH] D26142: Protect std::experimental::optional tests under libcpp-no-exceptions

2016-11-04 Thread Eric Fiselier via cfe-commits
EricWF accepted this revision.
EricWF added a comment.
This revision is now accepted and ready to land.

LGTM after addressing inline comments.

Thanks again!




Comment at: 
test/std/experimental/optional/optional.object/optional.object.ctor/copy.pass.cpp:30
 try
+#endif
 {

```
#ifdef TEST_HAS_NO_EXCEPTIONS
  if (is_going_to_throw) return;
#else
  try
#endif



Comment at: 
test/std/experimental/optional/optional.object/optional.object.ctor/copy.pass.cpp:41
 {
 assert(i == 6);
 }

also add ```assert(is_going_to_throw);```



Comment at: 
test/std/experimental/optional/optional.object/optional.object.ctor/move.pass.cpp:30
 bool rhs_engaged = static_cast(rhs);
+#ifndef TEST_HAS_NO_EXCEPTIONS
 try

Some comments as above.


https://reviews.llvm.org/D26142



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


[PATCH] D26139: Tests for strings conversions under libcpp-no-exceptions

2016-11-04 Thread Eric Fiselier via cfe-commits
EricWF added inline comments.



Comment at: test/std/strings/string.conversions/stold.pass.cpp:39
 assert(idx == 2);
+#ifndef TEST_HAS_NO_EXCEPTIONS
 try

Hmm. All of these `#ifdef`s get ugly fast. I think it might be better to add 
`TEST_TRY` and `TEST_CATCH(...)` macros defined like:

```
#ifndef TEST_HAS_NO_EXCEPTIONS
#define TEST_TRY try
#define TEST_CATCH(...) catch(__VA_ARGS__)
#else
#define TEST_TRY
#define TEST_CATCH(...) if (false)
#endif
```

What do you think? Feel free to add those macros to `test_macros.h` if you like 
the idea.



https://reviews.llvm.org/D26139



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


[PATCH] D25897: Add __no_instrument_function__ to _LIBCPP_INLINE_VISIBILITY and _LIBCPP_ALWAYS_INLINE

2016-11-04 Thread Eric Fiselier via cfe-commits
EricWF added a comment.

> It looks like this is caused by functions in libc++'s headers that are marked 
> to always be inlined. Since they are always inlined there is external 
> definition for the linker to get the address of. I have worked around this by 
> adding the no_instrument_function attribute to _LIBCPP_INLINE_VISIBILITY and 
> _LIBCPP_ALWAYS_INLINE.

That isn't quite correct. This problem only occurs on methods which are 
externally instantiated withing the dylib but there definitions are marked 
`__attribute__((visibility("hidden")))`.
For example `std::string` and `std::num_get`. Therefore the compiler *knows* 
there is an externally available definition but its hidden from the linker.

I would prefer to fix this by using `_LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY` 
on these methods instead of `_LIBCPP_INLINE_VISIBILITY` or 
`_LIBCPP_ALWAYS_INLINE` instead.


https://reviews.llvm.org/D25897



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


[PATCH] D26306: [AVX-512] Make VBMI instruction set enabling imply that the BWI instruction set is also enabled.

2016-11-04 Thread Craig Topper via cfe-commits
craig.topper added inline comments.



Comment at: test/Preprocessor/x86_target_features.c:212
 
+// RUN: %clang -target i386-unknown-unknown -march=atom -mavx512vbmi 
-mno-avx512vbmi -x c -E -dM -o - %s | FileCheck -match-full-lines 
--check-prefix=AVX512VBMINOAVX512BW %s
+

zvi wrote:
> Test is turning on and then off the same feature. Did you mean -mavx512bw 
> -mno-avx512vbmi ?
> 
> If the latter, I would prefer the compiler shout at me for providing 
> contradicting flags than let the last flag win. Consider enforcing this in 
> handleTargetFeatures().
> 
> 
It was supposed to be -mavx512vbmi -mno-avx512bw to verify that turning off bwi 
would turn off vbmi. The lack of warning is consistent with the behavior of all 
the other linked feature flags.


https://reviews.llvm.org/D26306



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


[PATCH] D26306: [AVX-512] Make VBMI instruction set enabling imply that the BWI instruction set is also enabled.

2016-11-04 Thread Craig Topper via cfe-commits
craig.topper updated this revision to Diff 76961.

https://reviews.llvm.org/D26306

Files:
  lib/Basic/Targets.cpp
  test/Preprocessor/x86_target_features.c


Index: test/Preprocessor/x86_target_features.c
===
--- test/Preprocessor/x86_target_features.c
+++ test/Preprocessor/x86_target_features.c
@@ -196,6 +196,7 @@
 // RUN: %clang -target i386-unknown-unknown -march=atom -mavx512vbmi -x c -E 
-dM -o - %s | FileCheck -match-full-lines --check-prefix=AVX512VBMI %s
 
 // AVX512VBMI: #define __AVX2__ 1
+// AVX512VBMI: #define __AVX512BW__ 1
 // AVX512VBMI: #define __AVX512F__ 1
 // AVX512VBMI: #define __AVX512VBMI__ 1
 // AVX512VBMI: #define __AVX__ 1
@@ -208,6 +209,11 @@
 // AVX512VBMI: #define __SSE__ 1
 // AVX512VBMI: #define __SSSE3__ 1
 
+// RUN: %clang -target i386-unknown-unknown -march=atom -mavx512vbmi 
-mno-avx512bw -x c -E -dM -o - %s | FileCheck -match-full-lines 
--check-prefix=AVX512VBMINOAVX512BW %s
+
+// AVX512VBMINOAVX512BW-NOT: #define __AVX512BW__ 1
+// AVX512VBMINOAVX512BW-NOT: #define __AVX512VBMI__ 1
+
 // RUN: %clang -target i386-unknown-unknown -march=atom -msse4.2 -x c -E -dM 
-o - %s | FileCheck -match-full-lines --check-prefix=SSE42POPCNT %s
 
 // SSE42POPCNT: #define __POPCNT__ 1
Index: lib/Basic/Targets.cpp
===
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -3350,6 +3350,12 @@
  Name == "avx512vbmi" || Name == "avx512ifma") {
 if (Enabled)
   setSSELevel(Features, AVX512F, Enabled);
+// Enable BWI instruction if VBMI is being enabled.
+if (Name == "avx512vbmi" && Enabled)
+  Features["avx512bw"] = true;
+// Also disable VBMI if BWI is being disabled.
+if (Name == "avx512bw" && !Enabled)
+  Features["avx512vbmi"] = false;
   } else if (Name == "fma") {
 if (Enabled)
   setSSELevel(Features, AVX, Enabled);


Index: test/Preprocessor/x86_target_features.c
===
--- test/Preprocessor/x86_target_features.c
+++ test/Preprocessor/x86_target_features.c
@@ -196,6 +196,7 @@
 // RUN: %clang -target i386-unknown-unknown -march=atom -mavx512vbmi -x c -E -dM -o - %s | FileCheck -match-full-lines --check-prefix=AVX512VBMI %s
 
 // AVX512VBMI: #define __AVX2__ 1
+// AVX512VBMI: #define __AVX512BW__ 1
 // AVX512VBMI: #define __AVX512F__ 1
 // AVX512VBMI: #define __AVX512VBMI__ 1
 // AVX512VBMI: #define __AVX__ 1
@@ -208,6 +209,11 @@
 // AVX512VBMI: #define __SSE__ 1
 // AVX512VBMI: #define __SSSE3__ 1
 
+// RUN: %clang -target i386-unknown-unknown -march=atom -mavx512vbmi -mno-avx512bw -x c -E -dM -o - %s | FileCheck -match-full-lines --check-prefix=AVX512VBMINOAVX512BW %s
+
+// AVX512VBMINOAVX512BW-NOT: #define __AVX512BW__ 1
+// AVX512VBMINOAVX512BW-NOT: #define __AVX512VBMI__ 1
+
 // RUN: %clang -target i386-unknown-unknown -march=atom -msse4.2 -x c -E -dM -o - %s | FileCheck -match-full-lines --check-prefix=SSE42POPCNT %s
 
 // SSE42POPCNT: #define __POPCNT__ 1
Index: lib/Basic/Targets.cpp
===
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -3350,6 +3350,12 @@
  Name == "avx512vbmi" || Name == "avx512ifma") {
 if (Enabled)
   setSSELevel(Features, AVX512F, Enabled);
+// Enable BWI instruction if VBMI is being enabled.
+if (Name == "avx512vbmi" && Enabled)
+  Features["avx512bw"] = true;
+// Also disable VBMI if BWI is being disabled.
+if (Name == "avx512bw" && !Enabled)
+  Features["avx512vbmi"] = false;
   } else if (Name == "fma") {
 if (Enabled)
   setSSELevel(Features, AVX, Enabled);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D26195: Ignore incomplete types when determining whether they are expensive to copy

2016-11-04 Thread Alexander Kornienko via cfe-commits
alexfh added a comment.

Thank you for the fix! One late comment inline.




Comment at: 
clang-tools-extra/trunk/test/clang-tidy/performance-unnecessary-value-param.cpp:241
+
+// Ensure that incomplete types result in an error from the frontend and not a
+// clang-tidy diagnostic about IncompleteType being expensive to copy.

Please move this test to a separate test file and revert the RUN line here. 


Repository:
  rL LLVM

https://reviews.llvm.org/D26195



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