[PATCH] D31069: Don't warn about an unreachable fallthrough annotation in a template function

2017-03-16 Thread Richard Smith via Phabricator via cfe-commits
rsmith accepted this revision.
rsmith added a comment.
This revision is now accepted and ready to land.

LGTM, do you need someone to commit for you?


https://reviews.llvm.org/D31069



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


r298040 - [AVX-512] Add missing typecasts and parentheses to _mm512_mask_i64gather_ps. My macro cleanup script I used on the others last year must have missed it.

2017-03-16 Thread Craig Topper via cfe-commits
Author: ctopper
Date: Fri Mar 17 00:14:37 2017
New Revision: 298040

URL: http://llvm.org/viewvc/llvm-project?rev=298040=rev
Log:
[AVX-512] Add missing typecasts and parentheses to _mm512_mask_i64gather_ps. My 
macro cleanup script I used on the others last year must have missed it.

Modified:
cfe/trunk/lib/Headers/avx512fintrin.h

Modified: cfe/trunk/lib/Headers/avx512fintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512fintrin.h?rev=298040=298039=298040=diff
==
--- cfe/trunk/lib/Headers/avx512fintrin.h (original)
+++ cfe/trunk/lib/Headers/avx512fintrin.h Fri Mar 17 00:14:37 2017
@@ -8149,11 +8149,11 @@ _mm512_maskz_getexp_ps (__mmask16 __U, _
(__v8di)(__m512i)(index), (__mmask8)-1, 
\
(int)(scale)); })
 
-#define _mm512_mask_i64gather_ps( __v1_old, __mask, __index,\
-  __addr, __scale) __extension__({\
-__builtin_ia32_gatherdiv16sf ((__v8sf) __v1_old,\
-  __addr,(__v8di) __index, __mask, __scale);\
-})
+#define _mm512_mask_i64gather_ps(v1_old, mask, index, addr, scale) 
__extension__({\
+  (__m256)__builtin_ia32_gatherdiv16sf((__v8sf)(__m256)(v1_old),\
+   (float const *)(addr), \
+   (__v8di)(__m512i)(index), \
+   (__mmask8)(mask), (int)(scale)); })
 
 #define _mm512_i64gather_epi32(index, addr, scale) __extension__ ({\
   (__m256i)__builtin_ia32_gatherdiv16si((__v8si)_mm256_undefined_ps(), \


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


[PATCH] D31069: Don't warn about an unreachable fallthrough annotation in a template function

2017-03-16 Thread Ahmed Asadi via Phabricator via cfe-commits
ahmedasadi updated this revision to Diff 92104.
ahmedasadi added a comment.

Added a test case.


https://reviews.llvm.org/D31069

Files:
  lib/Sema/AnalysisBasedWarnings.cpp
  test/SemaCXX/P30636.cpp


Index: test/SemaCXX/P30636.cpp
===
--- test/SemaCXX/P30636.cpp
+++ test/SemaCXX/P30636.cpp
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 -Wimplicit-fallthrough %s
+// expected-no-diagnostics
+
+template
+int fallthrough_template(int i)
+{
+  switch (i) {
+case 1:
+  if (param)
+return 3;
+  [[clang::fallthrough]]; // no warning here, for an unreachable 
annotation (in the fallthrough_template case) in a template function
+case 2:
+  return 4;
+default:
+  return 5;
+  }
+}
+  
+template int fallthrough_template(int);
+
Index: lib/Sema/AnalysisBasedWarnings.cpp
===
--- lib/Sema/AnalysisBasedWarnings.cpp
+++ lib/Sema/AnalysisBasedWarnings.cpp
@@ -972,7 +972,7 @@
   }
 }
 
-bool checkFallThroughIntoBlock(const CFGBlock , int ) {
+bool checkFallThroughIntoBlock(const CFGBlock , int , bool 
isTemplateInstantiation) {
   assert(!ReachableBlocks.empty() && "ReachableBlocks empty");
 
   int UnannotatedCnt = 0;
@@ -1002,8 +1002,12 @@
ElemIt != ElemEnd; ++ElemIt) {
 if (Optional CS = ElemIt->getAs()) {
   if (const AttributedStmt *AS = asFallThroughAttr(CS->getStmt())) 
{
-S.Diag(AS->getLocStart(),
-   diag::warn_fallthrough_attr_unreachable);
+// Don't issue a warning for an unreachable fallthrough
+// attribute in template instantiations as it may not be
+// unreachable in all instantiations of the template
+if (!isTemplateInstantiation)
+S.Diag(AS->getLocStart(),
+   diag::warn_fallthrough_attr_unreachable);
 markFallthroughVisited(AS);
 ++AnnotatedCnt;
 break;
@@ -1164,7 +1168,10 @@
 
 int AnnotatedCnt;
 
-if (!FM.checkFallThroughIntoBlock(*B, AnnotatedCnt))
+bool isTemplateInstantiation = false;
+if (const FunctionDecl *Function = dyn_cast(AC.getDecl()))
+isTemplateInstantiation = Function->isTemplateInstantiation();
+if (!FM.checkFallThroughIntoBlock(*B, AnnotatedCnt, 
isTemplateInstantiation))
   continue;
 
 S.Diag(Label->getLocStart(),


Index: test/SemaCXX/P30636.cpp
===
--- test/SemaCXX/P30636.cpp
+++ test/SemaCXX/P30636.cpp
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 -Wimplicit-fallthrough %s
+// expected-no-diagnostics
+
+template
+int fallthrough_template(int i)
+{
+  switch (i) {
+case 1:
+  if (param)
+return 3;
+  [[clang::fallthrough]]; // no warning here, for an unreachable annotation (in the fallthrough_template case) in a template function
+case 2:
+  return 4;
+default:
+  return 5;
+  }
+}
+  
+template int fallthrough_template(int);
+
Index: lib/Sema/AnalysisBasedWarnings.cpp
===
--- lib/Sema/AnalysisBasedWarnings.cpp
+++ lib/Sema/AnalysisBasedWarnings.cpp
@@ -972,7 +972,7 @@
   }
 }
 
-bool checkFallThroughIntoBlock(const CFGBlock , int ) {
+bool checkFallThroughIntoBlock(const CFGBlock , int , bool isTemplateInstantiation) {
   assert(!ReachableBlocks.empty() && "ReachableBlocks empty");
 
   int UnannotatedCnt = 0;
@@ -1002,8 +1002,12 @@
ElemIt != ElemEnd; ++ElemIt) {
 if (Optional CS = ElemIt->getAs()) {
   if (const AttributedStmt *AS = asFallThroughAttr(CS->getStmt())) {
-S.Diag(AS->getLocStart(),
-   diag::warn_fallthrough_attr_unreachable);
+// Don't issue a warning for an unreachable fallthrough
+// attribute in template instantiations as it may not be
+// unreachable in all instantiations of the template
+if (!isTemplateInstantiation)
+S.Diag(AS->getLocStart(),
+   diag::warn_fallthrough_attr_unreachable);
 markFallthroughVisited(AS);
 ++AnnotatedCnt;
 break;
@@ -1164,7 +1168,10 @@
 
 int AnnotatedCnt;
 
-if (!FM.checkFallThroughIntoBlock(*B, AnnotatedCnt))
+bool isTemplateInstantiation = false;
+if (const FunctionDecl *Function = dyn_cast(AC.getDecl()))
+isTemplateInstantiation = Function->isTemplateInstantiation();
+if (!FM.checkFallThroughIntoBlock(*B, AnnotatedCnt, isTemplateInstantiation))
   continue;
 
 S.Diag(Label->getLocStart(),

[PATCH] D31069: Don't warn about an unreachable fallthrough annotation in a template function

2017-03-16 Thread Richard Smith via Phabricator via cfe-commits
rsmith added a comment.

This needs a test case, but the change itself looks fine to me.


Repository:
  rL LLVM

https://reviews.llvm.org/D31069



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


[PATCH] D30806: [nonnull] Teach Clang to attach the nonnull LLVM attribute to declarations and calls instead of just definitions, and then teach it to *not* attach such attributes even if the source c

2017-03-16 Thread Hal Finkel via Phabricator via cfe-commits
hfinkel added inline comments.



Comment at: include/clang/AST/ASTContext.h:1868
+  bool *OverrideNonnullReturn = nullptr,
+  unsigned *OverrideNonnullArgs = nullptr,
   unsigned *IntegerConstantArgs = nullptr) const;

chandlerc wrote:
> hfinkel wrote:
> > It seems like you had to touch more code than necessary because you decided 
> > to add these parameters before IntegerConstantArgs. Why don't you add them 
> > afterward instead?
> It seemed more natural But I'm happy to change the order. I'm not worreid 
> about how much code I have to touch, I'd rather just get the options in the 
> right place. What order would you suggest?
I suggest the other order because it is more common to want the 
IntegerConstantArgs than the nonnull args (which essentially only one caller 
wants).


https://reviews.llvm.org/D30806



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


Re: [PATCH] D30415: Fix -mno-altivec cannot overwrite -maltivec option

2017-03-16 Thread Eric Christopher via cfe-commits
Great, thanks! Can you make this change instead Sean? :)

-eric

On Thu, Mar 16, 2017 at 7:20 PM Hal Finkel  wrote:

>
> On 03/16/2017 08:11 PM, Eric Christopher wrote:
>
>
>
> On Thu, Mar 16, 2017 at 5:45 PM Hal Finkel  wrote:
>
>
> On 03/16/2017 07:40 PM, Eric Christopher wrote:
>
>
>
> On Thu, Mar 16, 2017 at 5:37 PM Hal Finkel via Phabricator <
> revi...@reviews.llvm.org> wrote:
>
> hfinkel added a comment.
>
> In https://reviews.llvm.org/D30415#703398, @echristo wrote:
>
> > Different suggestion:
> >
> > Remove the faltivec option. Even gcc doesn't support it anymore afaict.
>
>
> What are you suggesting? Always having the language extensions on? Or
> explicitly tying the language extensions to the underlying target feature?
>
>
> I was thinking the latter.
>
>
> Is that what GCC now does?
>
>
> That would be my guess given the option isn't listed anymore, but what it
> does is this:
>
> echristo@dzur ~/s/gcc-git> grep -r faltivec *
> gcc/testsuite/gcc.target/powerpc/stabs-attrib-vect-darwin.c:/* {
> dg-options "-gstabs+ -fno-eliminate-unused-debug-types -faltivec" } */
> gcc/testsuite/ChangeLog-1993-2007: * g++.dg/ext/altivec-8.C: Use
> '-maltivec' instead of '-faltivec';
> gcc/config/rs6000/darwin.h:   the kernel or some such.  The "-faltivec"
> option should have been
> gcc/config/rs6000/darwin.h:  %{faltivec:-maltivec -include altivec.h}
> %{fno-altivec:-mno-altivec} \
> gcc/config/rs6000/darwin.h:  % gcc/config/rs6000/darwin.opt:faltivec
> gcc/ChangeLog-2003: -maltivec is specified, not the non-existent
> -faltivec.
> gcc/ChangeLog-2010: * config/rs6000/darwin.h (CC1_SPEC): Handle -faltivec
> and -fno-altivec.
> gcc/ChangeLog-2010: * config/rs6000/darwin.opt (Waltivec-long-deprecated,
> faltivec,
>
> and only on darwin. I don't see anything that treats the faltivec alias as
> anything language specific anywhere. It basically just says "pass the
> include and turn on maltivec".
>
> At this point I'm pretty sure that -faltivec can just be ignored.
>
>
> It is certainly fair to say that having the ability to use -fno-altivec
> was much more important when -faltivec included altivec.h (which injected
> names like vec_add into the global namespace). I'm fine with enabling the
> vector syntax extensions when targeting altivec is enabled (they're
> extensions to extensions anyway).
>
>
>  -Hal
>
>
>
> -eric
>
>
>
>  -Hal
>
>
>
> -eric
>
>
> > (Go ahead and commit the zvector part if you'd like).
> >
> > -eric
>
>
>
>
> https://reviews.llvm.org/D30415
>
>
>
>
> --
> Hal Finkel
> Lead, Compiler Technology and Programming Languages
> Leadership Computing Facility
> Argonne National Laboratory
>
>
> --
> Hal Finkel
> Lead, Compiler Technology and Programming Languages
> Leadership Computing Facility
> Argonne National Laboratory
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D30415: Fix -mno-altivec cannot overwrite -maltivec option

2017-03-16 Thread Hal Finkel via cfe-commits


On 03/16/2017 08:11 PM, Eric Christopher wrote:



On Thu, Mar 16, 2017 at 5:45 PM Hal Finkel > wrote:



On 03/16/2017 07:40 PM, Eric Christopher wrote:



On Thu, Mar 16, 2017 at 5:37 PM Hal Finkel via Phabricator
> wrote:

hfinkel added a comment.

In https://reviews.llvm.org/D30415#703398, @echristo wrote:

> Different suggestion:
>
> Remove the faltivec option. Even gcc doesn't support it
anymore afaict.


What are you suggesting? Always having the language
extensions on? Or explicitly tying the language extensions to
the underlying target feature?


I was thinking the latter.


Is that what GCC now does?


That would be my guess given the option isn't listed anymore, but what 
it does is this:


echristo@dzur ~/s/gcc-git> grep -r faltivec *
gcc/testsuite/gcc.target/powerpc/stabs-attrib-vect-darwin.c:/* { 
dg-options "-gstabs+ -fno-eliminate-unused-debug-types -faltivec" } */
gcc/testsuite/ChangeLog-1993-2007:* g++.dg/ext/altivec-8.C: Use 
'-maltivec' instead of '-faltivec';
gcc/config/rs6000/darwin.h:   the kernel or some such. The "-faltivec" 
option should have been
gcc/config/rs6000/darwin.h:  %{faltivec:-maltivec -include altivec.h} 
%{fno-altivec:-mno-altivec} \

gcc/config/rs6000/darwin.h:  %gcc/ChangeLog-2010:* config/rs6000/darwin.h (CC1_SPEC): Handle 
-faltivec and -fno-altivec.
gcc/ChangeLog-2010:* config/rs6000/darwin.opt 
(Waltivec-long-deprecated, faltivec,


and only on darwin. I don't see anything that treats the faltivec 
alias as anything language specific anywhere. It basically just says 
"pass the include and turn on maltivec".


At this point I'm pretty sure that -faltivec can just be ignored.


It is certainly fair to say that having the ability to use -fno-altivec 
was much more important when -faltivec included altivec.h (which 
injected names like vec_add into the global namespace). I'm fine with 
enabling the vector syntax extensions when targeting altivec is enabled 
(they're extensions to extensions anyway).


 -Hal



-eric

 -Hal




-eric

> (Go ahead and commit the zvector part if you'd like).
>
> -eric




https://reviews.llvm.org/D30415





-- 
Hal Finkel

Lead, Compiler Technology and Programming Languages
Leadership Computing Facility
Argonne National Laboratory



--
Hal Finkel
Lead, Compiler Technology and Programming Languages
Leadership Computing Facility
Argonne National Laboratory

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


Re: r298027 - [Serialization] Follow-up to r297972, deserialize name/loc in separate statements to make sure they deserialize in defined order.

2017-03-16 Thread Eric Christopher via cfe-commits
;)

On Thu, Mar 16, 2017 at 7:13 PM Argyrios Kyrtzidis 
wrote:

> *b* at the gcc bots, those are the worst… :-P
>
> On Mar 16, 2017, at 6:39 PM, Eric Christopher  wrote:
>
> Also gcc bots fwiw :)
>
> -eric
>
> On Thu, Mar 16, 2017 at 6:01 PM Argyrios Kyrtzidis via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
> Author: akirtzidis
> Date: Thu Mar 16 19:49:42 2017
> New Revision: 298027
>
> URL: http://llvm.org/viewvc/llvm-project?rev=298027=rev
> Log:
> [Serialization] Follow-up to r297972, deserialize name/loc in separate
> statements to make sure they deserialize in defined order.
>
> This should fix the windows bots.
>
> Modified:
> cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
>
> Modified: cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReaderDecl.cpp?rev=298027=298026=298027=diff
>
> ==
> --- cfe/trunk/lib/Serialization/ASTReaderDecl.cpp (original)
> +++ cfe/trunk/lib/Serialization/ASTReaderDecl.cpp Thu Mar 16 19:49:42 2017
> @@ -1124,10 +1124,12 @@ void ASTDeclReader::VisitObjCPropertyDec
>(ObjCPropertyDecl::PropertyAttributeKind)Record.readInt());
>D->setPropertyImplementation(
>(ObjCPropertyDecl::PropertyControl)Record.readInt());
> -  D->setGetterName(Record.readDeclarationName().getObjCSelector(),
> -   ReadSourceLocation());
> -  D->setSetterName(Record.readDeclarationName().getObjCSelector(),
> -   ReadSourceLocation());
> +  DeclarationName GetterName = Record.readDeclarationName();
> +  SourceLocation GetterLoc = ReadSourceLocation();
> +  D->setGetterName(GetterName.getObjCSelector(), GetterLoc);
> +  DeclarationName SetterName = Record.readDeclarationName();
> +  SourceLocation SetterLoc = ReadSourceLocation();
> +  D->setSetterName(SetterName.getObjCSelector(), SetterLoc);
>D->setGetterMethodDecl(ReadDeclAs());
>D->setSetterMethodDecl(ReadDeclAs());
>D->setPropertyIvarDecl(ReadDeclAs());
>
>
> ___
> 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: r298027 - [Serialization] Follow-up to r297972, deserialize name/loc in separate statements to make sure they deserialize in defined order.

2017-03-16 Thread Argyrios Kyrtzidis via cfe-commits
*b* at the gcc bots, those are the worst… :-P

> On Mar 16, 2017, at 6:39 PM, Eric Christopher  wrote:
> 
> Also gcc bots fwiw :)
> 
> -eric
> 
> On Thu, Mar 16, 2017 at 6:01 PM Argyrios Kyrtzidis via cfe-commits 
> > wrote:
> Author: akirtzidis
> Date: Thu Mar 16 19:49:42 2017
> New Revision: 298027
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=298027=rev 
> 
> Log:
> [Serialization] Follow-up to r297972, deserialize name/loc in separate 
> statements to make sure they deserialize in defined order.
> 
> This should fix the windows bots.
> 
> Modified:
> cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
> 
> Modified: cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReaderDecl.cpp?rev=298027=298026=298027=diff
>  
> 
> ==
> --- cfe/trunk/lib/Serialization/ASTReaderDecl.cpp (original)
> +++ cfe/trunk/lib/Serialization/ASTReaderDecl.cpp Thu Mar 16 19:49:42 2017
> @@ -1124,10 +1124,12 @@ void ASTDeclReader::VisitObjCPropertyDec
>(ObjCPropertyDecl::PropertyAttributeKind)Record.readInt());
>D->setPropertyImplementation(
>(ObjCPropertyDecl::PropertyControl)Record.readInt());
> -  D->setGetterName(Record.readDeclarationName().getObjCSelector(),
> -   ReadSourceLocation());
> -  D->setSetterName(Record.readDeclarationName().getObjCSelector(),
> -   ReadSourceLocation());
> +  DeclarationName GetterName = Record.readDeclarationName();
> +  SourceLocation GetterLoc = ReadSourceLocation();
> +  D->setGetterName(GetterName.getObjCSelector(), GetterLoc);
> +  DeclarationName SetterName = Record.readDeclarationName();
> +  SourceLocation SetterLoc = ReadSourceLocation();
> +  D->setSetterName(SetterName.getObjCSelector(), SetterLoc);
>D->setGetterMethodDecl(ReadDeclAs());
>D->setSetterMethodDecl(ReadDeclAs());
>D->setPropertyIvarDecl(ReadDeclAs());
> 
> 
> ___
> 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


[PATCH] D30806: [nonnull] Teach Clang to attach the nonnull LLVM attribute to declarations and calls instead of just definitions, and then teach it to *not* attach such attributes even if the source c

2017-03-16 Thread Chandler Carruth via Phabricator via cfe-commits
chandlerc added inline comments.



Comment at: include/clang/AST/ASTContext.h:1868
+  bool *OverrideNonnullReturn = nullptr,
+  unsigned *OverrideNonnullArgs = nullptr,
   unsigned *IntegerConstantArgs = nullptr) const;

hfinkel wrote:
> It seems like you had to touch more code than necessary because you decided 
> to add these parameters before IntegerConstantArgs. Why don't you add them 
> afterward instead?
It seemed more natural But I'm happy to change the order. I'm not worreid 
about how much code I have to touch, I'd rather just get the options in the 
right place. What order would you suggest?


https://reviews.llvm.org/D30806



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


Re: r298027 - [Serialization] Follow-up to r297972, deserialize name/loc in separate statements to make sure they deserialize in defined order.

2017-03-16 Thread Eric Christopher via cfe-commits
Also gcc bots fwiw :)

-eric

On Thu, Mar 16, 2017 at 6:01 PM Argyrios Kyrtzidis via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: akirtzidis
> Date: Thu Mar 16 19:49:42 2017
> New Revision: 298027
>
> URL: http://llvm.org/viewvc/llvm-project?rev=298027=rev
> Log:
> [Serialization] Follow-up to r297972, deserialize name/loc in separate
> statements to make sure they deserialize in defined order.
>
> This should fix the windows bots.
>
> Modified:
> cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
>
> Modified: cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReaderDecl.cpp?rev=298027=298026=298027=diff
>
> ==
> --- cfe/trunk/lib/Serialization/ASTReaderDecl.cpp (original)
> +++ cfe/trunk/lib/Serialization/ASTReaderDecl.cpp Thu Mar 16 19:49:42 2017
> @@ -1124,10 +1124,12 @@ void ASTDeclReader::VisitObjCPropertyDec
>(ObjCPropertyDecl::PropertyAttributeKind)Record.readInt());
>D->setPropertyImplementation(
>(ObjCPropertyDecl::PropertyControl)Record.readInt());
> -  D->setGetterName(Record.readDeclarationName().getObjCSelector(),
> -   ReadSourceLocation());
> -  D->setSetterName(Record.readDeclarationName().getObjCSelector(),
> -   ReadSourceLocation());
> +  DeclarationName GetterName = Record.readDeclarationName();
> +  SourceLocation GetterLoc = ReadSourceLocation();
> +  D->setGetterName(GetterName.getObjCSelector(), GetterLoc);
> +  DeclarationName SetterName = Record.readDeclarationName();
> +  SourceLocation SetterLoc = ReadSourceLocation();
> +  D->setSetterName(SetterName.getObjCSelector(), SetterLoc);
>D->setGetterMethodDecl(ReadDeclAs());
>D->setSetterMethodDecl(ReadDeclAs());
>D->setPropertyIvarDecl(ReadDeclAs());
>
>
> ___
> 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: r297972 - [index/AST] Add references for ObjC getter=/setter= property attributes and related property getter/setter role fixes

2017-03-16 Thread Yung, Douglas via cfe-commits
Your change does seem to have done the trick. Thanks!

Douglas Yung

> -Original Message-
> From: Argyrios Kyrtzidis [mailto:akyr...@gmail.com]
> Sent: Thursday, March 16, 2017 18:03
> To: Yung, Douglas
> Cc: cfe-commits
> Subject: Re: r297972 - [index/AST] Add references for ObjC getter=/setter=
> property attributes and related property getter/setter role fixes
> 
> I have high hopes r298027 will fix this.
> 
> > On Mar 16, 2017, at 5:42 PM, Argyrios Kyrtzidis  wrote:
> >
> > I think I know what the issue is, preparing a fix.
> >
> >
> >> On Mar 16, 2017, at 4:38 PM, Yung, Douglas  wrote:
> >>
> >> [I can't find Nathan's email, so sending to the submitter, Argyrios]
> >>
> >> Hi Argyrios/Nathan,
> >>
> >> This change appears to be causing 9 tests on Windows to fail. It seems the
> compiler crashes when trying to run the tests. Can you please take a look?
> >>
> >> The affected tests are the following:
> >>
> >> Clang :: ASTMerge/property/test.m
> >> Clang :: Index/annotate-comments-objc.m Clang ::
> >> Index/c-index-api-loadTU-test.m Clang :: Index/index-pch-objc.m Clang
> >> :: Modules/objc-categories.m Clang :: PCH/chain-categories.m Clang ::
> >> PCH/chain-categories2.m Clang :: PCH/chain-class-extension.m Clang ::
> >> PCH/objc_property.m
> >>
> >> Recent failure of the PS4 Windows bot:
> >> http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-wind
> >> ows10pro-fast/builds/6902/steps/test/logs/stdio
> >>
> >>> -Original Message-
> >>> From: cfe-commits [mailto:cfe-commits-boun...@lists.llvm.org] On
> >>> Behalf Of Argyrios Kyrtzidis via cfe-commits
> >>> Sent: Thursday, March 16, 2017 11:26
> >>> To: cfe-commits@lists.llvm.org
> >>> Subject: r297972 - [index/AST] Add references for ObjC
> >>> getter=/setter= property attributes and related property
> >>> getter/setter role fixes
> >>>
> >>> Author: akirtzidis
> >>> Date: Thu Mar 16 13:25:40 2017
> >>> New Revision: 297972
> >>>
> >>> URL: http://llvm.org/viewvc/llvm-project?rev=297972=rev
> >>> Log:
> >>> [index/AST] Add references for ObjC getter=/setter= property
> >>> attributes and related property getter/setter role fixes
> >>>
> >>> This enhances the AST to keep track of locations of the names in
> >>> those ObjC property attributes, and reports them for indexing.
> >>>
> >>> Patch by Nathan Hawes!
> >>> https://reviews.llvm.org/D30907
> >>>
> >>> Modified:
> >>>   cfe/trunk/include/clang/AST/DeclObjC.h
> >>>   cfe/trunk/include/clang/Sema/DeclSpec.h
> >>>   cfe/trunk/include/clang/Sema/Sema.h
> >>>   cfe/trunk/lib/AST/ASTImporter.cpp
> >>>   cfe/trunk/lib/Index/IndexBody.cpp
> >>>   cfe/trunk/lib/Index/IndexDecl.cpp
> >>>   cfe/trunk/lib/Parse/ParseObjc.cpp
> >>>   cfe/trunk/lib/Sema/SemaObjCProperty.cpp
> >>>   cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
> >>>   cfe/trunk/lib/Serialization/ASTWriterDecl.cpp
> >>>   cfe/trunk/test/Index/Core/index-source.m
> >>>
> >>> Modified: cfe/trunk/include/clang/AST/DeclObjC.h
> >>> URL: http://llvm.org/viewvc/llvm-
> >>> project/cfe/trunk/include/clang/AST/DeclObjC.h?rev=297972=297971&
> >>> r2=297972&
> >>> view=diff
> >>> 
> >>> ==
> >>> --- cfe/trunk/include/clang/AST/DeclObjC.h (original)
> >>> +++ cfe/trunk/include/clang/AST/DeclObjC.h Thu Mar 16 13:25:40 2017
> >>> @@ -743,6 +743,8 @@ private:
> >>>
> >>>  Selector GetterName;// getter name of NULL if no getter
> >>>  Selector SetterName;// setter name of NULL if no setter
> >>> +  SourceLocation GetterNameLoc; // location of the getter
> >>> + attribute's value  SourceLocation SetterNameLoc; // location of
> >>> + the setter attribute's value
> >>>
> >>>  ObjCMethodDecl *GetterMethodDecl; // Declaration of getter instance
> >>> method  ObjCMethodDecl *SetterMethodDecl; // Declaration of setter
> >>> instance method @@ -855,10 +857,18 @@ public:
> >>>  }
> >>>
> >>>  Selector getGetterName() const { return GetterName; }
> >>> -  void setGetterName(Selector Sel) { GetterName = Sel; }
> >>> +  SourceLocation getGetterNameLoc() const { return GetterNameLoc; }
> >>> + void setGetterName(Selector Sel, SourceLocation Loc) {
> >>> +GetterName = Sel;
> >>> +GetterNameLoc = Loc;
> >>> +  }
> >>>
> >>>  Selector getSetterName() const { return SetterName; }
> >>> -  void setSetterName(Selector Sel) { SetterName = Sel; }
> >>> +  SourceLocation getSetterNameLoc() const { return SetterNameLoc; }
> >>> + void setSetterName(Selector Sel, SourceLocation Loc) {
> >>> +SetterName = Sel;
> >>> +SetterNameLoc = Loc;
> >>> +  }
> >>>
> >>>  ObjCMethodDecl *getGetterMethodDecl() const { return
> >>> GetterMethodDecl; }  void setGetterMethodDecl(ObjCMethodDecl *gDecl)
> >>> { GetterMethodDecl = gDecl; }
> >>>
> >>> Modified: cfe/trunk/include/clang/Sema/DeclSpec.h
> >>> URL: http://llvm.org/viewvc/llvm-
> >>> project/cfe/trunk/include/clang/Sema/DeclSpec.h?rev=297972=297971
> >>> =297972
> >>> =diff

Re: [PATCH] D30415: Fix -mno-altivec cannot overwrite -maltivec option

2017-03-16 Thread Eric Christopher via cfe-commits
On Thu, Mar 16, 2017 at 5:45 PM Hal Finkel  wrote:

>
> On 03/16/2017 07:40 PM, Eric Christopher wrote:
>
>
>
> On Thu, Mar 16, 2017 at 5:37 PM Hal Finkel via Phabricator <
> revi...@reviews.llvm.org> wrote:
>
> hfinkel added a comment.
>
> In https://reviews.llvm.org/D30415#703398, @echristo wrote:
>
> > Different suggestion:
> >
> > Remove the faltivec option. Even gcc doesn't support it anymore afaict.
>
>
> What are you suggesting? Always having the language extensions on? Or
> explicitly tying the language extensions to the underlying target feature?
>
>
> I was thinking the latter.
>
>
> Is that what GCC now does?
>
>
That would be my guess given the option isn't listed anymore, but what it
does is this:

echristo@dzur ~/s/gcc-git> grep -r faltivec *
gcc/testsuite/gcc.target/powerpc/stabs-attrib-vect-darwin.c:/* { dg-options
"-gstabs+ -fno-eliminate-unused-debug-types -faltivec" } */
gcc/testsuite/ChangeLog-1993-2007: * g++.dg/ext/altivec-8.C: Use
'-maltivec' instead of '-faltivec';
gcc/config/rs6000/darwin.h:   the kernel or some such.  The "-faltivec"
option should have been
gcc/config/rs6000/darwin.h:  %{faltivec:-maltivec -include altivec.h}
%{fno-altivec:-mno-altivec} \
gcc/config/rs6000/darwin.h:  %  -Hal
>
>
>
> -eric
>
>
> > (Go ahead and commit the zvector part if you'd like).
> >
> > -eric
>
>
>
>
> https://reviews.llvm.org/D30415
>
>
>
>
> --
> Hal Finkel
> Lead, Compiler Technology and Programming Languages
> Leadership Computing Facility
> Argonne National Laboratory
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r297972 - [index/AST] Add references for ObjC getter=/setter= property attributes and related property getter/setter role fixes

2017-03-16 Thread Argyrios Kyrtzidis via cfe-commits
I have high hopes r298027 will fix this.

> On Mar 16, 2017, at 5:42 PM, Argyrios Kyrtzidis  wrote:
> 
> I think I know what the issue is, preparing a fix.
> 
> 
>> On Mar 16, 2017, at 4:38 PM, Yung, Douglas  wrote:
>> 
>> [I can't find Nathan's email, so sending to the submitter, Argyrios]
>> 
>> Hi Argyrios/Nathan,
>> 
>> This change appears to be causing 9 tests on Windows to fail. It seems the 
>> compiler crashes when trying to run the tests. Can you please take a look?
>> 
>> The affected tests are the following:
>> 
>> Clang :: ASTMerge/property/test.m
>> Clang :: Index/annotate-comments-objc.m
>> Clang :: Index/c-index-api-loadTU-test.m
>> Clang :: Index/index-pch-objc.m
>> Clang :: Modules/objc-categories.m
>> Clang :: PCH/chain-categories.m
>> Clang :: PCH/chain-categories2.m
>> Clang :: PCH/chain-class-extension.m
>> Clang :: PCH/objc_property.m
>> 
>> Recent failure of the PS4 Windows bot: 
>> http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/6902/steps/test/logs/stdio
>> 
>>> -Original Message-
>>> From: cfe-commits [mailto:cfe-commits-boun...@lists.llvm.org] On Behalf Of
>>> Argyrios Kyrtzidis via cfe-commits
>>> Sent: Thursday, March 16, 2017 11:26
>>> To: cfe-commits@lists.llvm.org
>>> Subject: r297972 - [index/AST] Add references for ObjC getter=/setter=
>>> property attributes and related property getter/setter role fixes
>>> 
>>> Author: akirtzidis
>>> Date: Thu Mar 16 13:25:40 2017
>>> New Revision: 297972
>>> 
>>> URL: http://llvm.org/viewvc/llvm-project?rev=297972=rev
>>> Log:
>>> [index/AST] Add references for ObjC getter=/setter= property attributes and
>>> related property getter/setter role fixes
>>> 
>>> This enhances the AST to keep track of locations of the names in those ObjC
>>> property attributes, and reports them for indexing.
>>> 
>>> Patch by Nathan Hawes!
>>> https://reviews.llvm.org/D30907
>>> 
>>> Modified:
>>>   cfe/trunk/include/clang/AST/DeclObjC.h
>>>   cfe/trunk/include/clang/Sema/DeclSpec.h
>>>   cfe/trunk/include/clang/Sema/Sema.h
>>>   cfe/trunk/lib/AST/ASTImporter.cpp
>>>   cfe/trunk/lib/Index/IndexBody.cpp
>>>   cfe/trunk/lib/Index/IndexDecl.cpp
>>>   cfe/trunk/lib/Parse/ParseObjc.cpp
>>>   cfe/trunk/lib/Sema/SemaObjCProperty.cpp
>>>   cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
>>>   cfe/trunk/lib/Serialization/ASTWriterDecl.cpp
>>>   cfe/trunk/test/Index/Core/index-source.m
>>> 
>>> Modified: cfe/trunk/include/clang/AST/DeclObjC.h
>>> URL: http://llvm.org/viewvc/llvm-
>>> project/cfe/trunk/include/clang/AST/DeclObjC.h?rev=297972=297971=297972&
>>> view=diff
>>> ==
>>> --- cfe/trunk/include/clang/AST/DeclObjC.h (original)
>>> +++ cfe/trunk/include/clang/AST/DeclObjC.h Thu Mar 16 13:25:40 2017
>>> @@ -743,6 +743,8 @@ private:
>>> 
>>>  Selector GetterName;// getter name of NULL if no getter
>>>  Selector SetterName;// setter name of NULL if no setter
>>> +  SourceLocation GetterNameLoc; // location of the getter attribute's
>>> + value  SourceLocation SetterNameLoc; // location of the setter
>>> + attribute's value
>>> 
>>>  ObjCMethodDecl *GetterMethodDecl; // Declaration of getter instance method
>>>  ObjCMethodDecl *SetterMethodDecl; // Declaration of setter instance method
>>> @@ -855,10 +857,18 @@ public:
>>>  }
>>> 
>>>  Selector getGetterName() const { return GetterName; }
>>> -  void setGetterName(Selector Sel) { GetterName = Sel; }
>>> +  SourceLocation getGetterNameLoc() const { return GetterNameLoc; }
>>> + void setGetterName(Selector Sel, SourceLocation Loc) {
>>> +GetterName = Sel;
>>> +GetterNameLoc = Loc;
>>> +  }
>>> 
>>>  Selector getSetterName() const { return SetterName; }
>>> -  void setSetterName(Selector Sel) { SetterName = Sel; }
>>> +  SourceLocation getSetterNameLoc() const { return SetterNameLoc; }
>>> + void setSetterName(Selector Sel, SourceLocation Loc) {
>>> +SetterName = Sel;
>>> +SetterNameLoc = Loc;
>>> +  }
>>> 
>>>  ObjCMethodDecl *getGetterMethodDecl() const { return GetterMethodDecl; }
>>>  void setGetterMethodDecl(ObjCMethodDecl *gDecl) { GetterMethodDecl = gDecl;
>>> }
>>> 
>>> Modified: cfe/trunk/include/clang/Sema/DeclSpec.h
>>> URL: http://llvm.org/viewvc/llvm-
>>> project/cfe/trunk/include/clang/Sema/DeclSpec.h?rev=297972=297971=297972
>>> =diff
>>> ==
>>> --- cfe/trunk/include/clang/Sema/DeclSpec.h (original)
>>> +++ cfe/trunk/include/clang/Sema/DeclSpec.h Thu Mar 16 13:25:40 2017
>>> @@ -861,11 +861,19 @@ public:
>>> 
>>>  const IdentifierInfo *getGetterName() const { return GetterName; }
>>>  IdentifierInfo *getGetterName() { return GetterName; }
>>> -  void setGetterName(IdentifierInfo *name) { GetterName = name; }
>>> +  SourceLocation getGetterNameLoc() const { return GetterNameLoc; }
>>> + void setGetterName(IdentifierInfo *name, SourceLocation 

[PATCH] D30806: [nonnull] Teach Clang to attach the nonnull LLVM attribute to declarations and calls instead of just definitions, and then teach it to *not* attach such attributes even if the source c

2017-03-16 Thread Hal Finkel via Phabricator via cfe-commits
hfinkel added inline comments.



Comment at: include/clang/AST/ASTContext.h:1865
   /// arguments to the builtin that are required to be integer constant
   /// expressions.
   QualType GetBuiltinType(unsigned ID, GetBuiltinTypeError ,

Please add some description of the new parameters.



Comment at: include/clang/AST/ASTContext.h:1868
+  bool *OverrideNonnullReturn = nullptr,
+  unsigned *OverrideNonnullArgs = nullptr,
   unsigned *IntegerConstantArgs = nullptr) const;

It seems like you had to touch more code than necessary because you decided to 
add these parameters before IntegerConstantArgs. Why don't you add them 
afterward instead?


https://reviews.llvm.org/D30806



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


r298027 - [Serialization] Follow-up to r297972, deserialize name/loc in separate statements to make sure they deserialize in defined order.

2017-03-16 Thread Argyrios Kyrtzidis via cfe-commits
Author: akirtzidis
Date: Thu Mar 16 19:49:42 2017
New Revision: 298027

URL: http://llvm.org/viewvc/llvm-project?rev=298027=rev
Log:
[Serialization] Follow-up to r297972, deserialize name/loc in separate 
statements to make sure they deserialize in defined order.

This should fix the windows bots.

Modified:
cfe/trunk/lib/Serialization/ASTReaderDecl.cpp

Modified: cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReaderDecl.cpp?rev=298027=298026=298027=diff
==
--- cfe/trunk/lib/Serialization/ASTReaderDecl.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReaderDecl.cpp Thu Mar 16 19:49:42 2017
@@ -1124,10 +1124,12 @@ void ASTDeclReader::VisitObjCPropertyDec
   (ObjCPropertyDecl::PropertyAttributeKind)Record.readInt());
   D->setPropertyImplementation(
   (ObjCPropertyDecl::PropertyControl)Record.readInt());
-  D->setGetterName(Record.readDeclarationName().getObjCSelector(),
-   ReadSourceLocation());
-  D->setSetterName(Record.readDeclarationName().getObjCSelector(),
-   ReadSourceLocation());
+  DeclarationName GetterName = Record.readDeclarationName();
+  SourceLocation GetterLoc = ReadSourceLocation();
+  D->setGetterName(GetterName.getObjCSelector(), GetterLoc);
+  DeclarationName SetterName = Record.readDeclarationName();
+  SourceLocation SetterLoc = ReadSourceLocation();
+  D->setSetterName(SetterName.getObjCSelector(), SetterLoc);
   D->setGetterMethodDecl(ReadDeclAs());
   D->setSetterMethodDecl(ReadDeclAs());
   D->setPropertyIvarDecl(ReadDeclAs());


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


[PATCH] D30806: [nonnull] Teach Clang to attach the nonnull LLVM attribute to declarations and calls instead of just definitions, and then teach it to *not* attach such attributes even if the source c

2017-03-16 Thread Chandler Carruth via Phabricator via cfe-commits
chandlerc added a comment.

Ping?


https://reviews.llvm.org/D30806



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


r298022 - Remove setting LessPreciseFPMADOption on the TargetOption as it's

2017-03-16 Thread Eric Christopher via cfe-commits
Author: echristo
Date: Thu Mar 16 19:37:53 2017
New Revision: 298022

URL: http://llvm.org/viewvc/llvm-project?rev=298022=rev
Log:
Remove setting LessPreciseFPMADOption on the TargetOption as it's
unused anywhere in llvm.

Modified:
cfe/trunk/lib/CodeGen/BackendUtil.cpp

Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=298022=298021=298022=diff
==
--- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original)
+++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Thu Mar 16 19:37:53 2017
@@ -583,7 +583,6 @@ void EmitAssemblyHelper::CreateTargetMac
   if (LangOpts.SjLjExceptions)
 Options.ExceptionModel = llvm::ExceptionHandling::SjLj;
 
-  Options.LessPreciseFPMADOption = CodeGenOpts.LessPreciseFPMAD;
   Options.NoInfsFPMath = CodeGenOpts.NoInfsFPMath;
   Options.NoNaNsFPMath = CodeGenOpts.NoNaNsFPMath;
   Options.NoZerosInBSS = CodeGenOpts.NoZeroInitializedInBSS;


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


Re: [PATCH] D30415: Fix -mno-altivec cannot overwrite -maltivec option

2017-03-16 Thread Hal Finkel via cfe-commits


On 03/16/2017 07:40 PM, Eric Christopher wrote:



On Thu, Mar 16, 2017 at 5:37 PM Hal Finkel via Phabricator 
> wrote:


hfinkel added a comment.

In https://reviews.llvm.org/D30415#703398, @echristo wrote:

> Different suggestion:
>
> Remove the faltivec option. Even gcc doesn't support it anymore
afaict.


What are you suggesting? Always having the language extensions on?
Or explicitly tying the language extensions to the underlying
target feature?


I was thinking the latter.


Is that what GCC now does?

 -Hal



-eric

> (Go ahead and commit the zvector part if you'd like).
>
> -eric




https://reviews.llvm.org/D30415





--
Hal Finkel
Lead, Compiler Technology and Programming Languages
Leadership Computing Facility
Argonne National Laboratory

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


Re: r297972 - [index/AST] Add references for ObjC getter=/setter= property attributes and related property getter/setter role fixes

2017-03-16 Thread Argyrios Kyrtzidis via cfe-commits
I think I know what the issue is, preparing a fix.


> On Mar 16, 2017, at 4:38 PM, Yung, Douglas  wrote:
> 
> [I can't find Nathan's email, so sending to the submitter, Argyrios]
> 
> Hi Argyrios/Nathan,
> 
> This change appears to be causing 9 tests on Windows to fail. It seems the 
> compiler crashes when trying to run the tests. Can you please take a look?
> 
> The affected tests are the following:
> 
> Clang :: ASTMerge/property/test.m
> Clang :: Index/annotate-comments-objc.m
> Clang :: Index/c-index-api-loadTU-test.m
> Clang :: Index/index-pch-objc.m
> Clang :: Modules/objc-categories.m
> Clang :: PCH/chain-categories.m
> Clang :: PCH/chain-categories2.m
> Clang :: PCH/chain-class-extension.m
> Clang :: PCH/objc_property.m
> 
> Recent failure of the PS4 Windows bot: 
> http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/6902/steps/test/logs/stdio
> 
>> -Original Message-
>> From: cfe-commits [mailto:cfe-commits-boun...@lists.llvm.org] On Behalf Of
>> Argyrios Kyrtzidis via cfe-commits
>> Sent: Thursday, March 16, 2017 11:26
>> To: cfe-commits@lists.llvm.org
>> Subject: r297972 - [index/AST] Add references for ObjC getter=/setter=
>> property attributes and related property getter/setter role fixes
>> 
>> Author: akirtzidis
>> Date: Thu Mar 16 13:25:40 2017
>> New Revision: 297972
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=297972=rev
>> Log:
>> [index/AST] Add references for ObjC getter=/setter= property attributes and
>> related property getter/setter role fixes
>> 
>> This enhances the AST to keep track of locations of the names in those ObjC
>> property attributes, and reports them for indexing.
>> 
>> Patch by Nathan Hawes!
>> https://reviews.llvm.org/D30907
>> 
>> Modified:
>>cfe/trunk/include/clang/AST/DeclObjC.h
>>cfe/trunk/include/clang/Sema/DeclSpec.h
>>cfe/trunk/include/clang/Sema/Sema.h
>>cfe/trunk/lib/AST/ASTImporter.cpp
>>cfe/trunk/lib/Index/IndexBody.cpp
>>cfe/trunk/lib/Index/IndexDecl.cpp
>>cfe/trunk/lib/Parse/ParseObjc.cpp
>>cfe/trunk/lib/Sema/SemaObjCProperty.cpp
>>cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
>>cfe/trunk/lib/Serialization/ASTWriterDecl.cpp
>>cfe/trunk/test/Index/Core/index-source.m
>> 
>> Modified: cfe/trunk/include/clang/AST/DeclObjC.h
>> URL: http://llvm.org/viewvc/llvm-
>> project/cfe/trunk/include/clang/AST/DeclObjC.h?rev=297972=297971=297972&
>> view=diff
>> ==
>> --- cfe/trunk/include/clang/AST/DeclObjC.h (original)
>> +++ cfe/trunk/include/clang/AST/DeclObjC.h Thu Mar 16 13:25:40 2017
>> @@ -743,6 +743,8 @@ private:
>> 
>>   Selector GetterName;// getter name of NULL if no getter
>>   Selector SetterName;// setter name of NULL if no setter
>> +  SourceLocation GetterNameLoc; // location of the getter attribute's
>> + value  SourceLocation SetterNameLoc; // location of the setter
>> + attribute's value
>> 
>>   ObjCMethodDecl *GetterMethodDecl; // Declaration of getter instance method
>>   ObjCMethodDecl *SetterMethodDecl; // Declaration of setter instance method
>> @@ -855,10 +857,18 @@ public:
>>   }
>> 
>>   Selector getGetterName() const { return GetterName; }
>> -  void setGetterName(Selector Sel) { GetterName = Sel; }
>> +  SourceLocation getGetterNameLoc() const { return GetterNameLoc; }
>> + void setGetterName(Selector Sel, SourceLocation Loc) {
>> +GetterName = Sel;
>> +GetterNameLoc = Loc;
>> +  }
>> 
>>   Selector getSetterName() const { return SetterName; }
>> -  void setSetterName(Selector Sel) { SetterName = Sel; }
>> +  SourceLocation getSetterNameLoc() const { return SetterNameLoc; }
>> + void setSetterName(Selector Sel, SourceLocation Loc) {
>> +SetterName = Sel;
>> +SetterNameLoc = Loc;
>> +  }
>> 
>>   ObjCMethodDecl *getGetterMethodDecl() const { return GetterMethodDecl; }
>>   void setGetterMethodDecl(ObjCMethodDecl *gDecl) { GetterMethodDecl = gDecl;
>> }
>> 
>> Modified: cfe/trunk/include/clang/Sema/DeclSpec.h
>> URL: http://llvm.org/viewvc/llvm-
>> project/cfe/trunk/include/clang/Sema/DeclSpec.h?rev=297972=297971=297972
>> =diff
>> ==
>> --- cfe/trunk/include/clang/Sema/DeclSpec.h (original)
>> +++ cfe/trunk/include/clang/Sema/DeclSpec.h Thu Mar 16 13:25:40 2017
>> @@ -861,11 +861,19 @@ public:
>> 
>>   const IdentifierInfo *getGetterName() const { return GetterName; }
>>   IdentifierInfo *getGetterName() { return GetterName; }
>> -  void setGetterName(IdentifierInfo *name) { GetterName = name; }
>> +  SourceLocation getGetterNameLoc() const { return GetterNameLoc; }
>> + void setGetterName(IdentifierInfo *name, SourceLocation loc) {
>> +GetterName = name;
>> +GetterNameLoc = loc;
>> +  }
>> 
>>   const IdentifierInfo *getSetterName() const { return SetterName; }
>>   IdentifierInfo *getSetterName() { return SetterName; }
>> -  void 

Re: [PATCH] D30415: Fix -mno-altivec cannot overwrite -maltivec option

2017-03-16 Thread Eric Christopher via cfe-commits
On Thu, Mar 16, 2017 at 5:37 PM Hal Finkel via Phabricator <
revi...@reviews.llvm.org> wrote:

> hfinkel added a comment.
>
> In https://reviews.llvm.org/D30415#703398, @echristo wrote:
>
> > Different suggestion:
> >
> > Remove the faltivec option. Even gcc doesn't support it anymore afaict.
>
>
> What are you suggesting? Always having the language extensions on? Or
> explicitly tying the language extensions to the underlying target feature?
>
>
I was thinking the latter.

-eric


> > (Go ahead and commit the zvector part if you'd like).
> >
> > -eric
>
>
>
>
> https://reviews.llvm.org/D30415
>
>
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D30415: Fix -mno-altivec cannot overwrite -maltivec option

2017-03-16 Thread Hal Finkel via Phabricator via cfe-commits
hfinkel added a comment.

In https://reviews.llvm.org/D30415#703398, @echristo wrote:

> Different suggestion:
>
> Remove the faltivec option. Even gcc doesn't support it anymore afaict.


What are you suggesting? Always having the language extensions on? Or 
explicitly tying the language extensions to the underlying target feature?

> (Go ahead and commit the zvector part if you'd like).
> 
> -eric




https://reviews.llvm.org/D30415



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


[PATCH] D31029: [analyzer] Fix logical not for pointers with different bit width

2017-03-16 Thread Anna Zaks via Phabricator via cfe-commits
zaks.anna added a comment.

Are there other cases where makeNull would need to be replaced?


Repository:
  rL LLVM

https://reviews.llvm.org/D31029



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


[PATCH] D30415: Fix -mno-altivec cannot overwrite -maltivec option

2017-03-16 Thread Eric Christopher via Phabricator via cfe-commits
echristo requested changes to this revision.
echristo added a comment.
This revision now requires changes to proceed.

Different suggestion:

Remove the faltivec option. Even gcc doesn't support it anymore afaict.

(Go ahead and commit the zvector part if you'd like).

-eric


https://reviews.llvm.org/D30415



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


RE: r297972 - [index/AST] Add references for ObjC getter=/setter= property attributes and related property getter/setter role fixes

2017-03-16 Thread Yung, Douglas via cfe-commits
[I can't find Nathan's email, so sending to the submitter, Argyrios]

Hi Argyrios/Nathan,

This change appears to be causing 9 tests on Windows to fail. It seems the 
compiler crashes when trying to run the tests. Can you please take a look?

The affected tests are the following:

Clang :: ASTMerge/property/test.m
Clang :: Index/annotate-comments-objc.m
Clang :: Index/c-index-api-loadTU-test.m
Clang :: Index/index-pch-objc.m
Clang :: Modules/objc-categories.m
Clang :: PCH/chain-categories.m
Clang :: PCH/chain-categories2.m
Clang :: PCH/chain-class-extension.m
Clang :: PCH/objc_property.m

Recent failure of the PS4 Windows bot: 
http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/6902/steps/test/logs/stdio

> -Original Message-
> From: cfe-commits [mailto:cfe-commits-boun...@lists.llvm.org] On Behalf Of
> Argyrios Kyrtzidis via cfe-commits
> Sent: Thursday, March 16, 2017 11:26
> To: cfe-commits@lists.llvm.org
> Subject: r297972 - [index/AST] Add references for ObjC getter=/setter=
> property attributes and related property getter/setter role fixes
> 
> Author: akirtzidis
> Date: Thu Mar 16 13:25:40 2017
> New Revision: 297972
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=297972=rev
> Log:
> [index/AST] Add references for ObjC getter=/setter= property attributes and
> related property getter/setter role fixes
> 
> This enhances the AST to keep track of locations of the names in those ObjC
> property attributes, and reports them for indexing.
> 
> Patch by Nathan Hawes!
> https://reviews.llvm.org/D30907
> 
> Modified:
> cfe/trunk/include/clang/AST/DeclObjC.h
> cfe/trunk/include/clang/Sema/DeclSpec.h
> cfe/trunk/include/clang/Sema/Sema.h
> cfe/trunk/lib/AST/ASTImporter.cpp
> cfe/trunk/lib/Index/IndexBody.cpp
> cfe/trunk/lib/Index/IndexDecl.cpp
> cfe/trunk/lib/Parse/ParseObjc.cpp
> cfe/trunk/lib/Sema/SemaObjCProperty.cpp
> cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
> cfe/trunk/lib/Serialization/ASTWriterDecl.cpp
> cfe/trunk/test/Index/Core/index-source.m
> 
> Modified: cfe/trunk/include/clang/AST/DeclObjC.h
> URL: http://llvm.org/viewvc/llvm-
> project/cfe/trunk/include/clang/AST/DeclObjC.h?rev=297972=297971=297972&
> view=diff
> ==
> --- cfe/trunk/include/clang/AST/DeclObjC.h (original)
> +++ cfe/trunk/include/clang/AST/DeclObjC.h Thu Mar 16 13:25:40 2017
> @@ -743,6 +743,8 @@ private:
> 
>Selector GetterName;// getter name of NULL if no getter
>Selector SetterName;// setter name of NULL if no setter
> +  SourceLocation GetterNameLoc; // location of the getter attribute's
> + value  SourceLocation SetterNameLoc; // location of the setter
> + attribute's value
> 
>ObjCMethodDecl *GetterMethodDecl; // Declaration of getter instance method
>ObjCMethodDecl *SetterMethodDecl; // Declaration of setter instance method
> @@ -855,10 +857,18 @@ public:
>}
> 
>Selector getGetterName() const { return GetterName; }
> -  void setGetterName(Selector Sel) { GetterName = Sel; }
> +  SourceLocation getGetterNameLoc() const { return GetterNameLoc; }
> + void setGetterName(Selector Sel, SourceLocation Loc) {
> +GetterName = Sel;
> +GetterNameLoc = Loc;
> +  }
> 
>Selector getSetterName() const { return SetterName; }
> -  void setSetterName(Selector Sel) { SetterName = Sel; }
> +  SourceLocation getSetterNameLoc() const { return SetterNameLoc; }
> + void setSetterName(Selector Sel, SourceLocation Loc) {
> +SetterName = Sel;
> +SetterNameLoc = Loc;
> +  }
> 
>ObjCMethodDecl *getGetterMethodDecl() const { return GetterMethodDecl; }
>void setGetterMethodDecl(ObjCMethodDecl *gDecl) { GetterMethodDecl = gDecl;
> }
> 
> Modified: cfe/trunk/include/clang/Sema/DeclSpec.h
> URL: http://llvm.org/viewvc/llvm-
> project/cfe/trunk/include/clang/Sema/DeclSpec.h?rev=297972=297971=297972
> =diff
> ==
> --- cfe/trunk/include/clang/Sema/DeclSpec.h (original)
> +++ cfe/trunk/include/clang/Sema/DeclSpec.h Thu Mar 16 13:25:40 2017
> @@ -861,11 +861,19 @@ public:
> 
>const IdentifierInfo *getGetterName() const { return GetterName; }
>IdentifierInfo *getGetterName() { return GetterName; }
> -  void setGetterName(IdentifierInfo *name) { GetterName = name; }
> +  SourceLocation getGetterNameLoc() const { return GetterNameLoc; }
> + void setGetterName(IdentifierInfo *name, SourceLocation loc) {
> +GetterName = name;
> +GetterNameLoc = loc;
> +  }
> 
>const IdentifierInfo *getSetterName() const { return SetterName; }
>IdentifierInfo *getSetterName() { return SetterName; }
> -  void setSetterName(IdentifierInfo *name) { SetterName = name; }
> +  SourceLocation getSetterNameLoc() const { return SetterNameLoc; }
> + void setSetterName(IdentifierInfo *name, SourceLocation loc) {
> +SetterName = name;
> +SetterNameLoc = loc;

r298012 - [Modules] Add documentation on private frameworks

2017-03-16 Thread Bruno Cardoso Lopes via cfe-commits
Author: bruno
Date: Thu Mar 16 18:18:55 2017
New Revision: 298012

URL: http://llvm.org/viewvc/llvm-project?rev=298012=rev
Log:
[Modules] Add documentation on private frameworks

Expand a bit on private modules with some guidance on how to write
them in the context of frameworks.

rdar://problem/24758771

Modified:
cfe/trunk/docs/Modules.rst

Modified: cfe/trunk/docs/Modules.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/Modules.rst?rev=298012=298011=298012=diff
==
--- cfe/trunk/docs/Modules.rst (original)
+++ cfe/trunk/docs/Modules.rst Thu Mar 16 18:18:55 2017
@@ -360,6 +360,7 @@ The ``framework`` qualifier specifies th
   Name.framework/
 Modules/module.modulemap  Module map for the framework
 Headers/  Subdirectory containing framework headers
+PrivateHeaders/   Subdirectory containing framework private headers
 Frameworks/   Subdirectory containing embedded frameworks
 Resources/Subdirectory containing additional resources
 Name  Symbolic link to the shared library for the 
framework
@@ -842,6 +843,16 @@ would be available when ``Foo_Private.h`
 easier to split a library's public and private APIs along header
 boundaries.
 
+When writing a private module as part of a *framework*, it's recommended that:
+
+* Headers for this module are present in the ``PrivateHeaders``
+  framework subdirectory.
+* The private module is defined as a *submodule* of the public framework (if
+  there's one), similar to how ``Foo.Private`` is defined in the example above.
+* The ``explicit`` keyword should be used to guarantee that its content will
+  only be available when the submodule itself is explicitly named (through a
+  ``@import`` for example).
+
 Modularizing a Platform
 ===
 To get any benefit out of modules, one needs to introduce module maps for 
software libraries starting at the bottom of the stack. This typically means 
introducing a module map covering the operating system's headers and the C 
standard library headers (in ``/usr/include``, for a Unix system). 


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


r298013 - [Headers] Reapply: Add #include_next for tgmath.h on Darwin

2017-03-16 Thread Bruno Cardoso Lopes via cfe-commits
Author: bruno
Date: Thu Mar 16 18:19:00 2017
New Revision: 298013

URL: http://llvm.org/viewvc/llvm-project?rev=298013=rev
Log:
[Headers] Reapply: Add #include_next for tgmath.h on Darwin

Reapply r289181 but rename the include guard to avoid
conflict with the one from Darwin.

Allow darwin to provide additional definitions and implementation
specifc values for tgmath.h on Apple platforms.

rdar://problem/19019845

Added:
cfe/trunk/test/Headers/Inputs/usr/include/math.h
cfe/trunk/test/Headers/Inputs/usr/include/tgmath.h
cfe/trunk/test/Headers/tgmath-darwin.c
Modified:
cfe/trunk/lib/Headers/tgmath.h

Modified: cfe/trunk/lib/Headers/tgmath.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/tgmath.h?rev=298013=298012=298013=diff
==
--- cfe/trunk/lib/Headers/tgmath.h (original)
+++ cfe/trunk/lib/Headers/tgmath.h Thu Mar 16 18:19:00 2017
@@ -22,12 +22,21 @@
  *
 
\*===--===*/
 
-#ifndef __TGMATH_H
-#define __TGMATH_H
+#ifndef __CLANG_TGMATH_H
+#define __CLANG_TGMATH_H
 
 /* C99 7.22 Type-generic math . */
 #include 
 
+/*
+ * Allow additional definitions and implementation-defined values on Apple
+ * platforms. This is done after #include  to avoid depcycle conflicts
+ * between libcxx and darwin in C++ modules builds.
+ */
+#if defined(__APPLE__) && __STDC_HOSTED__ && __has_include_next()
+#  include_next 
+#else
+
 /* C++ handles type genericity with overloading in math.h. */
 #ifndef __cplusplus
 #include 
@@ -1371,4 +1380,5 @@ static long double
 #undef _TG_ATTRS
 
 #endif /* __cplusplus */
-#endif /* __TGMATH_H */
+#endif /* __has_include_next */
+#endif /* __CLANG_TGMATH_H */

Added: cfe/trunk/test/Headers/Inputs/usr/include/math.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Headers/Inputs/usr/include/math.h?rev=298013=auto
==
--- cfe/trunk/test/Headers/Inputs/usr/include/math.h (added)
+++ cfe/trunk/test/Headers/Inputs/usr/include/math.h Thu Mar 16 18:19:00 2017
@@ -0,0 +1 @@
+// math.h

Added: cfe/trunk/test/Headers/Inputs/usr/include/tgmath.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Headers/Inputs/usr/include/tgmath.h?rev=298013=auto
==
--- cfe/trunk/test/Headers/Inputs/usr/include/tgmath.h (added)
+++ cfe/trunk/test/Headers/Inputs/usr/include/tgmath.h Thu Mar 16 18:19:00 2017
@@ -0,0 +1,4 @@
+#ifndef SYS_TGMATH_H
+#define SYS_TGMATH_H
+
+#endif /* SYS_TGMATH_H */

Added: cfe/trunk/test/Headers/tgmath-darwin.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Headers/tgmath-darwin.c?rev=298013=auto
==
--- cfe/trunk/test/Headers/tgmath-darwin.c (added)
+++ cfe/trunk/test/Headers/tgmath-darwin.c Thu Mar 16 18:19:00 2017
@@ -0,0 +1,12 @@
+// REQUIRES: system-darwin
+// RUN: %clang -target x86_64-apple-darwin10 -fsyntax-only -std=c11 -isysroot 
%S/Inputs %s
+#include 
+
+// Test the #include_next of tgmath.h works on Darwin.
+#ifndef SYS_TGMATH_H
+  #error "SYS_TGMATH_H not defined"
+#endif
+
+#ifndef __CLANG_TGMATH_H
+  #error "__CLANG_TGMATH_H not defined"
+#endif


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


Re: r295156 - Add a definition for __STRUCT_PARM_ALIGN__ for elfv2 and 64-bit darwin platforms to match what other compilers produce.

2017-03-16 Thread Eric Christopher via cfe-commits
... and ppc64 darwin preprocessor stuff isn't tested at all. We should
really just delete ppc darwin support at some point. Adding Iain here since
he's said that he's working on the platform :)

At any rate I added a single test in r298006

-eric

On Wed, Feb 15, 2017 at 12:13 AM Eric Christopher 
wrote:

> The PPC one should inherit from this. You're right I should have tested it
> though. Mostly ppc Darwin isn't well supported.
>
> On Wed, Feb 15, 2017, 12:06 AM Tim Shen  wrote:
>
> On Wed, Feb 15, 2017, 00:01 Eric Christopher via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
> Author: echristo
> Date: Wed Feb 15 01:50:11 2017
> New Revision: 295156
>
> URL: http://llvm.org/viewvc/llvm-project?rev=295156=rev
> Log:
> Add a definition for __STRUCT_PARM_ALIGN__ for elfv2 and 64-bit darwin
> platforms to match what other compilers produce.
>
> Modified:
> cfe/trunk/lib/Basic/Targets.cpp
> cfe/trunk/test/Preprocessor/init.c
>
> Modified: cfe/trunk/lib/Basic/Targets.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=295156=295155=295156=diff
>
> ==
> --- cfe/trunk/lib/Basic/Targets.cpp (original)
> +++ cfe/trunk/lib/Basic/Targets.cpp Wed Feb 15 01:50:11 2017
> @@ -1232,6 +1232,11 @@ void PPCTargetInfo::getTargetDefines(con
>if (LongDoubleWidth == 128)
>  Builder.defineMacro("__LONG_DOUBLE_128__");
>
> +  // Define this for elfv2 (64-bit only) or 64-bit darwin.
> +  if (ABI == "elfv2" ||
> +  (getTriple().getOS() == llvm::Triple::Darwin && PointerWidth == 64))
>
>
> I also see a "DarwinTargetInfo". Maybe this should be put there as well?
>
> +Builder.defineMacro("__STRUCT_PARM_ALIGN__", "16");
> +
>if (Opts.AltiVec) {
>  Builder.defineMacro("__VEC__", "10206");
>  Builder.defineMacro("__ALTIVEC__");
>
> Modified: cfe/trunk/test/Preprocessor/init.c
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/init.c?rev=295156=295155=295156=diff
>
> ==
> --- cfe/trunk/test/Preprocessor/init.c (original)
> +++ cfe/trunk/test/Preprocessor/init.c Wed Feb 15 01:50:11 2017
> @@ -5635,6 +5635,7 @@
>  // PPC64LE:#define __SIZE_MAX__ 18446744073709551615UL
>  // PPC64LE:#define __SIZE_TYPE__ long unsigned int
>  // PPC64LE:#define __SIZE_WIDTH__ 64
> +// PPC64LE:#define __STRUCT_PARM_ALIGN__ 16
>  // PPC64LE:#define __UINT16_C_SUFFIX__
>  // PPC64LE:#define __UINT16_MAX__ 65535
>  // PPC64LE:#define __UINT16_TYPE__ unsigned short
>
>
> ___
> 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


r298006 - Add a small test for __STRUCT_PARM_ALIGN__ for ppc64 darwin.

2017-03-16 Thread Eric Christopher via cfe-commits
Author: echristo
Date: Thu Mar 16 17:31:07 2017
New Revision: 298006

URL: http://llvm.org/viewvc/llvm-project?rev=298006=rev
Log:
Add a small test for __STRUCT_PARM_ALIGN__ for ppc64 darwin.

Modified:
cfe/trunk/test/Preprocessor/init.c

Modified: cfe/trunk/test/Preprocessor/init.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/init.c?rev=298006=298005=298006=diff
==
--- cfe/trunk/test/Preprocessor/init.c (original)
+++ cfe/trunk/test/Preprocessor/init.c Thu Mar 16 17:31:07 2017
@@ -6922,7 +6922,10 @@
 // PPC-DARWIN:#define __WINT_WIDTH__ 32
 // PPC-DARWIN:#define __powerpc__ 1
 // PPC-DARWIN:#define __ppc__ 1
-//
+
+// RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc64-apple-darwin8 < 
/dev/null | FileCheck -match-full-lines -check-prefix PPC64-DARWIN %s
+// PPC64-DARWIN:#define __STRUCT_PARM_ALIGN__ 16
+
 // RUN: %clang_cc1 -x cl -E -dM -ffreestanding -triple=amdgcn < /dev/null | 
FileCheck -match-full-lines -check-prefix AMDGCN --check-prefix AMDGPU %s
 // RUN: %clang_cc1 -x cl -E -dM -ffreestanding -triple=r600 -target-cpu caicos 
< /dev/null | FileCheck -match-full-lines --check-prefix AMDGPU %s
 //


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


[PATCH] D30920: Do not pass -Os and -Oz to the Gold plugin

2017-03-16 Thread Mehdi AMINI via Phabricator via cfe-commits
mehdi_amini added a comment.

The fundamental difference, is that Os/Oz especially are treated as 
`optimizations directive` that are independent of the pass pipeline: 
instructing that "loop unroll should not increase size" is independent of 
*where* is loop unroll inserted in the pipeline.

The issue with https://reviews.llvm.org/owners/package/1/ vs 
https://reviews.llvm.org/owners/package/2/ is that the *ordering* of the passes 
changes, not only the threshold to apply. For some of the differences we could 
get away with adding the level as a function attribute for instance, and have 
the PassManager itself skipping passes depending on the level. For instance the 
API for the pass manager could be

  PM.add(createLoopUnroll(), /* "shouldRun()" callback */ [] (Function ) { 
return F.getAttribute("opt_level") > 1; });

And the PM would call back the lambda and actually skip the LoopUnroll when the 
level is <2, in way that the client can customize with the position in the 
pipeline. But this can be very hard to setup a pipeline this way when we'd do 
more than just skipping but having different pass ordering entirely.

Also this wouldn't work with an SCC pass, as different functions in the SCC can 
have different level, it gets quite tricky. It also becomes problematic for any 
module level pass: `Dead Global Elimination` would need to leave out global 
variable that comes from a module compiled with 
https://reviews.llvm.org/owners/package/1/, same with `Merge Duplicate Global 
Constants` (I think the issue with `GlobalVariable` affects also Os/Oz by the 
way).


https://reviews.llvm.org/D30920



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


r297998 - Create msbuild only when using MSVC

2017-03-16 Thread Reid Kleckner via cfe-commits
Author: rnk
Date: Thu Mar 16 16:21:00 2017
New Revision: 297998

URL: http://llvm.org/viewvc/llvm-project?rev=297998=rev
Log:
Create msbuild only when using MSVC

Patch by: Mateusz Mikula

Reviewers: rnk

Reviewed By: rnk

Subscribers: asl, mgorny, cfe-commits

Tags: #clang-c

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

Modified:
cfe/trunk/tools/driver/CMakeLists.txt

Modified: cfe/trunk/tools/driver/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/CMakeLists.txt?rev=297998=297997=297998=diff
==
--- cfe/trunk/tools/driver/CMakeLists.txt (original)
+++ cfe/trunk/tools/driver/CMakeLists.txt Thu Mar 16 16:21:00 2017
@@ -61,7 +61,7 @@ add_dependencies(clang clang-headers)
 if(NOT CLANG_LINKS_TO_CREATE)
   set(CLANG_LINKS_TO_CREATE clang++ clang-cl clang-cpp)
 
-  if (WIN32)
+  if (MSVC)
 list(APPEND CLANG_LINKS_TO_CREATE ../msbuild-bin/cl)
   endif()
 endif()


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


[PATCH] D30991: [Driver] Fix cross compiling with Visual Studio 2017

2017-03-16 Thread Hamza Sood via Phabricator via cfe-commits
hamzasood added a comment.

In https://reviews.llvm.org/D30991#703199, @zturner wrote:

> lgtm, do you have commit access?


No, I don't.


https://reviews.llvm.org/D30991



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


[PATCH] D30991: [Driver] Fix cross compiling with Visual Studio 2017

2017-03-16 Thread Zachary Turner via Phabricator via cfe-commits
zturner accepted this revision.
zturner added a comment.
This revision is now accepted and ready to land.

lgtm, do you have commit access?


https://reviews.llvm.org/D30991



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


[PATCH] D30991: [Driver] Fix cross compiling with Visual Studio 2017

2017-03-16 Thread Hamza Sood via Phabricator via cfe-commits
hamzasood updated this revision to Diff 92050.
hamzasood added a comment.

@zturner: "it's just a vector of pointers"
Oh.. I was so focussed on reducing copies that I completely forgot it's 
just an array of pointers being copied, not the entire environment block 
contents. In that case, yeah. It's a dumb optimisation.

- setEnvironment is now just one function that accepts an ArrayRef.


https://reviews.llvm.org/D30991

Files:
  include/clang/Driver/Job.h
  lib/Driver/Job.cpp
  lib/Driver/ToolChains/MSVC.cpp

Index: lib/Driver/ToolChains/MSVC.cpp
===
--- lib/Driver/ToolChains/MSVC.cpp
+++ lib/Driver/ToolChains/MSVC.cpp
@@ -34,7 +34,7 @@
 // Include the necessary headers to interface with the Windows registry and
 // environment.
 #if defined(LLVM_ON_WIN32)
-#define USE_WIN32
+  #define USE_WIN32
 #endif
 
 #ifdef USE_WIN32
@@ -47,20 +47,20 @@
 #endif
 
 #ifdef _MSC_VER
-// Don't support SetupApi on MinGW.
-#define USE_MSVC_SETUP_API
+  // Don't support SetupApi on MinGW.
+  #define USE_MSVC_SETUP_API
 
-// Make sure this comes before MSVCSetupApi.h
-#include 
+  // Make sure this comes before MSVCSetupApi.h
+  #include 
 
-#include "MSVCSetupApi.h"
-#include "llvm/Support/COM.h"
-_COM_SMARTPTR_TYPEDEF(ISetupConfiguration, __uuidof(ISetupConfiguration));
-_COM_SMARTPTR_TYPEDEF(ISetupConfiguration2, __uuidof(ISetupConfiguration2));
-_COM_SMARTPTR_TYPEDEF(ISetupHelper, __uuidof(ISetupHelper));
-_COM_SMARTPTR_TYPEDEF(IEnumSetupInstances, __uuidof(IEnumSetupInstances));
-_COM_SMARTPTR_TYPEDEF(ISetupInstance, __uuidof(ISetupInstance));
-_COM_SMARTPTR_TYPEDEF(ISetupInstance2, __uuidof(ISetupInstance2));
+  #include "MSVCSetupApi.h"
+  #include "llvm/Support/COM.h"
+  _COM_SMARTPTR_TYPEDEF(ISetupConfiguration, __uuidof(ISetupConfiguration));
+  _COM_SMARTPTR_TYPEDEF(ISetupConfiguration2, __uuidof(ISetupConfiguration2));
+  _COM_SMARTPTR_TYPEDEF(ISetupHelper, __uuidof(ISetupHelper));
+  _COM_SMARTPTR_TYPEDEF(IEnumSetupInstances, __uuidof(IEnumSetupInstances));
+  _COM_SMARTPTR_TYPEDEF(ISetupInstance, __uuidof(ISetupInstance));
+  _COM_SMARTPTR_TYPEDEF(ISetupInstance2, __uuidof(ISetupInstance2));
 #endif
 
 using namespace clang::driver;
@@ -446,6 +446,8 @@
 
   TC.addProfileRTLibs(Args, CmdArgs);
 
+  std::vector Environment;
+
   // We need to special case some linker paths.  In the case of lld, we need to
   // translate 'lld' into 'lld-link', and in the case of the regular msvc
   // linker, we need to use a special search algorithm.
@@ -459,6 +461,68 @@
 // from the program PATH, because other environments like GnuWin32 install
 // their own link.exe which may come first.
 linkPath = FindVisualStudioExecutable(TC, "link.exe");
+
+#ifdef USE_WIN32
+// When cross-compiling with VS2017 or newer, link.exe expects to have
+// its containing bin directory at the top of PATH, followed by the
+// native target bin directory.
+// e.g. when compiling for x86 on an x64 host, PATH should start with:
+// /bin/HostX64/x86;/bin/HostX64/x64
+if (TC.getIsVS2017OrNewer() &&
+llvm::Triple(llvm::sys::getProcessTriple()).getArch() != TC.getArch()) {
+  auto HostArch = llvm::Triple(llvm::sys::getProcessTriple()).getArch();
+
+  auto EnvBlockWide = std::unique_ptr(
+GetEnvironmentStringsW(), FreeEnvironmentStringsW);
+  if (!EnvBlockWide)
+goto SkipSettingEnvironment;
+
+  size_t EnvCount = 0;
+  size_t EnvBlockLen = 0;
+  while (EnvBlockWide[EnvBlockLen] != L'\0') {
+++EnvCount;
+EnvBlockLen += std::wcslen([EnvBlockLen])
+   + 1/*string null-terminator*/;
+  }
+  ++EnvBlockLen;  // add the block null-terminator
+
+  std::string EnvBlock;
+  if (!llvm::convertUTF16ToUTF8String(
+ llvm::ArrayRef(reinterpret_cast(EnvBlockWide.get()),
+  EnvBlockLen * sizeof(EnvBlockWide[0])),
+ EnvBlock))
+goto SkipSettingEnvironment;
+
+  Environment.reserve(EnvCount);
+
+  // Now loop over each string in the block and copy them into the
+  // environment vector, adjusting the PATH variable as needed when we
+  // find it.
+  for (const char *Cursor = EnvBlock.data(); *Cursor != '\0';) {
+llvm::StringRef EnvVar(Cursor);
+if (EnvVar.startswith_lower("path=")) {
+  using SubDirectoryType = toolchains::MSVCToolChain::SubDirectoryType;
+  constexpr size_t PrefixLen = 5;  // strlen("path=")
+  Environment.push_back(Args.MakeArgString(
+  EnvVar.substr(0, PrefixLen)
++ TC.getSubDirectoryPath(SubDirectoryType::Bin)
++ llvm::Twine(llvm::sys::EnvPathSeparator)
++ TC.getSubDirectoryPath(SubDirectoryType::Bin, HostArch)
++ (EnvVar.size() > PrefixLen
+  ? 

[PATCH] D30920: Do not pass -Os and -Oz to the Gold plugin

2017-03-16 Thread Hal Finkel via Phabricator via cfe-commits
hfinkel added a comment.

In https://reviews.llvm.org/D30920#703083, @mehdi_amini wrote:

> In https://reviews.llvm.org/D30920#703082, @hfinkel wrote:
>
> > In https://reviews.llvm.org/D30920#700741, @mehdi_amini wrote:
> >
> > > Yes, the issue is only about how the driver accepts Os for the link even 
> > > though it has no effect 
> > > (O0/https://reviews.llvm.org/owners/package/1//https://reviews.llvm.org/owners/package/2//https://reviews.llvm.org/owners/package/3/
> > >  *will* have an effect though).
> >
> >
> > Do we agree that the desired endpoint here is that all optimization flags 
> > are encoded in the IR somehow? If so, in this desired end state, will it 
> > will be true that -O[n] will have some affect on an LTO link step?
>
>
> I don't think we have any plan for the optimization *level* (1, 2, and 3), at 
> least not that I know of. I don't even see how it would be possible to 
> achieve it in a principled way without limiting what we're allowing ourself 
> to express at the PassManager level with these levels.


Please elaborate.

> We can handle O0 (optnone), Os (optsize), and Oz (minsize) separately though, 
> because we can make these independent of the passmanager setup.

I'm trying to figure out if these are really fundamentally different from 1,2,3 
or if we just happen to handle them differently right now.


https://reviews.llvm.org/D30920



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


[PATCH] D31050: [ThinLTO] Clang support for emitting minimized bitcode for thin link

2017-03-16 Thread Teresa Johnson via Phabricator via cfe-commits
tejohnson created this revision.
Herald added a subscriber: Prazek.

Clang companion patch to LLVM patch https://reviews.llvm.org/D31027, which adds 
support
for emitting minimized bitcode file for use in the thin link step.
Add a cc1 option -fthin-link-bitcode= to trigger this behavior.

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


https://reviews.llvm.org/D31050

Files:
  include/clang/Driver/CC1Options.td
  include/clang/Frontend/CodeGenOptions.h
  lib/CodeGen/BackendUtil.cpp
  lib/Frontend/CompilerInvocation.cpp
  test/CodeGen/thin_link_bitcode.c


Index: test/CodeGen/thin_link_bitcode.c
===
--- /dev/null
+++ test/CodeGen/thin_link_bitcode.c
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 -o %t -flto=thin -fthin-link-bitcode=%t.nodebug -triple 
x86_64-unknown-linux-gnu -emit-llvm-bc -debug-info-kind=limited %s
+// RUN: llvm-bcanalyzer -dump %t | FileCheck %s
+// RUN: llvm-bcanalyzer -dump %t.nodebug | FileCheck %s --check-prefix=NO_DEBUG
+int main (void) {
+  return 0;
+}
+
+// CHECK: COMPILE_UNIT
+// NO_DEBUG-NOT: COMPILE_UNIT
Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -641,6 +641,7 @@
   << A->getAsString(Args) << "-x ir";
 Opts.ThinLTOIndexFile = Args.getLastArgValue(OPT_fthinlto_index_EQ);
   }
+  Opts.ThinLinkBitcodeFile = Args.getLastArgValue(OPT_fthin_link_bitcode_EQ);
 
   Opts.MSVolatile = Args.hasArg(OPT_fms_volatile);
 
Index: lib/CodeGen/BackendUtil.cpp
===
--- lib/CodeGen/BackendUtil.cpp
+++ lib/CodeGen/BackendUtil.cpp
@@ -688,7 +688,8 @@
 
   case Backend_EmitBC:
 if (CodeGenOpts.EmitSummaryIndex)
-  PerModulePasses.add(createWriteThinLTOBitcodePass(*OS));
+  PerModulePasses.add(
+  createWriteThinLTOBitcodePass(*OS, CodeGenOpts.ThinLinkBitcodeFile));
 else
   PerModulePasses.add(
   createBitcodeWriterPass(*OS, CodeGenOpts.EmitLLVMUseLists));
Index: include/clang/Frontend/CodeGenOptions.h
===
--- include/clang/Frontend/CodeGenOptions.h
+++ include/clang/Frontend/CodeGenOptions.h
@@ -186,6 +186,11 @@
   /// importing.
   std::string ThinLTOIndexFile;
 
+  /// Name of a file that can optionally be written with minimized bitcode
+  /// to be used as input for the ThinLTO thin link step, which only needs
+  /// the summary and module symbol table (and not, e.g. any debug metadata).
+  std::string ThinLinkBitcodeFile;
+
   /// A list of file names passed with -fcuda-include-gpubinary options to
   /// forward to CUDA runtime back-end for incorporating them into host-side
   /// object file.
Index: include/clang/Driver/CC1Options.td
===
--- include/clang/Driver/CC1Options.td
+++ include/clang/Driver/CC1Options.td
@@ -312,6 +312,8 @@
 def flto_unit: Flag<["-"], "flto-unit">,
 HelpText<"Emit IR to support LTO unit features (CFI, whole program vtable 
opt)">;
 def fno_lto_unit: Flag<["-"], "fno-lto-unit">;
+def fthin_link_bitcode_EQ : Joined<["-"], "fthin-link-bitcode=">,
+HelpText<"Write minimized bitcode to  for the ThinLTO thin link 
only">;
 
 
//===--===//
 // Dependency Output Options


Index: test/CodeGen/thin_link_bitcode.c
===
--- /dev/null
+++ test/CodeGen/thin_link_bitcode.c
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 -o %t -flto=thin -fthin-link-bitcode=%t.nodebug -triple x86_64-unknown-linux-gnu -emit-llvm-bc -debug-info-kind=limited %s
+// RUN: llvm-bcanalyzer -dump %t | FileCheck %s
+// RUN: llvm-bcanalyzer -dump %t.nodebug | FileCheck %s --check-prefix=NO_DEBUG
+int main (void) {
+  return 0;
+}
+
+// CHECK: COMPILE_UNIT
+// NO_DEBUG-NOT: COMPILE_UNIT
Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -641,6 +641,7 @@
   << A->getAsString(Args) << "-x ir";
 Opts.ThinLTOIndexFile = Args.getLastArgValue(OPT_fthinlto_index_EQ);
   }
+  Opts.ThinLinkBitcodeFile = Args.getLastArgValue(OPT_fthin_link_bitcode_EQ);
 
   Opts.MSVolatile = Args.hasArg(OPT_fms_volatile);
 
Index: lib/CodeGen/BackendUtil.cpp
===
--- lib/CodeGen/BackendUtil.cpp
+++ lib/CodeGen/BackendUtil.cpp
@@ -688,7 +688,8 @@
 
   case Backend_EmitBC:
 if (CodeGenOpts.EmitSummaryIndex)
-  PerModulePasses.add(createWriteThinLTOBitcodePass(*OS));
+  PerModulePasses.add(
+  createWriteThinLTOBitcodePass(*OS, CodeGenOpts.ThinLinkBitcodeFile));
 else
   PerModulePasses.add(
   createBitcodeWriterPass(*OS, 

[PATCH] D30920: Do not pass -Os and -Oz to the Gold plugin

2017-03-16 Thread Mehdi AMINI via Phabricator via cfe-commits
mehdi_amini added a comment.

In https://reviews.llvm.org/D30920#703082, @hfinkel wrote:

> In https://reviews.llvm.org/D30920#700741, @mehdi_amini wrote:
>
> > Yes, the issue is only about how the driver accepts Os for the link even 
> > though it has no effect 
> > (O0/https://reviews.llvm.org/owners/package/1//https://reviews.llvm.org/owners/package/2//https://reviews.llvm.org/owners/package/3/
> >  *will* have an effect though).
>
>
> Do we agree that the desired endpoint here is that all optimization flags are 
> encoded in the IR somehow? If so, in this desired end state, will it will be 
> true that -O[n] will have some affect on an LTO link step?


I don't think we have any plan for the optimization *level* (1, 2, and 3), at 
least not that I know of. I don't even see how it would be possible to achieve 
it in a principled way without limiting what we're allowing ourself to express 
at the PassManager level with these levels.
We can handle O0 (optnone), Os (optsize), and Oz (minsize) separately though, 
because we can make these independent of the passmanager setup.


https://reviews.llvm.org/D30920



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


[PATCH] D30920: Do not pass -Os and -Oz to the Gold plugin

2017-03-16 Thread Hal Finkel via Phabricator via cfe-commits
hfinkel added a comment.

In https://reviews.llvm.org/D30920#700741, @mehdi_amini wrote:

> In https://reviews.llvm.org/D30920#700574, @hfinkel wrote:
>
> > In https://reviews.llvm.org/D30920#700557, @mehdi_amini wrote:
> >
> > > In https://reviews.llvm.org/D30920#700433, @tejohnson wrote:
> > >
> > > > In https://reviews.llvm.org/D30920#700133, @pcc wrote:
> > > >
> > > > > In https://reviews.llvm.org/D30920#700077, @tejohnson wrote:
> > > > >
> > > > > > Until everything is converted to using size attributes, it seems 
> > > > > > like a correct fix for the bug is to accept these options in the 
> > > > > > gold-plugin and pass through the LTO API to the PassManagerBuilder.
> > > > >
> > > > >
> > > > > Not necessarily. There is no requirement (from a correctness 
> > > > > perspective) that `-Os` at link time should exactly match the 
> > > > > behaviour of `-Os` at compile time.
> > > >
> > > >
> > > > Sure, but there is certainly a perception that optimization flags 
> > > > affecting the non-LTO pipeline should similarly affect the LTO 
> > > > pipeline. LTO should be transparent to the user, so if -Os behaves one 
> > > > way without LTO, it seems problematic to me if it behaves a different 
> > > > way with LTO.
> > > >
> > > > That being said, agree that the best way to enforce that is to pass the 
> > > > relevant flags through the IR. (On the flip side, if the user passes 
> > > > -O1 to the link step, it does get passed through to the plugin and 
> > > > affects the LTO optimization pipeline...)
> > >
> > >
> > > I agree that I don't like the discrepancy: the driver should *not* drop 
> > > -Os silently if it passes down -O1/-O2/-O3, a warning is the minimum.
> >
> >
> > I don't like the discrepancy either, and I agree that we should be passing 
> > these other flags through the IR as well (even though, in the face of 
> > inlining, there is some ambiguity as to what the flags would mean). That 
> > having been said, I don't see the value in the warning. Forcing users to 
> > endure a warning solely because they use LTO and use -Os or -Oz for all of 
> > their compilation steps, is not friendly.
>
>
> The warning here is only about the *link* step.
>
> > The information has been captured already so there's nothing to warn about. 
> > You might worry about the opposite situation (the user uses only -Os or -Oz 
> > on the link step, but not for the compile steps), and that will have no 
> > effect. That, however, should be the expected behavior (optimization is 
> > associated with compiling, not linking, except perhaps for specifically 
> > called-out exceptions). The fact that our other optimization level don't 
> > work that way is a bug, not a feature, that we should fix instead of 
> > further exposing to our users.
>
> Yes, the issue is only about how the driver accepts Os for the link even 
> though it has no effect 
> (O0/https://reviews.llvm.org/owners/package/1//https://reviews.llvm.org/owners/package/2//https://reviews.llvm.org/owners/package/3/
>  *will* have an effect though).


Do we agree that the desired endpoint here is that all optimization flags are 
encoded in the IR somehow? If so, in this desired end state, will it will be 
true that -O[n] will have some affect on an LTO link step?


https://reviews.llvm.org/D30920



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


[PATCH] D31049: [Clang-tidy] Fix for misc-noexcept-move-constructor false triggers on defaulted declarations

2017-03-16 Thread Marek Jenda via Phabricator via cfe-commits
edyp87 created this revision.
edyp87 added a project: clang-tools-extra.
Herald added a subscriber: JDevlieghere.

There is no need for triggering warning when noexcept specifier in move 
constructor or move-assignment operator is neither evaluated nor uninstantiated.

This fixes bug reported here: bugs.llvm.org/show_bug.cgi?id=24712


Repository:
  rL LLVM

https://reviews.llvm.org/D31049

Files:
  clang-tidy/misc/NoexceptMoveConstructorCheck.cpp
  test/clang-tidy/misc-noexcept-move-constructor.cpp


Index: test/clang-tidy/misc-noexcept-move-constructor.cpp
===
--- test/clang-tidy/misc-noexcept-move-constructor.cpp
+++ test/clang-tidy/misc-noexcept-move-constructor.cpp
@@ -42,3 +42,13 @@
   OK3(OK3 &&) noexcept(false) {}
   OK3 =(OK3 &&) = delete;
 };
+
+struct OK4 {
+  OK4(OK4 &&) noexcept = default;
+  OK4 =(OK4 &&) noexcept = default;
+};
+
+struct OK5 {
+  OK5(OK5 &&) noexcept(true) = default;
+  OK5 =(OK5 &&) noexcept(true) = default;
+};
Index: clang-tidy/misc/NoexceptMoveConstructorCheck.cpp
===
--- clang-tidy/misc/NoexceptMoveConstructorCheck.cpp
+++ clang-tidy/misc/NoexceptMoveConstructorCheck.cpp
@@ -43,6 +43,10 @@
 }
 
 const auto *ProtoType = Decl->getType()->getAs();
+
+if (isUnresolvedExceptionSpec(ProtoType->getExceptionSpecType()))
+  return;
+
 switch (ProtoType->getNoexceptSpec(*Result.Context)) {
   case FunctionProtoType::NR_NoNoexcept:
 diag(Decl->getLocation(), "move %0s should be marked noexcept")


Index: test/clang-tidy/misc-noexcept-move-constructor.cpp
===
--- test/clang-tidy/misc-noexcept-move-constructor.cpp
+++ test/clang-tidy/misc-noexcept-move-constructor.cpp
@@ -42,3 +42,13 @@
   OK3(OK3 &&) noexcept(false) {}
   OK3 =(OK3 &&) = delete;
 };
+
+struct OK4 {
+  OK4(OK4 &&) noexcept = default;
+  OK4 =(OK4 &&) noexcept = default;
+};
+
+struct OK5 {
+  OK5(OK5 &&) noexcept(true) = default;
+  OK5 =(OK5 &&) noexcept(true) = default;
+};
Index: clang-tidy/misc/NoexceptMoveConstructorCheck.cpp
===
--- clang-tidy/misc/NoexceptMoveConstructorCheck.cpp
+++ clang-tidy/misc/NoexceptMoveConstructorCheck.cpp
@@ -43,6 +43,10 @@
 }
 
 const auto *ProtoType = Decl->getType()->getAs();
+
+if (isUnresolvedExceptionSpec(ProtoType->getExceptionSpecType()))
+  return;
+
 switch (ProtoType->getNoexceptSpec(*Result.Context)) {
   case FunctionProtoType::NR_NoNoexcept:
 diag(Decl->getLocation(), "move %0s should be marked noexcept")
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r297975 - Use arg_begin() instead of getArgumentList().begin(), the argument list is an implementation detail

2017-03-16 Thread Reid Kleckner via cfe-commits
Author: rnk
Date: Thu Mar 16 13:55:46 2017
New Revision: 297975

URL: http://llvm.org/viewvc/llvm-project?rev=297975=rev
Log:
Use arg_begin() instead of getArgumentList().begin(), the argument list is an 
implementation detail

Modified:
cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp

Modified: cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp?rev=297975=297974=297975=diff
==
--- cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp Thu Mar 16 13:55:46 2017
@@ -3780,9 +3780,7 @@ CGOpenMPRuntime::emitTaskInit(CodeGenFun
   // Emit initial values for private copies (if any).
   llvm::Value *TaskPrivatesMap = nullptr;
   auto *TaskPrivatesMapTy =
-  std::next(cast(TaskFunction)->getArgumentList().begin(),
-3)
-  ->getType();
+  std::next(cast(TaskFunction)->arg_begin(), 3)->getType();
   if (!Privates.empty()) {
 auto FI = std::next(KmpTaskTWithPrivatesQTyRD->field_begin());
 TaskPrivatesMap = emitTaskPrivateMappingFunction(


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


r297974 - [AST] Follow-up to r297972, add default value for setGetterName/setSetterName if a source-loc is not provided.

2017-03-16 Thread Argyrios Kyrtzidis via cfe-commits
Author: akirtzidis
Date: Thu Mar 16 13:40:13 2017
New Revision: 297974

URL: http://llvm.org/viewvc/llvm-project?rev=297974=rev
Log:
[AST] Follow-up to r297972, add default value for setGetterName/setSetterName 
if a source-loc is not provided.

Fixes lldb build.

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

Modified: cfe/trunk/include/clang/AST/DeclObjC.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclObjC.h?rev=297974=297973=297974=diff
==
--- cfe/trunk/include/clang/AST/DeclObjC.h (original)
+++ cfe/trunk/include/clang/AST/DeclObjC.h Thu Mar 16 13:40:13 2017
@@ -858,14 +858,14 @@ public:
 
   Selector getGetterName() const { return GetterName; }
   SourceLocation getGetterNameLoc() const { return GetterNameLoc; }
-  void setGetterName(Selector Sel, SourceLocation Loc) {
+  void setGetterName(Selector Sel, SourceLocation Loc = SourceLocation()) {
 GetterName = Sel;
 GetterNameLoc = Loc;
   }
 
   Selector getSetterName() const { return SetterName; }
   SourceLocation getSetterNameLoc() const { return SetterNameLoc; }
-  void setSetterName(Selector Sel, SourceLocation Loc) {
+  void setSetterName(Selector Sel, SourceLocation Loc = SourceLocation()) {
 SetterName = Sel;
 SetterNameLoc = Loc;
   }


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


[PATCH] D30896: [Clang-tidy] add check misc-prefer-switch-for-enums

2017-03-16 Thread Jonathan B Coe via Phabricator via cfe-commits
jbcoe added a comment.

I think that clang-tidy allows case-specific subsetting of C++. It is said that 
C++ contains a beautiful language and I've found that definition of beauty to 
be very use-case specific. Checks for side-effect free, Haskell-like, 
functional code would be of enormous interest to some subsections of the C++ 
community ( financial asset pricing and risk) but of very little interest to 
others (device drivers for embedded code). It would seem an enormous loss to me 
to require all clang-tidy checks to be generally useful. It's a simple matter 
to define a clang-tidy config file to enable different checks in different 
parts of a code base.


Repository:
  rL LLVM

https://reviews.llvm.org/D30896



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


[PATCH] D31029: [analyzer] Fix logical not for pointers with different bit width

2017-03-16 Thread Noel Grandin via Phabricator via cfe-commits
grandinj added inline comments.



Comment at: include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h:313
 
-  Loc makeNull() {
-return loc::ConcreteInt(BasicVals.getZeroWithPtrWidth());
+  // Pass type to accomodate for different pointer bit-witdths of different
+  // address spaces.

spelling and grammar and doxygen formatting:

/// \param type accommodate different pointer bit-widths of different address 
spaces.


Repository:
  rL LLVM

https://reviews.llvm.org/D31029



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


[PATCH] D30991: [Driver] Fix cross compiling with Visual Studio 2017

2017-03-16 Thread Zachary Turner via Phabricator via cfe-commits
zturner added a comment.

Looks good with one more suggested fix.




Comment at: include/clang/Driver/Job.h:129
+  /// the given vector is to be copied in as opposed to moved. 
+  void setEnvironment(const std::vector );
+

Since it's just a vector of pointers, I don't think this is a very valuable 
optimization, especially at the risk of complicating the API (I had to think 
again to recall how overload resolution works with rvalue references and const 
char*.  

Personally I would just have one function, `void setEnvironment(ArrayRef NewEnvironment);`  (for example, this allows someone to pass in a 
`SmallVector` as well), and not worry about the optimization.  More flexibility 
in the API is preferable to optimizations unless this is a specific bottleneck, 
which seems unlikely.


https://reviews.llvm.org/D30991



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


[PATCH] D30920: Do not pass -Os and -Oz to the Gold plugin

2017-03-16 Thread Mehdi AMINI via Phabricator via cfe-commits
mehdi_amini added a comment.

(By the way, this is what is done on Darwin: the -O flag is *ignored* for the 
link step invocation, because we couldn't find a "right way" of correctly 
honoring it that would be logical to the user in all case).


https://reviews.llvm.org/D30920



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


r297972 - [index/AST] Add references for ObjC getter=/setter= property attributes and related property getter/setter role fixes

2017-03-16 Thread Argyrios Kyrtzidis via cfe-commits
Author: akirtzidis
Date: Thu Mar 16 13:25:40 2017
New Revision: 297972

URL: http://llvm.org/viewvc/llvm-project?rev=297972=rev
Log:
[index/AST] Add references for ObjC getter=/setter= property attributes and 
related property getter/setter role fixes

This enhances the AST to keep track of locations of the names in those ObjC 
property attributes, and reports them for indexing.

Patch by Nathan Hawes!
https://reviews.llvm.org/D30907

Modified:
cfe/trunk/include/clang/AST/DeclObjC.h
cfe/trunk/include/clang/Sema/DeclSpec.h
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/AST/ASTImporter.cpp
cfe/trunk/lib/Index/IndexBody.cpp
cfe/trunk/lib/Index/IndexDecl.cpp
cfe/trunk/lib/Parse/ParseObjc.cpp
cfe/trunk/lib/Sema/SemaObjCProperty.cpp
cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
cfe/trunk/lib/Serialization/ASTWriterDecl.cpp
cfe/trunk/test/Index/Core/index-source.m

Modified: cfe/trunk/include/clang/AST/DeclObjC.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclObjC.h?rev=297972=297971=297972=diff
==
--- cfe/trunk/include/clang/AST/DeclObjC.h (original)
+++ cfe/trunk/include/clang/AST/DeclObjC.h Thu Mar 16 13:25:40 2017
@@ -743,6 +743,8 @@ private:
 
   Selector GetterName;// getter name of NULL if no getter
   Selector SetterName;// setter name of NULL if no setter
+  SourceLocation GetterNameLoc; // location of the getter attribute's value
+  SourceLocation SetterNameLoc; // location of the setter attribute's value
 
   ObjCMethodDecl *GetterMethodDecl; // Declaration of getter instance method
   ObjCMethodDecl *SetterMethodDecl; // Declaration of setter instance method
@@ -855,10 +857,18 @@ public:
   }
 
   Selector getGetterName() const { return GetterName; }
-  void setGetterName(Selector Sel) { GetterName = Sel; }
+  SourceLocation getGetterNameLoc() const { return GetterNameLoc; }
+  void setGetterName(Selector Sel, SourceLocation Loc) {
+GetterName = Sel;
+GetterNameLoc = Loc;
+  }
 
   Selector getSetterName() const { return SetterName; }
-  void setSetterName(Selector Sel) { SetterName = Sel; }
+  SourceLocation getSetterNameLoc() const { return SetterNameLoc; }
+  void setSetterName(Selector Sel, SourceLocation Loc) {
+SetterName = Sel;
+SetterNameLoc = Loc;
+  }
 
   ObjCMethodDecl *getGetterMethodDecl() const { return GetterMethodDecl; }
   void setGetterMethodDecl(ObjCMethodDecl *gDecl) { GetterMethodDecl = gDecl; }

Modified: cfe/trunk/include/clang/Sema/DeclSpec.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/DeclSpec.h?rev=297972=297971=297972=diff
==
--- cfe/trunk/include/clang/Sema/DeclSpec.h (original)
+++ cfe/trunk/include/clang/Sema/DeclSpec.h Thu Mar 16 13:25:40 2017
@@ -861,11 +861,19 @@ public:
 
   const IdentifierInfo *getGetterName() const { return GetterName; }
   IdentifierInfo *getGetterName() { return GetterName; }
-  void setGetterName(IdentifierInfo *name) { GetterName = name; }
+  SourceLocation getGetterNameLoc() const { return GetterNameLoc; }
+  void setGetterName(IdentifierInfo *name, SourceLocation loc) {
+GetterName = name;
+GetterNameLoc = loc;
+  }
 
   const IdentifierInfo *getSetterName() const { return SetterName; }
   IdentifierInfo *getSetterName() { return SetterName; }
-  void setSetterName(IdentifierInfo *name) { SetterName = name; }
+  SourceLocation getSetterNameLoc() const { return SetterNameLoc; }
+  void setSetterName(IdentifierInfo *name, SourceLocation loc) {
+SetterName = name;
+SetterNameLoc = loc;
+  }
 
 private:
   // FIXME: These two are unrelated and mutually exclusive. So perhaps
@@ -882,6 +890,9 @@ private:
 
   IdentifierInfo *GetterName;// getter name or NULL if no getter
   IdentifierInfo *SetterName;// setter name or NULL if no setter
+  SourceLocation GetterNameLoc; // location of the getter attribute's value
+  SourceLocation SetterNameLoc; // location of the setter attribute's value
+
 };
 
 /// \brief Represents a C++ unqualified-id that has been parsed. 

Modified: cfe/trunk/include/clang/Sema/Sema.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=297972=297971=297972=diff
==
--- cfe/trunk/include/clang/Sema/Sema.h (original)
+++ cfe/trunk/include/clang/Sema/Sema.h Thu Mar 16 13:25:40 2017
@@ -3266,7 +3266,9 @@ public:
   SourceLocation LParenLoc,
   FieldDeclarator ,
   Selector GetterSel,
+  SourceLocation GetterNameLoc,
   Selector SetterSel,
+  SourceLocation SetterNameLoc,
   const bool isReadWrite,
   unsigned ,
   const unsigned AttributesAsWritten,
@@ 

[PATCH] D30991: [Driver] Fix cross compiling with Visual Studio 2017

2017-03-16 Thread Nico Weber via Phabricator via cfe-commits
thakis added a comment.

Ah ok, thanks for explaining. In that case, this sounds fine and I'll leave the 
review to zturner.


https://reviews.llvm.org/D30991



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


[PATCH] D30268: Avoid copy of __atoms when char_type is char

2017-03-16 Thread Aditya Kumar via Phabricator via cfe-commits
hiraditya added a comment.

Ping


https://reviews.llvm.org/D30268



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


[PATCH] D30920: Do not pass -Os and -Oz to the Gold plugin

2017-03-16 Thread Mehdi AMINI via Phabricator via cfe-commits
mehdi_amini added a comment.

It would be reasonable to *not* forward any flag to the linker (plugin), but 
not to rewrite them with a different meaning.


https://reviews.llvm.org/D30920



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


[PATCH] D30920: Do not pass -Os and -Oz to the Gold plugin

2017-03-16 Thread Mehdi AMINI via Phabricator via cfe-commits
mehdi_amini added a comment.

In https://reviews.llvm.org/D30920#702979, @pirama wrote:

> The driver (accepts, but) ignores Os and other optimization flags for non-lto 
> link-only actions.  That it has an effect for LTO is seems to be an 
> implementation detail.  Since optimization flags are compiler-only options, 
> and Clang already silently (without a warning) ignores these flags during 
> link-only invocations, silently transforming them when passing to the plugin 
> seems reasonable.


No it is not reasonable to me. The users ask for A and we're doing B.


https://reviews.llvm.org/D30920



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


[PATCH] D30991: [Driver] Fix cross compiling with Visual Studio 2017

2017-03-16 Thread Hamza Sood via Phabricator via cfe-commits
hamzasood added a comment.

In https://reviews.llvm.org/D30991#702965, @thakis wrote:

> When you say "cross-compiling", you mean targeting Windows while running on 
> non-Windows, right? How do dlls get loaded there at all?
>
> Also, when does clang invoke link.exe? Normally on Windows the linker is 
> invoked directly, no through the compiler driver. Are you using clang.exe 
> instead of clang-cl.exe?


Sorry, I should have been more specific. @zturner is correct, I meant using an 
x64 link.exe to build for x86 (or vice-versa).

The new 2017 toolchains are split up by host architecture and target 
architecture:
HostX64/x64. Native compilation. Compile for x64 on an x64 host.
HostX64/x86. Cross-compilation. Compile for x86 on an x64 host.
HostX86/x64. Cross-compilation. Compile for x64 on an x86 host
HostX86/x86. Native compilation. Compile for x86 on an x86 host.

The cross compiling toolchains (HostX64/x86, HostX86/x64) are incomplete as 
they rely on components containing in the corresponding native toolchains (e.g. 
HostX64/x86 uses components from HostX64/x64).
You can see this in the vcvars bat scripts supplied with Visual Studio. They 
setup %PATH% in the same way when cross-compiling.
mspdbcore.dll is an example of something missing from the cross-compiling 
toolchains. There are probably others but I didn't check.


https://reviews.llvm.org/D30991



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


[PATCH] D30991: [Driver] Fix cross compiling with Visual Studio 2017

2017-03-16 Thread Zachary Turner via Phabricator via cfe-commits
zturner added a comment.

In https://reviews.llvm.org/D30991#702966, @zturner wrote:

> In https://reviews.llvm.org/D30991#702965, @thakis wrote:
>
> > When you say "cross-compiling", you mean targeting Windows while running on 
> > non-Windows, right? How do dlls get loaded there at all?
> >
> > Also, when does clang invoke link.exe? Normally on Windows the linker is 
> > invoked directly, no through the compiler driver. Are you using clang.exe 
> > instead of clang-cl.exe?
>
>
> I think he means "targeting x86 using an x64 toolchain", but yes, some 
> clarification would be helpful.  Also, which DLLs (specifically) are we 
> talking about?


A quick side-by-side comparison of two directories shows that the following 
files are missing from the x64_x86 cross compiler folder but are present in the 
x64_x64 folder:

atlprov.dll
CppCoreCheck.dll
d3dcompiler_47.dll
EspXEngine.dll
ExperimentalCppCoreCheck.dll
LocalESPC.dll
msobj140.dll
mspdb140.dll
mspdbcore.dll
mspdbst.dll
mspft140.dll
msvcdis140.dll
pgort140.dll

I then set up a cross compilation build environment using vcvarsall and the 
first two entries of my path are (in order):

  C:\Program Files (x86)\Microsoft Visual 
Studio\2017\Professional\VC\Tools\MSVC\14.10.25017\bin\HostX64\x86
  C:\Program Files (x86)\Microsoft Visual 
Studio\2017\Professional\VC\Tools\MSVC\14.10.25017\bin\HostX64\x64

So it looks like this matches up with what he's saying.


https://reviews.llvm.org/D30991



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


[PATCH] D30977: [CodeGen] Emit a CoreFoundation link guard when @available is used

2017-03-16 Thread Alex Lorenz via Phabricator via cfe-commits
arphaman updated this revision to Diff 92028.
arphaman marked an inline comment as done.
arphaman added a comment.

Reverse the early exit checks.


Repository:
  rL LLVM

https://reviews.llvm.org/D30977

Files:
  lib/CodeGen/CGObjC.cpp
  lib/CodeGen/CodeGenModule.cpp
  lib/CodeGen/CodeGenModule.h
  test/CodeGenObjC/availability-cf-link-guard.m

Index: test/CodeGenObjC/availability-cf-link-guard.m
===
--- /dev/null
+++ test/CodeGenObjC/availability-cf-link-guard.m
@@ -0,0 +1,45 @@
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.11 -emit-llvm -o - %s | FileCheck --check-prefixes=CHECK,CHECK_LINK_OPT %s
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.11 -emit-llvm -o - -D USE_BUILTIN %s | FileCheck --check-prefixes=CHECK,CHECK_LINK_OPT %s
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.11 -emit-llvm -o - -D DEF_CF %s | FileCheck --check-prefixes=CHECK_CF,CHECK_LINK_OPT %s
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.12 -emit-llvm -o - %s | FileCheck --check-prefix=CHECK_NO_GUARD %s
+// RUN: %clang_cc1 -triple x86_64-unknown-linux -emit-llvm -o - %s | FileCheck --check-prefix=CHECK_NO_GUARD %s
+
+#ifdef DEF_CF
+struct CFBundle;
+typedef struct CFBundle *CFBundleRef;
+unsigned CFBundleGetVersionNumber(CFBundleRef bundle);
+// CHECK_CF: declare i32 @CFBundleGetVersionNumber(%struct.CFBundle*)
+// CHECK_CF: @__clang_at_available_requires_core_foundation_framework
+// CHECK_CF-NEXT: call {{.*}}@CFBundleGetVersionNumber
+#endif
+
+void use_at_available() {
+#ifdef DEF_CF
+  CFBundleGetVersionNumber(0);
+#endif
+#ifdef USE_BUILTIN
+  if (__builtin_available(macos 10.12, *))
+;
+#else
+  if (@available(macos 10.12, *))
+;
+#endif
+}
+
+// CHECK: @llvm.compiler.used{{.*}}@__clang_at_available_requires_core_foundation_framework
+
+// CHECK: declare i32 @CFBundleGetVersionNumber(i8*)
+
+// CHECK-LABEL: linkonce hidden void @__clang_at_available_requires_core_foundation_framework
+// CHECK: call i32 @CFBundleGetVersionNumber(i8* null)
+// CHECK-NEXT: unreachable
+
+// CHECK_NO_GUARD-NOT: __clang_at_available_requires_core_foundation_framework
+// CHECK_NO_GUARD-NOT: CFBundleGetVersionNumber
+
+// CHECK_LINK_OPT: !"Linker Options", ![[OPTS:[0-9]+]]
+// CHECK_LINK_OPT: ![[OPTS]] = !{![[FRAMEWORK:[0-9]+]]
+// CHECK_LINK_OPT: ![[FRAMEWORK]] = !{!"-framework", !"CoreFoundation"}
+
+// CHECK_NO_GUARD-NOT: "Linker Options"
+// CHECK_NO_GUARD-NOT: CoreFoundation
Index: lib/CodeGen/CodeGenModule.h
===
--- lib/CodeGen/CodeGenModule.h
+++ lib/CodeGen/CodeGenModule.h
@@ -1288,6 +1288,10 @@
   /// Emit any vtables which we deferred and still have a use for.
   void EmitDeferredVTables();
 
+  /// Emit a dummy function that reference a CoreFoundation symbol when
+  /// @available is used on Darwin.
+  void emitAtAvailableLinkGuard();
+
   /// Emit the llvm.used and llvm.compiler.used metadata.
   void emitLLVMUsed();
 
Index: lib/CodeGen/CodeGenModule.cpp
===
--- lib/CodeGen/CodeGenModule.cpp
+++ lib/CodeGen/CodeGenModule.cpp
@@ -408,6 +408,7 @@
 CoverageMapping->emit();
   if (CodeGenOpts.SanitizeCfiCrossDso)
 CodeGenFunction(*this).EmitCfiCheckFail();
+  emitAtAvailableLinkGuard();
   emitLLVMUsed();
   if (SanStats)
 SanStats->finish();
Index: lib/CodeGen/CGObjC.cpp
===
--- lib/CodeGen/CGObjC.cpp
+++ lib/CodeGen/CGObjC.cpp
@@ -3416,4 +3416,37 @@
   return Builder.CreateICmpNE(CallRes, llvm::Constant::getNullValue(Int32Ty));
 }
 
+void CodeGenModule::emitAtAvailableLinkGuard() {
+  if (!IsOSVersionAtLeastFn)
+return;
+  // @available requires CoreFoundation only on Darwin.
+  if (!Target.getTriple().isOSDarwin())
+return;
+  // Add -framework CoreFoundation to the linker commands. We still want to
+  // emit the core foundation reference down below because otherwise if
+  // CoreFoundation is not used in the code, the linker won't link the
+  // framework.
+  auto  = getLLVMContext();
+  llvm::Metadata *Args[2] = {llvm::MDString::get(Context, "-framework"),
+ llvm::MDString::get(Context, "CoreFoundation")};
+  LinkerOptionsMetadata.push_back(llvm::MDNode::get(Context, Args));
+  // Emit a reference to a symbol from CoreFoundation to ensure that
+  // CoreFoundation is linked into the final binary.
+  llvm::FunctionType *FTy =
+  llvm::FunctionType::get(Int32Ty, {VoidPtrTy}, false);
+  llvm::Constant *CFFunc =
+  CreateRuntimeFunction(FTy, "CFBundleGetVersionNumber");
+
+  llvm::FunctionType *CheckFTy = llvm::FunctionType::get(VoidTy, {}, false);
+  llvm::Function *CFLinkCheckFunc = cast(CreateBuiltinFunction(
+  CheckFTy, "__clang_at_available_requires_core_foundation_framework"));
+  CFLinkCheckFunc->setLinkage(llvm::GlobalValue::LinkOnceAnyLinkage);
+  

[PATCH] D30841: [clang-tidy] readability-misleading-indentation: fix chained if

2017-03-16 Thread Florian Gross via Phabricator via cfe-commits
fgross updated this revision to Diff 92026.
fgross added a comment.

Now using `ASTContext::getParents` instead of `ChainedIfs` map.

For some reason I thought of `getParents` as an expensive function to call...


https://reviews.llvm.org/D30841

Files:
  clang-tidy/readability/MisleadingIndentationCheck.cpp
  clang-tidy/readability/MisleadingIndentationCheck.h
  test/clang-tidy/readability-misleading-indentation.cpp


Index: test/clang-tidy/readability-misleading-indentation.cpp
===
--- test/clang-tidy/readability-misleading-indentation.cpp
+++ test/clang-tidy/readability-misleading-indentation.cpp
@@ -76,5 +76,31 @@
 {
 }
 
+  if(cond1) {
+  }
+  else if (cond2) {
+  }
+  else {
+  }
+
+  if(cond1) {
+  }
+  else if (cond2) {
+  }
+   else {
+  }
+  // CHECK-MESSAGES: :[[@LINE-2]]:8: warning: different indentation for 'if' 
and corresponding 'else' [readability-misleading-indentation]
+  
+  if (cond1) {
+if (cond1) {
+}
+else if (cond2) {
+}
+else {
+}
+  }
+  else if (cond2) {
+  }
+
   BLOCK
 }
Index: clang-tidy/readability/MisleadingIndentationCheck.h
===
--- clang-tidy/readability/MisleadingIndentationCheck.h
+++ clang-tidy/readability/MisleadingIndentationCheck.h
@@ -30,7 +30,8 @@
   void check(const ast_matchers::MatchFinder::MatchResult ) override;
 
 private:
-  void danglingElseCheck(const SourceManager , const IfStmt *If);
+  void danglingElseCheck(const SourceManager , ASTContext *Context,
+ const IfStmt *If);
   void missingBracesCheck(const SourceManager , const CompoundStmt *CStmt);
 };
 
Index: clang-tidy/readability/MisleadingIndentationCheck.cpp
===
--- clang-tidy/readability/MisleadingIndentationCheck.cpp
+++ clang-tidy/readability/MisleadingIndentationCheck.cpp
@@ -17,7 +17,22 @@
 namespace tidy {
 namespace readability {
 
+static const IfStmt *getPrecedingIf(const SourceManager ,
+ASTContext *Context, const IfStmt *If) {
+  auto parents = Context->getParents(*If);
+  if (parents.size() != 1)
+return nullptr;
+  if (const auto *PrecedingIf = parents[0].get()) {
+SourceLocation PreviousElseLoc = PrecedingIf->getElseLoc();
+if (SM.getExpansionLineNumber(PreviousElseLoc) ==
+SM.getExpansionLineNumber(If->getIfLoc()))
+  return PrecedingIf;
+  }
+  return nullptr;
+}
+
 void MisleadingIndentationCheck::danglingElseCheck(const SourceManager ,
+   ASTContext *Context,
const IfStmt *If) {
   SourceLocation IfLoc = If->getIfLoc();
   SourceLocation ElseLoc = If->getElseLoc();
@@ -29,6 +44,11 @@
   SM.getExpansionLineNumber(ElseLoc))
 return;
 
+  // Find location of first 'if' in a 'if else if' chain.
+  for (auto PrecedingIf = getPrecedingIf(SM, Context, If); PrecedingIf;
+   PrecedingIf = getPrecedingIf(SM, Context, PrecedingIf))
+IfLoc = PrecedingIf->getIfLoc();
+
   if (SM.getExpansionColumnNumber(IfLoc) !=
   SM.getExpansionColumnNumber(ElseLoc))
 diag(ElseLoc, "different indentation for 'if' and corresponding 'else'");
@@ -92,7 +112,7 @@
 
 void MisleadingIndentationCheck::check(const MatchFinder::MatchResult ) 
{
   if (const auto *If = Result.Nodes.getNodeAs("if"))
-danglingElseCheck(*Result.SourceManager, If);
+danglingElseCheck(*Result.SourceManager, Result.Context, If);
 
   if (const auto *CStmt = Result.Nodes.getNodeAs("compound"))
 missingBracesCheck(*Result.SourceManager, CStmt);


Index: test/clang-tidy/readability-misleading-indentation.cpp
===
--- test/clang-tidy/readability-misleading-indentation.cpp
+++ test/clang-tidy/readability-misleading-indentation.cpp
@@ -76,5 +76,31 @@
 {
 }
 
+  if(cond1) {
+  }
+  else if (cond2) {
+  }
+  else {
+  }
+
+  if(cond1) {
+  }
+  else if (cond2) {
+  }
+   else {
+  }
+  // CHECK-MESSAGES: :[[@LINE-2]]:8: warning: different indentation for 'if' and corresponding 'else' [readability-misleading-indentation]
+  
+  if (cond1) {
+if (cond1) {
+}
+else if (cond2) {
+}
+else {
+}
+  }
+  else if (cond2) {
+  }
+
   BLOCK
 }
Index: clang-tidy/readability/MisleadingIndentationCheck.h
===
--- clang-tidy/readability/MisleadingIndentationCheck.h
+++ clang-tidy/readability/MisleadingIndentationCheck.h
@@ -30,7 +30,8 @@
   void check(const ast_matchers::MatchFinder::MatchResult ) override;
 
 private:
-  void danglingElseCheck(const SourceManager , const IfStmt *If);
+  void danglingElseCheck(const SourceManager , ASTContext *Context,
+ const IfStmt *If);
   void missingBracesCheck(const SourceManager , const CompoundStmt 

[PATCH] D30920: Do not pass -Os and -Oz to the Gold plugin

2017-03-16 Thread Pirama Arumuga Nainar via Phabricator via cfe-commits
pirama added a comment.

In https://reviews.llvm.org/D30920#700741, @mehdi_amini wrote:

> In https://reviews.llvm.org/D30920#700574, @hfinkel wrote:
>
> > In https://reviews.llvm.org/D30920#700557, @mehdi_amini wrote:
> >
> > > In https://reviews.llvm.org/D30920#700433, @tejohnson wrote:
> > >
> > > > In https://reviews.llvm.org/D30920#700133, @pcc wrote:
> > > >
> > > > > In https://reviews.llvm.org/D30920#700077, @tejohnson wrote:
> > > > >
> > > > > > Until everything is converted to using size attributes, it seems 
> > > > > > like a correct fix for the bug is to accept these options in the 
> > > > > > gold-plugin and pass through the LTO API to the PassManagerBuilder.
> > > > >
> > > > >
> > > > > Not necessarily. There is no requirement (from a correctness 
> > > > > perspective) that `-Os` at link time should exactly match the 
> > > > > behaviour of `-Os` at compile time.
> > > >
> > > >
> > > > Sure, but there is certainly a perception that optimization flags 
> > > > affecting the non-LTO pipeline should similarly affect the LTO 
> > > > pipeline. LTO should be transparent to the user, so if -Os behaves one 
> > > > way without LTO, it seems problematic to me if it behaves a different 
> > > > way with LTO.
> > > >
> > > > That being said, agree that the best way to enforce that is to pass the 
> > > > relevant flags through the IR. (On the flip side, if the user passes 
> > > > -O1 to the link step, it does get passed through to the plugin and 
> > > > affects the LTO optimization pipeline...)
> > >
> > >
> > > I agree that I don't like the discrepancy: the driver should *not* drop 
> > > -Os silently if it passes down -O1/-O2/-O3, a warning is the minimum.
> >
> >
> > I don't like the discrepancy either, and I agree that we should be passing 
> > these other flags through the IR as well (even though, in the face of 
> > inlining, there is some ambiguity as to what the flags would mean). That 
> > having been said, I don't see the value in the warning. Forcing users to 
> > endure a warning solely because they use LTO and use -Os or -Oz for all of 
> > their compilation steps, is not friendly.
>
>
> The warning here is only about the *link* step.
>
> > The information has been captured already so there's nothing to warn about. 
> > You might worry about the opposite situation (the user uses only -Os or -Oz 
> > on the link step, but not for the compile steps), and that will have no 
> > effect. That, however, should be the expected behavior (optimization is 
> > associated with compiling, not linking, except perhaps for specifically 
> > called-out exceptions). The fact that our other optimization level don't 
> > work that way is a bug, not a feature, that we should fix instead of 
> > further exposing to our users.
>
> Yes, the issue is only about how the driver accepts Os for the link even 
> though it has no effect 
> (O0/https://reviews.llvm.org/owners/package/1//https://reviews.llvm.org/owners/package/2//https://reviews.llvm.org/owners/package/3/
>  *will* have an effect though).


The driver (accepts, but) ignores Os and other optimization flags for non-lto 
link-only actions.  That it has an effect for LTO is seems to be an 
implementation detail.  Since optimization flags are compiler-only options, and 
Clang already silently (without a warning) ignores these flags during link-only 
invocations, silently transforming them when passing to the plugin seems 
reasonable.


https://reviews.llvm.org/D30920



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


[PATCH] D30977: [CodeGen] Emit a CoreFoundation link guard when @available is used

2017-03-16 Thread Alex Lorenz via Phabricator via cfe-commits
arphaman added inline comments.



Comment at: lib/CodeGen/CGObjC.cpp:3428
+  // CoreFoundation is not used in the code, the linker won't link the
+  // framework.
+  auto  = getLLVMContext();

rjmccall wrote:
> Can you explain why compiler-rt has to load the symbol at runtime?  Is this 
> just some compiler-rt testing thing?  Because it seems like a shame to pay a 
> code-size cost — even a negligible one — for something like that.
Because compiler-rt is linked into some internal projects that use the 
`-all_load` flag, so the linker loads `__isOSVersionAtLeast` that references 
the CoreFoundation symbols even when it's not used in code.


Repository:
  rL LLVM

https://reviews.llvm.org/D30977



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


[PATCH] D30896: [Clang-tidy] add check misc-prefer-switch-for-enums

2017-03-16 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

In https://reviews.llvm.org/D30896#702913, @jbcoe wrote:

> I've played around with a few heuristics but it's still far too contentious 
> to have this check on by default and have it warn in places I want warnings. 
> Where should it go?


Perhaps it should live as a private check rather than a public one?

Alternatively, are you aware of any public coding standard rule that matches 
the behavior you want? We tend to be a little more relaxed about chattiness 
when it's part of a check for a public, relatively well-known coding standard 
because it guides the discussion about what constitutes a false positive. As a 
case in point, the CERT module has a check for MSC30-C, which prohibits using 
the `rand()` function. That would be way too contentious of a check normally 
except that it matches the behavior expected of a check against that CERT rule.

I'm not certain we want a module named "chatty", or something like it, for 
checks that are over-eager to diagnose code, but that might be another option. 
It would require a community discussion outside of this code review. 
(Personally, I'd be opposed to such a module, but don't let that dissuade you 
from pitching the idea. I'm just one contributor and my mind can certainly be 
changed in the presence of good rationale.)


Repository:
  rL LLVM

https://reviews.llvm.org/D30896



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


[PATCH] D30991: [Driver] Fix cross compiling with Visual Studio 2017

2017-03-16 Thread Zachary Turner via Phabricator via cfe-commits
zturner added a comment.

In https://reviews.llvm.org/D30991#702965, @thakis wrote:

> When you say "cross-compiling", you mean targeting Windows while running on 
> non-Windows, right? How do dlls get loaded there at all?
>
> Also, when does clang invoke link.exe? Normally on Windows the linker is 
> invoked directly, no through the compiler driver. Are you using clang.exe 
> instead of clang-cl.exe?


I think he means "targeting x86 using an x64 toolchain", but yes, some 
clarification would be helpful.  Also, which DLLs (specifically) are we talking 
about?


https://reviews.llvm.org/D30991



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


[PATCH] D30991: [Driver] Fix cross compiling with Visual Studio 2017

2017-03-16 Thread Nico Weber via Phabricator via cfe-commits
thakis added a comment.

When you say "cross-compiling", you mean targeting Windows while running on 
non-Windows, right? How do dlls get loaded there at all?

Also, when does clang invoke link.exe? Normally on Windows the linker is 
invoked directly, no through the compiler driver. Are you using clang.exe 
instead of clang-cl.exe?


https://reviews.llvm.org/D30991



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


[PATCH] D30991: [Driver] Fix cross compiling with Visual Studio 2017

2017-03-16 Thread Hamza Sood via Phabricator via cfe-commits
hamzasood added a comment.

*dynamic loader
And that's the cross-compiling link.exes that have those requirements. The 
native ones have the required dlls in their containing directories.


https://reviews.llvm.org/D30991



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


[PATCH] D30991: [Driver] Fix cross compiling with Visual Studio 2017

2017-03-16 Thread Hamza Sood via Phabricator via cfe-commits
hamzasood added a comment.

In https://reviews.llvm.org/D30991#702941, @thakis wrote:

> What env vars are needed here? Reading an env file seems a bit inelegant, 
> could we pass the values of these env vars as flags instead?
>
> For example, MSVC2015 needs %INCLUDE%, but for cross-compiling (and for 
> building on Windows without requiring env vars to be set we added the -imsvc 
> flag instead of doing something like this.


The windows dynamic linker uses %PATH% to determine the location of dlls to 
load . link.exe is 
linked against dlls in a directory that usually wouldn't be in %PATH%, so 
launching link.exe will fail if the environment isn't modified.


https://reviews.llvm.org/D30991



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


[PATCH] D31044: Update for alloca construction changes

2017-03-16 Thread Matt Arsenault via Phabricator via cfe-commits
arsenm created this revision.
Herald added a subscriber: wdng.

This is enough to fix the build from the alloca construction API changes. More 
work is needed to be able to really produce code for a target that uses this 
feature


https://reviews.llvm.org/D31044

Files:
  lib/CodeGen/CGBuiltin.cpp
  lib/CodeGen/CGCall.cpp
  lib/CodeGen/CGDecl.cpp
  lib/CodeGen/CGExpr.cpp
  lib/CodeGen/CGObjCGNU.cpp
  lib/CodeGen/CodeGenModule.cpp
  lib/CodeGen/CodeGenTypeCache.h

Index: lib/CodeGen/CodeGenTypeCache.h
===
--- lib/CodeGen/CodeGenTypeCache.h
+++ lib/CodeGen/CodeGenTypeCache.h
@@ -60,6 +60,12 @@
 llvm::PointerType *Int8PtrPtrTy;
   };
 
+  /// void* in address space of allocas
+  union {
+llvm::PointerType *VoidAllocaPtrTy;
+llvm::PointerType *Int8AllocaPtrTy;
+  };
+
   /// The size and alignment of the builtin C type 'int'.  This comes
   /// up enough in various ABI lowering tasks to be worth pre-computing.
   union {
Index: lib/CodeGen/CodeGenModule.cpp
===
--- lib/CodeGen/CodeGenModule.cpp
+++ lib/CodeGen/CodeGenModule.cpp
@@ -111,6 +111,7 @@
 C.getTargetInfo().getMaxPointerWidth());
   Int8PtrTy = Int8Ty->getPointerTo(0);
   Int8PtrPtrTy = Int8PtrTy->getPointerTo(0);
+  Int8AllocaPtrTy = Int8Ty->getPointerTo(M.getDataLayout().getStackAddrSpace());
 
   RuntimeCC = getTargetCodeGenInfo().getABIInfo().getRuntimeCC();
   BuiltinCC = getTargetCodeGenInfo().getABIInfo().getBuiltinCC();
Index: lib/CodeGen/CGObjCGNU.cpp
===
--- lib/CodeGen/CGObjCGNU.cpp
+++ lib/CodeGen/CGObjCGNU.cpp
@@ -1330,7 +1330,8 @@
   Receiver->getType(), IdTy, nullptr);
 
   // FIXME: Is this really supposed to be a dynamic alloca?
-  Address ObjCSuper = Address(Builder.CreateAlloca(ObjCSuperTy),
+  Address ObjCSuper = Address(Builder.CreateAlloca(CGM.getDataLayout(),
+   ObjCSuperTy),
   CGF.getPointerAlign());
 
   Builder.CreateStore(Receiver,
Index: lib/CodeGen/CGExpr.cpp
===
--- lib/CodeGen/CGExpr.cpp
+++ lib/CodeGen/CGExpr.cpp
@@ -71,7 +71,8 @@
 /// block.
 llvm::AllocaInst *CodeGenFunction::CreateTempAlloca(llvm::Type *Ty,
 const Twine ) {
-  return new llvm::AllocaInst(Ty, nullptr, Name, AllocaInsertPt);
+  return new llvm::AllocaInst(Ty, CGM.getDataLayout().getStackAddrSpace(),
+  nullptr, Name, AllocaInsertPt);
 }
 
 /// CreateDefaultAlignTempAlloca - This creates an alloca with the
Index: lib/CodeGen/CGDecl.cpp
===
--- lib/CodeGen/CGDecl.cpp
+++ lib/CodeGen/CGDecl.cpp
@@ -924,15 +924,15 @@
 return nullptr;
 
   llvm::Value *SizeV = llvm::ConstantInt::get(Int64Ty, Size);
-  Addr = Builder.CreateBitCast(Addr, Int8PtrTy);
+  Addr = Builder.CreateBitCast(Addr, Int8AllocaPtrTy);
   llvm::CallInst *C =
   Builder.CreateCall(CGM.getLLVMLifetimeStartFn(), {SizeV, Addr});
   C->setDoesNotThrow();
   return SizeV;
 }
 
 void CodeGenFunction::EmitLifetimeEnd(llvm::Value *Size, llvm::Value *Addr) {
-  Addr = Builder.CreateBitCast(Addr, Int8PtrTy);
+  Addr = Builder.CreateBitCast(Addr, Int8AllocaPtrTy);
   llvm::CallInst *C =
   Builder.CreateCall(CGM.getLLVMLifetimeEndFn(), {Size, Addr});
   C->setDoesNotThrow();
@@ -1096,7 +1096,8 @@
 llvm::Type *llvmTy = ConvertTypeForMem(elementType);
 
 // Allocate memory for the array.
-llvm::AllocaInst *vla = Builder.CreateAlloca(llvmTy, elementCount, "vla");
+llvm::AllocaInst *vla = Builder.CreateAlloca(CGM.getDataLayout(),
+ llvmTy, elementCount, "vla");
 vla->setAlignment(alignment.getQuantity());
 
 address = Address(vla, alignment);
@@ -1727,18 +1728,16 @@
 /// Lazily declare the @llvm.lifetime.start intrinsic.
 llvm::Constant *CodeGenModule::getLLVMLifetimeStartFn() {
   if (LifetimeStartFn) return LifetimeStartFn;
-  llvm::Type *PtrTy = llvm::PointerType::getInt8PtrTy(getLLVMContext());
   LifetimeStartFn = llvm::Intrinsic::getDeclaration(
-(), llvm::Intrinsic::lifetime_start, { PtrTy });
+(), llvm::Intrinsic::lifetime_start, { Int8AllocaPtrTy });
   return LifetimeStartFn;
 }
 
 /// Lazily declare the @llvm.lifetime.end intrinsic.
 llvm::Constant *CodeGenModule::getLLVMLifetimeEndFn() {
   if (LifetimeEndFn) return LifetimeEndFn;
-  llvm::Type *PtrTy = llvm::PointerType::getInt8PtrTy(getLLVMContext());
   LifetimeEndFn = llvm::Intrinsic::getDeclaration(
-(), llvm::Intrinsic::lifetime_end, { PtrTy });
+(), llvm::Intrinsic::lifetime_end, { Int8AllocaPtrTy });
   return LifetimeEndFn;
 }
 
Index: lib/CodeGen/CGCall.cpp
===
--- 

[PATCH] D30991: [Driver] Fix cross compiling with Visual Studio 2017

2017-03-16 Thread Nico Weber via Phabricator via cfe-commits
thakis added a comment.

What env vars are needed here? Reading an env file seems a bit inelegant, could 
we pass the values of these env vars as flags instead?

For example, MSVC2015 needs %INCLUDE%, but for cross-compiling (and for 
building on Windows without requiring env vars to be set we added the -imsvc 
flag instead of doing something like this.


https://reviews.llvm.org/D30991



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


[PATCH] D31043: Update for lifetime intrinsic signature change

2017-03-16 Thread Matt Arsenault via Phabricator via cfe-commits
arsenm created this revision.
Herald added a subscriber: wdng.

https://reviews.llvm.org/D31043

Files:
  lib/CodeGen/CGDecl.cpp
  test/CodeGen/cleanup-destslot-simple.c
  test/CodeGen/lifetime-asan.c
  test/CodeGen/lifetime2.c
  test/CodeGen/temporary-lifetime-exceptions.cpp
  test/CodeGen/temporary-lifetime.cpp
  test/CodeGenCXX/destructors.cpp
  test/CodeGenCXX/microsoft-abi-eh-cleanups.cpp
  test/CodeGenCXX/nrvo.cpp
  test/CodeGenObjC/arc-blocks.m
  test/CodeGenObjC/arc-precise-lifetime.m
  test/CodeGenObjC/arc-ternary-op.m
  test/CodeGenObjC/arc.m
  test/CodeGenObjC/exceptions.m
  test/CodeGenObjCXX/arc-move.mm
  test/CodeGenObjCXX/arc-references.mm
  test/CodeGenObjCXX/arc.mm
  test/CodeGenObjCXX/literals.mm

Index: test/CodeGenObjCXX/literals.mm
===
--- test/CodeGenObjCXX/literals.mm
+++ test/CodeGenObjCXX/literals.mm
@@ -21,7 +21,7 @@
 
   // Initializing first element
   // CHECK: [[PTR1:%.*]] = bitcast i8** [[ARR]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.start(i64 8, i8* [[PTR1]])
+  // CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 8, i8* [[PTR1]])
   // CHECK: [[ELEMENT0:%[a-zA-Z0-9.]+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[OBJECTS]], i64 0, i64 0
   // CHECK-NEXT: call void @_ZN1XC1Ev
   // CHECK-NEXT: [[OBJECT0:%[a-zA-Z0-9.]+]] = invoke i8* @_ZNK1XcvP11objc_objectEv
@@ -51,7 +51,7 @@
   // CHECK-NOT: ret void
   // CHECK: call void @objc_release
   // CHECK-NEXT: [[PTR2:%.*]] = bitcast i8** [[ARR]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.end(i64 8, i8* [[PTR2]])
+  // CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 8, i8* [[PTR2]])
   // CHECK-NEXT: ret void
 
   // Check cleanups
@@ -73,7 +73,7 @@
 
   // Initializing first element
   // CHECK:  [[PTR1:%.*]] = bitcast i8** [[ARR]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.start(i64 8, i8* [[PTR1]])
+  // CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 8, i8* [[PTR1]])
   // CHECK: [[ELEMENT0:%[a-zA-Z0-9.]+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[OBJECTS]], i64 0, i64 0
   // CHECK-NEXT: call void @_ZN1XC1Ev
   // CHECK-NEXT: [[OBJECT0:%[a-zA-Z0-9.]+]] = invoke i8* @_ZNK1XcvP11objc_objectEv
@@ -103,7 +103,7 @@
   // CHECK-NOT: ret void
   // CHECK: call void @objc_release
   // CHECK-NEXT: [[PTR2]] = bitcast i8** [[ARR]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.end(i64 8, i8* [[PTR2]])
+  // CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 8, i8* [[PTR2]])
   // CHECK-NEXT: ret void
 
   // Check cleanups
Index: test/CodeGenObjCXX/arc.mm
===
--- test/CodeGenObjCXX/arc.mm
+++ test/CodeGenObjCXX/arc.mm
@@ -65,10 +65,10 @@
   // CHECK-NEXT: [[CONDCLEANUP:%.*]] = alloca i1
   // CHECK-NEXT: store i32
   // CHECK-NEXT: [[STRONGP:%.*]] = bitcast i8** [[STRONG]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.start(i64 8, i8* [[STRONGP]])
+  // CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 8, i8* [[STRONGP]])
   // CHECK-NEXT: store i8* null, i8** [[STRONG]]
   // CHECK-NEXT: [[WEAKP:%.*]] = bitcast i8** [[WEAK]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.start(i64 8, i8* [[WEAKP]])
+  // CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 8, i8* [[WEAKP]])
   // CHECK-NEXT: call i8* @objc_initWeak(i8** [[WEAK]], i8* null)
 
   // CHECK-NEXT: [[T0:%.*]] = load i32, i32* [[COND]]
@@ -316,7 +316,7 @@
 // CHECK:  [[X:%.*]] = alloca i8*
 // CHECK-NEXT: [[TEMP:%.*]] = alloca i8*
 // CHECK-NEXT: [[XP:%.*]] = bitcast i8** [[X]] to i8*
-// CHECK-NEXT: call void @llvm.lifetime.start(i64 8, i8* [[XP]])
+// CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 8, i8* [[XP]])
 // CHECK-NEXT: store i8* null, i8** [[X]]
 // CHECK:  [[T0:%.*]] = load i8*, i8** [[X]]
 // CHECK-NEXT: store i8* [[T0]], i8** [[TEMP]]
Index: test/CodeGenObjCXX/arc-references.mm
===
--- test/CodeGenObjCXX/arc-references.mm
+++ test/CodeGenObjCXX/arc-references.mm
@@ -45,7 +45,7 @@
   // CHECK-NEXT: call void @_Z6calleev()
   callee();
   // CHECK-NEXT: [[PTR:%.*]] = bitcast i8*** [[REF]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.end(i64 8, i8* [[PTR]])
+  // CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 8, i8* [[PTR]])
   // CHECK-NEXT: call void @objc_destroyWeak
   // CHECK-NEXT: ret void
 }
@@ -75,11 +75,11 @@
   // CHECK-NEXT: [[OBJ_ID:%[a-zA-Z0-9]+]] = bitcast [[A]]* [[OBJ_A]] to i8*
   // CHECK-NEXT: call void @objc_release
   // CHECK-NEXT: [[IPTR1:%.*]] = bitcast i32* [[I]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.start(i64 4, i8* [[IPTR1]])
+  // CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 4, i8* [[IPTR1]])
   // CHECK-NEXT: store i32 17, i32
   int i = 17;
   // CHECK-NEXT: [[IPTR2:%.*]] = bitcast i32* [[I]] to i8*
-  // CHECK-NEXT: call void @llvm.lifetime.end(i64 4, i8* [[IPTR2]])
+  // CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 4, i8* [[IPTR2]])
   // 

[PATCH] D30896: [Clang-tidy] add check misc-prefer-switch-for-enums

2017-03-16 Thread Jonathan B Coe via Phabricator via cfe-commits
jbcoe added a comment.

I've played around with a few heuristics but it's still far too contentious to 
have this check on by default and have it warn in places I want warnings. Where 
should it go?


Repository:
  rL LLVM

https://reviews.llvm.org/D30896



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


[PATCH] D27800: Add overload of TransformToPotentiallyEvaluated for TypeSourceInfo

2017-03-16 Thread Eli Friedman via Phabricator via cfe-commits
efriedma added inline comments.



Comment at: test/SemaCXX/pr31042.cpp:1
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm -disable-free %s
+

You need to use "-o -" or something like that to avoid generating a file 
pr31042.ll.  Also, a comment explaining why this test is using -emit-llvm would 
be nice.


https://reviews.llvm.org/D27800



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


[PATCH] D30991: [Driver] Fix cross compiling with Visual Studio 2017

2017-03-16 Thread Hamza Sood via Phabricator via cfe-commits
hamzasood updated this revision to Diff 92019.
hamzasood added a comment.

- Added an assertion in Command::Execute to ensure the environment vector is 
null-terminated before using it.
- Split Command::setEnvironment so that there's an overload to specifically 
handle the case where the input vector is to be copied in. While this adds a 
small amount of extra code complexity, it allows us to reduce the worst case 
from two copies (copy into the function, re-allocate/copy when appending the 
null-terminator) to just one. Considering the non-trivial size of environment 
blocks (and that we're already quite inefficient by going from UTF16 -> UTF8 -> 
UTF16), I think it's worth the few extra lines of code. However it's simple to 
revert if anyone disagrees.


https://reviews.llvm.org/D30991

Files:
  include/clang/Driver/Job.h
  lib/Driver/Job.cpp
  lib/Driver/ToolChains/MSVC.cpp

Index: lib/Driver/ToolChains/MSVC.cpp
===
--- lib/Driver/ToolChains/MSVC.cpp
+++ lib/Driver/ToolChains/MSVC.cpp
@@ -34,7 +34,7 @@
 // Include the necessary headers to interface with the Windows registry and
 // environment.
 #if defined(LLVM_ON_WIN32)
-#define USE_WIN32
+  #define USE_WIN32
 #endif
 
 #ifdef USE_WIN32
@@ -47,20 +47,20 @@
 #endif
 
 #ifdef _MSC_VER
-// Don't support SetupApi on MinGW.
-#define USE_MSVC_SETUP_API
+  // Don't support SetupApi on MinGW.
+  #define USE_MSVC_SETUP_API
 
-// Make sure this comes before MSVCSetupApi.h
-#include 
+  // Make sure this comes before MSVCSetupApi.h
+  #include 
 
-#include "MSVCSetupApi.h"
-#include "llvm/Support/COM.h"
-_COM_SMARTPTR_TYPEDEF(ISetupConfiguration, __uuidof(ISetupConfiguration));
-_COM_SMARTPTR_TYPEDEF(ISetupConfiguration2, __uuidof(ISetupConfiguration2));
-_COM_SMARTPTR_TYPEDEF(ISetupHelper, __uuidof(ISetupHelper));
-_COM_SMARTPTR_TYPEDEF(IEnumSetupInstances, __uuidof(IEnumSetupInstances));
-_COM_SMARTPTR_TYPEDEF(ISetupInstance, __uuidof(ISetupInstance));
-_COM_SMARTPTR_TYPEDEF(ISetupInstance2, __uuidof(ISetupInstance2));
+  #include "MSVCSetupApi.h"
+  #include "llvm/Support/COM.h"
+  _COM_SMARTPTR_TYPEDEF(ISetupConfiguration, __uuidof(ISetupConfiguration));
+  _COM_SMARTPTR_TYPEDEF(ISetupConfiguration2, __uuidof(ISetupConfiguration2));
+  _COM_SMARTPTR_TYPEDEF(ISetupHelper, __uuidof(ISetupHelper));
+  _COM_SMARTPTR_TYPEDEF(IEnumSetupInstances, __uuidof(IEnumSetupInstances));
+  _COM_SMARTPTR_TYPEDEF(ISetupInstance, __uuidof(ISetupInstance));
+  _COM_SMARTPTR_TYPEDEF(ISetupInstance2, __uuidof(ISetupInstance2));
 #endif
 
 using namespace clang::driver;
@@ -446,6 +446,8 @@
 
   TC.addProfileRTLibs(Args, CmdArgs);
 
+  std::vector Environment;
+
   // We need to special case some linker paths.  In the case of lld, we need to
   // translate 'lld' into 'lld-link', and in the case of the regular msvc
   // linker, we need to use a special search algorithm.
@@ -459,6 +461,68 @@
 // from the program PATH, because other environments like GnuWin32 install
 // their own link.exe which may come first.
 linkPath = FindVisualStudioExecutable(TC, "link.exe");
+
+#ifdef USE_WIN32
+// When cross-compiling with VS2017 or newer, link.exe expects to have
+// its containing bin directory at the top of PATH, followed by the
+// native target bin directory.
+// e.g. when compiling for x86 on an x64 host, PATH should start with:
+// /bin/HostX64/x86;/bin/HostX64/x64
+if (TC.getIsVS2017OrNewer() &&
+llvm::Triple(llvm::sys::getProcessTriple()).getArch() != TC.getArch()) {
+  auto HostArch = llvm::Triple(llvm::sys::getProcessTriple()).getArch();
+
+  auto EnvBlockWide = std::unique_ptr(
+GetEnvironmentStringsW(), FreeEnvironmentStringsW);
+  if (!EnvBlockWide)
+goto SkipSettingEnvironment;
+
+  size_t EnvCount = 0;
+  size_t EnvBlockLen = 0;
+  while (EnvBlockWide[EnvBlockLen] != L'\0') {
+++EnvCount;
+EnvBlockLen += std::wcslen([EnvBlockLen])
+   + 1/*string null-terminator*/;
+  }
+  ++EnvBlockLen;  // add the block null-terminator
+
+  std::string EnvBlock;
+  if (!llvm::convertUTF16ToUTF8String(
+ llvm::ArrayRef(reinterpret_cast(EnvBlockWide.get()),
+  EnvBlockLen * sizeof(EnvBlockWide[0])),
+ EnvBlock))
+goto SkipSettingEnvironment;
+
+  Environment.reserve(EnvCount + 1);
+
+  // Now loop over each string in the block and copy them into the
+  // environment vector, adjusting the PATH variable as needed when we
+  // find it.
+  for (const char *Cursor = EnvBlock.data(); *Cursor != '\0';) {
+llvm::StringRef EnvVar(Cursor);
+if (EnvVar.startswith_lower("path=")) {
+  using SubDirectoryType = toolchains::MSVCToolChain::SubDirectoryType;
+  constexpr size_t PrefixLen = 5;  // 

[PATCH] D31019: [clangd] [RFC] Use libclang and CXTranslationUnit instead of ASTUnit

2017-03-16 Thread Marc-Andre Laperle via Phabricator via cfe-commits
malaperle-ericsson abandoned this revision.
malaperle-ericsson added a comment.

Abandoned because of wrong approach.


Repository:
  rL LLVM

https://reviews.llvm.org/D31019



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


[PATCH] D31019: [clangd] [RFC] Use libclang and CXTranslationUnit instead of ASTUnit

2017-03-16 Thread Marc-Andre Laperle via Phabricator via cfe-commits
malaperle-ericsson added a comment.

Perfect. Thanks a lot for the explanation!


Repository:
  rL LLVM

https://reviews.llvm.org/D31019



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


[PATCH] D31006: [Objective-C] Fix "weak-unavailable" warning with -fobjc-weak

2017-03-16 Thread John McCall via Phabricator via cfe-commits
rjmccall added inline comments.



Comment at: lib/Sema/SemaCast.cpp:125
+  assert(Self.getLangOpts().ObjCAutoRefCount ||
+ Self.getLangOpts().ObjCWeak);
 

Unlike the other patches, we do clearly need to be checking the language 
options in places like this.  Still, it's a shame to repeat the same condition 
in a million places.

I think the right thing to do here is to add a helper method to LangOpts:

  /// Returns true if any types in the program might have non-trivial lifetime 
qualifiers.
  bool allowsNonTrivialObjCLifetimeQualifiers() const {
return ObjCAutoRefCount || ObjCWeak;
  }


https://reviews.llvm.org/D31006



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


[PATCH] D31034: [X86][AVX512][Clang][Intrinsics] Adding missing intrinsics to Clang .

2017-03-16 Thread Craig Topper via Phabricator via cfe-commits
craig.topper added inline comments.



Comment at: lib/Headers/avx512fintrin.h:9633
 static __inline __m512i __DEFAULT_FN_ATTRS
+_mm512_set_epi8 (char e63, char e62, char e61, char e60, char e59,
+char e58, char e57, char e56, char e55, char e54, char e53, char e52,

Isn't the convention to prefix all variable names in intrinsics with 2 leading 
underscores except when they are macros?


Repository:
  rL LLVM

https://reviews.llvm.org/D31034



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


[PATCH] D30977: [CodeGen] Emit a CoreFoundation link guard when @available is used

2017-03-16 Thread John McCall via Phabricator via cfe-commits
rjmccall added inline comments.



Comment at: lib/CodeGen/CGObjC.cpp:3423
+return;
+  if (!IsOSVersionAtLeastFn)
+return;

Reverse these checks, please; IsOSVersionAtLeastFn is much cheaper to check and 
will predominantly be null.



Comment at: lib/CodeGen/CGObjC.cpp:3428
+  // CoreFoundation is not used in the code, the linker won't link the
+  // framework.
+  auto  = getLLVMContext();

Can you explain why compiler-rt has to load the symbol at runtime?  Is this 
just some compiler-rt testing thing?  Because it seems like a shame to pay a 
code-size cost — even a negligible one — for something like that.


Repository:
  rL LLVM

https://reviews.llvm.org/D30977



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


r297961 - [ObjC][Sema] Avoid ARC performSelector error for 'self' selector

2017-03-16 Thread Alex Lorenz via cfe-commits
Author: arphaman
Date: Thu Mar 16 11:36:11 2017
New Revision: 297961

URL: http://llvm.org/viewvc/llvm-project?rev=297961=rev
Log:
[ObjC][Sema] Avoid ARC performSelector error for 'self' selector

The instance method 'self' does not actually return an over-retained object,
so we shouldn't report an error when it's used with 'performSelector'.

rdar://31071620

Modified:
cfe/trunk/lib/Sema/SemaExprObjC.cpp
cfe/trunk/test/SemaObjC/arc-peformselector.m

Modified: cfe/trunk/lib/Sema/SemaExprObjC.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprObjC.cpp?rev=297961=297960=297961=diff
==
--- cfe/trunk/lib/Sema/SemaExprObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprObjC.cpp Thu Mar 16 11:36:11 2017
@@ -3010,7 +3010,6 @@ ExprResult Sema::BuildInstanceMessage(Ex
   case OMF_copy:
   case OMF_mutableCopy:
   case OMF_new:
-  case OMF_self:
   case OMF_init:
 // Issue error, unless ns_returns_not_retained.
 if (!SelMethod->hasAttr()) {

Modified: cfe/trunk/test/SemaObjC/arc-peformselector.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/arc-peformselector.m?rev=297961=297960=297961=diff
==
--- cfe/trunk/test/SemaObjC/arc-peformselector.m (original)
+++ cfe/trunk/test/SemaObjC/arc-peformselector.m Thu Mar 16 11:36:11 2017
@@ -8,6 +8,7 @@
 - (id) init __attribute__((ns_returns_not_retained));
 - (id)PlusZero;
 - (id)PlusOne __attribute__((ns_returns_retained)); // expected-note {{method 
'PlusOne' declared here}}
+- (id)self;
 @end
 
 @interface I : NSObject
@@ -31,6 +32,8 @@
 
   return [self performSelector : @selector(PlusZero)];
   return [self performSelector : @selector(PlusOne)]; // expected-error 
{{performSelector names a selector which retains the object}}
+
+  return [self performSelector: @selector(self)]; // No error, -self is not +1!
 }
 
 - (id)performSelector:(SEL)aSelector { return 0; }


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


[PATCH] D31007: [Objective-C] Miscellaneous -fobjc-weak Fixes

2017-03-16 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment.

Same thing about parts of this patch — please try to just check 
T.hasNonTrivialObjCLifetime() when reasonable.

Thank you for all this, by the way. :)


https://reviews.llvm.org/D31007



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


[PATCH] D31019: [clangd] [RFC] Use libclang and CXTranslationUnit instead of ASTUnit

2017-03-16 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer added a comment.

libclang is supposed to be used for bindings to other languages (it's a pure C 
interface) and its stable. ASTUnit is the C++ side of libclang, libclang is 
just a thin wrapper around ASTUnit. ASTUnit itself suffers from lots of 
technical debt because clang changed since ASTUnit was created and ASTUnit was 
never refactored to accommodate that.

Even in the current state using ASTUnit gives you more control over clang, e.g. 
it lets you use the VFS which is not exposed in libclang. At some point we're 
going to need a cleaner replacement for ASTUnit, but currently it's the only 
place in clang that supports the precompiled preamble needed for speedy code 
completion.


Repository:
  rL LLVM

https://reviews.llvm.org/D31019



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


[PATCH] D31004: [Objective-C] Fix __weak type traits with -fobjc-weak

2017-03-16 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment.

I have similar feedback here to the other patch.  Please try to see if there's 
some reasonable way to make this dependent just on the lifetime qualifier 
without paying attention to the language options.  If we, say, decide to start 
supporting __strong in non-ARC modes, it'd be nice if that just worked without 
having to revisit all of this code.


https://reviews.llvm.org/D31004



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


[PATCH] D31003: [Objective-C] C++ Classes with __weak Members non-POD Types when using -fobjc-weak

2017-03-16 Thread John McCall via Phabricator via cfe-commits
rjmccall added inline comments.



Comment at: lib/AST/DeclCXX.cpp:727
+  !(Context.getLangOpts().ObjCWeak &&
+T.getObjCLifetime() == Qualifiers::OCL_Weak)) {
 setHasObjectMember(true);

Similarly, I think the best way of expressing this is to re-arrange the blocks 
like so:

  if (T.hasNonTrivialObjCLifetime()) {
// Objective-C Automatic Reference Counting:
//   If a class has a non-static data member of Objective-C pointer
//   type (or array thereof), it is a non-POD type and its
//   default constructor (if any), copy constructor, move constructor,
//   copy assignment operator, move assignment operator, and destructor are
//   non-trivial.
setHasObjectMember(true);
struct DefinitionData  = data();
Data.PlainOldData = false;
Data.HasTrivialSpecialMembers = 0;
Data.HasIrrelevantDestructor = false;
  } else if (!Context.getLangOpts().ObjCAutoRefCount) {
setHasObjectMember(true);
  }



Comment at: lib/Sema/SemaDeclCXX.cpp:4407
+   (SemaRef.getLangOpts().ObjCWeak &&
+FieldBaseElementType.getObjCLifetime() == Qualifiers::OCL_Weak))) {
+// ARC and Weak:

I think this entire check can just be:

  if (FieldBaseElementType.hasNonTrivialObjCLifetime())

The language-options checks are almost certainly slower than just checking the 
qualifiers.


https://reviews.llvm.org/D31003



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


[PATCH] D27387: [libc++] Add a key function for bad_function_call

2017-03-16 Thread James Y Knight via Phabricator via cfe-commits
jyknight added a comment.

Since this is only adding a new export to libc++, not changing/breaking 
existing ones, I don't think it should be grouped with the ABI-breaking changes 
in v2.

The usual promise is that upgrading libc++.so.1 will not break apps compiled 
against an older set of headers, not that you're able to compile against a new 
set of headers and then run on an old libc++.so.1.

That is, even if the use of the new export is put under a #ifdef, it seems like 
it ought to default "on".


https://reviews.llvm.org/D27387



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


[PATCH] D31019: [clangd] [RFC] Use libclang and CXTranslationUnit instead of ASTUnit

2017-03-16 Thread Marc-Andre Laperle via Phabricator via cfe-commits
malaperle-ericsson added a subscriber: bkramer.
malaperle-ericsson added a comment.

In https://reviews.llvm.org/D31019#702631, @bkramer wrote:

> It's not. the goal is to get rid of ASTUnit inside of clangd in the long term 
> as it's a big problem for extensibility. libclang is just a wrapper for 
> ASTUnit, with even more problems.
>
> If you want to get completion running, just call ASTUnit::CodeComplete.


Thanks a lot. When you say the goal is to get rid of ASTUnit, what would it be 
replaced with? Also, why would one use libclang over ASTUnit (libclangFrontend) 
then? Perhaps there's some documentation listing the pros and cons?


Repository:
  rL LLVM

https://reviews.llvm.org/D31019



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


[PATCH] D30158: [clang-tidy] modernize: Find usage of random_shuffle and replace it with shuffle.

2017-03-16 Thread Jonathan Roelofs via Phabricator via cfe-commits
jroelofs added a comment.

In https://reviews.llvm.org/D30158#702760, @madsravn wrote:

> In https://reviews.llvm.org/D30158#699342, @jroelofs wrote:
>
> > In https://reviews.llvm.org/D30158#699132, @madsravn wrote:
> >
> > > In https://reviews.llvm.org/D30158#698871, @aaron.ballman wrote:
> > >
> > > > In https://reviews.llvm.org/D30158#696534, @madsravn wrote:
> > > >
> > > > > Any updates on this?
> > > >
> > > >
> > > > Have you run it over the test suite on the revision before 
> > > > random_shuffle was removed from libc++?
> > >
> > >
> > > I can't find any more tests for random_shuffle. I have looked in the SVN 
> > > log for from december 2014 until now. It works on the three tests 
> > > currently in trunk.
> >
> >
> > Try just before r294328.
>
>
> I can't see any random_shuffle tests in the libc++ repo before r294328 
> either. I don't know if they aren't there or if I just can't find them. Would 
> you be able to point them out for me with revision and path?


Did you look at the diff from the commit I mentioned? That's the one that 
removed them.


https://reviews.llvm.org/D30158



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


Re: r297861 - Don't use MSVC Setup Api on MinGW.

2017-03-16 Thread Zachary Turner via cfe-commits
Pretty sure It's the latter. I don't use MinGW enough enough to know how
compatible it is with msvc, but this uses a bunch of COM APIs and funny
Microsoftisms like declspec(novtable), declspec(uuid), etc, and the MinGW
bot was throwing hundreds of compiler errors. If there's a way to make it
work I'm happy to try
On Thu, Mar 16, 2017 at 8:23 AM Nico Weber  wrote:

> Should this be a compile-time thing? I thought in general we try to make
> clang-built-with-msvc and clang-built-with-mingw behave roughly the same
> except for a different default triple, i.e. maybe this should be keyed off
> the triple at runtime instead of with a compile-time ifdef. Or do some of
> the APIs the 2017 path calls not exist in mingw?
>
> On Wed, Mar 15, 2017 at 1:09 PM, Zachary Turner via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
> Author: zturner
> Date: Wed Mar 15 12:09:36 2017
> New Revision: 297861
>
> URL: http://llvm.org/viewvc/llvm-project?rev=297861=rev
> Log:
> Don't use MSVC Setup Api on MinGW.
>
> Modified:
> cfe/trunk/lib/Driver/ToolChains/MSVC.cpp
>
> Modified: cfe/trunk/lib/Driver/ToolChains/MSVC.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/MSVC.cpp?rev=297861=297860=297861=diff
>
> ==
> --- cfe/trunk/lib/Driver/ToolChains/MSVC.cpp (original)
> +++ cfe/trunk/lib/Driver/ToolChains/MSVC.cpp Wed Mar 15 12:09:36 2017
> @@ -44,6 +44,11 @@
>  #define NOMINMAX
>#endif
>#include 
> +#endif
> +
> +#ifdef _MSC_VER
> +// Don't support SetupApi on MinGW.
> +#define USE_MSVC_SETUP_API
>
>  // Make sure this comes before MSVCSetupApi.h
>  #include 
> @@ -170,7 +175,7 @@ static bool findVCToolChainViaEnvironmen
>  // longer listed in the registry.
>  static bool findVCToolChainViaSetupConfig(std::string ,
>bool ) {
> -#if !defined(USE_WIN32)
> +#if !defined(USE_MSVC_SETUP_API)
>return false;
>  #else
>// FIXME: This really should be done once in the top-level program's
> main
>
>
> ___
> 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


[PATCH] D31029: [analyzer] Fix logical not for pointers with different bit width

2017-03-16 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki added a comment.

I am not sure where to look. I heard somebody say OpenCL has different pointer 
widths.


Repository:
  rL LLVM

https://reviews.llvm.org/D31029



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


Re: r297861 - Don't use MSVC Setup Api on MinGW.

2017-03-16 Thread Nico Weber via cfe-commits
Should this be a compile-time thing? I thought in general we try to make
clang-built-with-msvc and clang-built-with-mingw behave roughly the same
except for a different default triple, i.e. maybe this should be keyed off
the triple at runtime instead of with a compile-time ifdef. Or do some of
the APIs the 2017 path calls not exist in mingw?

On Wed, Mar 15, 2017 at 1:09 PM, Zachary Turner via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: zturner
> Date: Wed Mar 15 12:09:36 2017
> New Revision: 297861
>
> URL: http://llvm.org/viewvc/llvm-project?rev=297861=rev
> Log:
> Don't use MSVC Setup Api on MinGW.
>
> Modified:
> cfe/trunk/lib/Driver/ToolChains/MSVC.cpp
>
> Modified: cfe/trunk/lib/Driver/ToolChains/MSVC.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/
> ToolChains/MSVC.cpp?rev=297861=297860=297861=diff
> 
> ==
> --- cfe/trunk/lib/Driver/ToolChains/MSVC.cpp (original)
> +++ cfe/trunk/lib/Driver/ToolChains/MSVC.cpp Wed Mar 15 12:09:36 2017
> @@ -44,6 +44,11 @@
>  #define NOMINMAX
>#endif
>#include 
> +#endif
> +
> +#ifdef _MSC_VER
> +// Don't support SetupApi on MinGW.
> +#define USE_MSVC_SETUP_API
>
>  // Make sure this comes before MSVCSetupApi.h
>  #include 
> @@ -170,7 +175,7 @@ static bool findVCToolChainViaEnvironmen
>  // longer listed in the registry.
>  static bool findVCToolChainViaSetupConfig(std::string ,
>bool ) {
> -#if !defined(USE_WIN32)
> +#if !defined(USE_MSVC_SETUP_API)
>return false;
>  #else
>// FIXME: This really should be done once in the top-level program's
> main
>
>
> ___
> 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


[PATCH] D31034: [X86][AVX512][Clang][Intrinsics] Adding missing intrinsics to Clang .

2017-03-16 Thread Igor Breger via Phabricator via cfe-commits
igorb created this revision.

Adding missing intrinsics :

  _mm512_set_epi16, 
  _mm512_set_epi8,
  _mm512_permutevar_epi32
  _mm512_mask_permutevar_epi32 


Repository:
  rL LLVM

https://reviews.llvm.org/D31034

Files:
  lib/Headers/avx512fintrin.h
  test/CodeGen/avx512f-builtins.c

Index: test/CodeGen/avx512f-builtins.c
===
--- test/CodeGen/avx512f-builtins.c
+++ test/CodeGen/avx512f-builtins.c
@@ -7712,6 +7712,133 @@
   return _mm512_mask_set1_epi32 ( __O, __M, __A);
 }
 
+__m512i test_mm512_set_epi8(char e63, char e62, char e61, char e60, char e59,
+char e58, char e57, char e56, char e55, char e54, char e53, char e52,
+char e51, char e50, char e49, char e48, char e47, char e46, char e45,
+char e44, char e43, char e42, char e41, char e40, char e39, char e38,
+char e37, char e36, char e35, char e34, char e33, char e32, char e31,
+char e30, char e29, char e28, char e27, char e26, char e25, char e24,
+char e23, char e22, char e21, char e20, char e19, char e18, char e17,
+char e16, char e15, char e14, char e13, char e12, char e11, char e10,
+char e9, char e8, char e7, char e6, char e5, char e4, char e3, char e2,
+char e1, char e0) {
+
+  //CHECK-LABEL: @test_mm512_set_epi8
+  //CHECK: load i8, i8* %e63.addr, align 1
+   //CHECK: load i8, i8* %e62.addr, align 1
+   //CHECK: load i8, i8* %e61.addr, align 1
+   //CHECK: load i8, i8* %e60.addr, align 1
+   //CHECK: load i8, i8* %e59.addr, align 1
+   //CHECK: load i8, i8* %e58.addr, align 1
+   //CHECK: load i8, i8* %e57.addr, align 1
+   //CHECK: load i8, i8* %e56.addr, align 1
+   //CHECK: load i8, i8* %e55.addr, align 1
+   //CHECK: load i8, i8* %e54.addr, align 1
+   //CHECK: load i8, i8* %e53.addr, align 1
+   //CHECK: load i8, i8* %e52.addr, align 1
+   //CHECK: load i8, i8* %e51.addr, align 1
+   //CHECK: load i8, i8* %e50.addr, align 1
+   //CHECK: load i8, i8* %e49.addr, align 1
+   //CHECK: load i8, i8* %e48.addr, align 1
+   //CHECK: load i8, i8* %e47.addr, align 1
+   //CHECK: load i8, i8* %e46.addr, align 1
+   //CHECK: load i8, i8* %e45.addr, align 1
+   //CHECK: load i8, i8* %e44.addr, align 1
+   //CHECK: load i8, i8* %e43.addr, align 1
+   //CHECK: load i8, i8* %e42.addr, align 1
+   //CHECK: load i8, i8* %e41.addr, align 1
+   //CHECK: load i8, i8* %e40.addr, align 1
+   //CHECK: load i8, i8* %e39.addr, align 1
+   //CHECK: load i8, i8* %e38.addr, align 1
+   //CHECK: load i8, i8* %e37.addr, align 1
+   //CHECK: load i8, i8* %e36.addr, align 1
+   //CHECK: load i8, i8* %e35.addr, align 1
+   //CHECK: load i8, i8* %e34.addr, align 1
+   //CHECK: load i8, i8* %e33.addr, align 1
+   //CHECK: load i8, i8* %e32.addr, align 1
+   //CHECK: load i8, i8* %e31.addr, align 1
+   //CHECK: load i8, i8* %e30.addr, align 1
+   //CHECK: load i8, i8* %e29.addr, align 1
+   //CHECK: load i8, i8* %e28.addr, align 1
+   //CHECK: load i8, i8* %e27.addr, align 1
+   //CHECK: load i8, i8* %e26.addr, align 1
+   //CHECK: load i8, i8* %e25.addr, align 1
+   //CHECK: load i8, i8* %e24.addr, align 1
+   //CHECK: load i8, i8* %e23.addr, align 1
+   //CHECK: load i8, i8* %e22.addr, align 1
+   //CHECK: load i8, i8* %e21.addr, align 1
+   //CHECK: load i8, i8* %e20.addr, align 1
+   //CHECK: load i8, i8* %e19.addr, align 1
+   //CHECK: load i8, i8* %e18.addr, align 1
+   //CHECK: load i8, i8* %e17.addr, align 1
+   //CHECK: load i8, i8* %e16.addr, align 1
+   //CHECK: load i8, i8* %e15.addr, align 1
+   //CHECK: load i8, i8* %e14.addr, align 1
+   //CHECK: load i8, i8* %e13.addr, align 1
+   //CHECK: load i8, i8* %e12.addr, align 1
+   //CHECK: load i8, i8* %e11.addr, align 1
+   //CHECK: load i8, i8* %e10.addr, align 1
+   //CHECK: load i8, i8* %e9.addr, align 1
+   //CHECK: load i8, i8* %e8.addr, align 1
+   //CHECK: load i8, i8* %e7.addr, align 1
+   //CHECK: load i8, i8* %e6.addr, align 1
+   //CHECK: load i8, i8* %e5.addr, align 1
+   //CHECK: load i8, i8* %e4.addr, align 1
+   //CHECK: load i8, i8* %e3.addr, align 1
+   //CHECK: load i8, i8* %e2.addr, align 1
+   //CHECK: load i8, i8* %e1.addr, align 1
+   //CHECK: load i8, i8* %e0.addr, align 1
+  return _mm512_set_epi8(e63, e62, e61, e60, e59, e58, e57, e56, e55, e54,
+  e53, e52, e51, e50, e49, e48,e47, e46, e45, e44, e43, e42, e41, e40,
+  e39, e38, e37, e36, e35, e34, e33, e32,e31, e30, e29, e28, e27, e26,
+  e25, e24, e23, e22, e21, e20, e19, e18, e17, e16, e15, e14, e13, e12,
+  e11, e10, e9, e8, e7, e6, e5, e4, e3, e2, e1, e0);
+}
+
+__m512i test_mm512_set_epi16(short e31, short e30, short e29, short e28,
+short e27, short e26, short e25, short e24, short e23, short e22,
+short e21, short e20, short e19, short e18, short e17,
+short e16, short e15, short e14, short e13, short e12,
+short e11, short e10, short e9, short e8, short e7,
+short e6, short e5, short e4, short e3, short e2, short e1, short e0) {
+  //CHECK-LABEL: @test_mm512_set_epi16
+  //CHECK: 

[PATCH] D30158: [clang-tidy] modernize: Find usage of random_shuffle and replace it with shuffle.

2017-03-16 Thread Mads Ravn via Phabricator via cfe-commits
madsravn added a comment.

In https://reviews.llvm.org/D30158#699342, @jroelofs wrote:

> In https://reviews.llvm.org/D30158#699132, @madsravn wrote:
>
> > In https://reviews.llvm.org/D30158#698871, @aaron.ballman wrote:
> >
> > > In https://reviews.llvm.org/D30158#696534, @madsravn wrote:
> > >
> > > > Any updates on this?
> > >
> > >
> > > Have you run it over the test suite on the revision before random_shuffle 
> > > was removed from libc++?
> >
> >
> > I can't find any more tests for random_shuffle. I have looked in the SVN 
> > log for from december 2014 until now. It works on the three tests currently 
> > in trunk.
>
>
> Try just before r294328.


I can't see any random_shuffle tests in the libc++ repo before r294328 either. 
I don't know if they aren't there or if I just can't find them. Would you be 
able to point them out for me with revision and path?


https://reviews.llvm.org/D30158



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


Re: r297890 - enable -save-temps with -finclude-defult-header

2017-03-16 Thread Guansong Zhang via cfe-commits
Many thanks!

Regards

Guansong

On Wed, Mar 15, 2017 at 7:55 PM, Eric Christopher 
wrote:

> Hi Guansong,
>
> So this wasn't quite the right way to write this testcase. You really
> wanted a CHECK/CHECK-NOT line along with the actual commands. You also
> didn't want to (as you noticed later) depend on full compilation. You can
> check for this sort of thing in the future by using the -### command line
> option to get the subcommands that clang -would- invoke if it were actually
> going to do it.
>
> I've gone ahead and fixed this thusly:
> Committing to https://llvm.org/svn/llvm-project/cfe/trunk ...
> M test/Driver/include-default-header.cl
> Committed r297917
>
> Thanks!
>
> -eric
>
> On Wed, Mar 15, 2017 at 2:09 PM Guansong Zhang via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> Author: guansong
>> Date: Wed Mar 15 15:57:11 2017
>> New Revision: 297890
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=297890=rev
>> Log:
>> enable -save-temps with -finclude-defult-header
>>
>> Currently the two flags can not work together.
>>
>> To illustrate the issue, we can have an one line file a.cl contains only
>> an empty function
>>
>> cat a.cl
>>
>> void test(){}
>>
>> Then use
>>
>> clang -v -save-temps -x cl -Xclang -cl-std=CL2.0 -Xclang
>> -finclude-default-header -target amdgcn -S -c a.cl
>>
>> we will get redefinition errors for various things.
>>
>> The reason is that the -finclude-default-header flag is not meant to be
>> on cc1 command other than the preprocessor.
>>
>> The fix is modeled after the code just below the change to filter the
>> -finclude-default-header flag out when we are not in the preprocess phase.
>>
>> Differential Revision: https://reviews.llvm.org/D30743
>>
>> Added:
>> cfe/trunk/test/Driver/include-default-header.cl
>> Modified:
>> cfe/trunk/lib/Driver/ToolChains/Clang.cpp
>>
>> Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/
>> ToolChains/Clang.cpp?rev=297890=297889=297890=diff
>> 
>> ==
>> --- cfe/trunk/lib/Driver/ToolChains/Clang.cpp (original)
>> +++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp Wed Mar 15 15:57:11 2017
>> @@ -4268,7 +4268,19 @@ void Clang::ConstructJob(Compilation ,
>>
>>// Forward -Xclang arguments to -cc1, and -mllvm arguments to the LLVM
>> option
>>// parser.
>> -  Args.AddAllArgValues(CmdArgs, options::OPT_Xclang);
>> +  // -finclude-default-header flag is for preprocessor,
>> +  // do not pass it to other cc1 commands when save-temps is enabled
>> +  if (C.getDriver().isSaveTempsEnabled() &&
>> +  !isa(JA)) {
>> +for (auto Arg : Args.filtered(options::OPT_Xclang)) {
>> +  Arg->claim();
>> +  if (StringRef(Arg->getValue()) != "-finclude-default-header")
>> +CmdArgs.push_back(Arg->getValue());
>> +}
>> +  }
>> +  else {
>> +Args.AddAllArgValues(CmdArgs, options::OPT_Xclang);
>> +  }
>>for (const Arg *A : Args.filtered(options::OPT_mllvm)) {
>>  A->claim();
>>
>>
>> Added: cfe/trunk/test/Driver/include-default-header.cl
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/
>> include-default-header.cl?rev=297890=auto
>> 
>> ==
>> --- cfe/trunk/test/Driver/include-default-header.cl (added)
>> +++ cfe/trunk/test/Driver/include-default-header.cl Wed Mar 15 15:57:11
>> 2017
>> @@ -0,0 +1,4 @@
>> +// RUN: %clang -v -save-temps -x cl -Xclang -cl-std=CL2.0 -Xclang
>> -finclude-default-header -target amdgcn -S -c %s
>> +
>> +void test() {}
>> +
>>
>>
>> ___
>> 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


[PATCH] D30841: [clang-tidy] readability-misleading-indentation: fix chained if

2017-03-16 Thread Alexander Kornienko via Phabricator via cfe-commits
alexfh added inline comments.



Comment at: clang-tidy/readability/MisleadingIndentationCheck.cpp:40-42
+  for (auto Iter = ChainedIfs.find(If); Iter != ChainedIfs.end();
+   Iter = ChainedIfs.find(Iter->second))
+IfLoc = Iter->second->getIfLoc();

alexfh wrote:
> Can you just use the parent map to get the previous `if` in the chain?
`ASTContext::getParents` is the interface to it.


https://reviews.llvm.org/D30841



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


[PATCH] D30841: [clang-tidy] readability-misleading-indentation: fix chained if

2017-03-16 Thread Alexander Kornienko via Phabricator via cfe-commits
alexfh requested changes to this revision.
alexfh added a comment.
This revision now requires changes to proceed.

Thank you for the fix! One comment inline.




Comment at: clang-tidy/readability/MisleadingIndentationCheck.cpp:40-42
+  for (auto Iter = ChainedIfs.find(If); Iter != ChainedIfs.end();
+   Iter = ChainedIfs.find(Iter->second))
+IfLoc = Iter->second->getIfLoc();

Can you just use the parent map to get the previous `if` in the chain?


https://reviews.llvm.org/D30841



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


r297956 - Make table cells referring to Clang 4 green, as Clang 4 has been released.

2017-03-16 Thread Ed Schouten via cfe-commits
Author: ed
Date: Thu Mar 16 09:21:00 2017
New Revision: 297956

URL: http://llvm.org/viewvc/llvm-project?rev=297956=rev
Log:
Make table cells referring to Clang 4 green, as Clang 4 has been released.

Modified:
cfe/trunk/www/cxx_status.html

Modified: cfe/trunk/www/cxx_status.html
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/www/cxx_status.html?rev=297956=297955=297956=diff
==
--- cfe/trunk/www/cxx_status.html (original)
+++ cfe/trunk/www/cxx_status.html Thu Mar 16 09:21:00 2017
@@ -612,7 +612,7 @@ as the draft C++1z standard evolves.
 
   Make exception specifications part of the type system
   http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0012r1.html;>P0012R1
-  Clang 4
+  Clang 4
 
 
   __has_include in preprocessor conditionals
@@ -679,7 +679,7 @@ as the draft C++1z standard evolves.
 
   Dynamic memory allocation for over-aligned data
   http://wg21.link/p0035r4;>P0035R4
-  Clang 4
+  Clang 4
 
 
   Template argument deduction for class templates
@@ -692,17 +692,17 @@ as the draft C++1z standard evolves.
 
   Non-type template parameters with auto type
   http://wg21.link/p0127r2;>P0127R2
-  Clang 4
+  Clang 4
 
 
   Guaranteed copy elision
   http://wg21.link/p0135r1;>P0135R1
-  Clang 4
+  Clang 4
 
 
   Stricter expression evaluation order
   http://wg21.link/p0145r3;>P0145R3
-  Clang 4 (10)
+  Clang 4 (10)
 
 
   http://wg21.link/p0400r0;>P0400R0
@@ -725,7 +725,7 @@ as the draft C++1z standard evolves.
 
   Structured bindings
   http://wg21.link/p0217r3;>P0217R3
-  Clang 4
+  Clang 4
 
 
   Separate variable and condition for if and 
switch
@@ -741,12 +741,12 @@ as the draft C++1z standard evolves.
 
   Removing deprecated dynamic exception specifications
   http://wg21.link/p0003r5;>P0003R5
-  Clang 4
+  Clang 4
 
 
   Pack expansions in using-declarations
   http://wg21.link/p0195r2;>P0195R2
-  Clang 4
+  Clang 4
 
 
 


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


[PATCH] D31029: [analyzer] Fix logical not for pointers with different bit width

2017-03-16 Thread Gábor Horváth via Phabricator via cfe-commits
xazax.hun added a comment.

So there is no LLVM supported target with different bit width pointer types?

In case we have such a target upstreamed, you can add a test with the 
host-triple hardcoded into the test.


Repository:
  rL LLVM

https://reviews.llvm.org/D31029



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


[PATCH] D31005: [Objective-C] Fix "repeated use of weak" warning with -fobjc-weak

2017-03-16 Thread Alex Lorenz via Phabricator via cfe-commits
arphaman added inline comments.



Comment at: lib/Sema/SemaDecl.cpp:10184
+ (!getLangOpts().ObjCAutoRefCount && getLangOpts().ObjCWeak &&
+  VDecl->getType().getObjCLifetime() != Qualifiers::OCL_Weak)) &&
 !Diags.isIgnored(diag::warn_arc_repeated_use_of_weak,

jordan_rose wrote:
> bkelley wrote:
> > jordan_rose wrote:
> > > This condition's getting complicated, and it shows up in a few places. 
> > > Would it make sense to factor it out?
> > What do you think about adding a member function like 
> > `hasMRCNonTrivialWeakObjCLifetime(const ASTContext )` to QualType 
> > to factor out lines 10183-10184? We could use that in D31003, D31004, here, 
> > and D31007.
> I'm fine with it myself but I don't work on Clang very much anymore. Maybe 
> someone else can say whether it's actually a good idea.
> 
> (By the way, the conventional abbreviation for this mode is "MRR" for "Manual 
> Retain/Release", even though it's "ARC" and "Automated Reference Counting".)
Do you want to extract the out the entire

```
(!getLangOpts().ObjCAutoRefCount && getLangOpts().ObjCWeak &&
  VDecl->getType().getObjCLifetime() != Qualifiers::OCL_Weak)
```
?

It looks like the others patches use only `getLangOpts().ObjCWeak && 
Type.getObjCLifetime() != Qualifiers::OCL_Weak` so the use of 
`hasMRCNonTrivialWeakObjCLifetime` won't be equivalent to the original code in 
the other patches if you extract all code from lines 10183-10184.



Comment at: test/SemaObjC/arc-repeated-weak.mm:468
+// With -fobjc-weak, the cast below is allowed.
+#if __has_feature(objc_arc)
 // This used to crash in the constructor of WeakObjectProfileTy when a

NIT: You can keep the code in `foo1` active and just use the `#if` on the 
`expected-error`, like:

```
void foo1() {
  INTFPtrTy tmp = (INTFPtrTy)e1; 
#if __has_feature(objc_arc)
// expected-error@-2 {{cast of 'E' to 'INTFPtrTy' (aka 'INTF *') is disallowed 
with ARC}}
#endif
}
```


https://reviews.llvm.org/D31005



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


[PATCH] D31029: [analyzer] Fix logical not for pointers with different bit width

2017-03-16 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki created this revision.

The Static Analyzer assumed that all pointers had the same bit width. Now pass 
the type to the 'makeNull' method, to construct a null
pointer of the appropiate bit width.

Example code that does not work well:

  int main(void) {
    __cm void *cm_p = 0;
    if (cm_p == 0)
      (void)cm_p;
  }

Unfortunately there is no proper testcase here. The problem is seen with a 
custom target.


Repository:
  rL LLVM

https://reviews.llvm.org/D31029

Files:
  include/clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h
  include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h
  lib/StaticAnalyzer/Core/ExprEngineC.cpp


Index: lib/StaticAnalyzer/Core/ExprEngineC.cpp
===
--- lib/StaticAnalyzer/Core/ExprEngineC.cpp
+++ lib/StaticAnalyzer/Core/ExprEngineC.cpp
@@ -980,10 +980,9 @@
   //transfer functions as "0 == E".
   SVal Result;
   if (Optional LV = V.getAs()) {
-Loc X = svalBuilder.makeNull();
+Loc X = svalBuilder.makeNullWithType(Ex->getType());
 Result = evalBinOp(state, BO_EQ, *LV, X, U->getType());
-  }
-  else if (Ex->getType()->isFloatingType()) {
+  } else if (Ex->getType()->isFloatingType()) {
 // FIXME: handle floating point types.
 Result = UnknownVal();
   } else {
Index: include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h
===
--- include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h
+++ include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h
@@ -310,10 +310,14 @@
 return nonloc::ConcreteInt(BasicVals.getTruthValue(b));
   }
 
-  Loc makeNull() {
-return loc::ConcreteInt(BasicVals.getZeroWithPtrWidth());
+  // Pass type to accomodate for different pointer bit-witdths of different
+  // address spaces.
+  Loc makeNullWithType(QualType type) {
+return loc::ConcreteInt(BasicVals.getZeroWithTypeSize(type));
   }
 
+  Loc makeNull() { return loc::ConcreteInt(BasicVals.getZeroWithPtrWidth()); }
+
   Loc makeLoc(SymbolRef sym) {
 return loc::MemRegionVal(MemMgr.getSymbolicRegion(sym));
   }
Index: include/clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h
===
--- include/clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h
+++ include/clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h
@@ -176,6 +176,11 @@
 return getValue(X);
   }
 
+  inline const llvm::APSInt (QualType T,
+ bool isUnsigned = true) {
+return getValue(0, Ctx.getTypeSize(T), isUnsigned);
+  }
+
   inline const llvm::APSInt& getZeroWithPtrWidth(bool isUnsigned = true) {
 return getValue(0, Ctx.getTypeSize(Ctx.VoidPtrTy), isUnsigned);
   }


Index: lib/StaticAnalyzer/Core/ExprEngineC.cpp
===
--- lib/StaticAnalyzer/Core/ExprEngineC.cpp
+++ lib/StaticAnalyzer/Core/ExprEngineC.cpp
@@ -980,10 +980,9 @@
   //transfer functions as "0 == E".
   SVal Result;
   if (Optional LV = V.getAs()) {
-Loc X = svalBuilder.makeNull();
+Loc X = svalBuilder.makeNullWithType(Ex->getType());
 Result = evalBinOp(state, BO_EQ, *LV, X, U->getType());
-  }
-  else if (Ex->getType()->isFloatingType()) {
+  } else if (Ex->getType()->isFloatingType()) {
 // FIXME: handle floating point types.
 Result = UnknownVal();
   } else {
Index: include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h
===
--- include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h
+++ include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h
@@ -310,10 +310,14 @@
 return nonloc::ConcreteInt(BasicVals.getTruthValue(b));
   }
 
-  Loc makeNull() {
-return loc::ConcreteInt(BasicVals.getZeroWithPtrWidth());
+  // Pass type to accomodate for different pointer bit-witdths of different
+  // address spaces.
+  Loc makeNullWithType(QualType type) {
+return loc::ConcreteInt(BasicVals.getZeroWithTypeSize(type));
   }
 
+  Loc makeNull() { return loc::ConcreteInt(BasicVals.getZeroWithPtrWidth()); }
+
   Loc makeLoc(SymbolRef sym) {
 return loc::MemRegionVal(MemMgr.getSymbolicRegion(sym));
   }
Index: include/clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h
===
--- include/clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h
+++ include/clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h
@@ -176,6 +176,11 @@
 return getValue(X);
   }
 
+  inline const llvm::APSInt (QualType T,
+ bool isUnsigned = true) {
+return 

[PATCH] D23610: [ARM] Add pre-defined macros for ROPI and RWPI

2017-03-16 Thread Oliver Stannard via Phabricator via cfe-commits
olista01 updated this revision to Diff 91990.
olista01 retitled this revision from "[ARM] Add pre-defined macros for ROPI, 
RWPI and FPIC" to "[ARM] Add pre-defined macros for ROPI and RWPI".
olista01 edited the summary of this revision.

Repository:
  rL LLVM

https://reviews.llvm.org/D23610

Files:
  include/clang/Basic/LangOptions.def
  include/clang/Driver/Options.td
  lib/Basic/Targets.cpp
  lib/Driver/ToolChains/Clang.cpp
  lib/Frontend/CompilerInvocation.cpp
  test/Preprocessor/arm-pic-predefines.c


Index: test/Preprocessor/arm-pic-predefines.c
===
--- /dev/null
+++ test/Preprocessor/arm-pic-predefines.c
@@ -0,0 +1,14 @@
+// REQUIRES: arm-registered-target
+
+// RUN: %clang -target armv8--none-eabi   -x c -E -dM %s -o -   | 
FileCheck %s --check-prefix=NO-ROPI --check-prefix=NO-RWPI
+// RUN: %clang -target armv8--none-eabi   -x c -E -dM %s -o - -fropi| 
FileCheck %s --check-prefix=ROPI--check-prefix=NO-RWPI
+// RUN: %clang -target armv8--none-eabi   -x c -E -dM %s -o - -frwpi| 
FileCheck %s --check-prefix=NO-ROPI --check-prefix=RWPI
+// RUN: %clang -target armv8--none-eabi   -x c -E -dM %s -o - -fropi -frwpi | 
FileCheck %s --check-prefix=ROPI--check-prefix=RWPI
+
+// Pre-defined macros for position-independence modes
+
+// NO-ROPI-NOT: #define __APCS_ROPI
+// ROPI: #define __ARM_ROPI
+
+// NO-RWPI-NOT: #define __APCS_RWPI
+// RWPI: #define __ARM_RWPI
Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -2071,6 +2071,8 @@
   Opts.MaxTypeAlign = getLastArgIntValue(Args, OPT_fmax_type_align_EQ, 0, 
Diags);
   Opts.AlignDouble = Args.hasArg(OPT_malign_double);
   Opts.PICLevel = getLastArgIntValue(Args, OPT_pic_level, 0, Diags);
+  Opts.ROPI = Args.hasArg(OPT_fropi);
+  Opts.RWPI = Args.hasArg(OPT_frwpi);
   Opts.PIE = Args.hasArg(OPT_pic_is_pie);
   Opts.Static = Args.hasArg(OPT_static_define);
   Opts.DumpRecordLayoutsSimple = Args.hasArg(OPT_fdump_record_layouts_simple);
Index: lib/Driver/ToolChains/Clang.cpp
===
--- lib/Driver/ToolChains/Clang.cpp
+++ lib/Driver/ToolChains/Clang.cpp
@@ -2193,6 +2193,13 @@
   CmdArgs.push_back("-pic-is-pie");
   }
 
+  if (RelocationModel == llvm::Reloc::ROPI ||
+  RelocationModel == llvm::Reloc::ROPI_RWPI)
+CmdArgs.push_back("-fropi");
+  if (RelocationModel == llvm::Reloc::RWPI ||
+  RelocationModel == llvm::Reloc::ROPI_RWPI)
+CmdArgs.push_back("-frwpi");
+
   if (Arg *A = Args.getLastArg(options::OPT_meabi)) {
 CmdArgs.push_back("-meabi");
 CmdArgs.push_back(A->getValue());
Index: lib/Basic/Targets.cpp
===
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -5577,6 +5577,12 @@
 
 if (ArchKind == llvm::ARM::AK_ARMV8_1A)
   Builder.defineMacro("__ARM_FEATURE_QRDMX", "1");
+
+// ACLE position independent code macros.
+if (Opts.ROPI)
+  Builder.defineMacro("__ARM_ROPI", "1");
+if (Opts.RWPI)
+  Builder.defineMacro("__ARM_RWPI", "1");
   }
 
   ArrayRef getTargetBuiltins() const override {
Index: include/clang/Driver/Options.td
===
--- include/clang/Driver/Options.td
+++ include/clang/Driver/Options.td
@@ -1275,9 +1275,9 @@
 def fno_pic : Flag<["-"], "fno-pic">, Group;
 def fpie : Flag<["-"], "fpie">, Group;
 def fno_pie : Flag<["-"], "fno-pie">, Group;
-def fropi : Flag<["-"], "fropi">, Group;
+def fropi : Flag<["-"], "fropi">, Group, Flags<[CC1Option]>;
 def fno_ropi : Flag<["-"], "fno-ropi">, Group;
-def frwpi : Flag<["-"], "frwpi">, Group;
+def frwpi : Flag<["-"], "frwpi">, Group, Flags<[CC1Option]>;
 def fno_rwpi : Flag<["-"], "fno-rwpi">, Group;
 def fplugin_EQ : Joined<["-"], "fplugin=">, Group, 
Flags<[DriverOption]>, MetaVarName<"">,
   HelpText<"Load the named plugin (dynamic shared object)">;
Index: include/clang/Basic/LangOptions.def
===
--- include/clang/Basic/LangOptions.def
+++ include/clang/Basic/LangOptions.def
@@ -163,6 +163,8 @@
 VALUE_LANGOPT(AlignDouble, 1, 0, "Controls if doubles should be 
aligned to 8 bytes (x86 only)")
 COMPATIBLE_VALUE_LANGOPT(PICLevel, 2, 0, "__PIC__ level")
 COMPATIBLE_VALUE_LANGOPT(PIE , 1, 0, "is pie")
+LANGOPT(ROPI , 1, 0, "Read-only position independence")
+LANGOPT(RWPI , 1, 0, "Read-write position 
independence")
 COMPATIBLE_LANGOPT(GNUInline , 1, 0, "GNU inline semantics")
 COMPATIBLE_LANGOPT(NoInlineDefine, 1, 0, "__NO_INLINE__ predefined macro")
 COMPATIBLE_LANGOPT(Deprecated, 1, 0, "__DEPRECATED predefined macro")


Index: test/Preprocessor/arm-pic-predefines.c

[PATCH] D23610: [ARM] Add pre-defined macros for ROPI, RWPI and FPIC

2017-03-16 Thread Oliver Stannard via Phabricator via cfe-commits
olista01 added a comment.

My patch to the ACLE has now been accepted, so it will be in the next release. 
This is the wording:

  __ARM_ROPI is defined to 1 if the translation unit is being compiled in 
read-only position independent mode. In this mode, all read-only data and 
functions are at a link-time constant offset from the program counter.
  
  __ARM_RWPI is defined to 1 if the translation unit is being compiled in 
read-write position independent mode. In this mode, all writable data is at a 
link-time constant offset from the static base register defined in [AAPCS].
  
  The ROPI and RWPI position independence modes are compatible with each other, 
so the __ARM_ROPI and __ARM_RWPI macros may be defined at the same time.

We're not adding the FPIC macro to the ACLE, because that isn't ARM-specific.


Repository:
  rL LLVM

https://reviews.llvm.org/D23610



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


[PATCH] D30748: [Lexer] Finding beginning of token with escaped new line

2017-03-16 Thread Alexander Kornienko via Phabricator via cfe-commits
alexfh requested changes to this revision.
alexfh added inline comments.
This revision now requires changes to proceed.



Comment at: lib/Lex/Lexer.cpp:457
+static bool isNewLineEscaped(const char *BufferStart, const char *Str) {
+  while (Str > BufferStart && isWhitespace(*Str))
+--Str;

idlecode wrote:
> alexfh wrote:
> > We only care about two specific sequences here: `\\\r\n` or `\\\n`, not a 
> > backslash followed by arbitrary whitespace.
> I just saw that some functions (e.g. line 1285 in this file) accept 
> whitespaces between escape character and new line. How about now?
Indeed, both clang and gcc accept whitespace between the backslash and the 
newline character and issue a diagnostic: https://godbolt.org/g/PUCTzF.

This should probably be done similar to Lexer::getEscapedNewLineSize, but in 
reverse:

  assert(isVerticalWhitespace(*P));
  --P;
  if (P >= BufferStart && isVerticalWhitespace(*P) && *P != P[1]) // Skip the 
second character of `\r\n` or `\n\r`.
--P;
  // Clang allows horizontal whitespace between backslash and new-line with a 
warning. Skip it.
  while (P >= BufferStart && isHorizontalWhitespace(*P))
--P;
  return P >= BufferStart && *P == '\\';

I'd add a bunch of tests for this function specifically:
  <\r> -> true
  <\n> -> true
  <\r><\n> -> true
  <\n><\r> -> true
  <\v><\f><\r> -> true
  <\v><\f><\r><\n> -> true
  <\r><\r> -> false
  <\r><\r><\n> -> false
  <\n><\n> -> false



https://reviews.llvm.org/D30748



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


r297947 - [OpenCL] Implement as_type operator as alias of __builtin_astype.

2017-03-16 Thread Egor Churaev via cfe-commits
Author: echuraev
Date: Thu Mar 16 07:15:10 2017
New Revision: 297947

URL: http://llvm.org/viewvc/llvm-project?rev=297947=rev
Log:
[OpenCL] Implement as_type operator as alias of __builtin_astype.

Reviewers: Anastasia

Reviewed By: Anastasia

Subscribers: cfe-commits, yaxunl, bader

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

Modified:
cfe/trunk/lib/Headers/opencl-c.h
cfe/trunk/test/SemaOpenCL/as_type.cl

Modified: cfe/trunk/lib/Headers/opencl-c.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/opencl-c.h?rev=297947=297946=297947=diff
==
--- cfe/trunk/lib/Headers/opencl-c.h (original)
+++ cfe/trunk/lib/Headers/opencl-c.h Thu Mar 16 07:15:10 2017
@@ -6584,777 +6584,85 @@ half16 __ovld __cnfn convert_half16_rtz(
  * OpenCL v1.1/1.2/2.0 s6.2.4.2 - as_type operators
  * Reinterprets a data type as another data type of the same size
  */
-char __ovld __cnfn as_char(char);
-char __ovld __cnfn as_char(uchar);
-
-char2 __ovld __cnfn as_char2(char2);
-char2 __ovld __cnfn as_char2(uchar2);
-char2 __ovld __cnfn as_char2(short);
-char2 __ovld __cnfn as_char2(ushort);
-
-char3 __ovld __cnfn as_char3(char3);
-char3 __ovld __cnfn as_char3(char4);
-char3 __ovld __cnfn as_char3(uchar3);
-char3 __ovld __cnfn as_char3(uchar4);
-char3 __ovld __cnfn as_char3(short2);
-char3 __ovld __cnfn as_char3(ushort2);
-char3 __ovld __cnfn as_char3(int);
-char3 __ovld __cnfn as_char3(uint);
-char3 __ovld __cnfn as_char3(float);
-
-char4 __ovld __cnfn as_char4(char3);
-char4 __ovld __cnfn as_char4(char4);
-char4 __ovld __cnfn as_char4(uchar3);
-char4 __ovld __cnfn as_char4(uchar4);
-char4 __ovld __cnfn as_char4(short2);
-char4 __ovld __cnfn as_char4(ushort2);
-char4 __ovld __cnfn as_char4(int);
-char4 __ovld __cnfn as_char4(uint);
-char4 __ovld __cnfn as_char4(float);
-
-char8 __ovld __cnfn as_char8(char8);
-char8 __ovld __cnfn as_char8(uchar8);
-char8 __ovld __cnfn as_char8(short3);
-char8 __ovld __cnfn as_char8(short4);
-char8 __ovld __cnfn as_char8(ushort3);
-char8 __ovld __cnfn as_char8(ushort4);
-char8 __ovld __cnfn as_char8(int2);
-char8 __ovld __cnfn as_char8(uint2);
-char8 __ovld __cnfn as_char8(long);
-char8 __ovld __cnfn as_char8(ulong);
-char8 __ovld __cnfn as_char8(float2);
-
-char16 __ovld __cnfn as_char16(char16);
-char16 __ovld __cnfn as_char16(uchar16);
-char16 __ovld __cnfn as_char16(short8);
-char16 __ovld __cnfn as_char16(ushort8);
-char16 __ovld __cnfn as_char16(int3);
-char16 __ovld __cnfn as_char16(int4);
-char16 __ovld __cnfn as_char16(uint3);
-char16 __ovld __cnfn as_char16(uint4);
-char16 __ovld __cnfn as_char16(long2);
-char16 __ovld __cnfn as_char16(ulong2);
-char16 __ovld __cnfn as_char16(float3);
-char16 __ovld __cnfn as_char16(float4);
-
-uchar __ovld __cnfn as_uchar(char);
-uchar __ovld __cnfn as_uchar(uchar);
-
-uchar2 __ovld __cnfn as_uchar2(char2);
-uchar2 __ovld __cnfn as_uchar2(uchar2);
-uchar2 __ovld __cnfn as_uchar2(short);
-uchar2 __ovld __cnfn as_uchar2(ushort);
-
-uchar3 __ovld __cnfn as_uchar3(char3);
-uchar3 __ovld __cnfn as_uchar3(char4);
-uchar3 __ovld __cnfn as_uchar3(uchar3);
-uchar3 __ovld __cnfn as_uchar3(uchar4);
-uchar3 __ovld __cnfn as_uchar3(short2);
-uchar3 __ovld __cnfn as_uchar3(ushort2);
-uchar3 __ovld __cnfn as_uchar3(int);
-uchar3 __ovld __cnfn as_uchar3(uint);
-uchar3 __ovld __cnfn as_uchar3(float);
-
-uchar4 __ovld __cnfn as_uchar4(char3);
-uchar4 __ovld __cnfn as_uchar4(char4);
-uchar4 __ovld __cnfn as_uchar4(uchar3);
-uchar4 __ovld __cnfn as_uchar4(uchar4);
-uchar4 __ovld __cnfn as_uchar4(short2);
-uchar4 __ovld __cnfn as_uchar4(ushort2);
-uchar4 __ovld __cnfn as_uchar4(int);
-uchar4 __ovld __cnfn as_uchar4(uint);
-uchar4 __ovld __cnfn as_uchar4(float);
-
-uchar8 __ovld __cnfn as_uchar8(char8);
-uchar8 __ovld __cnfn as_uchar8(uchar8);
-uchar8 __ovld __cnfn as_uchar8(short3);
-uchar8 __ovld __cnfn as_uchar8(short4);
-uchar8 __ovld __cnfn as_uchar8(ushort3);
-uchar8 __ovld __cnfn as_uchar8(ushort4);
-uchar8 __ovld __cnfn as_uchar8(int2);
-uchar8 __ovld __cnfn as_uchar8(uint2);
-uchar8 __ovld __cnfn as_uchar8(long);
-uchar8 __ovld __cnfn as_uchar8(ulong);
-uchar8 __ovld __cnfn as_uchar8(float2);
-
-uchar16 __ovld __cnfn as_uchar16(char16);
-uchar16 __ovld __cnfn as_uchar16(uchar16);
-uchar16 __ovld __cnfn as_uchar16(short8);
-uchar16 __ovld __cnfn as_uchar16(ushort8);
-uchar16 __ovld __cnfn as_uchar16(int3);
-uchar16 __ovld __cnfn as_uchar16(int4);
-uchar16 __ovld __cnfn as_uchar16(uint3);
-uchar16 __ovld __cnfn as_uchar16(uint4);
-uchar16 __ovld __cnfn as_uchar16(long2);
-uchar16 __ovld __cnfn as_uchar16(ulong2);
-uchar16 __ovld __cnfn as_uchar16(float3);
-uchar16 __ovld __cnfn as_uchar16(float4);
-
-short __ovld __cnfn as_short(char2);
-short __ovld __cnfn as_short(uchar2);
-short __ovld __cnfn as_short(short);
-short __ovld __cnfn as_short(ushort);
-
-short2 __ovld __cnfn as_short2(char3);
-short2 __ovld __cnfn as_short2(char4);
-short2 __ovld __cnfn 

[PATCH] D30810: Preserve vec3 type.

2017-03-16 Thread JinGu Kang via Phabricator via cfe-commits
jaykang10 added a comment.

In https://reviews.llvm.org/D30810#702614, @Anastasia wrote:

> In https://reviews.llvm.org/D30810#702443, @bruno wrote:
>
> > > As a result, I think it would be good for clang to have both of features 
> > > and I would like to stick to the option "-fpresereve-vec3' to change the 
> > > behavior easily.
> >
> > The motivation doesn't seem solid to me, who else is going to benefit from 
> > this flag?
>
>
> There are some off the main tree implementation that would benefit. But in 
> the case of AMD GPU 3 loads/stores will be produced instead of 4. Sounds like 
> a good optimization to me. As I said in my previous comment I think it should 
> have been the default behavior from the beginning, but since different 
> implementation landed first we can integrate this one now with an additional 
> option.


Additionally, Here is assembly output from vec3 with amdgcn target. :)

LLVM IR

  define void @foo(<3 x float>* nocapture %a, <3 x float>* nocapture readonly 
%b) {
  entry:
%0 = load <3 x float>, <3 x float>* %b, align 16
store <3 x float> %0, <3 x float>* %a, align 16
ret void
  }

Assembly Output

.text
.section.AMDGPU.config
.long   47176
.long   11272256
.long   47180
.long   132
.long   47200
.long   0
.long   4
.long   0
.long   8
.long   0
.text
.globl  foo
.p2align8
.type   foo,@function
  foo:; @foo
  ; BB#0: ; %entry
s_load_dword s2, s[0:1], 0x9
s_load_dword s0, s[0:1], 0xa
s_mov_b32 s4, SCRATCH_RSRC_DWORD0
s_mov_b32 s5, SCRATCH_RSRC_DWORD1
s_mov_b32 s6, -1
s_mov_b32 s8, s3
s_mov_b32 s7, 0xe8f000
s_waitcnt lgkmcnt(0)
v_mov_b32_e32 v0, s0
buffer_load_dword v2, v0, s[4:7], s8 offen
buffer_load_dword v3, v0, s[4:7], s8 offen offset:8
buffer_load_dword v0, v0, s[4:7], s8 offen offset:4
v_mov_b32_e32 v1, s2
s_waitcnt vmcnt(0)
buffer_store_dword v0, v1, s[4:7], s8 offen offset:4
buffer_store_dword v2, v1, s[4:7], s8 offen
buffer_store_dword v3, v1, s[4:7], s8 offen offset:8
s_endpgm
  .Lfunc_end0:
.size   foo, .Lfunc_end0-foo
  
.section.AMDGPU.csdata
  ; Kernel info:
  ; codeLenInByte = 112
  ; NumSgprs: 9
  ; NumVgprs: 4
  ; FloatMode: 192
  ; IeeeMode: 1
  ; ScratchSize: 0
  ; LDSByteSize: 0 bytes/workgroup (compile time only)
  ; SGPRBlocks: 1
  ; VGPRBlocks: 0
  ; NumSGPRsForWavesPerEU: 9
  ; NumVGPRsForWavesPerEU: 4
  ; ReservedVGPRFirst: 0
  ; ReservedVGPRCount: 0
  ; COMPUTE_PGM_RSRC2:USER_SGPR: 2
  ; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
  ; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
  ; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
  ; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
  ; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
  
.section".note.GNU-stack"


https://reviews.llvm.org/D30810



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


[PATCH] D30810: Preserve vec3 type.

2017-03-16 Thread JinGu Kang via Phabricator via cfe-commits
jaykang10 added a comment.

In https://reviews.llvm.org/D30810#702548, @ahatanak wrote:

> In https://reviews.llvm.org/D30810#701141, @jaykang10 wrote:
>
> > In https://reviews.llvm.org/D30810#701132, @ahatanak wrote:
> >
> > > Actually, it's not a mis-compile. The record layout shows that there is a 
> > > padding before field f2 and f2 starts at byte 16. So using "store <4 x 
> > > float>" doesn't overwrite the field.
> >
> >
> > It depends on float3's alignment. I guess the float3's alignment is 16 on 
> > your target so there is a padding bytes before f2 to be aligned by 16. If 
> > you add __attribute__((packed)) on struct type, you could see overwrite.
>
>
> I looked at ItaniumRecordLayoutBuilder to understand how 
> __attribute__((packed)) affects the struct's layout.
>
> If the number of elements of a vector is not a power of 2, 
> ASTContext::getTypeInfoImpl rounds up the width and alignment to the next 
> power of 2. So the size of float3 is 16 bytes. __attribute__((packed)) can 
> change the alignment of float3, but it doesn't change its size, so there is a 
> 4-byte padding between field f1 and f2.


Oops, I am sorry,  I was wrong. I did not imagine the size has same behavior 
with alignment. Thank you for pointing out it! :) Additionally, I wonder why 
the non-power-of-2 length vector's size has same behavior with alignment... Do 
you know something about the reason?


https://reviews.llvm.org/D30810



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


[PATCH] D31019: [clangd] [RFC] Use libclang and CXTranslationUnit instead of ASTUnit

2017-03-16 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer resigned from this revision.
bkramer added a comment.

It's not. the goal is to get rid of ASTUnit inside of clangd in the long term 
as it's a big problem for extensibility. libclang is just a wrapper for 
ASTUnit, with even more problems.

If you want to get completion running, just call ASTUnit::CodeComplete.


Repository:
  rL LLVM

https://reviews.llvm.org/D31019



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


[PATCH] D28136: [OpenCL] Implement as_type operator as alias of __builtin_astype.

2017-03-16 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia accepted this revision.
Anastasia added a comment.
This revision is now accepted and ready to land.

LGTM! Thanks!




Comment at: lib/Headers/opencl-c.h:6588
-char __ovld __cnfn as_char(char);
-char __ovld __cnfn as_char(uchar);
-

bader wrote:
> Anastasia wrote:
> > Why do we have some of the overloads omitted? Would this cause any extra 
> > conversions? uchar -> char in this case?
> It's specific to how builtin_astype works. It drops first argument type and 
> only cares about matching first argument size with the data type size 
> provided as a second argument. So basically with single line we get all 
> possible and impossible overloads of as_char(*).
> This define will pass any variable type char,uchar to builtin_astype.
Ok, I see. I hope we won't get the "impossible" ones though. :)


https://reviews.llvm.org/D28136



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


  1   2   >