[PATCH] D13330: Implement __attribute__((unique_instantiation))

2016-10-28 Thread Keno Fischer via cfe-commits
loladiro planned changes to this revision.
loladiro added a comment.

Thanks for the review! Sorry, it's been a while since I wrote this code, so I'm 
not fluent in all the details, but I've replied below. I am not particularly 
partial to the name, so whatever you feel is best is ok with me.




Comment at: include/clang/Basic/AttrDocs.td:2321-2323
+When the unique_instantiation attribute is specified on an explicit template
+instantiation, the compiler is given license to emit strong symbols for
+this specific explicit template instantiation.

rsmith wrote:
> The primary description of the attribute should specify what it means, not 
> the consequences of that meaning. In this case, the meaning is that the 
> programmer is guaranteeing to the compiler that an explicit instantiation 
> precedes all implicit instantiations, and the consequence is that we can use 
> strong symbols.
Ok, sounds good.



Comment at: include/clang/Basic/DiagnosticSemaKinds.td:2456
+def err_unique_instantiation_not_previous : Error<
+  "'unique_instantiation' attribute must be specified for all declarations and 
definitions of this explicit template instantiation">;
 

rsmith wrote:
> loladiro wrote:
> > aaron.ballman wrote:
> > > > They are checking for two different conditions in the spec. One 
> > > > requires that all explicit template instantiations with this attribute 
> > > > have a declaration, the other that every declaration/definition has the 
> > > > attribute.
> > > 
> > > Okay, I see now what this diagnostic is attempting to convey. I think it 
> > > should read:
> > > ```
> > > def err_unique_instantiation_no_declaration : Error<
> > >   "'unique_instantiation' attribute on an explicit instantiation requires 
> > > a previous explicit instantiation declaration">;
> > > ```
> > Sounds good.
> This seems like an unnecessarily-strict rule to me. I don't see a reason to 
> disallow:
> ```
> // in header
> extern template struct __attribute__((whatever_its_called)) X;
> ```
> ```
> // in source file
> template struct X;
> ```
> There doesn't appear to be any safety or correctness concern here. In 
> general, it seems like the attribute is only promising that the explicit 
> instantiation declaration precedes any other instantiation, so the only 
> necessary rule would seem to be: if the attribute is present on any explicit 
> instantiation, the first point of instantiation must be an explicit 
> instantiation declaration that has the attribute.
While I didn't write the rules (just implemented them from the original 
proposal), I like the requirement from the point of view of making sure that 
the explicit instantiation declaration doesn't accidentally get deleted. Those 
declarations are somewhat odd in that they can be deleted without any semantic 
loss in functionality (just larger code size/more work for the linker) in the 
absence of this attribute. However, with this attribute, deleting the 
declaration would cause a subtle, perhaps hard to track down semantic change, 
so I like requiring people to be explicit. 



Comment at: lib/Sema/SemaDecl.cpp:2398-2399
+  // template declarations. In clang getDefinition() will get the
+  // ClassTemplateSpecializationDecl associated with the class template
+  // declaration, so we'd give incorrect warnings here.
+  if (auto *CTSD = dyn_cast(New)) {

rsmith wrote:
> I have no idea what you mean by this. Did you mean "associated with the 
> explicit instantiation declaration" or something like that?
Yes, I believe that is what I meant. It's been a while since I wrote this code, 
but I believe that all I'm trying to say here is that explicit instantiation 
declarations/definitions are allowed to add attributes after a definition, even 
though that is not normally allowed.



Comment at: lib/Sema/SemaDeclAttr.cpp:5400
+  if (!CTSD->getPreviousDecl())
+S.Diag(Attr.getLoc(), diag::err_unique_instantiation_no_declaration);
+}

rsmith wrote:
> Why is this rule only applied to explicit instantiations of class templates, 
> and not to function or variable templates?
I don't remember precisely, but I believe (at least when I wrote the patch) 
that those prior explicit instantiation declarations did not leave an AST node 
that I could check for.



Comment at: lib/Sema/SemaDeclCXX.cpp:5666-5685
+/// \brief Check if the new class needs a unique instantiation attribute
+/// based on whether its containing function or class has it
+void Sema::checkClassLevelUniqueInstantiation(CXXRecordDecl *Record) {
+  Decl *D = Record;
+  if (!D || D->hasAttr())
+return;
+  while (DeclContext *DC = D ? D->getDeclContext() : nullptr) {

rsmith wrote:
> I don't think this is the right way to handle this case. Note that an 
> explicit instantiation declaration/definition for a class is only an explicit 
> instantiation of those m

[PATCH] D25624: Added 'inline' attribute to basic_string's destructor

2016-10-28 Thread Mehdi AMINI via cfe-commits
mehdi_amini added a comment.

I believe the issue is _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY  itself. I 
asked here: 
http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20161024/175454.html


https://reviews.llvm.org/D25624



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


Re: [libcxx] r281681 - [libc++] Add _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY to support GCC ABI compatibility

2016-10-28 Thread Mehdi Amini via cfe-commits
Hi Eric,

I’m trying to make sense of _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY here.

If I understand correctly, such a symbol will be present and visible in the 
dyliib, but emitted as available_externally and visibility hidden in the client 
code.

I don’t understand the hidden visibility part, it seems incorrect to me as a 
remaining reference to the symbol, that we expect to get from the dylib, will 
be marked as hidden and the linker will expect the access to be in the same DSO.

(This is the cause of the failure that causes me to revert: 
https://reviews.llvm.org/D25624 )

Can you clarify what is the reason to add a "visibility hidden” when building 
the client code?

Thanks,

Mehdi


> On Sep 15, 2016, at 5:00 PM, Eric Fiselier via cfe-commits 
>  wrote:
> 
> Author: ericwf
> Date: Thu Sep 15 19:00:48 2016
> New Revision: 281681
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=281681&view=rev
> Log:
> [libc++] Add _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY to support GCC ABI 
> compatibility
> 
> Summary:
> GCC and Clang handle visibility attributes on the out-of-line definition of 
> externally instantiated templates differently. For example in the reproducer 
> below Clang will emit both 'foo' and 'bar' with default visibility while GCC 
> only emits a non-hidden 'foo'.  
> 
> ```
> // RUN: g++ -std=c++11 -shared -O3 test.cpp && sym_extract.py a.out
> // RUN: clang++ -std=c++11 -shared -O3 test.cpp && sym_extract.py a.out
> #define INLINE_VISIBILITY __attribute__((visibility("hidden"), always_inline))
> 
> template 
> struct Foo {
>  void foo();
>  void bar();
> };
> 
> template 
> void Foo::foo() {}
> 
> template 
> inline INLINE_VISIBILITY
> void Foo::bar() {}
> 
> template struct Foo;
> ```
> 
> This difference creates ABI incompatibilities between Clang and GCC built 
> dylibs. Specifically GCC built dylibs lack definitions for various member 
> functions of `basic_string`, `basic_istream`, `basic_ostream`, 
> `basic_iostream`, and `basic_streambuf` (All of these types are externally 
> instantiated). 
> 
> Surprisingly these missing symbols don't cause many problems because the 
> functions are marked `always_inline`  therefore the dylib definition is 
> rarely needed. However when an out-of-line definition is required then GCC 
> built dylibs will fail to link. For example [GCC built dylibs cannot build 
> Clang](http://stackoverflow.com/questions/39454262/clang-build-errors).
> 
> This patch works around this issue by adding 
> `_LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY` which is used to mark externally 
> instantiated member functions as always inline. When building the library 
> `_LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY` sets the symbol's visibility to 
> "default" instead of "hidden", otherwise it acts exactly the same as 
> `_LIBCPP_INLINE_VISIBILITY`.
> 
> After applying this patch GCC dylibs now contain:
>  * `_ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE7sungetcEv`
>  * `_ZNSt3__115basic_streambufIwNS_11char_traitsIwEEE5gbumpEi`
>  * `_ZNSt3__115basic_streambufIwNS_11char_traitsIwEEE7sungetcEv`
>  * `_ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE9sputbackcEc`
>  * 
> `_ZNSt3__113basic_istreamIwNS_11char_traitsIwEEE3getERNS_15basic_streambufIwS2_EE`
>  * 
> `_ZNSt3__113basic_ostreamIwNS_11char_traitsIwEEElsEPFRNS_9basic_iosIwS2_EES6_E`
>  * `_ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE4setpEPcS4_`
>  * 
> `_ZNSt3__113basic_ostreamIwNS_11char_traitsIwEEEC1EPNS_15basic_streambufIwS2_EE`
>  * `_ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE6snextcEv`
>  * `_ZNSt3__113basic_istreamIcNS_11char_traitsIcEEE4swapERS3_`
>  * `_ZNSt3__113basic_istreamIwNS_11char_traitsIwEEE4swapERS3_`
>  * 
> `_ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6__initEPKcm`
>  * `_ZNSt3__113basic_istreamIcNS_11char_traitsIcEEErsEPFRNS_8ios_baseES5_E`
>  * `_ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE9pubsetbufEPcl`
>  * 
> `_ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE10pubseekoffExNS_8ios_base7seekdirEj`
>  * 
> `_ZNSt3__113basic_istreamIwNS_11char_traitsIwEEErsEPFRNS_9basic_iosIwS2_EES6_E`
>  * `_ZNSt3__115basic_streambufIwNS_11char_traitsIwEEE5pbumpEi`
>  * 
> `_ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEE5seekpENS_4fposI11__mbstate_tEE`
>  * `_ZNSt3__113basic_istreamIcNS_11char_traitsIcEEE7getlineEPcl`
>  * `_ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE5sgetcEv`
>  * 
> `_ZNSt3__113basic_istreamIcNS_11char_traitsIcEEE3getERNS_15basic_streambufIcS2_EE`
>  * `_ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEElsEPFRNS_8ios_baseES5_E`
>  * `_ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE8in_availEv`
>  * `_ZNSt3__113basic_istreamIwNS_11char_traitsIwEEErsEPFRNS_8ios_baseES5_E`
>  * `_ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE6sbumpcEv`
>  * 
> `_ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEElsEPFRNS_9basic_iosIcS2_EES6_E`
>  * `_ZNSt3__113basic_istreamIcNS_11char_traitsIcEEE3getERc`
>  * `_ZNSt3__115basic_streambufIwNS_11char_traitsIwEEE6snextcEv`
>  * `_ZNSt3__11

[PATCH] D13419: Fix several problems at the intersection of template instantiations and visibility

2016-10-28 Thread Keno Fischer via cfe-commits
loladiro added inline comments.



Comment at: lib/AST/DeclCXX.cpp:1349-1354
+  while (!CTD->isMemberSpecialization()) {
+auto *NewCTD = CTD->getInstantiatedFromMemberTemplate();
+if (!NewCTD)
   break;
 CTD = NewCTD;
   }

rsmith wrote:
> The same bug exists in `VarDecl::getTemplateInstantiationPattern`; can you 
> fix it there too?
Do you have a test case that shows a problem with the current definition of 
that function? Would like to include it if possible. I tried cooking one up, 
but wasn't particularly successful.


Repository:
  rL LLVM

https://reviews.llvm.org/D13419



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


[PATCH] D25624: Added 'inline' attribute to basic_string's destructor

2016-10-28 Thread Mehdi AMINI via cfe-commits
mehdi_amini added a comment.

I see a decl:

  declare hidden void 
@_ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEED1Ev(%"class.std::__1::basic_string"*)
 unnamed_addr #9 align 2

(Note the hidden which prevent from finding it in the dyib)

And a use (after inlining):

  %1024 = call i32 @__cxa_atexit(void (i8*)* bitcast (void 
(%"class.std::__1::basic_string"*)* 
@_ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEED1Ev to void 
(i8*)*), i8* bitcast (%"class.std::__1::basic_string"* 
@_ZZN12_GLOBAL__N_13DFA16writeTableAndAPIERN4llvm11raw_ostreamERKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcE13SentinelEntry
 to i8*), i8* nonnull @__dso_handle) #1




https://reviews.llvm.org/D25624



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


[PATCH] D25624: Added 'inline' attribute to basic_string's destructor

2016-10-28 Thread Mehdi AMINI via cfe-commits
mehdi_amini added a comment.

FYI reproduced locally, and investigating now.


https://reviews.llvm.org/D25624



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


[PATCH] D25624: Added 'inline' attribute to basic_string's destructor

2016-10-28 Thread Mehdi AMINI via cfe-commits
mehdi_amini added a comment.

In https://reviews.llvm.org/D25624#582752, @mehdi_amini wrote:

> (The commit message is confusing, it mentions "Currently basic_string's 
> destructor is not getting inlined. So adding 'inline' attribute to 
> ~basic_string()", please add the quote of the standard and mention that it 
> enables instantiation)


(i.e. "inline" does not cause directly "inlining" here, this comes as a side 
effect of just starting to emit it)


https://reviews.llvm.org/D25624



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


[PATCH] D25624: Added 'inline' attribute to basic_string's destructor

2016-10-28 Thread Mehdi AMINI via cfe-commits
mehdi_amini added a comment.

Trying to figure out: it seems you are trying to address what I reported here: 
https://llvm.org/bugs/show_bug.cgi?id=26498 ; right?

> Except for inline functions, declarations with types deduced
>  from their initializer or return value (7.1.6.4), const 
>  variables of literal types, variables of reference types, 
>  and class template specializations, explicit instantiation
>  declarations have the effect of suppressing the implicit
>  instantiation of the entity to which they refer. [ Note: 
>  The intent is that an inline function that is the subject
>  of an explicit instantiation declaration will still be
>  implicitly instantiated when odr-used (3.2) so that the 
>  body can be considered for inlining, but that no 
>  out-of-line copy of the inline function would be generated
>  in the translation unit. — end note ]

So the `_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_TYPE_VIS basic_string)` 
block the instantiation of any non-inline template function. 
The effect of the "inline" keyword is actually allowing clang to actually 
instantiate and IRGen the function, so that it is available for inlining.

This seems like a generally good problem to solve for every such function and 
not only the destructor (I mentioned __init() as well in PR26498).

(The commit message is confusing, it mentions "Currently basic_string's 
destructor is not getting inlined. So adding 'inline' attribute to 
~basic_string()", please add the quote of the standard and mention that it 
enables instantiation)


https://reviews.llvm.org/D25624



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


[PATCH] D25624: Added 'inline' attribute to basic_string's destructor

2016-10-28 Thread Sebastian Pop via cfe-commits
sebpop added a comment.

In https://reviews.llvm.org/D25624#582731, @mehdi_amini wrote:

> I don't understand:
>
> 1. The motivation for this change


This is a change for performance: we have seen some benchmarks where inlining 
the string dtor brings performance up by 5%: from what I remember, there is a 
string ctor shortly followed by a dtor that could be optimized away if both the 
ctor and dtor are inlined.  We already committed the patch to do the ctor 
inlining, and that gave us some performance. This patch is what remains to get 
the rest of the performance by inlining the string dtor.

> 2. Why is this correct?

There seems to be a problem the patch uncovers, and we will investigate.
Thanks for pointing out this issue.


https://reviews.llvm.org/D25624



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


[PATCH] D23765: Fix for clang PR 29087

2016-10-28 Thread Taewook Oh via cfe-commits
twoh marked an inline comment as not done.
twoh added a comment.

Ping


https://reviews.llvm.org/D23765



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


Re: [libcxx] r285456 - Added 'inline' attribute to basic_string's destructor

2016-10-28 Thread Mehdi Amini via cfe-commits
Hi Adtiya,

I had to revert in r285485 to unbreak this build bot: 
http://lab.llvm.org:8080/green/job/clang-stage2-configure-Rlto_build/10737/ 

(LTO bootstrap of clang).

Let’s iterate on the revision on Phabricator to figure out what it the right 
fix!

Best,

— 
Mehdi


> On Oct 28, 2016, at 2:27 PM, Aditya Kumar via cfe-commits 
>  wrote:
> 
> Author: hiraditya
> Date: Fri Oct 28 16:27:24 2016
> New Revision: 285456
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=285456&view=rev
> Log:
> Added 'inline' attribute to basic_string's destructor
> 
> Author: laxmansole
> 
> Reviewers: howard.hinnant
>   mclow.lists
> Subscribers: EricWF, flyingforyou, evandro
> 
> Differential Revision: https://reviews.llvm.org/D25624
> 
> Reapplying the patch as the bug https://llvm.org/bugs/show_bug.cgi?id=30341 
> is fixed.
> 
> Currently basic_string's destructor is not getting inlined. So adding 
> 'inline' attribute to ~basic_string().
> Worked in collaboration with Aditya Kumar.
> 
> Modified:
>libcxx/trunk/include/string
> 
> Modified: libcxx/trunk/include/string
> URL: 
> http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/string?rev=285456&r1=285455&r2=285456&view=diff
> ==
> --- libcxx/trunk/include/string (original)
> +++ libcxx/trunk/include/string Fri Oct 28 16:27:24 2016
> @@ -806,6 +806,7 @@ public:
> basic_string(initializer_list __il, const allocator_type& 
> __a);
> #endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
> 
> +inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
> ~basic_string();
> 
> _LIBCPP_INLINE_VISIBILITY
> 
> 
> ___
> 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


[libcxx] r285485 - Revert "Added 'inline' attribute to basic_string's destructor"

2016-10-28 Thread Mehdi Amini via cfe-commits
Author: mehdi_amini
Date: Fri Oct 28 19:50:02 2016
New Revision: 285485

URL: http://llvm.org/viewvc/llvm-project?rev=285485&view=rev
Log:
Revert "Added 'inline' attribute to basic_string's destructor"

This reverts commit r285456, which broke LTO bootstrap on Darwin.

Modified:
libcxx/trunk/include/string

Modified: libcxx/trunk/include/string
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/string?rev=285485&r1=285484&r2=285485&view=diff
==
--- libcxx/trunk/include/string (original)
+++ libcxx/trunk/include/string Fri Oct 28 19:50:02 2016
@@ -806,7 +806,6 @@ public:
 basic_string(initializer_list __il, const allocator_type& __a);
 #endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
 
-inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
 ~basic_string();
 
 _LIBCPP_INLINE_VISIBILITY


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


[PATCH] D25624: Added 'inline' attribute to basic_string's destructor

2016-10-28 Thread Mehdi AMINI via cfe-commits
mehdi_amini added a comment.

I don't understand:

1. The motivation for this change
2. Why is this correct?

Can we restart the discussion here (I'm reverting to fix the LTO build failure 
here: 
http://lab.llvm.org:8080/green/job/clang-stage2-configure-Rlto_build/10737/console
 )


https://reviews.llvm.org/D25624



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


[PATCH] D25940: [analyzer] LibraryFunctions: Fix errors due to different integral types and typedefs on different architectures.

2016-10-28 Thread Anna Zaks via cfe-commits
zaks.anna added a comment.

How about this imperfect solution that will work quite well in practice? For 
the ssize_t case, where type size cannot be used, we check the function name, # 
of arguments , and check that the functions are coming from the system header.


https://reviews.llvm.org/D25940



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


[PATCH] D26109: Warn when 'assume_nonnull' infers nullability within an array.

2016-10-28 Thread Jordan Rose via cfe-commits
jordan_rose created this revision.
jordan_rose added a reviewer: doug.gregor.
jordan_rose added a subscriber: cfe-commits.
jordan_rose set the repository for this revision to rL LLVM.
jordan_rose added a dependency: D25850: Accept nullability annotations 
(_Nullable) on array parameters.

...or within a reference. Both of these add an extra level of indirection that 
make us less certain that the pointer really was supposed to be non-nullable. 
However, changing the default behavior would be a breaking change, so we'll 
just make it a warning instead.

Depends on https://reviews.llvm.org/D25850. Part of rdar://problem/25846421.


Repository:
  rL LLVM

https://reviews.llvm.org/D26109

Files:
  include/clang/Basic/DiagnosticGroups.td
  include/clang/Basic/DiagnosticSemaKinds.td
  lib/Sema/SemaType.cpp
  test/FixIt/nullability.mm
  test/SemaObjCXX/nullability-consistency-arrays.mm

Index: test/SemaObjCXX/nullability-consistency-arrays.mm
===
--- test/SemaObjCXX/nullability-consistency-arrays.mm
+++ test/SemaObjCXX/nullability-consistency-arrays.mm
@@ -1,9 +1,9 @@
-// RUN: %clang_cc1 -fsyntax-only -fblocks -I %S/Inputs %s -D ARRAYS_CHECKED=1 -verify
-// RUN: %clang_cc1 -fsyntax-only -fblocks -I %S/Inputs %s -D ARRAYS_CHECKED=0 -Wno-nullability-completeness-on-arrays -verify
-// RUN: %clang_cc1 -fsyntax-only -fblocks -I %S/Inputs %s -Wno-nullability-completeness -Werror
-// RUN: %clang_cc1 -fsyntax-only -fblocks -I %S/Inputs -x objective-c %s -D ARRAYS_CHECKED=1 -verify
-// RUN: %clang_cc1 -fsyntax-only -fblocks -I %S/Inputs -x objective-c %s -D ARRAYS_CHECKED=0 -Wno-nullability-completeness-on-arrays -verify
-// RUN: %clang_cc1 -fsyntax-only -fblocks -I %S/Inputs -x objective-c %s -Wno-nullability-completeness -Werror
+// RUN: %clang_cc1 -fsyntax-only -fblocks -I %S/Inputs -Wno-nullability-inferred-on-nested-type %s -D ARRAYS_CHECKED=1 -verify
+// RUN: %clang_cc1 -fsyntax-only -fblocks -I %S/Inputs -Wno-nullability-inferred-on-nested-type %s -D ARRAYS_CHECKED=0 -Wno-nullability-completeness-on-arrays -verify
+// RUN: %clang_cc1 -fsyntax-only -fblocks -I %S/Inputs -Wno-nullability-inferred-on-nested-type %s -Wno-nullability-completeness -Werror
+// RUN: %clang_cc1 -fsyntax-only -fblocks -I %S/Inputs -Wno-nullability-inferred-on-nested-type -x objective-c %s -D ARRAYS_CHECKED=1 -verify
+// RUN: %clang_cc1 -fsyntax-only -fblocks -I %S/Inputs -Wno-nullability-inferred-on-nested-type -x objective-c %s -D ARRAYS_CHECKED=0 -Wno-nullability-completeness-on-arrays -verify
+// RUN: %clang_cc1 -fsyntax-only -fblocks -I %S/Inputs -Wno-nullability-inferred-on-nested-type -x objective-c %s -Wno-nullability-completeness -Werror
 
 #include "nullability-consistency-arrays.h"
 
Index: test/FixIt/nullability.mm
===
--- /dev/null
+++ test/FixIt/nullability.mm
@@ -0,0 +1,68 @@
+// RUN: %clang_cc1 -fsyntax-only -fblocks -std=gnu++11 -verify %s
+// RUN: not %clang_cc1 -fdiagnostics-parseable-fixits -fblocks -std=gnu++11 %s 2>&1 | FileCheck %s
+
+#pragma clang assume_nonnull begin
+
+extern void *array[2]; // expected-warning {{inferring '_Nonnull' for pointer type within array is deprecated}}
+// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:14-[[@LINE-1]]:14}:" _Nonnull "
+
+extern void* array2[2]; // expected-warning {{inferring '_Nonnull' for pointer type within array is deprecated}}
+// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:13-[[@LINE-1]]:13}:" _Nonnull"
+
+extern void *nestedArray[2][3]; // expected-warning {{inferring '_Nonnull' for pointer type within array is deprecated}}
+// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:14-[[@LINE-1]]:14}:" _Nonnull "
+
+
+typedef const void *CFTypeRef;
+
+extern CFTypeRef typedefArray[2]; // expected-warning {{inferring '_Nonnull' for pointer type within array is deprecated}}
+// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:17-[[@LINE-1]]:17}:" _Nonnull"
+
+
+extern void *&ref; // expected-warning {{inferring '_Nonnull' for pointer type within reference is deprecated}}
+// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:14-[[@LINE-1]]:14}:"_Nonnull"
+
+extern void * &ref2; // expected-warning {{inferring '_Nonnull' for pointer type within reference is deprecated}}
+// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:14-[[@LINE-1]]:14}:" _Nonnull"
+
+extern void *&&ref3; // expected-warning {{inferring '_Nonnull' for pointer type within reference is deprecated}}
+// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:14-[[@LINE-1]]:14}:"_Nonnull"
+
+extern void * &&ref4; // expected-warning {{inferring '_Nonnull' for pointer type within reference is deprecated}}
+// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:14-[[@LINE-1]]:14}:" _Nonnull"
+
+extern void *(&arrayRef)[2]; // expected-warning {{inferring '_Nonnull' for pointer type within array is deprecated}}
+// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:14-[[@LINE-1]]:14}:"_Nonnull"
+
+extern void * (&arrayRef2)[2]; // expected-warning {{inferring '_Nonnull' for pointer type within array is deprec

[PATCH] D26108: Add -Wnullability-completeness-on-arrays.

2016-10-28 Thread Jordan Rose via cfe-commits
jordan_rose created this revision.
jordan_rose added a reviewer: doug.gregor.
jordan_rose added a subscriber: cfe-commits.
jordan_rose set the repository for this revision to rL LLVM.
jordan_rose added a dependency: D25850: Accept nullability annotations 
(_Nullable) on array parameters.

This is an addition to (and sub-warning of) -Wnullability-completeness that 
warns when an array parameter is missing nullability. When the specific warning 
is switched off, the compiler falls back to only warning on pointer types 
written as pointer types.

Note that use of nullability //within// an array triggers the completeness 
checks regardless of whether or not the array-specific warning is enabled; the 
intent there is simply to determine whether a particular header is trying to be 
nullability-aware at all.

Depends on https://reviews.llvm.org/D25850. Part of rdar://problem/25846421.


Repository:
  rL LLVM

https://reviews.llvm.org/D26108

Files:
  include/clang/Basic/DiagnosticGroups.td
  include/clang/Basic/DiagnosticSemaKinds.td
  lib/Sema/SemaType.cpp
  test/SemaObjCXX/Inputs/nullability-consistency-arrays.h
  test/SemaObjCXX/nullability-consistency-arrays.mm

Index: test/SemaObjCXX/nullability-consistency-arrays.mm
===
--- /dev/null
+++ test/SemaObjCXX/nullability-consistency-arrays.mm
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -fsyntax-only -fblocks -I %S/Inputs %s -D ARRAYS_CHECKED=1 -verify
+// RUN: %clang_cc1 -fsyntax-only -fblocks -I %S/Inputs %s -D ARRAYS_CHECKED=0 -Wno-nullability-completeness-on-arrays -verify
+// RUN: %clang_cc1 -fsyntax-only -fblocks -I %S/Inputs %s -Wno-nullability-completeness -Werror
+// RUN: %clang_cc1 -fsyntax-only -fblocks -I %S/Inputs -x objective-c %s -D ARRAYS_CHECKED=1 -verify
+// RUN: %clang_cc1 -fsyntax-only -fblocks -I %S/Inputs -x objective-c %s -D ARRAYS_CHECKED=0 -Wno-nullability-completeness-on-arrays -verify
+// RUN: %clang_cc1 -fsyntax-only -fblocks -I %S/Inputs -x objective-c %s -Wno-nullability-completeness -Werror
+
+#include "nullability-consistency-arrays.h"
+
+void h1(int *ptr) { } // don't warn
+
+void h2(int * _Nonnull p) { }
Index: test/SemaObjCXX/Inputs/nullability-consistency-arrays.h
===
--- /dev/null
+++ test/SemaObjCXX/Inputs/nullability-consistency-arrays.h
@@ -0,0 +1,87 @@
+void firstThingInTheFileThatNeedsNullabilityIsAnArray(int ints[]);
+#if ARRAYS_CHECKED
+// expected-warning@-2 {{array parameter is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified)}}
+#endif
+
+int *secondThingInTheFileThatNeedsNullabilityIsAPointer;
+#if !ARRAYS_CHECKED
+// expected-warning@-2 {{pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified)}}
+#endif
+
+int *_Nonnull triggerConsistencyWarnings;
+
+void test(
+int ints[],
+#if ARRAYS_CHECKED
+// expected-warning@-2 {{array parameter is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified)}}
+#endif
+void *ptrs[], // expected-warning {{pointer is missing a nullability type specifier}}
+#if ARRAYS_CHECKED
+// expected-warning@-2 {{array parameter is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified)}}
+#endif
+void **nestedPtrs[]); // expected-warning 2 {{pointer is missing a nullability type specifier}}
+#if ARRAYS_CHECKED
+// expected-warning@-2 {{array parameter is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified)}}
+#endif
+
+void testArraysOK(
+int ints[_Nonnull],
+void *ptrs[_Nonnull], // expected-warning {{pointer is missing a nullability type specifier}}
+void **nestedPtrs[_Nonnull]); // expected-warning 2 {{pointer is missing a nullability type specifier}}
+void testAllOK(
+int ints[_Nonnull],
+void * _Nullable ptrs[_Nonnull],
+void * _Nullable * _Nullable nestedPtrs[_Nonnull]);
+
+void nestedArrays(int x[5][1]) {}
+#if ARRAYS_CHECKED
+// expected-warning@-2 {{array parameter is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified)}}
+#endif
+void nestedArraysOK(int x[_Nonnull 5][1]) {}
+
+#if !__cplusplus
+void staticOK(int x[static 5][1]){}
+#endif
+
+int globalArraysDoNotNeedNullability[5];
+
+typedef int INTS[4];
+
+void typedefTest(
+INTS x,
+#if ARRAYS_CHECKED
+// expected-warning@-2 {{array parameter is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified)}}
+#endif
+INTS _Nonnull x2,
+_Nonnull INTS x3,
+INTS y[2],
+#if ARRAYS_CHECKED
+// expected-warning@-2 {{array parameter is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified)}}
+#endif
+INTS y2[_Nonnull 2]);
+
+
+#pragma clang assume_nonnull begin
+void testAssumeNonnull(
+  int ints[],
+#if ARRAYS_CHECKED
+// expected-warning@-2 {{array parameter is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified)}}
+#endif

[PATCH] D26105: Allow CaseStmt to be initialized with a SubStmt

2016-10-28 Thread Kareem Khazem via cfe-commits
khazem updated this revision to Diff 76272.
khazem added a comment.

(added more context)


https://reviews.llvm.org/D26105

Files:
  include/clang/AST/Stmt.h
  lib/AST/ASTImporter.cpp


Index: lib/AST/ASTImporter.cpp
===
--- lib/AST/ASTImporter.cpp
+++ lib/AST/ASTImporter.cpp
@@ -5102,12 +5102,15 @@
   Expr *ToRHS = Importer.Import(S->getRHS());
   if (!ToRHS && S->getRHS())
 return nullptr;
+  Stmt *SubStmt = Importer.Import(S->getSubStmt());
+  if (!SubStmt && S->getSubStmt())
+return nullptr;
   SourceLocation ToCaseLoc = Importer.Import(S->getCaseLoc());
   SourceLocation ToEllipsisLoc = Importer.Import(S->getEllipsisLoc());
   SourceLocation ToColonLoc = Importer.Import(S->getColonLoc());
-  return new (Importer.getToContext()) CaseStmt(ToLHS, ToRHS,
-ToCaseLoc, ToEllipsisLoc,
-ToColonLoc);
+  return new (Importer.getToContext()) CaseStmt(ToLHS, ToRHS, ToCaseLoc,
+ToEllipsisLoc, ToColonLoc,
+SubStmt);
 }
 
 Stmt *ASTNodeImporter::VisitDefaultStmt(DefaultStmt *S) {
Index: include/clang/AST/Stmt.h
===
--- include/clang/AST/Stmt.h
+++ include/clang/AST/Stmt.h
@@ -693,9 +693,10 @@
  // GNU "case 1 ... 4" extension
 public:
   CaseStmt(Expr *lhs, Expr *rhs, SourceLocation caseLoc,
-   SourceLocation ellipsisLoc, SourceLocation colonLoc)
+   SourceLocation ellipsisLoc, SourceLocation colonLoc,
+   Stmt *SubStmt=nullptr)
 : SwitchCase(CaseStmtClass, caseLoc, colonLoc) {
-SubExprs[SUBSTMT] = nullptr;
+SubExprs[SUBSTMT] = SubStmt;
 SubExprs[LHS] = reinterpret_cast(lhs);
 SubExprs[RHS] = reinterpret_cast(rhs);
 EllipsisLoc = ellipsisLoc;


Index: lib/AST/ASTImporter.cpp
===
--- lib/AST/ASTImporter.cpp
+++ lib/AST/ASTImporter.cpp
@@ -5102,12 +5102,15 @@
   Expr *ToRHS = Importer.Import(S->getRHS());
   if (!ToRHS && S->getRHS())
 return nullptr;
+  Stmt *SubStmt = Importer.Import(S->getSubStmt());
+  if (!SubStmt && S->getSubStmt())
+return nullptr;
   SourceLocation ToCaseLoc = Importer.Import(S->getCaseLoc());
   SourceLocation ToEllipsisLoc = Importer.Import(S->getEllipsisLoc());
   SourceLocation ToColonLoc = Importer.Import(S->getColonLoc());
-  return new (Importer.getToContext()) CaseStmt(ToLHS, ToRHS,
-ToCaseLoc, ToEllipsisLoc,
-ToColonLoc);
+  return new (Importer.getToContext()) CaseStmt(ToLHS, ToRHS, ToCaseLoc,
+ToEllipsisLoc, ToColonLoc,
+SubStmt);
 }
 
 Stmt *ASTNodeImporter::VisitDefaultStmt(DefaultStmt *S) {
Index: include/clang/AST/Stmt.h
===
--- include/clang/AST/Stmt.h
+++ include/clang/AST/Stmt.h
@@ -693,9 +693,10 @@
  // GNU "case 1 ... 4" extension
 public:
   CaseStmt(Expr *lhs, Expr *rhs, SourceLocation caseLoc,
-   SourceLocation ellipsisLoc, SourceLocation colonLoc)
+   SourceLocation ellipsisLoc, SourceLocation colonLoc,
+   Stmt *SubStmt=nullptr)
 : SwitchCase(CaseStmtClass, caseLoc, colonLoc) {
-SubExprs[SUBSTMT] = nullptr;
+SubExprs[SUBSTMT] = SubStmt;
 SubExprs[LHS] = reinterpret_cast(lhs);
 SubExprs[RHS] = reinterpret_cast(rhs);
 EllipsisLoc = ellipsisLoc;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D26105: Allow CaseStmt to be initialized with a SubStmt

2016-10-28 Thread Kareem Khazem via cfe-commits
khazem created this revision.
khazem added reviewers: a.sidorin, xazax.hun, doug.gregor, rsmith.
khazem added subscribers: phosek, cfe-commits, smklein.

The CaseStmt constructor now takes an optional SubStmt argument to initialize 
its SubExprs field with. This fixes an issue where the ASTImporter was 
constructing a CaseStmt and not setting its SubStmt member, causing a null 
pointer access when the SubStmt is accessed in the 
Stmt::stripLabelLikeStatements() function.


https://reviews.llvm.org/D26105

Files:
  include/clang/AST/Stmt.h
  lib/AST/ASTImporter.cpp


Index: lib/AST/ASTImporter.cpp
===
--- lib/AST/ASTImporter.cpp
+++ lib/AST/ASTImporter.cpp
@@ -5102,12 +5102,15 @@
   Expr *ToRHS = Importer.Import(S->getRHS());
   if (!ToRHS && S->getRHS())
 return nullptr;
+  Stmt *SubStmt = Importer.Import(S->getSubStmt());
+  if (!SubStmt && S->getSubStmt())
+return nullptr;
   SourceLocation ToCaseLoc = Importer.Import(S->getCaseLoc());
   SourceLocation ToEllipsisLoc = Importer.Import(S->getEllipsisLoc());
   SourceLocation ToColonLoc = Importer.Import(S->getColonLoc());
-  return new (Importer.getToContext()) CaseStmt(ToLHS, ToRHS,
-ToCaseLoc, ToEllipsisLoc,
-ToColonLoc);
+  return new (Importer.getToContext()) CaseStmt(ToLHS, ToRHS, ToCaseLoc,
+ToEllipsisLoc, ToColonLoc,
+SubStmt);
 }
 
 Stmt *ASTNodeImporter::VisitDefaultStmt(DefaultStmt *S) {
Index: include/clang/AST/Stmt.h
===
--- include/clang/AST/Stmt.h
+++ include/clang/AST/Stmt.h
@@ -693,9 +693,10 @@
  // GNU "case 1 ... 4" extension
 public:
   CaseStmt(Expr *lhs, Expr *rhs, SourceLocation caseLoc,
-   SourceLocation ellipsisLoc, SourceLocation colonLoc)
+   SourceLocation ellipsisLoc, SourceLocation colonLoc,
+   Stmt *SubStmt=nullptr)
 : SwitchCase(CaseStmtClass, caseLoc, colonLoc) {
-SubExprs[SUBSTMT] = nullptr;
+SubExprs[SUBSTMT] = SubStmt;
 SubExprs[LHS] = reinterpret_cast(lhs);
 SubExprs[RHS] = reinterpret_cast(rhs);
 EllipsisLoc = ellipsisLoc;


Index: lib/AST/ASTImporter.cpp
===
--- lib/AST/ASTImporter.cpp
+++ lib/AST/ASTImporter.cpp
@@ -5102,12 +5102,15 @@
   Expr *ToRHS = Importer.Import(S->getRHS());
   if (!ToRHS && S->getRHS())
 return nullptr;
+  Stmt *SubStmt = Importer.Import(S->getSubStmt());
+  if (!SubStmt && S->getSubStmt())
+return nullptr;
   SourceLocation ToCaseLoc = Importer.Import(S->getCaseLoc());
   SourceLocation ToEllipsisLoc = Importer.Import(S->getEllipsisLoc());
   SourceLocation ToColonLoc = Importer.Import(S->getColonLoc());
-  return new (Importer.getToContext()) CaseStmt(ToLHS, ToRHS,
-ToCaseLoc, ToEllipsisLoc,
-ToColonLoc);
+  return new (Importer.getToContext()) CaseStmt(ToLHS, ToRHS, ToCaseLoc,
+ToEllipsisLoc, ToColonLoc,
+SubStmt);
 }
 
 Stmt *ASTNodeImporter::VisitDefaultStmt(DefaultStmt *S) {
Index: include/clang/AST/Stmt.h
===
--- include/clang/AST/Stmt.h
+++ include/clang/AST/Stmt.h
@@ -693,9 +693,10 @@
  // GNU "case 1 ... 4" extension
 public:
   CaseStmt(Expr *lhs, Expr *rhs, SourceLocation caseLoc,
-   SourceLocation ellipsisLoc, SourceLocation colonLoc)
+   SourceLocation ellipsisLoc, SourceLocation colonLoc,
+   Stmt *SubStmt=nullptr)
 : SwitchCase(CaseStmtClass, caseLoc, colonLoc) {
-SubExprs[SUBSTMT] = nullptr;
+SubExprs[SUBSTMT] = SubStmt;
 SubExprs[LHS] = reinterpret_cast(lhs);
 SubExprs[RHS] = reinterpret_cast(rhs);
 EllipsisLoc = ellipsisLoc;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r285469 - Remove files missed in r285466

2016-10-28 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri Oct 28 17:54:24 2016
New Revision: 285469

URL: http://llvm.org/viewvc/llvm-project?rev=285469&view=rev
Log:
Remove files missed in r285466

Removed:
libcxx/trunk/src/libcpp_version.cpp
libcxx/trunk/test/libcxx/version.pass.cpp

Removed: libcxx/trunk/src/libcpp_version.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/libcpp_version.cpp?rev=285468&view=auto
==
--- libcxx/trunk/src/libcpp_version.cpp (original)
+++ libcxx/trunk/src/libcpp_version.cpp (removed)
@@ -1,14 +0,0 @@
-#include "__config"
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-// Test that _LIBCPP_VERSION and __libcpp_version are in sync.
-// The __libcpp_version file stores only a number representing the libc++
-// version so it can be easily parsed by clang.
-static_assert(_LIBCPP_VERSION ==
-#include "__libcpp_version"
-, "version file does not match");
-
-int __libcpp_library_version() { return _LIBCPP_VERSION; }
-
-_LIBCPP_END_NAMESPACE_STD

Removed: libcxx/trunk/test/libcxx/version.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/version.pass.cpp?rev=285468&view=auto
==
--- libcxx/trunk/test/libcxx/version.pass.cpp (original)
+++ libcxx/trunk/test/libcxx/version.pass.cpp (removed)
@@ -1,31 +0,0 @@
-// -*- C++ -*-
-//===--===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===--===//
-
-// UNSUPPORTED: with_system_cxx_lib
-
-// Test the _LIBCPP_VERSION and _LIBCPP_LIBRARY_VERSION macros
-
-#include <__config>
-
-#ifndef _LIBCPP_VERSION
-#error _LIBCPP_VERSION must be defined
-#endif
-
-#ifndef _LIBCPP_LIBRARY_VERSION
-#error _LIBCPP_LIBRARY_VERSION must be defined
-#endif
-
-#include 
-
-int main() {
-  assert(_LIBCPP_VERSION == _LIBCPP_LIBRARY_VERSION);
-  assert(std::__libcpp_library_version);
-  assert(_LIBCPP_LIBRARY_VERSION == std::__libcpp_library_version());
-}


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


[PATCH] D13330: Implement __attribute__((unique_instantiation))

2016-10-28 Thread Richard Smith via cfe-commits
rsmith added a comment.

I think this attribute is poorly named. Explicit instantiation definitions are 
*already* required to be globally unique; see [temp.spec]/5.1:

"For a given template and a given set of template-arguments, an explicit 
instantiation definition shall appear at most once in a program"

The actual meaning of the attribute is that an explicit instantiation 
declaration will appear before any use that might trigger implicit 
instantiation. To that end, something like 
`__attribute__((declared_before_all_uses))` might be clearer.




Comment at: include/clang/Basic/AttrDocs.td:2321-2323
+When the unique_instantiation attribute is specified on an explicit template
+instantiation, the compiler is given license to emit strong symbols for
+this specific explicit template instantiation.

The primary description of the attribute should specify what it means, not the 
consequences of that meaning. In this case, the meaning is that the programmer 
is guaranteeing to the compiler that an explicit instantiation precedes all 
implicit instantiations, and the consequence is that we can use strong symbols.



Comment at: include/clang/Basic/AttrDocs.td:1736-1755
+// Explicit template definition (in exactly ONE .cpp file)
+template struct __attribute__((unique_instantiation)) my_template;
+
+
+When the unique_instantiation attribute is specified on an explicit template
+instantiation, the compiler is given license to emit strong symbols for
+this specific explicit template instantiation.

loladiro wrote:
> majnemer wrote:
> > Instead of using all-caps for emphasis in "ONE" and "MUST", why not bold 
> > the text instead?  It would catch the eye a little faster.
> Sure! I assume, this follows standard RST conventions where ** is bold?
Yes, this documentation allows arbitrary RST markup. But I don't see the need 
for strong emphasis here.



Comment at: include/clang/Basic/DiagnosticSemaKinds.td:2456
+def err_unique_instantiation_not_previous : Error<
+  "'unique_instantiation' attribute must be specified for all declarations and 
definitions of this explicit template instantiation">;
 

loladiro wrote:
> aaron.ballman wrote:
> > > They are checking for two different conditions in the spec. One requires 
> > > that all explicit template instantiations with this attribute have a 
> > > declaration, the other that every declaration/definition has the 
> > > attribute.
> > 
> > Okay, I see now what this diagnostic is attempting to convey. I think it 
> > should read:
> > ```
> > def err_unique_instantiation_no_declaration : Error<
> >   "'unique_instantiation' attribute on an explicit instantiation requires a 
> > previous explicit instantiation declaration">;
> > ```
> Sounds good.
This seems like an unnecessarily-strict rule to me. I don't see a reason to 
disallow:
```
// in header
extern template struct __attribute__((whatever_its_called)) X;
```
```
// in source file
template struct X;
```
There doesn't appear to be any safety or correctness concern here. In general, 
it seems like the attribute is only promising that the explicit instantiation 
declaration precedes any other instantiation, so the only necessary rule would 
seem to be: if the attribute is present on any explicit instantiation, the 
first point of instantiation must be an explicit instantiation declaration that 
has the attribute.



Comment at: lib/AST/ASTContext.cpp:8789
 
-  return GVA_DiscardableODR;
+  return  GVA_DiscardableODR;
 }

revert this change



Comment at: lib/Sema/SemaDecl.cpp:2396-2397
+  // Explicit template instantiations need special handling because in certain
+  // ABIs explicit template definitions may add attributes over explicit
+  // template declarations. In clang getDefinition() will get the
+  // ClassTemplateSpecializationDecl associated with the class template

I assume you mean "explicit instantiation" rather than "explicit template" here 
(2x).



Comment at: lib/Sema/SemaDecl.cpp:2398-2399
+  // template declarations. In clang getDefinition() will get the
+  // ClassTemplateSpecializationDecl associated with the class template
+  // declaration, so we'd give incorrect warnings here.
+  if (auto *CTSD = dyn_cast(New)) {

I have no idea what you mean by this. Did you mean "associated with the 
explicit instantiation declaration" or something like that?



Comment at: lib/Sema/SemaDeclAttr.cpp:5400
+  if (!CTSD->getPreviousDecl())
+S.Diag(Attr.getLoc(), diag::err_unique_instantiation_no_declaration);
+}

Why is this rule only applied to explicit instantiations of class templates, 
and not to function or variable templates?



Comment at: lib/Sema/SemaDeclCXX.cpp:5666-5685
+/// \brief Check if the new class needs a unique instantiation attribute
+/

[libcxx] r285466 - Revert addition of __libcpp_library_version

2016-10-28 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri Oct 28 17:37:24 2016
New Revision: 285466

URL: http://llvm.org/viewvc/llvm-project?rev=285466&view=rev
Log:
Revert addition of __libcpp_library_version

Modified:
libcxx/trunk/include/__config
libcxx/trunk/lib/abi/CHANGELOG.TXT
libcxx/trunk/lib/abi/x86_64-apple-darwin16.0.abilist
libcxx/trunk/lib/abi/x86_64-linux-gnu.abilist

Modified: libcxx/trunk/include/__config
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=285466&r1=285465&r2=285466&view=diff
==
--- libcxx/trunk/include/__config (original)
+++ libcxx/trunk/include/__config Fri Oct 28 17:37:24 2016
@@ -908,15 +908,6 @@ extern "C" void __sanitizer_annotate_con
 #define _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF
 #endif
 
-extern "C++" {
-_LIBCPP_BEGIN_NAMESPACE_STD
-_LIBCPP_FUNC_VIS _LIBCPP_WEAK  int __libcpp_library_version();
-_LIBCPP_END_NAMESPACE_STD
-}
-
-#define _LIBCPP_LIBRARY_VERSION \
- (_VSTD::__libcpp_library_version ? _VSTD::__libcpp_library_version() : -1)
-
 #endif // __cplusplus
 
 #endif // _LIBCPP_CONFIG

Modified: libcxx/trunk/lib/abi/CHANGELOG.TXT
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/lib/abi/CHANGELOG.TXT?rev=285466&r1=285465&r2=285466&view=diff
==
--- libcxx/trunk/lib/abi/CHANGELOG.TXT (original)
+++ libcxx/trunk/lib/abi/CHANGELOG.TXT Fri Oct 28 17:37:24 2016
@@ -16,11 +16,6 @@ New entries should be added directly bel
 Version 4.0
 ---
 
-* r285382 - Add __libcpp_library_version
-
-  all platforms
-  -
-  Symbol added: _ZNSt3__124__libcpp_library_versionEv
 
 * r285101 - Add -fvisibility-inlines-hidden when building libc++.
 

Modified: libcxx/trunk/lib/abi/x86_64-apple-darwin16.0.abilist
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/lib/abi/x86_64-apple-darwin16.0.abilist?rev=285466&r1=285465&r2=285466&view=diff
==
--- libcxx/trunk/lib/abi/x86_64-apple-darwin16.0.abilist (original)
+++ libcxx/trunk/lib/abi/x86_64-apple-darwin16.0.abilist Fri Oct 28 17:37:24 
2016
@@ -1213,7 +1213,6 @@
 {'type': 'FUNC', 'name': '__ZNSt3__121recursive_timed_mutexD1Ev'}
 {'type': 'FUNC', 'name': '__ZNSt3__121recursive_timed_mutexD2Ev'}
 {'type': 'FUNC', 'name': '__ZNSt3__121undeclare_no_pointersEPcm'}
-{'type': 'FUNC', 'name': '__ZNSt3__124__libcpp_library_versionEv'}
 {'type': 'FUNC', 'name': 
'__ZNSt3__125notify_all_at_thread_exitERNS_18condition_variableENS_11unique_lockINS_5mutexEEE'}
 {'type': 'FUNC', 'name': 
'__ZNSt3__127__insertion_sort_incompleteIRNS_6__lessIaaEEPaEEbT0_S5_T_'}
 {'type': 'FUNC', 'name': 
'__ZNSt3__127__insertion_sort_incompleteIRNS_6__lessIccEEPcEEbT0_S5_T_'}

Modified: libcxx/trunk/lib/abi/x86_64-linux-gnu.abilist
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/lib/abi/x86_64-linux-gnu.abilist?rev=285466&r1=285465&r2=285466&view=diff
==
--- libcxx/trunk/lib/abi/x86_64-linux-gnu.abilist (original)
+++ libcxx/trunk/lib/abi/x86_64-linux-gnu.abilist Fri Oct 28 17:37:24 2016
@@ -1141,7 +1141,6 @@
 {'type': 'FUNC', 'name': '_ZNSt3__121recursive_timed_mutexD1Ev'}
 {'type': 'FUNC', 'name': '_ZNSt3__121recursive_timed_mutexD2Ev'}
 {'type': 'FUNC', 'name': '_ZNSt3__121undeclare_no_pointersEPcm'}
-{'type': 'FUNC', 'name': '_ZNSt3__124__libcpp_library_versionEv'}
 {'type': 'FUNC', 'name': '_ZNSt3__125__num_get_signed_integralIlEET_PKcS3_Rji'}
 {'type': 'FUNC', 'name': '_ZNSt3__125__num_get_signed_integralIxEET_PKcS3_Rji'}
 {'type': 'FUNC', 'name': 
'_ZNSt3__125notify_all_at_thread_exitERNS_18condition_variableENS_11unique_lockINS_5mutexEEE'}


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


[PATCH] D13419: Fix several problems at the intersection of template instantiations and visibility

2016-10-28 Thread Richard Smith via cfe-commits
rsmith added a comment.

Please factor out the fix for `getTemplateInstantiationPattern` and commit it 
separately. https://reviews.llvm.org/D25942 has a testcase for that portion of 
this change.




Comment at: lib/AST/Decl.cpp:1057-1058
+RD->getTemplateInstantiationPattern();
+if (!InstantiatedFrom)
+  InstantiatedFrom = RD->getInstantiatedFromMemberClass();
 if (InstantiatedFrom)

This doesn't seem to match GCC; GCC seems to do this for all kinds of member 
specialization, not just for member class specialization:

```
template struct A {
  template struct __attribute__((visibility("hidden"))) B;
};
template<> template struct A::B { virtual void f() {} };
void g() { A::B().f(); }
```

Here, A::B gets hidden visibility, even though it was instantiated 
from the member template specialization `A::B` which had no visibility 
attribute.

I don't know what the underlying logic is here -- does GCC look at the 
visibility on the enclosing class when computing visibility for a member class? 
-- but I don't think this one special case covers it.



Comment at: lib/AST/Decl.cpp:1096-1097
+FunctionDecl *InstantiatedFrom = fn->getTemplateInstantiationPattern();
+if (!InstantiatedFrom)
+  InstantiatedFrom = fn->getInstantiatedFromMemberFunction();
 

Likewise.



Comment at: lib/AST/DeclCXX.cpp:1349-1354
+  while (!CTD->isMemberSpecialization()) {
+auto *NewCTD = CTD->getInstantiatedFromMemberTemplate();
+if (!NewCTD)
   break;
 CTD = NewCTD;
   }

The same bug exists in `VarDecl::getTemplateInstantiationPattern`; can you fix 
it there too?


Repository:
  rL LLVM

https://reviews.llvm.org/D13419



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


[PATCH] D13419: Fix several problems at the intersection of template instantiations and visibility

2016-10-28 Thread Keno Fischer via cfe-commits
loladiro updated this revision to Diff 76257.
loladiro added a comment.

Add the expected-error annotation


Repository:
  rL LLVM

https://reviews.llvm.org/D13419

Files:
  lib/AST/Decl.cpp
  lib/AST/DeclCXX.cpp
  test/CodeGenCXX/visibility.cpp
  test/Modules/cxx-templates.cpp

Index: test/Modules/cxx-templates.cpp
===
--- test/Modules/cxx-templates.cpp
+++ test/Modules/cxx-templates.cpp
@@ -199,7 +199,7 @@
 cls uk4; // expected-error 1+{{partial specialization of 'cls' must be imported}} expected-error 1+{{definition of}}
 cls::nested_cls unk1; // expected-error 1+{{explicit specialization of 'nested_cls' must be imported}} expected-error 1+{{definition of}}
 cls::nested_cls_t unk2; // expected-error 1+{{explicit specialization of 'nested_cls_t' must be imported}} expected-error 1+{{definition of}}
-cls::nested_cls_t unk3; // expected-error 1+{{explicit specialization of 'nested_cls_t' must be imported}}
+cls::nested_cls_t unk3; // expected-error 1+{{explicit specialization of 'nested_cls_t' must be imported}} expected-error 1+{{definition of}}
 
 // For enums, uses that would trigger instantiations of definitions are not
 // allowed.
Index: test/CodeGenCXX/visibility.cpp
===
--- test/CodeGenCXX/visibility.cpp
+++ test/CodeGenCXX/visibility.cpp
@@ -1317,3 +1317,59 @@
   // CHECK-LABEL: define void @_ZN6test693foo1fEv
   // CHECK-HIDDEN-LABEL: define hidden void @_ZN6test693foo1fEv
 }
+
+namespace test70 {
+template 
+class foo {
+public:
+  T x;
+  template 
+  HIDDEN S AddS(S);
+  template 
+  class HIDDEN barS {
+  public:
+static S AddS2(foo x, S);
+  };
+  template 
+  class HIDDEN barZ {
+  public:
+template 
+static S AddSZ(foo x, S, Z);
+  };
+};
+
+// CHECK: define linkonce_odr hidden i64 @_ZN6test703fooIiE4AddSIxEET_S3_
+// CHECK-NOT: define linkonce_odr i64 @_ZN6test703fooIiE4AddSIxEET_S3_
+template 
+template 
+HIDDEN S foo::AddS(S y) {
+  return ((S)x) + y;
+}
+
+// CHECK: define linkonce_odr hidden i64 @_ZN6test703fooIiE4barSIxE5AddS2ES1_x
+// CHECK-NOT: define linkonce_odr i64 @_ZN6test703fooIiE4barSIxE5AddS2ES1_x
+template 
+template 
+HIDDEN S foo::barS::AddS2(foo x, S y) {
+  return ((S)x.x) + y;
+}
+
+// CHECK: define linkonce_odr hidden i64 @_ZN6test703fooIiE4barZIxE5AddSZIcEExS1_xT_
+// CHECK-NOT: define linkonce_odr i64 @_ZN6test703fooIiE4barZIxE5AddSZIcEExS1_xT_
+template 
+template 
+template 
+HIDDEN S foo::barZ::AddSZ(foo x, S y, Z z) {
+  return ((S)x.x) + y + ((S)z);
+}
+
+extern template struct foo;
+template struct foo;
+
+void f() {
+  auto var = foo{5};
+  auto bar = var.AddS((long long)3);
+  auto bar2 = decltype(var)::barS::AddS2(var, 3);
+  auto bar3 = decltype(var)::barZ::AddSZ(var, 3, (char)0);
+}
+}
Index: lib/AST/DeclCXX.cpp
===
--- lib/AST/DeclCXX.cpp
+++ lib/AST/DeclCXX.cpp
@@ -1346,17 +1346,19 @@
   if (auto *TD = dyn_cast(this)) {
 auto From = TD->getInstantiatedFrom();
 if (auto *CTD = From.dyn_cast()) {
-  while (auto *NewCTD = CTD->getInstantiatedFromMemberTemplate()) {
-if (NewCTD->isMemberSpecialization())
+  while (!CTD->isMemberSpecialization()) {
+auto *NewCTD = CTD->getInstantiatedFromMemberTemplate();
+if (!NewCTD)
   break;
 CTD = NewCTD;
   }
   return CTD->getTemplatedDecl()->getDefinition();
 }
 if (auto *CTPSD =
 From.dyn_cast()) {
-  while (auto *NewCTPSD = CTPSD->getInstantiatedFromMember()) {
-if (NewCTPSD->isMemberSpecialization())
+  while (!CTPSD->isMemberSpecialization()) {
+auto *NewCTPSD = CTPSD->getInstantiatedFromMember();
+if (!NewCTPSD)
   break;
 CTPSD = NewCTPSD;
   }
Index: lib/AST/Decl.cpp
===
--- lib/AST/Decl.cpp
+++ lib/AST/Decl.cpp
@@ -1052,7 +1052,10 @@
   // If this is a member class of a specialization of a class template
   // and the corresponding decl has explicit visibility, use that.
   if (const auto *RD = dyn_cast(ND)) {
-CXXRecordDecl *InstantiatedFrom = RD->getInstantiatedFromMemberClass();
+const CXXRecordDecl *InstantiatedFrom =
+RD->getTemplateInstantiationPattern();
+if (!InstantiatedFrom)
+  InstantiatedFrom = RD->getInstantiatedFromMemberClass();
 if (InstantiatedFrom)
   return getVisibilityOf(InstantiatedFrom, kind);
   }
@@ -1086,16 +1089,13 @@
   }
   // Also handle function template specializations.
   if (const auto *fn = dyn_cast(ND)) {
-// If the function is a specialization of a template with an
-// explicit visibility attribute, use that.
-if (FunctionTemplateSpecializationInfo *templateInfo
-  = fn->getTemplateSpecializationInfo())
-  return getVisibilityOf(templateInfo->getTemplate()->getTemplatedDecl(),
-   

[PATCH] D13330: Implement __attribute__((unique_instantiation))

2016-10-28 Thread Keno Fischer via cfe-commits
loladiro updated this revision to Diff 76256.
loladiro added a comment.

Fix for the corner case I found and add it as a test.


Repository:
  rL LLVM

https://reviews.llvm.org/D13330

Files:
  include/clang/Basic/Attr.td
  include/clang/Basic/AttrDocs.td
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/Sema/AttributeList.h
  include/clang/Sema/Sema.h
  lib/AST/ASTContext.cpp
  lib/CodeGen/CGVTables.cpp
  lib/Sema/SemaDecl.cpp
  lib/Sema/SemaDeclAttr.cpp
  lib/Sema/SemaDeclCXX.cpp
  lib/Sema/SemaTemplate.cpp
  test/CodeGenCXX/unique-instantiation.cpp
  test/SemaCXX/unique-instantiations.cpp
  utils/TableGen/ClangAttrEmitter.cpp

Index: utils/TableGen/ClangAttrEmitter.cpp
===
--- utils/TableGen/ClangAttrEmitter.cpp
+++ utils/TableGen/ClangAttrEmitter.cpp
@@ -2662,6 +2662,8 @@
 case Func | ObjCMethod | Param: return "ExpectedFunctionMethodOrParameter";
 case Func | ObjCMethod: return "ExpectedFunctionOrMethod";
 case Func | Var: return "ExpectedVariableOrFunction";
+case Func | Class:
+  return "ExpectedFunctionOrClass";
 
 // If not compiling for C++, the class portion does not apply.
 case Func | Var | Class:
Index: test/SemaCXX/unique-instantiations.cpp
===
--- /dev/null
+++ test/SemaCXX/unique-instantiations.cpp
@@ -0,0 +1,62 @@
+// RUN: %clang -cc1 -std=c++14 -fsyntax-only -verify %s
+
+// Correct usage
+template 
+struct foo {};
+extern template struct __attribute__((unique_instantiation)) foo;
+template struct __attribute__((unique_instantiation)) foo;
+
+template 
+T pi = T(3.1415926535897932385);
+extern template __attribute__((unique_instantiation)) float pi;
+template __attribute__((unique_instantiation)) float pi;
+
+// Usages on non-templates
+float __attribute__((unique_instantiation)) notpi(2.71828182845904523536028747135); // expected-error{{'unique_instantiation' attribute only applies to explicit template declarations or definitions}}
+struct __attribute__((unique_instantiation)) bar {};// expected-error{{'unique_instantiation' attribute only applies to explicit template declarations or definitions}}
+void __attribute__((unique_instantiation)) func() {}// expected-error{{'unique_instantiation' attribute only applies to explicit template declarations or definitions}}
+
+// Usages that violate one of the conditions required conditions
+template 
+struct foo1 {};
+template struct __attribute__((unique_instantiation)) foo1; // expected-error{{'unique_instantiation' attribute on an explicit instantiation requires a previous explicit instantiation declaration}}
+
+template 
+T pi1 = T(3.1415926535897932385);
+template __attribute__((unique_instantiation)) float pi1; // expected-error{{'unique_instantiation' attribute on an explicit instantiation requires a previous explicit instantiation declaration}}
+
+template 
+struct foo2 {};
+extern template struct foo2;// expected-note{{previous explicit instantiation is here}}
+template struct __attribute__((unique_instantiation)) foo2; // expected-error{{'unique_instantiation' attribute must be specified for all declarations and definitions of this explicit template instantiation}}
+
+template 
+struct foo3 {};
+extern template struct __attribute__((unique_instantiation)) foo3; // expected-note{{previous explicit instantiation is here}}
+extern template struct foo3;   // expected-error{{'unique_instantiation' attribute must be specified for all declarations and definitions of this explicit template instantiation}}
+
+template 
+struct __attribute__((unique_instantiation)) foo4 {}; // expected-error{{'unique_instantiation' attribute only applies to explicit template declarations or definitions}}
+
+template 
+struct foo5 {};
+extern template struct __attribute__((unique_instantiation)) foo5; // expected-note{{previous explicit instantiation is here}}
+template struct foo5;  // expected-error{{'unique_instantiation' attribute must be specified for all declarations and definitions of this explicit template instantiation}}
+
+template 
+struct foo6 {};
+extern template struct __attribute__((unique_instantiation(16))) foo6; // expected-error{{'unique_instantiation' attribute takes no arguments}}
+
+template 
+struct static_separate_template {
+typedef T element;
+static T *a_static_field;
+};
+extern template struct __attribute__((unique_instantiation)) static_separate_template;
+template struct __attribute__((unique_instantiation)) static_separate_template;
+extern template struct __attribute__((unique_instantiation)) static_separate_template; // expected-note{{previous explicit instantiation is here}}
+template struct __attribute__((unique_instantiation)) static_separate_template;
+
+template  typename static_se

r285458 - Make a function static. NFC.

2016-10-28 Thread George Burgess IV via cfe-commits
Author: gbiv
Date: Fri Oct 28 16:42:06 2016
New Revision: 285458

URL: http://llvm.org/viewvc/llvm-project?rev=285458&view=rev
Log:
Make a function static. NFC.

Modified:
cfe/trunk/lib/Sema/SemaOverload.cpp

Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=285458&r1=285457&r2=285458&view=diff
==
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Fri Oct 28 16:42:06 2016
@@ -8982,10 +8982,9 @@ enum OverloadCandidateKind {
   oc_inherited_constructor_template
 };
 
-OverloadCandidateKind ClassifyOverloadCandidate(Sema &S,
-NamedDecl *Found,
-FunctionDecl *Fn,
-std::string &Description) {
+static OverloadCandidateKind
+ClassifyOverloadCandidate(Sema &S, NamedDecl *Found, FunctionDecl *Fn,
+  std::string &Description) {
   bool isTemplate = false;
 
   if (FunctionTemplateDecl *FunTmpl = Fn->getPrimaryTemplate()) {


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


[PATCH] D25284: AvailabilityAttrs: Delay partial availability diagnostics

2016-10-28 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL285457: [Sema] Delay partial availability diagnostics, just 
like deprecated (authored by epilk).

Changed prior to commit:
  https://reviews.llvm.org/D25284?vs=74738&id=76250#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D25284

Files:
  cfe/trunk/include/clang/Sema/DelayedDiagnostic.h
  cfe/trunk/lib/Sema/DelayedDiagnostic.cpp
  cfe/trunk/lib/Sema/SemaDeclAttr.cpp
  cfe/trunk/test/SemaObjC/unguarded-availability.m

Index: cfe/trunk/test/SemaObjC/unguarded-availability.m
===
--- cfe/trunk/test/SemaObjC/unguarded-availability.m
+++ cfe/trunk/test/SemaObjC/unguarded-availability.m
@@ -63,7 +63,7 @@
 #ifdef OBJCPP
 // expected-note@+2 {{marked partial here}}
 #endif
-typedef int int_10_12 AVAILABLE_10_12; // expected-note 3 {{'int_10_12' has been explicitly marked partial here}}
+typedef int int_10_12 AVAILABLE_10_12; // expected-note 2 {{'int_10_12' has been explicitly marked partial here}}
 
 void use_typedef() {
   int_10_11 x; // expected-warning{{'int_10_11' is only available on macOS 10.11 or newer}} expected-note{{enclose 'int_10_11' in an @available check to silence this warning}}
@@ -127,8 +127,7 @@
 
 void test_params(int_10_12 x); // expected-warning {{'int_10_12' is partial: introduced in macOS 10.12}} expected-note{{redeclare}}
 
-// FIXME: This should be fine!
-void test_params2(int_10_12 x) AVAILABLE_10_12; // expected-warning {{'int_10_12' is partial: introduced in macOS 10.12}} expected-note{{redeclare}}
+void test_params2(int_10_12 x) AVAILABLE_10_12; // no warn
 
 #ifdef OBJCPP
 
Index: cfe/trunk/lib/Sema/DelayedDiagnostic.cpp
===
--- cfe/trunk/lib/Sema/DelayedDiagnostic.cpp
+++ cfe/trunk/lib/Sema/DelayedDiagnostic.cpp
@@ -20,50 +20,41 @@
 using namespace sema;
 
 DelayedDiagnostic
-DelayedDiagnostic::makeAvailability(AvailabilityResult AD,
+DelayedDiagnostic::makeAvailability(AvailabilityResult AR,
 SourceLocation Loc,
 const NamedDecl *D,
 const ObjCInterfaceDecl *UnknownObjCClass,
 const ObjCPropertyDecl  *ObjCProperty,
 StringRef Msg,
 bool ObjCPropertyAccess) {
   DelayedDiagnostic DD;
-  switch (AD) {
-  case AR_Deprecated:
-DD.Kind = Deprecation;
-break;
-  case AR_Unavailable:
-DD.Kind = Unavailable;
-break;
-  default:
-llvm_unreachable("partial diags should not be delayed");
-  }
+  DD.Kind = Availability;
   DD.Triggered = false;
   DD.Loc = Loc;
-  DD.DeprecationData.Decl = D;
-  DD.DeprecationData.UnknownObjCClass = UnknownObjCClass;
-  DD.DeprecationData.ObjCProperty = ObjCProperty;
+  DD.AvailabilityData.Decl = D;
+  DD.AvailabilityData.UnknownObjCClass = UnknownObjCClass;
+  DD.AvailabilityData.ObjCProperty = ObjCProperty;
   char *MessageData = nullptr;
   if (Msg.size()) {
 MessageData = new char [Msg.size()];
 memcpy(MessageData, Msg.data(), Msg.size());
   }
 
-  DD.DeprecationData.Message = MessageData;
-  DD.DeprecationData.MessageLen = Msg.size();
-  DD.DeprecationData.ObjCPropertyAccess = ObjCPropertyAccess;
+  DD.AvailabilityData.Message = MessageData;
+  DD.AvailabilityData.MessageLen = Msg.size();
+  DD.AvailabilityData.AR = AR;
+  DD.AvailabilityData.ObjCPropertyAccess = ObjCPropertyAccess;
   return DD;
 }
 
 void DelayedDiagnostic::Destroy() {
-  switch (static_cast(Kind)) {
+  switch (Kind) {
   case Access: 
 getAccessData().~AccessedEntity(); 
 break;
 
-  case Deprecation:
-  case Unavailable:
-delete [] DeprecationData.Message;
+  case Availability:
+delete[] AvailabilityData.Message;
 break;
 
   case ForbiddenType:
Index: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
===
--- cfe/trunk/lib/Sema/SemaDeclAttr.cpp
+++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp
@@ -6510,9 +6510,6 @@
 break;
 
   case AR_NotYetIntroduced:
-assert(!S.getCurFunctionOrMethodDecl() &&
-   "Function-level partial availablity should not be diagnosed here!");
-
 diag = diag::warn_partial_availability;
 diag_message = diag::warn_partial_message;
 diag_fwdclass_message = diag::warn_partial_fwdclass_message;
@@ -6585,15 +6582,14 @@
 
 static void handleDelayedAvailabilityCheck(Sema &S, DelayedDiagnostic &DD,
Decl *Ctx) {
-  assert(DD.Kind == DelayedDiagnostic::Deprecation ||
- DD.Kind == DelayedDiagnostic::Unavailable);
-  AvailabilityResult AR = DD.Kind == DelayedDiagnostic::Deprecation
-  ? AR_Deprecated
-  : AR_Unavailable;
+  assert(DD.Kind == DelayedDiagnostic::Availability &&
+ "Expected an availability diagno

r285457 - [Sema] Delay partial availability diagnostics, just like deprecated

2016-10-28 Thread Erik Pilkington via cfe-commits
Author: epilk
Date: Fri Oct 28 16:39:27 2016
New Revision: 285457

URL: http://llvm.org/viewvc/llvm-project?rev=285457&view=rev
Log:
[Sema] Delay partial availability diagnostics, just like deprecated

This is done so that the following compiles with no warnings:
int fn(type_10_12) __attribute__((availability(macos, introduced=10.12)));

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

Modified:
cfe/trunk/include/clang/Sema/DelayedDiagnostic.h
cfe/trunk/lib/Sema/DelayedDiagnostic.cpp
cfe/trunk/lib/Sema/SemaDeclAttr.cpp
cfe/trunk/test/SemaObjC/unguarded-availability.m

Modified: cfe/trunk/include/clang/Sema/DelayedDiagnostic.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/DelayedDiagnostic.h?rev=285457&r1=285456&r2=285457&view=diff
==
--- cfe/trunk/include/clang/Sema/DelayedDiagnostic.h (original)
+++ cfe/trunk/include/clang/Sema/DelayedDiagnostic.h Fri Oct 28 16:39:27 2016
@@ -113,9 +113,9 @@ private:
 /// the complete parsing of the current declaration.
 class DelayedDiagnostic {
 public:
-  enum DDKind { Deprecation, Unavailable, Access, ForbiddenType };
+  enum DDKind : unsigned char { Availability, Access, ForbiddenType };
 
-  unsigned char Kind; // actually a DDKind
+  DDKind Kind;
   bool Triggered;
 
   SourceLocation Loc;
@@ -164,17 +164,19 @@ public:
 return *reinterpret_cast(AccessData);
   }
 
-  const NamedDecl *getDeprecationDecl() const {
-assert((Kind == Deprecation || Kind == Unavailable) &&
-   "Not a deprecation diagnostic.");
-return DeprecationData.Decl;
+  const NamedDecl *getAvailabilityDecl() const {
+assert(Kind == Availability && "Not an availability diagnostic.");
+return AvailabilityData.Decl;
   }
 
-  StringRef getDeprecationMessage() const {
-assert((Kind == Deprecation || Kind == Unavailable) &&
-   "Not a deprecation diagnostic.");
-return StringRef(DeprecationData.Message,
-   DeprecationData.MessageLen);
+  StringRef getAvailabilityMessage() const {
+assert(Kind == Availability && "Not an availability diagnostic.");
+return StringRef(AvailabilityData.Message, AvailabilityData.MessageLen);
+  }
+
+  AvailabilityResult getAvailabilityResult() const {
+assert(Kind == Availability && "Not an availability diagnostic.");
+return AvailabilityData.AR;
   }
 
   /// The diagnostic ID to emit.  Used like so:
@@ -195,27 +197,28 @@ public:
 assert(Kind == ForbiddenType && "not a forbidden-type diagnostic");
 return QualType::getFromOpaquePtr(ForbiddenTypeData.OperandType);
   }
-  
+
   const ObjCInterfaceDecl *getUnknownObjCClass() const {
-return DeprecationData.UnknownObjCClass;
+return AvailabilityData.UnknownObjCClass;
   }
 
   const ObjCPropertyDecl *getObjCProperty() const {
-return DeprecationData.ObjCProperty;
+return AvailabilityData.ObjCProperty;
   }
-
+
   bool getObjCPropertyAccess() const {
-return DeprecationData.ObjCPropertyAccess;
+return AvailabilityData.ObjCPropertyAccess;
   }
-  
+
 private:
 
-  struct DD {
+  struct AD {
 const NamedDecl *Decl;
 const ObjCInterfaceDecl *UnknownObjCClass;
 const ObjCPropertyDecl  *ObjCProperty;
 const char *Message;
 size_t MessageLen;
+AvailabilityResult AR;
 bool ObjCPropertyAccess;
   };
 
@@ -226,8 +229,7 @@ private:
   };
 
   union {
-/// Deprecation
-struct DD DeprecationData;
+struct AD AvailabilityData;
 struct FTD ForbiddenTypeData;
 
 /// Access control.

Modified: cfe/trunk/lib/Sema/DelayedDiagnostic.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/DelayedDiagnostic.cpp?rev=285457&r1=285456&r2=285457&view=diff
==
--- cfe/trunk/lib/Sema/DelayedDiagnostic.cpp (original)
+++ cfe/trunk/lib/Sema/DelayedDiagnostic.cpp Fri Oct 28 16:39:27 2016
@@ -20,7 +20,7 @@ using namespace clang;
 using namespace sema;
 
 DelayedDiagnostic
-DelayedDiagnostic::makeAvailability(AvailabilityResult AD,
+DelayedDiagnostic::makeAvailability(AvailabilityResult AR,
 SourceLocation Loc,
 const NamedDecl *D,
 const ObjCInterfaceDecl *UnknownObjCClass,
@@ -28,42 +28,33 @@ DelayedDiagnostic::makeAvailability(Avai
 StringRef Msg,
 bool ObjCPropertyAccess) {
   DelayedDiagnostic DD;
-  switch (AD) {
-  case AR_Deprecated:
-DD.Kind = Deprecation;
-break;
-  case AR_Unavailable:
-DD.Kind = Unavailable;
-break;
-  default:
-llvm_unreachable("partial diags should not be delayed");
-  }
+  DD.Kind = Availability;
   DD.Triggered = false;
   DD.Loc = Loc;
-  DD.DeprecationData.Decl = D;
-  DD.DeprecationData.UnknownObjCClass = UnknownObjCClass;
-  DD.DeprecationData.ObjCProperty = 

[libcxx] r285456 - Added 'inline' attribute to basic_string's destructor

2016-10-28 Thread Aditya Kumar via cfe-commits
Author: hiraditya
Date: Fri Oct 28 16:27:24 2016
New Revision: 285456

URL: http://llvm.org/viewvc/llvm-project?rev=285456&view=rev
Log:
Added 'inline' attribute to basic_string's destructor

Author: laxmansole

Reviewers: howard.hinnant
   mclow.lists
Subscribers: EricWF, flyingforyou, evandro

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

Reapplying the patch as the bug https://llvm.org/bugs/show_bug.cgi?id=30341 is 
fixed.

Currently basic_string's destructor is not getting inlined. So adding 'inline' 
attribute to ~basic_string().
Worked in collaboration with Aditya Kumar.

Modified:
libcxx/trunk/include/string

Modified: libcxx/trunk/include/string
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/string?rev=285456&r1=285455&r2=285456&view=diff
==
--- libcxx/trunk/include/string (original)
+++ libcxx/trunk/include/string Fri Oct 28 16:27:24 2016
@@ -806,6 +806,7 @@ public:
 basic_string(initializer_list __il, const allocator_type& __a);
 #endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
 
+inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
 ~basic_string();
 
 _LIBCPP_INLINE_VISIBILITY


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


[PATCH] D13330: Implement __attribute__((unique_instantiation))

2016-10-28 Thread Keno Fischer via cfe-commits
loladiro added a comment.

I meant 
`template __attribute__((unique_instantiation)) int * 
static_separate_template::a_static_field;`
of course, though we probably need a better diagnostic for the other spelling 
(which applies the attribute to the static_separate_template). I'll look 
into adding a diagnostic.


Repository:
  rL LLVM

https://reviews.llvm.org/D13330



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


[PATCH] D25624: Added 'inline' attribute to basic_string's destructor

2016-10-28 Thread Aditya Kumar via cfe-commits
hiraditya added inline comments.



Comment at: libcxx/include/string:1837
 template 
+inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
 basic_string<_CharT, _Traits, _Allocator>::~basic_string()

EricWF wrote:
> The attribute should appear on the first declaration not the out-of-line 
> definition. Feel free to commit after making that change.
Okay, thanks for the correction.


https://reviews.llvm.org/D25624



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


r285446 - Fix handling of constructor inherited through multiple levels of virtual base class.

2016-10-28 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Fri Oct 28 15:20:58 2016
New Revision: 285446

URL: http://llvm.org/viewvc/llvm-project?rev=285446&view=rev
Log:
Fix handling of constructor inherited through multiple levels of virtual base 
class.

Modified:
cfe/trunk/include/clang/AST/DeclCXX.h
cfe/trunk/test/CXX/special/class.init/class.inhctor.init/p1.cpp

Modified: cfe/trunk/include/clang/AST/DeclCXX.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclCXX.h?rev=285446&r1=285445&r2=285446&view=diff
==
--- cfe/trunk/include/clang/AST/DeclCXX.h (original)
+++ cfe/trunk/include/clang/AST/DeclCXX.h Fri Oct 28 15:20:58 2016
@@ -2957,11 +2957,10 @@ class ConstructorUsingShadowDecl final :
 dyn_cast(Target)),
 ConstructedBaseClassShadowDecl(NominatedBaseClassShadowDecl),
 IsVirtual(TargetInVirtualBase) {
-// If we found a constructor for a non-virtual base class, but it chains to
-// a constructor for a virtual base, we should directly call the virtual
-// base constructor instead.
+// If we found a constructor that chains to a constructor for a virtual
+// base, we should directly call that virtual base constructor instead.
 // FIXME: This logic belongs in Sema.
-if (!TargetInVirtualBase && NominatedBaseClassShadowDecl &&
+if (NominatedBaseClassShadowDecl &&
 NominatedBaseClassShadowDecl->constructsVirtualBase()) {
   ConstructedBaseClassShadowDecl =
   NominatedBaseClassShadowDecl->ConstructedBaseClassShadowDecl;

Modified: cfe/trunk/test/CXX/special/class.init/class.inhctor.init/p1.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/special/class.init/class.inhctor.init/p1.cpp?rev=285446&r1=285445&r2=285446&view=diff
==
--- cfe/trunk/test/CXX/special/class.init/class.inhctor.init/p1.cpp (original)
+++ cfe/trunk/test/CXX/special/class.init/class.inhctor.init/p1.cpp Fri Oct 28 
15:20:58 2016
@@ -87,6 +87,13 @@ namespace vbase {
   D d2(0, 0); // expected-error {{deleted}}
 }
 
+namespace vbase_of_vbase {
+  struct V { V(int); };
+  struct W : virtual V { using V::V; };
+  struct X : virtual W, virtual V { using W::W; };
+  X x(0);
+}
+
 namespace constexpr_init_order {
   struct Param;
   struct A {


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


[libcxx] r285445 - Fix Clang 3.6 build error

2016-10-28 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri Oct 28 15:19:36 2016
New Revision: 285445

URL: http://llvm.org/viewvc/llvm-project?rev=285445&view=rev
Log:
Fix Clang 3.6 build error

Modified:
libcxx/trunk/src/experimental/filesystem/path.cpp

Modified: libcxx/trunk/src/experimental/filesystem/path.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/experimental/filesystem/path.cpp?rev=285445&r1=285444&r2=285445&view=diff
==
--- libcxx/trunk/src/experimental/filesystem/path.cpp (original)
+++ libcxx/trunk/src/experimental/filesystem/path.cpp Fri Oct 28 15:19:36 2016
@@ -283,7 +283,7 @@ string_view_t path::__root_path_raw() co
 if (!parser::good(e))
   e = parser::root_name_end(__pn_);
 if (parser::good(e))
-  return string_view_t{__pn_}.substr(0, e + 1);
+  return string_view_t(__pn_).substr(0, e + 1);
 return {};
 }
 


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


r285439 - [PPC] add float and double overloads for vec_orc and vec_nand in altivec.h

2016-10-28 Thread Nemanja Ivanovic via cfe-commits
Author: nemanjai
Date: Fri Oct 28 15:04:53 2016
New Revision: 285439

URL: http://llvm.org/viewvc/llvm-project?rev=285439&view=rev
Log:
[PPC] add float and double overloads for vec_orc and vec_nand in altivec.h

This patch corresponds to review https://reviews.llvm.org/D25950.
Committing on behalf of Sean Fertile.

Modified:
cfe/trunk/lib/Headers/altivec.h
cfe/trunk/test/CodeGen/builtins-ppc-p8vector.c

Modified: cfe/trunk/lib/Headers/altivec.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/altivec.h?rev=285439&r1=285438&r2=285439&view=diff
==
--- cfe/trunk/lib/Headers/altivec.h (original)
+++ cfe/trunk/lib/Headers/altivec.h Fri Oct 28 15:04:53 2016
@@ -5356,6 +5356,12 @@ static __inline__ vector bool int __ATTR
   return ~(__a & __b);
 }
 
+static __inline__ vector float __ATTRS_o_ai
+vec_nand(vector float __a, vector float __b) {
+  return (vector float)(~((vector unsigned int)__a &
+  (vector unsigned int)__b));
+}
+
 static __inline__ vector signed long long __ATTRS_o_ai
 vec_nand(vector signed long long __a, vector signed long long __b) {
   return ~(__a & __b);
@@ -5391,6 +5397,12 @@ vec_nand(vector bool long long __a, vect
   return ~(__a & __b);
 }
 
+static __inline__ vector double __ATTRS_o_ai
+vec_nand(vector double __a, vector double __b) {
+  return (vector double)(~((vector unsigned long long)__a &
+   (vector unsigned long long)__b));
+}
+
 #endif
 
 /* vec_nmadd */
@@ -5862,6 +5874,16 @@ static __inline__ vector bool int __ATTR
   return __a | ~__b;
 }
 
+static __inline__ vector float __ATTRS_o_ai
+vec_orc(vector bool int __a, vector float __b) {
+ return (vector float)(__a | ~(vector unsigned int)__b);
+}
+
+static __inline__ vector float __ATTRS_o_ai
+vec_orc(vector float __a, vector bool int __b) {
+  return (vector float)((vector unsigned int)__a | ~__b);
+}
+
 static __inline__ vector signed long long __ATTRS_o_ai
 vec_orc(vector signed long long __a, vector signed long long __b) {
   return __a | ~__b;
@@ -5896,6 +5918,16 @@ static __inline__ vector bool long long
 vec_orc(vector bool long long __a, vector bool long long __b) {
   return __a | ~__b;
 }
+
+static __inline__ vector double __ATTRS_o_ai
+vec_orc(vector double __a, vector bool long long __b) {
+  return (vector double)((vector unsigned long long)__a | ~__b);
+}
+
+static __inline__ vector double __ATTRS_o_ai
+vec_orc(vector bool long long __a, vector double __b) {
+  return (vector double)(__a | ~(vector unsigned long long)__b);
+}
 #endif
 
 /* vec_vor */

Modified: cfe/trunk/test/CodeGen/builtins-ppc-p8vector.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/builtins-ppc-p8vector.c?rev=285439&r1=285438&r2=285439&view=diff
==
--- cfe/trunk/test/CodeGen/builtins-ppc-p8vector.c (original)
+++ cfe/trunk/test/CodeGen/builtins-ppc-p8vector.c Fri Oct 28 15:04:53 2016
@@ -1266,6 +1266,12 @@ void test1() {
 // CHECK-LE: [[T1:%.+]] = and <4 x i32>
 // CHECK-LE: xor <4 x i32> [[T1]], 
 
+  res_vf = vec_nand(vfa, vfa);
+// CHECK: [[T1:%.+]] = and <4 x i32>
+// CHECK: xor <4 x i32> [[T1]], 
+// CHECK-LE: [[T1:%.+]] = and <4 x i32>
+// CHECK-LE: xor <4 x i32> [[T1]], 
+
   res_vsll = vec_nand(vsll, vsll);
 // CHECK: [[T1:%.+]] = and <2 x i64>
 // CHECK: xor <2 x i64> [[T1]], 
@@ -1284,6 +1290,12 @@ void test1() {
 // CHECK-LE: [[T1:%.+]] = and <2 x i64>
 // CHECK-LE: xor <2 x i64> [[T1]], 
 
+  res_vd = vec_nand(vda, vda);
+// CHECK: [[T1:%.+]] = and <2 x i64>
+// CHECK: xor <2 x i64> [[T1]], 
+// CHECK-LE: [[T1:%.+]] = and <2 x i64>
+// CHECK-LE: xor <2 x i64> [[T1]], 
+
   /* vec_orc */
   res_vsc = vec_orc(vsc, vsc);
 // CHECK: [[T1:%.+]] = xor <16 x i8> {{%.+}}, 
@@ -1412,6 +1424,18 @@ void test1() {
 // CHECK-LE: [[T1:%.+]] = xor <4 x i32> {{%.+}}, 
 // CHECK-LE: or <4 x i32> {{%.+}}, [[T1]]
 
+  res_vf = vec_orc(vbi, vfa);
+// CHECK: [[T1:%.+]] = xor <4 x i32> {{%.+}}, 
+// CHECK: or <4 x i32> {{%.+}}, [[T1]]
+// CHECK-LE: [[T1:%.+]] = xor <4 x i32> {{%.+}}, 
+// CHECK-LE: or <4 x i32> {{%.+}}, [[T1]]
+
+  res_vf = vec_orc(vfa, vbi);
+// CHECK: [[T1:%.+]] = xor <4 x i32> {{%.+}}, 
+// CHECK: or <4 x i32> {{%.+}}, [[T1]]
+// CHECK-LE: [[T1:%.+]] = xor <4 x i32> {{%.+}}, 
+// CHECK-LE: or <4 x i32> {{%.+}}, [[T1]]
+
   res_vsll = vec_orc(vsll, vsll);
 // CHECK: [[T1:%.+]] = xor <2 x i64> {{%.+}}, 
 // CHECK: or <2 x i64> {{%.+}}, [[T1]]
@@ -1452,6 +1476,18 @@ void test1() {
 // CHECK: [[T1:%.+]] = xor <2 x i64> {{%.+}}, 
 // CHECK: or <2 x i64> {{%.+}}, [[T1]]
 // CHECK-LE: [[T1:%.+]] = xor <2 x i64> {{%.+}}, 
+// CHECK-LE: or <2 x i64> {{%.+}}, [[T1]]
+
+  res_vd = vec_orc(vbll, vda);
+// CHECK: [[T1:%.+]] = xor <2 x i64> {{%.+}}, 
+// CHECK: or <2 x i64> {{%.+}}, [[T1]]
+// CHECK-LE: [[T1:%.+]] = xor <2 x i64> {{%.+}}, 
+// CHECK-LE: or <2 x i64> {{%.+}}, [[T1]]
+
+  res_vd = vec_orc(vda, v

[PATCH] D25624: Added 'inline' attribute to basic_string's destructor

2016-10-28 Thread Eric Fiselier via cfe-commits
EricWF accepted this revision.
EricWF added inline comments.



Comment at: libcxx/include/string:1837
 template 
+inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
 basic_string<_CharT, _Traits, _Allocator>::~basic_string()

The attribute should appear on the first declaration not the out-of-line 
definition. Feel free to commit after making that change.


https://reviews.llvm.org/D25624



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


[PATCH] D25624: Added 'inline' attribute to basic_string's destructor

2016-10-28 Thread Aditya Kumar via cfe-commits
hiraditya updated this revision to Diff 76240.

https://reviews.llvm.org/D25624

Files:
  libcxx/include/string


Index: libcxx/include/string
===
--- libcxx/include/string
+++ libcxx/include/string
@@ -1834,6 +1834,7 @@
 #endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
 
 template 
+inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
 basic_string<_CharT, _Traits, _Allocator>::~basic_string()
 {
 #if _LIBCPP_DEBUG_LEVEL >= 2


Index: libcxx/include/string
===
--- libcxx/include/string
+++ libcxx/include/string
@@ -1834,6 +1834,7 @@
 #endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
 
 template 
+inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
 basic_string<_CharT, _Traits, _Allocator>::~basic_string()
 {
 #if _LIBCPP_DEBUG_LEVEL >= 2
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r285437 - PR30831: Teach template type diffing to cope with TemplateSpecializationTypes

2016-10-28 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Fri Oct 28 14:54:43 2016
New Revision: 285437

URL: http://llvm.org/viewvc/llvm-project?rev=285437&view=rev
Log:
PR30831: Teach template type diffing to cope with TemplateSpecializationTypes
that desugar to non-TSTs (such as injected-class-names).

Modified:
cfe/trunk/lib/AST/ASTDiagnostic.cpp
cfe/trunk/test/Misc/diag-template-diffing.cpp

Modified: cfe/trunk/lib/AST/ASTDiagnostic.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTDiagnostic.cpp?rev=285437&r1=285436&r2=285437&view=diff
==
--- cfe/trunk/lib/AST/ASTDiagnostic.cpp (original)
+++ cfe/trunk/lib/AST/ASTDiagnostic.cpp Fri Oct 28 14:54:43 2016
@@ -936,6 +936,9 @@ class TemplateDiff {
 ++(*this);
   }
 
+  /// Return true if the iterator is non-singular.
+  bool isValid() const { return TST; }
+
   /// isEnd - Returns true if the iterator is one past the end.
   bool isEnd() const {
 assert(TST && "InternalIterator is invalid with a null TST.");
@@ -995,21 +998,21 @@ class TemplateDiff {
   }
 };
 
-bool UseDesugaredIterator;
 InternalIterator SugaredIterator;
 InternalIterator DesugaredIterator;
 
   public:
 TSTiterator(ASTContext &Context, const TemplateSpecializationType *TST)
-: UseDesugaredIterator(TST->isSugared() && !TST->isTypeAlias()),
-  SugaredIterator(TST),
+: SugaredIterator(TST),
   DesugaredIterator(
-  GetTemplateSpecializationType(Context, TST->desugar())) {}
+  (TST->isSugared() && !TST->isTypeAlias())
+  ? GetTemplateSpecializationType(Context, TST->desugar())
+  : nullptr) {}
 
 /// &operator++ - Increment the iterator to the next template argument.
 TSTiterator &operator++() {
   ++SugaredIterator;
-  if (UseDesugaredIterator)
+  if (DesugaredIterator.isValid())
 ++DesugaredIterator;
   return *this;
 }
@@ -1032,12 +1035,12 @@ class TemplateDiff {
 /// hasDesugaredTA - Returns true if there is another TemplateArgument
 /// available.
 bool hasDesugaredTA() const {
-  return UseDesugaredIterator && !DesugaredIterator.isEnd();
+  return DesugaredIterator.isValid() && !DesugaredIterator.isEnd();
 }
 
 /// getDesugaredTA - Returns the desugared TemplateArgument.
 reference getDesugaredTA() const {
-  assert(UseDesugaredIterator &&
+  assert(DesugaredIterator.isValid() &&
  "Desugared TemplateArgument should not be used.");
   return *DesugaredIterator;
 }

Modified: cfe/trunk/test/Misc/diag-template-diffing.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Misc/diag-template-diffing.cpp?rev=285437&r1=285436&r2=285437&view=diff
==
--- cfe/trunk/test/Misc/diag-template-diffing.cpp (original)
+++ cfe/trunk/test/Misc/diag-template-diffing.cpp Fri Oct 28 14:54:43 2016
@@ -1492,3 +1492,8 @@ void run(A_reg reg, A_ptr
 // CHECK-NOELIDE-NOTREE: {{[0-9]*}} errors generated.
 // CHECK-ELIDE-TREE: {{[0-9]*}} errors generated.
 // CHECK-NOELIDE-TREE: {{[0-9]*}} errors generated.
+
+namespace pr30831 {
+  template  struct A { static A const a; };
+  template  A A::a = A();
+}


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


[PATCH] D26002: Implement vector count leading/trailing bytes with zero lsb and vector parity builtins - clang portion

2016-10-28 Thread Nemanja Ivanovic via cfe-commits
nemanjai added a comment.

Committed revision 285436.
Zaara, please close this review if there are no buildbot failures.


https://reviews.llvm.org/D26002



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


r285436 - Implement vector count leading/trailing bytes with zero lsb and vector parity

2016-10-28 Thread Nemanja Ivanovic via cfe-commits
Author: nemanjai
Date: Fri Oct 28 14:49:03 2016
New Revision: 285436

URL: http://llvm.org/viewvc/llvm-project?rev=285436&view=rev
Log:
Implement vector count leading/trailing bytes with zero lsb and vector parity
builtins - clang portion

This patch corresponds to review: https://reviews.llvm.org/D26002
Committing on behalf of Zaara Syeda.

Modified:
cfe/trunk/include/clang/Basic/BuiltinsPPC.def
cfe/trunk/lib/Headers/altivec.h
cfe/trunk/test/CodeGen/builtins-ppc-p9vector.c

Modified: cfe/trunk/include/clang/Basic/BuiltinsPPC.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsPPC.def?rev=285436&r1=285435&r2=285436&view=diff
==
--- cfe/trunk/include/clang/Basic/BuiltinsPPC.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsPPC.def Fri Oct 28 14:49:03 2016
@@ -272,6 +272,12 @@ BUILTIN(__builtin_altivec_vctzh, "V8UsV8
 BUILTIN(__builtin_altivec_vctzw, "V4UiV4Ui", "")
 BUILTIN(__builtin_altivec_vctzd, "V2ULLiV2ULLi", "")
 
+BUILTIN(__builtin_altivec_vclzlsbb, "SiV16Uc", "")
+BUILTIN(__builtin_altivec_vctzlsbb, "SiV16Uc", "")
+BUILTIN(__builtin_altivec_vprtybw, "V4UiV4Ui", "")
+BUILTIN(__builtin_altivec_vprtybd, "V2ULLiV2ULLi", "")
+BUILTIN(__builtin_altivec_vprtybq, "V1ULLLiV1ULLLi", "")
+
 // Vector population count built-ins
 BUILTIN(__builtin_altivec_vpopcntb, "V16UcV16Uc", "")
 BUILTIN(__builtin_altivec_vpopcnth, "V8UsV8Us", "")

Modified: cfe/trunk/lib/Headers/altivec.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/altivec.h?rev=285436&r1=285435&r2=285436&view=diff
==
--- cfe/trunk/lib/Headers/altivec.h (original)
+++ cfe/trunk/lib/Headers/altivec.h Fri Oct 28 14:49:03 2016
@@ -1720,6 +1720,72 @@ vec_cmpnez(vector unsigned int __a, vect
  (vector int)__b);
 }
 
+static __inline__ signed int __ATTRS_o_ai
+vec_cntlz_lsbb(vector signed char __a) {
+#ifdef __LITTLE_ENDIAN__
+  return __builtin_altivec_vctzlsbb(__a);
+#else
+  return __builtin_altivec_vclzlsbb(__a);
+#endif
+}
+
+static __inline__ signed int __ATTRS_o_ai
+vec_cntlz_lsbb(vector unsigned char __a) {
+#ifdef __LITTLE_ENDIAN__
+  return __builtin_altivec_vctzlsbb(__a);
+#else
+  return __builtin_altivec_vclzlsbb(__a);
+#endif
+}
+
+static __inline__ signed int __ATTRS_o_ai
+vec_cnttz_lsbb(vector signed char __a) {
+#ifdef __LITTLE_ENDIAN__
+  return __builtin_altivec_vclzlsbb(__a);
+#else
+  return __builtin_altivec_vctzlsbb(__a);
+#endif
+}
+
+static __inline__ signed int __ATTRS_o_ai
+vec_cnttz_lsbb(vector unsigned char __a) {
+#ifdef __LITTLE_ENDIAN__
+  return __builtin_altivec_vclzlsbb(__a);
+#else
+  return __builtin_altivec_vctzlsbb(__a);
+#endif
+}
+
+static __inline__ vector unsigned int __ATTRS_o_ai
+vec_parity_lsbb(vector unsigned int __a) {
+  return __builtin_altivec_vprtybw(__a);
+}
+
+static __inline__ vector unsigned int __ATTRS_o_ai
+vec_parity_lsbb(vector signed int __a) {
+  return __builtin_altivec_vprtybw(__a);
+}
+
+static __inline__ vector unsigned __int128 __ATTRS_o_ai
+vec_parity_lsbb(vector unsigned __int128 __a) {
+  return __builtin_altivec_vprtybq(__a);
+}
+
+static __inline__ vector unsigned __int128 __ATTRS_o_ai
+vec_parity_lsbb(vector signed __int128 __a) {
+  return __builtin_altivec_vprtybq(__a);
+}
+
+static __inline__ vector unsigned long long __ATTRS_o_ai
+vec_parity_lsbb(vector unsigned long long __a) {
+  return __builtin_altivec_vprtybd(__a);
+}
+
+static __inline__ vector unsigned long long __ATTRS_o_ai
+vec_parity_lsbb(vector signed long long __a) {
+  return __builtin_altivec_vprtybd(__a);
+}
+
 #endif
 
 /* vec_cmpgt */

Modified: cfe/trunk/test/CodeGen/builtins-ppc-p9vector.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/builtins-ppc-p9vector.c?rev=285436&r1=285435&r2=285436&view=diff
==
--- cfe/trunk/test/CodeGen/builtins-ppc-p9vector.c (original)
+++ cfe/trunk/test/CodeGen/builtins-ppc-p9vector.c Fri Oct 28 14:49:03 2016
@@ -23,6 +23,8 @@ vector unsigned long long vula, vulb;
 vector bool long long vbla, vblb;
 vector float vfa, vfb;
 vector double vda, vdb;
+vector unsigned __int128 vui128a, vui128b;
+vector signed __int128 vsi128a, vsi128b;
 
 unsigned test1(void) {
 // CHECK-BE: @llvm.ppc.altivec.vcmpequb(<16 x i8>
@@ -698,6 +700,81 @@ vector unsigned short test54(void) {
 // CHECK-NEXT: ret <8 x i16>
   return vec_popcnt (vusa);
 }
+signed int test59(void) {
+// CHECK-BE: @llvm.ppc.altivec.vclzlsbb(<16 x i8>
+// CHECK-BE-NEXT: ret i32
+// CHECK-LE: @llvm.ppc.altivec.vctzlsbb(<16 x i8>
+// CHECK-LE-NEXT: ret i32
+  return vec_cntlz_lsbb (vuca);
+}
+signed int test60(void) {
+// CHECK-BE: @llvm.ppc.altivec.vclzlsbb(<16 x i8>
+// CHECK-BE-NEXT: ret i32
+// CHECK-LE: @llvm.ppc.altivec.vctzlsbb(<16 x i8>
+// CHECK-LE-NEXT: ret i32
+  return 

[PATCH] D25974: Fix implementation of the likely resolution of core issue 253 to support class based arrays.

2016-10-28 Thread Richard Smith via cfe-commits
rsmith closed this revision.
rsmith added a comment.

Committed as https://reviews.llvm.org/rL285430.


https://reviews.llvm.org/D25974



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


r285430 - Fix implementation of the likely resolution of core issue 253 to support class

2016-10-28 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Fri Oct 28 14:11:18 2016
New Revision: 285430

URL: http://llvm.org/viewvc/llvm-project?rev=285430&view=rev
Log:
Fix implementation of the likely resolution of core issue 253 to support class
based arrays. Patch by Ian Tessier!

Differential Review: https://reviews.llvm.org/D25974

Modified:
cfe/trunk/lib/AST/DeclCXX.cpp
cfe/trunk/test/SemaCXX/constexpr-value-init.cpp

Modified: cfe/trunk/lib/AST/DeclCXX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclCXX.cpp?rev=285430&r1=285429&r2=285430&view=diff
==
--- cfe/trunk/lib/AST/DeclCXX.cpp (original)
+++ cfe/trunk/lib/AST/DeclCXX.cpp Fri Oct 28 14:11:18 2016
@@ -739,7 +739,7 @@ void CXXRecordDecl::addedMember(Decl *D)
 }
 
 if (!Field->hasInClassInitializer() && !Field->isMutable()) {
-  if (CXXRecordDecl *FieldType = Field->getType()->getAsCXXRecordDecl()) {
+  if (CXXRecordDecl *FieldType = T->getAsCXXRecordDecl()) {
 if (FieldType->hasDefinition() && !FieldType->allowConstDefaultInit())
   data().HasUninitializedFields = true;
   } else {

Modified: cfe/trunk/test/SemaCXX/constexpr-value-init.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/constexpr-value-init.cpp?rev=285430&r1=285429&r2=285430&view=diff
==
--- cfe/trunk/test/SemaCXX/constexpr-value-init.cpp (original)
+++ cfe/trunk/test/SemaCXX/constexpr-value-init.cpp Fri Oct 28 14:11:18 2016
@@ -35,3 +35,12 @@ template struct Z : T {
   constexpr Z() : V() {}
 };
 constexpr int n = Z().c; // expected-error {{constant expression}} 
expected-note {{virtual base class}}
+
+struct E {
+  A a[2];
+};
+constexpr E e; // ok
+static_assert(e.a[0].a == 1, "");
+static_assert(e.a[0].b == 2, "");
+static_assert(e.a[1].a == 1, "");
+static_assert(e.a[1].b == 2, "");


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


LLVM buildmaster will restarted soon

2016-10-28 Thread Galina Kistanova via cfe-commits
Hello everyone,

LLVM buildmaster will restarted at 1 PM Pacific time today.
Thank you for understanding.

Thanks

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


r285428 - Add missing newline at EOF to avoid -Wnewline-eof warnings.

2016-10-28 Thread Bob Wilson via cfe-commits
Author: bwilson
Date: Fri Oct 28 13:55:50 2016
New Revision: 285428

URL: http://llvm.org/viewvc/llvm-project?rev=285428&view=rev
Log:
Add missing newline at EOF to avoid -Wnewline-eof warnings.

Modified:
cfe/trunk/include/clang/Basic/OpenCLImageTypes.def

Modified: cfe/trunk/include/clang/Basic/OpenCLImageTypes.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/OpenCLImageTypes.def?rev=285428&r1=285427&r2=285428&view=diff
==
--- cfe/trunk/include/clang/Basic/OpenCLImageTypes.def (original)
+++ cfe/trunk/include/clang/Basic/OpenCLImageTypes.def Fri Oct 28 13:55:50 2016
@@ -79,4 +79,4 @@ IMAGE_READ_WRITE_TYPE(image3d, OCLImage3
 #undef GENERIC_IMAGE_TYPE
 #undef IMAGE_READ_TYPE
 #undef IMAGE_WRITE_TYPE
-#undef IMAGE_READ_WRITE_TYPE
\ No newline at end of file
+#undef IMAGE_READ_WRITE_TYPE


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


[libcxx] r285427 - Try 2 to add extern C++ to __libcpp_library_version

2016-10-28 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri Oct 28 13:26:06 2016
New Revision: 285427

URL: http://llvm.org/viewvc/llvm-project?rev=285427&view=rev
Log:
Try 2 to add extern C++ to __libcpp_library_version

Modified:
libcxx/trunk/include/__config

Modified: libcxx/trunk/include/__config
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=285427&r1=285426&r2=285427&view=diff
==
--- libcxx/trunk/include/__config (original)
+++ libcxx/trunk/include/__config Fri Oct 28 13:26:06 2016
@@ -908,9 +908,11 @@ extern "C" void __sanitizer_annotate_con
 #define _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF
 #endif
 
+extern "C++" {
 _LIBCPP_BEGIN_NAMESPACE_STD
-_LIBCPP_FUNC_VIS _LIBCPP_WEAK extern "C++" int __libcpp_library_version();
+_LIBCPP_FUNC_VIS _LIBCPP_WEAK  int __libcpp_library_version();
 _LIBCPP_END_NAMESPACE_STD
+}
 
 #define _LIBCPP_LIBRARY_VERSION \
  (_VSTD::__libcpp_library_version ? _VSTD::__libcpp_library_version() : -1)


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


[PATCH] D26054: Use `getFileLoc()` instead of `getSpellingLoc()` in the ASTImporter

2016-10-28 Thread Argyrios Kyrtzidis via cfe-commits
akyrtzi added a comment.

LGTM.


https://reviews.llvm.org/D26054



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


[PATCH] D25153: preprocessor supports `-dI` flag

2016-10-28 Thread Steve O'Brien via cfe-commits
elsteveogrande added inline comments.



Comment at: cfe/trunk/test/Preprocessor/dump_include.c:2
+// RUN: %clang_cc1 -w -E -dI -isystem %S -imacros %S/dump_include.h %s -o - | 
FileCheck %s
+// CHECK: {{^}}#__include_macros "/{{([^/]+/)+}}dump_
+// CHECK: {{^}}#include https://reviews.llvm.org/D25153



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


r285419 - Fixing small problem with avx512-reduceIntrin.c test on some OS.

2016-10-28 Thread Michael Zuckerman via cfe-commits
Author: mzuckerm
Date: Fri Oct 28 12:25:26 2016
New Revision: 285419

URL: http://llvm.org/viewvc/llvm-project?rev=285419&view=rev
Log:
Fixing small problem with avx512-reduceIntrin.c test on some OS.


Modified:
cfe/trunk/test/CodeGen/avx512-reduceIntrin.c

Modified: cfe/trunk/test/CodeGen/avx512-reduceIntrin.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/avx512-reduceIntrin.c?rev=285419&r1=285418&r2=285419&view=diff
==
--- cfe/trunk/test/CodeGen/avx512-reduceIntrin.c (original)
+++ cfe/trunk/test/CodeGen/avx512-reduceIntrin.c Fri Oct 28 12:25:26 2016
@@ -391,7 +391,7 @@ double test_mm512_mask_reduce_add_pd(__m
 
 double test_mm512_mask_reduce_mul_pd(__mmask8 __M, __m512d __W){
   // CHECK: {{.*}} = bitcast i8 %__M to <8 x i1>
-  // CHECK: {{.*}} = select <8 x i1> %0, <8 x double> %__W, <8 x double> 

+  // CHECK: {{.*}} = select <8 x i1> {{.*}}, <8 x double> %__W, <8 x double> 

   // CHECK: %shuffle.i = shufflevector <8 x double> {{.*}}, <8 x double> 
undef, <4 x i32> 
   // CHECK: %shuffle1.i = shufflevector <8 x double> {{.*}}, <8 x double> 
undef, <4 x i32> 
   // CHECK: %mul.i = fmul <4 x double> %shuffle.i, %shuffle1.i
@@ -425,7 +425,7 @@ float test_mm512_mask_reduce_add_ps(__mm
 
 float test_mm512_mask_reduce_mul_ps(__mmask16 __M, __m512 __W){
   // CHECK: {{.*}} = bitcast i16 %__M to <16 x i1>
-  // CHECK: {{.*}} = select <16 x i1> %0, <16 x float> %__W, <16 x float> 

+  // CHECK: {{.*}} = select <16 x i1> {{.*}}, <16 x float> %__W, <16 x float> 

   // CHECK: %shuffle.i = shufflevector <16 x float> {{.*}}, <16 x float> 
undef, <8 x i32> 
   // CHECK: %shuffle1.i = shufflevector <16 x float> {{.*}}, <16 x float> 
undef, <8 x i32> 
   // CHECK: %mul.i = fmul <8 x float> %shuffle.i, %shuffle1.i


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


[PATCH] D26054: Use `getFileLoc()` instead of `getSpellingLoc()` in the ASTImporter

2016-10-28 Thread Sean Callanan via cfe-commits
spyffe updated this revision to Diff 76213.
spyffe added a comment.

Updated the corresponding comment.


https://reviews.llvm.org/D26054

Files:
  lib/AST/ASTImporter.cpp
  test/ASTMerge/Inputs/macro.modulemap
  test/ASTMerge/Inputs/macro1.h
  test/ASTMerge/Inputs/macro1.m
  test/ASTMerge/Inputs/macro2.m
  test/ASTMerge/macro.m


Index: test/ASTMerge/macro.m
===
--- test/ASTMerge/macro.m
+++ test/ASTMerge/macro.m
@@ -0,0 +1,6 @@
+// RUN: rm -rf %t
+// RUN: mkdir -p %t/cache
+// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t/cache 
-fmodule-map-file=%S/Inputs/macro.modulemap -I%S/Inputs -emit-pch -o %t.1.ast 
%S/Inputs/macro1.m
+// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t/cache 
-fmodule-map-file=%S/Inputs/macro.modulemap -I%S/Inputs -emit-pch -o %t.2.ast 
%S/Inputs/macro2.m
+// RUN: %clang_cc1 -fmodules -ast-merge %t.1.ast -ast-merge %t.2.ast 
-fsyntax-only -verify %s
+// expected-no-diagnostics
Index: test/ASTMerge/Inputs/macro2.m
===
--- test/ASTMerge/Inputs/macro2.m
+++ test/ASTMerge/Inputs/macro2.m
@@ -0,0 +1,5 @@
+void foo();
+
+void bar() {
+  foo();
+}
Index: test/ASTMerge/Inputs/macro1.m
===
--- test/ASTMerge/Inputs/macro1.m
+++ test/ASTMerge/Inputs/macro1.m
@@ -0,0 +1,5 @@
+@import macro1;
+
+void foo() {
+  maybeNull(0, 0);
+}
Index: test/ASTMerge/Inputs/macro1.h
===
--- test/ASTMerge/Inputs/macro1.h
+++ test/ASTMerge/Inputs/macro1.h
@@ -0,0 +1,5 @@
+typedef void *VoidRef;
+
+void maybeNull(
+  int i,
+  __nullable VoidRef *__nullable);
Index: test/ASTMerge/Inputs/macro.modulemap
===
--- test/ASTMerge/Inputs/macro.modulemap
+++ test/ASTMerge/Inputs/macro.modulemap
@@ -0,0 +1,4 @@
+module macro1 [extern_c] {
+  header "macro1.h"
+  export *
+}
Index: lib/AST/ASTImporter.cpp
===
--- lib/AST/ASTImporter.cpp
+++ lib/AST/ASTImporter.cpp
@@ -6943,10 +6943,10 @@
 
   SourceManager &FromSM = FromContext.getSourceManager();
   
-  // For now, map everything down to its spelling location, so that we
+  // For now, map everything down to its file location, so that we
   // don't have to import macro expansions.
   // FIXME: Import macro expansions!
-  FromLoc = FromSM.getSpellingLoc(FromLoc);
+  FromLoc = FromSM.getFileLoc(FromLoc);
   std::pair Decomposed = FromSM.getDecomposedLoc(FromLoc);
   SourceManager &ToSM = ToContext.getSourceManager();
   FileID ToFileID = Import(Decomposed.first);


Index: test/ASTMerge/macro.m
===
--- test/ASTMerge/macro.m
+++ test/ASTMerge/macro.m
@@ -0,0 +1,6 @@
+// RUN: rm -rf %t
+// RUN: mkdir -p %t/cache
+// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t/cache -fmodule-map-file=%S/Inputs/macro.modulemap -I%S/Inputs -emit-pch -o %t.1.ast %S/Inputs/macro1.m
+// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t/cache -fmodule-map-file=%S/Inputs/macro.modulemap -I%S/Inputs -emit-pch -o %t.2.ast %S/Inputs/macro2.m
+// RUN: %clang_cc1 -fmodules -ast-merge %t.1.ast -ast-merge %t.2.ast -fsyntax-only -verify %s
+// expected-no-diagnostics
Index: test/ASTMerge/Inputs/macro2.m
===
--- test/ASTMerge/Inputs/macro2.m
+++ test/ASTMerge/Inputs/macro2.m
@@ -0,0 +1,5 @@
+void foo();
+
+void bar() {
+  foo();
+}
Index: test/ASTMerge/Inputs/macro1.m
===
--- test/ASTMerge/Inputs/macro1.m
+++ test/ASTMerge/Inputs/macro1.m
@@ -0,0 +1,5 @@
+@import macro1;
+
+void foo() {
+  maybeNull(0, 0);
+}
Index: test/ASTMerge/Inputs/macro1.h
===
--- test/ASTMerge/Inputs/macro1.h
+++ test/ASTMerge/Inputs/macro1.h
@@ -0,0 +1,5 @@
+typedef void *VoidRef;
+
+void maybeNull(
+  int i,
+  __nullable VoidRef *__nullable);
Index: test/ASTMerge/Inputs/macro.modulemap
===
--- test/ASTMerge/Inputs/macro.modulemap
+++ test/ASTMerge/Inputs/macro.modulemap
@@ -0,0 +1,4 @@
+module macro1 [extern_c] {
+  header "macro1.h"
+  export *
+}
Index: lib/AST/ASTImporter.cpp
===
--- lib/AST/ASTImporter.cpp
+++ lib/AST/ASTImporter.cpp
@@ -6943,10 +6943,10 @@
 
   SourceManager &FromSM = FromContext.getSourceManager();
   
-  // For now, map everything down to its spelling location, so that we
+  // For now, map everything down to its file location, so that we
   // don't have to import macro expansions.
   // FIXME: Import macro expansions!
-  FromLoc = FromSM.getSpellingLoc(FromLoc);
+  FromLoc = FromSM.getFileLoc(FromLoc);
   std::pair Decomposed = FromSM.getDec

[PATCH] D25153: preprocessor supports `-dI` flag

2016-10-28 Thread Bruno Cardoso Lopes via cfe-commits
bruno added a comment.

The test is failing on windows:

http://lab.llvm.org:8011/builders/clang-x86-windows-msvc2015/builds/141

I reverted the patch for now in r285416, can you take a look?


Repository:
  rL LLVM

https://reviews.llvm.org/D25153



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


r285416 - Revert "[Preprocessor] Support for '-dI' flag"

2016-10-28 Thread Bruno Cardoso Lopes via cfe-commits
Author: bruno
Date: Fri Oct 28 12:02:10 2016
New Revision: 285416

URL: http://llvm.org/viewvc/llvm-project?rev=285416&view=rev
Log:
Revert "[Preprocessor] Support for '-dI' flag"

This reverts r285411. Tests failing on
http://lab.llvm.org:8011/builders/clang-x86-windows-msvc2015/builds/141

Removed:
cfe/trunk/test/Preprocessor/dump_import.h
cfe/trunk/test/Preprocessor/dump_import.m
cfe/trunk/test/Preprocessor/dump_include.c
cfe/trunk/test/Preprocessor/dump_include.h
Modified:
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/include/clang/Frontend/PreprocessorOutputOptions.h
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/lib/Frontend/PrintPreprocessedOutput.cpp

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=285416&r1=285415&r2=285416&view=diff
==
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Fri Oct 28 12:02:10 2016
@@ -429,8 +429,6 @@ def fno_cuda_approx_transcendentals : Fl
 def dA : Flag<["-"], "dA">, Group;
 def dD : Flag<["-"], "dD">, Group, Flags<[CC1Option]>,
   HelpText<"Print macro definitions in -E mode in addition to normal output">;
-def dI : Flag<["-"], "dI">, Group, Flags<[CC1Option]>,
-  HelpText<"Print include directives in -E mode in addition to normal output">;
 def dM : Flag<["-"], "dM">, Group, Flags<[CC1Option]>,
   HelpText<"Print macro definitions in -E mode instead of normal output">;
 def dead__strip : Flag<["-"], "dead_strip">;

Modified: cfe/trunk/include/clang/Frontend/PreprocessorOutputOptions.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/PreprocessorOutputOptions.h?rev=285416&r1=285415&r2=285416&view=diff
==
--- cfe/trunk/include/clang/Frontend/PreprocessorOutputOptions.h (original)
+++ cfe/trunk/include/clang/Frontend/PreprocessorOutputOptions.h Fri Oct 28 
12:02:10 2016
@@ -22,7 +22,6 @@ public:
   unsigned UseLineDirectives : 1;   ///< Use \#line instead of GCC-style \# N.
   unsigned ShowMacroComments : 1;  ///< Show comments, even in macros.
   unsigned ShowMacros : 1; ///< Print macro definitions.
-  unsigned ShowIncludeDirectives : 1;  ///< Print includes, imports etc. 
within preprocessed output.
   unsigned RewriteIncludes : 1;///< Preprocess include directives only.
 
 public:
@@ -33,7 +32,6 @@ public:
 UseLineDirectives = 0;
 ShowMacroComments = 0;
 ShowMacros = 0;
-ShowIncludeDirectives = 0;
 RewriteIncludes = 0;
   }
 };

Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=285416&r1=285415&r2=285416&view=diff
==
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Fri Oct 28 12:02:10 2016
@@ -2353,7 +2353,6 @@ static void ParsePreprocessorOutputArgs(
   Opts.ShowLineMarkers = !Args.hasArg(OPT_P);
   Opts.ShowMacroComments = Args.hasArg(OPT_CC);
   Opts.ShowMacros = Args.hasArg(OPT_dM) || Args.hasArg(OPT_dD);
-  Opts.ShowIncludeDirectives = Args.hasArg(OPT_dI);
   Opts.RewriteIncludes = Args.hasArg(OPT_frewrite_includes);
   Opts.UseLineDirectives = Args.hasArg(OPT_fuse_line_directives);
 }

Modified: cfe/trunk/lib/Frontend/PrintPreprocessedOutput.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PrintPreprocessedOutput.cpp?rev=285416&r1=285415&r2=285416&view=diff
==
--- cfe/trunk/lib/Frontend/PrintPreprocessedOutput.cpp (original)
+++ cfe/trunk/lib/Frontend/PrintPreprocessedOutput.cpp Fri Oct 28 12:02:10 2016
@@ -93,16 +93,13 @@ private:
   bool Initialized;
   bool DisableLineMarkers;
   bool DumpDefines;
-  bool DumpIncludeDirectives;
   bool UseLineDirectives;
   bool IsFirstFileEntered;
 public:
   PrintPPOutputPPCallbacks(Preprocessor &pp, raw_ostream &os, bool lineMarkers,
-   bool defines, bool DumpIncludeDirectives,
-   bool UseLineDirectives)
+   bool defines, bool UseLineDirectives)
   : PP(pp), SM(PP.getSourceManager()), ConcatInfo(PP), OS(os),
 DisableLineMarkers(lineMarkers), DumpDefines(defines),
-DumpIncludeDirectives(DumpIncludeDirectives),
 UseLineDirectives(UseLineDirectives) {
 CurLine = 0;
 CurFilename += "";
@@ -323,10 +320,10 @@ void PrintPPOutputPPCallbacks::Inclusion
   StringRef SearchPath,
   StringRef RelativePath,
   const Module *Imported) {
+  // When preprocessing, 

r285412 - Relax assertion in FunctionDecl::doesDeclarationForceExternallyVisibleDefinition.

2016-10-28 Thread Justin Lebar via cfe-commits
Author: jlebar
Date: Fri Oct 28 11:46:39 2016
New Revision: 285412

URL: http://llvm.org/viewvc/llvm-project?rev=285412&view=rev
Log:
Relax assertion in 
FunctionDecl::doesDeclarationForceExternallyVisibleDefinition.

Previously we were asserting that this declaration doesn't have a body
*and* won't have a body after we continue parsing.  This is too strong
and breaks the go-bindings test during codegen.

Modified:
cfe/trunk/lib/AST/Decl.cpp

Modified: cfe/trunk/lib/AST/Decl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Decl.cpp?rev=285412&r1=285411&r2=285412&view=diff
==
--- cfe/trunk/lib/AST/Decl.cpp (original)
+++ cfe/trunk/lib/AST/Decl.cpp Fri Oct 28 11:46:39 2016
@@ -2933,7 +2933,7 @@ static bool RedeclForcesDefC99(const Fun
 /// of redeclarations of the given functions causes
 /// isInlineDefinitionExternallyVisible to change from false to true.
 bool FunctionDecl::doesDeclarationForceExternallyVisibleDefinition() const {
-  assert(!doesThisDeclarationHaveABody() && !willHaveBody() &&
+  assert(!doesThisDeclarationHaveABody() &&
  "Must have a declaration without a body.");
 
   ASTContext &Context = getASTContext();


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


[PATCH] D26073: [PPC] Add vec_absd functions to altivec.h

2016-10-28 Thread Nemanja Ivanovic via cfe-commits
nemanjai added a comment.

This patch LGTM. I'll let @kbarton/@echristo have a look as well and have the 
final say.


https://reviews.llvm.org/D26073



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


[PATCH] D25153: preprocessor supports `-dI` flag

2016-10-28 Thread Bruno Cardoso Lopes via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL285411: [Preprocessor] Support for '-dI' flag (authored by 
bruno).

Changed prior to commit:
  https://reviews.llvm.org/D25153?vs=75351&id=76210#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D25153

Files:
  cfe/trunk/include/clang/Driver/Options.td
  cfe/trunk/include/clang/Frontend/PreprocessorOutputOptions.h
  cfe/trunk/lib/Frontend/CompilerInvocation.cpp
  cfe/trunk/lib/Frontend/PrintPreprocessedOutput.cpp
  cfe/trunk/test/Preprocessor/dump_import.h
  cfe/trunk/test/Preprocessor/dump_import.m
  cfe/trunk/test/Preprocessor/dump_include.c
  cfe/trunk/test/Preprocessor/dump_include.h

Index: cfe/trunk/include/clang/Driver/Options.td
===
--- cfe/trunk/include/clang/Driver/Options.td
+++ cfe/trunk/include/clang/Driver/Options.td
@@ -429,6 +429,8 @@
 def dA : Flag<["-"], "dA">, Group;
 def dD : Flag<["-"], "dD">, Group, Flags<[CC1Option]>,
   HelpText<"Print macro definitions in -E mode in addition to normal output">;
+def dI : Flag<["-"], "dI">, Group, Flags<[CC1Option]>,
+  HelpText<"Print include directives in -E mode in addition to normal output">;
 def dM : Flag<["-"], "dM">, Group, Flags<[CC1Option]>,
   HelpText<"Print macro definitions in -E mode instead of normal output">;
 def dead__strip : Flag<["-"], "dead_strip">;
Index: cfe/trunk/include/clang/Frontend/PreprocessorOutputOptions.h
===
--- cfe/trunk/include/clang/Frontend/PreprocessorOutputOptions.h
+++ cfe/trunk/include/clang/Frontend/PreprocessorOutputOptions.h
@@ -22,6 +22,7 @@
   unsigned UseLineDirectives : 1;   ///< Use \#line instead of GCC-style \# N.
   unsigned ShowMacroComments : 1;  ///< Show comments, even in macros.
   unsigned ShowMacros : 1; ///< Print macro definitions.
+  unsigned ShowIncludeDirectives : 1;  ///< Print includes, imports etc. within preprocessed output.
   unsigned RewriteIncludes : 1;///< Preprocess include directives only.
 
 public:
@@ -32,6 +33,7 @@
 UseLineDirectives = 0;
 ShowMacroComments = 0;
 ShowMacros = 0;
+ShowIncludeDirectives = 0;
 RewriteIncludes = 0;
   }
 };
Index: cfe/trunk/test/Preprocessor/dump_import.m
===
--- cfe/trunk/test/Preprocessor/dump_import.m
+++ cfe/trunk/test/Preprocessor/dump_import.m
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 -E -dI %s -o - | FileCheck %s
+// CHECK: {{^}}#import "dump_
+
+// See also `dump_include.c` which tests other inclusion cases with `-dI`.
+
+#import "dump_import.h"
Index: cfe/trunk/test/Preprocessor/dump_import.h
===
--- cfe/trunk/test/Preprocessor/dump_import.h
+++ cfe/trunk/test/Preprocessor/dump_import.h
@@ -0,0 +1 @@
+#define DUMP_IMPORT_TESTVAL 1
Index: cfe/trunk/test/Preprocessor/dump_include.h
===
--- cfe/trunk/test/Preprocessor/dump_include.h
+++ cfe/trunk/test/Preprocessor/dump_include.h
@@ -0,0 +1,2 @@
+#pragma once
+#define DUMP_INCLUDE_TESTVAL 1
Index: cfe/trunk/test/Preprocessor/dump_include.c
===
--- cfe/trunk/test/Preprocessor/dump_include.c
+++ cfe/trunk/test/Preprocessor/dump_include.c
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -w -E -dI -isystem %S -imacros %S/dump_include.h %s -o - | FileCheck %s
+// CHECK: {{^}}#__include_macros "/{{([^/]+/)+}}dump_
+// CHECK: {{^}}#include 
+#include "dump_include.h"
+#include_next "dump_include.h"
Index: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
===
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp
@@ -2353,6 +2353,7 @@
   Opts.ShowLineMarkers = !Args.hasArg(OPT_P);
   Opts.ShowMacroComments = Args.hasArg(OPT_CC);
   Opts.ShowMacros = Args.hasArg(OPT_dM) || Args.hasArg(OPT_dD);
+  Opts.ShowIncludeDirectives = Args.hasArg(OPT_dI);
   Opts.RewriteIncludes = Args.hasArg(OPT_frewrite_includes);
   Opts.UseLineDirectives = Args.hasArg(OPT_fuse_line_directives);
 }
Index: cfe/trunk/lib/Frontend/PrintPreprocessedOutput.cpp
===
--- cfe/trunk/lib/Frontend/PrintPreprocessedOutput.cpp
+++ cfe/trunk/lib/Frontend/PrintPreprocessedOutput.cpp
@@ -93,13 +93,16 @@
   bool Initialized;
   bool DisableLineMarkers;
   bool DumpDefines;
+  bool DumpIncludeDirectives;
   bool UseLineDirectives;
   bool IsFirstFileEntered;
 public:
   PrintPPOutputPPCallbacks(Preprocessor &pp, raw_ostream &os, bool lineMarkers,
-   bool defines, bool UseLineDirectives)
+   bool defines, bool DumpIncludeDirectives,
+   bool UseLineDirectives)
   : PP(pp), SM(PP.getSourceManager()), ConcatInfo(P

r285411 - [Preprocessor] Support for '-dI' flag

2016-10-28 Thread Bruno Cardoso Lopes via cfe-commits
Author: bruno
Date: Fri Oct 28 11:32:10 2016
New Revision: 285411

URL: http://llvm.org/viewvc/llvm-project?rev=285411&view=rev
Log:
[Preprocessor] Support for '-dI' flag

Implement the -dI as supported by GCC: Output ‘#include’ directives in addition
to the result of preprocessing.

This change aims to add this option, pass it through to the preprocessor via
the options class, and when inclusions occur we output some information (+ test
cases).

Patch by Steve O'Brien!

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

Added:
cfe/trunk/test/Preprocessor/dump_import.h
cfe/trunk/test/Preprocessor/dump_import.m
cfe/trunk/test/Preprocessor/dump_include.c
cfe/trunk/test/Preprocessor/dump_include.h
Modified:
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/include/clang/Frontend/PreprocessorOutputOptions.h
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/lib/Frontend/PrintPreprocessedOutput.cpp

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=285411&r1=285410&r2=285411&view=diff
==
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Fri Oct 28 11:32:10 2016
@@ -429,6 +429,8 @@ def fno_cuda_approx_transcendentals : Fl
 def dA : Flag<["-"], "dA">, Group;
 def dD : Flag<["-"], "dD">, Group, Flags<[CC1Option]>,
   HelpText<"Print macro definitions in -E mode in addition to normal output">;
+def dI : Flag<["-"], "dI">, Group, Flags<[CC1Option]>,
+  HelpText<"Print include directives in -E mode in addition to normal output">;
 def dM : Flag<["-"], "dM">, Group, Flags<[CC1Option]>,
   HelpText<"Print macro definitions in -E mode instead of normal output">;
 def dead__strip : Flag<["-"], "dead_strip">;

Modified: cfe/trunk/include/clang/Frontend/PreprocessorOutputOptions.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/PreprocessorOutputOptions.h?rev=285411&r1=285410&r2=285411&view=diff
==
--- cfe/trunk/include/clang/Frontend/PreprocessorOutputOptions.h (original)
+++ cfe/trunk/include/clang/Frontend/PreprocessorOutputOptions.h Fri Oct 28 
11:32:10 2016
@@ -22,6 +22,7 @@ public:
   unsigned UseLineDirectives : 1;   ///< Use \#line instead of GCC-style \# N.
   unsigned ShowMacroComments : 1;  ///< Show comments, even in macros.
   unsigned ShowMacros : 1; ///< Print macro definitions.
+  unsigned ShowIncludeDirectives : 1;  ///< Print includes, imports etc. 
within preprocessed output.
   unsigned RewriteIncludes : 1;///< Preprocess include directives only.
 
 public:
@@ -32,6 +33,7 @@ public:
 UseLineDirectives = 0;
 ShowMacroComments = 0;
 ShowMacros = 0;
+ShowIncludeDirectives = 0;
 RewriteIncludes = 0;
   }
 };

Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=285411&r1=285410&r2=285411&view=diff
==
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Fri Oct 28 11:32:10 2016
@@ -2353,6 +2353,7 @@ static void ParsePreprocessorOutputArgs(
   Opts.ShowLineMarkers = !Args.hasArg(OPT_P);
   Opts.ShowMacroComments = Args.hasArg(OPT_CC);
   Opts.ShowMacros = Args.hasArg(OPT_dM) || Args.hasArg(OPT_dD);
+  Opts.ShowIncludeDirectives = Args.hasArg(OPT_dI);
   Opts.RewriteIncludes = Args.hasArg(OPT_frewrite_includes);
   Opts.UseLineDirectives = Args.hasArg(OPT_fuse_line_directives);
 }

Modified: cfe/trunk/lib/Frontend/PrintPreprocessedOutput.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PrintPreprocessedOutput.cpp?rev=285411&r1=285410&r2=285411&view=diff
==
--- cfe/trunk/lib/Frontend/PrintPreprocessedOutput.cpp (original)
+++ cfe/trunk/lib/Frontend/PrintPreprocessedOutput.cpp Fri Oct 28 11:32:10 2016
@@ -93,13 +93,16 @@ private:
   bool Initialized;
   bool DisableLineMarkers;
   bool DumpDefines;
+  bool DumpIncludeDirectives;
   bool UseLineDirectives;
   bool IsFirstFileEntered;
 public:
   PrintPPOutputPPCallbacks(Preprocessor &pp, raw_ostream &os, bool lineMarkers,
-   bool defines, bool UseLineDirectives)
+   bool defines, bool DumpIncludeDirectives,
+   bool UseLineDirectives)
   : PP(pp), SM(PP.getSourceManager()), ConcatInfo(PP), OS(os),
 DisableLineMarkers(lineMarkers), DumpDefines(defines),
+DumpIncludeDirectives(DumpIncludeDirectives),
 UseLineDirectives(UseLineDirectives) {
 CurLine = 0;
 CurFilename += "";
@@ -320,10 +323,10 @@ void PrintPPOutputPPCallbacks::Inclusion
  

[PATCH] D25640: [CUDA] [AST] Allow isInlineDefinitionExternallyVisible to be called on functions without bodies.

2016-10-28 Thread Justin Lebar via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL285410: [CUDA] [AST] Allow 
isInlineDefinitionExternallyVisible to be called on… (authored by jlebar).

Changed prior to commit:
  https://reviews.llvm.org/D25640?vs=76118&id=76208#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D25640

Files:
  cfe/trunk/include/clang/AST/Decl.h
  cfe/trunk/lib/AST/Decl.cpp
  cfe/trunk/lib/Sema/SemaDecl.cpp
  cfe/trunk/test/SemaCUDA/gnu-inline.cu

Index: cfe/trunk/include/clang/AST/Decl.h
===
--- cfe/trunk/include/clang/AST/Decl.h
+++ cfe/trunk/include/clang/AST/Decl.h
@@ -1632,6 +1632,11 @@
   /// skipped.
   unsigned HasSkippedBody : 1;
 
+  /// Indicates if the function declaration will have a body, once we're done
+  /// parsing it.  (We don't set it to false when we're done parsing, in the
+  /// hopes this is simpler.)
+  unsigned WillHaveBody : 1;
+
   /// \brief End part of this FunctionDecl's source range.
   ///
   /// We could compute the full range in getSourceRange(). However, when we're
@@ -1701,25 +1706,21 @@
 
 protected:
   FunctionDecl(Kind DK, ASTContext &C, DeclContext *DC, SourceLocation StartLoc,
-   const DeclarationNameInfo &NameInfo,
-   QualType T, TypeSourceInfo *TInfo,
-   StorageClass S, bool isInlineSpecified,
+   const DeclarationNameInfo &NameInfo, QualType T,
+   TypeSourceInfo *TInfo, StorageClass S, bool isInlineSpecified,
bool isConstexprSpecified)
-: DeclaratorDecl(DK, DC, NameInfo.getLoc(), NameInfo.getName(), T, TInfo,
- StartLoc),
-  DeclContext(DK),
-  redeclarable_base(C),
-  ParamInfo(nullptr), Body(),
-  SClass(S),
-  IsInline(isInlineSpecified), IsInlineSpecified(isInlineSpecified),
-  IsVirtualAsWritten(false), IsPure(false), HasInheritedPrototype(false),
-  HasWrittenPrototype(true), IsDeleted(false), IsTrivial(false),
-  IsDefaulted(false), IsExplicitlyDefaulted(false),
-  HasImplicitReturnZero(false), IsLateTemplateParsed(false),
-  IsConstexpr(isConstexprSpecified), UsesSEHTry(false),
-  HasSkippedBody(false), EndRangeLoc(NameInfo.getEndLoc()),
-  TemplateOrSpecialization(),
-  DNLoc(NameInfo.getInfo()) {}
+  : DeclaratorDecl(DK, DC, NameInfo.getLoc(), NameInfo.getName(), T, TInfo,
+   StartLoc),
+DeclContext(DK), redeclarable_base(C), ParamInfo(nullptr), Body(),
+SClass(S), IsInline(isInlineSpecified),
+IsInlineSpecified(isInlineSpecified), IsVirtualAsWritten(false),
+IsPure(false), HasInheritedPrototype(false), HasWrittenPrototype(true),
+IsDeleted(false), IsTrivial(false), IsDefaulted(false),
+IsExplicitlyDefaulted(false), HasImplicitReturnZero(false),
+IsLateTemplateParsed(false), IsConstexpr(isConstexprSpecified),
+UsesSEHTry(false), HasSkippedBody(false), WillHaveBody(false),
+EndRangeLoc(NameInfo.getEndLoc()), TemplateOrSpecialization(),
+DNLoc(NameInfo.getInfo()) {}
 
   typedef Redeclarable redeclarable_base;
   FunctionDecl *getNextRedeclarationImpl() override {
@@ -2001,6 +2002,10 @@
   bool hasSkippedBody() const { return HasSkippedBody; }
   void setHasSkippedBody(bool Skipped = true) { HasSkippedBody = Skipped; }
 
+  /// True if this function will eventually have a body, once it's fully parsed.
+  bool willHaveBody() const { return WillHaveBody; }
+  void setWillHaveBody(bool V = true) { WillHaveBody = V; }
+
   void setPreviousDeclaration(FunctionDecl * PrevDecl);
 
   FunctionDecl *getCanonicalDecl() override;
Index: cfe/trunk/test/SemaCUDA/gnu-inline.cu
===
--- cfe/trunk/test/SemaCUDA/gnu-inline.cu
+++ cfe/trunk/test/SemaCUDA/gnu-inline.cu
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+#include "Inputs/cuda.h"
+
+// expected-no-diagnostics
+
+// Check that we can handle gnu_inline functions when compiling in CUDA mode.
+
+void foo();
+inline __attribute__((gnu_inline)) void bar() { foo(); }
Index: cfe/trunk/lib/AST/Decl.cpp
===
--- cfe/trunk/lib/AST/Decl.cpp
+++ cfe/trunk/lib/AST/Decl.cpp
@@ -2933,7 +2933,7 @@
 /// of redeclarations of the given functions causes
 /// isInlineDefinitionExternallyVisible to change from false to true.
 bool FunctionDecl::doesDeclarationForceExternallyVisibleDefinition() const {
-  assert(!doesThisDeclarationHaveABody() &&
+  assert(!doesThisDeclarationHaveABody() && !willHaveBody() &&
  "Must have a declaration without a body.");
 
   ASTContext &Context = getASTContext();
@@ -3048,7 +3048,8 @@
 /// an externally visible symbol, but "extern inline" will not create an 
 /// externally visible symbol.
 bool FunctionDecl::isInlineDefinitionExternallyVisible() const {
-  assert(doesThisDeclarationHaveABody() && "Must 

r285410 - [CUDA] [AST] Allow isInlineDefinitionExternallyVisible to be called on functions without bodies.

2016-10-28 Thread Justin Lebar via cfe-commits
Author: jlebar
Date: Fri Oct 28 11:26:26 2016
New Revision: 285410

URL: http://llvm.org/viewvc/llvm-project?rev=285410&view=rev
Log:
[CUDA] [AST] Allow isInlineDefinitionExternallyVisible to be called on 
functions without bodies.

Summary:
In CUDA compilation, we call isInlineDefinitionExternallyVisible (via
getGVALinkageForFunction) on functions while parsing their definitions.

At the point in time when we call getGVALinkageForFunction, we haven't
yet added the body to the function, so we trip this assert.  But as far
as I can tell, this is harmless.

To work around this, we add a new flag to FunctionDecl, "WillHaveBody".

There was other code that was working around the existing assert with a
really awful hack -- this change lets us get rid of that hack.

Reviewers: rsmith, tra

Subscribers: aemerson, cfe-commits

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

Added:
cfe/trunk/test/SemaCUDA/gnu-inline.cu
Modified:
cfe/trunk/include/clang/AST/Decl.h
cfe/trunk/lib/AST/Decl.cpp
cfe/trunk/lib/Sema/SemaDecl.cpp

Modified: cfe/trunk/include/clang/AST/Decl.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Decl.h?rev=285410&r1=285409&r2=285410&view=diff
==
--- cfe/trunk/include/clang/AST/Decl.h (original)
+++ cfe/trunk/include/clang/AST/Decl.h Fri Oct 28 11:26:26 2016
@@ -1632,6 +1632,11 @@ private:
   /// skipped.
   unsigned HasSkippedBody : 1;
 
+  /// Indicates if the function declaration will have a body, once we're done
+  /// parsing it.  (We don't set it to false when we're done parsing, in the
+  /// hopes this is simpler.)
+  unsigned WillHaveBody : 1;
+
   /// \brief End part of this FunctionDecl's source range.
   ///
   /// We could compute the full range in getSourceRange(). However, when we're
@@ -1701,25 +1706,21 @@ private:
 
 protected:
   FunctionDecl(Kind DK, ASTContext &C, DeclContext *DC, SourceLocation 
StartLoc,
-   const DeclarationNameInfo &NameInfo,
-   QualType T, TypeSourceInfo *TInfo,
-   StorageClass S, bool isInlineSpecified,
+   const DeclarationNameInfo &NameInfo, QualType T,
+   TypeSourceInfo *TInfo, StorageClass S, bool isInlineSpecified,
bool isConstexprSpecified)
-: DeclaratorDecl(DK, DC, NameInfo.getLoc(), NameInfo.getName(), T, TInfo,
- StartLoc),
-  DeclContext(DK),
-  redeclarable_base(C),
-  ParamInfo(nullptr), Body(),
-  SClass(S),
-  IsInline(isInlineSpecified), IsInlineSpecified(isInlineSpecified),
-  IsVirtualAsWritten(false), IsPure(false), HasInheritedPrototype(false),
-  HasWrittenPrototype(true), IsDeleted(false), IsTrivial(false),
-  IsDefaulted(false), IsExplicitlyDefaulted(false),
-  HasImplicitReturnZero(false), IsLateTemplateParsed(false),
-  IsConstexpr(isConstexprSpecified), UsesSEHTry(false),
-  HasSkippedBody(false), EndRangeLoc(NameInfo.getEndLoc()),
-  TemplateOrSpecialization(),
-  DNLoc(NameInfo.getInfo()) {}
+  : DeclaratorDecl(DK, DC, NameInfo.getLoc(), NameInfo.getName(), T, TInfo,
+   StartLoc),
+DeclContext(DK), redeclarable_base(C), ParamInfo(nullptr), Body(),
+SClass(S), IsInline(isInlineSpecified),
+IsInlineSpecified(isInlineSpecified), IsVirtualAsWritten(false),
+IsPure(false), HasInheritedPrototype(false), HasWrittenPrototype(true),
+IsDeleted(false), IsTrivial(false), IsDefaulted(false),
+IsExplicitlyDefaulted(false), HasImplicitReturnZero(false),
+IsLateTemplateParsed(false), IsConstexpr(isConstexprSpecified),
+UsesSEHTry(false), HasSkippedBody(false), WillHaveBody(false),
+EndRangeLoc(NameInfo.getEndLoc()), TemplateOrSpecialization(),
+DNLoc(NameInfo.getInfo()) {}
 
   typedef Redeclarable redeclarable_base;
   FunctionDecl *getNextRedeclarationImpl() override {
@@ -2001,6 +2002,10 @@ public:
   bool hasSkippedBody() const { return HasSkippedBody; }
   void setHasSkippedBody(bool Skipped = true) { HasSkippedBody = Skipped; }
 
+  /// True if this function will eventually have a body, once it's fully 
parsed.
+  bool willHaveBody() const { return WillHaveBody; }
+  void setWillHaveBody(bool V = true) { WillHaveBody = V; }
+
   void setPreviousDeclaration(FunctionDecl * PrevDecl);
 
   FunctionDecl *getCanonicalDecl() override;

Modified: cfe/trunk/lib/AST/Decl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Decl.cpp?rev=285410&r1=285409&r2=285410&view=diff
==
--- cfe/trunk/lib/AST/Decl.cpp (original)
+++ cfe/trunk/lib/AST/Decl.cpp Fri Oct 28 11:26:26 2016
@@ -2933,7 +2933,7 @@ static bool RedeclForcesDefC99(const Fun
 /// of redeclarations of the given functions causes
 /// isInlineDefinitionExternallyVisible to change from false to true.
 bool FunctionDecl::doesDeclarati

[PATCH] D23657: Remove some false positives when taking the address of packed members

2016-10-28 Thread Roger Ferrer Ibanez via cfe-commits
rogfer01 added a comment.

Ping?


https://reviews.llvm.org/D23657



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


r285408 - Define extra variable in OpenMP offloading driver tests.

2016-10-28 Thread Samuel Antao via cfe-commits
Author: sfantao
Date: Fri Oct 28 10:42:38 2016
New Revision: 285408

URL: http://llvm.org/viewvc/llvm-project?rev=285408&view=rev
Log:
Define extra variable in OpenMP offloading driver tests.

Modified:
cfe/trunk/test/Driver/openmp-offload.c

Modified: cfe/trunk/test/Driver/openmp-offload.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/openmp-offload.c?rev=285408&r1=285407&r2=285408&view=diff
==
--- cfe/trunk/test/Driver/openmp-offload.c (original)
+++ cfe/trunk/test/Driver/openmp-offload.c Fri Oct 28 10:42:38 2016
@@ -250,7 +250,8 @@
 //
 // CHK-COMMANDS: clang{{.*}}" "-cc1" "-triple" "powerpc64le-ibm-linux-gnu" 
"-emit-obj" {{.*}}"-pic-level" "2" {{.*}}"-fopenmp" {{.*}}"-o" "
 // CHK-COMMANDS-SAME: [[T1OBJ:[^\\/]+\.o]]" "-x" "c" "{{.*}}[[INPUT]]" 
"-fopenmp-is-device" "-fopenmp-host-ir-file-path" "{{.*}}[[HOSTBC]]"
-// CHK-COMMANDS: ld" {{.*}}"-o" "{{.*}}[[T1BIN]]" {{.*}}"{{.*}}[[T1OBJ]]"
+// CHK-COMMANDS: ld" {{.*}}"-o" "
+// CHK-COMMANDS-SAME: [[T1BIN:[^\\/]+\.out]]" {{.*}}"{{.*}}[[T1OBJ]]"
 // CHK-COMMANDS-ST: clang{{.*}}" "-cc1" "-triple" "powerpc64le-ibm-linux-gnu" 
"-E" {{.*}}"-fopenmp" {{.*}}"-o" "
 // CHK-COMMANDS-ST-SAME: [[T1PP:[^\\/]+\.i]]" "-x" "c" "{{.*}}[[INPUT]]"
 // CHK-COMMANDS-ST: clang{{.*}}" "-cc1" "-triple" "powerpc64le-ibm-linux-gnu" 
"-emit-llvm-bc" {{.*}}"-pic-level" "2" {{.*}}"-fopenmp" {{.*}}"-o" "
@@ -259,14 +260,15 @@
 // CHK-COMMANDS-ST-SAME: [[T1ASM:[^\\/]+\.s]]" "-x" "ir" "{{.*}}[[T1BC]]"
 // CHK-COMMANDS-ST: clang{{.*}}" "-cc1as" "-triple" 
"powerpc64le-ibm-linux-gnu" "-filetype" "obj" {{.*}}"-o" "
 // CHK-COMMANDS-ST-SAME: [[T1OBJ:[^\\/]+\.o]]" "{{.*}}[[T1ASM]]"
-// CHK-COMMANDS-ST: ld" {{.*}}"-shared" {{.*}}"-o" "{{.*}}[[T1BIN]]" 
{{.*}}[[T1OBJ]]
-
+// CHK-COMMANDS-ST: ld" {{.*}}"-shared" {{.*}}"-o" "
+// CHK-COMMANDS-ST-SAME: 
[[T1BIN:[^\\/]+\.out-openmp-powerpc64le-ibm-linux-gnu]]" {{.*}}"{{.*}}[[T1OBJ]]"
 //
 // Compile for the x86 device.
 //
 // CHK-COMMANDS: clang{{.*}}" "-cc1" "-triple" "x86_64-pc-linux-gnu" 
"-emit-obj" {{.*}}"-pic-level" "2" {{.*}}"-fopenmp"  {{.*}}"-o" "
 // CHK-COMMANDS-SAME: [[T2OBJ:[^\\/]+\.o]]" "-x" "c" "{{.*}}[[INPUT]]" 
"-fopenmp-is-device" "-fopenmp-host-ir-file-path" "{{.*}}[[HOSTBC]]"
-// CHK-COMMANDS: ld" {{.*}}"-o" "{{.*}}[[T2BIN]]" {{.*}}"{{.*}}[[T2OBJ]]"
+// CHK-COMMANDS: ld" {{.*}}"-o" "
+// CHK-COMMANDS-SAME: [[T2BIN:[^\\/]+\.out]]" {{.*}}"{{.*}}[[T2OBJ]]"
 // CHK-COMMANDS-ST: clang{{.*}}" "-cc1" "-triple" "x86_64-pc-linux-gnu" "-E" 
{{.*}}"-fopenmp" {{.*}}"-o" "
 // CHK-COMMANDS-ST-SAME: [[T2PP:[^\\/]+\.i]]" "-x" "c" "{{.*}}[[INPUT]]"
 // CHK-COMMANDS-ST: clang{{.*}}" "-cc1" "-triple" "x86_64-pc-linux-gnu" 
"-emit-llvm-bc" {{.*}}"-pic-level" "2" {{.*}}"-fopenmp" {{.*}}"-o" "
@@ -275,7 +277,8 @@
 // CHK-COMMANDS-ST-SAME: [[T2ASM:[^\\/]+\.s]]" "-x" "ir" "{{.*}}[[T2BC]]"
 // CHK-COMMANDS-ST: clang{{.*}}" "-cc1as" "-triple" "x86_64-pc-linux-gnu" 
"-filetype" "obj" {{.*}}"-o" "
 // CHK-COMMANDS-ST-SAME: [[T2OBJ:[^\\/]+\.o]]" "{{.*}}[[T2ASM]]"
-// CHK-COMMANDS-ST: ld" {{.*}}"-shared" {{.*}}"-o" "{{.*}}[[T2BIN]]" 
{{.*}}[[T2OBJ]]
+// CHK-COMMANDS-ST: ld" {{.*}}"-shared" {{.*}}"-o" "
+// CHK-COMMANDS-ST-SAME: [[T2BIN:[^\\/]+\.out-openmp-x86_64-pc-linux-gnu]]" 
{{.*}}"{{.*}}[[T2OBJ]]"
 
 //
 // Generate host object from the BC file and link using the linker script.


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


[PATCH] D26082: Incomplete support for Python 3 in libclang python bindings

2016-10-28 Thread Jonathan B Coe via cfe-commits
jbcoe created this revision.
jbcoe added reviewers: eliben, compnerd, nemanjai, skalinichev.
jbcoe added a subscriber: cfe-commits.
jbcoe set the repository for this revision to rL LLVM.

This is incomplete and I'm in need of some input.

Some test pass in Python 3 now. Python 2 tests pass as before.

Work so far:

`map` in Python 3 is lazily evaluated so the method by which functions are 
registered needed updating.

Strings are unicode in Python 3 not UTF-8, I've tried to create an new 
c_types-like class (c_string_p) to automate the conversion. It mostly works but 
I may have overlooked things.

Once we can get all Python 3 tests to pass then I'd like to get this merged.


Repository:
  rL LLVM

https://reviews.llvm.org/D26082

Files:
  bindings/python/clang/cindex.py

Index: bindings/python/clang/cindex.py
===
--- bindings/python/clang/cindex.py
+++ bindings/python/clang/cindex.py
@@ -73,6 +73,30 @@
 # this by marshalling object arguments as void**.
 c_object_p = POINTER(c_void_p)
 
+# Python 3 strings are unicode, translate them to/from utf8 for C-interop
+if type(u"") == str:
+class c_string_p(c_char_p):
+def __init__(self, p=None):
+if p is None:
+p = ""
+if type(p) == str:
+p = p.encode("utf8")
+super(c_char_p, self).__init__(p)
+
+def __str__(self):
+return self.value
+
+@property
+def value(self):
+return super(c_char_p, self).value.decode("utf8")
+
+@classmethod
+def from_param(cls, param):
+return cls(param)
+else:
+c_string_p = c_char_p
+
+
 callbacks = {}
 
 ### Exception Classes ###
@@ -147,7 +171,7 @@
 class _CXString(Structure):
 """Helper for transforming CXString results."""
 
-_fields_ = [("spelling", c_char_p), ("free", c_int)]
+_fields_ = [("spelling", c_string_p), ("free", c_int)]
 
 def __del__(self):
 conf.lib.clang_disposeString(self)
@@ -554,8 +578,8 @@
 if value >= len(self.__class__._kinds):
 self.__class__._kinds += [None] * (value - len(self.__class__._kinds) + 1)
 if self.__class__._kinds[value] is not None:
-raise ValueError,'{0} value {1} already loaded'.format(
-str(self.__class__), value)
+raise ValueError('{0} value {1} already loaded'.format(
+str(self.__class__), value))
 self.value = value
 self.__class__._kinds[value] = self
 self.__class__._name_map = None
@@ -577,7 +601,7 @@
 @classmethod
 def from_id(cls, id):
 if id >= len(cls._kinds) or cls._kinds[id] is None:
-raise ValueError,'Unknown template argument kind %d' % id
+raise ValueError('Unknown template argument kind %d' % id)
 return cls._kinds[id]
 
 def __repr__(self):
@@ -1775,7 +1799,7 @@
 if value >= len(StorageClass._kinds):
 StorageClass._kinds += [None] * (value - len(StorageClass._kinds) + 1)
 if StorageClass._kinds[value] is not None:
-raise ValueError,'StorageClass already loaded'
+raise ValueError('StorageClass already loaded')
 self.value = value
 StorageClass._kinds[value] = self
 StorageClass._name_map = None
@@ -1796,7 +1820,7 @@
 @staticmethod
 def from_id(id):
 if id >= len(StorageClass._kinds) or not StorageClass._kinds[id]:
-raise ValueError,'Unknown storage class %d' % id
+raise ValueError('Unknown storage class %d' % id)
 return StorageClass._kinds[id]
 
 def __repr__(self):
@@ -2125,7 +2149,7 @@
 """
 Retrieve the offset of a field in the record.
 """
-return conf.lib.clang_Type_getOffsetOf(self, c_char_p(fieldname))
+return conf.lib.clang_Type_getOffsetOf(self, c_string_p(fieldname))
 
 def get_ref_qualifier(self):
 """
@@ -2184,7 +2208,7 @@
 
 class _CXUnsavedFile(Structure):
 """Helper for passing unsaved file arguments."""
-_fields_ = [("name", c_char_p), ("contents", c_char_p), ('length', c_ulong)]
+_fields_ = [("name", c_string_p), ("contents", c_string_p), ('length', c_ulong)]
 
 # Functions calls through the python interface are rather slow. Fortunately,
 # for most symboles, we do not need to perform a function call. Their spelling
@@ -2539,17 +2563,19 @@
 
 args_array = None
 if len(args) > 0:
-args_array = (c_char_p * len(args))(* args)
+args_array = (c_string_p * len(args))()
+for i,a in enumerate(args):
+args_array[i] = c_string_p(a)
 
 unsaved_array = None
 if len(unsaved_files) > 0:
 unsaved_array = (_CXUnsavedFile * len(unsaved_files))()
 for i, (name, contents) in enumerate(unsaved_files):
 if hasattr(contents, "read"):
 contents = conte

[PATCH] D21845: [Driver][OpenMP] Add specialized action builder for OpenMP offloading actions.

2016-10-28 Thread Samuel Antao via cfe-commits
sfantao added a comment.

Hi Michael,

In https://reviews.llvm.org/D21845#581988, @mkuron wrote:

> I think `OffloadAction::DeviceDependences::add(..., ..., 
> /*BoundArch=*/nullptr, Action::OFK_OpenMP)` is never sufficient. The invalid 
> `BoundArch` eventually ends up in `NVPTX::Assembler::ConstructJob` and 
> triggers an assert; I don't think there is any code path with OpenMP 
> offloading where the GPU architecture is set correctly. If I compile a simple 
> test file with
>
>   clang -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -c example.c 
> -march=sm_30
>
>
> the error message is the following:
>
>   clang: /llvm/tools/clang/lib/Driver/Tools.cpp:11960: virtual void 
> clang::driver::tools::NVPTX::Assembler::ConstructJob(clang::driver::Compilation&,
>  const clang::driver::JobAction&, const clang::driver::InputInfo&, const 
> InputInfoList&, const llvm::opt::ArgList&, const char*) const: Assertion 
> `gpu_arch != CudaArch::UNKNOWN && "Device action expected to have an 
> architecture."' failed.
>
>
> On a related but different note, leaving out `-march=sm_30` in the clang call 
> above causes an earlier assert to trigger:
>
>   clang: /llvm/tools/clang/lib/Driver/ToolChains.cpp:5049: virtual void 
> clang::driver::toolchains::CudaToolChain::addClangTargetOptions(const 
> llvm::opt::ArgList&, llvm::opt::ArgStringList&) const: Assertion 
> `!GpuArch.empty() && "Must have an explicit GPU arch."' failed.
>
>
> The more appropriate flag would probably be `--cuda-gpu-arch=sm_30`, but that 
> is not recognized.
>
> I thought I'd just report this here as it seemed to me that with the merge of 
> all of @sfantao's code yesterday the OpenMP offloading support should mostly 
> work. If this is not the case or I should report the issue elsewhere, please 
> let me know. Also, I'm not sure if/how this relates to the bug report you 
> mentioned.


These patches do not implement any specific support for GPUs. Only toolchains 
based on gcc are expected to work. GPUs will require some extra work on the 
toolchain which is under progress.

In any case, it is not nice to have these assertions when trying an unsupported 
toolchain. I'll work on a diagnostic so that the driver stops before attempting 
to create jobs for unsupported toolchains.

Thanks for reporting this!


https://reviews.llvm.org/D21845



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


[PATCH] D25624: Added 'inline' attribute to basic_string's destructor

2016-10-28 Thread Sebastian Pop via cfe-commits
sebpop added a comment.

Other than removing that comment the patch looks good.
Thanks!




Comment at: libcxx/src/string.cpp:10
 
+// For keeping the definition of ~basic_string in this translation unit.
+#define _LIBCPP_BUILDING_STRING

Let's not add this comment here, as this define may be used in the future for 
other purposes.  Also a simple grep would give you the places where this is 
used.


https://reviews.llvm.org/D25624



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


r285404 - Change OpenMP offload driver tests so that it doesn't use the full file path during tests.

2016-10-28 Thread Samuel Antao via cfe-commits
Author: sfantao
Date: Fri Oct 28 10:11:50 2016
New Revision: 285404

URL: http://llvm.org/viewvc/llvm-project?rev=285404&view=rev
Log:
Change OpenMP offload driver tests so that it doesn't use the full file path 
during tests.

This was causing failures on windows bots. 

Modified:
cfe/trunk/test/Driver/openmp-offload.c

Modified: cfe/trunk/test/Driver/openmp-offload.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/openmp-offload.c?rev=285404&r1=285403&r2=285404&view=diff
==
--- cfe/trunk/test/Driver/openmp-offload.c (original)
+++ cfe/trunk/test/Driver/openmp-offload.c Fri Oct 28 10:11:50 2016
@@ -236,40 +236,62 @@
 //
 // Generate host BC file.
 //
-// CHK-COMMANDS: clang{{.*}}" "-cc1" "-triple" "powerpc64le--linux" 
"-emit-llvm-bc" {{.*}}"-o" "[[HOSTBC:.+\.bc]]" "-x" "c" "[[INPUT:.+\.c]]" 
"-fopenmp-targets=powerpc64le-ibm-linux-gnu,x86_64-pc-linux-gnu"
-// CHK-COMMANDS-ST: clang{{.*}}" "-cc1" "-triple" "powerpc64le--linux" "-E" 
{{.*}}"-fopenmp" {{.*}}"-o" "[[HOSTPP:.+\.i]]" "-x" "c" "[[INPUT:.+\.c]]"
-// CHK-COMMANDS-ST: clang{{.*}}" "-cc1" "-triple" "powerpc64le--linux" 
"-emit-llvm-bc" {{.*}}"-fopenmp" {{.*}}"-o" "[[HOSTBC:.+\.bc]]" "-x" 
"cpp-output" "[[HOSTPP]]" 
"-fopenmp-targets=powerpc64le-ibm-linux-gnu,x86_64-pc-linux-gnu"
+// CHK-COMMANDS: clang{{.*}}" "-cc1" "-triple" "powerpc64le--linux" 
"-emit-llvm-bc" {{.*}}"-o" "
+// CHK-COMMANDS-SAME: [[HOSTBC:[^\\/]+\.bc]]" "-x" "c" "
+// CHK-COMMANDS-SAME: [[INPUT:[^\\/]+\.c]]" 
"-fopenmp-targets=powerpc64le-ibm-linux-gnu,x86_64-pc-linux-gnu"
+// CHK-COMMANDS-ST: clang{{.*}}" "-cc1" "-triple" "powerpc64le--linux" "-E" 
{{.*}}"-fopenmp" {{.*}}"-o" "
+// CHK-COMMANDS-ST-SAME: [[HOSTPP:[^\\/]+\.i]]" "-x" "c" "
+// CHK-COMMANDS-ST-SAME: [[INPUT:[^\\/]+\.c]]"
+// CHK-COMMANDS-ST: clang{{.*}}" "-cc1" "-triple" "powerpc64le--linux" 
"-emit-llvm-bc" {{.*}}"-fopenmp" {{.*}}"-o" "
+// CHK-COMMANDS-ST-SAME: [[HOSTBC:[^\\/]+\.bc]]" "-x" "cpp-output" 
"{{.*}}[[HOSTPP]]" 
"-fopenmp-targets=powerpc64le-ibm-linux-gnu,x86_64-pc-linux-gnu"
 
 //
 // Compile for the powerpc device.
 //
-// CHK-COMMANDS: clang{{.*}}" "-cc1" "-triple" "powerpc64le-ibm-linux-gnu" 
"-emit-obj" {{.*}}"-pic-level" "2" {{.*}}"-fopenmp" {{.*}}"-o" 
"[[T1OBJ:.+\.o]]" "-x" "c" "[[INPUT]]" "-fopenmp-is-device" 
"-fopenmp-host-ir-file-path" "[[HOSTBC]]"
-// CHK-COMMANDS: ld" {{.*}}"-o" "[[T1BIN]]" {{.*}}"[[T1OBJ]]"
-// CHK-COMMANDS-ST: clang{{.*}}" "-cc1" "-triple" "powerpc64le-ibm-linux-gnu" 
"-E" {{.*}}"-fopenmp" {{.*}}"-o" "[[T1PP:.+\.i]]" "-x" "c" "[[INPUT]]"
-// CHK-COMMANDS-ST: clang{{.*}}" "-cc1" "-triple" "powerpc64le-ibm-linux-gnu" 
"-emit-llvm-bc" {{.*}}"-pic-level" "2" {{.*}}"-fopenmp" {{.*}}"-o" 
"[[T1BC:.+\.bc]]" "-x" "cpp-output" "[[T1PP]]" "-fopenmp-is-device" 
"-fopenmp-host-ir-file-path" "[[HOSTBC]]"
-// CHK-COMMANDS-ST: clang{{.*}}" "-cc1" "-triple" "powerpc64le-ibm-linux-gnu" 
"-S" {{.*}}"-fopenmp" {{.*}}"-o" "[[T1ASM:.+\.s]]" "-x" "ir" "[[T1BC]]"
-// CHK-COMMANDS-ST: clang{{.*}}" "-cc1as" "-triple" 
"powerpc64le-ibm-linux-gnu" "-filetype" "obj" {{.*}}"-o" "[[T1OBJ:.+\.o]]" 
"[[T1ASM]]"
-// CHK-COMMANDS-ST: ld" {{.*}}"-shared" {{.*}}"-o" "[[T1BIN]]" {{.*}}[[T1OBJ]]
+// CHK-COMMANDS: clang{{.*}}" "-cc1" "-triple" "powerpc64le-ibm-linux-gnu" 
"-emit-obj" {{.*}}"-pic-level" "2" {{.*}}"-fopenmp" {{.*}}"-o" "
+// CHK-COMMANDS-SAME: [[T1OBJ:[^\\/]+\.o]]" "-x" "c" "{{.*}}[[INPUT]]" 
"-fopenmp-is-device" "-fopenmp-host-ir-file-path" "{{.*}}[[HOSTBC]]"
+// CHK-COMMANDS: ld" {{.*}}"-o" "{{.*}}[[T1BIN]]" {{.*}}"{{.*}}[[T1OBJ]]"
+// CHK-COMMANDS-ST: clang{{.*}}" "-cc1" "-triple" "powerpc64le-ibm-linux-gnu" 
"-E" {{.*}}"-fopenmp" {{.*}}"-o" "
+// CHK-COMMANDS-ST-SAME: [[T1PP:[^\\/]+\.i]]" "-x" "c" "{{.*}}[[INPUT]]"
+// CHK-COMMANDS-ST: clang{{.*}}" "-cc1" "-triple" "powerpc64le-ibm-linux-gnu" 
"-emit-llvm-bc" {{.*}}"-pic-level" "2" {{.*}}"-fopenmp" {{.*}}"-o" "
+// CHK-COMMANDS-ST-SAME: [[T1BC:[^\\/]+\.bc]]" "-x" "cpp-output" 
"{{.*}}[[T1PP]]" "-fopenmp-is-device" "-fopenmp-host-ir-file-path" 
"{{.*}}[[HOSTBC]]"
+// CHK-COMMANDS-ST: clang{{.*}}" "-cc1" "-triple" "powerpc64le-ibm-linux-gnu" 
"-S" {{.*}}"-fopenmp" {{.*}}"-o" "
+// CHK-COMMANDS-ST-SAME: [[T1ASM:[^\\/]+\.s]]" "-x" "ir" "{{.*}}[[T1BC]]"
+// CHK-COMMANDS-ST: clang{{.*}}" "-cc1as" "-triple" 
"powerpc64le-ibm-linux-gnu" "-filetype" "obj" {{.*}}"-o" "
+// CHK-COMMANDS-ST-SAME: [[T1OBJ:[^\\/]+\.o]]" "{{.*}}[[T1ASM]]"
+// CHK-COMMANDS-ST: ld" {{.*}}"-shared" {{.*}}"-o" "{{.*}}[[T1BIN]]" 
{{.*}}[[T1OBJ]]
 
 //
 // Compile for the x86 device.
 //
-// CHK-COMMANDS: clang{{.*}}" "-cc1" "-triple" "x86_64-pc-linux-gnu" 
"-emit-obj" {{.*}}"-pic-level" "2" {{.*}}"-fopenmp"  {{.*}}"-o" 
"[[T2OBJ:.+\.o]]" "-x" "c" "[[INPUT]]" "-fopenmp-is-device" 
"-fopenmp-host-ir-file-path" "[[HOSTBC]]"
-// CHK-COMMANDS: ld" {{.*}}"-o" "[[T2BIN]]" {{.*}}"[[T2OBJ]]"
-// CHK-COMMANDS-ST: clang{{.*}}" "-cc1" "-triple" "x86_64-pc-linux-gnu" "-E" 
{{.*}}"-fopenmp" {{.*}

[PATCH] D25624: Added 'inline' attribute to basic_string's destructor

2016-10-28 Thread Eric Fiselier via cfe-commits
EricWF added a comment.

Actually we don't want to copy `memory.cpp` in this case. Please use 
`_LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY`. There are only examples in 
`` you can follow. Make sure to put it on the in-class declaration.


https://reviews.llvm.org/D25624



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


r285405 - 1. Fixing small types issue (PD|PS) (reduce) .

2016-10-28 Thread Michael Zuckerman via cfe-commits
Author: mzuckerm
Date: Fri Oct 28 10:16:03 2016
New Revision: 285405

URL: http://llvm.org/viewvc/llvm-project?rev=285405&view=rev
Log:
1. Fixing small types issue (PD|PS) (reduce)  .
2. Cosmetic changes

Modified:
cfe/trunk/lib/Headers/avx512fintrin.h
cfe/trunk/test/CodeGen/avx512-reduceIntrin.c

Modified: cfe/trunk/lib/Headers/avx512fintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512fintrin.h?rev=285405&r1=285404&r2=285405&view=diff
==
--- cfe/trunk/lib/Headers/avx512fintrin.h (original)
+++ cfe/trunk/lib/Headers/avx512fintrin.h Fri Oct 28 10:16:03 2016
@@ -9668,7 +9668,7 @@ _mm512_mask_abs_pd(__m512d __W, __mmask8
 // This takes log2(n) steps where n is the number of elements in the vector.
 
 // Vec512 - Vector with size 512.
-// Operator - Can be one of following: +,*,&&,||
+// Operator - Can be one of following: +,*,&,|
 // T2  - Can get 'i' for int and 'f' for float.
 // T1 - Can get 'i' for int and 'd' for double.
 
@@ -9725,54 +9725,60 @@ static __inline__ double __DEFAULT_FN_AT
 }
 
 // Vec512 - Vector with size 512.
-// Operator - Can be one of following: +,*,&&,||
+// Vec512Neutral - All vector elements set to the identity element. 
+// Identity element: {+,0},{*,1},{&,0x},{|,0}
+// Operator - Can be one of following: +,*,&,|
 // Mask - Intrinsic Mask
-// Neutral - Identity element: {+,0},{*,1},{&&,0x},{||,0}
 // T2  - Can get 'i' for int and 'f' for float.
 // T1 - Can get 'i' for int and 'd' for packed double-precision.
 // T3 - Can be Pd for packed double or q for q-word.
 
-#define _mm512_mask_reduce_operator_64bit(Vec512, Operator, Mask, Neutral, 
\
-  T2, T1, T3)  
\
+#define _mm512_mask_reduce_operator_64bit(Vec512, Vec512Neutral, Operator, 
\
+  Mask, T2, T1, T3)
\
   __extension__({  
\
 Vec512 = __builtin_ia32_select##T3##_512(  
\
- (__mmask8)Mask, (__v8d##T2)Vec512,
\
- (__v8d##T2)_mm512_set1_epi64(Neutral));   
\
+ (__mmask8)Mask,   
\
+ (__v8d##T2)Vec512,
\
+ (__v8d##T2)Vec512Neutral);
\
 _mm512_reduce_operator_64bit(Vec512, Operator, T2, T1);
\
   })
 
 static __inline__ long long __DEFAULT_FN_ATTRS
 _mm512_mask_reduce_add_epi64(__mmask8 __M, __m512i __W) {
-  _mm512_mask_reduce_operator_64bit(__W, +, __M, 0, i, i, q);
+  _mm512_mask_reduce_operator_64bit(__W, _mm512_set1_epi64(0), +, __M, i, i, 
q);
 }
 
 static __inline__ long long __DEFAULT_FN_ATTRS
 _mm512_mask_reduce_mul_epi64(__mmask8 __M, __m512i __W) {
-  _mm512_mask_reduce_operator_64bit(__W, *, __M, 1, i, i, q);
+  _mm512_mask_reduce_operator_64bit(__W, _mm512_set1_epi64(1), *, __M, i, i, 
q);
 }
 
 static __inline__ long long __DEFAULT_FN_ATTRS
 _mm512_mask_reduce_and_epi64(__mmask8 __M, __m512i __W) {
-  _mm512_mask_reduce_operator_64bit(__W, &, __M, 0x, i, i, q);
+  _mm512_mask_reduce_operator_64bit(__W, 
_mm512_set1_epi64(0x), 
+&, __M,  i, i, q);
 }
 
 static __inline__ long long __DEFAULT_FN_ATTRS
 _mm512_mask_reduce_or_epi64(__mmask8 __M, __m512i __W) {
-  _mm512_mask_reduce_operator_64bit(__W, |, __M, 0, i, i, q);
+  _mm512_mask_reduce_operator_64bit(__W, _mm512_set1_epi64(0), |, __M, 
+i, i, q);
 }
 
 static __inline__ double __DEFAULT_FN_ATTRS
 _mm512_mask_reduce_add_pd(__mmask8 __M, __m512d __W) {
-  _mm512_mask_reduce_operator_64bit(__W, +, __M, 0, f, d, pd);
+  _mm512_mask_reduce_operator_64bit(__W, _mm512_set1_pd(0), +, __M, 
+f, d, pd);
 }
 
 static __inline__ double __DEFAULT_FN_ATTRS
 _mm512_mask_reduce_mul_pd(__mmask8 __M, __m512d __W) {
-  _mm512_mask_reduce_operator_64bit(__W, *, __M, 1, f, d, pd);
+  _mm512_mask_reduce_operator_64bit(__W, _mm512_set1_pd(1), *, __M,
+f, d, pd);
 }
 
 // Vec512 - Vector with size 512.
-// Operator - Can be one of following: +,*,&&,||
+// Operator - Can be one of following: +,*,&,|
 // T2 - Can get 'i' for int and ' ' for packed single.
 // T1 - Can get 'i' for int and 'f' for float.
 
@@ -9849,50 +9855,53 @@ _mm512_reduce_mul_ps(__m512 __W) {
 }
 
 // Vec512 - Vector with size 512.
-// Operator - Can be one of following: +,*,&&,||
+// Vec512Neutral - All vector elements set to the identity element. 
+// Identity element: {+,0},{*,1},{&,0x},{|,0}
+// Operator - Can be one of following: +,*,&,|
 // Mask - Intrinsic Mask
-// Neutral - Identity element: {

[PATCH] D25624: Added 'inline' attribute to basic_string's destructor

2016-10-28 Thread Eric Fiselier via cfe-commits
EricWF added a comment.

Additionally _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY is documented here 
http://libcxx.llvm.org/docs/DesignDocs/VisibilityMacros.html.


https://reviews.llvm.org/D25624



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


[PATCH] D21845: [Driver][OpenMP] Add specialized action builder for OpenMP offloading actions.

2016-10-28 Thread Michael Kuron via cfe-commits
mkuron added a comment.

I think `OffloadAction::DeviceDependences::add(..., ..., /*BoundArch=*/nullptr, 
Action::OFK_OpenMP)` is never sufficient. The invalid `BoundArch` eventually 
ends up in `NVPTX::Assembler::ConstructJob` and triggers an assert; I don't 
think there is any code path with OpenMP offloading where the GPU architecture 
is set correctly. If I compile a simple test file with

  clang -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -c example.c 
-march=sm_30

the error message is the following:

  clang: /llvm/tools/clang/lib/Driver/Tools.cpp:11960: virtual void 
clang::driver::tools::NVPTX::Assembler::ConstructJob(clang::driver::Compilation&,
 const clang::driver::JobAction&, const clang::driver::InputInfo&, const 
InputInfoList&, const llvm::opt::ArgList&, const char*) const: Assertion 
`gpu_arch != CudaArch::UNKNOWN && "Device action expected to have an 
architecture."' failed.

On a related but different note, leaving out `-march=sm_30` in the clang call 
above causes an earlier assert to trigger:

  clang: /llvm/tools/clang/lib/Driver/ToolChains.cpp:5049: virtual void 
clang::driver::toolchains::CudaToolChain::addClangTargetOptions(const 
llvm::opt::ArgList&, llvm::opt::ArgStringList&) const: Assertion 
`!GpuArch.empty() && "Must have an explicit GPU arch."' failed.

The more appropriate flag would probably be `--cuda-gpu-arch=sm_30`, but that 
is not recognized.

I thought I'd just report this here as it seemed to me that with the merge of 
all of @sfantao's code yesterday the OpenMP offloading support should mostly 
work. If this is not the case or I should report the issue elsewhere, please 
let me know.


https://reviews.llvm.org/D21845



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


[PATCH] D25624: Added 'inline' attribute to basic_string's destructor

2016-10-28 Thread Aditya Kumar via cfe-commits
hiraditya updated this revision to Diff 76192.
hiraditya added a comment.

Addressed Sebastian's comments.


https://reviews.llvm.org/D25624

Files:
  libcxx/include/string
  libcxx/src/string.cpp


Index: libcxx/src/string.cpp
===
--- libcxx/src/string.cpp
+++ libcxx/src/string.cpp
@@ -7,6 +7,9 @@
 //
 
//===--===//
 
+// For keeping the definition of ~basic_string in this translation unit.
+#define _LIBCPP_BUILDING_STRING
+
 #include "string"
 #include "cstdlib"
 #include "cwchar"
Index: libcxx/include/string
===
--- libcxx/include/string
+++ libcxx/include/string
@@ -1834,6 +1834,9 @@
 #endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
 
 template 
+#ifndef _LIBCPP_BUILDING_STRING
+inline _LIBCPP_INLINE_VISIBILITY
+#endif
 basic_string<_CharT, _Traits, _Allocator>::~basic_string()
 {
 #if _LIBCPP_DEBUG_LEVEL >= 2


Index: libcxx/src/string.cpp
===
--- libcxx/src/string.cpp
+++ libcxx/src/string.cpp
@@ -7,6 +7,9 @@
 //
 //===--===//
 
+// For keeping the definition of ~basic_string in this translation unit.
+#define _LIBCPP_BUILDING_STRING
+
 #include "string"
 #include "cstdlib"
 #include "cwchar"
Index: libcxx/include/string
===
--- libcxx/include/string
+++ libcxx/include/string
@@ -1834,6 +1834,9 @@
 #endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
 
 template 
+#ifndef _LIBCPP_BUILDING_STRING
+inline _LIBCPP_INLINE_VISIBILITY
+#endif
 basic_string<_CharT, _Traits, _Allocator>::~basic_string()
 {
 #if _LIBCPP_DEBUG_LEVEL >= 2
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D26075: Change from "XFAIL: libcpp-no-exceptions" to "UNSUPPORTED: libcpp-no-exceptions" tests that only check exceptions and nothing else

2016-10-28 Thread Roger Ferrer Ibanez via cfe-commits
rogfer01 created this revision.
rogfer01 added reviewers: rmaprath, EricWF, mclow.lists.
rogfer01 added a subscriber: cfe-commits.

This is a follow up of https://reviews.llvm.org/D24562.

These tests do not check anything but exceptions, so it makes sense to mark 
them as UNSUPPORTED under a library built without exceptions.


https://reviews.llvm.org/D26075

Files:
  test/libcxx/containers/sequences/vector/asan_throw.pass.cpp
  
test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/default_throws_bad_alloc.pass.cpp
  
test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/at.pass.cpp
  
test/std/containers/sequences/deque/deque.modifiers/push_back_exception_safety.pass.cpp
  
test/std/containers/sequences/deque/deque.modifiers/push_front_exception_safety.pass.cpp
  
test/std/containers/sequences/forwardlist/forwardlist.modifiers/push_front_exception_safety.pass.cpp
  
test/std/containers/sequences/list/list.modifiers/push_back_exception_safety.pass.cpp
  
test/std/containers/sequences/list/list.modifiers/push_front_exception_safety.pass.cpp
  
test/std/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp
  
test/std/language.support/support.exception/except.nested/rethrow_nested.pass.cpp
  
test/std/language.support/support.exception/except.nested/throw_with_nested.pass.cpp
  
test/std/language.support/support.exception/propagation/current_exception.pass.cpp
  
test/std/language.support/support.exception/propagation/make_exception_ptr.pass.cpp
  
test/std/language.support/support.exception/propagation/rethrow_exception.pass.cpp
  
test/std/language.support/support.exception/uncaught/uncaught_exception.pass.cpp
  
test/std/language.support/support.exception/uncaught/uncaught_exceptions.pass.cpp
  test/std/strings/basic.string/string.capacity/max_size.pass.cpp
  test/std/strings/basic.string/string.capacity/over_max_size.pass.cpp
  
test/std/thread/thread.condition/thread.condition.condvarany/wait_terminates.sh.cpp
  
test/std/utilities/memory/default.allocator/allocator.members/allocate.size.pass.cpp
  
test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_allocator_throw.pass.cpp
  
test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_throw.pass.cpp
  
test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_allocator_throw.pass.cpp
  
test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_throw.pass.cpp
  
test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_throw.pass.cpp

Index: test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_throw.pass.cpp
===
--- test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_throw.pass.cpp
+++ test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_throw.pass.cpp
@@ -7,7 +7,7 @@
 //
 //===--===//
 
-// XFAIL: libcpp-no-exceptions
+// UNSUPPORTED: libcpp-no-exceptions
 // UNSUPPORTED: sanitizer-new-delete
 
 // 
Index: test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_throw.pass.cpp
===
--- test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_throw.pass.cpp
+++ test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_throw.pass.cpp
@@ -7,7 +7,7 @@
 //
 //===--===//
 
-// XFAIL: libcpp-no-exceptions
+// UNSUPPORTED: libcpp-no-exceptions
 // UNSUPPORTED: sanitizer-new-delete
 
 // 
Index: test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_allocator_throw.pass.cpp
===
--- test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_allocator_throw.pass.cpp
+++ test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_allocator_throw.pass.cpp
@@ -7,7 +7,7 @@
 //
 //===--===//
 
-// XFAIL: libcpp-no-exceptions
+// UNSUPPORTED: libcpp-no-exceptions
 // 
 
 // template shared_ptr(Y* p, D d, A a);
Index: test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_throw.pass.cpp
===
--- test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullp

[libcxx] r285403 - Explicitly specify extern "C++" on __libcpp_library_version

2016-10-28 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri Oct 28 10:02:30 2016
New Revision: 285403

URL: http://llvm.org/viewvc/llvm-project?rev=285403&view=rev
Log:
Explicitly specify extern "C++" on  __libcpp_library_version

Modified:
libcxx/trunk/include/__config

Modified: libcxx/trunk/include/__config
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=285403&r1=285402&r2=285403&view=diff
==
--- libcxx/trunk/include/__config (original)
+++ libcxx/trunk/include/__config Fri Oct 28 10:02:30 2016
@@ -909,7 +909,7 @@ extern "C" void __sanitizer_annotate_con
 #endif
 
 _LIBCPP_BEGIN_NAMESPACE_STD
-_LIBCPP_FUNC_VIS _LIBCPP_WEAK int __libcpp_library_version();
+_LIBCPP_FUNC_VIS _LIBCPP_WEAK extern "C++" int __libcpp_library_version();
 _LIBCPP_END_NAMESPACE_STD
 
 #define _LIBCPP_LIBRARY_VERSION \


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


Re: [libcxx] r285382 - Add __libcpp_version file and __libcpp_library_version function.

2016-10-28 Thread James Y Knight via cfe-commits
This breaks code which is using module headers, and then does like this:
extern "C" {
#include 
}

because:

> In file included from include/c++/v1/stdint.h:102:
> include/c++/v1/__config:912:35: error: declaration of
> '__libcpp_library_version' has a different language linkage
> _LIBCPP_FUNC_VIS _LIBCPP_WEAK int __libcpp_library_version();
>   ^
> include/c++/v1/__config:912:35: note: previous declaration is here
> _LIBCPP_FUNC_VIS _LIBCPP_WEAK int __libcpp_library_version();



Yes, ideally people wouldn't put a stdint.h include inside an extern "C",
but it's very common -- especially because a lot of C-library headers don't
have the appropriate extern "C" around their own declarations, so you
*need* to surround the whole thing with an extern "C". So this breaks a
whole lot of code.

I think you need to either make these functions extern "C", or else not
provide them in __config.



On Fri, Oct 28, 2016 at 2:06 AM, Eric Fiselier via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: ericwf
> Date: Fri Oct 28 01:06:50 2016
> New Revision: 285382
>
> URL: http://llvm.org/viewvc/llvm-project?rev=285382&view=rev
> Log:
> Add __libcpp_version file and __libcpp_library_version function.
>
> This patch does two seperate things. First it adds a file called
> "__libcpp_version" which only contains the current libc++ version
> (currently 4000). This file is not intended for use as a header. This file
> is used by Clang in order to easily determine the installed libc++ version.
> This allows Clang to enable/disable certain language features only when the
> library supports them.
>
> The second change is the addition of _LIBCPP_LIBRARY_VERSION macro, which
> returns the version of the installed dylib since it may be different than
> the headers.
>
> Added:
> libcxx/trunk/include/__libcpp_version
> libcxx/trunk/src/libcpp_version.cpp
> libcxx/trunk/test/libcxx/version.pass.cpp
> Modified:
> libcxx/trunk/include/__config
> libcxx/trunk/lib/abi/CHANGELOG.TXT
> libcxx/trunk/lib/abi/x86_64-linux-gnu.abilist
>
> Modified: libcxx/trunk/include/__config
> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__
> config?rev=285382&r1=285381&r2=285382&view=diff
> 
> ==
> --- libcxx/trunk/include/__config (original)
> +++ libcxx/trunk/include/__config Fri Oct 28 01:06:50 2016
> @@ -908,6 +908,13 @@ extern "C" void __sanitizer_annotate_con
>  #define _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF
>  #endif
>
> +_LIBCPP_BEGIN_NAMESPACE_STD
> +_LIBCPP_FUNC_VIS _LIBCPP_WEAK int __libcpp_library_version();
> +_LIBCPP_END_NAMESPACE_STD
> +
> +#define _LIBCPP_LIBRARY_VERSION \
> + (_VSTD::__libcpp_library_version ? _VSTD::__libcpp_library_version() :
> -1)
> +
>  #endif // __cplusplus
>
>  #endif // _LIBCPP_CONFIG
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D24799: [XRay] Check in Clang whether XRay supports the target when -fxray-instrument is passed

2016-10-28 Thread Serge Rogatch via cfe-commits
rSerge added a comment.

@dberris , I've checked the .diff file which I was uploading to Phabricator, 
and it doesn't seem to contain trailing whitespace. Please, see the screenshot:
F2536547: Whitespace.jpg 
So it seems that Phabricator or your downloading tool adds the whitespace.
The only potential problem is in "CR,LF" line terminator, while you may be 
using Linux "LF" only.


Repository:
  rL LLVM

https://reviews.llvm.org/D24799



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


[PATCH] D22346: [Clang-tidy] CERT-MSC50-CPP (std:rand() )

2016-10-28 Thread Aaron Ballman via cfe-commits
aaron.ballman added a comment.

In https://reviews.llvm.org/D22346#581329, @falho wrote:

> Cool! Thank you for the reviews!


If you don't have commit privileges, let me know and I'm happy to commit on 
your behalf.


https://reviews.llvm.org/D22346



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


[PATCH] D26073: [PPC] Add vec_absd functions to altivec.h

2016-10-28 Thread Sean Fertile via cfe-commits
sfertile created this revision.
sfertile added reviewers: kbarton, amehsan, lei, jtony, syzaara, nemanjai, 
echristo.
sfertile added a subscriber: cfe-commits.
Herald added a subscriber: mehdi_amini.

Adds  three overloads of vec_absd to altivec .h, as well as matching PPC 
specific builtins:

vector unsigned char vec_absd (vector unsigned char, vector unsigned char);
vector unsigned int vec_absd (vector unsigned int, vector unsigned int);
vector unsigned short vec_absd (vector unsigned short, vector unsigned short);


https://reviews.llvm.org/D26073

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


Index: test/CodeGen/builtins-ppc-p9vector.c
===
--- test/CodeGen/builtins-ppc-p9vector.c
+++ test/CodeGen/builtins-ppc-p9vector.c
@@ -726,3 +726,18 @@
 // CHECK-NEXT: ret <4 x float>
   return vec_insert_exp (vuia,vuib);
 }
+vector unsigned char test59(void) {
+// CHECK-BE: call <16 x i8> @llvm.ppc.altivec.vabsdub(<16 x i8> {{.+}}, <16 x 
i8> {{.+}})
+// CHECK: call <16 x i8> @llvm.ppc.altivec.vabsdub(<16 x i8> {{.+}}, <16 x i8> 
{{.+}})
+  return vec_absd(vuca, vucb);
+}
+vector unsigned short test60(void) {
+// CHECK-BE: call <8 x i16> @llvm.ppc.altivec.vabsduh(<8 x i16> {{.+}}, <8 x 
i16> {{.+}})
+// CHECK: call <8 x i16> @llvm.ppc.altivec.vabsduh(<8 x i16> {{.+}}, <8 x i16> 
{{.+}})
+  return vec_absd(vusa, vusb);
+}
+vector unsigned int test61(void) {
+// CHECK-BE: call <4 x i32> @llvm.ppc.altivec.vabsduw(<4 x i32> {{.+}}, <4 x 
i32> {{.+}})
+// CHECK: call <4 x i32> @llvm.ppc.altivec.vabsduw(<4 x i32> {{.+}}, <4 x i32> 
{{.+}})
+  return vec_absd(vuia, vuib);
+}
Index: lib/Headers/altivec.h
===
--- lib/Headers/altivec.h
+++ lib/Headers/altivec.h
@@ -163,6 +163,26 @@
   __a, __builtin_altivec_vsubsws((vector signed int)(0), __a));
 }
 
+/* vec_absd */
+#if defined(__POWER9_VECTOR__)
+
+static __inline__ vector unsigned char __ATTRS_o_ai
+vec_absd(vector unsigned char __a, vector unsigned char __b) {
+  return __builtin_altivec_vabsdub(__a, __b);
+}
+
+static __inline__ vector unsigned short __ATTRS_o_ai
+vec_absd(vector unsigned short __a, vector unsigned short __b) {
+  return __builtin_altivec_vabsduh(__a, __b);
+}
+
+static __inline__ vector unsigned int __ATTRS_o_ai
+vec_absd(vector unsigned int __a,  vector unsigned int __b) {
+  return __builtin_altivec_vabsduw(__a, __b);
+}
+
+#endif /* End __POWER9_VECTOR__ */
+
 /* vec_add */
 
 static __inline__ vector signed char __ATTRS_o_ai
Index: include/clang/Basic/BuiltinsPPC.def
===
--- include/clang/Basic/BuiltinsPPC.def
+++ include/clang/Basic/BuiltinsPPC.def
@@ -278,6 +278,11 @@
 BUILTIN(__builtin_altivec_vpopcntw, "V4UiV4Ui", "")
 BUILTIN(__builtin_altivec_vpopcntd, "V2ULLiV2ULLi", "")
 
+// Absolute difference built-ins
+BUILTIN(__builtin_altivec_vabsdub, "V16UcV16UcV16Uc", "")
+BUILTIN(__builtin_altivec_vabsduh, "V8UsV8UsV8Us", "")
+BUILTIN(__builtin_altivec_vabsduw, "V4UiV4UiV4Ui", "")
+
 // VSX built-ins.
 
 BUILTIN(__builtin_vsx_lxvd2x, "V2divC*", "")


Index: test/CodeGen/builtins-ppc-p9vector.c
===
--- test/CodeGen/builtins-ppc-p9vector.c
+++ test/CodeGen/builtins-ppc-p9vector.c
@@ -726,3 +726,18 @@
 // CHECK-NEXT: ret <4 x float>
   return vec_insert_exp (vuia,vuib);
 }
+vector unsigned char test59(void) {
+// CHECK-BE: call <16 x i8> @llvm.ppc.altivec.vabsdub(<16 x i8> {{.+}}, <16 x i8> {{.+}})
+// CHECK: call <16 x i8> @llvm.ppc.altivec.vabsdub(<16 x i8> {{.+}}, <16 x i8> {{.+}})
+  return vec_absd(vuca, vucb);
+}
+vector unsigned short test60(void) {
+// CHECK-BE: call <8 x i16> @llvm.ppc.altivec.vabsduh(<8 x i16> {{.+}}, <8 x i16> {{.+}})
+// CHECK: call <8 x i16> @llvm.ppc.altivec.vabsduh(<8 x i16> {{.+}}, <8 x i16> {{.+}})
+  return vec_absd(vusa, vusb);
+}
+vector unsigned int test61(void) {
+// CHECK-BE: call <4 x i32> @llvm.ppc.altivec.vabsduw(<4 x i32> {{.+}}, <4 x i32> {{.+}})
+// CHECK: call <4 x i32> @llvm.ppc.altivec.vabsduw(<4 x i32> {{.+}}, <4 x i32> {{.+}})
+  return vec_absd(vuia, vuib);
+}
Index: lib/Headers/altivec.h
===
--- lib/Headers/altivec.h
+++ lib/Headers/altivec.h
@@ -163,6 +163,26 @@
   __a, __builtin_altivec_vsubsws((vector signed int)(0), __a));
 }
 
+/* vec_absd */
+#if defined(__POWER9_VECTOR__)
+
+static __inline__ vector unsigned char __ATTRS_o_ai
+vec_absd(vector unsigned char __a, vector unsigned char __b) {
+  return __builtin_altivec_vabsdub(__a, __b);
+}
+
+static __inline__ vector unsigned short __ATTRS_o_ai
+vec_absd(vector unsigned short __a, vector unsigned short __b) {
+  return __builtin_altivec_vabsduh(__a, __b);
+}
+
+static __inline__ vector unsigned int __ATTRS_o_ai
+vec_absd(vector unsigned int __a,  vector unsig

[PATCH] D25990: Sema: do not warn about unused const vars if main file is a header

2016-10-28 Thread Erik Verbruggen via cfe-commits
erikjv closed this revision.
erikjv added a comment.

Committed as r285386.


https://reviews.llvm.org/D25990



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


[PATCH] D25153: preprocessor supports `-dI` flag

2016-10-28 Thread Steve O'Brien via cfe-commits
elsteveogrande added a comment.

Ping, can anyone help with committing this?  It's accepted, just needs to be 
landed.  (I don't have commit access.)  Thanks!


https://reviews.llvm.org/D25153



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


[clang-tools-extra] r285396 - [include-fixer] Make error message sound less like clang crashed.

2016-10-28 Thread Benjamin Kramer via cfe-commits
Author: d0k
Date: Fri Oct 28 08:00:49 2016
New Revision: 285396

URL: http://llvm.org/viewvc/llvm-project?rev=285396&view=rev
Log:
[include-fixer] Make error message sound less like clang crashed.

We suppress all Clang diagnostics (because they would be wrong,
include-fixer does custom recovery) but still want to give some feedback
in case there was a compiler error we couldn't recover from. The most
common case for this is a #include in the file that couldn't be found.

Modified:
clang-tools-extra/trunk/include-fixer/tool/ClangIncludeFixer.cpp

Modified: clang-tools-extra/trunk/include-fixer/tool/ClangIncludeFixer.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/include-fixer/tool/ClangIncludeFixer.cpp?rev=285396&r1=285395&r2=285396&view=diff
==
--- clang-tools-extra/trunk/include-fixer/tool/ClangIncludeFixer.cpp (original)
+++ clang-tools-extra/trunk/include-fixer/tool/ClangIncludeFixer.cpp Fri Oct 28 
08:00:49 2016
@@ -351,8 +351,12 @@ int includeFixerMain(int argc, const cha
Style, 
MinimizeIncludePaths);
 
   if (tool.run(&Factory) != 0) {
-llvm::errs()
-<< "Clang died with a fatal error! (incorrect include paths?)\n";
+// We suppress all Clang diagnostics (because they would be wrong,
+// include-fixer does custom recovery) but still want to give some feedback
+// in case there was a compiler error we couldn't recover from. The most
+// common case for this is a #include in the file that couldn't be found.
+llvm::errs() << "Fatal compiler error occurred while parsing file!"
+" (incorrect include paths?)\n";
 return 1;
   }
 


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


r285395 - [OpenCL] Diagnose variadic arguments

2016-10-28 Thread Anastasia Stulova via cfe-commits
Author: stulova
Date: Fri Oct 28 07:59:39 2016
New Revision: 285395

URL: http://llvm.org/viewvc/llvm-project?rev=285395&view=rev
Log:
[OpenCL] Diagnose variadic arguments

OpenCL disallows using variadic arguments (s6.9.e and s6.12.5 OpenCL v2.0)
apart from some exceptions:
- printf
- enqueue_kernel

This change adds error diagnostic for variadic functions but accepts printf
and any compiler internal function (which should cover __enqueue_kernel_XXX 
cases).

It also unifies diagnostic with block prototype and adds missing uncaught cases 
for blocks.


Added:
cfe/trunk/test/SemaOpenCL/func.cl
Removed:
cfe/trunk/test/SemaOpenCL/func_ptr.cl
Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/Headers/opencl-c.h
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Sema/SemaType.cpp
cfe/trunk/test/SemaOpenCL/builtin.cl
cfe/trunk/test/SemaOpenCL/invalid-block.cl

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=285395&r1=285394&r2=285395&view=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Fri Oct 28 07:59:39 
2016
@@ -8080,8 +8080,6 @@ def err_atomic_init_constant : Error<
   " in the declaration statement in the program scope">;
 def err_opencl_implicit_vector_conversion : Error<
   "implicit conversions between vector types (%0 and %1) are not permitted">;
-def err_opencl_block_proto_variadic : Error<
-  "invalid block prototype, variadic arguments are not allowed in OpenCL">;
 def err_opencl_invalid_type_array : Error<
   "array of %0 type is invalid in OpenCL">;
 def err_opencl_ternary_with_block : Error<
@@ -8093,6 +8091,8 @@ def err_opencl_type_can_only_be_used_as_
 def warn_opencl_attr_deprecated_ignored : Warning <
   "%0 attribute is deprecated and ignored in OpenCL version %1">,
   InGroup;
+def err_opencl_variadic_function : Error<
+  "invalid prototype, variadic arguments are not allowed in OpenCL">;
 
 // OpenCL v2.0 s6.13.6 -- Builtin Pipe Functions
 def err_opencl_builtin_pipe_first_arg : Error<

Modified: cfe/trunk/lib/Headers/opencl-c.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/opencl-c.h?rev=285395&r1=285394&r2=285395&view=diff
==
--- cfe/trunk/lib/Headers/opencl-c.h (original)
+++ cfe/trunk/lib/Headers/opencl-c.h Fri Oct 28 07:59:39 2016
@@ -15459,9 +15459,11 @@ half16 __ovld __cnfn shuffle2(half8 x, h
 half16 __ovld __cnfn shuffle2(half16 x, half16 y, ushort16 mask);
 #endif //cl_khr_fp16
 
+#if __OPENCL_C_VERSION__ >= CL_VERSION_1_2
 // OpenCL v1.2 s6.12.13, v2.0 s6.13.13 - printf
 
 int printf(__constant const char* st, ...);
+#endif
 
 // OpenCL v1.1 s6.11.3, v1.2 s6.12.14, v2.0 s6.13.14 - Image Read and Write 
Functions
 

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=285395&r1=285394&r2=285395&view=diff
==
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Fri Oct 28 07:59:39 2016
@@ -6888,17 +6888,6 @@ void Sema::CheckVariableDeclarationType(
 NewVD->setInvalidDecl();
 return;
   }
-  // OpenCL v2.0 s6.12.5 - Blocks with variadic arguments are not 
supported.
-  // TODO: this check is not enough as it doesn't diagnose the typedef
-  const BlockPointerType *BlkTy = T->getAs();
-  const FunctionProtoType *FTy =
-  BlkTy->getPointeeType()->getAs();
-  if (FTy && FTy->isVariadic()) {
-Diag(NewVD->getLocation(), diag::err_opencl_block_proto_variadic)
-<< T << NewVD->getSourceRange();
-NewVD->setInvalidDecl();
-return;
-  }
 }
 // OpenCL v1.2 s6.5 - All program scope variables must be declared in the
 // __constant address space.

Modified: cfe/trunk/lib/Sema/SemaType.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaType.cpp?rev=285395&r1=285394&r2=285395&view=diff
==
--- cfe/trunk/lib/Sema/SemaType.cpp (original)
+++ cfe/trunk/lib/Sema/SemaType.cpp Fri Oct 28 07:59:39 2016
@@ -4043,13 +4043,26 @@ static TypeSourceInfo *GetFullTypeForDec
 }
   }
 
+  if (LangOpts.OpenCL) {
 // OpenCL v2.0 s6.12.5 - A block cannot be the return value of a
 // function.
-  if (LangOpts.OpenCL && (T->isBlockPointerType() || T->isImageType() ||
-  T->isSamplerT() || T->isPipeType())) {
-S.Diag(D.getIdentifierLoc(), diag::err_opencl_invalid_return)
-<< T << 1 /*hint off*/;
-D.setInvalidType(true);
+if (T->isBlockPointerType() || 

[PATCH] D26071: [CodeCompletion] Show block invocation result for block property setters

2016-10-28 Thread Alex Lorenz via cfe-commits
arphaman created this revision.
arphaman added reviewers: manmanren, akyrtzi.
arphaman added a subscriber: cfe-commits.
arphaman set the repository for this revision to rL LLVM.

This patch changes the code completion results for block property setters. 
Right now we code complete block property setters with a property and a setter 
(for readwrite properties). So, for: `object.` clang displays:

  object.block
  object.block = 

But this patch makes the default block property result an invocation rather 
than a property, so now clang will display:

  object.block()
  object.block = 


Repository:
  rL LLVM

https://reviews.llvm.org/D26071

Files:
  lib/Sema/SemaCodeComplete.cpp
  test/Index/complete-block-properties.m
  test/Index/complete-block-property-assignment.m

Index: test/Index/complete-block-property-assignment.m
===
--- test/Index/complete-block-property-assignment.m
+++ test/Index/complete-block-property-assignment.m
@@ -35,11 +35,11 @@
 // RUN: c-index-test -code-completion-at=%s:29:9 %s | FileCheck -check-prefix=CHECK-CC1 %s
 // CHECK-CC1: ObjCPropertyDecl:{ResultType int}{TypedText foo} (35)
 // CHECK-CC1-NEXT: ObjCPropertyDecl:{ResultType Obj *}{TypedText obj} (35)
-// CHECK-CC1-NEXT: ObjCPropertyDecl:{ResultType void (^)(Obj *)}{TypedText onAction} (35)
+// CHECK-CC1-NEXT: ObjCPropertyDecl:{ResultType void}{TypedText onAction}{LeftParen (}{Placeholder Obj *object}{RightParen )} (35)
 // CHECK-CC1-NEXT: ObjCPropertyDecl:{ResultType void (^)(Obj *)}{TypedText onAction}{Equal  = }{Placeholder ^(Obj *object)} (38)
-// CHECK-CC1-NEXT: ObjCPropertyDecl:{ResultType FooBlock}{TypedText onEventHandler} (35)
+// CHECK-CC1-NEXT: ObjCPropertyDecl:{ResultType void}{TypedText onEventHandler}{LeftParen (}{Placeholder Foo *someParameter}{RightParen )} (35)
 // CHECK-CC1-NEXT: ObjCPropertyDecl:{ResultType FooBlock}{TypedText onEventHandler}{Equal  = }{Placeholder ^(Foo *someParameter)} (38)
-// CHECK-CC1-NEXT: ObjCPropertyDecl:{ResultType void (^)(int *)}{TypedText onReadonly} (35)
+// CHECK-CC1-NEXT: ObjCPropertyDecl:{ResultType void}{TypedText onReadonly}{LeftParen (}{Placeholder int *someParameter}{RightParen )} (35)
 
 - (void) takeInt:(int)x { }
 
Index: test/Index/complete-block-properties.m
===
--- /dev/null
+++ test/Index/complete-block-properties.m
@@ -0,0 +1,53 @@
+// Note: the run lines follow their respective tests, since line/column
+// matter in this test.
+
+// Block invocations should be presented when completing properties in
+// standalone statements.
+// rdar://28846196
+
+typedef int Foo;
+typedef void (^FooBlock)(Foo *someParameter);
+typedef int (^BarBlock)(int *);
+
+@interface Obj
+
+@property (readwrite, nonatomic, copy) void (^block)();
+@property (readonly, nonatomic, copy) int (^performA)();
+@property (readonly, nonatomic, copy) int (^performB)(int x, int y);
+@property (readwrite, nonatomic, copy) Foo (^blocker)(int x, Foo y, FooBlock foo);
+
+@end
+
+
+@interface Test : Obj
+
+@property (readonly, nonatomic, copy) FooBlock fooBlock;
+@property (readonly, nonatomic, copy) BarBlock barBlock;
+@property (readonly, nonatomic, copy) Test * (^getObject)(int index);
+@property (readwrite, nonatomic) int foo;
+
+@end
+
+@implementation Test
+
+- (void)test {
+  self.foo = 2;
+  int x = self.performA(); self.foo = 2;
+  self.getObject(0).foo = 2;
+}
+
+// RUN: c-index-test -code-completion-at=%s:34:8 %s | FileCheck -check-prefix=CHECK-CC1 %s
+// RUN: c-index-test -code-completion-at=%s:35:33 %s | FileCheck -check-prefix=CHECK-CC1 %s
+// RUN: c-index-test -code-completion-at=%s:36:21 %s | FileCheck -check-prefix=CHECK-CC1 %s
+//CHECK-CC1: ObjCPropertyDecl:{ResultType int}{TypedText barBlock}{LeftParen (}{Placeholder int *}{RightParen )} (35)
+//CHECK-CC1-NEXT: ObjCPropertyDecl:{ResultType void}{TypedText block}{LeftParen (}{RightParen )} (35)
+//CHECK-CC1-NEXT: ObjCPropertyDecl:{ResultType void (^)()}{TypedText block}{Equal  = }{Placeholder ^(void)} (38)
+//CHECK-CC1-NEXT: ObjCPropertyDecl:{ResultType Foo}{TypedText blocker}{LeftParen (}{Placeholder int x}{Comma , }{Placeholder Foo y}{Comma , }{Placeholder ^(Foo *someParameter)foo}{RightParen )} (35)
+//CHECK-CC1-NEXT: ObjCPropertyDecl:{ResultType Foo (^)(int, Foo, FooBlock)}{TypedText blocker}{Equal  = }{Placeholder ^Foo(int x, Foo y, FooBlock foo)} (38)
+//CHECK-CC1-NEXT: ObjCPropertyDecl:{ResultType int}{TypedText foo} (35)
+//CHECK-CC1-NEXT: ObjCPropertyDecl:{ResultType void}{TypedText fooBlock}{LeftParen (}{Placeholder Foo *someParameter}{RightParen )} (35)
+//CHECK-CC1-NEXT: ObjCPropertyDecl:{ResultType Test *}{TypedText getObject}{LeftParen (}{Placeholder int index}{RightParen )} (35)
+//CHECK-CC1-NEXT: ObjCPropertyDecl:{ResultType int}{TypedText performA}{LeftParen (}{RightParen )} (35)
+//CHECK-CC1-NEXT: ObjCPropertyDecl:{ResultType int}{TypedText performB}{LeftParen (}{Placeholder int x}{Comma , }{Pla

[PATCH] D25008: [cmake] Split linked libraries into private & public, for linker script

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

In https://reviews.llvm.org/D25008#581889, @Hahnfeld wrote:

> What are the possibilities to proceed here?


To be honest, I don't have any good idea besides renaming the library. Keeping 
two non-interchangeable libraries under the same name is bound to fail.


Repository:
  rL LLVM

https://reviews.llvm.org/D25008



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


[PATCH] D25008: [cmake] Split linked libraries into private & public, for linker script

2016-10-28 Thread Jonas Hahnfeld via cfe-commits
Hahnfeld added a comment.

What are the possibilities to proceed here?


Repository:
  rL LLVM

https://reviews.llvm.org/D25008



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


[libcxx] r285392 - Fix test when using an installed libc++

2016-10-28 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Fri Oct 28 06:01:12 2016
New Revision: 285392

URL: http://llvm.org/viewvc/llvm-project?rev=285392&view=rev
Log:
Fix test when using an installed libc++

Modified:
libcxx/trunk/test/libcxx/test/config.py
libcxx/trunk/test/libcxx/version.pass.cpp

Modified: libcxx/trunk/test/libcxx/test/config.py
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/test/config.py?rev=285392&r1=285391&r2=285392&view=diff
==
--- libcxx/trunk/test/libcxx/test/config.py (original)
+++ libcxx/trunk/test/libcxx/test/config.py Fri Oct 28 06:01:12 2016
@@ -290,6 +290,7 @@ class Configuration(object):
 # XFAIL markers for tests that are known to fail with versions of
 # libc++ as were shipped with a particular triple.
 if self.use_system_cxx_lib:
+self.config.available_features.add('with_system_cxx_lib')
 self.config.available_features.add(
 'with_system_cxx_lib=%s' % self.config.target_triple)
 

Modified: libcxx/trunk/test/libcxx/version.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/version.pass.cpp?rev=285392&r1=285391&r2=285392&view=diff
==
--- libcxx/trunk/test/libcxx/version.pass.cpp (original)
+++ libcxx/trunk/test/libcxx/version.pass.cpp Fri Oct 28 06:01:12 2016
@@ -8,6 +8,8 @@
 //
 
//===--===//
 
+// UNSUPPORTED: with_system_cxx_lib
+
 // Test the _LIBCPP_VERSION and _LIBCPP_LIBRARY_VERSION macros
 
 #include <__config>


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


Re: [libcxx] r285382 - Add __libcpp_version file and __libcpp_library_version function.

2016-10-28 Thread Eric Fiselier via cfe-commits
It appears you're testing fresh headers against a system installed libc++
library. Can you confirm this was your intention?

Either way I'll correct the test to handle this.

/Eric


On Fri, Oct 28, 2016 at 3:22 AM, Ismail Donmez  wrote:

> Hi,
>
> On Fri, Oct 28, 2016 at 9:06 AM, Eric Fiselier via cfe-commits
>  wrote:
> > Author: ericwf
> > Date: Fri Oct 28 01:06:50 2016
> > New Revision: 285382
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=285382&view=rev
> > Log:
> > Add __libcpp_version file and __libcpp_library_version function.
> >
> > This patch does two seperate things. First it adds a file called
> > "__libcpp_version" which only contains the current libc++ version
> > (currently 4000). This file is not intended for use as a header. This
> file
> > is used by Clang in order to easily determine the installed libc++
> version.
> > This allows Clang to enable/disable certain language features only when
> the
> > library supports them.
> >
> > The second change is the addition of _LIBCPP_LIBRARY_VERSION macro, which
> > returns the version of the installed dylib since it may be different than
> > the headers.
>
> The test seems to be failing here:
>
> [ 7087s]  TEST 'libc++ :: libcxx/version.pass.cpp'
> FAILED 
> [ 7087s] Compiled With:
> ['/home/abuild/rpmbuild/BUILD/llvm/stage1/bin/clang++', '-o',
> '/home/abuild/rpmbuild/BUILD/llvm/stage2/projects/libcxx/
> test/libcxx/Output/version.pass.cpp.o',
> '-x', 'c++', '/home/abuild/rpmbuild/BUILD/llvm/projects/libcxx/test/
> libcxx/version.pass.cpp',
> '-c', '-v', '-Werror=thread-safety', '-std=c++1z', '-include',
> '/home/abuild/rpmbuild/BUILD/llvm/projects/libcxx/test/
> support/nasty_macros.hpp',
> '-nostdinc++', '-I/home/abuild/rpmbuild/BUILD/llvm/projects/libcxx/
> include',
> '-D__STDC_FORMAT_MACROS', '-D__STDC_LIMIT_MACROS',
> '-D__STDC_CONSTANT_MACROS',
> '-I/home/abuild/rpmbuild/BUILD/llvm/projects/libcxx/test/support',
> '-DLIBCXX_FILESYSTEM_STATIC_TEST_ROOT="/home/abuild/
> rpmbuild/BUILD/llvm/projects/libcxx/test/std/experimental/
> filesystem/Inputs/static_test_env"',
> '-DLIBCXX_FILESYSTEM_DYNAMIC_TEST_ROOT="/home/abuild/
> rpmbuild/BUILD/llvm/stage2/projects/libcxx/test/
> filesystem/Output/dynamic_env"',
> '-DLIBCXX_FILESYSTEM_DYNAMIC_TEST_HELPER="/usr/bin/python2.7
> /home/abuild/rpmbuild/BUILD/llvm/projects/libcxx/test/
> support/filesystem_dynamic_test_helper.py"',
> '-c', '&&', '/home/abuild/rpmbuild/BUILD/llvm/stage1/bin/clang++',
> '-o', '/home/abuild/rpmbuild/BUILD/llvm/stage2/projects/libcxx/
> test/libcxx/Output/version.pass.cpp.exe',
> '/home/abuild/rpmbuild/BUILD/llvm/stage2/projects/libcxx/
> test/libcxx/Output/version.pass.cpp.o',
> '-v', '-L/home/abuild/rpmbuild/BUILD/llvm/stage2/lib64',
> '-Wl,-rpath,/home/abuild/rpmbuild/BUILD/llvm/stage2/lib64',
> '-nodefaultlibs', '-lc++experimental', '-lc++', '-lm', '-lgcc_s',
> '-lgcc', '-lpthread', '-lc', '-lgcc_s', '-lgcc']
> [ 7087s] Command: ['env',
> 'LIBCXX_FILESYSTEM_DYNAMIC_TEST_ROOT=/home/abuild/
> rpmbuild/BUILD/llvm/stage2/projects/libcxx/test/
> filesystem/Output/dynamic_env',
> '/home/abuild/rpmbuild/BUILD/llvm/stage2/projects/libcxx/
> test/libcxx/Output/version.pass.cpp.exe']
> [ 7087s] Exit Code: -6
> [ 7087s] Standard Error:
> [ 7087s] --
> [ 7087s] version.pass.cpp.exe:
> /home/abuild/rpmbuild/BUILD/llvm/projects/libcxx/test/
> libcxx/version.pass.cpp:26:
> int main(): Assertion `_LIBCPP_VERSION == _LIBCPP_LIBRARY_VERSION'
> failed.
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D9888: [OPENMP] Driver support for OpenMP offloading

2016-10-28 Thread Samuel Antao via cfe-commits
sfantao abandoned this revision.
sfantao marked 8 inline comments as done.
sfantao added a comment.

Hi Jonas,

In https://reviews.llvm.org/D9888#581809, @Hahnfeld wrote:

> I think these changes have been contributed to trunk in multiple commits so 
> this can be closed?


You're right, this can be closed now.

Thanks!
Samuel


https://reviews.llvm.org/D9888



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


[PATCH] D13419: Fix several problems at the intersection of template instantiations and visibility

2016-10-28 Thread Alex Lorenz via cfe-commits
arphaman added a comment.

In https://reviews.llvm.org/D13419#581356, @loladiro wrote:

> Hmm, the rebased version of this introduces new errors in 
> `test/Modules/cxx-templates.cpp`. That test didn't exist when I wrote this 
> code and I'm not familiar with templates. @rsmith could you take a look, 
> error is:
>
>   error: 'error' diagnostics seen but not expected:
> File /data/keno/llvm/tools/clang/test/Modules/cxx-templates.cpp Line 202: 
> definition of 'nested_cls_t' must be imported from module 
> 'cxx_templates_common.unimported' before it is required
> File /data/keno/llvm/tools/clang/test/Modules/cxx-templates.cpp Line 202: 
> definition of 'nested_cls_t' must be imported from module 
> 'cxx_templates_common.unimported' before it is required
>


FWIW, I also found this issue while working on my patch and decided to add 
`expected-error 1+{{definition of}}` verified check to that line ( 
https://reviews.llvm.org/differential/changeset/?ref=558280&whitespace=ignore-most).
 It seems that the preceding lines have this check as well, so I assumed that 
this diagnostic was expected and my patch fixed a bug that prevented this 
diagnostic from showing up.


Repository:
  rL LLVM

https://reviews.llvm.org/D13419



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


RE: [PATCH] D25343: [OpenCL] Mark group functions as convergent in opencl-c.h

2016-10-28 Thread Anastasia Stulova via cfe-commits
Hi Ettore,

Thanks for the example. Up to now we used noduplicate to prevent this erroneous 
optimisation but using convergent instead would be equally good. And as it's 
pointed out it is less restrictive to allow more optimisations in LLVM i.e. 
loop unrolling with convergent operation in it.

I think we have a good motivation now for adding the convergent attribute 
explicitly. I am just trying to think whether we need to keep noduplicate at 
all, but I am guessing this is something we can decide later as well.

Cheers,
Anastasia

-Original Message-
From: Ettore Speziale [mailto:speziale.ett...@gmail.com] 
Sent: 25 October 2016 23:12
To: Anastasia Stulova
Cc: Ettore Speziale; Liu, Yaxun (Sam); 
reviews+d25343+public+a10e9553b0fc8...@reviews.llvm.org; 
alexey.ba...@intel.com; aaron.ball...@gmail.com; Clang Commits; Sumner, Brian; 
Stellard, Thomas; Arsenault, Matthew; nd
Subject: Re: [PATCH] D25343: [OpenCL] Mark group functions as convergent in 
opencl-c.h

Hello,

> As far as I understand the whole problem is that the optimized functions are 
> marked by __attribute__((pure)). If the attribute is removed from your 
> example, we get LLVM dump preserving correctness:
> 
> define i32 @bar(i32 %x) local_unnamed_addr #0 {
> entry:
>  %call = tail call i32 @foo() #2
>  %tobool = icmp eq i32 %x, 0
>  %.call = select i1 %tobool, i32 0, i32 %call  ret i32 %.call }

I’ve used __attribute__((pure)) only to force LLVM applying the transformation 
and show you an example of incorrect behavior.

This is another example:

void foo();
int baz();

int bar(int x) {
  int y;
  if (x) 
y = baz();
  foo();
  if (x) 
y = baz();
  return y;
} 

Which gets lowered into:

define i32 @bar(i32) #0 {
  %2 = icmp eq i32 %0, 0
  br i1 %2, label %3, label %4

; :3   ; preds = %1
  tail call void (...) @foo() #2
  br label %7

; :4   ; preds = %1
  %5 = tail call i32 (...) @baz() #2
  tail call void (...) @foo() #2
  %6 = tail call i32 (...) @baz() #2
  br label %7

; :7   ; preds = %3, %4
  %8 = phi i32 [ %6, %4 ], [ undef, %3 ]
  ret i32 %8
}

As you can see the call sites of foo in the optimized IR are not 
control-equivalent to the only call site of foo in the unoptimized IR. Now 
imaging foo is implemented in another module and contains a call to a 
convergent function — e.f. barrier(). You are going to generate incorrect code.

Bye

--
Ettore Speziale — Compiler Engineer
speziale.ett...@gmail.com
espezi...@apple.com
--

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


[PATCH] D13419: Fix several problems at the intersection of template instantiations and visibility

2016-10-28 Thread Alex Lorenz via cfe-commits
arphaman added a comment.

I just noticed that this patch fixes a template crash that I have a patch for 
at https://reviews.llvm.org/D25942. I will abandon my patch since this patch 
fixes the other issue. Would you mind adding the test case from my patch to 
this patch? It's available at 
https://reviews.llvm.org/differential/changeset/?ref=558279&whitespace=ignore-most
 .


Repository:
  rL LLVM

https://reviews.llvm.org/D13419



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


[PATCH] D25942: Fix crash in implicit default constructor creation for a template record specialization that has a field declaration with an initializer expression

2016-10-28 Thread Alex Lorenz via cfe-commits
arphaman abandoned this revision.
arphaman added a comment.

Abandoning since I discovered that another patch 
(https://reviews.llvm.org/D13419) that's currently in review fixes this issue.


Repository:
  rL LLVM

https://reviews.llvm.org/D25942



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


[PATCH] D25993: [Objective-C] Add objc_subclassing_restricted attribute

2016-10-28 Thread Alex Lorenz via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL285391: [Objective-C] Add objc_subclassing_restricted 
attribute (authored by arphaman).

Changed prior to commit:
  https://reviews.llvm.org/D25993?vs=76019&id=76175#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D25993

Files:
  cfe/trunk/include/clang/Basic/Attr.td
  cfe/trunk/include/clang/Basic/AttrDocs.td
  cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
  cfe/trunk/lib/Sema/SemaDeclAttr.cpp
  cfe/trunk/lib/Sema/SemaDeclObjC.cpp
  cfe/trunk/test/SemaObjC/subclassing-restricted-attr.m

Index: cfe/trunk/lib/Sema/SemaDeclObjC.cpp
===
--- cfe/trunk/lib/Sema/SemaDeclObjC.cpp
+++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp
@@ -3853,6 +3853,18 @@
 Diag(IDecl->getLocation(), diag::err_objc_root_class_subclass);
   }
 
+  if (const ObjCInterfaceDecl *Super = IDecl->getSuperClass()) {
+// An interface can subclass another interface with a
+// objc_subclassing_restricted attribute when it has that attribute as
+// well (because of interfaces imported from Swift). Therefore we have
+// to check if we can subclass in the implementation as well.
+if (IDecl->hasAttr() &&
+Super->hasAttr()) {
+  Diag(IC->getLocation(), diag::err_restricted_superclass_mismatch);
+  Diag(Super->getLocation(), diag::note_class_declared);
+}
+  }
+
   if (LangOpts.ObjCRuntime.isNonFragile()) {
 while (IDecl->getSuperClass()) {
   DiagnoseDuplicateIvars(IDecl, IDecl->getSuperClass());
@@ -3873,6 +3885,14 @@
 ImplMethodsVsClassMethods(S, CatImplClass, Cat);
   }
 }
+  } else if (const auto *IntfDecl = dyn_cast(ClassDecl)) {
+if (const ObjCInterfaceDecl *Super = IntfDecl->getSuperClass()) {
+  if (!IntfDecl->hasAttr() &&
+  Super->hasAttr()) {
+Diag(IntfDecl->getLocation(), diag::err_restricted_superclass_mismatch);
+Diag(Super->getLocation(), diag::note_class_declared);
+  }
+}
   }
   if (isInterfaceDeclKind) {
 // Reject invalid vardecls.
Index: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
===
--- cfe/trunk/lib/Sema/SemaDeclAttr.cpp
+++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp
@@ -5776,6 +5776,9 @@
   case AttributeList::AT_ObjCRootClass:
 handleSimpleAttribute(S, D, Attr);
 break;
+  case AttributeList::AT_ObjCSubclassingRestricted:
+handleSimpleAttribute(S, D, Attr);
+break;
   case AttributeList::AT_ObjCExplicitProtocolImpl:
 handleObjCSuppresProtocolAttr(S, D, Attr);
 break;
Index: cfe/trunk/include/clang/Basic/AttrDocs.td
===
--- cfe/trunk/include/clang/Basic/AttrDocs.td
+++ cfe/trunk/include/clang/Basic/AttrDocs.td
@@ -2667,3 +2667,11 @@
 Transparent unions are not supported in C++.
   }];
 }
+
+def ObjCSubclassingRestrictedDocs : Documentation {
+  let Category = DocCatType;
+  let Content = [{
+This attribute can be added to an Objective-C ``@interface`` declaration to
+ensure that this class cannot be subclassed.
+  }];
+}
Index: cfe/trunk/include/clang/Basic/Attr.td
===
--- cfe/trunk/include/clang/Basic/Attr.td
+++ cfe/trunk/include/clang/Basic/Attr.td
@@ -1285,6 +1285,12 @@
   let Documentation = [Undocumented];
 }
 
+def ObjCSubclassingRestricted : InheritableAttr {
+  let Spellings = [GNU<"objc_subclassing_restricted">];
+  let Subjects = SubjectList<[ObjCInterface], ErrorDiag>;
+  let Documentation = [ObjCSubclassingRestrictedDocs];
+}
+
 def ObjCExplicitProtocolImpl : InheritableAttr {
   let Spellings = [GNU<"objc_protocol_requires_explicit_implementation">];
   let Subjects = SubjectList<[ObjCProtocol], ErrorDiag>;
Index: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
===
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
@@ -781,6 +781,9 @@
   "class with specified objc_requires_property_definitions attribute is declared here">;
 def err_objc_root_class_subclass : Error<
   "objc_root_class attribute may only be specified on a root class declaration">;
+def err_restricted_superclass_mismatch : Error<
+  "cannot subclass a class that was declared with the "
+  "'objc_subclassing_restricted' attribute">;
 def warn_objc_root_class_missing : Warning<
   "class %0 defined without specifying a base class">,
   InGroup;
Index: cfe/trunk/test/SemaObjC/subclassing-restricted-attr.m
===
--- cfe/trunk/test/SemaObjC/subclassing-restricted-attr.m
+++ cfe/trunk/test/SemaObjC/subclassing-restricted-attr.m
@@ -0,0 +1,36 @@
+// RUN: %clang_cc1  -fsyntax-only -verify -Wno-objc-root-class %s
+// RUN: %clang_cc1 -x ob

r285391 - [Objective-C] Add objc_subclassing_restricted attribute

2016-10-28 Thread Alex Lorenz via cfe-commits
Author: arphaman
Date: Fri Oct 28 05:25:10 2016
New Revision: 285391

URL: http://llvm.org/viewvc/llvm-project?rev=285391&view=rev
Log:
[Objective-C] Add objc_subclassing_restricted attribute

This patch adds an objc_subclassing_restricted attribute into clang. This
attribute acts similarly to 'final' - Objective-C classes with this attribute
can't be subclassed. However, @interface declarations that have
objc_subclassing_restricted but don't have @implementation are allowed to
inherit other @interface declarations with objc_subclassing_restricted. This is
needed to describe the Swift class hierarchy in clang while making sure that
the Objective-C classes cannot subclass the Swift classes.

This attribute is already implemented in a fork of clang that's used for Swift
(https://github.com/apple/swift-clang) and this patch moves that code to the
upstream clang repository.

rdar://28937548

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

Added:
cfe/trunk/test/SemaObjC/subclassing-restricted-attr.m
Modified:
cfe/trunk/include/clang/Basic/Attr.td
cfe/trunk/include/clang/Basic/AttrDocs.td
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/Sema/SemaDeclAttr.cpp
cfe/trunk/lib/Sema/SemaDeclObjC.cpp

Modified: cfe/trunk/include/clang/Basic/Attr.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Attr.td?rev=285391&r1=285390&r2=285391&view=diff
==
--- cfe/trunk/include/clang/Basic/Attr.td (original)
+++ cfe/trunk/include/clang/Basic/Attr.td Fri Oct 28 05:25:10 2016
@@ -1285,6 +1285,12 @@ def ObjCRootClass : InheritableAttr {
   let Documentation = [Undocumented];
 }
 
+def ObjCSubclassingRestricted : InheritableAttr {
+  let Spellings = [GNU<"objc_subclassing_restricted">];
+  let Subjects = SubjectList<[ObjCInterface], ErrorDiag>;
+  let Documentation = [ObjCSubclassingRestrictedDocs];
+}
+
 def ObjCExplicitProtocolImpl : InheritableAttr {
   let Spellings = [GNU<"objc_protocol_requires_explicit_implementation">];
   let Subjects = SubjectList<[ObjCProtocol], ErrorDiag>;

Modified: cfe/trunk/include/clang/Basic/AttrDocs.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/AttrDocs.td?rev=285391&r1=285390&r2=285391&view=diff
==
--- cfe/trunk/include/clang/Basic/AttrDocs.td (original)
+++ cfe/trunk/include/clang/Basic/AttrDocs.td Fri Oct 28 05:25:10 2016
@@ -2667,3 +2667,11 @@ transparent union should have the same c
 Transparent unions are not supported in C++.
   }];
 }
+
+def ObjCSubclassingRestrictedDocs : Documentation {
+  let Category = DocCatType;
+  let Content = [{
+This attribute can be added to an Objective-C ``@interface`` declaration to
+ensure that this class cannot be subclassed.
+  }];
+}

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=285391&r1=285390&r2=285391&view=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Fri Oct 28 05:25:10 
2016
@@ -781,6 +781,9 @@ def note_suppressed_class_declare : Note
   "class with specified objc_requires_property_definitions attribute is 
declared here">;
 def err_objc_root_class_subclass : Error<
   "objc_root_class attribute may only be specified on a root class 
declaration">;
+def err_restricted_superclass_mismatch : Error<
+  "cannot subclass a class that was declared with the "
+  "'objc_subclassing_restricted' attribute">;
 def warn_objc_root_class_missing : Warning<
   "class %0 defined without specifying a base class">,
   InGroup;

Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=285391&r1=285390&r2=285391&view=diff
==
--- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Fri Oct 28 05:25:10 2016
@@ -5776,6 +5776,9 @@ static void ProcessDeclAttribute(Sema &S
   case AttributeList::AT_ObjCRootClass:
 handleSimpleAttribute(S, D, Attr);
 break;
+  case AttributeList::AT_ObjCSubclassingRestricted:
+handleSimpleAttribute(S, D, Attr);
+break;
   case AttributeList::AT_ObjCExplicitProtocolImpl:
 handleObjCSuppresProtocolAttr(S, D, Attr);
 break;

Modified: cfe/trunk/lib/Sema/SemaDeclObjC.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclObjC.cpp?rev=285391&r1=285390&r2=285391&view=diff
==
--- cfe/trunk/lib/Sema/SemaDeclObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp Fri Oct 28 05:25:10 2016
@@ -3853,6 +3853,18 @@ Decl *Sema::ActOnAtE

r285390 - Fix MSVC "not all control paths return a value" warning

2016-10-28 Thread Simon Pilgrim via cfe-commits
Author: rksimon
Date: Fri Oct 28 05:09:35 2016
New Revision: 285390

URL: http://llvm.org/viewvc/llvm-project?rev=285390&view=rev
Log:
Fix MSVC "not all control paths return a value" warning

Add unreachable after enum switch statement

Modified:
cfe/trunk/lib/Driver/Action.cpp

Modified: cfe/trunk/lib/Driver/Action.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Action.cpp?rev=285390&r1=285389&r2=285390&view=diff
==
--- cfe/trunk/lib/Driver/Action.cpp (original)
+++ cfe/trunk/lib/Driver/Action.cpp Fri Oct 28 05:09:35 2016
@@ -146,6 +146,8 @@ llvm::StringRef Action::GetOffloadKindNa
 
 // TODO: Add other programming models here.
   }
+
+  llvm_unreachable("invalid offload kind");
 }
 
 void InputAction::anchor() {}


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


r285388 - [openmp] Remove test assumption that canonical binary name contains "clang"

2016-10-28 Thread Benjamin Kramer via cfe-commits
Author: d0k
Date: Fri Oct 28 04:20:02 2016
New Revision: 285388

URL: http://llvm.org/viewvc/llvm-project?rev=285388&view=rev
Log:
[openmp] Remove test assumption that canonical binary name contains "clang"

Patch by Sam McCall!

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

Modified:
cfe/trunk/test/Driver/openmp-offload.c

Modified: cfe/trunk/test/Driver/openmp-offload.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/openmp-offload.c?rev=285388&r1=285387&r2=285388&view=diff
==
--- cfe/trunk/test/Driver/openmp-offload.c (original)
+++ cfe/trunk/test/Driver/openmp-offload.c Fri Oct 28 04:20:02 2016
@@ -184,15 +184,15 @@
 /// We use -fopenmp-dump-offload-linker-script to dump the linker script and
 /// check its contents.
 ///
-// RUN:   %clang -### -fopenmp=libomp -o %t.out -target powerpc64le-linux 
-fopenmp-targets=powerpc64le-ibm-linux-gnu,x86_64-pc-linux-gnu %s 
-fopenmp-dump-offload-linker-script 2>&1 \
+// RUN:   %clang -### -fopenmp=libomp -o %t.out -target powerpc64le-linux 
-fopenmp-targets=powerpc64le-ibm-linux-gnu,x86_64-pc-linux-gnu %s 
-fopenmp-dump-offload-linker-script -no-canonical-prefixes 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHK-COMMANDS -check-prefix=CHK-LKS 
-check-prefix=CHK-LKS-REG %s
-// RUN:   %clang -### -fopenmp=libomp -o %t.out -target powerpc64le-linux 
-fopenmp-targets=powerpc64le-ibm-linux-gnu,x86_64-pc-linux-gnu %s -save-temps 
-fopenmp-dump-offload-linker-script 2>&1 \
+// RUN:   %clang -### -fopenmp=libomp -o %t.out -target powerpc64le-linux 
-fopenmp-targets=powerpc64le-ibm-linux-gnu,x86_64-pc-linux-gnu %s -save-temps 
-fopenmp-dump-offload-linker-script -no-canonical-prefixes 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHK-COMMANDS-ST -check-prefix=CHK-LKS 
-check-prefix=CHK-LKS-ST %s
 
 // Make sure we are not dumping the script unless the user requested it.
-// RUN:   %clang -### -fopenmp=libomp -o %t.out -target powerpc64le-linux 
-fopenmp-targets=powerpc64le-ibm-linux-gnu,x86_64-pc-linux-gnu %s 2>&1 \
+// RUN:   %clang -### -fopenmp=libomp -o %t.out -target powerpc64le-linux 
-fopenmp-targets=powerpc64le-ibm-linux-gnu,x86_64-pc-linux-gnu %s 
-no-canonical-prefixes 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHK-LKS-NODUMP %s
-// RUN:   %clang -### -fopenmp=libomp -o %t.out -target powerpc64le-linux 
-fopenmp-targets=powerpc64le-ibm-linux-gnu,x86_64-pc-linux-gnu %s -save-temps 
2>&1 \
+// RUN:   %clang -### -fopenmp=libomp -o %t.out -target powerpc64le-linux 
-fopenmp-targets=powerpc64le-ibm-linux-gnu,x86_64-pc-linux-gnu %s -save-temps 
-no-canonical-prefixes 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHK-LKS-NODUMP %s
 
 //
@@ -275,7 +275,7 @@
 /// ###
 
 /// Check separate compilation with offloading - bundling actions
-// RUN:   %clang -### -ccc-print-phases -fopenmp=libomp -c -o %t.o -lsomelib 
-target powerpc64le-linux 
-fopenmp-targets=powerpc64le-ibm-linux-gnu,x86_64-pc-linux-gnu %s 2>&1 \
+// RUN:   %clang -### -ccc-print-phases -fopenmp=libomp -c -o %t.o -lsomelib 
-target powerpc64le-linux 
-fopenmp-targets=powerpc64le-ibm-linux-gnu,x86_64-pc-linux-gnu %s 
-no-canonical-prefixes 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHK-BUACTIONS %s
 
 // CHK-BUACTIONS: 0: input, "[[INPUT:.+\.c]]", c, (host-openmp)
@@ -303,7 +303,7 @@
 
 /// Check separate compilation with offloading - unbundling actions
 // RUN:   touch %t.i
-// RUN:   %clang -### -ccc-print-phases -fopenmp=libomp -o %t.out -lsomelib 
-target powerpc64le-linux 
-fopenmp-targets=powerpc64le-ibm-linux-gnu,x86_64-pc-linux-gnu %t.i 2>&1 \
+// RUN:   %clang -### -ccc-print-phases -fopenmp=libomp -o %t.out -lsomelib 
-target powerpc64le-linux 
-fopenmp-targets=powerpc64le-ibm-linux-gnu,x86_64-pc-linux-gnu %t.i 
-no-canonical-prefixes 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHK-UBACTIONS %s
 
 // CHK-UBACTIONS: 0: input, "somelib", object, (host-openmp)
@@ -331,7 +331,7 @@
 
 /// Check separate compilation with offloading - unbundling/bundling actions
 // RUN:   touch %t.i
-// RUN:   %clang -### -ccc-print-phases -fopenmp=libomp -c -o %t.o -lsomelib 
-target powerpc64le-linux 
-fopenmp-targets=powerpc64le-ibm-linux-gnu,x86_64-pc-linux-gnu %t.i 2>&1 \
+// RUN:   %clang -### -ccc-print-phases -fopenmp=libomp -c -o %t.o -lsomelib 
-target powerpc64le-linux 
-fopenmp-targets=powerpc64le-ibm-linux-gnu,x86_64-pc-linux-gnu %t.i 
-no-canonical-prefixes 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHK-UBUACTIONS %s
 
 // CHK-UBUACTIONS: 0: input, "[[INPUT:.+\.i]]", cpp-output, (host-openmp)
@@ -354,9 +354,9 @@
 /// ###
 
 /// Check separate compilation with offloading - bundling jobs construct
-// RUN:   %clang -### -fopenmp=libomp -c -o %t.o -lsomelib -target 
powerpc64le-linux 
-fopenmp-targets=powerpc64le-ibm-linux-gnu,x86_64-pc-linux-gnu %s 2>&1 \
+// RUN:  

[PATCH] D26067: [openmp] Remove test assumption that canonical binary name contains "clang"

2016-10-28 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL285388: [openmp] Remove test assumption that canonical 
binary name contains "clang" (authored by d0k).

Changed prior to commit:
  https://reviews.llvm.org/D26067?vs=76172&id=76174#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D26067

Files:
  cfe/trunk/test/Driver/openmp-offload.c


Index: cfe/trunk/test/Driver/openmp-offload.c
===
--- cfe/trunk/test/Driver/openmp-offload.c
+++ cfe/trunk/test/Driver/openmp-offload.c
@@ -184,15 +184,15 @@
 /// We use -fopenmp-dump-offload-linker-script to dump the linker script and
 /// check its contents.
 ///
-// RUN:   %clang -### -fopenmp=libomp -o %t.out -target powerpc64le-linux 
-fopenmp-targets=powerpc64le-ibm-linux-gnu,x86_64-pc-linux-gnu %s 
-fopenmp-dump-offload-linker-script 2>&1 \
+// RUN:   %clang -### -fopenmp=libomp -o %t.out -target powerpc64le-linux 
-fopenmp-targets=powerpc64le-ibm-linux-gnu,x86_64-pc-linux-gnu %s 
-fopenmp-dump-offload-linker-script -no-canonical-prefixes 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHK-COMMANDS -check-prefix=CHK-LKS 
-check-prefix=CHK-LKS-REG %s
-// RUN:   %clang -### -fopenmp=libomp -o %t.out -target powerpc64le-linux 
-fopenmp-targets=powerpc64le-ibm-linux-gnu,x86_64-pc-linux-gnu %s -save-temps 
-fopenmp-dump-offload-linker-script 2>&1 \
+// RUN:   %clang -### -fopenmp=libomp -o %t.out -target powerpc64le-linux 
-fopenmp-targets=powerpc64le-ibm-linux-gnu,x86_64-pc-linux-gnu %s -save-temps 
-fopenmp-dump-offload-linker-script -no-canonical-prefixes 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHK-COMMANDS-ST -check-prefix=CHK-LKS 
-check-prefix=CHK-LKS-ST %s
 
 // Make sure we are not dumping the script unless the user requested it.
-// RUN:   %clang -### -fopenmp=libomp -o %t.out -target powerpc64le-linux 
-fopenmp-targets=powerpc64le-ibm-linux-gnu,x86_64-pc-linux-gnu %s 2>&1 \
+// RUN:   %clang -### -fopenmp=libomp -o %t.out -target powerpc64le-linux 
-fopenmp-targets=powerpc64le-ibm-linux-gnu,x86_64-pc-linux-gnu %s 
-no-canonical-prefixes 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHK-LKS-NODUMP %s
-// RUN:   %clang -### -fopenmp=libomp -o %t.out -target powerpc64le-linux 
-fopenmp-targets=powerpc64le-ibm-linux-gnu,x86_64-pc-linux-gnu %s -save-temps 
2>&1 \
+// RUN:   %clang -### -fopenmp=libomp -o %t.out -target powerpc64le-linux 
-fopenmp-targets=powerpc64le-ibm-linux-gnu,x86_64-pc-linux-gnu %s -save-temps 
-no-canonical-prefixes 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHK-LKS-NODUMP %s
 
 //
@@ -275,7 +275,7 @@
 /// ###
 
 /// Check separate compilation with offloading - bundling actions
-// RUN:   %clang -### -ccc-print-phases -fopenmp=libomp -c -o %t.o -lsomelib 
-target powerpc64le-linux 
-fopenmp-targets=powerpc64le-ibm-linux-gnu,x86_64-pc-linux-gnu %s 2>&1 \
+// RUN:   %clang -### -ccc-print-phases -fopenmp=libomp -c -o %t.o -lsomelib 
-target powerpc64le-linux 
-fopenmp-targets=powerpc64le-ibm-linux-gnu,x86_64-pc-linux-gnu %s 
-no-canonical-prefixes 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHK-BUACTIONS %s
 
 // CHK-BUACTIONS: 0: input, "[[INPUT:.+\.c]]", c, (host-openmp)
@@ -303,7 +303,7 @@
 
 /// Check separate compilation with offloading - unbundling actions
 // RUN:   touch %t.i
-// RUN:   %clang -### -ccc-print-phases -fopenmp=libomp -o %t.out -lsomelib 
-target powerpc64le-linux 
-fopenmp-targets=powerpc64le-ibm-linux-gnu,x86_64-pc-linux-gnu %t.i 2>&1 \
+// RUN:   %clang -### -ccc-print-phases -fopenmp=libomp -o %t.out -lsomelib 
-target powerpc64le-linux 
-fopenmp-targets=powerpc64le-ibm-linux-gnu,x86_64-pc-linux-gnu %t.i 
-no-canonical-prefixes 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHK-UBACTIONS %s
 
 // CHK-UBACTIONS: 0: input, "somelib", object, (host-openmp)
@@ -331,7 +331,7 @@
 
 /// Check separate compilation with offloading - unbundling/bundling actions
 // RUN:   touch %t.i
-// RUN:   %clang -### -ccc-print-phases -fopenmp=libomp -c -o %t.o -lsomelib 
-target powerpc64le-linux 
-fopenmp-targets=powerpc64le-ibm-linux-gnu,x86_64-pc-linux-gnu %t.i 2>&1 \
+// RUN:   %clang -### -ccc-print-phases -fopenmp=libomp -c -o %t.o -lsomelib 
-target powerpc64le-linux 
-fopenmp-targets=powerpc64le-ibm-linux-gnu,x86_64-pc-linux-gnu %t.i 
-no-canonical-prefixes 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHK-UBUACTIONS %s
 
 // CHK-UBUACTIONS: 0: input, "[[INPUT:.+\.i]]", cpp-output, (host-openmp)
@@ -354,9 +354,9 @@
 /// ###
 
 /// Check separate compilation with offloading - bundling jobs construct
-// RUN:   %clang -### -fopenmp=libomp -c -o %t.o -lsomelib -target 
powerpc64le-linux 
-fopenmp-targets=powerpc64le-ibm-linux-gnu,x86_64-pc-linux-gnu %s 2>&1 \
+// RUN:   %clang -### -fopenmp=libomp -c -o %t.o -lsomelib -target 
powerpc64le-linux 
-fopenmp-targets=powerpc64le-ibm-linux-gnu,x86_6

Re: [libcxx] r285382 - Add __libcpp_version file and __libcpp_library_version function.

2016-10-28 Thread Ismail Donmez via cfe-commits
Hi,

On Fri, Oct 28, 2016 at 9:06 AM, Eric Fiselier via cfe-commits
 wrote:
> Author: ericwf
> Date: Fri Oct 28 01:06:50 2016
> New Revision: 285382
>
> URL: http://llvm.org/viewvc/llvm-project?rev=285382&view=rev
> Log:
> Add __libcpp_version file and __libcpp_library_version function.
>
> This patch does two seperate things. First it adds a file called
> "__libcpp_version" which only contains the current libc++ version
> (currently 4000). This file is not intended for use as a header. This file
> is used by Clang in order to easily determine the installed libc++ version.
> This allows Clang to enable/disable certain language features only when the
> library supports them.
>
> The second change is the addition of _LIBCPP_LIBRARY_VERSION macro, which
> returns the version of the installed dylib since it may be different than
> the headers.

The test seems to be failing here:

[ 7087s]  TEST 'libc++ :: libcxx/version.pass.cpp'
FAILED 
[ 7087s] Compiled With:
['/home/abuild/rpmbuild/BUILD/llvm/stage1/bin/clang++', '-o',
'/home/abuild/rpmbuild/BUILD/llvm/stage2/projects/libcxx/test/libcxx/Output/version.pass.cpp.o',
'-x', 'c++', 
'/home/abuild/rpmbuild/BUILD/llvm/projects/libcxx/test/libcxx/version.pass.cpp',
'-c', '-v', '-Werror=thread-safety', '-std=c++1z', '-include',
'/home/abuild/rpmbuild/BUILD/llvm/projects/libcxx/test/support/nasty_macros.hpp',
'-nostdinc++', '-I/home/abuild/rpmbuild/BUILD/llvm/projects/libcxx/include',
'-D__STDC_FORMAT_MACROS', '-D__STDC_LIMIT_MACROS',
'-D__STDC_CONSTANT_MACROS',
'-I/home/abuild/rpmbuild/BUILD/llvm/projects/libcxx/test/support',
'-DLIBCXX_FILESYSTEM_STATIC_TEST_ROOT="/home/abuild/rpmbuild/BUILD/llvm/projects/libcxx/test/std/experimental/filesystem/Inputs/static_test_env"',
'-DLIBCXX_FILESYSTEM_DYNAMIC_TEST_ROOT="/home/abuild/rpmbuild/BUILD/llvm/stage2/projects/libcxx/test/filesystem/Output/dynamic_env"',
'-DLIBCXX_FILESYSTEM_DYNAMIC_TEST_HELPER="/usr/bin/python2.7
/home/abuild/rpmbuild/BUILD/llvm/projects/libcxx/test/support/filesystem_dynamic_test_helper.py"',
'-c', '&&', '/home/abuild/rpmbuild/BUILD/llvm/stage1/bin/clang++',
'-o', 
'/home/abuild/rpmbuild/BUILD/llvm/stage2/projects/libcxx/test/libcxx/Output/version.pass.cpp.exe',
'/home/abuild/rpmbuild/BUILD/llvm/stage2/projects/libcxx/test/libcxx/Output/version.pass.cpp.o',
'-v', '-L/home/abuild/rpmbuild/BUILD/llvm/stage2/lib64',
'-Wl,-rpath,/home/abuild/rpmbuild/BUILD/llvm/stage2/lib64',
'-nodefaultlibs', '-lc++experimental', '-lc++', '-lm', '-lgcc_s',
'-lgcc', '-lpthread', '-lc', '-lgcc_s', '-lgcc']
[ 7087s] Command: ['env',
'LIBCXX_FILESYSTEM_DYNAMIC_TEST_ROOT=/home/abuild/rpmbuild/BUILD/llvm/stage2/projects/libcxx/test/filesystem/Output/dynamic_env',
'/home/abuild/rpmbuild/BUILD/llvm/stage2/projects/libcxx/test/libcxx/Output/version.pass.cpp.exe']
[ 7087s] Exit Code: -6
[ 7087s] Standard Error:
[ 7087s] --
[ 7087s] version.pass.cpp.exe:
/home/abuild/rpmbuild/BUILD/llvm/projects/libcxx/test/libcxx/version.pass.cpp:26:
int main(): Assertion `_LIBCPP_VERSION == _LIBCPP_LIBRARY_VERSION'
failed.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D26067: [openmp] Remove test assumption that invoked binary name contains "clang"

2016-10-28 Thread Sam McCall via cfe-commits
sammccall updated this revision to Diff 76172.
sammccall added a comment.

Use -no-canonical-prefixes so that the invoked binary name will contain "clang"


https://reviews.llvm.org/D26067

Files:
  test/Driver/openmp-offload.c


Index: test/Driver/openmp-offload.c
===
--- test/Driver/openmp-offload.c
+++ test/Driver/openmp-offload.c
@@ -184,15 +184,15 @@
 /// We use -fopenmp-dump-offload-linker-script to dump the linker script and
 /// check its contents.
 ///
-// RUN:   %clang -### -fopenmp=libomp -o %t.out -target powerpc64le-linux 
-fopenmp-targets=powerpc64le-ibm-linux-gnu,x86_64-pc-linux-gnu %s 
-fopenmp-dump-offload-linker-script 2>&1 \
+// RUN:   %clang -### -fopenmp=libomp -o %t.out -target powerpc64le-linux 
-fopenmp-targets=powerpc64le-ibm-linux-gnu,x86_64-pc-linux-gnu %s 
-fopenmp-dump-offload-linker-script -no-canonical-prefixes 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHK-COMMANDS -check-prefix=CHK-LKS 
-check-prefix=CHK-LKS-REG %s
-// RUN:   %clang -### -fopenmp=libomp -o %t.out -target powerpc64le-linux 
-fopenmp-targets=powerpc64le-ibm-linux-gnu,x86_64-pc-linux-gnu %s -save-temps 
-fopenmp-dump-offload-linker-script 2>&1 \
+// RUN:   %clang -### -fopenmp=libomp -o %t.out -target powerpc64le-linux 
-fopenmp-targets=powerpc64le-ibm-linux-gnu,x86_64-pc-linux-gnu %s -save-temps 
-fopenmp-dump-offload-linker-script -no-canonical-prefixes 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHK-COMMANDS-ST -check-prefix=CHK-LKS 
-check-prefix=CHK-LKS-ST %s
 
 // Make sure we are not dumping the script unless the user requested it.
-// RUN:   %clang -### -fopenmp=libomp -o %t.out -target powerpc64le-linux 
-fopenmp-targets=powerpc64le-ibm-linux-gnu,x86_64-pc-linux-gnu %s 2>&1 \
+// RUN:   %clang -### -fopenmp=libomp -o %t.out -target powerpc64le-linux 
-fopenmp-targets=powerpc64le-ibm-linux-gnu,x86_64-pc-linux-gnu %s 
-no-canonical-prefixes 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHK-LKS-NODUMP %s
-// RUN:   %clang -### -fopenmp=libomp -o %t.out -target powerpc64le-linux 
-fopenmp-targets=powerpc64le-ibm-linux-gnu,x86_64-pc-linux-gnu %s -save-temps 
2>&1 \
+// RUN:   %clang -### -fopenmp=libomp -o %t.out -target powerpc64le-linux 
-fopenmp-targets=powerpc64le-ibm-linux-gnu,x86_64-pc-linux-gnu %s -save-temps 
-no-canonical-prefixes 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHK-LKS-NODUMP %s
 
 //
@@ -275,7 +275,7 @@
 /// ###
 
 /// Check separate compilation with offloading - bundling actions
-// RUN:   %clang -### -ccc-print-phases -fopenmp=libomp -c -o %t.o -lsomelib 
-target powerpc64le-linux 
-fopenmp-targets=powerpc64le-ibm-linux-gnu,x86_64-pc-linux-gnu %s 2>&1 \
+// RUN:   %clang -### -ccc-print-phases -fopenmp=libomp -c -o %t.o -lsomelib 
-target powerpc64le-linux 
-fopenmp-targets=powerpc64le-ibm-linux-gnu,x86_64-pc-linux-gnu %s 
-no-canonical-prefixes 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHK-BUACTIONS %s
 
 // CHK-BUACTIONS: 0: input, "[[INPUT:.+\.c]]", c, (host-openmp)
@@ -303,7 +303,7 @@
 
 /// Check separate compilation with offloading - unbundling actions
 // RUN:   touch %t.i
-// RUN:   %clang -### -ccc-print-phases -fopenmp=libomp -o %t.out -lsomelib 
-target powerpc64le-linux 
-fopenmp-targets=powerpc64le-ibm-linux-gnu,x86_64-pc-linux-gnu %t.i 2>&1 \
+// RUN:   %clang -### -ccc-print-phases -fopenmp=libomp -o %t.out -lsomelib 
-target powerpc64le-linux 
-fopenmp-targets=powerpc64le-ibm-linux-gnu,x86_64-pc-linux-gnu %t.i 
-no-canonical-prefixes 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHK-UBACTIONS %s
 
 // CHK-UBACTIONS: 0: input, "somelib", object, (host-openmp)
@@ -331,7 +331,7 @@
 
 /// Check separate compilation with offloading - unbundling/bundling actions
 // RUN:   touch %t.i
-// RUN:   %clang -### -ccc-print-phases -fopenmp=libomp -c -o %t.o -lsomelib 
-target powerpc64le-linux 
-fopenmp-targets=powerpc64le-ibm-linux-gnu,x86_64-pc-linux-gnu %t.i 2>&1 \
+// RUN:   %clang -### -ccc-print-phases -fopenmp=libomp -c -o %t.o -lsomelib 
-target powerpc64le-linux 
-fopenmp-targets=powerpc64le-ibm-linux-gnu,x86_64-pc-linux-gnu %t.i 
-no-canonical-prefixes 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHK-UBUACTIONS %s
 
 // CHK-UBUACTIONS: 0: input, "[[INPUT:.+\.i]]", cpp-output, (host-openmp)
@@ -354,9 +354,9 @@
 /// ###
 
 /// Check separate compilation with offloading - bundling jobs construct
-// RUN:   %clang -### -fopenmp=libomp -c -o %t.o -lsomelib -target 
powerpc64le-linux 
-fopenmp-targets=powerpc64le-ibm-linux-gnu,x86_64-pc-linux-gnu %s 2>&1 \
+// RUN:   %clang -### -fopenmp=libomp -c -o %t.o -lsomelib -target 
powerpc64le-linux 
-fopenmp-targets=powerpc64le-ibm-linux-gnu,x86_64-pc-linux-gnu %s 
-no-canonical-prefixes 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHK-BUJOBS %s
-// RUN:   %clang -### -fopenmp=libomp -c -o %t.o -lsomelib -target 
powerpc64le-linux

[PATCH] D26067: [openmp] Remove test assumption that invoked binary name contains "clang"

2016-10-28 Thread Sam McCall via cfe-commits
sammccall created this revision.
sammccall added a reviewer: bkramer.
sammccall added a subscriber: cfe-commits.

Remove test assumption that driver-invoked binary name contains "clang"


https://reviews.llvm.org/D26067

Files:
  test/Driver/openmp-offload.c

Index: test/Driver/openmp-offload.c
===
--- test/Driver/openmp-offload.c
+++ test/Driver/openmp-offload.c
@@ -236,39 +236,39 @@
 //
 // Generate host BC file.
 //
-// CHK-COMMANDS: clang{{.*}}" "-cc1" "-triple" "powerpc64le--linux" "-emit-llvm-bc" {{.*}}"-o" "[[HOSTBC:.+\.bc]]" "-x" "c" "[[INPUT:.+\.c]]" "-fopenmp-targets=powerpc64le-ibm-linux-gnu,x86_64-pc-linux-gnu"
-// CHK-COMMANDS-ST: clang{{.*}}" "-cc1" "-triple" "powerpc64le--linux" "-E" {{.*}}"-fopenmp" {{.*}}"-o" "[[HOSTPP:.+\.i]]" "-x" "c" "[[INPUT:.+\.c]]"
-// CHK-COMMANDS-ST: clang{{.*}}" "-cc1" "-triple" "powerpc64le--linux" "-emit-llvm-bc" {{.*}}"-fopenmp" {{.*}}"-o" "[[HOSTBC:.+\.bc]]" "-x" "cpp-output" "[[HOSTPP]]" "-fopenmp-targets=powerpc64le-ibm-linux-gnu,x86_64-pc-linux-gnu"
+// CHK-COMMANDS: "-cc1" "-triple" "powerpc64le--linux" "-emit-llvm-bc" {{.*}}"-o" "[[HOSTBC:.+\.bc]]" "-x" "c" "[[INPUT:.+\.c]]" "-fopenmp-targets=powerpc64le-ibm-linux-gnu,x86_64-pc-linux-gnu"
+// CHK-COMMANDS-ST: "-cc1" "-triple" "powerpc64le--linux" "-E" {{.*}}"-fopenmp" {{.*}}"-o" "[[HOSTPP:.+\.i]]" "-x" "c" "[[INPUT:.+\.c]]"
+// CHK-COMMANDS-ST: "-cc1" "-triple" "powerpc64le--linux" "-emit-llvm-bc" {{.*}}"-fopenmp" {{.*}}"-o" "[[HOSTBC:.+\.bc]]" "-x" "cpp-output" "[[HOSTPP]]" "-fopenmp-targets=powerpc64le-ibm-linux-gnu,x86_64-pc-linux-gnu"
 
 //
 // Compile for the powerpc device.
 //
-// CHK-COMMANDS: clang{{.*}}" "-cc1" "-triple" "powerpc64le-ibm-linux-gnu" "-emit-obj" {{.*}}"-pic-level" "2" {{.*}}"-fopenmp" {{.*}}"-o" "[[T1OBJ:.+\.o]]" "-x" "c" "[[INPUT]]" "-fopenmp-is-device" "-fopenmp-host-ir-file-path" "[[HOSTBC]]"
+// CHK-COMMANDS: "-cc1" "-triple" "powerpc64le-ibm-linux-gnu" "-emit-obj" {{.*}}"-pic-level" "2" {{.*}}"-fopenmp" {{.*}}"-o" "[[T1OBJ:.+\.o]]" "-x" "c" "[[INPUT]]" "-fopenmp-is-device" "-fopenmp-host-ir-file-path" "[[HOSTBC]]"
 // CHK-COMMANDS: ld" {{.*}}"-o" "[[T1BIN]]" {{.*}}"[[T1OBJ]]"
-// CHK-COMMANDS-ST: clang{{.*}}" "-cc1" "-triple" "powerpc64le-ibm-linux-gnu" "-E" {{.*}}"-fopenmp" {{.*}}"-o" "[[T1PP:.+\.i]]" "-x" "c" "[[INPUT]]"
-// CHK-COMMANDS-ST: clang{{.*}}" "-cc1" "-triple" "powerpc64le-ibm-linux-gnu" "-emit-llvm-bc" {{.*}}"-pic-level" "2" {{.*}}"-fopenmp" {{.*}}"-o" "[[T1BC:.+\.bc]]" "-x" "cpp-output" "[[T1PP]]" "-fopenmp-is-device" "-fopenmp-host-ir-file-path" "[[HOSTBC]]"
-// CHK-COMMANDS-ST: clang{{.*}}" "-cc1" "-triple" "powerpc64le-ibm-linux-gnu" "-S" {{.*}}"-fopenmp" {{.*}}"-o" "[[T1ASM:.+\.s]]" "-x" "ir" "[[T1BC]]"
-// CHK-COMMANDS-ST: clang{{.*}}" "-cc1as" "-triple" "powerpc64le-ibm-linux-gnu" "-filetype" "obj" {{.*}}"-o" "[[T1OBJ:.+\.o]]" "[[T1ASM]]"
+// CHK-COMMANDS-ST: "-cc1" "-triple" "powerpc64le-ibm-linux-gnu" "-E" {{.*}}"-fopenmp" {{.*}}"-o" "[[T1PP:.+\.i]]" "-x" "c" "[[INPUT]]"
+// CHK-COMMANDS-ST: "-cc1" "-triple" "powerpc64le-ibm-linux-gnu" "-emit-llvm-bc" {{.*}}"-pic-level" "2" {{.*}}"-fopenmp" {{.*}}"-o" "[[T1BC:.+\.bc]]" "-x" "cpp-output" "[[T1PP]]" "-fopenmp-is-device" "-fopenmp-host-ir-file-path" "[[HOSTBC]]"
+// CHK-COMMANDS-ST: "-cc1" "-triple" "powerpc64le-ibm-linux-gnu" "-S" {{.*}}"-fopenmp" {{.*}}"-o" "[[T1ASM:.+\.s]]" "-x" "ir" "[[T1BC]]"
+// CHK-COMMANDS-ST: "-cc1as" "-triple" "powerpc64le-ibm-linux-gnu" "-filetype" "obj" {{.*}}"-o" "[[T1OBJ:.+\.o]]" "[[T1ASM]]"
 // CHK-COMMANDS-ST: ld" {{.*}}"-shared" {{.*}}"-o" "[[T1BIN]]" {{.*}}[[T1OBJ]]
 
 //
 // Compile for the x86 device.
 //
-// CHK-COMMANDS: clang{{.*}}" "-cc1" "-triple" "x86_64-pc-linux-gnu" "-emit-obj" {{.*}}"-pic-level" "2" {{.*}}"-fopenmp"  {{.*}}"-o" "[[T2OBJ:.+\.o]]" "-x" "c" "[[INPUT]]" "-fopenmp-is-device" "-fopenmp-host-ir-file-path" "[[HOSTBC]]"
+// CHK-COMMANDS: "-cc1" "-triple" "x86_64-pc-linux-gnu" "-emit-obj" {{.*}}"-pic-level" "2" {{.*}}"-fopenmp"  {{.*}}"-o" "[[T2OBJ:.+\.o]]" "-x" "c" "[[INPUT]]" "-fopenmp-is-device" "-fopenmp-host-ir-file-path" "[[HOSTBC]]"
 // CHK-COMMANDS: ld" {{.*}}"-o" "[[T2BIN]]" {{.*}}"[[T2OBJ]]"
-// CHK-COMMANDS-ST: clang{{.*}}" "-cc1" "-triple" "x86_64-pc-linux-gnu" "-E" {{.*}}"-fopenmp" {{.*}}"-o" "[[T2PP:.+\.i]]" "-x" "c" "[[INPUT]]"
-// CHK-COMMANDS-ST: clang{{.*}}" "-cc1" "-triple" "x86_64-pc-linux-gnu" "-emit-llvm-bc" {{.*}}"-pic-level" "2" {{.*}}"-fopenmp" {{.*}}"-o" "[[T2BC:.+\.bc]]" "-x" "cpp-output" "[[T2PP]]" "-fopenmp-is-device" "-fopenmp-host-ir-file-path" "[[HOSTBC]]"
-// CHK-COMMANDS-ST: clang{{.*}}" "-cc1" "-triple" "x86_64-pc-linux-gnu" "-S" {{.*}}"-fopenmp" {{.*}}"-o" "[[T2ASM:.+\.s]]" "-x" "ir" "[[T2BC]]"
-// CHK-COMMANDS-ST: clang{{.*}}" "-cc1as" "-triple" "x86_64-pc-linux-gnu" "-filetype" "obj" {{.*}}"-o" "[[T2OBJ:.+\.o]]" "[[T2ASM]]"
+// CHK-COMMANDS-ST: "-cc1" "-triple" "x86_64-pc-linux-gnu" "-E" {{.*}}"-fopenmp" {{.*}}"-o" "[[T2PP:.+\.i]]" "-x" "c" "[[INPUT]]"
+

r285386 - Sema: do not warn about unused const vars if main file is a header

2016-10-28 Thread Erik Verbruggen via cfe-commits
Author: erikjv
Date: Fri Oct 28 03:28:42 2016
New Revision: 285386

URL: http://llvm.org/viewvc/llvm-project?rev=285386&view=rev
Log:
Sema: do not warn about unused const vars if main file is a header

If we pass a header to libclang, e.g. because it's open in an editor in
an IDE, warnings about unused const vars are not useful: other files
that include the header might use those constants. So when -x *-header
is passed as command-line option, suppress this warning.

Added:
cfe/trunk/test/Sema/no-warn-unused-const-variables.c
Modified:
cfe/trunk/lib/Sema/Sema.cpp

Modified: cfe/trunk/lib/Sema/Sema.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/Sema.cpp?rev=285386&r1=285385&r2=285386&view=diff
==
--- cfe/trunk/lib/Sema/Sema.cpp (original)
+++ cfe/trunk/lib/Sema/Sema.cpp Fri Oct 28 03:28:42 2016
@@ -865,8 +865,11 @@ void Sema::ActOnEndOfTranslationUnit() {
   Diag(DiagD->getLocation(), diag::warn_unneeded_internal_decl)
 << /*variable*/1 << DiagD->getDeclName();
 } else if (DiagD->getType().isConstQualified()) {
-  Diag(DiagD->getLocation(), diag::warn_unused_const_variable)
-  << DiagD->getDeclName();
+  const SourceManager &SM = SourceMgr;
+  if (SM.getMainFileID() != SM.getFileID(DiagD->getLocation()) ||
+  !PP.getLangOpts().IsHeaderFile)
+Diag(DiagD->getLocation(), diag::warn_unused_const_variable)
+<< DiagD->getDeclName();
 } else {
   Diag(DiagD->getLocation(), diag::warn_unused_variable)
   << DiagD->getDeclName();

Added: cfe/trunk/test/Sema/no-warn-unused-const-variables.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/no-warn-unused-const-variables.c?rev=285386&view=auto
==
--- cfe/trunk/test/Sema/no-warn-unused-const-variables.c (added)
+++ cfe/trunk/test/Sema/no-warn-unused-const-variables.c Fri Oct 28 03:28:42 
2016
@@ -0,0 +1,4 @@
+// RUN: %clang_cc1 -fsyntax-only -Wunused-const-variable -x c-header 
-ffreestanding -verify %s
+// RUN: %clang_cc1 -fsyntax-only -Wunused-const-variable -x c++-header 
-ffreestanding -verify %s
+// expected-no-diagnostics
+static const int unused[] = { 2, 3, 5, 7, 11, 13 };


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


[PATCH] D23752: [cmake] Respect LLVM_RUNTIMES_LIBDIR_SUFFIX

2016-10-28 Thread Michał Górny via cfe-commits
mgorny abandoned this revision.
mgorny added a comment.

Very well. I'll look into (ab)using the existing options to achieve the same 
result. Having stand-alone build systems, this should become easier these days, 
at least until some major change in runtime handling occurs.


https://reviews.llvm.org/D23752



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