[PATCH] D25547: [CodeGen][ObjC] Do not emit objc_storeStrong to initialize a constexpr variable

2016-10-12 Thread Akira Hatanaka via cfe-commits
ahatanak created this revision.
ahatanak added a reviewer: rjmccall.
ahatanak added a subscriber: cfe-commits.

When compiling a constexpr NSString initialized with an objective-c string 
literal, CodeGen currently emits objc_storeStrong on an uninitialized alloca, 
which causes a crash:

  constexpr NSString *S = @"abc";



  %S = alloca %0*, align 8
  %0 = bitcast %0** %S to i8** ; this points to uninitialized memory
  call void @objc_storeStrong(i8** %0, i8* bitcast 
(%struct.__NSConstantString_tag* @_unnamed_cfstring_ to i8*)) #1

This patch fixes the crash by directly storing the pointer to the 
__NSConstantString_tag for the string into the allocated alloca. The rationale 
for this change is that retain or release on an Objective-c string literal (or 
anything used to initialize a constexpr variable) has no effect and therefore 
objc_storeStrong isn't needed in this case.

rdar://problem/28562009


https://reviews.llvm.org/D25547

Files:
  lib/CodeGen/CGDecl.cpp
  lib/CodeGen/CGExpr.cpp
  lib/CodeGen/CodeGenFunction.h
  test/CodeGenObjCXX/arc-constexpr.mm

Index: test/CodeGenObjCXX/arc-constexpr.mm
===
--- /dev/null
+++ test/CodeGenObjCXX/arc-constexpr.mm
@@ -0,0 +1,16 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fobjc-arc -o - -std=c++11 %s | FileCheck %s
+
+// CHECK: %[[TYPE:[a-z0-9]+]] = type opaque
+// CHECK: @[[CFSTRING:[a-z0-9_]+]] = private global %struct.__NSConstantString_tag
+
+// CHECK: define void @_Z5test1v
+// CHECK:   %[[ALLOCA:[A-Z]+]] = alloca %[[TYPE]]*
+// CHECK:   store %[[TYPE]]* bitcast (%struct.__NSConstantString_tag* @[[CFSTRING]] to %[[TYPE]]*), %[[TYPE]]** %[[ALLOCA]]
+// CHECK:   %[[V0:[a-z0-9]+]] = bitcast %[[TYPE]]** %[[ALLOCA]] to i8**
+// CHECK:   call void @objc_storeStrong(i8** %[[V0]], i8* null)
+
+@class NSString;
+
+void test1() {
+  constexpr NSString *S = @"abc";
+}
Index: lib/CodeGen/CodeGenFunction.h
===
--- lib/CodeGen/CodeGenFunction.h
+++ lib/CodeGen/CodeGenFunction.h
@@ -2709,7 +2709,8 @@
   /// EmitStoreThroughLValue - Store the specified rvalue into the specified
   /// lvalue, where both are guaranteed to the have the same type, and that type
   /// is 'Ty'.
-  void EmitStoreThroughLValue(RValue Src, LValue Dst, bool isInit = false);
+  void EmitStoreThroughLValue(RValue Src, LValue Dst, bool isInit = false,
+  bool IsConstExpr = false);
   void EmitStoreThroughExtVectorComponentLValue(RValue Src, LValue Dst);
   void EmitStoreThroughGlobalRegLValue(RValue Src, LValue Dst);
 
Index: lib/CodeGen/CGExpr.cpp
===
--- lib/CodeGen/CGExpr.cpp
+++ lib/CodeGen/CGExpr.cpp
@@ -1593,7 +1593,7 @@
 /// lvalue, where both are guaranteed to the have the same type, and that type
 /// is 'Ty'.
 void CodeGenFunction::EmitStoreThroughLValue(RValue Src, LValue Dst,
- bool isInit) {
+ bool isInit, bool IsConstExpr) {
   if (!Dst.isSimple()) {
 if (Dst.isVectorElt()) {
   // Read/modify/write the vector, inserting the new element.
@@ -1619,62 +1619,63 @@
   }
 
   // There's special magic for assigning into an ARC-qualified l-value.
-  if (Qualifiers::ObjCLifetime Lifetime = Dst.getQuals().getObjCLifetime()) {
-switch (Lifetime) {
-case Qualifiers::OCL_None:
-  llvm_unreachable("present but none");
+  if (!IsConstExpr) {
+if (Qualifiers::ObjCLifetime Lifetime = Dst.getQuals().getObjCLifetime()) {
+  switch (Lifetime) {
+  case Qualifiers::OCL_None:
+llvm_unreachable("present but none");
 
-case Qualifiers::OCL_ExplicitNone:
-  // nothing special
-  break;
+  case Qualifiers::OCL_ExplicitNone:
+// nothing special
+break;
 
-case Qualifiers::OCL_Strong:
-  EmitARCStoreStrong(Dst, Src.getScalarVal(), /*ignore*/ true);
-  return;
+  case Qualifiers::OCL_Strong:
+EmitARCStoreStrong(Dst, Src.getScalarVal(), /*ignore*/ true);
+return;
 
-case Qualifiers::OCL_Weak:
-  EmitARCStoreWeak(Dst.getAddress(), Src.getScalarVal(), /*ignore*/ true);
-  return;
+  case Qualifiers::OCL_Weak:
+EmitARCStoreWeak(Dst.getAddress(), Src.getScalarVal(), /*ignore*/ true);
+return;
 
-case Qualifiers::OCL_Autoreleasing:
-  Src = RValue::get(EmitObjCExtendObjectLifetime(Dst.getType(),
- Src.getScalarVal()));
-  // fall into the normal path
-  break;
+  case Qualifiers::OCL_Autoreleasing:
+Src = RValue::get(
+EmitObjCExtendObjectLifetime(Dst.getType(), Src.getScalarVal()));
+// fall into the normal path
+break;
+  }
 }
-  }
 
-  if (Dst.isObjCWeak() && !Dst.isNonGC()) {
-// load of a __weak object.
-Address LvalueDst = 

[PATCH] D22968: [analyzer] A checker for macOS-specific bool- and number-like objects.

2016-10-12 Thread Anna Zaks via cfe-commits
zaks.anna accepted this revision.
zaks.anna added inline comments.
This revision is now accepted and ready to land.



Comment at: include/clang/StaticAnalyzer/Checkers/Checkers.td:479
+  InPackage,
+  HelpText<"Check for erroneous conversions of number pointers into numbers">,
+  DescFile<"NumberObjectConversionChecker">;

"number pointers" -> "objects representing numbers"


https://reviews.llvm.org/D22968



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


[PATCH] D20811: [analyzer] Model some library functions

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

Ping? Is there something blocking progress here? This functionality is very 
useful and almost done.

Thanks!


https://reviews.llvm.org/D20811



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


Re: [libcxx] r282345 - Use __attribute__((internal_linkage)) when available.

2016-10-12 Thread Mehdi Amini via cfe-commits
Thanks Eric!

> On Oct 12, 2016, at 9:18 PM, Eric Fiselier  wrote:
> 
> Sure, I've reverted the change in r284101.
> 
> I'll try and respond in detail tomorrow.
> 
> /Eric
> 
> On Wed, Oct 12, 2016 at 9:57 PM, Mehdi Amini  > wrote:
> Hi Eric,
> 
> This is not clear to me that this patch is correct as-is. 
> 
> See the last message in the thread: 
> http://lists.llvm.org/pipermail/cfe-dev/2016-July/049985.html 
> 
> 
> I think we should reach a consensus on the right course of actions about this 
> first.
> 
> — 
> Mehdi
> 
> 
> 
> 
>> On Sep 24, 2016, at 8:14 PM, Eric Fiselier via cfe-commits 
>> > wrote:
>> 
>> Author: ericwf
>> Date: Sat Sep 24 22:14:13 2016
>> New Revision: 282345
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=282345=rev 
>> 
>> Log:
>> Use __attribute__((internal_linkage)) when available.
>> 
>> Summary:
>> This patch has been a long time coming (Thanks @eugenis). It changes 
>> `_LIBCPP_INLINE_VISIBILITY` to use `__attribute__((internal_linkage))` 
>> instead of `__attribute__((visibility("hidden"), always_inline))`.
>> 
>> The point of `_LIBCPP_INLINE_VISIBILITY` is to prevent inline functions from 
>> being exported from both the libc++ library and from user libraries. This 
>> helps libc++ better manage it's ABI.
>> Previously this was done by forcing inlining and modifying the symbols 
>> visibility. However inlining isn't guaranteed and symbol visibility only 
>> affects shared libraries making this an imperfect solution.  
>> `internal_linkage` improves this situation by making all symbols local to 
>> the TU they are emitted in, regardless of inlining or visibility. IIRC the 
>> effect of applying `__attribute__((internal_linkage))` to an inline function 
>> is the same as applying `static`.
>> 
>> For more information about the attribute see: 
>> http://lists.llvm.org/pipermail/cfe-dev/2015-October/045580.html 
>> 
>> 
>> Most of the work for this patch was done by @eugenis.
>> 
>> 
>> Reviewers: mclow.lists, eugenis
>> 
>> Subscribers: eugenis, cfe-commits
>> 
>> Differential Revision: https://reviews.llvm.org/D24642 
>> 
>> 
>> Modified:
>>libcxx/trunk/include/__config
>>libcxx/trunk/src/string.cpp
>> 
>> Modified: libcxx/trunk/include/__config
>> URL: 
>> http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=282345=282344=282345=diff
>>  
>> 
>> ==
>> --- libcxx/trunk/include/__config (original)
>> +++ libcxx/trunk/include/__config Sat Sep 24 22:14:13 2016
>> @@ -34,6 +34,7 @@
>> #endif
>> 
>> #if defined(_LIBCPP_ABI_UNSTABLE) || _LIBCPP_ABI_VERSION >= 2
>> +#define _LIBCPP_ABI_EXTERN_TEMPLATE_SYMBOLS_VERSION 2
>> // Change short string representation so that string data starts at offset 0,
>> // improving its alignment in some cases.
>> #define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
>> @@ -49,6 +50,7 @@
>> #define _LIBCPP_ABI_FIX_UNORDERED_CONTAINER_SIZE_TYPE
>> #define _LIBCPP_ABI_VARIADIC_LOCK_GUARD
>> #elif _LIBCPP_ABI_VERSION == 1
>> +#define _LIBCPP_ABI_EXTERN_TEMPLATE_SYMBOLS_VERSION 1
>> // Feature macros for disabling pre ABI v1 features. All of these options
>> // are deprecated.
>> #if defined(__FreeBSD__)
>> @@ -629,11 +631,19 @@ namespace std {
>> #endif
>> 
>> #ifndef _LIBCPP_INLINE_VISIBILITY
>> -#define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__visibility__("hidden"), 
>> __always_inline__))
>> +# if __has_attribute(__internal_linkage__)
>> +#   define _LIBCPP_INLINE_VISIBILITY __attribute__((__internal_linkage__, 
>> __always_inline__))
>> +# else
>> +#   define _LIBCPP_INLINE_VISIBILITY __attribute__ 
>> ((__visibility__("hidden"), __always_inline__))
>> +# endif
>> #endif
>> 
>> #ifndef _LIBCPP_ALWAYS_INLINE
>> -#define _LIBCPP_ALWAYS_INLINE  __attribute__ ((__visibility__("hidden"), 
>> __always_inline__))
>> +# if __has_attribute(__internal_linkage__)
>> +#   define _LIBCPP_ALWAYS_INLINE __attribute__((__internal_linkage__, 
>> __always_inline__))
>> +# else
>> +#   define _LIBCPP_ALWAYS_INLINE  __attribute__ ((__visibility__("hidden"), 
>> __always_inline__))
>> +# endif
>> #endif
>> 
>> #ifndef _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
>> 
>> Modified: libcxx/trunk/src/string.cpp
>> URL: 
>> http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/string.cpp?rev=282345=282344=282345=diff
>>  
>> 
>> ==
>> --- libcxx/trunk/src/string.cpp (original)
>> 

[PATCH] D1805: [scan-build] Whitelist all -fXXXX options.

2016-10-12 Thread Anna Zaks via cfe-commits
zaks.anna accepted this revision.
zaks.anna added a comment.
This revision is now accepted and ready to land.

Just realized that this is super old and has probably been fixed by r186138. 
Closing.


https://reviews.llvm.org/D1805



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


[PATCH] D1805: [scan-build] Whitelist all -fXXXX options.

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

Please, provide more information on why this patch is needed and why the 
existing processing of the -f flags does not work as expected. Looks like the 
last modifications to the -f flags were made in r186138.

(Please, submit patches with more context: 
http://llvm.org/docs/Phabricator.html#requesting-a-review-via-the-web-interface)

Thank you!


https://reviews.llvm.org/D1805



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


[PATCH] D25503: [analyzer] Remove superquadratic behaviour from DataflowWorklist

2016-10-12 Thread Anna Zaks via cfe-commits
zaks.anna accepted this revision.
zaks.anna added a comment.
This revision is now accepted and ready to land.

LGTM!

I would add info on how much speedup you see in the cryptographic libraries to 
the commit message. (You could say something like "on a cryptographic library 
that uses code generation, this patch gives"...)

Thanks,
Anna.


Repository:
  rL LLVM

https://reviews.llvm.org/D25503



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


Re: [libcxx] r282345 - Use __attribute__((internal_linkage)) when available.

2016-10-12 Thread Eric Fiselier via cfe-commits
Sure, I've reverted the change in r284101.

I'll try and respond in detail tomorrow.

/Eric

On Wed, Oct 12, 2016 at 9:57 PM, Mehdi Amini  wrote:

> Hi Eric,
>
> This is not clear to me that this patch is correct as-is.
>
> See the last message in the thread: http://lists.llvm.org/
> pipermail/cfe-dev/2016-July/049985.html
>
> I think we should reach a consensus on the right course of actions about
> this first.
>
> —
> Mehdi
>
>
>
>
> On Sep 24, 2016, at 8:14 PM, Eric Fiselier via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
> Author: ericwf
> Date: Sat Sep 24 22:14:13 2016
> New Revision: 282345
>
> URL: http://llvm.org/viewvc/llvm-project?rev=282345=rev
> Log:
> Use __attribute__((internal_linkage)) when available.
>
> Summary:
> This patch has been a long time coming (Thanks @eugenis). It changes
> `_LIBCPP_INLINE_VISIBILITY` to use `__attribute__((internal_linkage))`
> instead of `__attribute__((visibility("hidden"), always_inline))`.
>
> The point of `_LIBCPP_INLINE_VISIBILITY` is to prevent inline functions
> from being exported from both the libc++ library and from user libraries.
> This helps libc++ better manage it's ABI.
> Previously this was done by forcing inlining and modifying the symbols
> visibility. However inlining isn't guaranteed and symbol visibility only
> affects shared libraries making this an imperfect solution.
>  `internal_linkage` improves this situation by making all symbols local to
> the TU they are emitted in, regardless of inlining or visibility. IIRC the
> effect of applying `__attribute__((internal_linkage))` to an inline
> function is the same as applying `static`.
>
> For more information about the attribute see: http://lists.llvm.org/
> pipermail/cfe-dev/2015-October/045580.html
>
> Most of the work for this patch was done by @eugenis.
>
>
> Reviewers: mclow.lists, eugenis
>
> Subscribers: eugenis, cfe-commits
>
> Differential Revision: https://reviews.llvm.org/D24642
>
> Modified:
>libcxx/trunk/include/__config
>libcxx/trunk/src/string.cpp
>
> Modified: libcxx/trunk/include/__config
> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/_
> _config?rev=282345=282344=282345=diff
> 
> ==
> --- libcxx/trunk/include/__config (original)
> +++ libcxx/trunk/include/__config Sat Sep 24 22:14:13 2016
> @@ -34,6 +34,7 @@
> #endif
>
> #if defined(_LIBCPP_ABI_UNSTABLE) || _LIBCPP_ABI_VERSION >= 2
> +#define _LIBCPP_ABI_EXTERN_TEMPLATE_SYMBOLS_VERSION 2
> // Change short string representation so that string data starts at offset
> 0,
> // improving its alignment in some cases.
> #define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
> @@ -49,6 +50,7 @@
> #define _LIBCPP_ABI_FIX_UNORDERED_CONTAINER_SIZE_TYPE
> #define _LIBCPP_ABI_VARIADIC_LOCK_GUARD
> #elif _LIBCPP_ABI_VERSION == 1
> +#define _LIBCPP_ABI_EXTERN_TEMPLATE_SYMBOLS_VERSION 1
> // Feature macros for disabling pre ABI v1 features. All of these options
> // are deprecated.
> #if defined(__FreeBSD__)
> @@ -629,11 +631,19 @@ namespace std {
> #endif
>
> #ifndef _LIBCPP_INLINE_VISIBILITY
> -#define _LIBCPP_INLINE_VISIBILITY __attribute__
> ((__visibility__("hidden"), __always_inline__))
> +# if __has_attribute(__internal_linkage__)
> +#   define _LIBCPP_INLINE_VISIBILITY __attribute__((__internal_linkage__,
> __always_inline__))
> +# else
> +#   define _LIBCPP_INLINE_VISIBILITY __attribute__
> ((__visibility__("hidden"), __always_inline__))
> +# endif
> #endif
>
> #ifndef _LIBCPP_ALWAYS_INLINE
> -#define _LIBCPP_ALWAYS_INLINE  __attribute__ ((__visibility__("hidden"),
> __always_inline__))
> +# if __has_attribute(__internal_linkage__)
> +#   define _LIBCPP_ALWAYS_INLINE __attribute__((__internal_linkage__,
> __always_inline__))
> +# else
> +#   define _LIBCPP_ALWAYS_INLINE  __attribute__
> ((__visibility__("hidden"), __always_inline__))
> +# endif
> #endif
>
> #ifndef _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
>
> Modified: libcxx/trunk/src/string.cpp
> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/
> string.cpp?rev=282345=282344=282345=diff
> 
> ==
> --- libcxx/trunk/src/string.cpp (original)
> +++ libcxx/trunk/src/string.cpp Sat Sep 24 22:14:13 2016
> @@ -29,6 +29,29 @@ template
> string
> operator+(char const*,
> string const&);
>
> +// These external instantiations are required to maintain dylib
> compatibility
> +// for ABI v1 when using __attribute__((internal_linkage)) as opposed to
> +// __attribute__((visibility("hidden"), always_inline)).
> +#if _LIBCPP_ABI_EXTERN_TEMPLATE_SYMBOLS_VERSION == 1
> +template basic_string::iterator
> +basic_string::insert(basic_string::const_iterator,
> +   char const *, char const *);
> +
> +template basic_string::iterator
> +basic_string::insert(basic_string::const_iterator,
> +  wchar_t const *, 

[libcxx] r284101 - Revert r282345 - Use __attribute__((internal_linkage)) when available.

2016-10-12 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Wed Oct 12 23:07:58 2016
New Revision: 284101

URL: http://llvm.org/viewvc/llvm-project?rev=284101=rev
Log:
Revert r282345 - Use __attribute__((internal_linkage)) when available.

Modified:
libcxx/trunk/include/__config
libcxx/trunk/src/string.cpp

Modified: libcxx/trunk/include/__config
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=284101=284100=284101=diff
==
--- libcxx/trunk/include/__config (original)
+++ libcxx/trunk/include/__config Wed Oct 12 23:07:58 2016
@@ -34,7 +34,6 @@
 #endif
 
 #if defined(_LIBCPP_ABI_UNSTABLE) || _LIBCPP_ABI_VERSION >= 2
-#define _LIBCPP_ABI_EXTERN_TEMPLATE_SYMBOLS_VERSION 2
 // Change short string representation so that string data starts at offset 0,
 // improving its alignment in some cases.
 #define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
@@ -50,7 +49,6 @@
 #define _LIBCPP_ABI_FIX_UNORDERED_CONTAINER_SIZE_TYPE
 #define _LIBCPP_ABI_VARIADIC_LOCK_GUARD
 #elif _LIBCPP_ABI_VERSION == 1
-#define _LIBCPP_ABI_EXTERN_TEMPLATE_SYMBOLS_VERSION 1
 // Feature macros for disabling pre ABI v1 features. All of these options
 // are deprecated.
 #if defined(__FreeBSD__)
@@ -603,19 +601,11 @@ namespace std {
 #endif
 
 #ifndef _LIBCPP_INLINE_VISIBILITY
-# if __has_attribute(__internal_linkage__)
-#   define _LIBCPP_INLINE_VISIBILITY __attribute__((__internal_linkage__, 
__always_inline__))
-# else
-#   define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__visibility__("hidden"), 
__always_inline__))
-# endif
+#define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__visibility__("hidden"), 
__always_inline__))
 #endif
 
 #ifndef _LIBCPP_ALWAYS_INLINE
-# if __has_attribute(__internal_linkage__)
-#   define _LIBCPP_ALWAYS_INLINE __attribute__((__internal_linkage__, 
__always_inline__))
-# else
-#   define _LIBCPP_ALWAYS_INLINE  __attribute__ ((__visibility__("hidden"), 
__always_inline__))
-# endif
+#define _LIBCPP_ALWAYS_INLINE  __attribute__ ((__visibility__("hidden"), 
__always_inline__))
 #endif
 
 #ifndef _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY

Modified: libcxx/trunk/src/string.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/string.cpp?rev=284101=284100=284101=diff
==
--- libcxx/trunk/src/string.cpp (original)
+++ libcxx/trunk/src/string.cpp Wed Oct 12 23:07:58 2016
@@ -29,29 +29,6 @@ template
 string
 operator+(char const*, string 
const&);
 
-// These external instantiations are required to maintain dylib compatibility
-// for ABI v1 when using __attribute__((internal_linkage)) as opposed to
-// __attribute__((visibility("hidden"), always_inline)).
-#if _LIBCPP_ABI_EXTERN_TEMPLATE_SYMBOLS_VERSION == 1
-template basic_string::iterator
-basic_string::insert(basic_string::const_iterator,
-   char const *, char const *);
-
-template basic_string::iterator
-basic_string::insert(basic_string::const_iterator,
-  wchar_t const *, wchar_t const *);
-
-template basic_string &
-basic_string::replace(basic_string::const_iterator,
-   basic_string::const_iterator,
-   char const *, char const *);
-
-template basic_string &
-basic_string::replace(basic_string::const_iterator,
-   basic_string::const_iterator,
-   wchar_t const *, wchar_t const *);
-#endif // _LIBCPP_ABI_EXTERN_TEMPLATE_SYMBOLS_VERSION
-
 namespace
 {
 


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


Re: [libcxx] r282345 - Use __attribute__((internal_linkage)) when available.

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

This is not clear to me that this patch is correct as-is. 

See the last message in the thread: 
http://lists.llvm.org/pipermail/cfe-dev/2016-July/049985.html 


I think we should reach a consensus on the right course of actions about this 
first.

— 
Mehdi




> On Sep 24, 2016, at 8:14 PM, Eric Fiselier via cfe-commits 
>  wrote:
> 
> Author: ericwf
> Date: Sat Sep 24 22:14:13 2016
> New Revision: 282345
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=282345=rev
> Log:
> Use __attribute__((internal_linkage)) when available.
> 
> Summary:
> This patch has been a long time coming (Thanks @eugenis). It changes 
> `_LIBCPP_INLINE_VISIBILITY` to use `__attribute__((internal_linkage))` 
> instead of `__attribute__((visibility("hidden"), always_inline))`.
> 
> The point of `_LIBCPP_INLINE_VISIBILITY` is to prevent inline functions from 
> being exported from both the libc++ library and from user libraries. This 
> helps libc++ better manage it's ABI.
> Previously this was done by forcing inlining and modifying the symbols 
> visibility. However inlining isn't guaranteed and symbol visibility only 
> affects shared libraries making this an imperfect solution.  
> `internal_linkage` improves this situation by making all symbols local to the 
> TU they are emitted in, regardless of inlining or visibility. IIRC the effect 
> of applying `__attribute__((internal_linkage))` to an inline function is the 
> same as applying `static`.
> 
> For more information about the attribute see: 
> http://lists.llvm.org/pipermail/cfe-dev/2015-October/045580.html
> 
> Most of the work for this patch was done by @eugenis.
> 
> 
> Reviewers: mclow.lists, eugenis
> 
> Subscribers: eugenis, cfe-commits
> 
> Differential Revision: https://reviews.llvm.org/D24642
> 
> Modified:
>libcxx/trunk/include/__config
>libcxx/trunk/src/string.cpp
> 
> Modified: libcxx/trunk/include/__config
> URL: 
> http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=282345=282344=282345=diff
> ==
> --- libcxx/trunk/include/__config (original)
> +++ libcxx/trunk/include/__config Sat Sep 24 22:14:13 2016
> @@ -34,6 +34,7 @@
> #endif
> 
> #if defined(_LIBCPP_ABI_UNSTABLE) || _LIBCPP_ABI_VERSION >= 2
> +#define _LIBCPP_ABI_EXTERN_TEMPLATE_SYMBOLS_VERSION 2
> // Change short string representation so that string data starts at offset 0,
> // improving its alignment in some cases.
> #define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
> @@ -49,6 +50,7 @@
> #define _LIBCPP_ABI_FIX_UNORDERED_CONTAINER_SIZE_TYPE
> #define _LIBCPP_ABI_VARIADIC_LOCK_GUARD
> #elif _LIBCPP_ABI_VERSION == 1
> +#define _LIBCPP_ABI_EXTERN_TEMPLATE_SYMBOLS_VERSION 1
> // Feature macros for disabling pre ABI v1 features. All of these options
> // are deprecated.
> #if defined(__FreeBSD__)
> @@ -629,11 +631,19 @@ namespace std {
> #endif
> 
> #ifndef _LIBCPP_INLINE_VISIBILITY
> -#define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__visibility__("hidden"), 
> __always_inline__))
> +# if __has_attribute(__internal_linkage__)
> +#   define _LIBCPP_INLINE_VISIBILITY __attribute__((__internal_linkage__, 
> __always_inline__))
> +# else
> +#   define _LIBCPP_INLINE_VISIBILITY __attribute__ 
> ((__visibility__("hidden"), __always_inline__))
> +# endif
> #endif
> 
> #ifndef _LIBCPP_ALWAYS_INLINE
> -#define _LIBCPP_ALWAYS_INLINE  __attribute__ ((__visibility__("hidden"), 
> __always_inline__))
> +# if __has_attribute(__internal_linkage__)
> +#   define _LIBCPP_ALWAYS_INLINE __attribute__((__internal_linkage__, 
> __always_inline__))
> +# else
> +#   define _LIBCPP_ALWAYS_INLINE  __attribute__ ((__visibility__("hidden"), 
> __always_inline__))
> +# endif
> #endif
> 
> #ifndef _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
> 
> Modified: libcxx/trunk/src/string.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/string.cpp?rev=282345=282344=282345=diff
> ==
> --- libcxx/trunk/src/string.cpp (original)
> +++ libcxx/trunk/src/string.cpp Sat Sep 24 22:14:13 2016
> @@ -29,6 +29,29 @@ template
> string
> operator+(char const*, string 
> const&);
> 
> +// These external instantiations are required to maintain dylib compatibility
> +// for ABI v1 when using __attribute__((internal_linkage)) as opposed to
> +// __attribute__((visibility("hidden"), always_inline)).
> +#if _LIBCPP_ABI_EXTERN_TEMPLATE_SYMBOLS_VERSION == 1
> +template basic_string::iterator
> +basic_string::insert(basic_string::const_iterator,
> +   char const *, char const *);
> +
> +template basic_string::iterator
> +basic_string::insert(basic_string::const_iterator,
> +  wchar_t const *, wchar_t const *);
> +
> +template basic_string &
> 

Re: [PATCH] D25539: [Coverage] Support for C++17 switch initializers

2016-10-12 Thread Richard Smith via cfe-commits
Do we need the same change for if-statements too?

On 12 Oct 2016 6:26 pm, "Vedant Kumar via cfe-commits" <
cfe-commits@lists.llvm.org> wrote:

> vsk created this revision.
> vsk added reviewers: arphaman, ikudrin.
> vsk added a subscriber: cfe-commits.
>
> Generate coverage mappings for  in switch (; ).
>
> I'm unsure about whether or not the CodeGenPGO change in this patch
> deserves more testing.
>
>
> https://reviews.llvm.org/D25539
>
> Files:
>   lib/CodeGen/CodeGenPGO.cpp
>   lib/CodeGen/CoverageMappingGen.cpp
>   test/CoverageMapping/switch.c
>   test/CoverageMapping/switch.cpp
>
>
> Index: test/CoverageMapping/switch.cpp
> ===
> --- test/CoverageMapping/switch.cpp
> +++ test/CoverageMapping/switch.cpp
> @@ -1,4 +1,5 @@
> -// RUN: %clang_cc1 -fprofile-instrument=clang -fcoverage-mapping
> -dump-coverage-mapping -emit-llvm-only -main-file-name switch.c %s |
> FileCheck %s
> +// RUN: %clang_cc1 -fprofile-instrument=clang -fcoverage-mapping
> -dump-coverage-mapping -emit-llvm-only -std=c++1z -triple
> %itanium_abi_triple -main-file-name switch.cpp %s | FileCheck %s
> +
>  // CHECK: foo
>  void foo(int i) {   // CHECK-NEXT: File 0, [[@LINE]]:17 -> [[@LINE+8]]:2
> = #0
>switch(i) {
> @@ -10,7 +11,7 @@
>int x = 0;// CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+1]]:2 =
> #1
>  }
>
> -void nop() {}
> +int nop() { return 0; }
>
>  // CHECK: bar
>  void bar(int i) {   // CHECK-NEXT: File 0, [[@LINE]]:17 -> [[@LINE+20]]:2
> = #0
> @@ -35,8 +36,16 @@
>nop();// CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+1]]:2 =
> #6
>  }
>
> +// CHECK: baz
> +void baz() {// CHECK-NEXT: File 0, [[@LINE]]:12 -> [[@LINE+5]]:2
> = #0
> +  switch (int i = true ? nop()  // CHECK-NEXT: [[@LINE]]:26 ->
> [[@LINE]]:31 = #2
> +   : nop(); // CHECK-NEXT: [[@LINE]]:26 ->
> [[@LINE]]:31 = (#0 - #2)
> +  i) {}
> +  nop();// CHECK-NEXT: [[@LINE]]:3 -> [[@LINE+1]]:2 = #1
> +}
> +
>  // CHECK-NEXT: main
> -int main() {// CHECK-NEXT: File 0, [[@LINE]]:12 -> [[@LINE+34]]:2
> = #0
> +int main() {// CHECK-NEXT: File 0, [[@LINE]]:12 -> [[@LINE+35]]:2
> = #0
>int i = 0;
>switch(i) {
>case 0:   // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+7]]:10
> = #2
> @@ -48,7 +57,7 @@
>default:  // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+1]]:10
> = #4
>  break;
>}
> -  switch(i) {   // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+22]]:2
> = #1
> +  switch(i) {   // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+23]]:2
> = #1
>case 0:   // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+6]]:10
> = #6
>  i = 1;
>  break;
> @@ -58,16 +67,17 @@
>  break;
>}
>
> -  switch(i) {   // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+12]]:2
> = #5
> +  switch(i) {   // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+13]]:2
> = #5
>case 1:   // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+5]]:11
> = #10
>case 2:   // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+4]]:11
> = (#10 + #11)
>  i = 11;
>case 3:   // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+2]]:11
> = ((#10 + #11) + #12)
>case 4:   // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+1]]:11
> = (((#10 + #11) + #12) + #13)
>  i = 99;
>}
>
> -  foo(1);   // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+2]]:11
> = #9
> +  foo(1);   // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+3]]:11
> = #9
>bar(1);
> +  baz();
>return 0;
>  }
> Index: lib/CodeGen/CoverageMappingGen.cpp
> ===
> --- lib/CodeGen/CoverageMappingGen.cpp
> +++ lib/CodeGen/CoverageMappingGen.cpp
> @@ -813,6 +813,9 @@
>
>void VisitSwitchStmt(const SwitchStmt *S) {
>  extendRegion(S);
> +if (S->getInit())
> +  Visit(S->getInit());
> +
>  Visit(S->getCond());
>
>  BreakContinueStack.push_back(BreakContinue());
> Index: lib/CodeGen/CodeGenPGO.cpp
> ===
> --- lib/CodeGen/CodeGenPGO.cpp
> +++ lib/CodeGen/CodeGenPGO.cpp
> @@ -458,6 +458,8 @@
>
>void VisitSwitchStmt(const SwitchStmt *S) {
>  RecordStmtCount(S);
> +if (S->getInit())
> +  Visit(S->getInit());
>  Visit(S->getCond());
>  CurrentCount = 0;
>  BreakContinueStack.push_back(BreakContinue());
>
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D25541: [CUDA] Emit deferred diagnostics during Sema rather than during codegen.

2016-10-12 Thread Justin Lebar via cfe-commits
jlebar created this revision.
jlebar added a reviewer: rnk.
jlebar added subscribers: tra, rsmith, cfe-commits.

Emitting deferred diagnostics during codegen was a hack.  It did work,
but usability was poor, both for us as compiler devs and for users.  We
don't codegen if there are any sema errors, so for users this meant that
they wouldn't see deferred errors if there were any non-deferred errors.
For devs, this meant that we had to carefully split up our tests so that
when we tested deferred errors, we didn't emit any non-deferred errors.

This change moves checking for deferred errors into Sema.  See the big
comment in SemaCUDA.cpp for an overview of the idea.

This checking adds overhead to compilation, because we have to maintain
a partial call graph.  As a result, this change makes deferred errors a
CUDA-only concept (whereas before they were a general concept).  If
anyone else wants to use this framework for something other than CUDA,
we can generalize at that time.

This patch makes the minimal set of test changes -- after this lands,
I'll go back through and do a cleanup of the tests that we no longer
have to split up.


https://reviews.llvm.org/D25541

Files:
  clang/include/clang/AST/ASTContext.h
  clang/include/clang/AST/Decl.h
  clang/include/clang/Sema/Sema.h
  clang/lib/AST/Decl.cpp
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/lib/CodeGen/CodeGenModule.h
  clang/lib/Sema/SemaCUDA.cpp
  clang/test/Parser/lambda-attr.cu
  clang/test/SemaCUDA/call-host-fn-from-device.cu
  clang/test/SemaCUDA/function-overload.cu
  clang/test/SemaCUDA/method-target.cu

Index: clang/test/SemaCUDA/method-target.cu
===
--- clang/test/SemaCUDA/method-target.cu
+++ clang/test/SemaCUDA/method-target.cu
@@ -29,7 +29,7 @@
 // Test 3: device method called from host function
 
 struct S3 {
-  __device__ void method() {} // expected-note {{'method' declared here}};
+  __device__ void method() {} // expected-note {{'method' declared here}}
 };
 
 void foo3(S3& s) {
@@ -40,11 +40,11 @@
 // Test 4: device method called from host function
 
 struct S4 {
-  __device__ void method() {}
+  __device__ void method() {}  // expected-note {{'method' declared here}}
 };
 
 __host__ __device__ void foo4(S4& s) {
-  s.method();
+  s.method(); // expected-error {{reference to __device__ function 'method' in __host__ __device__ function}}
 }
 
 //--
Index: clang/test/SemaCUDA/function-overload.cu
===
--- clang/test/SemaCUDA/function-overload.cu
+++ clang/test/SemaCUDA/function-overload.cu
@@ -170,11 +170,23 @@
   DeviceReturnTy ret_d = d();
   DeviceFnPtr fp_cd = cd;
   DeviceReturnTy ret_cd = cd();
+#if !defined(__CUDA_ARCH__)
+  // expected-error@-5 {{reference to __device__ function 'd' in __host__ __device__ function}}
+  // expected-error@-5 {{reference to __device__ function 'd' in __host__ __device__ function}}
+  // expected-error@-5 {{reference to __device__ function 'cd' in __host__ __device__ function}}
+  // expected-error@-5 {{reference to __device__ function 'cd' in __host__ __device__ function}}
+#endif
 
   HostFnPtr fp_h = h;
   HostReturnTy ret_h = h();
   HostFnPtr fp_ch = ch;
   HostReturnTy ret_ch = ch();
+#if defined(__CUDA_ARCH__)
+  // expected-error@-5 {{reference to __host__ function 'h' in __host__ __device__ function}}
+  // expected-error@-5 {{reference to __host__ function 'h' in __host__ __device__ function}}
+  // expected-error@-5 {{reference to __host__ function 'ch' in __host__ __device__ function}}
+  // expected-error@-5 {{reference to __host__ function 'ch' in __host__ __device__ function}}
+#endif
 
   CurrentFnPtr fp_dh = dh;
   CurrentReturnTy ret_dh = dh();
@@ -308,7 +320,11 @@
 
 // If we have a mix of HD and H-only or D-only candidates in the overload set,
 // normal C++ overload resolution rules apply first.
-template  TemplateReturnTy template_vs_hd_function(T arg) {
+template  TemplateReturnTy template_vs_hd_function(T arg)
+#ifdef __CUDA_ARCH__
+//expected-note@-2 {{declared here}}
+#endif
+{
   return TemplateReturnTy();
 }
 __host__ __device__ HostDeviceReturnTy template_vs_hd_function(float arg) {
@@ -318,6 +334,9 @@
 __host__ __device__ void test_host_device_calls_hd_template() {
   HostDeviceReturnTy ret1 = template_vs_hd_function(1.0f);
   TemplateReturnTy ret2 = template_vs_hd_function(1);
+#ifdef __CUDA_ARCH__
+  // expected-error@-2 {{reference to __host__ function 'template_vs_hd_function' in __host__ __device__ function}}
+#endif
 }
 
 __host__ void test_host_calls_hd_template() {
@@ -337,14 +356,30 @@
 // side of compilation.
 __device__ DeviceReturnTy device_only_function(int arg) { return DeviceReturnTy(); }
 __device__ DeviceReturnTy2 device_only_function(float arg) { return DeviceReturnTy2(); }
+#ifndef __CUDA_ARCH__
+  // expected-note@-3 {{'device_only_function' declared 

[PATCH] D9403: llvm.noalias - Clang CodeGen for local restrict-qualified pointers

2016-10-12 Thread Hal Finkel via cfe-commits
hfinkel added a comment.

Ping.


https://reviews.llvm.org/D9403



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


[PATCH] D25540: Implement MS _ReturnAddress and _AddressOfReturnAddress intrinsics

2016-10-12 Thread Albert Gutowski via cfe-commits
agutowski created this revision.
agutowski added reviewers: rnk, hans, thakis, majnemer.
agutowski added a subscriber: cfe-commits.

https://reviews.llvm.org/D25540

Files:
  include/clang/Basic/Builtins.def
  include/clang/Basic/BuiltinsX86.def
  lib/CodeGen/CGBuiltin.cpp
  lib/Headers/intrin.h
  test/CodeGen/ms-intrinsics.c

Index: lib/Headers/intrin.h
===
--- lib/Headers/intrin.h
+++ lib/Headers/intrin.h
@@ -1112,14 +1112,6 @@
 /**\
 |* Misc
 \**/
-static __inline__ void * __DEFAULT_FN_ATTRS
-_AddressOfReturnAddress(void) {
-  return (void*)((char*)__builtin_frame_address(0) + sizeof(void*));
-}
-static __inline__ void * __DEFAULT_FN_ATTRS
-_ReturnAddress(void) {
-  return __builtin_return_address(0);
-}
 #if defined(__i386__) || defined(__x86_64__)
 static __inline__ void __DEFAULT_FN_ATTRS
 __cpuid(int __info[4], int __level) {
Index: lib/CodeGen/CGBuiltin.cpp
===
--- lib/CodeGen/CGBuiltin.cpp
+++ lib/CodeGen/CGBuiltin.cpp
@@ -1147,6 +1147,12 @@
 Value *F = CGM.getIntrinsic(Intrinsic::returnaddress);
 return RValue::get(Builder.CreateCall(F, Depth));
   }
+  case Builtin::BI_ReturnAddress: {
+Value *Depth =
+Constant::getNullValue(ConvertType(getContext().UnsignedIntTy));
+Value *F = CGM.getIntrinsic(Intrinsic::returnaddress);
+return RValue::get(Builder.CreateCall(F, Depth));
+  }
   case Builtin::BI__builtin_frame_address: {
 Value *Depth =
 CGM.EmitConstantExpr(E->getArg(0), getContext().UnsignedIntTy, this);
@@ -7697,7 +7703,11 @@
   case X86::BI_BitScanReverse:
   case X86::BI_BitScanReverse64:
 return EmitMSVCBuiltinExpr(MSVCIntrin::_BitScanReverse, E);
+  case X86::BI_AddressOfReturnAddress: {
+Value *F = CGM.getIntrinsic(Intrinsic::addressofreturnaddress);
+return Builder.CreateCall(F);
   }
+  }
 }
 
 
Index: include/clang/Basic/BuiltinsX86.def
===
--- include/clang/Basic/BuiltinsX86.def
+++ include/clang/Basic/BuiltinsX86.def
@@ -2039,6 +2039,8 @@
 TARGET_HEADER_BUILTIN(__emul,  "LLiii","nh", "intrin.h", ALL_MS_LANGUAGES, "")
 TARGET_HEADER_BUILTIN(__emulu, "ULLiUiUi", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
 
+TARGET_HEADER_BUILTIN(_AddressOfReturnAddress, "v*", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
+
 #undef BUILTIN
 #undef TARGET_BUILTIN
 #undef TARGET_HEADER_BUILTIN
Index: include/clang/Basic/Builtins.def
===
--- include/clang/Basic/Builtins.def
+++ include/clang/Basic/Builtins.def
@@ -753,6 +753,7 @@
 LANGBUILTIN(__popcnt,   "UiUi", "nc", ALL_MS_LANGUAGES)
 LANGBUILTIN(__popcnt64, "ULLiULLi", "nc", ALL_MS_LANGUAGES)
 LANGBUILTIN(__readfsdword,"ULiULi", "n", ALL_MS_LANGUAGES)
+LANGBUILTIN(_ReturnAddress, "v*", "n", ALL_MS_LANGUAGES)
 LANGBUILTIN(_rotl8,  "UcUcUc","n", ALL_MS_LANGUAGES)
 LANGBUILTIN(_rotl16, "UsUsUc","n", ALL_MS_LANGUAGES)
 LANGBUILTIN(_rotl,   "UiUii", "n", ALL_MS_LANGUAGES)
Index: test/CodeGen/ms-intrinsics.c
===
--- test/CodeGen/ms-intrinsics.c
+++ test/CodeGen/ms-intrinsics.c
@@ -1,12 +1,12 @@
 // RUN: %clang_cc1 -ffreestanding -fms-extensions -fms-compatibility -fms-compatibility-version=17.00 \
 // RUN: -triple i686--windows -Oz -emit-llvm %s -o - \
-// RUN: | FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-I386
+// RUN: | FileCheck %s -check-prefixes CHECK,CHECK-I386,CHECK-X86
 // RUN: %clang_cc1 -ffreestanding -fms-extensions -fms-compatibility -fms-compatibility-version=17.00 \
 // RUN: -triple thumbv7--windows -Oz -emit-llvm %s -o - \
-// RUN: | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-ARM-X64
+// RUN: | FileCheck %s --check-prefixes CHECK,CHECK-ARM-X64
 // RUN: %clang_cc1 -ffreestanding -fms-extensions -fms-compatibility -fms-compatibility-version=17.00 \
 // RUN: -triple x86_64--windows -Oz -emit-llvm %s -o - \
-// RUN: | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-X64 --check-prefix=CHECK-ARM-X64
+// RUN: | FileCheck %s --check-prefixes CHECK,CHECK-X64,CHECK-ARM-X64,CHECK-X86
 
 // intrin.h needs size_t, but -ffreestanding prevents us from getting it from
 // stddef.h.  Work around it with this typedef.
@@ -14,6 +14,22 @@
 
 #include 
 
+void *test_ReturnAddress() {
+  return _ReturnAddress();
+}
+// CHECK-LABEL: define{{.*}}i8* @test_ReturnAddress()
+// CHECK: = tail call i8* @llvm.returnaddress(i32 0)
+// CHECK: ret i8*
+
+#if defined(__i386__) || defined(__x86_64__)
+void *test_AddressOfReturnAddress() {
+  return _AddressOfReturnAddress();
+}
+// CHECK-X86-LABEL: define i8* @test_AddressOfReturnAddress()
+// 

[PATCH] D25539: [Coverage] Support for C++17 switch initializers

2016-10-12 Thread Vedant Kumar via cfe-commits
vsk created this revision.
vsk added reviewers: arphaman, ikudrin.
vsk added a subscriber: cfe-commits.

Generate coverage mappings for  in switch (; ).

I'm unsure about whether or not the CodeGenPGO change in this patch deserves 
more testing.


https://reviews.llvm.org/D25539

Files:
  lib/CodeGen/CodeGenPGO.cpp
  lib/CodeGen/CoverageMappingGen.cpp
  test/CoverageMapping/switch.c
  test/CoverageMapping/switch.cpp


Index: test/CoverageMapping/switch.cpp
===
--- test/CoverageMapping/switch.cpp
+++ test/CoverageMapping/switch.cpp
@@ -1,4 +1,5 @@
-// RUN: %clang_cc1 -fprofile-instrument=clang -fcoverage-mapping 
-dump-coverage-mapping -emit-llvm-only -main-file-name switch.c %s | FileCheck 
%s
+// RUN: %clang_cc1 -fprofile-instrument=clang -fcoverage-mapping 
-dump-coverage-mapping -emit-llvm-only -std=c++1z -triple %itanium_abi_triple 
-main-file-name switch.cpp %s | FileCheck %s
+
 // CHECK: foo
 void foo(int i) {   // CHECK-NEXT: File 0, [[@LINE]]:17 -> [[@LINE+8]]:2 = #0
   switch(i) {
@@ -10,7 +11,7 @@
   int x = 0;// CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+1]]:2 = #1
 }
 
-void nop() {}
+int nop() { return 0; }
 
 // CHECK: bar
 void bar(int i) {   // CHECK-NEXT: File 0, [[@LINE]]:17 -> [[@LINE+20]]:2 = #0
@@ -35,8 +36,16 @@
   nop();// CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+1]]:2 = #6
 }
 
+// CHECK: baz
+void baz() {// CHECK-NEXT: File 0, [[@LINE]]:12 -> [[@LINE+5]]:2 = #0
+  switch (int i = true ? nop()  // CHECK-NEXT: [[@LINE]]:26 -> [[@LINE]]:31 = 
#2
+   : nop(); // CHECK-NEXT: [[@LINE]]:26 -> [[@LINE]]:31 = 
(#0 - #2)
+  i) {}
+  nop();// CHECK-NEXT: [[@LINE]]:3 -> [[@LINE+1]]:2 = #1
+}
+
 // CHECK-NEXT: main
-int main() {// CHECK-NEXT: File 0, [[@LINE]]:12 -> [[@LINE+34]]:2 = #0
+int main() {// CHECK-NEXT: File 0, [[@LINE]]:12 -> [[@LINE+35]]:2 = #0
   int i = 0;
   switch(i) {
   case 0:   // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+7]]:10 = #2
@@ -48,7 +57,7 @@
   default:  // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+1]]:10 = #4
 break;
   }
-  switch(i) {   // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+22]]:2 = #1
+  switch(i) {   // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+23]]:2 = #1
   case 0:   // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+6]]:10 = #6
 i = 1;
 break;
@@ -58,16 +67,17 @@
 break;
   }
 
-  switch(i) {   // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+12]]:2 = #5
+  switch(i) {   // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+13]]:2 = #5
   case 1:   // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+5]]:11 = #10
   case 2:   // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+4]]:11 = 
(#10 + #11)
 i = 11;
   case 3:   // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+2]]:11 = 
((#10 + #11) + #12)
   case 4:   // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+1]]:11 = 
(((#10 + #11) + #12) + #13)
 i = 99;
   }
 
-  foo(1);   // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+2]]:11 = #9
+  foo(1);   // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+3]]:11 = #9
   bar(1);
+  baz();
   return 0;
 }
Index: lib/CodeGen/CoverageMappingGen.cpp
===
--- lib/CodeGen/CoverageMappingGen.cpp
+++ lib/CodeGen/CoverageMappingGen.cpp
@@ -813,6 +813,9 @@
 
   void VisitSwitchStmt(const SwitchStmt *S) {
 extendRegion(S);
+if (S->getInit())
+  Visit(S->getInit());
+
 Visit(S->getCond());
 
 BreakContinueStack.push_back(BreakContinue());
Index: lib/CodeGen/CodeGenPGO.cpp
===
--- lib/CodeGen/CodeGenPGO.cpp
+++ lib/CodeGen/CodeGenPGO.cpp
@@ -458,6 +458,8 @@
 
   void VisitSwitchStmt(const SwitchStmt *S) {
 RecordStmtCount(S);
+if (S->getInit())
+  Visit(S->getInit());
 Visit(S->getCond());
 CurrentCount = 0;
 BreakContinueStack.push_back(BreakContinue());


Index: test/CoverageMapping/switch.cpp
===
--- test/CoverageMapping/switch.cpp
+++ test/CoverageMapping/switch.cpp
@@ -1,4 +1,5 @@
-// RUN: %clang_cc1 -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -main-file-name switch.c %s | FileCheck %s
+// RUN: %clang_cc1 -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -std=c++1z -triple %itanium_abi_triple -main-file-name switch.cpp %s | FileCheck %s
+
 // CHECK: foo
 void foo(int i) {   // CHECK-NEXT: File 0, [[@LINE]]:17 -> [[@LINE+8]]:2 = #0
   switch(i) {
@@ -10,7 +11,7 @@
   int x = 0;// CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+1]]:2 = #1
 }
 
-void nop() {}
+int nop() { return 0; }
 
 // CHECK: bar
 void bar(int i) {   // 

[PATCH] D25139: [CUDA] Add Sema::CUDADiagBuilder and Sema::CUDADiagIfDeviceCode().

2016-10-12 Thread Reid Kleckner via cfe-commits
rnk accepted this revision.
rnk added a comment.
This revision is now accepted and ready to land.

lgtm




Comment at: clang/include/clang/Sema/Sema.h:9238
+///
+///   if (CUDADiagBuilder(...) << foo << bar)
+/// return ExprError();

jlebar wrote:
> rnk wrote:
> > I'm concerned that this usage pattern isn't going to be efficient because 
> > you build the complete diagnostic before calling the bool conversion 
> > operator to determine that it doesn't need to be emitted. I think you want 
> > to construct something more like:
> >   if (isCUDADeviceCode())
> > CUDADiag(...) << ...;
> > 
> > Otherwise you are going to construct and destruct a large number of 
> > diagnostics about language features that are forbidden in device code, but 
> > are legal in host code, and 99% of the TU is going to be host code that 
> > uses these illegal features.
> I think the comment is misleading -- I tried to update it to resolve this 
> misunderstanding.  Does it make more sense now?
Actually, I just had to think about the problem more to realize why it has to 
be this way. This is for deferred diagnostics where you don't know if the code 
is device code yet. :)


https://reviews.llvm.org/D25139



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


Re: [PATCH] D25537: [ThinLTO] Update doc to include lld

2016-10-12 Thread Mehdi Amini via cfe-commits
Perfect!
LGTM, thanks!

— 
Mehdi

> On Oct 12, 2016, at 5:04 PM, Davide Italiano  wrote:
> 
> davide updated this revision to Diff 74459.
> davide added a comment.
> 
> I mentioned that's ELF only. Are you OK with that or you want me to put more 
> detailed info?
> 
> 
> https://reviews.llvm.org/D25537
> 
> Files:
> docs/ThinLTO.rst
> 
> 
> Index: docs/ThinLTO.rst
> ===
> --- docs/ThinLTO.rst
> +++ docs/ThinLTO.rst
> @@ -62,8 +62,8 @@
>  `_.
> - **ld64**:
>  Starting with `Xcode 8 `_.
> -
> -Additionally, support is being added to the *lld* linker.
> +- **lld**:
> +  Starting with r284050 (ELF only).
> 
> Usage
> =
> @@ -109,6 +109,8 @@
>  ``-Wl,-plugin-opt,jobs=N``
> - ld64:
>  ``-Wl,-mllvm,-threads=N``
> +- lld:
> +  ``-Wl,--thinlto-jobs=N``
> 
> Incremental
> ---
> 
> 
> 

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


[PATCH] D25503: [analyzer] Remove superquadratic behaviour from DataflowWorklist

2016-10-12 Thread Alexander Shaposhnikov via cfe-commits
alexshap added a comment.

I've just run scan-build against LLVM & clang & clang-extra-tools - the new 
version (with PriorityQueue) is a bit faster - i was running the build on OSX & 
-j8 and the total time for the new version is 88 minutes vs 92 minutes for the 
old one. Certainly i think that this measurement is not 100% proof but i don't 
see any regressions.


Repository:
  rL LLVM

https://reviews.llvm.org/D25503



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


r284084 - [analyzer] DeallocChecker: Don't warn about directly-set IBOutlet ivars on macOS

2016-10-12 Thread Devin Coughlin via cfe-commits
Author: dcoughlin
Date: Wed Oct 12 18:57:05 2016
New Revision: 284084

URL: http://llvm.org/viewvc/llvm-project?rev=284084=rev
Log:
[analyzer] DeallocChecker: Don't warn about directly-set IBOutlet ivars on macOS

On macOS (but not iOS), if an ObjC property has no setter, the nib-loading code
for an IBOutlet is documented as directly setting the backing ivar without
retaining the value -- even if the property is 'retain'.

This resulted in false positives from the DeallocChecker for code that did not
release such ivars in -dealloc.

To avoid these false positives, treat IBOutlet ivars that back a property
without a setter as having an unknown release requirement in macOS.

rdar://problem/28507353

Modified:
cfe/trunk/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp
cfe/trunk/test/Analysis/DeallocMissingRelease.m

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp?rev=284084=284083=284084=diff
==
--- cfe/trunk/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp Wed Oct 12 
18:57:05 2016
@@ -34,6 +34,7 @@
 #include "clang/AST/Expr.h"
 #include "clang/AST/ExprObjC.h"
 #include "clang/Basic/LangOptions.h"
+#include "clang/Basic/TargetInfo.h"
 #include "clang/StaticAnalyzer/Core/BugReporter/BugReporter.h"
 #include "clang/StaticAnalyzer/Core/BugReporter/BugType.h"
 #include "clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h"
@@ -180,6 +181,7 @@ private:
   bool classHasSeparateTeardown(const ObjCInterfaceDecl *ID) const;
 
   bool isReleasedByCIFilterDealloc(const ObjCPropertyImplDecl *PropImpl) const;
+  bool isNibLoadedIvarWithoutRetain(const ObjCPropertyImplDecl *PropImpl) 
const;
 };
 } // End anonymous namespace.
 
@@ -935,6 +937,9 @@ ReleaseRequirement ObjCDeallocChecker::g
 if (isReleasedByCIFilterDealloc(PropImpl))
   return ReleaseRequirement::MustNotReleaseDirectly;
 
+if (isNibLoadedIvarWithoutRetain(PropImpl))
+  return ReleaseRequirement::Unknown;
+
 return ReleaseRequirement::MustRelease;
 
   case ObjCPropertyDecl::Weak:
@@ -1091,6 +1096,32 @@ bool ObjCDeallocChecker::isReleasedByCIF
   return false;
 }
 
+/// Returns whether the ivar backing the property is an IBOutlet that
+/// has its value set by nib loading code without retaining the value.
+///
+/// On macOS, if there is no setter, the nib-loading code sets the ivar
+/// directly, without retaining the value,
+///
+/// On iOS and its derivatives, the nib-loading code will call
+/// -setValue:forKey:, which retains the value before directly setting the 
ivar.
+bool ObjCDeallocChecker::isNibLoadedIvarWithoutRetain(
+const ObjCPropertyImplDecl *PropImpl) const {
+  const ObjCIvarDecl *IvarDecl = PropImpl->getPropertyIvarDecl();
+  if (!IvarDecl->hasAttr())
+return false;
+
+  const llvm::Triple  =
+  IvarDecl->getASTContext().getTargetInfo().getTriple();
+
+  if (!Target.isMacOSX())
+return false;
+
+  if (PropImpl->getPropertyDecl()->getSetterMethodDecl())
+return false;
+
+  return true;
+}
+
 void ento::registerObjCDeallocChecker(CheckerManager ) {
   const LangOptions  = Mgr.getLangOpts();
   // These checker only makes sense under MRR.

Modified: cfe/trunk/test/Analysis/DeallocMissingRelease.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/DeallocMissingRelease.m?rev=284084=284083=284084=diff
==
--- cfe/trunk/test/Analysis/DeallocMissingRelease.m (original)
+++ cfe/trunk/test/Analysis/DeallocMissingRelease.m Wed Oct 12 18:57:05 2016
@@ -1,4 +1,5 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=osx.cocoa.Dealloc -fblocks 
-verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=osx.cocoa.Dealloc -fblocks 
-triple x86_64-apple-ios4.0 -DMACOS=0 -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=osx.cocoa.Dealloc -fblocks 
-triple x86_64-apple-macosx10.6.0 -DMACOS=1 -verify %s
 // RUN: %clang_cc1 -analyze -analyzer-checker=osx.cocoa.Dealloc -fblocks 
-triple x86_64-apple-darwin10 -fobjc-arc -fobjc-runtime-has-weak -verify %s
 
 #include "Inputs/system-header-simulator-for-objc-dealloc.h"
@@ -938,3 +939,71 @@ __attribute__((objc_root_class))
 @implementation NotMissingDeallocCIFilter // no-warning
 @synthesize inputIvar = inputIvar;
 @end
+
+
+@interface ClassWithRetainPropWithIBOutletIvarButNoSetter : NSObject {
+  // On macOS, the nib-loading code will set the ivar directly without
+  // retaining value (unike iOS, where it is retained). This means that
+  // on macOS we should not warn about a missing release for a property backed
+  // by an IBOutlet ivar when that property does not have a setter.
+  IBOutlet NSObject *ivarForOutlet;
+}
+
+@property (readonly, retain) NSObject *ivarForOutlet;
+#if NON_ARC && !MACOS
+// 

[PATCH] D25537: [ThinLTO] Update doc to include lld

2016-10-12 Thread Davide Italiano via cfe-commits
davide updated this revision to Diff 74459.
davide added a comment.

I mentioned that's ELF only. Are you OK with that or you want me to put more 
detailed info?


https://reviews.llvm.org/D25537

Files:
  docs/ThinLTO.rst


Index: docs/ThinLTO.rst
===
--- docs/ThinLTO.rst
+++ docs/ThinLTO.rst
@@ -62,8 +62,8 @@
   `_.
 - **ld64**:
   Starting with `Xcode 8 `_.
-
-Additionally, support is being added to the *lld* linker.
+- **lld**:
+  Starting with r284050 (ELF only).
 
 Usage
 =
@@ -109,6 +109,8 @@
   ``-Wl,-plugin-opt,jobs=N``
 - ld64:
   ``-Wl,-mllvm,-threads=N``
+- lld:
+  ``-Wl,--thinlto-jobs=N``
 
 Incremental
 ---


Index: docs/ThinLTO.rst
===
--- docs/ThinLTO.rst
+++ docs/ThinLTO.rst
@@ -62,8 +62,8 @@
   `_.
 - **ld64**:
   Starting with `Xcode 8 `_.
-
-Additionally, support is being added to the *lld* linker.
+- **lld**:
+  Starting with r284050 (ELF only).
 
 Usage
 =
@@ -109,6 +109,8 @@
   ``-Wl,-plugin-opt,jobs=N``
 - ld64:
   ``-Wl,-mllvm,-threads=N``
+- lld:
+  ``-Wl,--thinlto-jobs=N``
 
 Incremental
 ---
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r284083 - fix ms-intrinsics labels code to work with builds with assertions

2016-10-12 Thread Albert Gutowski via cfe-commits
Author: agutowski
Date: Wed Oct 12 18:52:38 2016
New Revision: 284083

URL: http://llvm.org/viewvc/llvm-project?rev=284083=rev
Log:
fix ms-intrinsics labels code to work with builds with assertions

Modified:
cfe/trunk/test/CodeGen/ms-intrinsics.c

Modified: cfe/trunk/test/CodeGen/ms-intrinsics.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/ms-intrinsics.c?rev=284083=284082=284083=diff
==
--- cfe/trunk/test/CodeGen/ms-intrinsics.c (original)
+++ cfe/trunk/test/CodeGen/ms-intrinsics.c Wed Oct 12 18:52:38 2016
@@ -20,10 +20,10 @@ unsigned char test_BitScanForward(unsign
 // CHECK: define{{.*}}i8 @test_BitScanForward(i32* {{[a-z_ ]*}}%Index, i32 
{{[a-z_ ]*}}%Mask){{.*}}{
 // CHECK:   [[ISNOTZERO:%[a-z0-9._]+]] = icmp eq i32 %Mask, 0
 // CHECK:   br i1 [[ISNOTZERO]], label %[[END_LABEL:[a-z0-9._]+]], label 
%[[ISNOTZERO_LABEL:[a-z0-9._]+]]
-// CHECK: ; :[[END_LABEL]]:
+// CHECK:   [[END_LABEL]]:
 // CHECK:   [[RESULT:%[a-z0-9._]+]] = phi i8 [ 0, 
%[[ISZERO_LABEL:[a-z0-9._]+]] ], [ 1, %[[ISNOTZERO_LABEL]] ]
 // CHECK:   ret i8 [[RESULT]]
-// CHECK: ; :[[ISNOTZERO_LABEL]]:
+// CHECK:   [[ISNOTZERO_LABEL]]:
 // CHECK:   [[INDEX:%[0-9]+]] = tail call i32 @llvm.cttz.i32(i32 %Mask, i1 
true)
 // CHECK:   store i32 [[INDEX]], i32* %Index, align 4
 // CHECK:   br label %[[END_LABEL]]
@@ -34,10 +34,10 @@ unsigned char test_BitScanReverse(unsign
 // CHECK: define{{.*}}i8 @test_BitScanReverse(i32* {{[a-z_ ]*}}%Index, i32 
{{[a-z_ ]*}}%Mask){{.*}}{
 // CHECK:   [[ISNOTZERO:%[0-9]+]] = icmp eq i32 %Mask, 0
 // CHECK:   br i1 [[ISNOTZERO]], label %[[END_LABEL:[a-z0-9._]+]], label 
%[[ISNOTZERO_LABEL:[a-z0-9._]+]]
-// CHECK: ; :[[END_LABEL]]:
+// CHECK:   [[END_LABEL]]:
 // CHECK:   [[RESULT:%[a-z0-9._]+]] = phi i8 [ 0, 
%[[ISZERO_LABEL:[a-z0-9._]+]] ], [ 1, %[[ISNOTZERO_LABEL]] ]
 // CHECK:   ret i8 [[RESULT]]
-// CHECK: ; :[[ISNOTZERO_LABEL]]:
+// CHECK:   [[ISNOTZERO_LABEL]]:
 // CHECK:   [[REVINDEX:%[0-9]+]] = tail call i32 @llvm.ctlz.i32(i32 %Mask, i1 
true)
 // CHECK:   [[INDEX:%[0-9]+]] = xor i32 [[REVINDEX]], 31
 // CHECK:   store i32 [[INDEX]], i32* %Index, align 4
@@ -50,10 +50,10 @@ unsigned char test_BitScanForward64(unsi
 // CHECK-ARM-X64: define{{.*}}i8 @test_BitScanForward64(i32* {{[a-z_ 
]*}}%Index, i64 {{[a-z_ ]*}}%Mask){{.*}}{
 // CHECK-ARM-X64:   [[ISNOTZERO:%[a-z0-9._]+]] = icmp eq i64 %Mask, 0
 // CHECK-ARM-X64:   br i1 [[ISNOTZERO]], label %[[END_LABEL:[a-z0-9._]+]], 
label %[[ISNOTZERO_LABEL:[a-z0-9._]+]]
-// CHECK-ARM-X64: ; :[[END_LABEL]]:
+// CHECK-ARM-X64:   [[END_LABEL]]:
 // CHECK-ARM-X64:   [[RESULT:%[a-z0-9._]+]] = phi i8 [ 0, 
%[[ISZERO_LABEL:[a-z0-9._]+]] ], [ 1, %[[ISNOTZERO_LABEL]] ]
 // CHECK-ARM-X64:   ret i8 [[RESULT]]
-// CHECK-ARM-X64: ; :[[ISNOTZERO_LABEL]]:
+// CHECK-ARM-X64:   [[ISNOTZERO_LABEL]]:
 // CHECK-ARM-X64:   [[INDEX:%[0-9]+]] = tail call i64 @llvm.cttz.i64(i64 
%Mask, i1 true)
 // CHECK-ARM-X64:   [[TRUNC_INDEX:%[0-9]+]] = trunc i64 [[INDEX]] to i32
 // CHECK-ARM-X64:   store i32 [[TRUNC_INDEX]], i32* %Index, align 4
@@ -65,10 +65,10 @@ unsigned char test_BitScanReverse64(unsi
 // CHECK-ARM-X64: define{{.*}}i8 @test_BitScanReverse64(i32* {{[a-z_ 
]*}}%Index, i64 {{[a-z_ ]*}}%Mask){{.*}}{
 // CHECK-ARM-X64:   [[ISNOTZERO:%[0-9]+]] = icmp eq i64 %Mask, 0
 // CHECK-ARM-X64:   br i1 [[ISNOTZERO]], label %[[END_LABEL:[a-z0-9._]+]], 
label %[[ISNOTZERO_LABEL:[a-z0-9._]+]]
-// CHECK-ARM-X64: ; :[[END_LABEL]]:
+// CHECK-ARM-X64:   [[END_LABEL]]:
 // CHECK-ARM-X64:   [[RESULT:%[a-z0-9._]+]] = phi i8 [ 0, 
%[[ISZERO_LABEL:[a-z0-9._]+]] ], [ 1, %[[ISNOTZERO_LABEL]] ]
 // CHECK-ARM-X64:   ret i8 [[RESULT]]
-// CHECK-ARM-X64: ; :[[ISNOTZERO_LABEL]]:
+// CHECK-ARM-X64:   [[ISNOTZERO_LABEL]]:
 // CHECK-ARM-X64:   [[REVINDEX:%[0-9]+]] = tail call i64 @llvm.ctlz.i64(i64 
%Mask, i1 true)
 // CHECK-ARM-X64:   [[TRUNC_REVINDEX:%[0-9]+]] = trunc i64 [[REVINDEX]] to i32
 // CHECK-ARM-X64:   [[INDEX:%[0-9]+]] = xor i32 [[TRUNC_REVINDEX]], 63


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


[PATCH] D24958: Test linked to D24957

2016-10-12 Thread Reid Kleckner via cfe-commits
rnk accepted this revision.
rnk added a comment.
This revision is now accepted and ready to land.

lgtm


Repository:
  rL LLVM

https://reviews.llvm.org/D24958



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


[PATCH] D25537: [ThinLTO] Update doc to include lld

2016-10-12 Thread Mehdi AMINI via cfe-commits
mehdi_amini requested changes to this revision.
mehdi_amini added a comment.
This revision now requires changes to proceed.

You have to add which platforms are supported.


https://reviews.llvm.org/D25537



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


r284081 - Revert r284008. This is us to fail to instantiate static data members in some

2016-10-12 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Wed Oct 12 18:29:02 2016
New Revision: 284081

URL: http://llvm.org/viewvc/llvm-project?rev=284081=rev
Log:
Revert r284008. This is us to fail to instantiate static data members in some
cases. I'm working on reducing a testcase.

Removed:
cfe/trunk/test/Modules/Inputs/PR28752/
cfe/trunk/test/Modules/pr28752.cpp
Modified:
cfe/trunk/include/clang/AST/Decl.h
cfe/trunk/lib/AST/Decl.cpp
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Sema/SemaTemplate.cpp
cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
cfe/trunk/lib/Sema/SemaType.cpp
cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
cfe/trunk/lib/Serialization/ASTWriterDecl.cpp

Modified: cfe/trunk/include/clang/AST/Decl.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Decl.h?rev=284081=284080=284081=diff
==
--- cfe/trunk/include/clang/AST/Decl.h (original)
+++ cfe/trunk/include/clang/AST/Decl.h Wed Oct 12 18:29:02 2016
@@ -865,11 +865,6 @@ protected:
 
 unsigned : NumVarDeclBits;
 
-// FIXME: We need something similar to CXXRecordDecl::DefinitionData.
-/// \brief Whether this variable is a definition which was demoted due to
-/// module merge.
-unsigned IsThisDeclarationADemotedDefinition : 1;
-
 /// \brief Whether this variable is the exception variable in a C++ catch
 /// or an Objective-C @catch statement.
 unsigned ExceptionVar : 1;
@@ -1203,28 +1198,12 @@ public:
   InitializationStyle getInitStyle() const {
 return static_cast(VarDeclBits.InitStyle);
   }
+
   /// \brief Whether the initializer is a direct-initializer (list or call).
   bool isDirectInit() const {
 return getInitStyle() != CInit;
   }
 
-  /// \brief If this definition should pretend to be a declaration.
-  bool isThisDeclarationADemotedDefinition() const {
-return isa(this) ? false :
-  NonParmVarDeclBits.IsThisDeclarationADemotedDefinition;
-  }
-
-  /// \brief This is a definition which should be demoted to a declaration.
-  ///
-  /// In some cases (mostly module merging) we can end up with two visible
-  /// definitions one of which needs to be demoted to a declaration to keep
-  /// the AST invariants.
-  void demoteThisDefinitionToDeclaration() {
-assert (isThisDeclarationADefinition() && "Not a definition!");
-assert (!isa(this) && "Cannot demote ParmVarDecls!");
-NonParmVarDeclBits.IsThisDeclarationADemotedDefinition = 1;
-  }
-
   /// \brief Determine whether this variable is the exception variable in a
   /// C++ catch statememt or an Objective-C \@catch statement.
   bool isExceptionVariable() const {
@@ -1323,10 +1302,6 @@ public:
 NonParmVarDeclBits.PreviousDeclInSameBlockScope = Same;
   }
 
-  /// \brief Retrieve the variable declaration from which this variable could
-  /// be instantiated, if it is an instantiation (rather than a non-template).
-  VarDecl *getTemplateInstantiationPattern() const;
-
   /// \brief If this variable is an instantiated static data member of a
   /// class template specialization, returns the templated static data member
   /// from which it was instantiated.

Modified: cfe/trunk/lib/AST/Decl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Decl.cpp?rev=284081=284080=284081=diff
==
--- cfe/trunk/lib/AST/Decl.cpp (original)
+++ cfe/trunk/lib/AST/Decl.cpp Wed Oct 12 18:29:02 2016
@@ -1926,9 +1926,6 @@ VarDecl::isThisDeclarationADefinition(AS
   //
   // FIXME: How do you declare (but not define) a partial specialization of
   // a static data member template outside the containing class?
-  if (isThisDeclarationADemotedDefinition())
-return DeclarationOnly;
-
   if (isStaticDataMember()) {
 if (isOutOfLine() &&
 !(getCanonicalDecl()->isInline() &&
@@ -2253,56 +2250,6 @@ bool VarDecl::checkInitIsICE() const {
   return Eval->IsICE;
 }
 
-VarDecl *VarDecl::getTemplateInstantiationPattern() const {
-  // If it's a variable template specialization, find the template or partial
-  // specialization from which it was instantiated.
-  if (auto *VDTemplSpec = dyn_cast(this)) {
-auto From = VDTemplSpec->getInstantiatedFrom();
-if (auto *VTD = From.dyn_cast()) {
-  while (auto *NewVTD = VTD->getInstantiatedFromMemberTemplate()) {
-if (NewVTD->isMemberSpecialization())
-  break;
-VTD = NewVTD;
-  }
-  return VTD->getTemplatedDecl()->getDefinition();
-}
-if (auto *VTPSD =
-From.dyn_cast()) {
-  while (auto *NewVTPSD = VTPSD->getInstantiatedFromMember()) {
-if (NewVTPSD->isMemberSpecialization())
-  break;
-VTPSD = NewVTPSD;
-  }
-  return VTPSD->getDefinition();
-}
-  }
-
-  if (MemberSpecializationInfo *MSInfo = getMemberSpecializationInfo()) {
-if (isTemplateInstantiation(MSInfo->getTemplateSpecializationKind())) {
-  

r284080 - [NFC] Fixing the description for _mm_store_ps and _mm_store_ps1.

2016-10-12 Thread Yunzhong Gao via cfe-commits
Author: ygao
Date: Wed Oct 12 18:27:27 2016
New Revision: 284080

URL: http://llvm.org/viewvc/llvm-project?rev=284080=rev
Log:
[NFC] Fixing the description for _mm_store_ps and _mm_store_ps1.

It seems that the doxygen description of these two intrinsics were swapped by
mistake.


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

Modified: cfe/trunk/lib/Headers/xmmintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/xmmintrin.h?rev=284080=284079=284080=diff
==
--- cfe/trunk/lib/Headers/xmmintrin.h (original)
+++ cfe/trunk/lib/Headers/xmmintrin.h Wed Oct 12 18:27:27 2016
@@ -1914,8 +1914,8 @@ _mm_store_ss(float *__p, __m128 __a)
   ((struct __mm_store_ss_struct*)__p)->__u = __a[0];
 }
 
-/// \brief Stores float values from a 128-bit vector of [4 x float] to an
-///unaligned memory location.
+/// \brief Stores a 128-bit vector of [4 x float] to an unaligned memory
+///location.
 ///
 /// \headerfile 
 ///
@@ -1935,19 +1935,18 @@ _mm_storeu_ps(float *__p, __m128 __a)
   ((struct __storeu_ps*)__p)->__v = __a;
 }
 
-/// \brief Stores the lower 32 bits of a 128-bit vector of [4 x float] into
-///four contiguous elements in an aligned memory location.
+/// \brief Stores a 128-bit vector of [4 x float] into an aligned memory
+///location.
 ///
 /// \headerfile 
 ///
-/// This intrinsic corresponds to \c VMOVAPS / MOVAPS + \c shuffling
-///instruction.
+/// This intrinsic corresponds to the \c VMOVAPS / MOVAPS instruction.
 ///
 /// \param __p
-///A pointer to a 128-bit memory location.
+///A pointer to a 128-bit memory location. The address of the memory
+///location has to be 16-byte aligned.
 /// \param __a
-///A 128-bit vector of [4 x float] whose lower 32 bits are stored to each
-///of the four contiguous elements pointed by __p.
+///A 128-bit vector of [4 x float] containing the values to be stored.
 static __inline__ void __DEFAULT_FN_ATTRS
 _mm_store_ps(float *__p, __m128 __a)
 {
@@ -1974,18 +1973,19 @@ _mm_store1_ps(float *__p, __m128 __a)
   _mm_store_ps(__p, __a);
 }
 
-/// \brief Stores float values from a 128-bit vector of [4 x float] to an
-///aligned memory location.
+/// \brief Stores the lower 32 bits of a 128-bit vector of [4 x float] into
+///four contiguous elements in an aligned memory location.
 ///
 /// \headerfile 
 ///
-/// This intrinsic corresponds to the \c VMOVAPS / MOVAPS instruction.
+/// This intrinsic corresponds to \c VMOVAPS / MOVAPS + \c shuffling
+///instruction.
 ///
 /// \param __p
-///A pointer to a 128-bit memory location. The address of the memory
-///location has to be 128-bit aligned.
+///A pointer to a 128-bit memory location.
 /// \param __a
-///A 128-bit vector of [4 x float] containing the values to be stored.
+///A 128-bit vector of [4 x float] whose lower 32 bits are stored to each
+///of the four contiguous elements pointed by __p.
 static __inline__ void __DEFAULT_FN_ATTRS
 _mm_store_ps1(float *__p, __m128 __a)
 {


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


[PATCH] D25537: [ThinLTO] Update doc to include lld

2016-10-12 Thread Teresa Johnson via cfe-commits
tejohnson accepted this revision.
tejohnson added a comment.
This revision is now accepted and ready to land.

LGTM, thanks!


https://reviews.llvm.org/D25537



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


[PATCH] D25537: [ThinLTO] Update doc to include lld

2016-10-12 Thread Davide Italiano via cfe-commits
davide created this revision.
davide added reviewers: tejohnson, mehdi_amini.
davide added a subscriber: cfe-commits.

https://reviews.llvm.org/D25537

Files:
  docs/ThinLTO.rst


Index: docs/ThinLTO.rst
===
--- docs/ThinLTO.rst
+++ docs/ThinLTO.rst
@@ -62,8 +62,8 @@
   `_.
 - **ld64**:
   Starting with `Xcode 8 `_.
-
-Additionally, support is being added to the *lld* linker.
+- **lld**:
+  Starting with r284050.
 
 Usage
 =
@@ -109,6 +109,8 @@
   ``-Wl,-plugin-opt,jobs=N``
 - ld64:
   ``-Wl,-mllvm,-threads=N``
+- lld:
+  ``-Wl,--thinlto-jobs=N``
 
 Incremental
 ---


Index: docs/ThinLTO.rst
===
--- docs/ThinLTO.rst
+++ docs/ThinLTO.rst
@@ -62,8 +62,8 @@
   `_.
 - **ld64**:
   Starting with `Xcode 8 `_.
-
-Additionally, support is being added to the *lld* linker.
+- **lld**:
+  Starting with r284050.
 
 Usage
 =
@@ -109,6 +109,8 @@
   ``-Wl,-plugin-opt,jobs=N``
 - ld64:
   ``-Wl,-mllvm,-threads=N``
+- lld:
+  ``-Wl,--thinlto-jobs=N``
 
 Incremental
 ---
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D25001: [Module] Merge function prototype with a non-prototype function declaration

2016-10-12 Thread Akira Hatanaka via cfe-commits
ahatanak added a comment.

It looks like this patch doesn't do what I thought would do when the 
unprototyped function declaration is in the header and the prototyped function 
declaration is in the source code. The DeclRefExpr created for the call to 
func1("abc", 12) points to the unprototyped function "func1()" instead of 
"func1(const char *, int)".


https://reviews.llvm.org/D25001



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


r284062 - fix regexes for label names in ms-intrinsics test

2016-10-12 Thread Albert Gutowski via cfe-commits
Author: agutowski
Date: Wed Oct 12 17:22:34 2016
New Revision: 284062

URL: http://llvm.org/viewvc/llvm-project?rev=284062=rev
Log:
fix regexes for label names in ms-intrinsics test

Modified:
cfe/trunk/test/CodeGen/ms-intrinsics.c

Modified: cfe/trunk/test/CodeGen/ms-intrinsics.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/ms-intrinsics.c?rev=284062=284061=284062=diff
==
--- cfe/trunk/test/CodeGen/ms-intrinsics.c (original)
+++ cfe/trunk/test/CodeGen/ms-intrinsics.c Wed Oct 12 17:22:34 2016
@@ -19,9 +19,9 @@ unsigned char test_BitScanForward(unsign
 }
 // CHECK: define{{.*}}i8 @test_BitScanForward(i32* {{[a-z_ ]*}}%Index, i32 
{{[a-z_ ]*}}%Mask){{.*}}{
 // CHECK:   [[ISNOTZERO:%[a-z0-9._]+]] = icmp eq i32 %Mask, 0
-// CHECK:   br i1 [[ISNOTZERO]], label %[[END_LABEL:[a-z0-9.]+]], label 
%[[ISNOTZERO_LABEL:[0-9]+]]
+// CHECK:   br i1 [[ISNOTZERO]], label %[[END_LABEL:[a-z0-9._]+]], label 
%[[ISNOTZERO_LABEL:[a-z0-9._]+]]
 // CHECK: ; :[[END_LABEL]]:
-// CHECK:   [[RESULT:%[a-z0-9._]+]] = phi i8 [ 0, %[[ISZERO_LABEL:[0-9]+]] ], 
[ 1, %[[ISNOTZERO_LABEL]] ]
+// CHECK:   [[RESULT:%[a-z0-9._]+]] = phi i8 [ 0, 
%[[ISZERO_LABEL:[a-z0-9._]+]] ], [ 1, %[[ISNOTZERO_LABEL]] ]
 // CHECK:   ret i8 [[RESULT]]
 // CHECK: ; :[[ISNOTZERO_LABEL]]:
 // CHECK:   [[INDEX:%[0-9]+]] = tail call i32 @llvm.cttz.i32(i32 %Mask, i1 
true)
@@ -33,9 +33,9 @@ unsigned char test_BitScanReverse(unsign
 }
 // CHECK: define{{.*}}i8 @test_BitScanReverse(i32* {{[a-z_ ]*}}%Index, i32 
{{[a-z_ ]*}}%Mask){{.*}}{
 // CHECK:   [[ISNOTZERO:%[0-9]+]] = icmp eq i32 %Mask, 0
-// CHECK:   br i1 [[ISNOTZERO]], label %[[END_LABEL:[a-z0-9.]+]], label 
%[[ISNOTZERO_LABEL:[0-9]+]]
+// CHECK:   br i1 [[ISNOTZERO]], label %[[END_LABEL:[a-z0-9._]+]], label 
%[[ISNOTZERO_LABEL:[a-z0-9._]+]]
 // CHECK: ; :[[END_LABEL]]:
-// CHECK:   [[RESULT:%[a-z0-9._]+]] = phi i8 [ 0, %[[ISZERO_LABEL:[0-9]+]] ], 
[ 1, %[[ISNOTZERO_LABEL]] ]
+// CHECK:   [[RESULT:%[a-z0-9._]+]] = phi i8 [ 0, 
%[[ISZERO_LABEL:[a-z0-9._]+]] ], [ 1, %[[ISNOTZERO_LABEL]] ]
 // CHECK:   ret i8 [[RESULT]]
 // CHECK: ; :[[ISNOTZERO_LABEL]]:
 // CHECK:   [[REVINDEX:%[0-9]+]] = tail call i32 @llvm.ctlz.i32(i32 %Mask, i1 
true)
@@ -49,9 +49,9 @@ unsigned char test_BitScanForward64(unsi
 }
 // CHECK-ARM-X64: define{{.*}}i8 @test_BitScanForward64(i32* {{[a-z_ 
]*}}%Index, i64 {{[a-z_ ]*}}%Mask){{.*}}{
 // CHECK-ARM-X64:   [[ISNOTZERO:%[a-z0-9._]+]] = icmp eq i64 %Mask, 0
-// CHECK-ARM-X64:   br i1 [[ISNOTZERO]], label %[[END_LABEL:[a-z0-9.]+]], 
label %[[ISNOTZERO_LABEL:[0-9]+]]
+// CHECK-ARM-X64:   br i1 [[ISNOTZERO]], label %[[END_LABEL:[a-z0-9._]+]], 
label %[[ISNOTZERO_LABEL:[a-z0-9._]+]]
 // CHECK-ARM-X64: ; :[[END_LABEL]]:
-// CHECK-ARM-X64:   [[RESULT:%[a-z0-9._]+]] = phi i8 [ 0, 
%[[ISZERO_LABEL:[0-9]+]] ], [ 1, %[[ISNOTZERO_LABEL]] ]
+// CHECK-ARM-X64:   [[RESULT:%[a-z0-9._]+]] = phi i8 [ 0, 
%[[ISZERO_LABEL:[a-z0-9._]+]] ], [ 1, %[[ISNOTZERO_LABEL]] ]
 // CHECK-ARM-X64:   ret i8 [[RESULT]]
 // CHECK-ARM-X64: ; :[[ISNOTZERO_LABEL]]:
 // CHECK-ARM-X64:   [[INDEX:%[0-9]+]] = tail call i64 @llvm.cttz.i64(i64 
%Mask, i1 true)
@@ -64,9 +64,9 @@ unsigned char test_BitScanReverse64(unsi
 }
 // CHECK-ARM-X64: define{{.*}}i8 @test_BitScanReverse64(i32* {{[a-z_ 
]*}}%Index, i64 {{[a-z_ ]*}}%Mask){{.*}}{
 // CHECK-ARM-X64:   [[ISNOTZERO:%[0-9]+]] = icmp eq i64 %Mask, 0
-// CHECK-ARM-X64:   br i1 [[ISNOTZERO]], label %[[END_LABEL:[a-z0-9.]+]], 
label %[[ISNOTZERO_LABEL:[0-9]+]]
+// CHECK-ARM-X64:   br i1 [[ISNOTZERO]], label %[[END_LABEL:[a-z0-9._]+]], 
label %[[ISNOTZERO_LABEL:[a-z0-9._]+]]
 // CHECK-ARM-X64: ; :[[END_LABEL]]:
-// CHECK-ARM-X64:   [[RESULT:%[a-z0-9._]+]] = phi i8 [ 0, 
%[[ISZERO_LABEL:[0-9]+]] ], [ 1, %[[ISNOTZERO_LABEL]] ]
+// CHECK-ARM-X64:   [[RESULT:%[a-z0-9._]+]] = phi i8 [ 0, 
%[[ISZERO_LABEL:[a-z0-9._]+]] ], [ 1, %[[ISNOTZERO_LABEL]] ]
 // CHECK-ARM-X64:   ret i8 [[RESULT]]
 // CHECK-ARM-X64: ; :[[ISNOTZERO_LABEL]]:
 // CHECK-ARM-X64:   [[REVINDEX:%[0-9]+]] = tail call i64 @llvm.ctlz.i64(i64 
%Mask, i1 true)


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


[PATCH] D24991: Inline hot functions in libcxx shared_ptr implementation.

2016-10-12 Thread Kevin Hu via cfe-commits
hxy9243 added a comment.

Thanks for pointing out. It's true that it may cause ABI breakage. It would be 
nice to keep compatibility while getting the performance benefits from inlining.

I've tested the patch with google-benchmark/util_smartptr_libcxx shipped with 
libcxx on x86_64 server, and attached the results as following:

  BASE libcxx r283113:
  $   taskset -c 23 ./util_smartptr.libcxx.out
  Run on (24 X 1200 MHz CPU s)
  2016-10-12 13:52:03
  ***WARNING*** CPU scaling is enabled, the benchmark real time measurements 
may be noisy and will incur extra overhead.
  Benchmark  Time   CPU Iterations
  
  BM_SharedPtrCreateDestroy 54 ns 54 ns   12388755
  BM_SharedPtrIncDecRef 37 ns 37 ns   19021739
  BM_WeakPtrIncDecRef   38 ns 38 ns   18421053
   
  
  
  libcxx with patch:
  $   taskset -c 23 ./util_smartptr.libcxx.out
  Run on (24 X 1200 MHz CPU s)
  2016-10-12 13:48:38
  ***WARNING*** CPU scaling is enabled, the benchmark real time measurements 
may be noisy and will incur extra overhead.
  Benchmark  Time   CPU Iterations
  
  BM_SharedPtrCreateDestroy 44 ns 44 ns   14730639
  BM_SharedPtrIncDecRef 18 ns 18 ns   3889
  BM_WeakPtrIncDecRef   30 ns 30 ns   23648649


Repository:
  rL LLVM

https://reviews.llvm.org/D24991



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


[PATCH] D25534: Implement part of P0031; adding `constexpr` to `reverse_iterator`

2016-10-12 Thread Marshall Clow via cfe-commits
mclow.lists created this revision.
mclow.lists added reviewers: EricWF, lefticus, AntonBikineev.
mclow.lists added a subscriber: cfe-commits.

This just does the `reverse_iterator` bits of http://wg21.link/P0031 - not any 
of the other parts.
This duplicates some (but not all) of the work that was done in 
https://reviews.llvm.org/D20915 and https://reviews.llvm.org/D22584.

The win here (I think) is the extensive tests.


https://reviews.llvm.org/D25534

Files:
  include/iterator
  
test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.cons/default.pass.cpp
  
test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.cons/iter.pass.cpp
  
test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.cons/reverse_iterator.pass.cpp
  
test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.make/make_reverse_iterator.pass.cpp
  
test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op!=/test.pass.cpp
  
test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op++/post.pass.cpp
  
test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op++/pre.pass.cpp
  
test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op+/difference_type.pass.cpp
  
test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op+=/difference_type.pass.cpp
  
test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op--/post.pass.cpp
  
test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op--/pre.pass.cpp
  
test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op-/difference_type.pass.cpp
  
test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op-=/difference_type.pass.cpp
  
test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op.star/op_star.pass.cpp
  
test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op=/reverse_iterator.pass.cpp
  
test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op==/test.pass.cpp
  
test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opdiff/test.pass.cpp
  
test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opgt/test.pass.cpp
  
test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opgt=/test.pass.cpp
  
test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.oplt/test.pass.cpp
  
test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.oplt=/test.pass.cpp
  
test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opref/op_arrow.pass.cpp
  
test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opsum/difference_type.pass.cpp

Index: test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opsum/difference_type.pass.cpp
===
--- test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opsum/difference_type.pass.cpp
+++ test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opsum/difference_type.pass.cpp
@@ -12,12 +12,15 @@
 // reverse_iterator
 
 // template 
-//   reverse_iterator
+//   constexpr reverse_iterator
 //   operator+(Iter::difference_type n, const reverse_iterator& x);
+//
+// constexpr in C++17
 
 #include 
 #include 
 
+#include "test_macros.h"
 #include "test_iterators.h"
 
 template 
@@ -34,4 +37,17 @@
 const char* s = "1234567890";
 test(random_access_iterator(s+5), 5, random_access_iterator(s));
 test(s+5, 5, s);
+
+#if TEST_STD_VER > 14
+	{
+		constexpr const char *p = "123456789";
+		typedef std::reverse_iterator RI;
+		constexpr RI it1 = std::make_reverse_iterator(p);
+		constexpr RI it2 = std::make_reverse_iterator(p + 5);
+		constexpr RI it3 = 5 + it2;
+		static_assert(it1 != it2, "");
+		static_assert(it1 == it3, "");
+		static_assert(it2 != it3, "");
+	}
+#endif
 }
Index: test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opref/op_arrow.pass.cpp
===
--- test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opref/op_arrow.pass.cpp
+++ test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opref/op_arrow.pass.cpp
@@ -11,7 +11,9 @@
 
 // reverse_iterator
 
-// pointer operator->() const;
+// constexpr pointer operator->() const;
+//
+// constexpr in C++17
 
 // Be sure to respect LWG 198:
 //http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#198
@@ -23,6 +25,8 @@
 #include 
 #include 
 
+#include 

r284060 - Implement MS _BitScan intrinsics

2016-10-12 Thread Albert Gutowski via cfe-commits
Author: agutowski
Date: Wed Oct 12 17:01:05 2016
New Revision: 284060

URL: http://llvm.org/viewvc/llvm-project?rev=284060=rev
Log:
Implement MS _BitScan intrinsics

Summary: _BitScan intrinsics (and some others, for example _Interlocked and 
_bittest) are supposed to work on both ARM and x86. This is an attempt to 
isolate them, avoiding repeating their code or writing separate function for 
each builtin.

Reviewers: hans, thakis, rnk, majnemer

Subscribers: RKSimon, cfe-commits, aemerson

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

Modified:
cfe/trunk/include/clang/Basic/BuiltinsARM.def
cfe/trunk/include/clang/Basic/BuiltinsX86.def
cfe/trunk/include/clang/Basic/BuiltinsX86_64.def
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/lib/CodeGen/CGBuiltin.cpp
cfe/trunk/lib/CodeGen/CodeGenFunction.h
cfe/trunk/lib/Headers/intrin.h
cfe/trunk/test/CodeGen/ms-intrinsics.c

Modified: cfe/trunk/include/clang/Basic/BuiltinsARM.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsARM.def?rev=284060=284059=284060=diff
==
--- cfe/trunk/include/clang/Basic/BuiltinsARM.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsARM.def Wed Oct 12 17:01:05 2016
@@ -18,6 +18,10 @@
 #   define LANGBUILTIN(ID, TYPE, ATTRS, BUILTIN_LANG) BUILTIN(ID, TYPE, ATTRS)
 #endif
 
+#if defined(BUILTIN) && !defined(TARGET_HEADER_BUILTIN)
+#  define TARGET_HEADER_BUILTIN(ID, TYPE, ATTRS, HEADER, LANG, FEATURE) 
BUILTIN(ID, TYPE, ATTRS)
+#endif
+
 // In libgcc
 BUILTIN(__clear_cache, "vv*v*", "i")
 
@@ -129,5 +133,11 @@ LANGBUILTIN(_MoveFromCoprocessor2, "UiIU
 LANGBUILTIN(_MoveToCoprocessor, "vUiIUiIUiIUiIUiIUi", "", ALL_MS_LANGUAGES)
 LANGBUILTIN(_MoveToCoprocessor2, "vUiIUiIUiIUiIUiIUi", "", ALL_MS_LANGUAGES)
 
+TARGET_HEADER_BUILTIN(_BitScanForward, "UcULi*ULi", "n", "intrin.h", 
ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_BitScanReverse, "UcULi*ULi", "n", "intrin.h", 
ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_BitScanForward64, "UcULi*ULLi", "n", "intrin.h", 
ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_BitScanReverse64, "UcULi*ULLi", "n", "intrin.h", 
ALL_MS_LANGUAGES, "")
+
 #undef BUILTIN
 #undef LANGBUILTIN
+#undef TARGET_HEADER_BUILTIN

Modified: cfe/trunk/include/clang/Basic/BuiltinsX86.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsX86.def?rev=284060=284059=284060=diff
==
--- cfe/trunk/include/clang/Basic/BuiltinsX86.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsX86.def Wed Oct 12 17:01:05 2016
@@ -2028,6 +2028,10 @@ TARGET_BUILTIN(__builtin_ia32_selectpd_5
 TARGET_BUILTIN(__builtin_ia32_monitorx, "vv*UiUi", "", "mwaitx")
 TARGET_BUILTIN(__builtin_ia32_mwaitx, "vUiUiUi", "", "mwaitx")
 
+// MSVC
+TARGET_HEADER_BUILTIN(_BitScanForward, "UcULi*ULi", "n", "intrin.h", 
ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_BitScanReverse, "UcULi*ULi", "n", "intrin.h", 
ALL_MS_LANGUAGES, "")
+
 TARGET_HEADER_BUILTIN(_ReadWriteBarrier, "v", "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
 TARGET_HEADER_BUILTIN(_ReadBarrier,  "v", "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
 TARGET_HEADER_BUILTIN(_WriteBarrier, "v", "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")

Modified: cfe/trunk/include/clang/Basic/BuiltinsX86_64.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsX86_64.def?rev=284060=284059=284060=diff
==
--- cfe/trunk/include/clang/Basic/BuiltinsX86_64.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsX86_64.def Wed Oct 12 17:01:05 2016
@@ -22,6 +22,9 @@
 #  define TARGET_HEADER_BUILTIN(ID, TYPE, ATTRS, HEADER, LANG, FEATURE) 
BUILTIN(ID, TYPE, ATTRS)
 #endif
 
+TARGET_HEADER_BUILTIN(_BitScanForward64, "UcULi*ULLi", "n", "intrin.h", 
ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_BitScanReverse64, "UcULi*ULLi", "n", "intrin.h", 
ALL_MS_LANGUAGES, "")
+
 TARGET_HEADER_BUILTIN(__mulh,  "LLiLLiLLi","nch", "intrin.h", 
ALL_MS_LANGUAGES, "")
 TARGET_HEADER_BUILTIN(__umulh, "ULLiULLiULLi", "nch", "intrin.h", 
ALL_MS_LANGUAGES, "")
 TARGET_HEADER_BUILTIN(_mul128, "LLiLLiLLiLLi*",  "nh",   "intrin.h", 
ALL_MS_LANGUAGES, "")

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=284060=284059=284060=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Wed Oct 12 17:01:05 2016
@@ -5588,6 +5588,8 @@ const Builtin::Info ARMTargetInfo::Built
   { #ID, TYPE, ATTRS, nullptr, LANG, nullptr },
 #define LIBBUILTIN(ID, TYPE, ATTRS, HEADER) \
   { #ID, TYPE, ATTRS, HEADER, ALL_LANGUAGES, nullptr },
+#define TARGET_HEADER_BUILTIN(ID, TYPE, ATTRS, HEADER, LANGS, FEATURE) \
+  { #ID, TYPE, ATTRS, HEADER, 

[PATCH] D25139: [CUDA] Add Sema::CUDADiagBuilder and Sema::CUDADiagIfDeviceCode().

2016-10-12 Thread Justin Lebar via cfe-commits
jlebar added a comment.

If you're busy with other stuff, that's cool, this is not urgent, but pinging 
in case this got lost.


https://reviews.llvm.org/D25139



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


[PATCH] D25264: Implement MS _BitScan intrinsics

2016-10-12 Thread David Majnemer via cfe-commits
majnemer accepted this revision.
majnemer added a comment.
This revision is now accepted and ready to land.

This looks right to me.


https://reviews.llvm.org/D25264



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


r284055 - Remove basic block label in test case

2016-10-12 Thread Arnold Schwaighofer via cfe-commits
Author: arnolds
Date: Wed Oct 12 16:36:15 2016
New Revision: 284055

URL: http://llvm.org/viewvc/llvm-project?rev=284055=rev
Log:
Remove basic block label in test case

Another attempt to make a bot happy

Modified:
cfe/trunk/test/CodeGen/windows-swiftcall.c

Modified: cfe/trunk/test/CodeGen/windows-swiftcall.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/windows-swiftcall.c?rev=284055=284054=284055=diff
==
--- cfe/trunk/test/CodeGen/windows-swiftcall.c (original)
+++ cfe/trunk/test/CodeGen/windows-swiftcall.c Wed Oct 12 16:36:15 2016
@@ -121,7 +121,6 @@ TEST(struct_1);
 // CHECK:   ret void
 // CHECK: }
 // CHECK-LABEL: define void @test_struct_1() {{.*}}{
-// CHECK: entry:
 // CHECK:   [[AGG:%.*]] = alloca [[STRUCT1:%.*]], align 4
 // CHECK:   [[RET:%.*]] = call swiftcc { i64, i64 } @return_struct_1()
 // CHECK:   [[CAST:%.*]] = bitcast [[STRUCT1]]* [[AGG]] to { i64, i64 }*


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


Re: r284008 - Reinstate r283887 and r283882.

2016-10-12 Thread Manman via cfe-commits

> On Oct 12, 2016, at 1:39 PM, Vassil Vassilev  wrote:
> 
> Hi Manman,
> On 12/10/16 20:28, Manman wrote:
>> Hi Vassil,
>> 
>> Any change between this commit and “r283887 + r283882”?
> The only extra change is in:
> 
> +  bool isThisDeclarationADemotedDefinition() const {
> +return isa(this) ? false :
> +  NonParmVarDeclBits.IsThisDeclarationADemotedDefinition;
> +  }
> 
> The old patch failed because we read the IsThisDeclarationADemotedDefinition 
> bit of ParmVarDecls. We allow demoting only VarDecls, which are not 
> ParmVarDecls, and thus we serialize/deserialize this bit only for non 
> ParmVarDecls. Reading the IsThisDeclarationADemotedDefinition of ParmVarDecls 
> caused random behavior.

Thanks,

Manman

> 
> Cheers,
> Vassil
>> And what was the issue that caused the revert?
>> 
>> Thanks,
>> Manman
>> 
>>> On Oct 12, 2016, at 4:57 AM, Vassil Vassilev via cfe-commits 
>>>  wrote:
>>> 
>>> Author: vvassilev
>>> Date: Wed Oct 12 06:57:08 2016
>>> New Revision: 284008
>>> 
>>> URL: http://llvm.org/viewvc/llvm-project?rev=284008=rev
>>> Log:
>>> Reinstate r283887 and r283882.
>>> 
>>> Original message:
>>> "[modules] PR28752: Do not instantiate variable declarations which are not 
>>> visible.
>>> 
>>> https://reviews.llvm.org/D24508
>>> 
>>> Patch developed in collaboration with Richard Smith!"
>>> 
>>> Added:
>>>cfe/trunk/test/Modules/Inputs/PR28752/
>>>cfe/trunk/test/Modules/Inputs/PR28752/Subdir1/
>>>cfe/trunk/test/Modules/Inputs/PR28752/Subdir1/b.h
>>>cfe/trunk/test/Modules/Inputs/PR28752/Subdir1/c.h
>>>cfe/trunk/test/Modules/Inputs/PR28752/Subdir1/module.modulemap
>>>cfe/trunk/test/Modules/Inputs/PR28752/a.h
>>>cfe/trunk/test/Modules/Inputs/PR28752/module.modulemap
>>>cfe/trunk/test/Modules/Inputs/PR28752/vector
>>>cfe/trunk/test/Modules/pr28752.cpp
>>> Modified:
>>>cfe/trunk/include/clang/AST/Decl.h
>>>cfe/trunk/lib/AST/Decl.cpp
>>>cfe/trunk/lib/Sema/SemaDecl.cpp
>>>cfe/trunk/lib/Sema/SemaTemplate.cpp
>>>cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
>>>cfe/trunk/lib/Sema/SemaType.cpp
>>>cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
>>>cfe/trunk/lib/Serialization/ASTWriterDecl.cpp
>>> 
>>> Modified: cfe/trunk/include/clang/AST/Decl.h
>>> URL: 
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Decl.h?rev=284008=284007=284008=diff
>>> ==
>>> --- cfe/trunk/include/clang/AST/Decl.h (original)
>>> +++ cfe/trunk/include/clang/AST/Decl.h Wed Oct 12 06:57:08 2016
>>> @@ -865,6 +865,11 @@ protected:
>>> 
>>> unsigned : NumVarDeclBits;
>>> 
>>> +// FIXME: We need something similar to CXXRecordDecl::DefinitionData.
>>> +/// \brief Whether this variable is a definition which was demoted due 
>>> to
>>> +/// module merge.
>>> +unsigned IsThisDeclarationADemotedDefinition : 1;
>>> +
>>> /// \brief Whether this variable is the exception variable in a C++ 
>>> catch
>>> /// or an Objective-C @catch statement.
>>> unsigned ExceptionVar : 1;
>>> @@ -1198,12 +1203,28 @@ public:
>>>   InitializationStyle getInitStyle() const {
>>> return static_cast(VarDeclBits.InitStyle);
>>>   }
>>> -
>>>   /// \brief Whether the initializer is a direct-initializer (list or call).
>>>   bool isDirectInit() const {
>>> return getInitStyle() != CInit;
>>>   }
>>> 
>>> +  /// \brief If this definition should pretend to be a declaration.
>>> +  bool isThisDeclarationADemotedDefinition() const {
>>> +return isa(this) ? false :
>>> +  NonParmVarDeclBits.IsThisDeclarationADemotedDefinition;
>>> +  }
>>> +
>>> +  /// \brief This is a definition which should be demoted to a declaration.
>>> +  ///
>>> +  /// In some cases (mostly module merging) we can end up with two visible
>>> +  /// definitions one of which needs to be demoted to a declaration to keep
>>> +  /// the AST invariants.
>>> +  void demoteThisDefinitionToDeclaration() {
>>> +assert (isThisDeclarationADefinition() && "Not a definition!");
>>> +assert (!isa(this) && "Cannot demote ParmVarDecls!");
>>> +NonParmVarDeclBits.IsThisDeclarationADemotedDefinition = 1;
>>> +  }
>>> +
>>>   /// \brief Determine whether this variable is the exception variable in a
>>>   /// C++ catch statememt or an Objective-C \@catch statement.
>>>   bool isExceptionVariable() const {
>>> @@ -1302,6 +1323,10 @@ public:
>>> NonParmVarDeclBits.PreviousDeclInSameBlockScope = Same;
>>>   }
>>> 
>>> +  /// \brief Retrieve the variable declaration from which this variable 
>>> could
>>> +  /// be instantiated, if it is an instantiation (rather than a 
>>> non-template).
>>> +  VarDecl *getTemplateInstantiationPattern() const;
>>> +
>>>   /// \brief If this variable is an instantiated static data member of a
>>>   /// class template specialization, returns the templated static data 
>>> member
>>>   /// from which it 

[PATCH] D25491: [libcxx] Use C++14 when building libc++ with musl

2016-10-12 Thread Petr Hosek via cfe-commits
phosek updated this revision to Diff 74439.
phosek marked an inline comment as done.

Repository:
  rL LLVM

https://reviews.llvm.org/D25491

Files:
  CMakeLists.txt


Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -325,6 +325,11 @@
 
 # Required flags ==
 set(LIBCXX_STANDARD_VER c++11 CACHE INTERNAL "internal option to change build 
dialect")
+if (LIBCXX_HAS_MUSL_LIBC)
+  # musl's pthread implementations uses volatile types in their structs which 
is
+  # not a constexpr in C++11 but is in C++14, so we use C++14 with musl.
+  set(LIBCXX_STANDARD_VER c++14)
+endif()
 add_compile_flags_if_supported(-std=${LIBCXX_STANDARD_VER})
 mangle_name("LIBCXX_SUPPORTS_STD_EQ_${LIBCXX_STANDARD_VER}_FLAG" 
SUPPORTS_DIALECT_NAME)
 if (NOT MSVC AND NOT ${SUPPORTS_DIALECT_NAME})


Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -325,6 +325,11 @@
 
 # Required flags ==
 set(LIBCXX_STANDARD_VER c++11 CACHE INTERNAL "internal option to change build dialect")
+if (LIBCXX_HAS_MUSL_LIBC)
+  # musl's pthread implementations uses volatile types in their structs which is
+  # not a constexpr in C++11 but is in C++14, so we use C++14 with musl.
+  set(LIBCXX_STANDARD_VER c++14)
+endif()
 add_compile_flags_if_supported(-std=${LIBCXX_STANDARD_VER})
 mangle_name("LIBCXX_SUPPORTS_STD_EQ_${LIBCXX_STANDARD_VER}_FLAG" SUPPORTS_DIALECT_NAME)
 if (NOT MSVC AND NOT ${SUPPORTS_DIALECT_NAME})
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D25503: [analyzer] Remove superquadratic behaviour from DataflowWorklist

2016-10-12 Thread Alexander Shaposhnikov via cfe-commits
alexshap updated the summary for this revision.
alexshap updated this revision to Diff 74437.
alexshap added a comment.

Switch to priority queue.
I have rerun the tests - they are all green.
I will post the numbers about the perf a bit later.


Repository:
  rL LLVM

https://reviews.llvm.org/D25503

Files:
  lib/Analysis/LiveVariables.cpp


Index: lib/Analysis/LiveVariables.cpp
===
--- lib/Analysis/LiveVariables.cpp
+++ lib/Analysis/LiveVariables.cpp
@@ -19,6 +19,7 @@
 #include "clang/Analysis/CFG.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/PostOrderIterator.h"
+#include "llvm/ADT/PriorityQueue.h"
 #include "llvm/Support/raw_ostream.h"
 #include 
 #include 
@@ -28,52 +29,44 @@
 namespace {
 
 class DataflowWorklist {
-  SmallVector worklist;
   llvm::BitVector enqueuedBlocks;
   PostOrderCFGView *POV;
+  llvm::PriorityQueue,
+  PostOrderCFGView::BlockOrderCompare> worklist;
+
 public:
   DataflowWorklist(const CFG , AnalysisDeclContext )
 : enqueuedBlocks(cfg.getNumBlockIDs()),
-  POV(Ctx.getAnalysis()) {}
+  POV(Ctx.getAnalysis()),
+  worklist(POV->getComparator()) {}
   
   void enqueueBlock(const CFGBlock *block);
   void enqueuePredecessors(const CFGBlock *block);
 
   const CFGBlock *dequeue();
-
-  void sortWorklist();
 };
 
 }
 
 void DataflowWorklist::enqueueBlock(const clang::CFGBlock *block) {
   if (block && !enqueuedBlocks[block->getBlockID()]) {
 enqueuedBlocks[block->getBlockID()] = true;
-worklist.push_back(block);
+worklist.push(block);
   }
 }
 
 void DataflowWorklist::enqueuePredecessors(const clang::CFGBlock *block) {
-  const unsigned OldWorklistSize = worklist.size();
   for (CFGBlock::const_pred_iterator I = block->pred_begin(),
E = block->pred_end(); I != E; ++I) {
 enqueueBlock(*I);
   }
-  
-  if (OldWorklistSize == 0 || OldWorklistSize == worklist.size())
-return;
-
-  sortWorklist();
-}
-
-void DataflowWorklist::sortWorklist() {
-  std::sort(worklist.begin(), worklist.end(), POV->getComparator());
 }
 
 const CFGBlock *DataflowWorklist::dequeue() {
   if (worklist.empty())
 return nullptr;
-  const CFGBlock *b = worklist.pop_back_val();
+  const CFGBlock *b = worklist.top();
+  worklist.pop();
   enqueuedBlocks[b->getBlockID()] = false;
   return b;
 }
@@ -528,8 +521,6 @@
   }
   }
   
-  worklist.sortWorklist();
-  
   while (const CFGBlock *block = worklist.dequeue()) {
 // Determine if the block's end value has changed.  If not, we
 // have nothing left to do for this block.


Index: lib/Analysis/LiveVariables.cpp
===
--- lib/Analysis/LiveVariables.cpp
+++ lib/Analysis/LiveVariables.cpp
@@ -19,6 +19,7 @@
 #include "clang/Analysis/CFG.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/PostOrderIterator.h"
+#include "llvm/ADT/PriorityQueue.h"
 #include "llvm/Support/raw_ostream.h"
 #include 
 #include 
@@ -28,52 +29,44 @@
 namespace {
 
 class DataflowWorklist {
-  SmallVector worklist;
   llvm::BitVector enqueuedBlocks;
   PostOrderCFGView *POV;
+  llvm::PriorityQueue,
+  PostOrderCFGView::BlockOrderCompare> worklist;
+
 public:
   DataflowWorklist(const CFG , AnalysisDeclContext )
 : enqueuedBlocks(cfg.getNumBlockIDs()),
-  POV(Ctx.getAnalysis()) {}
+  POV(Ctx.getAnalysis()),
+  worklist(POV->getComparator()) {}
   
   void enqueueBlock(const CFGBlock *block);
   void enqueuePredecessors(const CFGBlock *block);
 
   const CFGBlock *dequeue();
-
-  void sortWorklist();
 };
 
 }
 
 void DataflowWorklist::enqueueBlock(const clang::CFGBlock *block) {
   if (block && !enqueuedBlocks[block->getBlockID()]) {
 enqueuedBlocks[block->getBlockID()] = true;
-worklist.push_back(block);
+worklist.push(block);
   }
 }
 
 void DataflowWorklist::enqueuePredecessors(const clang::CFGBlock *block) {
-  const unsigned OldWorklistSize = worklist.size();
   for (CFGBlock::const_pred_iterator I = block->pred_begin(),
E = block->pred_end(); I != E; ++I) {
 enqueueBlock(*I);
   }
-  
-  if (OldWorklistSize == 0 || OldWorklistSize == worklist.size())
-return;
-
-  sortWorklist();
-}
-
-void DataflowWorklist::sortWorklist() {
-  std::sort(worklist.begin(), worklist.end(), POV->getComparator());
 }
 
 const CFGBlock *DataflowWorklist::dequeue() {
   if (worklist.empty())
 return nullptr;
-  const CFGBlock *b = worklist.pop_back_val();
+  const CFGBlock *b = worklist.top();
+  worklist.pop();
   enqueuedBlocks[b->getBlockID()] = false;
   return b;
 }
@@ -528,8 +521,6 @@
   }
   }
   
-  worklist.sortWorklist();
-  
   while (const CFGBlock *block = worklist.dequeue()) {
 // Determine if the block's end value has changed.  If not, we
 // have nothing left to do for this block.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org

[PATCH] D25264: Implement MS _BitScan intrinsics

2016-10-12 Thread Albert Gutowski via cfe-commits
agutowski updated this revision to Diff 74435.
agutowski added a comment.

rebase


https://reviews.llvm.org/D25264

Files:
  include/clang/Basic/BuiltinsARM.def
  include/clang/Basic/BuiltinsX86.def
  include/clang/Basic/BuiltinsX86_64.def
  lib/Basic/Targets.cpp
  lib/CodeGen/CGBuiltin.cpp
  lib/CodeGen/CodeGenFunction.h
  lib/Headers/intrin.h
  test/CodeGen/ms-intrinsics.c

Index: lib/Headers/intrin.h
===
--- lib/Headers/intrin.h
+++ lib/Headers/intrin.h
@@ -432,20 +432,6 @@
 |* Bit Counting and Testing
 \**/
 static __inline__ unsigned char __DEFAULT_FN_ATTRS
-_BitScanForward(unsigned long *_Index, unsigned long _Mask) {
-  if (!_Mask)
-return 0;
-  *_Index = __builtin_ctzl(_Mask);
-  return 1;
-}
-static __inline__ unsigned char __DEFAULT_FN_ATTRS
-_BitScanReverse(unsigned long *_Index, unsigned long _Mask) {
-  if (!_Mask)
-return 0;
-  *_Index = 31 - __builtin_clzl(_Mask);
-  return 1;
-}
-static __inline__ unsigned char __DEFAULT_FN_ATTRS
 _bittest(long const *_BitBase, long _BitPos) {
   return (*_BitBase >> _BitPos) & 1;
 }
@@ -491,20 +477,6 @@
 #endif
 #ifdef __x86_64__
 static __inline__ unsigned char __DEFAULT_FN_ATTRS
-_BitScanForward64(unsigned long *_Index, unsigned __int64 _Mask) {
-  if (!_Mask)
-return 0;
-  *_Index = __builtin_ctzll(_Mask);
-  return 1;
-}
-static __inline__ unsigned char __DEFAULT_FN_ATTRS
-_BitScanReverse64(unsigned long *_Index, unsigned __int64 _Mask) {
-  if (!_Mask)
-return 0;
-  *_Index = 63 - __builtin_clzll(_Mask);
-  return 1;
-}
-static __inline__ unsigned char __DEFAULT_FN_ATTRS
 _bittest64(__int64 const *_BitBase, __int64 _BitPos) {
   return (*_BitBase >> _BitPos) & 1;
 }
Index: lib/CodeGen/CGBuiltin.cpp
===
--- lib/CodeGen/CGBuiltin.cpp
+++ lib/CodeGen/CGBuiltin.cpp
@@ -2637,6 +2637,68 @@
   }
 }
 
+// Many of MSVC builtins are on both x64 and ARM; to avoid repeating code, we
+// handle them here.
+enum class CodeGenFunction::MSVCIntrin {
+  _BitScanForward,
+  _BitScanReverse
+};
+
+Value *CodeGenFunction::EmitMSVCBuiltinExpr(MSVCIntrin BuiltinID,
+const CallExpr *E) {
+  switch (BuiltinID) {
+  case MSVCIntrin::_BitScanForward:
+  case MSVCIntrin::_BitScanReverse: {
+Value *ArgValue = EmitScalarExpr(E->getArg(1));
+
+llvm::Type *ArgType = ArgValue->getType();
+llvm::Type *IndexType =
+EmitScalarExpr(E->getArg(0))->getType()->getPointerElementType();
+llvm::Type *ResultType = ConvertType(E->getType());
+
+Value *ArgZero = llvm::Constant::getNullValue(ArgType);
+Value *ResZero = llvm::Constant::getNullValue(ResultType);
+Value *ResOne = llvm::ConstantInt::get(ResultType, 1);
+
+BasicBlock *Begin = Builder.GetInsertBlock();
+BasicBlock *End = createBasicBlock("bitscan_end", this->CurFn);
+Builder.SetInsertPoint(End);
+PHINode *Result = Builder.CreatePHI(ResultType, 2, "bitscan_result");
+
+Builder.SetInsertPoint(Begin);
+Value *IsZero = Builder.CreateICmpEQ(ArgValue, ArgZero);
+BasicBlock *NotZero = createBasicBlock("bitscan_not_zero", this->CurFn);
+Builder.CreateCondBr(IsZero, End, NotZero);
+Result->addIncoming(ResZero, Begin);
+
+Builder.SetInsertPoint(NotZero);
+Address IndexAddress = EmitPointerWithAlignment(E->getArg(0));
+
+if (BuiltinID == MSVCIntrin::_BitScanForward) {
+  Value *F = CGM.getIntrinsic(Intrinsic::cttz, ArgType);
+  Value *ZeroCount = Builder.CreateCall(F, {ArgValue, Builder.getTrue()});
+  ZeroCount = Builder.CreateIntCast(ZeroCount, IndexType, false);
+  Builder.CreateStore(ZeroCount, IndexAddress, false);
+} else {
+  unsigned ArgWidth = cast(ArgType)->getBitWidth();
+  Value *ArgTypeLastIndex = llvm::ConstantInt::get(IndexType, ArgWidth - 1);
+
+  Value *F = CGM.getIntrinsic(Intrinsic::ctlz, ArgType);
+  Value *ZeroCount = Builder.CreateCall(F, {ArgValue, Builder.getTrue()});
+  ZeroCount = Builder.CreateIntCast(ZeroCount, IndexType, false);
+  Value *Index = Builder.CreateNSWSub(ArgTypeLastIndex, ZeroCount);
+  Builder.CreateStore(Index, IndexAddress, false);
+}
+Builder.CreateBr(End);
+Result->addIncoming(ResOne, NotZero);
+
+Builder.SetInsertPoint(End);
+return Result;
+  }
+  }
+  llvm_unreachable("Incorrect MSVC intrinsic!");
+}
+
 Value *CodeGenFunction::EmitTargetBuiltinExpr(unsigned BuiltinID,
   const CallExpr *E) {
   if (getContext().BuiltinInfo.isAuxBuiltinID(BuiltinID)) {
@@ -4561,6 +4623,12 @@
 return Builder.CreateCall(F, {Ops[1], Ops[2], Ops[0],
   Ops[3], Ops[4], Ops[5]});
   }
+  case ARM::BI_BitScanForward:
+  case ARM::BI_BitScanForward64:
+return EmitMSVCBuiltinExpr(MSVCIntrin::_BitScanForward, E);
+  case 

r284048 - Specify a target cpu in test case

2016-10-12 Thread Arnold Schwaighofer via cfe-commits
Author: arnolds
Date: Wed Oct 12 15:30:24 2016
New Revision: 284048

URL: http://llvm.org/viewvc/llvm-project?rev=284048=rev
Log:
Specify a target cpu in test case

Hopefully, this makes the bots happy

Modified:
cfe/trunk/test/CodeGen/windows-swiftcall.c

Modified: cfe/trunk/test/CodeGen/windows-swiftcall.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/windows-swiftcall.c?rev=284048=284047=284048=diff
==
--- cfe/trunk/test/CodeGen/windows-swiftcall.c (original)
+++ cfe/trunk/test/CodeGen/windows-swiftcall.c Wed Oct 12 15:30:24 2016
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple x86_64-unknown-windows -emit-llvm -o - %s | 
FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-unknown-windows -emit-llvm -target-cpu core2 
-o - %s | FileCheck %s
 
 #define SWIFTCALL __attribute__((swiftcall))
 #define OUT __attribute__((swift_indirect_result))


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


Re: r284008 - Reinstate r283887 and r283882.

2016-10-12 Thread Vassil Vassilev via cfe-commits

Hi Manman,
On 12/10/16 20:28, Manman wrote:

Hi Vassil,

Any change between this commit and “r283887 + r283882”?

The only extra change is in:

+  bool isThisDeclarationADemotedDefinition() const {
+return isa(this) ? false :
+  NonParmVarDeclBits.IsThisDeclarationADemotedDefinition;
+  }

The old patch failed because we read the 
IsThisDeclarationADemotedDefinition bit of ParmVarDecls. We allow 
demoting only VarDecls, which are not ParmVarDecls, and thus we 
serialize/deserialize this bit only for non ParmVarDecls. Reading the 
IsThisDeclarationADemotedDefinition of ParmVarDecls caused random behavior.


Cheers,
Vassil

And what was the issue that caused the revert?

Thanks,
Manman


On Oct 12, 2016, at 4:57 AM, Vassil Vassilev via cfe-commits 
 wrote:

Author: vvassilev
Date: Wed Oct 12 06:57:08 2016
New Revision: 284008

URL: http://llvm.org/viewvc/llvm-project?rev=284008=rev
Log:
Reinstate r283887 and r283882.

Original message:
"[modules] PR28752: Do not instantiate variable declarations which are not 
visible.

https://reviews.llvm.org/D24508

Patch developed in collaboration with Richard Smith!"

Added:
cfe/trunk/test/Modules/Inputs/PR28752/
cfe/trunk/test/Modules/Inputs/PR28752/Subdir1/
cfe/trunk/test/Modules/Inputs/PR28752/Subdir1/b.h
cfe/trunk/test/Modules/Inputs/PR28752/Subdir1/c.h
cfe/trunk/test/Modules/Inputs/PR28752/Subdir1/module.modulemap
cfe/trunk/test/Modules/Inputs/PR28752/a.h
cfe/trunk/test/Modules/Inputs/PR28752/module.modulemap
cfe/trunk/test/Modules/Inputs/PR28752/vector
cfe/trunk/test/Modules/pr28752.cpp
Modified:
cfe/trunk/include/clang/AST/Decl.h
cfe/trunk/lib/AST/Decl.cpp
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Sema/SemaTemplate.cpp
cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
cfe/trunk/lib/Sema/SemaType.cpp
cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
cfe/trunk/lib/Serialization/ASTWriterDecl.cpp

Modified: cfe/trunk/include/clang/AST/Decl.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Decl.h?rev=284008=284007=284008=diff
==
--- cfe/trunk/include/clang/AST/Decl.h (original)
+++ cfe/trunk/include/clang/AST/Decl.h Wed Oct 12 06:57:08 2016
@@ -865,6 +865,11 @@ protected:

 unsigned : NumVarDeclBits;

+// FIXME: We need something similar to CXXRecordDecl::DefinitionData.
+/// \brief Whether this variable is a definition which was demoted due to
+/// module merge.
+unsigned IsThisDeclarationADemotedDefinition : 1;
+
 /// \brief Whether this variable is the exception variable in a C++ catch
 /// or an Objective-C @catch statement.
 unsigned ExceptionVar : 1;
@@ -1198,12 +1203,28 @@ public:
   InitializationStyle getInitStyle() const {
 return static_cast(VarDeclBits.InitStyle);
   }
-
   /// \brief Whether the initializer is a direct-initializer (list or call).
   bool isDirectInit() const {
 return getInitStyle() != CInit;
   }

+  /// \brief If this definition should pretend to be a declaration.
+  bool isThisDeclarationADemotedDefinition() const {
+return isa(this) ? false :
+  NonParmVarDeclBits.IsThisDeclarationADemotedDefinition;
+  }
+
+  /// \brief This is a definition which should be demoted to a declaration.
+  ///
+  /// In some cases (mostly module merging) we can end up with two visible
+  /// definitions one of which needs to be demoted to a declaration to keep
+  /// the AST invariants.
+  void demoteThisDefinitionToDeclaration() {
+assert (isThisDeclarationADefinition() && "Not a definition!");
+assert (!isa(this) && "Cannot demote ParmVarDecls!");
+NonParmVarDeclBits.IsThisDeclarationADemotedDefinition = 1;
+  }
+
   /// \brief Determine whether this variable is the exception variable in a
   /// C++ catch statememt or an Objective-C \@catch statement.
   bool isExceptionVariable() const {
@@ -1302,6 +1323,10 @@ public:
 NonParmVarDeclBits.PreviousDeclInSameBlockScope = Same;
   }

+  /// \brief Retrieve the variable declaration from which this variable could
+  /// be instantiated, if it is an instantiation (rather than a non-template).
+  VarDecl *getTemplateInstantiationPattern() const;
+
   /// \brief If this variable is an instantiated static data member of a
   /// class template specialization, returns the templated static data member
   /// from which it was instantiated.

Modified: cfe/trunk/lib/AST/Decl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Decl.cpp?rev=284008=284007=284008=diff
==
--- cfe/trunk/lib/AST/Decl.cpp (original)
+++ cfe/trunk/lib/AST/Decl.cpp Wed Oct 12 06:57:08 2016
@@ -1926,6 +1926,9 @@ VarDecl::isThisDeclarationADefinition(AS
   //
   // FIXME: How do you declare (but not define) a partial specialization of
   // a static data member template outside the containing 

[libcxx] r284047 - Disable trivial pair copy/move tests when unsupported

2016-10-12 Thread Dimitry Andric via cfe-commits
Author: dim
Date: Wed Oct 12 15:26:47 2016
New Revision: 284047

URL: http://llvm.org/viewvc/llvm-project?rev=284047=rev
Log:
Disable trivial pair copy/move tests when unsupported

Summary:
On FreeBSD, for ABI compatibility reasons, the pair trivial copy
constructor is disabled, using the aptly-named
`_LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR` define.

Disable the related tests when this define is on, so they don't fail
unexpectedly.

Reviewers: emaste, rsmith, theraven, EricWF

Subscribers: cfe-commits

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

Modified:

libcxx/trunk/test/std/utilities/utility/pairs/pairs.pair/trivial_copy_move.pass.cpp

Modified: 
libcxx/trunk/test/std/utilities/utility/pairs/pairs.pair/trivial_copy_move.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/utility/pairs/pairs.pair/trivial_copy_move.pass.cpp?rev=284047=284046=284047=diff
==
--- 
libcxx/trunk/test/std/utilities/utility/pairs/pairs.pair/trivial_copy_move.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/utilities/utility/pairs/pairs.pair/trivial_copy_move.pass.cpp
 Wed Oct 12 15:26:47 2016
@@ -32,19 +32,25 @@ int main()
 typedef std::pair P;
 {
 static_assert(std::is_copy_constructible::value, "");
+#if !defined(_LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR)
 static_assert(std::is_trivially_copy_constructible::value, "");
+#endif
 }
 #if TEST_STD_VER >= 11
 {
 static_assert(std::is_move_constructible::value, "");
+#if !defined(_LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR)
 static_assert(std::is_trivially_move_constructible::value, "");
+#endif
 }
 {
 using P1 = std::pair;
 static_assert(!std::is_copy_constructible::value, "");
 static_assert(!std::is_trivially_copy_constructible::value, "");
 static_assert(std::is_move_constructible::value, "");
+#if !defined(_LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR)
 static_assert(std::is_trivially_move_constructible::value, "");
+#endif
 }
 #endif
 }


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


[PATCH] D25503: [analyzer] Remove superquadratic behaviour from DataflowWorklist

2016-10-12 Thread Alexander Shaposhnikov via cfe-commits
alexshap added inline comments.



Comment at: lib/Analysis/LiveVariables.cpp:66
 return nullptr;
-  const CFGBlock *b = worklist.pop_back_val();
+  const auto I = --worklist.end();
+  const CFGBlock *b = *I;

alexshap wrote:
> alexshap wrote:
> > zaks.anna wrote:
> > > '--wroklist.end()' -> 'worklist.rbegin()'?
> > 1. rbegin - OK - will update the diff
> > 2. regarding http://llvm.org/docs/doxygen/html/classllvm_1_1SparseSet.html 
> > and 
> > http://llvm.org/docs/ProgrammersManual.html#set-like-containers-std-set-smallset-setvector-etc
> > (i took a look at it before) - the problem is that i don't see any 
> > containers which take a custom comparator & provide "ordered set"-like 
> > functionality there.
> > 3. regarding the performance - i can run static analyzer against LLVM and 
> > measure the time (compare the old version with this one). Will post the 
> > results here.  
> 4. Will test the approach suggested by @NoQ as well.
actually it looks like llvm::PriorityQueue might work here - will check.


Repository:
  rL LLVM

https://reviews.llvm.org/D25503



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


[PATCH] D24644: Pass -ffunction-sections/-fdata-sections along to gold-plugin

2016-10-12 Thread Mehdi AMINI via cfe-commits
mehdi_amini accepted this revision.
mehdi_amini added a comment.
This revision is now accepted and ready to land.

LGTM.


https://reviews.llvm.org/D24644



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


[PATCH] D25503: [analyzer] Remove superquadratic behaviour from DataflowWorklist

2016-10-12 Thread Alexander Shaposhnikov via cfe-commits
alexshap added inline comments.



Comment at: lib/Analysis/LiveVariables.cpp:66
 return nullptr;
-  const CFGBlock *b = worklist.pop_back_val();
+  const auto I = --worklist.end();
+  const CFGBlock *b = *I;

alexshap wrote:
> zaks.anna wrote:
> > '--wroklist.end()' -> 'worklist.rbegin()'?
> 1. rbegin - OK - will update the diff
> 2. regarding http://llvm.org/docs/doxygen/html/classllvm_1_1SparseSet.html 
> and 
> http://llvm.org/docs/ProgrammersManual.html#set-like-containers-std-set-smallset-setvector-etc
> (i took a look at it before) - the problem is that i don't see any containers 
> which take a custom comparator & provide "ordered set"-like functionality 
> there.
> 3. regarding the performance - i can run static analyzer against LLVM and 
> measure the time (compare the old version with this one). Will post the 
> results here.  
4. Will test the approach suggested by @NoQ as well.


Repository:
  rL LLVM

https://reviews.llvm.org/D25503



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


[PATCH] D25406: Fix doubled whitespace in modernize-use-auto fixit

2016-10-12 Thread Aaron Ballman via cfe-commits
aaron.ballman added inline comments.



Comment at: clang-tidy/modernize/UseAutoCheck.cpp:378
+  Lexer::getLocForEndOfToken(Range.getEnd(), 0, SM, 
Context->getLangOpts());
+  bool Whitespace = isWhitespace(*FullSourceLoc(Next, SM).getCharacterData());
+

malcolm.parsons wrote:
> aaron.ballman wrote:
> > malcolm.parsons wrote:
> > > aaron.ballman wrote:
> > > > malcolm.parsons wrote:
> > > > > aaron.ballman wrote:
> > > > > > Oye, this is deceptively expensive because you now have to go back 
> > > > > > to the actual source file for this information. That source file 
> > > > > > may live on a network share somewhere, for instance.
> > > > > > 
> > > > > > Can you use `Token::hasLeadingSpace()` instead?
> > > > > > 
> > > > > > Also, doesn't this still need to care about the `RemoveStars` 
> > > > > > option?
> > > > > Where would I get a Token from?
> > > > Hrm, might not be as trivial as I was hoping (I thought we had a way to 
> > > > go from a `SourceLocation` back to a `Token`, but I'm not seeing one 
> > > > off-hand). Regardless, I worry about the expense of going all the way 
> > > > back to the source for this.
> > > > 
> > > > @alexfh -- should this functionality be a part of a more general "we've 
> > > > made a fixit, now make it not look ugly?" pass? At least then, if we go 
> > > > back to the source, we can do it in a more controlled manner and 
> > > > hopefully get some performance back from that.
> > > `LineIsMarkedWithNOLINT` is going to read the source anyway, so I don't 
> > > see any additional expense.
> > The additional expense comes from many checks needing similar functionality 
> > -- generally, fixit replacements are going to require formatting 
> > modifications of some sort. It's better to handle all of those in the same 
> > place and transparently rather than have every check with a fixit manually 
> > handle formatting. Additionally, this means we can go back to the source as 
> > infrequently as possible.
> I ran strace -c on clang-tidy on several real world source files that 
> modernize-use-auto warns about before and after this change and the counts 
> for read, write, stat, open, close, openat and fstat syscalls were all 
> unchanged.
> The expense is exactly zero.
> It will still be zero when multiplied by many checks.
> There is no performance issue here.
> Do you have any other issues with this change?
Thank you for running strace to see what the behavior is. From what I 
understand, this is hard to judge because it depends on when the SourceManager 
elects to drop its underlying memory buffer (if at all). We definitely try to 
avoid going back to source when possible in Clang; I think clang-tidy should 
take a similar policy.

I don't think the fix you have is incorrect. I am, however, not convinced this 
is the best way to solve the problem because we're playing whack-a-mole with 
fixing replacements already, and this is one more instance of such need. 
@alexfh had suggested (in a different review thread about a similar need) that 
we solve this through a convenient bottleneck (such as the diagnostics engine) 
that basically runs clang-format over replaced text, handles extraneous commas, 
etc and I would prefer to hear if efforts are being made/planned for that 
approach before committing another one-off solution. The extra space included 
in the current behavior is not a correctness issue, so I'm not too worried 
about getting this fix in immediately if there's work in progress on a better 
approach.


https://reviews.llvm.org/D25406



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


[PATCH] D25503: [analyzer] Remove superquadratic behaviour from DataflowWorklist

2016-10-12 Thread Alexander Shaposhnikov via cfe-commits
alexshap added inline comments.



Comment at: lib/Analysis/LiveVariables.cpp:66
 return nullptr;
-  const CFGBlock *b = worklist.pop_back_val();
+  const auto I = --worklist.end();
+  const CFGBlock *b = *I;

zaks.anna wrote:
> '--wroklist.end()' -> 'worklist.rbegin()'?
1. rbegin - OK - will update the diff
2. regarding http://llvm.org/docs/doxygen/html/classllvm_1_1SparseSet.html and 
http://llvm.org/docs/ProgrammersManual.html#set-like-containers-std-set-smallset-setvector-etc
(i took a look at it before) - the problem is that i don't see any containers 
which take a custom comparator & provide "ordered set"-like functionality there.
3. regarding the performance - i can run static analyzer against LLVM and 
measure the time (compare the old version with this one). Will post the results 
here.  


Repository:
  rL LLVM

https://reviews.llvm.org/D25503



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


[PATCH] D25406: Fix doubled whitespace in modernize-use-auto fixit

2016-10-12 Thread Malcolm Parsons via cfe-commits
malcolm.parsons added inline comments.



Comment at: clang-tidy/modernize/UseAutoCheck.cpp:378
+  Lexer::getLocForEndOfToken(Range.getEnd(), 0, SM, 
Context->getLangOpts());
+  bool Whitespace = isWhitespace(*FullSourceLoc(Next, SM).getCharacterData());
+

aaron.ballman wrote:
> malcolm.parsons wrote:
> > aaron.ballman wrote:
> > > malcolm.parsons wrote:
> > > > aaron.ballman wrote:
> > > > > Oye, this is deceptively expensive because you now have to go back to 
> > > > > the actual source file for this information. That source file may 
> > > > > live on a network share somewhere, for instance.
> > > > > 
> > > > > Can you use `Token::hasLeadingSpace()` instead?
> > > > > 
> > > > > Also, doesn't this still need to care about the `RemoveStars` option?
> > > > Where would I get a Token from?
> > > Hrm, might not be as trivial as I was hoping (I thought we had a way to 
> > > go from a `SourceLocation` back to a `Token`, but I'm not seeing one 
> > > off-hand). Regardless, I worry about the expense of going all the way 
> > > back to the source for this.
> > > 
> > > @alexfh -- should this functionality be a part of a more general "we've 
> > > made a fixit, now make it not look ugly?" pass? At least then, if we go 
> > > back to the source, we can do it in a more controlled manner and 
> > > hopefully get some performance back from that.
> > `LineIsMarkedWithNOLINT` is going to read the source anyway, so I don't see 
> > any additional expense.
> The additional expense comes from many checks needing similar functionality 
> -- generally, fixit replacements are going to require formatting 
> modifications of some sort. It's better to handle all of those in the same 
> place and transparently rather than have every check with a fixit manually 
> handle formatting. Additionally, this means we can go back to the source as 
> infrequently as possible.
I ran strace -c on clang-tidy on several real world source files that 
modernize-use-auto warns about before and after this change and the counts for 
read, write, stat, open, close, openat and fstat syscalls were all unchanged.
The expense is exactly zero.
It will still be zero when multiplied by many checks.
There is no performance issue here.
Do you have any other issues with this change?


https://reviews.llvm.org/D25406



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


[PATCH] D25531: [libcxx] [test] Include in string_view::copy test

2016-10-12 Thread Billy Robert O'Neal III via cfe-commits
BillyONeal added a comment.

No, I don't believe any of us in MSVC++ land have commit access.


https://reviews.llvm.org/D25531



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


[PATCH] D25531: [libcxx] [test] Include in string_view::copy test

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

@BillyONeal Do you have commit access?


https://reviews.llvm.org/D25531



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


[PATCH] D25531: [libcxx] [test] Include in string_view::copy test

2016-10-12 Thread Billy Robert O'Neal III via cfe-commits
BillyONeal created this revision.
BillyONeal added reviewers: EricWF, mclow.lists.
BillyONeal added a subscriber: cfe-commits.

The string_view::copy test calls std::min, which is not required to be
made available by including .

(The MSVC++ STL does not use std::min internally because we need to
avoid the *macro* named min which is defined by windows.h)


https://reviews.llvm.org/D25531

Files:
  test/std/strings/string.view/string.view.ops/copy.pass.cpp


Index: test/std/strings/string.view/string.view.ops/copy.pass.cpp
===
--- test/std/strings/string.view/string.view.ops/copy.pass.cpp
+++ test/std/strings/string.view/string.view.ops/copy.pass.cpp
@@ -19,6 +19,7 @@
 
 
 #include 
+#include 
 #include 
 
 #include "test_macros.h"


Index: test/std/strings/string.view/string.view.ops/copy.pass.cpp
===
--- test/std/strings/string.view/string.view.ops/copy.pass.cpp
+++ test/std/strings/string.view/string.view.ops/copy.pass.cpp
@@ -19,6 +19,7 @@
 
 
 #include 
+#include 
 #include 
 
 #include "test_macros.h"
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r284032 - Declare WinX86_64ABIInfo to satisfy SwiftABI info

2016-10-12 Thread Arnold Schwaighofer via cfe-commits
Author: arnolds
Date: Wed Oct 12 13:59:24 2016
New Revision: 284032

URL: http://llvm.org/viewvc/llvm-project?rev=284032=rev
Log:
Declare WinX86_64ABIInfo to satisfy SwiftABI info

This is minimal support that allows swift's test cases on non windows platforms
to pass.

rdar://28738985

Added:
cfe/trunk/test/CodeGen/windows-swiftcall.c
Modified:
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/lib/CodeGen/TargetInfo.cpp
cfe/trunk/test/Sema/attr-swiftcall.c

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=284032=284031=284032=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Wed Oct 12 13:59:24 2016
@@ -4551,6 +4551,7 @@ public:
 case CC_X86VectorCall:
 case CC_IntelOclBicc:
 case CC_X86_64SysV:
+case CC_Swift:
   return CCCR_OK;
 default:
   return CCCR_Warning;

Modified: cfe/trunk/lib/CodeGen/TargetInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/TargetInfo.cpp?rev=284032=284031=284032=diff
==
--- cfe/trunk/lib/CodeGen/TargetInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/TargetInfo.cpp Wed Oct 12 13:59:24 2016
@@ -2003,10 +2003,10 @@ public:
 };
 
 /// WinX86_64ABIInfo - The Windows X86_64 ABI information.
-class WinX86_64ABIInfo : public ABIInfo {
+class WinX86_64ABIInfo : public SwiftABIInfo {
 public:
   WinX86_64ABIInfo(CodeGen::CodeGenTypes )
-  : ABIInfo(CGT),
+  : SwiftABIInfo(CGT),
 IsMingw64(getTarget().getTriple().isWindowsGNUEnvironment()) {}
 
   void computeInfo(CGFunctionInfo ) const override;
@@ -2025,6 +2025,12 @@ public:
 return isX86VectorCallAggregateSmallEnough(NumMembers);
   }
 
+  bool shouldPassIndirectlyForSwift(CharUnits totalSize,
+ArrayRef scalars,
+bool asReturnValue) const override {
+return occupiesMoreThan(CGT, scalars, /*total*/ 4);
+  }
+
 private:
   ABIArgInfo classify(QualType Ty, unsigned ,
   bool IsReturnType) const;

Added: cfe/trunk/test/CodeGen/windows-swiftcall.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/windows-swiftcall.c?rev=284032=auto
==
--- cfe/trunk/test/CodeGen/windows-swiftcall.c (added)
+++ cfe/trunk/test/CodeGen/windows-swiftcall.c Wed Oct 12 13:59:24 2016
@@ -0,0 +1,459 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-windows -emit-llvm -o - %s | 
FileCheck %s
+
+#define SWIFTCALL __attribute__((swiftcall))
+#define OUT __attribute__((swift_indirect_result))
+#define ERROR __attribute__((swift_error_result))
+#define CONTEXT __attribute__((swift_context))
+
+// CHECK: [[STRUCT2_RESULT:@.*]] = private {{.*}} constant 
[[STRUCT2_TYPE:%.*]] { i32 0, i8 0, i8 undef, i8 0, float 0.00e+00, float 
0.00e+00 }
+
+/*/
+/** PARAMETER ABIS ***/
+/*/
+
+SWIFTCALL void indirect_result_1(OUT int *arg0, OUT float *arg1) {}
+// CHECK-LABEL: define {{.*}} void @indirect_result_1(i32* noalias sret align 
4 dereferenceable(4){{.*}}, float* noalias align 4 dereferenceable(4){{.*}})
+
+// TODO: maybe this shouldn't suppress sret.
+SWIFTCALL int indirect_result_2(OUT int *arg0, OUT float *arg1) {  
__builtin_unreachable(); }
+// CHECK-LABEL: define {{.*}} i32 @indirect_result_2(i32* noalias align 4 
dereferenceable(4){{.*}}, float* noalias align 4 dereferenceable(4){{.*}})
+
+typedef struct { char array[1024]; } struct_reallybig;
+SWIFTCALL struct_reallybig indirect_result_3(OUT int *arg0, OUT float *arg1) { 
__builtin_unreachable(); }
+// CHECK-LABEL: define {{.*}} void @indirect_result_3({{.*}}* noalias sret 
{{.*}}, i32* noalias align 4 dereferenceable(4){{.*}}, float* noalias align 4 
dereferenceable(4){{.*}})
+
+SWIFTCALL void context_1(CONTEXT void *self) {}
+// CHECK-LABEL: define {{.*}} void @context_1(i8* swiftself
+
+SWIFTCALL void context_2(void *arg0, CONTEXT void *self) {}
+// CHECK-LABEL: define {{.*}} void @context_2(i8*{{.*}}, i8* swiftself
+
+SWIFTCALL void context_error_1(CONTEXT int *self, ERROR float **error) {}
+// CHECK-LABEL: define {{.*}} void @context_error_1(i32* swiftself{{.*}}, 
float** swifterror)
+// CHECK:   [[TEMP:%.*]] = alloca float*, align 8
+// CHECK:   [[T0:%.*]] = load float*, float** [[ERRORARG:%.*]], align 8
+// CHECK:   store float* [[T0]], float** [[TEMP]], align 8
+// CHECK:   [[T0:%.*]] = load float*, float** [[TEMP]], align 8
+// CHECK:   store float* [[T0]], float** [[ERRORARG]], align 8
+void test_context_error_1() {
+  int x;
+  float *error;
+  context_error_1(, );

[PATCH] D25503: [analyzer] Remove superquadratic behaviour from DataflowWorklist

2016-10-12 Thread Artem Dergachev via cfe-commits
NoQ added a reviewer: a.sidorin.
NoQ added a comment.

This looks familiar, i think i've seen significant slowdowns around there on 
some very rare files. Nice catch! Probably a binary-search insert could have 
also been much better than re-sorting, even if it's still a vector.


Repository:
  rL LLVM

https://reviews.llvm.org/D25503



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


[PATCH] D25439: Fixed column shift when formatting line containing bit shift operators

2016-10-12 Thread Paweł Żukowski via cfe-commits
idlecode updated this revision to Diff 74412.

https://reviews.llvm.org/D25439

Files:
  lib/Format/FormatTokenLexer.cpp
  unittests/Format/FormatTest.cpp


Index: unittests/Format/FormatTest.cpp
===
--- unittests/Format/FormatTest.cpp
+++ unittests/Format/FormatTest.cpp
@@ -11361,6 +11361,16 @@
"llvm::outs()\n<<");
 }
 
+TEST_F(FormatTest, BitshiftOperatorWidth) {
+  std::string left = "int a = 1 << 2; /* foo\n"
+ "   bar */";
+  EXPECT_EQ(left, format(left));
+
+  std::string right = "int b = 256 >> 2; /* foo\n"
+  " bar */";
+  EXPECT_EQ(right, format(right));
+}
+
 TEST_F(FormatTest, HandleUnbalancedImplicitBracesAcrossPPBranches) {
   std::string code = "#if A\n"
  "#if B\n"
Index: lib/Format/FormatTokenLexer.cpp
===
--- lib/Format/FormatTokenLexer.cpp
+++ lib/Format/FormatTokenLexer.cpp
@@ -525,10 +525,12 @@
   } else if (FormatTok->Tok.is(tok::greatergreater)) {
 FormatTok->Tok.setKind(tok::greater);
 FormatTok->TokenText = FormatTok->TokenText.substr(0, 1);
+Column += 1;
 StateStack.push(LexerState::TOKEN_STASHED);
   } else if (FormatTok->Tok.is(tok::lessless)) {
 FormatTok->Tok.setKind(tok::less);
 FormatTok->TokenText = FormatTok->TokenText.substr(0, 1);
+Column += 1;
 StateStack.push(LexerState::TOKEN_STASHED);
   }
 


Index: unittests/Format/FormatTest.cpp
===
--- unittests/Format/FormatTest.cpp
+++ unittests/Format/FormatTest.cpp
@@ -11361,6 +11361,16 @@
"llvm::outs()\n<<");
 }
 
+TEST_F(FormatTest, BitshiftOperatorWidth) {
+  std::string left = "int a = 1 << 2; /* foo\n"
+ "   bar */";
+  EXPECT_EQ(left, format(left));
+
+  std::string right = "int b = 256 >> 2; /* foo\n"
+  " bar */";
+  EXPECT_EQ(right, format(right));
+}
+
 TEST_F(FormatTest, HandleUnbalancedImplicitBracesAcrossPPBranches) {
   std::string code = "#if A\n"
  "#if B\n"
Index: lib/Format/FormatTokenLexer.cpp
===
--- lib/Format/FormatTokenLexer.cpp
+++ lib/Format/FormatTokenLexer.cpp
@@ -525,10 +525,12 @@
   } else if (FormatTok->Tok.is(tok::greatergreater)) {
 FormatTok->Tok.setKind(tok::greater);
 FormatTok->TokenText = FormatTok->TokenText.substr(0, 1);
+Column += 1;
 StateStack.push(LexerState::TOKEN_STASHED);
   } else if (FormatTok->Tok.is(tok::lessless)) {
 FormatTok->Tok.setKind(tok::less);
 FormatTok->TokenText = FormatTok->TokenText.substr(0, 1);
+Column += 1;
 StateStack.push(LexerState::TOKEN_STASHED);
   }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D25503: [analyzer] Remove superquadratic behaviour from DataflowWorklist

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

Do you have results that show how this effects performance on average code and 
machine generated code?

One concern is that multiset is malloc intensive. See 
http://llvm.org/docs/ProgrammersManual.html#picking-the-right-data-structure-for-a-task.

Maybe SparseSet/SparseMultiSet would be better?




Comment at: lib/Analysis/LiveVariables.cpp:66
 return nullptr;
-  const CFGBlock *b = worklist.pop_back_val();
+  const auto I = --worklist.end();
+  const CFGBlock *b = *I;

'--wroklist.end()' -> 'worklist.rbegin()'?


Repository:
  rL LLVM

https://reviews.llvm.org/D25503



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


[PATCH] D25491: [libcxx] Use C++14 when building libc++ with musl

2016-10-12 Thread Hal Finkel via cfe-commits
hfinkel added inline comments.



Comment at: CMakeLists.txt:327
 # Required flags ==
 set(LIBCXX_STANDARD_VER c++11 CACHE INTERNAL "internal option to change build 
dialect")
 add_compile_flags_if_supported(-std=${LIBCXX_STANDARD_VER})

EricWF wrote:
> phosek wrote:
> > EricWF wrote:
> > > Why not just set `LIBCXX_STANDARD_VER` differently instead of replacing 
> > > it after the fact?
> > I totally missed it; this change was a part of a downstream patch we were 
> > using for building Fuchsia toolchain and it predates this option. Using 
> > this option, I can override the dialect only for our build, which is 
> > perfectly fine for Fuchsia since we default to C++14. I'd be happy to 
> > abandon this patch unless you want to persist that setting for musl?
> Since we support MUSL it would be nice if libc++ built out of the box. Making 
> the option persistent for MUSL makes the most sense to me.
We should add a comment here, or where ever this logic ends up going, to 
explain why this is needed.


Repository:
  rL LLVM

https://reviews.llvm.org/D25491



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


r284029 - Document potential implementation of CFI in hardware.

2016-10-12 Thread Kostya Serebryany via cfe-commits
Author: kcc
Date: Wed Oct 12 13:33:54 2016
New Revision: 284029

URL: http://llvm.org/viewvc/llvm-project?rev=284029=rev
Log:
Document potential implementation of CFI in hardware.

Summary: Document potential implementation of CFI in hardware.

Reviewers: eugenis, pcc

Subscribers: llvm-commits

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

Modified:
cfe/trunk/docs/ControlFlowIntegrityDesign.rst

Modified: cfe/trunk/docs/ControlFlowIntegrityDesign.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ControlFlowIntegrityDesign.rst?rev=284029=284028=284029=diff
==
--- cfe/trunk/docs/ControlFlowIntegrityDesign.rst (original)
+++ cfe/trunk/docs/ControlFlowIntegrityDesign.rst Wed Oct 12 13:33:54 2016
@@ -497,3 +497,57 @@ Cross-DSO CFI mode requires that the mai
 In non-PIE executables the address of an external function (taken from
 the main executable) is the address of that function’s PLT record in
 the main executable. This would break the CFI checks.
+
+
+Hardware support
+
+
+We believe that the above design can be efficiently implemented in hardware.
+A single new instruction added to an ISA would allow to perform the CFI check
+with fewer bytes per check (smaller code size overhead) and potentially more
+efficiently. The current software-only instrumentation requires at least
+32-bytes per check (on x86_64).
+A hardware instruction may probably be less than ~ 12 bytes.
+Such instruction would check that the argument pointer is in-bounds,
+and is properly aligned, and if the checks fail it will either trap (in 
monolithic scheme)
+or call the slow path function (cross-DSO scheme).
+The bit vector lookup is probably too complex for a hardware implementation.
+
+.. code-block:: none
+
+  //  This instruction checks that 'Ptr'
+  //   * is aligned by (1 << kAlignment) and
+  //   * is inside [kRangeBeg, kRangeBeg+(kRangeSize<= kRangeBeg + (kRangeSize << kAlignment) ||
+ Ptr & ((1 << kAlignment) - 1))
+   Jump(kFailedCheckTarget);
+  }
+
+An alternative and more compact enconding would not use `kFailedCheckTarget`,
+and will trap on check failure instead.
+This will allow us to fit the instruction into **8-9 bytes**.
+The cross-DSO checks will be performed by a trap handler and
+performance-critical ones will have to be black-listed and checked using the
+software-only scheme.
+
+Note that such hardware extension would be complementary to checks
+at the callee side, such as e.g. **Intel ENDBRANCH**.
+Moreover, CFI would have two benefits over ENDBRANCH: a) precision and b)
+ability to protect against invalid casts between polymorphic types.


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


[PATCH] D25520: [CodeCompletion] Add block placeholders when completing member access for Objective-C block property setters

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

What if the user just wants to invoke the block, this is as common or more, 
like:

`self.onEventHandler(10)`

The assign literal completion is useful but it should be an additional entry 
(with maybe lower priority) not replace the property completion.
BTW, it would be great we had completion as if it was a function call, so 2 
entries, 1 for block invocation and 1 for assigning literal. Absence the block 
invocation call it should be 1 for normal property completion and 1 for 
assigning literal.


Repository:
  rL LLVM

https://reviews.llvm.org/D25520



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


Re: r284008 - Reinstate r283887 and r283882.

2016-10-12 Thread Manman via cfe-commits
Hi Vassil,

Any change between this commit and “r283887 + r283882”?
And what was the issue that caused the revert?

Thanks,
Manman

> On Oct 12, 2016, at 4:57 AM, Vassil Vassilev via cfe-commits 
>  wrote:
> 
> Author: vvassilev
> Date: Wed Oct 12 06:57:08 2016
> New Revision: 284008
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=284008=rev
> Log:
> Reinstate r283887 and r283882.
> 
> Original message:
> "[modules] PR28752: Do not instantiate variable declarations which are not 
> visible.
> 
> https://reviews.llvm.org/D24508
> 
> Patch developed in collaboration with Richard Smith!"
> 
> Added:
>cfe/trunk/test/Modules/Inputs/PR28752/
>cfe/trunk/test/Modules/Inputs/PR28752/Subdir1/
>cfe/trunk/test/Modules/Inputs/PR28752/Subdir1/b.h
>cfe/trunk/test/Modules/Inputs/PR28752/Subdir1/c.h
>cfe/trunk/test/Modules/Inputs/PR28752/Subdir1/module.modulemap
>cfe/trunk/test/Modules/Inputs/PR28752/a.h
>cfe/trunk/test/Modules/Inputs/PR28752/module.modulemap
>cfe/trunk/test/Modules/Inputs/PR28752/vector
>cfe/trunk/test/Modules/pr28752.cpp
> Modified:
>cfe/trunk/include/clang/AST/Decl.h
>cfe/trunk/lib/AST/Decl.cpp
>cfe/trunk/lib/Sema/SemaDecl.cpp
>cfe/trunk/lib/Sema/SemaTemplate.cpp
>cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
>cfe/trunk/lib/Sema/SemaType.cpp
>cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
>cfe/trunk/lib/Serialization/ASTWriterDecl.cpp
> 
> Modified: cfe/trunk/include/clang/AST/Decl.h
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Decl.h?rev=284008=284007=284008=diff
> ==
> --- cfe/trunk/include/clang/AST/Decl.h (original)
> +++ cfe/trunk/include/clang/AST/Decl.h Wed Oct 12 06:57:08 2016
> @@ -865,6 +865,11 @@ protected:
> 
> unsigned : NumVarDeclBits;
> 
> +// FIXME: We need something similar to CXXRecordDecl::DefinitionData.
> +/// \brief Whether this variable is a definition which was demoted due to
> +/// module merge.
> +unsigned IsThisDeclarationADemotedDefinition : 1;
> +
> /// \brief Whether this variable is the exception variable in a C++ catch
> /// or an Objective-C @catch statement.
> unsigned ExceptionVar : 1;
> @@ -1198,12 +1203,28 @@ public:
>   InitializationStyle getInitStyle() const {
> return static_cast(VarDeclBits.InitStyle);
>   }
> -
>   /// \brief Whether the initializer is a direct-initializer (list or call).
>   bool isDirectInit() const {
> return getInitStyle() != CInit;
>   }
> 
> +  /// \brief If this definition should pretend to be a declaration.
> +  bool isThisDeclarationADemotedDefinition() const {
> +return isa(this) ? false :
> +  NonParmVarDeclBits.IsThisDeclarationADemotedDefinition;
> +  }
> +
> +  /// \brief This is a definition which should be demoted to a declaration.
> +  ///
> +  /// In some cases (mostly module merging) we can end up with two visible
> +  /// definitions one of which needs to be demoted to a declaration to keep
> +  /// the AST invariants.
> +  void demoteThisDefinitionToDeclaration() {
> +assert (isThisDeclarationADefinition() && "Not a definition!");
> +assert (!isa(this) && "Cannot demote ParmVarDecls!");
> +NonParmVarDeclBits.IsThisDeclarationADemotedDefinition = 1;
> +  }
> +
>   /// \brief Determine whether this variable is the exception variable in a
>   /// C++ catch statememt or an Objective-C \@catch statement.
>   bool isExceptionVariable() const {
> @@ -1302,6 +1323,10 @@ public:
> NonParmVarDeclBits.PreviousDeclInSameBlockScope = Same;
>   }
> 
> +  /// \brief Retrieve the variable declaration from which this variable could
> +  /// be instantiated, if it is an instantiation (rather than a 
> non-template).
> +  VarDecl *getTemplateInstantiationPattern() const;
> +
>   /// \brief If this variable is an instantiated static data member of a
>   /// class template specialization, returns the templated static data member
>   /// from which it was instantiated.
> 
> Modified: cfe/trunk/lib/AST/Decl.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Decl.cpp?rev=284008=284007=284008=diff
> ==
> --- cfe/trunk/lib/AST/Decl.cpp (original)
> +++ cfe/trunk/lib/AST/Decl.cpp Wed Oct 12 06:57:08 2016
> @@ -1926,6 +1926,9 @@ VarDecl::isThisDeclarationADefinition(AS
>   //
>   // FIXME: How do you declare (but not define) a partial specialization of
>   // a static data member template outside the containing class?
> +  if (isThisDeclarationADemotedDefinition())
> +return DeclarationOnly;
> +
>   if (isStaticDataMember()) {
> if (isOutOfLine() &&
> !(getCanonicalDecl()->isInline() &&
> @@ -2250,6 +2253,56 @@ bool VarDecl::checkInitIsICE() const {
>   return Eval->IsICE;
> }
> 
> +VarDecl *VarDecl::getTemplateInstantiationPattern() const {
> +  // If it's a variable template 

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

2016-10-12 Thread Aaron Ballman via cfe-commits
aaron.ballman added inline comments.



Comment at: include/clang/Basic/AttrDocs.td:612
+  let Content = [{
+The ``convergent`` attribute can be placed on function declarations. It is
+translated to LLVM ``convergent`` attribute, which indicates the call

on a function declaration



Comment at: include/clang/Basic/AttrDocs.td:613
+The ``convergent`` attribute can be placed on function declarations. It is
+translated to LLVM ``convergent`` attribute, which indicates the call
+instructions of a function with this attribute cannot be made control-dependent

s/to/into the
s/the call/that the call



Comment at: include/clang/Basic/AttrDocs.td:621
+
+This attribute is different from ``noduplicate`` since it allows duplicating
+function calls if it can be proved that the duplicated function calls are

s/since/because



Comment at: include/clang/Basic/AttrDocs.td:629
+
+  void convfunc() __attribute__((convergent));
+  // Setting it as a C++11 attribute is also valid

Since this is a C block, perhaps that should be `void convfunc(void)` instead?



Comment at: test/CodeGenOpenCL/convergent.cl:118
+// CHECK-DAG: attributes #[[attr5]] = { {{[^}]*}}convergent{{[^}]*}} }
+// CHECK-DAG: attributes #[[attr6]] = { {{[^}]*}}noduplicate{{[^}]*}} }

Missing the Sema tests for the attribute's semantics (applies only to 
functions, accepts no args, etc).


https://reviews.llvm.org/D25343



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


[PATCH] D25406: Fix doubled whitespace in modernize-use-auto fixit

2016-10-12 Thread Aaron Ballman via cfe-commits
aaron.ballman added inline comments.



Comment at: clang-tidy/modernize/UseAutoCheck.cpp:378
+  Lexer::getLocForEndOfToken(Range.getEnd(), 0, SM, 
Context->getLangOpts());
+  bool Whitespace = isWhitespace(*FullSourceLoc(Next, SM).getCharacterData());
+

malcolm.parsons wrote:
> aaron.ballman wrote:
> > malcolm.parsons wrote:
> > > aaron.ballman wrote:
> > > > Oye, this is deceptively expensive because you now have to go back to 
> > > > the actual source file for this information. That source file may live 
> > > > on a network share somewhere, for instance.
> > > > 
> > > > Can you use `Token::hasLeadingSpace()` instead?
> > > > 
> > > > Also, doesn't this still need to care about the `RemoveStars` option?
> > > Where would I get a Token from?
> > Hrm, might not be as trivial as I was hoping (I thought we had a way to go 
> > from a `SourceLocation` back to a `Token`, but I'm not seeing one 
> > off-hand). Regardless, I worry about the expense of going all the way back 
> > to the source for this.
> > 
> > @alexfh -- should this functionality be a part of a more general "we've 
> > made a fixit, now make it not look ugly?" pass? At least then, if we go 
> > back to the source, we can do it in a more controlled manner and hopefully 
> > get some performance back from that.
> `LineIsMarkedWithNOLINT` is going to read the source anyway, so I don't see 
> any additional expense.
The additional expense comes from many checks needing similar functionality -- 
generally, fixit replacements are going to require formatting modifications of 
some sort. It's better to handle all of those in the same place and 
transparently rather than have every check with a fixit manually handle 
formatting. Additionally, this means we can go back to the source as 
infrequently as possible.


https://reviews.llvm.org/D25406



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


[PATCH] D25491: [libcxx] Use C++14 when building libc++ with musl

2016-10-12 Thread Petr Hosek via cfe-commits
phosek updated this revision to Diff 74402.
phosek marked an inline comment as done.

Repository:
  rL LLVM

https://reviews.llvm.org/D25491

Files:
  CMakeLists.txt


Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -325,6 +325,9 @@
 
 # Required flags ==
 set(LIBCXX_STANDARD_VER c++11 CACHE INTERNAL "internal option to change build 
dialect")
+if (LIBCXX_HAS_MUSL_LIBC)
+  set(LIBCXX_STANDARD_VER c++14)
+endif()
 add_compile_flags_if_supported(-std=${LIBCXX_STANDARD_VER})
 mangle_name("LIBCXX_SUPPORTS_STD_EQ_${LIBCXX_STANDARD_VER}_FLAG" 
SUPPORTS_DIALECT_NAME)
 if (NOT MSVC AND NOT ${SUPPORTS_DIALECT_NAME})


Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -325,6 +325,9 @@
 
 # Required flags ==
 set(LIBCXX_STANDARD_VER c++11 CACHE INTERNAL "internal option to change build dialect")
+if (LIBCXX_HAS_MUSL_LIBC)
+  set(LIBCXX_STANDARD_VER c++14)
+endif()
 add_compile_flags_if_supported(-std=${LIBCXX_STANDARD_VER})
 mangle_name("LIBCXX_SUPPORTS_STD_EQ_${LIBCXX_STANDARD_VER}_FLAG" SUPPORTS_DIALECT_NAME)
 if (NOT MSVC AND NOT ${SUPPORTS_DIALECT_NAME})
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D22955: [MSVC] Improved late parsing of template functions.

2016-10-12 Thread David Majnemer via cfe-commits
majnemer added inline comments.



Comment at: lib/Sema/SemaLookup.cpp:1044-1070
+static bool isBaseClass(const CXXRecordDecl *Record, CXXRecordDecl *Base) {
+  SmallVector Queue;
+
+  while (true) {
+for (const auto  : Record->bases()) {
+  const RecordType *Ty = I.getType()->getAs();
+  if (!Ty)

This looks a lot like forallBases, any chance it could be reused?


https://reviews.llvm.org/D22955



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


[PATCH] D25519: [CodeCompletion] Refactor: Extract two Objective-C block formatting related functions from FormatFunctionParameter

2016-10-12 Thread Manman Ren via cfe-commits
manmanren added a comment.

Cheers,
Manman




Comment at: lib/Sema/SemaCodeComplete.cpp:2165
 
+static void findTypeLocationForBlockDecl(const TypeSourceInfo *TSInfo,
+ FunctionTypeLoc ,

Please add comments for the helper function.



Comment at: lib/Sema/SemaCodeComplete.cpp:2279
+static std::string
+formatBlockPlaceholder(const PrintingPolicy , const NamedDecl 
*BlockDecl,
+   FunctionTypeLoc , FunctionProtoTypeLoc 
,

Comments here as well.


Repository:
  rL LLVM

https://reviews.llvm.org/D25519



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


r284026 - Move x86-64 builtins from SemaChecking.cpp to BuiltinsX86_64.def

2016-10-12 Thread Albert Gutowski via cfe-commits
Author: agutowski
Date: Wed Oct 12 12:28:44 2016
New Revision: 284026

URL: http://llvm.org/viewvc/llvm-project?rev=284026=rev
Log:
Move x86-64 builtins from SemaChecking.cpp to BuiltinsX86_64.def

Summary: Follow-up to https://reviews.llvm.org/D24598 (separating builtins for 
x84-64 and i386).

Reviewers: hans, thakis, rnk

Subscribers: cfe-commits

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

Added:
cfe/trunk/test/Sema/builtins-x86_64.c
Removed:
cfe/trunk/test/CodeGen/builtins-x86-disabled.c
Modified:
cfe/trunk/include/clang/Basic/BuiltinsX86.def
cfe/trunk/include/clang/Basic/BuiltinsX86_64.def
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/lib/Sema/SemaChecking.cpp

Modified: cfe/trunk/include/clang/Basic/BuiltinsX86.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsX86.def?rev=284026=284025=284026=diff
==
--- cfe/trunk/include/clang/Basic/BuiltinsX86.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsX86.def Wed Oct 12 12:28:44 2016
@@ -48,9 +48,7 @@ TARGET_BUILTIN(__builtin_ia32_undef512,
 // FLAGS
 //
 TARGET_BUILTIN(__builtin_ia32_readeflags_u32, "Ui", "n", "")
-TARGET_BUILTIN(__builtin_ia32_readeflags_u64, "ULLi", "n", "")
 TARGET_BUILTIN(__builtin_ia32_writeeflags_u32, "vUi", "n", "")
-TARGET_BUILTIN(__builtin_ia32_writeeflags_u64, "vULLi", "n", "")
 
 // 3DNow!
 //
@@ -310,8 +308,6 @@ TARGET_BUILTIN(__builtin_ia32_stmxcsr, "
 TARGET_HEADER_BUILTIN(_mm_getcsr, "Ui", "h", "xmmintrin.h", ALL_LANGUAGES, 
"sse")
 TARGET_BUILTIN(__builtin_ia32_cvtss2si, "iV4f", "", "sse")
 TARGET_BUILTIN(__builtin_ia32_cvttss2si, "iV4f", "", "sse")
-TARGET_BUILTIN(__builtin_ia32_cvtss2si64, "LLiV4f", "", "sse")
-TARGET_BUILTIN(__builtin_ia32_cvttss2si64, "LLiV4f", "", "sse")
 TARGET_BUILTIN(__builtin_ia32_storehps, "vV2i*V4f", "", "sse")
 TARGET_BUILTIN(__builtin_ia32_storelps, "vV2i*V4f", "", "sse")
 TARGET_BUILTIN(__builtin_ia32_movmskps, "iV4f", "", "sse")
@@ -338,8 +334,6 @@ TARGET_BUILTIN(__builtin_ia32_cvtpd2ps,
 TARGET_BUILTIN(__builtin_ia32_cvttpd2dq, "V4iV2d", "", "sse2")
 TARGET_BUILTIN(__builtin_ia32_cvtsd2si, "iV2d", "", "sse2")
 TARGET_BUILTIN(__builtin_ia32_cvttsd2si, "iV2d", "", "sse2")
-TARGET_BUILTIN(__builtin_ia32_cvtsd2si64, "LLiV2d", "", "sse2")
-TARGET_BUILTIN(__builtin_ia32_cvttsd2si64, "LLiV2d", "", "sse2")
 TARGET_BUILTIN(__builtin_ia32_cvtsd2ss, "V4fV4fV2d", "", "sse2")
 TARGET_BUILTIN(__builtin_ia32_cvtps2dq, "V4iV4f", "", "sse2")
 TARGET_BUILTIN(__builtin_ia32_cvttps2dq, "V4iV4f", "", "sse2")
@@ -424,7 +418,6 @@ TARGET_BUILTIN(__builtin_ia32_pcmpestriz
 TARGET_BUILTIN(__builtin_ia32_crc32qi, "UiUiUc", "", "sse4.2")
 TARGET_BUILTIN(__builtin_ia32_crc32hi, "UiUiUs", "", "sse4.2")
 TARGET_BUILTIN(__builtin_ia32_crc32si, "UiUiUi", "", "sse4.2")
-TARGET_BUILTIN(__builtin_ia32_crc32di, "ULLiULLiULLi", "", "sse4.2")
 
 // SSE4a
 TARGET_BUILTIN(__builtin_ia32_extrqi, "V2LLiV2LLiIcIc", "", "sse4a")
@@ -638,65 +631,44 @@ TARGET_BUILTIN(__builtin_ia32_rdrand64_s
 
 // FSGSBASE
 TARGET_BUILTIN(__builtin_ia32_rdfsbase32, "Ui", "", "fsgsbase")
-TARGET_BUILTIN(__builtin_ia32_rdfsbase64, "ULLi", "", "fsgsbase")
 TARGET_BUILTIN(__builtin_ia32_rdgsbase32, "Ui", "", "fsgsbase")
-TARGET_BUILTIN(__builtin_ia32_rdgsbase64, "ULLi", "", "fsgsbase")
 TARGET_BUILTIN(__builtin_ia32_wrfsbase32, "vUi", "", "fsgsbase")
-TARGET_BUILTIN(__builtin_ia32_wrfsbase64, "vULLi", "", "fsgsbase")
 TARGET_BUILTIN(__builtin_ia32_wrgsbase32, "vUi", "", "fsgsbase")
-TARGET_BUILTIN(__builtin_ia32_wrgsbase64, "vULLi", "", "fsgsbase")
 
 // FXSR
 TARGET_BUILTIN(__builtin_ia32_fxrstor, "vv*", "", "fxsr")
-TARGET_BUILTIN(__builtin_ia32_fxrstor64, "vv*", "", "fxsr")
 TARGET_BUILTIN(__builtin_ia32_fxsave, "vv*", "", "fxsr")
-TARGET_BUILTIN(__builtin_ia32_fxsave64, "vv*", "", "fxsr")
 
 // XSAVE
 TARGET_BUILTIN(__builtin_ia32_xsave, "vv*ULLi", "", "xsave")
-TARGET_BUILTIN(__builtin_ia32_xsave64, "vv*ULLi", "", "xsave")
 TARGET_BUILTIN(__builtin_ia32_xrstor, "vv*ULLi", "", "xsave")
-TARGET_BUILTIN(__builtin_ia32_xrstor64, "vv*ULLi", "", "xsave")
 TARGET_BUILTIN(__builtin_ia32_xsaveopt, "vv*ULLi", "", "xsaveopt")
-TARGET_BUILTIN(__builtin_ia32_xsaveopt64, "vv*ULLi", "", "xsaveopt")
 TARGET_BUILTIN(__builtin_ia32_xrstors, "vv*ULLi", "", "xsaves")
-TARGET_BUILTIN(__builtin_ia32_xrstors64, "vv*ULLi", "", "xsaves")
 TARGET_BUILTIN(__builtin_ia32_xsavec, "vv*ULLi", "", "xsavec")
-TARGET_BUILTIN(__builtin_ia32_xsavec64, "vv*ULLi", "", "xsavec")
 TARGET_BUILTIN(__builtin_ia32_xsaves, "vv*ULLi", "", "xsaves")
-TARGET_BUILTIN(__builtin_ia32_xsaves64, "vv*ULLi", "", "xsaves")
 
 //CLFLUSHOPT
 TARGET_BUILTIN(__builtin_ia32_clflushopt, "vc*", "", "clflushopt")
 
 // ADX
 TARGET_BUILTIN(__builtin_ia32_addcarryx_u32, "UcUcUiUiUi*", "", "adx")
-TARGET_BUILTIN(__builtin_ia32_addcarryx_u64, "UcUcULLiULLiULLi*", "", "adx")
 TARGET_BUILTIN(__builtin_ia32_addcarry_u32, "UcUcUiUiUi*", "", "")

[PATCH] D25494: Move x86-64 builtins from SemaChecking.cpp to BuiltinsX86_64.def

2016-10-12 Thread Albert Gutowski via cfe-commits
agutowski updated this revision to Diff 74398.
agutowski added a comment.

add -fno-spell-checking to tests


https://reviews.llvm.org/D25494

Files:
  include/clang/Basic/BuiltinsX86.def
  include/clang/Basic/BuiltinsX86_64.def
  lib/Basic/Targets.cpp
  lib/Sema/SemaChecking.cpp
  test/CodeGen/builtins-x86-disabled.c
  test/Sema/builtins-x86_64.c

Index: lib/Sema/SemaChecking.cpp
===
--- lib/Sema/SemaChecking.cpp
+++ lib/Sema/SemaChecking.cpp
@@ -1590,58 +1590,6 @@
   return false;
 }
 
-static bool isX86_64Builtin(unsigned BuiltinID) {
-  // These builtins only work on x86-64 targets.
-  switch (BuiltinID) {
-  case X86::BI__builtin_ia32_addcarryx_u64:
-  case X86::BI__builtin_ia32_addcarry_u64:
-  case X86::BI__builtin_ia32_subborrow_u64:
-  case X86::BI__builtin_ia32_readeflags_u64:
-  case X86::BI__builtin_ia32_writeeflags_u64:
-  case X86::BI__builtin_ia32_bextr_u64:
-  case X86::BI__builtin_ia32_bextri_u64:
-  case X86::BI__builtin_ia32_bzhi_di:
-  case X86::BI__builtin_ia32_pdep_di:
-  case X86::BI__builtin_ia32_pext_di:
-  case X86::BI__builtin_ia32_crc32di:
-  case X86::BI__builtin_ia32_fxsave64:
-  case X86::BI__builtin_ia32_fxrstor64:
-  case X86::BI__builtin_ia32_xsave64:
-  case X86::BI__builtin_ia32_xrstor64:
-  case X86::BI__builtin_ia32_xsaveopt64:
-  case X86::BI__builtin_ia32_xrstors64:
-  case X86::BI__builtin_ia32_xsavec64:
-  case X86::BI__builtin_ia32_xsaves64:
-  case X86::BI__builtin_ia32_rdfsbase64:
-  case X86::BI__builtin_ia32_rdgsbase64:
-  case X86::BI__builtin_ia32_wrfsbase64:
-  case X86::BI__builtin_ia32_wrgsbase64:
-  case X86::BI__builtin_ia32_pbroadcastq512_gpr_mask:
-  case X86::BI__builtin_ia32_pbroadcastq256_gpr_mask:
-  case X86::BI__builtin_ia32_pbroadcastq128_gpr_mask:
-  case X86::BI__builtin_ia32_vcvtsd2si64:
-  case X86::BI__builtin_ia32_vcvtsd2usi64:
-  case X86::BI__builtin_ia32_vcvtss2si64:
-  case X86::BI__builtin_ia32_vcvtss2usi64:
-  case X86::BI__builtin_ia32_vcvttsd2si64:
-  case X86::BI__builtin_ia32_vcvttsd2usi64:
-  case X86::BI__builtin_ia32_vcvttss2si64:
-  case X86::BI__builtin_ia32_vcvttss2usi64:
-  case X86::BI__builtin_ia32_cvtss2si64:
-  case X86::BI__builtin_ia32_cvttss2si64:
-  case X86::BI__builtin_ia32_cvtsd2si64:
-  case X86::BI__builtin_ia32_cvttsd2si64:
-  case X86::BI__builtin_ia32_cvtsi2sd64:
-  case X86::BI__builtin_ia32_cvtsi2ss64:
-  case X86::BI__builtin_ia32_cvtusi2sd64:
-  case X86::BI__builtin_ia32_cvtusi2ss64:
-  case X86::BI__builtin_ia32_rdseed64_step:
-return true;
-  }
-
-  return false;
-}
-
 // Check if the rounding mode is legal.
 bool Sema::CheckX86BuiltinRoundingOrSAE(unsigned BuiltinID, CallExpr *TheCall) {
   // Indicates if this instruction has rounding control or just SAE.
@@ -1838,12 +1786,6 @@
   if (BuiltinID == X86::BI__builtin_ms_va_start)
 return SemaBuiltinMSVAStart(TheCall);
 
-  // Check for 64-bit only builtins on a 32-bit target.
-  const llvm::Triple  = Context.getTargetInfo().getTriple();
-  if (TT.getArch() != llvm::Triple::x86_64 && isX86_64Builtin(BuiltinID))
-return Diag(TheCall->getCallee()->getLocStart(),
-diag::err_x86_builtin_32_bit_tgt);
-
   // If the intrinsic has rounding or SAE make sure its valid.
   if (CheckX86BuiltinRoundingOrSAE(BuiltinID, TheCall))
 return true;
Index: lib/Basic/Targets.cpp
===
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -2362,6 +2362,8 @@
 
 #define BUILTIN(ID, TYPE, ATTRS)   \
   { #ID, TYPE, ATTRS, nullptr, ALL_LANGUAGES, nullptr },
+#define TARGET_BUILTIN(ID, TYPE, ATTRS, FEATURE) \
+  { #ID, TYPE, ATTRS, nullptr, ALL_LANGUAGES, FEATURE },
 #define TARGET_HEADER_BUILTIN(ID, TYPE, ATTRS, HEADER, LANGS, FEATURE) \
   { #ID, TYPE, ATTRS, HEADER, LANGS, FEATURE },
 #include "clang/Basic/BuiltinsX86_64.def"
Index: include/clang/Basic/BuiltinsX86_64.def
===
--- include/clang/Basic/BuiltinsX86_64.def
+++ include/clang/Basic/BuiltinsX86_64.def
@@ -14,6 +14,10 @@
 
 // The format of this database matches clang/Basic/Builtins.def.
 
+#if defined(BUILTIN) && !defined(TARGET_BUILTIN)
+#   define TARGET_BUILTIN(ID, TYPE, ATTRS, FEATURE) BUILTIN(ID, TYPE, ATTRS)
+#endif
+
 #if defined(BUILTIN) && !defined(TARGET_HEADER_BUILTIN)
 #  define TARGET_HEADER_BUILTIN(ID, TYPE, ATTRS, HEADER, LANG, FEATURE) BUILTIN(ID, TYPE, ATTRS)
 #endif
@@ -25,6 +29,50 @@
 
 TARGET_HEADER_BUILTIN(__faststorefence, "v", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
 
+TARGET_BUILTIN(__builtin_ia32_readeflags_u64, "ULLi", "n", "")
+TARGET_BUILTIN(__builtin_ia32_writeeflags_u64, "vULLi", "n", "")
+TARGET_BUILTIN(__builtin_ia32_cvtss2si64, "LLiV4f", "", "sse")
+TARGET_BUILTIN(__builtin_ia32_cvttss2si64, "LLiV4f", "", "sse")
+TARGET_BUILTIN(__builtin_ia32_cvtsd2si64, "LLiV2d", "", "sse2")

[PATCH] D25522: Remove warnings from google-benchmarks in libcxx

2016-10-12 Thread Aditya Kumar via cfe-commits
hiraditya created this revision.
hiraditya added reviewers: EricWF, mclow.lists.
hiraditya added subscribers: sebpop, cfe-commits.

https://reviews.llvm.org/D25522

Files:
  libcxx/benchmarks/ContainerBenchmarks.hpp
  libcxx/benchmarks/GenerateInput.hpp


Index: libcxx/benchmarks/GenerateInput.hpp
===
--- libcxx/benchmarks/GenerateInput.hpp
+++ libcxx/benchmarks/GenerateInput.hpp
@@ -112,7 +112,7 @@
 
 inline std::vector getRandomStringInputs(size_t N) {
 std::vector inputs;
-for (int i=0; i < N; ++i) {
+for (size_t i=0; i < N; ++i) {
 inputs.push_back(getRandomString(1024));
 }
 return inputs;
Index: libcxx/benchmarks/ContainerBenchmarks.hpp
===
--- libcxx/benchmarks/ContainerBenchmarks.hpp
+++ libcxx/benchmarks/ContainerBenchmarks.hpp
@@ -11,10 +11,11 @@
 template 
 void BM_ConstructIterIter(benchmark::State& st, Container, GenInputs gen) {
 auto in = gen(st.range(0));
+const auto begin = in.begin();
 const auto end = in.end();
 benchmark::DoNotOptimize();
 while (st.KeepRunning()) {
-Container c(in.begin(), in.end());
+Container c(begin, end);
 benchmark::DoNotOptimize(c.data());
 }
 }


Index: libcxx/benchmarks/GenerateInput.hpp
===
--- libcxx/benchmarks/GenerateInput.hpp
+++ libcxx/benchmarks/GenerateInput.hpp
@@ -112,7 +112,7 @@
 
 inline std::vector getRandomStringInputs(size_t N) {
 std::vector inputs;
-for (int i=0; i < N; ++i) {
+for (size_t i=0; i < N; ++i) {
 inputs.push_back(getRandomString(1024));
 }
 return inputs;
Index: libcxx/benchmarks/ContainerBenchmarks.hpp
===
--- libcxx/benchmarks/ContainerBenchmarks.hpp
+++ libcxx/benchmarks/ContainerBenchmarks.hpp
@@ -11,10 +11,11 @@
 template 
 void BM_ConstructIterIter(benchmark::State& st, Container, GenInputs gen) {
 auto in = gen(st.range(0));
+const auto begin = in.begin();
 const auto end = in.end();
 benchmark::DoNotOptimize();
 while (st.KeepRunning()) {
-Container c(in.begin(), in.end());
+Container c(begin, end);
 benchmark::DoNotOptimize(c.data());
 }
 }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2016-10-12 Thread Yaxun Liu via cfe-commits
yaxunl retitled this revision from "[OpenCL] Mark group functions as 
noduplicate in opencl-c.h" to "[OpenCL] Mark group functions as convergent in 
opencl-c.h".
yaxunl updated the summary for this revision.
yaxunl added a reviewer: aaron.ballman.
yaxunl updated this revision to Diff 74394.

https://reviews.llvm.org/D25343

Files:
  include/clang/Basic/Attr.td
  include/clang/Basic/AttrDocs.td
  lib/CodeGen/CGCall.cpp
  lib/Headers/opencl-c.h
  lib/Sema/SemaDeclAttr.cpp
  test/CodeGenOpenCL/convergent.cl

Index: test/CodeGenOpenCL/convergent.cl
===
--- /dev/null
+++ test/CodeGenOpenCL/convergent.cl
@@ -0,0 +1,118 @@
+// RUN: %clang_cc1 -triple spir-unknown-unknown -emit-llvm %s -o - | FileCheck %s
+
+void convfun(void) __attribute__((convergent));
+void non_convfun(void);
+void nodupfun(void) __attribute__((noduplicate));
+
+void f(void);
+void g(void);
+
+// Test two if's are merged and non_convfun duplicated.
+// The LLVM IR is equivalent to:
+//if (a) {
+//  f();
+//  non_convfun();
+//  g();
+//} else {
+//  non_conffun();
+//}
+//
+// CHECK: define spir_func void @test_merge_if(i32 %[[a:.+]])
+// CHECK: %[[tobool:.+]] = icmp eq i32 %[[a]], 0
+// CHECK: br i1 %[[tobool]], label %[[if_end3_critedge:.+]], label %[[if_then:.+]]
+// CHECK: [[if_then]]:
+// CHECK: tail call spir_func void @f()
+// CHECK: tail call spir_func void @non_convfun()
+// CHECK: tail call spir_func void @g()
+// CHECK: br label %[[if_end3:.+]]
+// CHECK: [[if_end3_critedge]]:
+// CHECK: tail call spir_func void @non_convfun()
+// CHECK: br label %[[if_end3]]
+// CHECK: [[if_end3]]:
+// CHECK-LABEL: ret void
+
+void test_merge_if(int a) {
+  if (a) {
+f();
+  }
+  non_convfun();
+  if (a) {
+g();
+  }
+}
+
+// CHECK-DAG: declare spir_func void @f()
+// CHECK-DAG: declare spir_func void @non_convfun()
+// CHECK-DAG: declare spir_func void @g()
+
+// Test two if's are not merged.
+// CHECK: define spir_func void @test_no_merge_if(i32 %[[a:.+]])
+// CHECK:  %[[tobool:.+]] = icmp eq i32 %[[a]], 0
+// CHECK: br i1 %[[tobool]], label %[[if_end:.+]], label %[[if_then:.+]]
+// CHECK: [[if_then]]:
+// CHECK: tail call spir_func void @f()
+// CHECK-NOT: call spir_func void @non_convfun()
+// CHECK-NOT: call spir_func void @g()
+// CHECK: br label %[[if_end]]
+// CHECK: [[if_end]]:
+// CHECK:  %[[tobool_pr:.+]] = phi i1 [ true, %[[if_then]] ], [ false, %{{.+}} ]
+// CHECK:  tail call spir_func void @convfun() #[[attr5:.+]]
+// CHECK:  br i1 %[[tobool_pr]], label %[[if_then2:.+]], label %[[if_end3:.+]]
+// CHECK: [[if_then2]]:
+// CHECK: tail call spir_func void @g()
+// CHECK:  br label %[[if_end3:.+]]
+// CHECK: [[if_end3]]:
+// CHECK-LABEL:  ret void
+
+void test_no_merge_if(int a) {
+  if (a) {
+f();
+  }
+  convfun();
+  if(a) {
+g();
+  }
+}
+
+// CHECK: declare spir_func void @convfun(){{[^#]*}} #[[attr2:[0-9]+]]
+
+// Test loop is unrolled for convergent function.
+// CHECK-LABEL: define spir_func void @test_unroll()
+// CHECK:  tail call spir_func void @convfun() #[[attr5:[0-9]+]]
+// CHECK:  tail call spir_func void @convfun() #[[attr5]]
+// CHECK:  tail call spir_func void @convfun() #[[attr5]]
+// CHECK:  tail call spir_func void @convfun() #[[attr5]]
+// CHECK:  tail call spir_func void @convfun() #[[attr5]]
+// CHECK:  tail call spir_func void @convfun() #[[attr5]]
+// CHECK:  tail call spir_func void @convfun() #[[attr5]]
+// CHECK:  tail call spir_func void @convfun() #[[attr5]]
+// CHECK:  tail call spir_func void @convfun() #[[attr5]]
+// CHECK:  tail call spir_func void @convfun() #[[attr5]]
+// CHECK-LABEL:  ret void
+
+void test_unroll() {
+  for (int i = 0; i < 10; i++)
+convfun();
+}
+
+// Test loop is not unrolled for noduplicate function.
+// CHECK-LABEL: define spir_func void @test_not_unroll()
+// CHECK:  br label %[[for_body:.+]]
+// CHECK: [[for_cond_cleanup:.+]]:
+// CHECK:  ret void
+// CHECK: [[for_body]]:
+// CHECK:  tail call spir_func void @nodupfun() #[[attr6:[0-9]+]]
+// CHECK-NOT: call spir_func void @nodupfun()
+// CHECK:  br i1 %{{.+}}, label %[[for_body]], label %[[for_cond_cleanup]]
+
+void test_not_unroll() {
+  for (int i = 0; i < 10; i++)
+nodupfun();
+}
+
+// CHECK: declare spir_func void @nodupfun(){{[^#]*}} #[[attr3:[0-9]+]]
+
+// CHECK-DAG: attributes #[[attr2]] = { {{[^}]*}}convergent{{[^}]*}} }
+// CHECK-DAG: attributes #[[attr3]] = { {{[^}]*}}noduplicate{{[^}]*}} }
+// CHECK-DAG: attributes #[[attr5]] = { {{[^}]*}}convergent{{[^}]*}} }
+// CHECK-DAG: attributes #[[attr6]] = { {{[^}]*}}noduplicate{{[^}]*}} }
Index: lib/Sema/SemaDeclAttr.cpp
===
--- lib/Sema/SemaDeclAttr.cpp
+++ lib/Sema/SemaDeclAttr.cpp
@@ -5809,6 +5809,9 @@
   case AttributeList::AT_NoDuplicate:
 handleSimpleAttribute(S, D, Attr);
 break;
+  case AttributeList::AT_Convergent:
+handleSimpleAttribute(S, D, Attr);
+break;
   case 

[libcxx] r284021 - Mark ostream_iterator's constructors as noexcept.

2016-10-12 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Wed Oct 12 11:13:48 2016
New Revision: 284021

URL: http://llvm.org/viewvc/llvm-project?rev=284021=rev
Log:
Mark ostream_iterator's constructors as noexcept.

Modified:
libcxx/trunk/include/iterator

Modified: libcxx/trunk/include/iterator
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/iterator?rev=284021=284020=284021=diff
==
--- libcxx/trunk/include/iterator (original)
+++ libcxx/trunk/include/iterator Wed Oct 12 11:13:48 2016
@@ -889,9 +889,9 @@ private:
 ostream_type* __out_stream_;
 const char_type* __delim_;
 public:
-_LIBCPP_INLINE_VISIBILITY ostream_iterator(ostream_type& __s)
+_LIBCPP_INLINE_VISIBILITY ostream_iterator(ostream_type& __s) _NOEXCEPT
 : __out_stream_(_VSTD::addressof(__s)), __delim_(0) {}
-_LIBCPP_INLINE_VISIBILITY ostream_iterator(ostream_type& __s, const 
_CharT* __delimiter)
+_LIBCPP_INLINE_VISIBILITY ostream_iterator(ostream_type& __s, const 
_CharT* __delimiter) _NOEXCEPT
 : __out_stream_(_VSTD::addressof(__s)), __delim_(__delimiter) {}
 _LIBCPP_INLINE_VISIBILITY ostream_iterator& operator=(const _Tp& __value_)
 {


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


[PATCH] D25520: [CodeCompletion] Add block placeholders when completing member access for Objective-C block property setters

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

This patch depends on https://reviews.llvm.org/D25519.

This patch changes the way that Objective-C block properties are code complete: 
clang now suggests completion with an additional '=' and the block literal 
placeholder when providing member access completions for appropriate readwrite 
block properties. This patch uses a simple heuristic to determine if it's 
appropriate to suggest a setter completion for block properties: if we are 
completing member access that is a standalone statement, we provide setter 
completion. Otherwise we fallback to the default property completion.

The following example illustrates when the setter completion is triggered:

  @interface Test : Obj
  @property (readonly, nonatomic, copy) void (^onReadonly)(int *someParameter);
  @end
  @implementation Test
  - foo {
self. // will complete with ‘=‘ and block
  }
  - fooNot {
// These will code complete normally:
(self.)
return self.
[self foo: self.]
if (self.) { }
  }
  @end


Repository:
  rL LLVM

https://reviews.llvm.org/D25520

Files:
  include/clang/Parse/Parser.h
  include/clang/Sema/Sema.h
  lib/Parse/ParseExpr.cpp
  lib/Parse/ParseStmt.cpp
  lib/Sema/SemaCodeComplete.cpp
  test/Index/complete-block-property-assignment.m

Index: test/Index/complete-block-property-assignment.m
===
--- /dev/null
+++ test/Index/complete-block-property-assignment.m
@@ -0,0 +1,66 @@
+// Note: the run lines follow their respective tests, since line/column
+// matter in this test.
+
+// rdar://28481726
+
+void func(int x);
+typedef int Foo;
+typedef void (^FooBlock)(Foo *someParameter);
+
+@interface Obj
+@property (readwrite, nonatomic, copy) void (^onAction)(Obj *object);
+@property (readwrite, nonatomic) int foo;
+@end
+
+@interface Test : Obj
+@property (readwrite, nonatomic, copy) FooBlock onEventHandler;
+@property (readonly, nonatomic, copy) void (^onReadonly)(int *someParameter);
+@property (readonly, nonatomic, strong) Obj *obj;
+@end
+
+@implementation Test
+
+#define SELFY self
+
+- (void)test {
+  self.foo = 2;
+  [self takeInt: 2]; self.foo = 2;
+  /* Comment */ self.foo = 2;
+  SELFY.foo = 2
+}
+
+// RUN: c-index-test -code-completion-at=%s:26:8 %s | FileCheck -check-prefix=CHECK-CC1 %s
+// RUN: c-index-test -code-completion-at=%s:27:27 %s | FileCheck -check-prefix=CHECK-CC1 %s
+// RUN: c-index-test -code-completion-at=%s:28:22 %s | FileCheck -check-prefix=CHECK-CC1 %s
+// 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}{Equal  = }{Placeholder ^(Obj *object)} (35)
+// CHECK-CC1-NEXT: ObjCPropertyDecl:{ResultType FooBlock}{TypedText onEventHandler}{Equal  = }{Placeholder ^(Foo *someParameter)} (35)
+// CHECK-CC1-NEXT: ObjCPropertyDecl:{ResultType void (^)(int *)}{TypedText onReadonly} (35)
+
+- (void) takeInt:(int)x { }
+
+- (int) testFailures {
+  (self.foo);
+  int x = self.foo;
+  [self takeInt: self.foo];
+  if (self.foo) {
+func(self.foo);
+  }
+  return self.foo;
+}
+
+// RUN: c-index-test -code-completion-at=%s:45:9 %s | FileCheck -check-prefix=CHECK-NO %s
+// RUN: c-index-test -code-completion-at=%s:46:16 %s | FileCheck -check-prefix=CHECK-NO %s
+// RUN: c-index-test -code-completion-at=%s:47:23 %s | FileCheck -check-prefix=CHECK-NO %s
+// RUN: c-index-test -code-completion-at=%s:48:12 %s | FileCheck -check-prefix=CHECK-NO %s
+// RUN: c-index-test -code-completion-at=%s:49:15 %s | FileCheck -check-prefix=CHECK-NO %s
+// RUN: c-index-test -code-completion-at=%s:51:15 %s | FileCheck -check-prefix=CHECK-NO %s
+// CHECK-NO: ObjCPropertyDecl:{ResultType int}{TypedText foo} (35)
+// CHECK-NO-NEXT: ObjCPropertyDecl:{ResultType Obj *}{TypedText obj} (35)
+// CHECK-NO-NEXT: ObjCPropertyDecl:{ResultType void (^)(Obj *)}{TypedText onAction} (35)
+// CHECK-NO-NEXT: ObjCPropertyDecl:{ResultType FooBlock}{TypedText onEventHandler} (35)
+// CHECK-NO-NEXT: ObjCPropertyDecl:{ResultType void (^)(int *)}{TypedText onReadonly} (35)
+
+@end
Index: lib/Sema/SemaCodeComplete.cpp
===
--- lib/Sema/SemaCodeComplete.cpp
+++ lib/Sema/SemaCodeComplete.cpp
@@ -2206,6 +2206,7 @@
 static std::string
 formatBlockPlaceholder(const PrintingPolicy , const NamedDecl *BlockDecl,
FunctionTypeLoc , FunctionProtoTypeLoc ,
+   bool SuppressBlockName = false,
bool SuppressBlock = false,
Optional ObjCSubsts = None);
 
@@ -2271,14 +2272,15 @@
 
   // We have 

[PATCH] D25508: [clang-move] Compare with real paths of symlinks

2016-10-12 Thread Haojian Wu via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL284020: [clang-move] Compare with real paths of symlinks 
(authored by hokein).

Changed prior to commit:
  https://reviews.llvm.org/D25508?vs=74382=74391#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D25508

Files:
  clang-tools-extra/trunk/clang-move/ClangMove.cpp
  clang-tools-extra/trunk/test/clang-move/Inputs/database_template.json
  clang-tools-extra/trunk/test/clang-move/move-class.cpp

Index: clang-tools-extra/trunk/clang-move/ClangMove.cpp
===
--- clang-tools-extra/trunk/clang-move/ClangMove.cpp
+++ clang-tools-extra/trunk/clang-move/ClangMove.cpp
@@ -51,8 +51,18 @@
SM.getFileManager().getVirtualFileSystem()->makeAbsolute(AbsolutePath))
 llvm::errs() << "Warning: could not make absolute file: '" <<  EC.message()
  << '\n';
-  llvm::sys::path::remove_dots(AbsolutePath, /*remove_dot_dot=*/true);
-  llvm::sys::path::native(AbsolutePath);
+  // Handle symbolic link path cases.
+  // We are trying to get the real file path of the symlink.
+  const DirectoryEntry *Dir = SM.getFileManager().getDirectory(
+   llvm::sys::path::parent_path(AbsolutePath.str()));
+  if (Dir) {
+StringRef DirName = SM.getFileManager().getCanonicalName(Dir);
+SmallVector AbsoluteFilename;
+llvm::sys::path::append(AbsoluteFilename, DirName,
+llvm::sys::path::filename(AbsolutePath.str()));
+return llvm::StringRef(AbsoluteFilename.data(), AbsoluteFilename.size())
+.str();
+  }
   return AbsolutePath.str();
 }
 
@@ -382,24 +392,27 @@
 llvm::StringRef SearchPath,
 llvm::StringRef FileName,
 const SourceManager& SM) {
-  auto AbsoluteSearchPath = MakeAbsolutePath(SM, SearchPath);
+  SmallVector HeaderWithSearchPath;
+  llvm::sys::path::append(HeaderWithSearchPath, SearchPath, IncludeHeader);
+  std::string AbsoluteOldHeader =
+  MakeAbsolutePath(OriginalRunningDirectory, Spec.OldHeader);
   // FIXME: Add old.h to the new.cc/h when the new target has dependencies on
   // old.h/c. For instance, when moved class uses another class defined in
   // old.h, the old.h should be added in new.h.
-  if (MakeAbsolutePath(OriginalRunningDirectory, Spec.OldHeader) ==
-  MakeAbsolutePath(AbsoluteSearchPath, IncludeHeader))
+  if (AbsoluteOldHeader ==
+  MakeAbsolutePath(SM, llvm::StringRef(HeaderWithSearchPath.data(),
+   HeaderWithSearchPath.size(
 return;
 
   std::string IncludeLine =
   IsAngled ? ("#include <" + IncludeHeader + ">\n").str()
: ("#include \"" + IncludeHeader + "\"\n").str();
 
-  std::string AbsolutePath = MakeAbsolutePath(SM, FileName);
-  if (MakeAbsolutePath(OriginalRunningDirectory, Spec.OldHeader) ==
-  AbsolutePath) {
+  std::string AbsoluteCurrentFile = MakeAbsolutePath(SM, FileName);
+  if (AbsoluteOldHeader == AbsoluteCurrentFile) {
 HeaderIncludes.push_back(IncludeLine);
   } else if (MakeAbsolutePath(OriginalRunningDirectory, Spec.OldCC) ==
- AbsolutePath) {
+ AbsoluteCurrentFile) {
 CCIncludes.push_back(IncludeLine);
   }
 }
Index: clang-tools-extra/trunk/test/clang-move/Inputs/database_template.json
===
--- clang-tools-extra/trunk/test/clang-move/Inputs/database_template.json
+++ clang-tools-extra/trunk/test/clang-move/Inputs/database_template.json
@@ -1,7 +1,7 @@
 [
 {
   "directory": "$test_dir/build",
-  "command": "clang++ -o test.o $test_dir/test.cpp",
-  "file": "$test_dir/test.cpp"
+  "command": "clang++ -o test.o -I../include $test_dir/src/test.cpp",
+  "file": "$test_dir/src/test.cpp"
 }
 ]
Index: clang-tools-extra/trunk/test/clang-move/move-class.cpp
===
--- clang-tools-extra/trunk/test/clang-move/move-class.cpp
+++ clang-tools-extra/trunk/test/clang-move/move-class.cpp
@@ -1,21 +1,25 @@
 // RUN: mkdir -p %T/clang-move/build
+// RUN: mkdir -p %T/clang-move/include
+// RUN: mkdir -p %T/clang-move/src
 // RUN: sed 's|$test_dir|%/T/clang-move|g' %S/Inputs/database_template.json > %T/clang-move/compile_commands.json
-// RUN: cp %S/Inputs/test*  %T/clang-move/
-// RUN: touch %T/clang-move/test2.h
-// RUN: cd %T/clang-move
-// RUN: clang-move -name="a::Foo" -new_cc=%T/clang-move/new_test.cpp -new_header=%T/clang-move/new_test.h -old_cc=../clang-move/test.cpp -old_header=../clang-move/test.h %T/clang-move/test.cpp
+// RUN: cp %S/Inputs/test.h  %T/clang-move/include
+// RUN: cp %S/Inputs/test.cpp %T/clang-move/src
+// RUN: touch %T/clang-move/include/test2.h
+// RUN: cd %T/clang-move/build
+// RUN: clang-move -name="a::Foo" -new_cc=%T/clang-move/new_test.cpp -new_header=%T/clang-move/new_test.h 

[clang-tools-extra] r284020 - [clang-move] Compare with real paths of symlinks

2016-10-12 Thread Haojian Wu via cfe-commits
Author: hokein
Date: Wed Oct 12 10:50:30 2016
New Revision: 284020

URL: http://llvm.org/viewvc/llvm-project?rev=284020=rev
Log:
[clang-move] Compare with real paths of symlinks

Summary: MakeAbsolutePath does wrong things with symlinks previously. When 
comparing with a symlink, we need to compare with the real path of it. This 
fixes issues when the build directory is a symlink.

Reviewers: ioeric

Subscribers: beanz, mgorny, cfe-commits, bkramer

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

Modified:
clang-tools-extra/trunk/clang-move/ClangMove.cpp
clang-tools-extra/trunk/test/clang-move/Inputs/database_template.json
clang-tools-extra/trunk/test/clang-move/move-class.cpp

Modified: clang-tools-extra/trunk/clang-move/ClangMove.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-move/ClangMove.cpp?rev=284020=284019=284020=diff
==
--- clang-tools-extra/trunk/clang-move/ClangMove.cpp (original)
+++ clang-tools-extra/trunk/clang-move/ClangMove.cpp Wed Oct 12 10:50:30 2016
@@ -51,8 +51,18 @@ std::string MakeAbsolutePath(const Sourc
SM.getFileManager().getVirtualFileSystem()->makeAbsolute(AbsolutePath))
 llvm::errs() << "Warning: could not make absolute file: '" <<  EC.message()
  << '\n';
-  llvm::sys::path::remove_dots(AbsolutePath, /*remove_dot_dot=*/true);
-  llvm::sys::path::native(AbsolutePath);
+  // Handle symbolic link path cases.
+  // We are trying to get the real file path of the symlink.
+  const DirectoryEntry *Dir = SM.getFileManager().getDirectory(
+   llvm::sys::path::parent_path(AbsolutePath.str()));
+  if (Dir) {
+StringRef DirName = SM.getFileManager().getCanonicalName(Dir);
+SmallVector AbsoluteFilename;
+llvm::sys::path::append(AbsoluteFilename, DirName,
+llvm::sys::path::filename(AbsolutePath.str()));
+return llvm::StringRef(AbsoluteFilename.data(), AbsoluteFilename.size())
+.str();
+  }
   return AbsolutePath.str();
 }
 
@@ -382,24 +392,27 @@ void ClangMoveTool::addIncludes(llvm::St
 llvm::StringRef SearchPath,
 llvm::StringRef FileName,
 const SourceManager& SM) {
-  auto AbsoluteSearchPath = MakeAbsolutePath(SM, SearchPath);
+  SmallVector HeaderWithSearchPath;
+  llvm::sys::path::append(HeaderWithSearchPath, SearchPath, IncludeHeader);
+  std::string AbsoluteOldHeader =
+  MakeAbsolutePath(OriginalRunningDirectory, Spec.OldHeader);
   // FIXME: Add old.h to the new.cc/h when the new target has dependencies on
   // old.h/c. For instance, when moved class uses another class defined in
   // old.h, the old.h should be added in new.h.
-  if (MakeAbsolutePath(OriginalRunningDirectory, Spec.OldHeader) ==
-  MakeAbsolutePath(AbsoluteSearchPath, IncludeHeader))
+  if (AbsoluteOldHeader ==
+  MakeAbsolutePath(SM, llvm::StringRef(HeaderWithSearchPath.data(),
+   HeaderWithSearchPath.size(
 return;
 
   std::string IncludeLine =
   IsAngled ? ("#include <" + IncludeHeader + ">\n").str()
: ("#include \"" + IncludeHeader + "\"\n").str();
 
-  std::string AbsolutePath = MakeAbsolutePath(SM, FileName);
-  if (MakeAbsolutePath(OriginalRunningDirectory, Spec.OldHeader) ==
-  AbsolutePath) {
+  std::string AbsoluteCurrentFile = MakeAbsolutePath(SM, FileName);
+  if (AbsoluteOldHeader == AbsoluteCurrentFile) {
 HeaderIncludes.push_back(IncludeLine);
   } else if (MakeAbsolutePath(OriginalRunningDirectory, Spec.OldCC) ==
- AbsolutePath) {
+ AbsoluteCurrentFile) {
 CCIncludes.push_back(IncludeLine);
   }
 }

Modified: clang-tools-extra/trunk/test/clang-move/Inputs/database_template.json
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-move/Inputs/database_template.json?rev=284020=284019=284020=diff
==
--- clang-tools-extra/trunk/test/clang-move/Inputs/database_template.json 
(original)
+++ clang-tools-extra/trunk/test/clang-move/Inputs/database_template.json Wed 
Oct 12 10:50:30 2016
@@ -1,7 +1,7 @@
 [
 {
   "directory": "$test_dir/build",
-  "command": "clang++ -o test.o $test_dir/test.cpp",
-  "file": "$test_dir/test.cpp"
+  "command": "clang++ -o test.o -I../include $test_dir/src/test.cpp",
+  "file": "$test_dir/src/test.cpp"
 }
 ]

Modified: clang-tools-extra/trunk/test/clang-move/move-class.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-move/move-class.cpp?rev=284020=284019=284020=diff
==
--- clang-tools-extra/trunk/test/clang-move/move-class.cpp (original)
+++ clang-tools-extra/trunk/test/clang-move/move-class.cpp Wed Oct 12 10:50:30 
2016
@@ -1,21 +1,25 

[PATCH] D25519: [CodeCompletion] Refactor: Extract two Objective-C block formatting related functions from FormatFunctionParameter

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

This patch extracts two new functions from the function 
`FormatFunctionParameter` that are related to Objective-C block formatting. It 
should be two separate commits (the first extracts 
`findTypeLocationForBlockDecl`, and the second extracts 
`formatBlockPlaceholder`), but I squashed them to make the review easier.

This patch is required for my follow up patch that improves completion for 
block property setters.


Repository:
  rL LLVM

https://reviews.llvm.org/D25519

Files:
  lib/Sema/SemaCodeComplete.cpp

Index: lib/Sema/SemaCodeComplete.cpp
===
--- lib/Sema/SemaCodeComplete.cpp
+++ lib/Sema/SemaCodeComplete.cpp
@@ -2162,6 +2162,53 @@
   return Result;
 }
 
+static void findTypeLocationForBlockDecl(const TypeSourceInfo *TSInfo,
+ FunctionTypeLoc ,
+ FunctionProtoTypeLoc ,
+ bool SuppressBlock = false) {
+  if (!TSInfo)
+return;
+  TypeLoc TL = TSInfo->getTypeLoc().getUnqualifiedLoc();
+  while (true) {
+// Look through typedefs.
+if (!SuppressBlock) {
+  if (TypedefTypeLoc TypedefTL = TL.getAs()) {
+if (TypeSourceInfo *InnerTSInfo =
+TypedefTL.getTypedefNameDecl()->getTypeSourceInfo()) {
+  TL = InnerTSInfo->getTypeLoc().getUnqualifiedLoc();
+  continue;
+}
+  }
+
+  // Look through qualified types
+  if (QualifiedTypeLoc QualifiedTL = TL.getAs()) {
+TL = QualifiedTL.getUnqualifiedLoc();
+continue;
+  }
+
+  if (AttributedTypeLoc AttrTL = TL.getAs()) {
+TL = AttrTL.getModifiedLoc();
+continue;
+  }
+}
+
+// Try to get the function prototype behind the block pointer type,
+// then we're done.
+if (BlockPointerTypeLoc BlockPtr = TL.getAs()) {
+  TL = BlockPtr.getPointeeLoc().IgnoreParens();
+  Block = TL.getAs();
+  BlockProto = TL.getAs();
+}
+break;
+  }
+}
+
+static std::string
+formatBlockPlaceholder(const PrintingPolicy , const NamedDecl *BlockDecl,
+   FunctionTypeLoc , FunctionProtoTypeLoc ,
+   bool SuppressBlock = false,
+   Optional ObjCSubsts = None);
+
 static std::string FormatFunctionParameter(const PrintingPolicy ,
const ParmVarDecl *Param,
bool SuppressName = false,
@@ -2192,47 +2239,13 @@
 }
 return Result;
   }
-  
+
   // The argument for a block pointer parameter is a block literal with
   // the appropriate type.
   FunctionTypeLoc Block;
   FunctionProtoTypeLoc BlockProto;
-  TypeLoc TL;
-  if (TypeSourceInfo *TSInfo = Param->getTypeSourceInfo()) {
-TL = TSInfo->getTypeLoc().getUnqualifiedLoc();
-while (true) {
-  // Look through typedefs.
-  if (!SuppressBlock) {
-if (TypedefTypeLoc TypedefTL = TL.getAs()) {
-  if (TypeSourceInfo *InnerTSInfo =
-  TypedefTL.getTypedefNameDecl()->getTypeSourceInfo()) {
-TL = InnerTSInfo->getTypeLoc().getUnqualifiedLoc();
-continue;
-  }
-}
-
-// Look through qualified types
-if (QualifiedTypeLoc QualifiedTL = TL.getAs()) {
-  TL = QualifiedTL.getUnqualifiedLoc();
-  continue;
-}
-
-if (AttributedTypeLoc AttrTL = TL.getAs()) {
-  TL = AttrTL.getModifiedLoc();
-  continue;
-}
-  }
-  
-  // Try to get the function prototype behind the block pointer type,
-  // then we're done.
-  if (BlockPointerTypeLoc BlockPtr = TL.getAs()) {
-TL = BlockPtr.getPointeeLoc().IgnoreParens();
-Block = TL.getAs();
-BlockProto = TL.getAs();
-  }
-  break;
-}
-  }
+  findTypeLocationForBlockDecl(Param->getTypeSourceInfo(), Block, BlockProto,
+   SuppressBlock);
 
   if (!Block) {
 // We were unable to find a FunctionProtoTypeLoc with parameter names
@@ -2258,12 +2271,21 @@
 
   // We have the function prototype behind the block pointer type, as it was
   // written in the source.
+  return formatBlockPlaceholder(Policy, Param, Block, BlockProto, SuppressBlock,
+ObjCSubsts);
+}
+
+static std::string
+formatBlockPlaceholder(const PrintingPolicy , const NamedDecl *BlockDecl,
+   FunctionTypeLoc , FunctionProtoTypeLoc ,
+   bool SuppressBlock,
+   Optional ObjCSubsts) {
   std::string Result;
   QualType ResultType = Block.getTypePtr()->getReturnType();
   if (ObjCSubsts)
-ResultType = ResultType.substObjCTypeArgs(Param->getASTContext(),
-   

[PATCH] D25494: Move x86-64 builtins from SemaChecking.cpp to BuiltinsX86_64.def

2016-10-12 Thread Reid Kleckner via cfe-commits
rnk accepted this revision.
rnk added a comment.
This revision is now accepted and ready to land.

lgtm




Comment at: test/Sema/builtins-x86_64.c:17
+  v8ll vec8longlongs;
+  (void)__builtin_ia32_readeflags_u64(); // 
expected-error{{use of unknown builtin}} expected-note 0+ {{}}
+  (void)__builtin_ia32_writeeflags_u64(4);   // 
expected-error{{use of unknown builtin}} expected-note 0+ {{}}

agutowski wrote:
> Is there some way to ignore all notes? I needed to handle typo-correction 
> notes (like: `did you mean '__builtin_ia32_readeflags_u32'`).
If it's all typo correction, I recommend testing with -fno-spell-checking.


https://reviews.llvm.org/D25494



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


[PATCH] D25208: [libc++] Make _LIBCPP_TYPE_VIS export members

2016-10-12 Thread Shoaib Meenai via cfe-commits
smeenai added a comment.

In https://reviews.llvm.org/D25208#564930, @EricWF wrote:

> Why do you want to build `libc++.so` with hidden visibility? What's wrong 
> with the existing way  we build `libc++.so`?


There's nothing wrong with the existing way, per se. I personally prefer hidden 
visibility semantics because I come from a Windows background and hidden 
visibility matches up well with DLL semantics, but the first section of 
https://gcc.gnu.org/wiki/Visibility covers the advantages of hidden visibility 
pretty well.


https://reviews.llvm.org/D25208



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


[PATCH] D25373: Fix for Bug 30639: CGDebugInfo Null dereference with OpenMP array access

2016-10-12 Thread Alexey Bataev via cfe-commits
ABataev added a comment.

I will commit it for you, Erich, no problems


https://reviews.llvm.org/D25373



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


r284019 - NFC: CodeCompletionResult's constructor should take const NamedDecl

2016-10-12 Thread Alex Lorenz via cfe-commits
Author: arphaman
Date: Wed Oct 12 10:33:35 2016
New Revision: 284019

URL: http://llvm.org/viewvc/llvm-project?rev=284019=rev
Log:
NFC: CodeCompletionResult's constructor should take const NamedDecl

CodeCompletionResult's Declaration field is a const pointer to the
NamedDecl, and thus the constructor should take a const pointer as well.

Modified:
cfe/trunk/include/clang/Sema/CodeCompleteConsumer.h

Modified: cfe/trunk/include/clang/Sema/CodeCompleteConsumer.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/CodeCompleteConsumer.h?rev=284019=284018=284019=diff
==
--- cfe/trunk/include/clang/Sema/CodeCompleteConsumer.h (original)
+++ cfe/trunk/include/clang/Sema/CodeCompleteConsumer.h Wed Oct 12 10:33:35 2016
@@ -737,7 +737,7 @@ public:
 
   /// \brief Build a result that refers to a pattern with an associated
   /// declaration.
-  CodeCompletionResult(CodeCompletionString *Pattern, NamedDecl *D,
+  CodeCompletionResult(CodeCompletionString *Pattern, const NamedDecl *D,
unsigned Priority)
 : Declaration(D), Pattern(Pattern), Priority(Priority), StartParameter(0),
   Kind(RK_Pattern), Availability(CXAvailability_Available), Hidden(false),


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


[PATCH] D22955: [MSVC] Improved late parsing of template functions.

2016-10-12 Thread Alexey Bataev via cfe-commits
ABataev added a comment.

Ping


https://reviews.llvm.org/D22955



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


[PATCH] D25508: [clang-move] Compare with real paths of symlinks

2016-10-12 Thread Haojian Wu via cfe-commits
hokein updated this revision to Diff 74382.
hokein added a comment.

Update.


https://reviews.llvm.org/D25508

Files:
  clang-move/ClangMove.cpp
  test/clang-move/Inputs/database_template.json
  test/clang-move/move-class.cpp

Index: test/clang-move/move-class.cpp
===
--- test/clang-move/move-class.cpp
+++ test/clang-move/move-class.cpp
@@ -1,21 +1,24 @@
 // RUN: mkdir -p %T/clang-move/build
+// RUN: mkdir -p %T/clang-move/include
 // RUN: sed 's|$test_dir|%/T/clang-move|g' %S/Inputs/database_template.json > %T/clang-move/compile_commands.json
-// RUN: cp %S/Inputs/test*  %T/clang-move/
-// RUN: touch %T/clang-move/test2.h
-// RUN: cd %T/clang-move
-// RUN: clang-move -name="a::Foo" -new_cc=%T/clang-move/new_test.cpp -new_header=%T/clang-move/new_test.h -old_cc=../clang-move/test.cpp -old_header=../clang-move/test.h %T/clang-move/test.cpp
+// RUN: cp %S/Inputs/test.h  %T/clang-move/include
+// RUN: cp %S/Inputs/test.cpp %T/clang-move
+// RUN: touch %T/clang-move/include/test2.h
+// RUN: cd %T/clang-move/build
+// RUN: clang-move -name="a::Foo" -new_cc=%T/clang-move/new_test.cpp -new_header=%T/clang-move/new_test.h -old_cc=../test.cpp -old_header=../include/test.h %T/clang-move/test.cpp
 // RUN: FileCheck -input-file=%T/clang-move/new_test.cpp -check-prefix=CHECK-NEW-TEST-CPP %s
 // RUN: FileCheck -input-file=%T/clang-move/new_test.h -check-prefix=CHECK-NEW-TEST-H %s
 // RUN: FileCheck -input-file=%T/clang-move/test.cpp -check-prefix=CHECK-OLD-TEST-CPP %s
-// RUN: FileCheck -input-file=%T/clang-move/test.h %s -implicit-check-not='{{namespace.*}}'
+// RUN: FileCheck -input-file=%T/clang-move/include/test.h %s -implicit-check-not='{{namespace.*}}'
 //
-// RUN: cp %S/Inputs/test*  %T/clang-move/
-// RUN: cd %T/clang-move
-// RUN: clang-move -name="a::Foo" -new_cc=%T/clang-move/new_test.cpp -new_header=%T/clang-move/new_test.h -old_cc=%T/clang-move/test.cpp -old_header=%T/clang-move/test.h %T/clang-move/test.cpp
+// RUN: cp %S/Inputs/test.h  %T/clang-move/include
+// RUN: cp %S/Inputs/test.cpp %T/clang-move
+// RUN: cd %T/clang-move/build
+// RUN: clang-move -name="a::Foo" -new_cc=%T/clang-move/new_test.cpp -new_header=%T/clang-move/new_test.h -old_cc=%T/clang-move/test.cpp -old_header=%T/clang-move/include/test.h %T/clang-move/test.cpp
 // RUN: FileCheck -input-file=%T/clang-move/new_test.cpp -check-prefix=CHECK-NEW-TEST-CPP %s
 // RUN: FileCheck -input-file=%T/clang-move/new_test.h -check-prefix=CHECK-NEW-TEST-H %s
 // RUN: FileCheck -input-file=%T/clang-move/test.cpp -check-prefix=CHECK-OLD-TEST-CPP %s
-// RUN: FileCheck -input-file=%T/clang-move/test.h %s -implicit-check-not='{{namespace.*}}'
+// RUN: FileCheck -input-file=%T/clang-move/include/test.h %s -implicit-check-not='{{namespace.*}}'
 //
 // CHECK-NEW-TEST-H: namespace a {
 // CHECK-NEW-TEST-H: class Foo {
Index: test/clang-move/Inputs/database_template.json
===
--- test/clang-move/Inputs/database_template.json
+++ test/clang-move/Inputs/database_template.json
@@ -1,7 +1,7 @@
 [
 {
   "directory": "$test_dir/build",
-  "command": "clang++ -o test.o $test_dir/test.cpp",
+  "command": "clang++ -o test.o -I../include $test_dir/test.cpp",
   "file": "$test_dir/test.cpp"
 }
 ]
Index: clang-move/ClangMove.cpp
===
--- clang-move/ClangMove.cpp
+++ clang-move/ClangMove.cpp
@@ -51,8 +51,18 @@
SM.getFileManager().getVirtualFileSystem()->makeAbsolute(AbsolutePath))
 llvm::errs() << "Warning: could not make absolute file: '" <<  EC.message()
  << '\n';
-  llvm::sys::path::remove_dots(AbsolutePath, /*remove_dot_dot=*/true);
-  llvm::sys::path::native(AbsolutePath);
+  // Handle symbolic link path cases.
+  // We are trying to get the real file path of the symlink.
+  const DirectoryEntry *Dir = SM.getFileManager().getDirectory(
+   llvm::sys::path::parent_path(AbsolutePath.str()));
+  if (Dir) {
+StringRef DirName = SM.getFileManager().getCanonicalName(Dir);
+SmallVector AbsoluteFilename;
+llvm::sys::path::append(AbsoluteFilename, DirName,
+llvm::sys::path::filename(AbsolutePath.str()));
+return llvm::StringRef(AbsoluteFilename.data(), AbsoluteFilename.size())
+.str();
+  }
   return AbsolutePath.str();
 }
 
@@ -382,24 +392,27 @@
 llvm::StringRef SearchPath,
 llvm::StringRef FileName,
 const SourceManager& SM) {
-  auto AbsoluteSearchPath = MakeAbsolutePath(SM, SearchPath);
+  SmallVector HeaderWithSearchPath;
+  llvm::sys::path::append(HeaderWithSearchPath, SearchPath, IncludeHeader);
+  std::string AbsoluteOldHeader =
+  MakeAbsolutePath(OriginalRunningDirectory, Spec.OldHeader);
   // FIXME: Add old.h to the new.cc/h when the new target has dependencies on
   // 

[PATCH] D25373: Fix for Bug 30639: CGDebugInfo Null dereference with OpenMP array access

2016-10-12 Thread Alexey Bataev via cfe-commits
ABataev accepted this revision.
ABataev added a comment.
This revision is now accepted and ready to land.

LG with a nit




Comment at: lib/CodeGen/CGStmtOpenMP.cpp:312
+  assert(ArgLVal.getType()->isPointerType());
+  ArgAddr = this->EmitLoadOfPointer(
+  ArgAddr, ArgLVal.getType()->castAs());

Remove `this->`


https://reviews.llvm.org/D25373



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


[PATCH] D25508: [clang-move] Compare with real paths of symlinks

2016-10-12 Thread Eric Liu via cfe-commits
ioeric accepted this revision.
ioeric added a comment.
This revision is now accepted and ready to land.

Lg with one nit.




Comment at: clang-move/ClangMove.cpp:410
   std::string AbsolutePath = MakeAbsolutePath(SM, FileName);
   if (MakeAbsolutePath(OriginalRunningDirectory, Spec.OldHeader) ==
   AbsolutePath) {

This duplicates `MakeAbsolutePath` in line 400


https://reviews.llvm.org/D25508



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


[PATCH] D24644: Pass -ffunction-sections/-fdata-sections along to gold-plugin

2016-10-12 Thread Teresa Johnson via cfe-commits
tejohnson added a comment.

Ping. It seems like using attributes is not feasible at this time due to the 
lack of data attributes.


https://reviews.llvm.org/D24644



___
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-12 Thread Steve O'Brien via cfe-commits
elsteveogrande added a comment.

Ping again -- addressed all issues, looking ok now?

Note about this change + review process here.  First I know the every 1-2 day 
pinging generates noise on the lists, and for that  I'm SorryNotSorry :-p

I just want to ensure this is reaching at least the right people for feedback + 
eventually accepting.

Also this diff is pretty low-risk...

- It's short and doesn't change too much.
- What it does change is essentially opt-in with a new flag.  So this shouldn't 
break existing toolchains and projects, because nothing uses this yet.
- It's largely "additive" and again shouldn't change existing behavior, just 
allowing for new functionality.
- This new flag is for feature parity w/ gcc, and so there is some prescription 
for its behavior.  Though not officially documented (absent from GCC docs, for 
example, but with a small amount of info in `man 1 gcc`), it seems to work 
roughly the same.
- Has unit test coverage which I believe covers all possible usage cases 
(different ways to `#include` files).
- I stripped away unneeded code which was creating some sticking points, 
working around that for now, shortening this diff more.  (And reducing mystery 
and having to make decisions about e.g. string escaping and weird stuff.)
- Had quite a bit of feedback already from @rsmith, @majnemer, @vsk (thank you 
all!) -- addressed a number of issues and cleaned this up a lot.

Is this in acceptable shape?  Any objections to accept, land, then revert if 
catastrophe (doubt it for reasons above)?

Thanks again!


https://reviews.llvm.org/D25153



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


[PATCH] D25508: [clang-move] Don't comparing absolute file path to relative path.

2016-10-12 Thread Haojian Wu via cfe-commits
hokein updated this revision to Diff 74375.
hokein added a comment.

Update the patch based on offline discussion.


https://reviews.llvm.org/D25508

Files:
  clang-move/ClangMove.cpp
  test/clang-move/Inputs/database_template.json
  test/clang-move/move-class.cpp


Index: test/clang-move/move-class.cpp
===
--- test/clang-move/move-class.cpp
+++ test/clang-move/move-class.cpp
@@ -1,21 +1,24 @@
 // RUN: mkdir -p %T/clang-move/build
+// RUN: mkdir -p %T/clang-move/include
 // RUN: sed 's|$test_dir|%/T/clang-move|g' %S/Inputs/database_template.json > 
%T/clang-move/compile_commands.json
-// RUN: cp %S/Inputs/test*  %T/clang-move/
-// RUN: touch %T/clang-move/test2.h
-// RUN: cd %T/clang-move
-// RUN: clang-move -name="a::Foo" -new_cc=%T/clang-move/new_test.cpp 
-new_header=%T/clang-move/new_test.h -old_cc=../clang-move/test.cpp 
-old_header=../clang-move/test.h %T/clang-move/test.cpp
+// RUN: cp %S/Inputs/test.h  %T/clang-move/include
+// RUN: cp %S/Inputs/test.cpp %T/clang-move
+// RUN: touch %T/clang-move/include/test2.h
+// RUN: cd %T/clang-move/build
+// RUN: clang-move -name="a::Foo" -new_cc=%T/clang-move/new_test.cpp 
-new_header=%T/clang-move/new_test.h -old_cc=../test.cpp 
-old_header=../include/test.h %T/clang-move/test.cpp
 // RUN: FileCheck -input-file=%T/clang-move/new_test.cpp 
-check-prefix=CHECK-NEW-TEST-CPP %s
 // RUN: FileCheck -input-file=%T/clang-move/new_test.h 
-check-prefix=CHECK-NEW-TEST-H %s
 // RUN: FileCheck -input-file=%T/clang-move/test.cpp 
-check-prefix=CHECK-OLD-TEST-CPP %s
-// RUN: FileCheck -input-file=%T/clang-move/test.h %s 
-implicit-check-not='{{namespace.*}}'
+// RUN: FileCheck -input-file=%T/clang-move/include/test.h %s 
-implicit-check-not='{{namespace.*}}'
 //
-// RUN: cp %S/Inputs/test*  %T/clang-move/
-// RUN: cd %T/clang-move
-// RUN: clang-move -name="a::Foo" -new_cc=%T/clang-move/new_test.cpp 
-new_header=%T/clang-move/new_test.h -old_cc=%T/clang-move/test.cpp 
-old_header=%T/clang-move/test.h %T/clang-move/test.cpp
+// RUN: cp %S/Inputs/test.h  %T/clang-move/include
+// RUN: cp %S/Inputs/test.cpp %T/clang-move
+// RUN: cd %T/clang-move/build
+// RUN: clang-move -name="a::Foo" -new_cc=%T/clang-move/new_test.cpp 
-new_header=%T/clang-move/new_test.h -old_cc=%T/clang-move/test.cpp 
-old_header=%T/clang-move/include/test.h %T/clang-move/test.cpp
 // RUN: FileCheck -input-file=%T/clang-move/new_test.cpp 
-check-prefix=CHECK-NEW-TEST-CPP %s
 // RUN: FileCheck -input-file=%T/clang-move/new_test.h 
-check-prefix=CHECK-NEW-TEST-H %s
 // RUN: FileCheck -input-file=%T/clang-move/test.cpp 
-check-prefix=CHECK-OLD-TEST-CPP %s
-// RUN: FileCheck -input-file=%T/clang-move/test.h %s 
-implicit-check-not='{{namespace.*}}'
+// RUN: FileCheck -input-file=%T/clang-move/include/test.h %s 
-implicit-check-not='{{namespace.*}}'
 //
 // CHECK-NEW-TEST-H: namespace a {
 // CHECK-NEW-TEST-H: class Foo {
Index: test/clang-move/Inputs/database_template.json
===
--- test/clang-move/Inputs/database_template.json
+++ test/clang-move/Inputs/database_template.json
@@ -1,7 +1,7 @@
 [
 {
   "directory": "$test_dir/build",
-  "command": "clang++ -o test.o $test_dir/test.cpp",
+  "command": "clang++ -o test.o -I../include $test_dir/test.cpp",
   "file": "$test_dir/test.cpp"
 }
 ]
Index: clang-move/ClangMove.cpp
===
--- clang-move/ClangMove.cpp
+++ clang-move/ClangMove.cpp
@@ -51,8 +51,18 @@
SM.getFileManager().getVirtualFileSystem()->makeAbsolute(AbsolutePath))
 llvm::errs() << "Warning: could not make absolute file: '" <<  EC.message()
  << '\n';
-  llvm::sys::path::remove_dots(AbsolutePath, /*remove_dot_dot=*/true);
-  llvm::sys::path::native(AbsolutePath);
+  // Handle symbolic link path cases.
+  // We are trying to get the real file path of the symlink.
+  const DirectoryEntry *Dir = SM.getFileManager().getDirectory(
+   llvm::sys::path::parent_path(AbsolutePath.str()));
+  if (Dir) {
+StringRef DirName = SM.getFileManager().getCanonicalName(Dir);
+SmallVector AbsoluteFilename;
+llvm::sys::path::append(AbsoluteFilename, DirName,
+llvm::sys::path::filename(AbsolutePath.str()));
+return llvm::StringRef(AbsoluteFilename.data(), AbsoluteFilename.size())
+.str();
+  }
   return AbsolutePath.str();
 }
 
@@ -382,12 +392,14 @@
 llvm::StringRef SearchPath,
 llvm::StringRef FileName,
 const SourceManager& SM) {
-  auto AbsoluteSearchPath = MakeAbsolutePath(SM, SearchPath);
+  SmallVector HeaderWithSearchPath;
+  llvm::sys::path::append(HeaderWithSearchPath, SearchPath, IncludeHeader);
   // FIXME: Add old.h to the new.cc/h when the new target has dependencies on
   // old.h/c. For instance, when moved class uses 

[PATCH] D25145: [libc++] Correct explanation of _LIBCPP_NEW_DELETE_VIS

2016-10-12 Thread Shoaib Meenai via cfe-commits
smeenai closed this revision.
smeenai added a comment.

Not sure why Phabricator isn't closing this out, but this was committed as SVN 
r284016


https://reviews.llvm.org/D25145



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


[PATCH] D25475: [analyzer] Add a new SVal to support pointer-to-member operations.

2016-10-12 Thread Artem Dergachev via cfe-commits
NoQ added a comment.

Yay, thanks for posting this! :)

I've got a bit of concern for some assert-suppressions.




Comment at: lib/StaticAnalyzer/Core/ExprEngine.cpp:2314
 {
+  // Return to fulfil assert condition
+  if (location.getAs())

Hmm. Why would anybody try to load anything from a plain pointer-to-member, 
rather than from a pointer-to-member-applied-to-an-object (which would no 
longer be represented by a `PointerToMember` value)? I suspect there's 
something wrong above the stack (or one of the sub-expression `SVal`s is 
incorrect), because otherwise i think that making `PointerToMember` a NonLoc is 
correct - we cannot store things in it or load things from it.



Comment at: lib/StaticAnalyzer/Core/ExprEngineC.cpp:465
+   "UnaryOperator as Cast's child was expected");
+if (const UnaryOperator *UO = dyn_cast(UOExpr)) {
+  const Expr *DREExpr = UO->getSubExpr()->IgnoreParenCasts();

`cast<>()`? It seems that all dynamic casts here are asserted to succeed.



Comment at: lib/StaticAnalyzer/Core/ExprEngineCXX.cpp:69
+// Add check to fulfil assert condition
+if (!V.getAs())
+  assert(V.isUnknown());

Same concern: Why are we copying a `NonLoc`?



Comment at: test/Analysis/pointer-to-member.cpp:79
   // FIXME: Should emit a null dereference.
   return obj.*member; // no-warning
 }

In fact, maybe dereferencing a null pointer-to-member should produce an 
`UndefinedVal`, which could be later caught by 
`core.uninitialized.UndefReturn`. I wonder why doesn't this happen.


https://reviews.llvm.org/D25475



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


[libcxx] r284016 - [libc++] Correct explanation of _LIBCPP_NEW_DELETE_VIS

2016-10-12 Thread Shoaib Meenai via cfe-commits
Author: smeenai
Date: Wed Oct 12 08:48:14 2016
New Revision: 284016

URL: http://llvm.org/viewvc/llvm-project?rev=284016=rev
Log:
[libc++] Correct explanation of _LIBCPP_NEW_DELETE_VIS

The behavior of this macro actually needs to apply universally on
Windows and not just when using the Microsoft CRT. Update the macro
definition and documentation accordingly.

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

Modified:
libcxx/trunk/docs/DesignDocs/VisibilityMacros.rst
libcxx/trunk/include/new

Modified: libcxx/trunk/docs/DesignDocs/VisibilityMacros.rst
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/docs/DesignDocs/VisibilityMacros.rst?rev=284016=284015=284016=diff
==
--- libcxx/trunk/docs/DesignDocs/VisibilityMacros.rst (original)
+++ libcxx/trunk/docs/DesignDocs/VisibilityMacros.rst Wed Oct 12 08:48:14 2016
@@ -112,14 +112,15 @@ Visibility Macros
   Mark a symbol as being exported by the libc++ library. This macro must be
   applied to all `operator new` and `operator delete` overloads.
 
-  **Windows Behavior**: When using the Microsoft CRT, all the `operator new` 
and
-  `operator delete` overloads are defined statically in `msvcrt.lib`. Marking
-  them as `dllimport` in the libc++ `` header is therefore undesirable: if
-  we were to mark them as `dllimport` and then link against libc++, source 
files
-  which included `` would end up linking against libc++'s `operator new`
-  and `operator delete`, while source files which did not include `` would
-  end up linking against msvcrt's `operator new` and `operator delete`, which
-  would be a confusing and potentially error-prone inconsistency.
+  **Windows Behavior**: The `operator new` and `operator delete` overloads
+  should not be marked as `dllimport`; if they were, source files including the
+  `` header (either directly or transitively) would lose the ability to 
use
+  local overloads of `operator new` and `operator delete`. On Windows, this
+  macro therefore expands to `__declspec(dllexport)` when building the library
+  and has an empty definition otherwise. A related caveat is that libc++ must 
be
+  included on the link line before `msvcrt.lib`, otherwise Microsoft's
+  definitions of `operator new` and `operator delete` inside `msvcrt.lib` will
+  end up being used instead of libc++'s.
 
 Links
 =

Modified: libcxx/trunk/include/new
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/new?rev=284016=284015=284016=diff
==
--- libcxx/trunk/include/new (original)
+++ libcxx/trunk/include/new Wed Oct 12 08:48:14 2016
@@ -125,7 +125,7 @@ _LIBCPP_FUNC_VIS new_handler get_new_han
 
 }  // std
 
-#if defined(_LIBCPP_MSVCRT) && !defined(_LIBCPP_BUILDING_LIBRARY)
+#if defined(_WIN32) && !defined(_LIBCPP_BUILDING_LIBRARY)
 # define _LIBCPP_NEW_DELETE_VIS
 #else
 # define _LIBCPP_NEW_DELETE_VIS _LIBCPP_FUNC_VIS


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


[PATCH] D25145: [libc++] Correct explanation of _LIBCPP_NEW_DELETE_VIS

2016-10-12 Thread Shoaib Meenai via cfe-commits
smeenai added a comment.

In https://reviews.llvm.org/D25145#565027, @mclow.lists wrote:

> Sigh. Make an expedient choice that you don't really agree with, and you get 
> immediately reminded of it.   I suggested on an earlier review (not this 
> patch) that I really didn't want to see `_WIN32` in any files other than 
> ``, that we should have a libc++-specific one.  I let that slide 
> because we had a couple other instances of `_WIN32` in the source base.
>
> About three days later, this pops up. :-(
>  Not your fault, but it makes me sad.


I'm not a fan either :) Gonna commit this and then send something to cfe-dev 
about cleaning them up.


https://reviews.llvm.org/D25145



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


[PATCH] D25397: [change-namespace] don't miss comments in the beginning of a namespace block.

2016-10-12 Thread Eric Liu via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL284011: [change-namespace] don't miss comments in the 
beginning of a namespace block. (authored by ioeric).

Changed prior to commit:
  https://reviews.llvm.org/D25397?vs=74038=74368#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D25397

Files:
  clang-tools-extra/trunk/change-namespace/ChangeNamespace.cpp
  clang-tools-extra/trunk/unittests/change-namespace/ChangeNamespaceTests.cpp

Index: clang-tools-extra/trunk/unittests/change-namespace/ChangeNamespaceTests.cpp
===
--- clang-tools-extra/trunk/unittests/change-namespace/ChangeNamespaceTests.cpp
+++ clang-tools-extra/trunk/unittests/change-namespace/ChangeNamespaceTests.cpp
@@ -552,6 +552,38 @@
   EXPECT_EQ(format(Expected), runChangeNamespaceOnCode(Code));
 }
 
+TEST_F(ChangeNamespaceTest, CommentsBeforeMovedClass) {
+  std::string Code = "namespace na {\n"
+ "namespace nb {\n"
+ "\n\n"
+ "// Wild comments.\n"
+ "\n"
+ "// Comments.\n"
+ "// More comments.\n"
+ "class B {\n"
+ "  // Private comments.\n"
+ "  int a;\n"
+ "};\n"
+ "}\n"
+ "}";
+  std::string Expected = "\n"
+ "\n"
+ "namespace x {\n"
+ "namespace y {\n"
+ "\n\n"
+ "// Wild comments.\n"
+ "\n"
+ "// Comments.\n"
+ "// More comments.\n"
+ "class B {\n"
+ "  // Private comments.\n"
+ "  int a;\n"
+ "};\n"
+ "} // namespace y\n"
+ "} // namespace x\n";
+  EXPECT_EQ(format(Expected), runChangeNamespaceOnCode(Code));
+}
+
 } // anonymous namespace
 } // namespace change_namespace
 } // namespace clang
Index: clang-tools-extra/trunk/change-namespace/ChangeNamespace.cpp
===
--- clang-tools-extra/trunk/change-namespace/ChangeNamespace.cpp
+++ clang-tools-extra/trunk/change-namespace/ChangeNamespace.cpp
@@ -82,33 +82,42 @@
   return CurrentNs;
 }
 
-// FIXME: get rid of this helper function if this is supported in clang-refactor
-// library.
-SourceLocation getStartOfNextLine(SourceLocation Loc, const SourceManager ,
-  const LangOptions ) {
+static std::unique_ptr
+getLexerStartingFromLoc(SourceLocation Loc, const SourceManager ,
+const LangOptions ) {
   if (Loc.isMacroID() &&
   !Lexer::isAtEndOfMacroExpansion(Loc, SM, LangOpts, ))
-return SourceLocation();
+return nullptr;
   // Break down the source location.
   std::pair LocInfo = SM.getDecomposedLoc(Loc);
   // Try to load the file buffer.
   bool InvalidTemp = false;
   llvm::StringRef File = SM.getBufferData(LocInfo.first, );
   if (InvalidTemp)
-return SourceLocation();
+return nullptr;
 
   const char *TokBegin = File.data() + LocInfo.second;
   // Lex from the start of the given location.
-  Lexer Lex(SM.getLocForStartOfFile(LocInfo.first), LangOpts, File.begin(),
-TokBegin, File.end());
+  return llvm::make_unique(SM.getLocForStartOfFile(LocInfo.first),
+  LangOpts, File.begin(), TokBegin, File.end());
+}
 
+// FIXME: get rid of this helper function if this is supported in clang-refactor
+// library.
+static SourceLocation getStartOfNextLine(SourceLocation Loc,
+ const SourceManager ,
+ const LangOptions ) {
+  std::unique_ptr Lex = getLexerStartingFromLoc(Loc, SM, LangOpts);
+  if (!Lex.get())
+return SourceLocation();
   llvm::SmallVector Line;
   // FIXME: this is a bit hacky to get ReadToEndOfLine work.
-  Lex.setParsingPreprocessorDirective(true);
-  Lex.ReadToEndOfLine();
+  Lex->setParsingPreprocessorDirective(true);
+  Lex->ReadToEndOfLine();
   auto End = Loc.getLocWithOffset(Line.size());
-  return SM.getLocForEndOfFile(LocInfo.first) == End ? End
- : End.getLocWithOffset(1);
+  return SM.getLocForEndOfFile(SM.getDecomposedLoc(Loc).first) == End
+ ? End
+ : End.getLocWithOffset(1);
 }
 
 // Returns `R` with new range that refers to code after `Replaces` being
@@ -365,6 +374,23 @@
   }
 }
 
+static SourceLocation getLocAfterNamespaceLBrace(const NamespaceDecl *NsDecl,
+ const SourceManager ,
+ const LangOptions ) {
+  std::unique_ptr Lex =
+ 

[clang-tools-extra] r284011 - [change-namespace] don't miss comments in the beginning of a namespace block.

2016-10-12 Thread Eric Liu via cfe-commits
Author: ioeric
Date: Wed Oct 12 07:34:18 2016
New Revision: 284011

URL: http://llvm.org/viewvc/llvm-project?rev=284011=rev
Log:
[change-namespace] don't miss comments in the beginning of a namespace block.

Reviewers: hokein

Subscribers: cfe-commits

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

Modified:
clang-tools-extra/trunk/change-namespace/ChangeNamespace.cpp
clang-tools-extra/trunk/unittests/change-namespace/ChangeNamespaceTests.cpp

Modified: clang-tools-extra/trunk/change-namespace/ChangeNamespace.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/change-namespace/ChangeNamespace.cpp?rev=284011=284010=284011=diff
==
--- clang-tools-extra/trunk/change-namespace/ChangeNamespace.cpp (original)
+++ clang-tools-extra/trunk/change-namespace/ChangeNamespace.cpp Wed Oct 12 
07:34:18 2016
@@ -82,33 +82,42 @@ const NamespaceDecl *getOuterNamespace(c
   return CurrentNs;
 }
 
-// FIXME: get rid of this helper function if this is supported in 
clang-refactor
-// library.
-SourceLocation getStartOfNextLine(SourceLocation Loc, const SourceManager ,
-  const LangOptions ) {
+static std::unique_ptr
+getLexerStartingFromLoc(SourceLocation Loc, const SourceManager ,
+const LangOptions ) {
   if (Loc.isMacroID() &&
   !Lexer::isAtEndOfMacroExpansion(Loc, SM, LangOpts, ))
-return SourceLocation();
+return nullptr;
   // Break down the source location.
   std::pair LocInfo = SM.getDecomposedLoc(Loc);
   // Try to load the file buffer.
   bool InvalidTemp = false;
   llvm::StringRef File = SM.getBufferData(LocInfo.first, );
   if (InvalidTemp)
-return SourceLocation();
+return nullptr;
 
   const char *TokBegin = File.data() + LocInfo.second;
   // Lex from the start of the given location.
-  Lexer Lex(SM.getLocForStartOfFile(LocInfo.first), LangOpts, File.begin(),
-TokBegin, File.end());
+  return llvm::make_unique(SM.getLocForStartOfFile(LocInfo.first),
+  LangOpts, File.begin(), TokBegin, 
File.end());
+}
 
+// FIXME: get rid of this helper function if this is supported in 
clang-refactor
+// library.
+static SourceLocation getStartOfNextLine(SourceLocation Loc,
+ const SourceManager ,
+ const LangOptions ) {
+  std::unique_ptr Lex = getLexerStartingFromLoc(Loc, SM, LangOpts);
+  if (!Lex.get())
+return SourceLocation();
   llvm::SmallVector Line;
   // FIXME: this is a bit hacky to get ReadToEndOfLine work.
-  Lex.setParsingPreprocessorDirective(true);
-  Lex.ReadToEndOfLine();
+  Lex->setParsingPreprocessorDirective(true);
+  Lex->ReadToEndOfLine();
   auto End = Loc.getLocWithOffset(Line.size());
-  return SM.getLocForEndOfFile(LocInfo.first) == End ? End
- : End.getLocWithOffset(1);
+  return SM.getLocForEndOfFile(SM.getDecomposedLoc(Loc).first) == End
+ ? End
+ : End.getLocWithOffset(1);
 }
 
 // Returns `R` with new range that refers to code after `Replaces` being
@@ -365,6 +374,23 @@ void ChangeNamespaceTool::run(
   }
 }
 
+static SourceLocation getLocAfterNamespaceLBrace(const NamespaceDecl *NsDecl,
+ const SourceManager ,
+ const LangOptions ) {
+  std::unique_ptr Lex =
+  getLexerStartingFromLoc(NsDecl->getLocStart(), SM, LangOpts);
+  assert(Lex.get() &&
+ "Failed to create lexer from the beginning of namespace.");
+  if (!Lex.get())
+return SourceLocation();
+  Token Tok;
+  while (!Lex->LexFromRawLexer(Tok) && Tok.isNot(tok::TokenKind::l_brace)) {
+  }
+  return Tok.isNot(tok::TokenKind::l_brace)
+ ? SourceLocation()
+ : Tok.getEndLoc().getLocWithOffset(1);
+}
+
 // Stores information about a moved namespace in `MoveNamespaces` and leaves
 // the actual movement to `onEndOfTranslationUnit()`.
 void ChangeNamespaceTool::moveOldNamespace(
@@ -375,7 +401,9 @@ void ChangeNamespaceTool::moveOldNamespa
 return;
 
   // Get the range of the code in the old namespace.
-  SourceLocation Start = NsDecl->decls_begin()->getLocStart();
+  SourceLocation Start = getLocAfterNamespaceLBrace(
+  NsDecl, *Result.SourceManager, Result.Context->getLangOpts());
+  assert(Start.isValid() && "Can't find l_brace for namespace.");
   SourceLocation End = NsDecl->getRBraceLoc().getLocWithOffset(-1);
   // Create a replacement that deletes the code in the old namespace merely for
   // retrieving offset and length from it.

Modified: 
clang-tools-extra/trunk/unittests/change-namespace/ChangeNamespaceTests.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/unittests/change-namespace/ChangeNamespaceTests.cpp?rev=284011=284010=284011=diff

[PATCH] D24508: PR28752: Do not instantiate var decls which are not visible.

2016-10-12 Thread Vassil Vassilev via cfe-commits
v.g.vassilev closed this revision.
v.g.vassilev marked an inline comment as done.
v.g.vassilev added a comment.

Relanded in r284008.


https://reviews.llvm.org/D24508



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


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

2016-10-12 Thread Joerg Sonnenberger via cfe-commits
joerg added inline comments.



Comment at: lib/Sema/SemaChecking.cpp:11370
+// we are here such increase has not been enough. So pointing the first
+// FieldDecl that either is packed orelse its RecordDecl is,
+// seems reasonable.

Missing space.


https://reviews.llvm.org/D23657



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


[PATCH] D25474: [ARM] Fix - missing target-cpu in test

2016-10-12 Thread Javed Absar via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL284009: [ARM] Fix - missing target-cpu in test (authored by 
javed.absar).

Changed prior to commit:
  https://reviews.llvm.org/D25474?vs=74247=74365#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D25474

Files:
  cfe/trunk/test/Driver/arm-cortex-cpus.c


Index: cfe/trunk/test/Driver/arm-cortex-cpus.c
===
--- cfe/trunk/test/Driver/arm-cortex-cpus.c
+++ cfe/trunk/test/Driver/arm-cortex-cpus.c
@@ -165,7 +165,7 @@
 // RUN: FileCheck -check-prefix=CHECK-V8R-THUMB-BIG %s
 // RUN: %clang -target arm -march=armv8r -mthumb -mbig-endian -### -c %s 2>&1 
| \
 // RUN: FileCheck -check-prefix=CHECK-V8R-THUMB-BIG %s
-// CHECK-V8R-THUMB-BIG: "-cc1"{{.*}} "-triple" "thumbebv8r-{{.*}} "-target-cpu
+// CHECK-V8R-THUMB-BIG: "-cc1"{{.*}} "-triple" "thumbebv8r-{{.*}} 
"-target-cpu" "cortex-r52"
 
 // RUN: %clang -mcpu=generic -target armv8 -### -c %s 2>&1 | FileCheck 
-check-prefix=CHECK-V8A-GENERIC %s
 // RUN: %clang -mcpu=generic -target arm -march=armv8 -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-V8A-GENERIC %s


Index: cfe/trunk/test/Driver/arm-cortex-cpus.c
===
--- cfe/trunk/test/Driver/arm-cortex-cpus.c
+++ cfe/trunk/test/Driver/arm-cortex-cpus.c
@@ -165,7 +165,7 @@
 // RUN: FileCheck -check-prefix=CHECK-V8R-THUMB-BIG %s
 // RUN: %clang -target arm -march=armv8r -mthumb -mbig-endian -### -c %s 2>&1 | \
 // RUN: FileCheck -check-prefix=CHECK-V8R-THUMB-BIG %s
-// CHECK-V8R-THUMB-BIG: "-cc1"{{.*}} "-triple" "thumbebv8r-{{.*}} "-target-cpu
+// CHECK-V8R-THUMB-BIG: "-cc1"{{.*}} "-triple" "thumbebv8r-{{.*}} "-target-cpu" "cortex-r52"
 
 // RUN: %clang -mcpu=generic -target armv8 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V8A-GENERIC %s
 // RUN: %clang -mcpu=generic -target arm -march=armv8 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V8A-GENERIC %s
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r284009 - [ARM] Fix - missing target-cpu in test

2016-10-12 Thread Javed Absar via cfe-commits
Author: javed.absar
Date: Wed Oct 12 07:13:55 2016
New Revision: 284009

URL: http://llvm.org/viewvc/llvm-project?rev=284009=rev
Log:
[ARM] Fix - missing target-cpu in test

Fixes an incomplete test, wherein the target-cpu name (cortex-r52) was missing.

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



Modified:
cfe/trunk/test/Driver/arm-cortex-cpus.c

Modified: cfe/trunk/test/Driver/arm-cortex-cpus.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/arm-cortex-cpus.c?rev=284009=284008=284009=diff
==
--- cfe/trunk/test/Driver/arm-cortex-cpus.c (original)
+++ cfe/trunk/test/Driver/arm-cortex-cpus.c Wed Oct 12 07:13:55 2016
@@ -165,7 +165,7 @@
 // RUN: FileCheck -check-prefix=CHECK-V8R-THUMB-BIG %s
 // RUN: %clang -target arm -march=armv8r -mthumb -mbig-endian -### -c %s 2>&1 
| \
 // RUN: FileCheck -check-prefix=CHECK-V8R-THUMB-BIG %s
-// CHECK-V8R-THUMB-BIG: "-cc1"{{.*}} "-triple" "thumbebv8r-{{.*}} "-target-cpu
+// CHECK-V8R-THUMB-BIG: "-cc1"{{.*}} "-triple" "thumbebv8r-{{.*}} 
"-target-cpu" "cortex-r52"
 
 // RUN: %clang -mcpu=generic -target armv8 -### -c %s 2>&1 | FileCheck 
-check-prefix=CHECK-V8A-GENERIC %s
 // RUN: %clang -mcpu=generic -target arm -march=armv8 -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-V8A-GENERIC %s


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


[PATCH] D25436: [CodeCompletion] Improve completion for properties declared in Objective-C protocols

2016-10-12 Thread Alex Lorenz via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL284007: [CodeCompletion] Show protocol properties that are 
accessed through qualified id (authored by arphaman).

Changed prior to commit:
  https://reviews.llvm.org/D25436?vs=74227=74364#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D25436

Files:
  cfe/trunk/lib/Sema/SemaCodeComplete.cpp
  cfe/trunk/test/CodeCompletion/objc-protocol-member-access.m


Index: cfe/trunk/test/CodeCompletion/objc-protocol-member-access.m
===
--- cfe/trunk/test/CodeCompletion/objc-protocol-member-access.m
+++ cfe/trunk/test/CodeCompletion/objc-protocol-member-access.m
@@ -0,0 +1,24 @@
+// Note: the run lines follow their respective tests, since line/column
+// matter in this test.
+
+@protocol Bar
+@property (readonly) int bar;
+@end
+
+@protocol Foo 
+
+@property (nonatomic, readonly) int foo;
+- (void)foobar: (int)x;
+
+@end
+
+int getFoo(id object) {
+  id modelObject = (id)object;
+  int foo = modelObject.;
+  return foo;
+}
+
+// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:17:25 %s -o - | 
FileCheck %s
+// CHECK: bar : [#int#]bar
+// CHECK: foo : [#int#]foo
+// CHECK-NOT: foobar
Index: cfe/trunk/lib/Sema/SemaCodeComplete.cpp
===
--- cfe/trunk/lib/Sema/SemaCodeComplete.cpp
+++ cfe/trunk/lib/Sema/SemaCodeComplete.cpp
@@ -3720,20 +3720,21 @@
   Results.AddResult(Result("template"));
   }
 }
-  } else if (!IsArrow && BaseType->getAsObjCInterfacePointerType()) {
+  } else if (!IsArrow && BaseType->isObjCObjectPointerType()) {
 // Objective-C property reference.
 AddedPropertiesSet AddedProperties;
-
-// Add property results based on our interface.
-const ObjCObjectPointerType *ObjCPtr
-  = BaseType->getAsObjCInterfacePointerType();
-assert(ObjCPtr && "Non-NULL pointer guaranteed above!");
-AddObjCProperties(CCContext, ObjCPtr->getInterfaceDecl(), true,
-  /*AllowNullaryMethods=*/true, CurContext, 
-  AddedProperties, Results);
-
+
+if (const ObjCObjectPointerType *ObjCPtr =
+BaseType->getAsObjCInterfacePointerType()) {
+  // Add property results based on our interface.
+  assert(ObjCPtr && "Non-NULL pointer guaranteed above!");
+  AddObjCProperties(CCContext, ObjCPtr->getInterfaceDecl(), true,
+/*AllowNullaryMethods=*/true, CurContext,
+AddedProperties, Results);
+}
+
 // Add properties from the protocols in a qualified interface.
-for (auto *I : ObjCPtr->quals())
+for (auto *I : BaseType->getAs()->quals())
   AddObjCProperties(CCContext, I, true, /*AllowNullaryMethods=*/true,
 CurContext, AddedProperties, Results);
   } else if ((IsArrow && BaseType->isObjCObjectPointerType()) ||


Index: cfe/trunk/test/CodeCompletion/objc-protocol-member-access.m
===
--- cfe/trunk/test/CodeCompletion/objc-protocol-member-access.m
+++ cfe/trunk/test/CodeCompletion/objc-protocol-member-access.m
@@ -0,0 +1,24 @@
+// Note: the run lines follow their respective tests, since line/column
+// matter in this test.
+
+@protocol Bar
+@property (readonly) int bar;
+@end
+
+@protocol Foo 
+
+@property (nonatomic, readonly) int foo;
+- (void)foobar: (int)x;
+
+@end
+
+int getFoo(id object) {
+  id modelObject = (id)object;
+  int foo = modelObject.;
+  return foo;
+}
+
+// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:17:25 %s -o - | FileCheck %s
+// CHECK: bar : [#int#]bar
+// CHECK: foo : [#int#]foo
+// CHECK-NOT: foobar
Index: cfe/trunk/lib/Sema/SemaCodeComplete.cpp
===
--- cfe/trunk/lib/Sema/SemaCodeComplete.cpp
+++ cfe/trunk/lib/Sema/SemaCodeComplete.cpp
@@ -3720,20 +3720,21 @@
   Results.AddResult(Result("template"));
   }
 }
-  } else if (!IsArrow && BaseType->getAsObjCInterfacePointerType()) {
+  } else if (!IsArrow && BaseType->isObjCObjectPointerType()) {
 // Objective-C property reference.
 AddedPropertiesSet AddedProperties;
-
-// Add property results based on our interface.
-const ObjCObjectPointerType *ObjCPtr
-  = BaseType->getAsObjCInterfacePointerType();
-assert(ObjCPtr && "Non-NULL pointer guaranteed above!");
-AddObjCProperties(CCContext, ObjCPtr->getInterfaceDecl(), true,
-  /*AllowNullaryMethods=*/true, CurContext, 
-  AddedProperties, Results);
-
+
+if (const ObjCObjectPointerType *ObjCPtr =
+BaseType->getAsObjCInterfacePointerType()) {
+  // Add property results based on our interface.
+  assert(ObjCPtr && "Non-NULL pointer guaranteed above!");
+  AddObjCProperties(CCContext, ObjCPtr->getInterfaceDecl(), true,
+

[PATCH] D25479: Guard flag –fdenormal-fp-math with –fno-fast-math

2016-10-12 Thread Sjoerd Meijer via cfe-commits
SjoerdMeijer updated this revision to Diff 74363.
SjoerdMeijer added a comment.

Thanks for catching this: the logic and test have been updated.


https://reviews.llvm.org/D25479

Files:
  lib/Driver/Tools.cpp
  test/Driver/denormal-fp-math.c


Index: test/Driver/denormal-fp-math.c
===
--- test/Driver/denormal-fp-math.c
+++ test/Driver/denormal-fp-math.c
@@ -1,9 +1,12 @@
 // RUN: %clang -### -target arm-unknown-linux-gnu -c %s 
-fdenormal-fp-math=ieee -v 2>&1 | FileCheck -check-prefix=CHECK-IEEE %s
 // RUN: %clang -### -target arm-unknown-linux-gnu -c %s 
-fdenormal-fp-math=preserve-sign -v 2>&1 | FileCheck -check-prefix=CHECK-PS %s
 // RUN: %clang -### -target arm-unknown-linux-gnu -c %s 
-fdenormal-fp-math=positive-zero -v 2>&1 | FileCheck -check-prefix=CHECK-PZ %s
+// RUN: %clang -### -target arm-unknown-linux-gnu -c %s 
-fdenormal-fp-math=ieee -fno-fast-math -v 2>&1 | FileCheck 
-check-prefix=CHECK-NO-UNSAFE %s
+// RUN: %clang -### -target arm-unknown-linux-gnu -c %s 
-fdenormal-fp-math=ieee -fno-unsafe-math-optimizations -v 2>&1 | FileCheck 
-check-prefix=CHECK-NO-UNSAFE %s
 // RUN: not %clang -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=foo 
-v 2>&1 | FileCheck -check-prefix=CHECK-INVALID %s
 
 // CHECK-IEEE: "-fdenormal-fp-math=ieee"
 // CHECK-PS: "-fdenormal-fp-math=preserve-sign"
 // CHECK-PZ: "-fdenormal-fp-math=positive-zero"
+// CHECK-NO-UNSAFE-NOT: "-fdenormal-fp-math=ieee"
 // CHECK-INVALID: error: invalid value 'foo' in '-fdenormal-fp-math=foo'
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -4390,11 +4390,18 @@
   if (ReciprocalMath)
 CmdArgs.push_back("-freciprocal-math");
 
-  if (!TrappingMath) 
+  if (!TrappingMath)
 CmdArgs.push_back("-fno-trapping-math");
 
-  if (Args.hasArg(options::OPT_fdenormal_fp_math_EQ))
-Args.AddLastArg(CmdArgs, options::OPT_fdenormal_fp_math_EQ);
+
+  if (Arg *A = Args.getLastArg(options::OPT_ffast_math, FastMathAliasOption,
+   options::OPT_fno_fast_math,
+   options::OPT_funsafe_math_optimizations,
+   options::OPT_fno_unsafe_math_optimizations,
+   options::OPT_fdenormal_fp_math_EQ))
+if (A->getOption().getID() != options::OPT_fno_fast_math &&
+A->getOption().getID() != options::OPT_fno_unsafe_math_optimizations)
+  Args.AddLastArg(CmdArgs, options::OPT_fdenormal_fp_math_EQ);
 
   // Validate and pass through -fp-contract option.
   if (Arg *A = Args.getLastArg(options::OPT_ffast_math, FastMathAliasOption,


Index: test/Driver/denormal-fp-math.c
===
--- test/Driver/denormal-fp-math.c
+++ test/Driver/denormal-fp-math.c
@@ -1,9 +1,12 @@
 // RUN: %clang -### -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=ieee -v 2>&1 | FileCheck -check-prefix=CHECK-IEEE %s
 // RUN: %clang -### -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=preserve-sign -v 2>&1 | FileCheck -check-prefix=CHECK-PS %s
 // RUN: %clang -### -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=positive-zero -v 2>&1 | FileCheck -check-prefix=CHECK-PZ %s
+// RUN: %clang -### -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=ieee -fno-fast-math -v 2>&1 | FileCheck -check-prefix=CHECK-NO-UNSAFE %s
+// RUN: %clang -### -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=ieee -fno-unsafe-math-optimizations -v 2>&1 | FileCheck -check-prefix=CHECK-NO-UNSAFE %s
 // RUN: not %clang -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=foo -v 2>&1 | FileCheck -check-prefix=CHECK-INVALID %s
 
 // CHECK-IEEE: "-fdenormal-fp-math=ieee"
 // CHECK-PS: "-fdenormal-fp-math=preserve-sign"
 // CHECK-PZ: "-fdenormal-fp-math=positive-zero"
+// CHECK-NO-UNSAFE-NOT: "-fdenormal-fp-math=ieee"
 // CHECK-INVALID: error: invalid value 'foo' in '-fdenormal-fp-math=foo'
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -4390,11 +4390,18 @@
   if (ReciprocalMath)
 CmdArgs.push_back("-freciprocal-math");
 
-  if (!TrappingMath) 
+  if (!TrappingMath)
 CmdArgs.push_back("-fno-trapping-math");
 
-  if (Args.hasArg(options::OPT_fdenormal_fp_math_EQ))
-Args.AddLastArg(CmdArgs, options::OPT_fdenormal_fp_math_EQ);
+
+  if (Arg *A = Args.getLastArg(options::OPT_ffast_math, FastMathAliasOption,
+   options::OPT_fno_fast_math,
+   options::OPT_funsafe_math_optimizations,
+   options::OPT_fno_unsafe_math_optimizations,
+   options::OPT_fdenormal_fp_math_EQ))
+if (A->getOption().getID() != options::OPT_fno_fast_math &&
+A->getOption().getID() != options::OPT_fno_unsafe_math_optimizations)
+  

r284008 - Reinstate r283887 and r283882.

2016-10-12 Thread Vassil Vassilev via cfe-commits
Author: vvassilev
Date: Wed Oct 12 06:57:08 2016
New Revision: 284008

URL: http://llvm.org/viewvc/llvm-project?rev=284008=rev
Log:
Reinstate r283887 and r283882.

Original message:
"[modules] PR28752: Do not instantiate variable declarations which are not 
visible.

https://reviews.llvm.org/D24508

Patch developed in collaboration with Richard Smith!"

Added:
cfe/trunk/test/Modules/Inputs/PR28752/
cfe/trunk/test/Modules/Inputs/PR28752/Subdir1/
cfe/trunk/test/Modules/Inputs/PR28752/Subdir1/b.h
cfe/trunk/test/Modules/Inputs/PR28752/Subdir1/c.h
cfe/trunk/test/Modules/Inputs/PR28752/Subdir1/module.modulemap
cfe/trunk/test/Modules/Inputs/PR28752/a.h
cfe/trunk/test/Modules/Inputs/PR28752/module.modulemap
cfe/trunk/test/Modules/Inputs/PR28752/vector
cfe/trunk/test/Modules/pr28752.cpp
Modified:
cfe/trunk/include/clang/AST/Decl.h
cfe/trunk/lib/AST/Decl.cpp
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Sema/SemaTemplate.cpp
cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
cfe/trunk/lib/Sema/SemaType.cpp
cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
cfe/trunk/lib/Serialization/ASTWriterDecl.cpp

Modified: cfe/trunk/include/clang/AST/Decl.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Decl.h?rev=284008=284007=284008=diff
==
--- cfe/trunk/include/clang/AST/Decl.h (original)
+++ cfe/trunk/include/clang/AST/Decl.h Wed Oct 12 06:57:08 2016
@@ -865,6 +865,11 @@ protected:
 
 unsigned : NumVarDeclBits;
 
+// FIXME: We need something similar to CXXRecordDecl::DefinitionData.
+/// \brief Whether this variable is a definition which was demoted due to
+/// module merge.
+unsigned IsThisDeclarationADemotedDefinition : 1;
+
 /// \brief Whether this variable is the exception variable in a C++ catch
 /// or an Objective-C @catch statement.
 unsigned ExceptionVar : 1;
@@ -1198,12 +1203,28 @@ public:
   InitializationStyle getInitStyle() const {
 return static_cast(VarDeclBits.InitStyle);
   }
-
   /// \brief Whether the initializer is a direct-initializer (list or call).
   bool isDirectInit() const {
 return getInitStyle() != CInit;
   }
 
+  /// \brief If this definition should pretend to be a declaration.
+  bool isThisDeclarationADemotedDefinition() const {
+return isa(this) ? false :
+  NonParmVarDeclBits.IsThisDeclarationADemotedDefinition;
+  }
+
+  /// \brief This is a definition which should be demoted to a declaration.
+  ///
+  /// In some cases (mostly module merging) we can end up with two visible
+  /// definitions one of which needs to be demoted to a declaration to keep
+  /// the AST invariants.
+  void demoteThisDefinitionToDeclaration() {
+assert (isThisDeclarationADefinition() && "Not a definition!");
+assert (!isa(this) && "Cannot demote ParmVarDecls!");
+NonParmVarDeclBits.IsThisDeclarationADemotedDefinition = 1;
+  }
+
   /// \brief Determine whether this variable is the exception variable in a
   /// C++ catch statememt or an Objective-C \@catch statement.
   bool isExceptionVariable() const {
@@ -1302,6 +1323,10 @@ public:
 NonParmVarDeclBits.PreviousDeclInSameBlockScope = Same;
   }
 
+  /// \brief Retrieve the variable declaration from which this variable could
+  /// be instantiated, if it is an instantiation (rather than a non-template).
+  VarDecl *getTemplateInstantiationPattern() const;
+
   /// \brief If this variable is an instantiated static data member of a
   /// class template specialization, returns the templated static data member
   /// from which it was instantiated.

Modified: cfe/trunk/lib/AST/Decl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Decl.cpp?rev=284008=284007=284008=diff
==
--- cfe/trunk/lib/AST/Decl.cpp (original)
+++ cfe/trunk/lib/AST/Decl.cpp Wed Oct 12 06:57:08 2016
@@ -1926,6 +1926,9 @@ VarDecl::isThisDeclarationADefinition(AS
   //
   // FIXME: How do you declare (but not define) a partial specialization of
   // a static data member template outside the containing class?
+  if (isThisDeclarationADemotedDefinition())
+return DeclarationOnly;
+
   if (isStaticDataMember()) {
 if (isOutOfLine() &&
 !(getCanonicalDecl()->isInline() &&
@@ -2250,6 +2253,56 @@ bool VarDecl::checkInitIsICE() const {
   return Eval->IsICE;
 }
 
+VarDecl *VarDecl::getTemplateInstantiationPattern() const {
+  // If it's a variable template specialization, find the template or partial
+  // specialization from which it was instantiated.
+  if (auto *VDTemplSpec = dyn_cast(this)) {
+auto From = VDTemplSpec->getInstantiatedFrom();
+if (auto *VTD = From.dyn_cast()) {
+  while (auto *NewVTD = VTD->getInstantiatedFromMemberTemplate()) {
+if (NewVTD->isMemberSpecialization())
+  break;
+VTD = NewVTD;
+  }
+  return 

[PATCH] D24656: [clang-tidy] Add check readability-redundant-declaration

2016-10-12 Thread Aaron Ballman via cfe-commits
aaron.ballman added inline comments.



Comment at: clang-tidy/readability/RedundantDeclarationCheck.cpp:60
+auto Diag = diag(D->getLocation(), "redundant '%0' declaration")
+<< cast(D)->getName();
+if (!MultiVar && !DifferentHeaders)

danielmarjamaki wrote:
> alexfh wrote:
> > It should be possible to just use `D` here.
> Thanks. It's not possible:
> 
> ```
> RedundantDeclarationCheck.cpp:61:15: error: ‘const class clang::Decl’ has no 
> member named ‘getName’
>  << D->getName();
>^
> ```
> 
`diag(...) << cast(D)` is required; the diagnostic engine properly 
handles quoting `NamedDecl` objects.


https://reviews.llvm.org/D24656



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


Re: [libcxx] r284005 - Remove incorrect XFAILS

2016-10-12 Thread Asiri Rathnayake via cfe-commits
More love for no-exceptions in any case ;)

Cheers!

On Wed, Oct 12, 2016 at 12:52 PM, Eric Fiselier  wrote:

> I just committed those tests, so I kinda had to fix them :-P
>
> On Wed, Oct 12, 2016 at 5:40 AM, Asiri Rathnayake <
> asiri.rathnay...@gmail.com> wrote:
>
>> Thanks!
>>
>> I still have that no-exception cleanup in my TODO list. Just pressed on
>> time, hope to get to it soon.
>>
>> / Asiri
>>
>> On Wed, Oct 12, 2016 at 12:29 PM, Eric Fiselier via cfe-commits <
>> cfe-commits@lists.llvm.org> wrote:
>>
>>> Author: ericwf
>>> Date: Wed Oct 12 06:29:18 2016
>>> New Revision: 284005
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=284005=rev
>>> Log:
>>> Remove incorrect XFAILS
>>>
>>> Modified:
>>> libcxx/trunk/test/libcxx/utilities/optional/optional.object/
>>> optional.object.assign/copy.pass.cpp
>>> libcxx/trunk/test/libcxx/utilities/optional/optional.object/
>>> optional.object.assign/move.pass.cpp
>>> libcxx/trunk/test/libcxx/utilities/optional/optional.object/
>>> optional.object.ctor/copy.pass.cpp
>>> libcxx/trunk/test/libcxx/utilities/optional/optional.object/
>>> optional.object.ctor/move.pass.cpp
>>>
>>> Modified: libcxx/trunk/test/libcxx/utilities/optional/optional.object/
>>> optional.object.assign/copy.pass.cpp
>>> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx
>>> /utilities/optional/optional.object/optional.object.assign/c
>>> opy.pass.cpp?rev=284005=284004=284005=diff
>>> 
>>> ==
>>> --- libcxx/trunk/test/libcxx/utilities/optional/optional.object/
>>> optional.object.assign/copy.pass.cpp (original)
>>> +++ libcxx/trunk/test/libcxx/utilities/optional/optional.object/
>>> optional.object.assign/copy.pass.cpp Wed Oct 12 06:29:18 2016
>>> @@ -8,7 +8,6 @@
>>>  //===--
>>> ===//
>>>
>>>  // UNSUPPORTED: c++98, c++03, c++11, c++14
>>> -// XFAIL: libcpp-no-exceptions
>>>  // 
>>>
>>>  // optional& operator=(const optional& rhs);
>>> @@ -45,7 +44,6 @@ struct Z2
>>>  Z2& operator=(const Z2&) = default;
>>>  };
>>>
>>> -#if __cplusplus >= 201402
>>>  template 
>>>  constexpr bool
>>>  test()
>>> @@ -55,23 +53,18 @@ test()
>>>  opt = opt2;
>>>  return true;
>>>  }
>>> -#endif
>>>
>>>  int main()
>>>  {
>>>  {
>>>  using T = int;
>>>  
>>> static_assert((std::is_trivially_copy_assignable::value),
>>> "");
>>> -#if __cplusplus >= 201402
>>>  static_assert(test(), "");
>>> -#endif
>>>  }
>>>  {
>>>  using T = X;
>>>  
>>> static_assert((std::is_trivially_copy_assignable::value),
>>> "");
>>> -#if __cplusplus >= 201402
>>>  static_assert(test(), "");
>>> -#endif
>>>  }
>>>  static_assert(!(std::is_trivially_copy_assignable::value),
>>> "");
>>>  
>>> static_assert(!(std::is_trivially_copy_assignable::value),
>>> "");
>>>
>>> Modified: libcxx/trunk/test/libcxx/utilities/optional/optional.object/
>>> optional.object.assign/move.pass.cpp
>>> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx
>>> /utilities/optional/optional.object/optional.object.assign/m
>>> ove.pass.cpp?rev=284005=284004=284005=diff
>>> 
>>> ==
>>> --- libcxx/trunk/test/libcxx/utilities/optional/optional.object/
>>> optional.object.assign/move.pass.cpp (original)
>>> +++ libcxx/trunk/test/libcxx/utilities/optional/optional.object/
>>> optional.object.assign/move.pass.cpp Wed Oct 12 06:29:18 2016
>>> @@ -8,7 +8,6 @@
>>>  //===--
>>> ===//
>>>
>>>  // UNSUPPORTED: c++98, c++03, c++11, c++14
>>> -// XFAIL: libcpp-no-exceptions
>>>  // 
>>>
>>>  // optional& operator=(optional&& rhs);
>>> @@ -42,7 +41,6 @@ struct Z2
>>>  Z2& operator=(Z2&&) = default;
>>>  };
>>>
>>> -#if __cplusplus >= 201402
>>>  template 
>>>  constexpr bool
>>>  test()
>>> @@ -52,23 +50,18 @@ test()
>>>  opt = std::move(opt2);
>>>  return true;
>>>  }
>>> -#endif
>>>
>>>  int main()
>>>  {
>>>  {
>>>  using T = int;
>>>  
>>> static_assert((std::is_trivially_copy_constructible::value),
>>> "");
>>> -#if __cplusplus >= 201402
>>>  static_assert(test(), "");
>>> -#endif
>>>  }
>>>  {
>>>  using T = X;
>>>  
>>> static_assert((std::is_trivially_copy_constructible::value),
>>> "");
>>> -#if __cplusplus >= 201402
>>>  static_assert(test(), "");
>>> -#endif
>>>  }
>>>  static_assert(!(std::is_trivially_move_assignable::value),
>>> "");
>>>  
>>> static_assert(!(std::is_trivially_move_assignable::value),
>>> "");
>>>
>>> Modified: libcxx/trunk/test/libcxx/utilities/optional/optional.object/
>>> optional.object.ctor/copy.pass.cpp
>>> URL: 

Re: [libcxx] r284005 - Remove incorrect XFAILS

2016-10-12 Thread Eric Fiselier via cfe-commits
I just committed those tests, so I kinda had to fix them :-P

On Wed, Oct 12, 2016 at 5:40 AM, Asiri Rathnayake <
asiri.rathnay...@gmail.com> wrote:

> Thanks!
>
> I still have that no-exception cleanup in my TODO list. Just pressed on
> time, hope to get to it soon.
>
> / Asiri
>
> On Wed, Oct 12, 2016 at 12:29 PM, Eric Fiselier via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> Author: ericwf
>> Date: Wed Oct 12 06:29:18 2016
>> New Revision: 284005
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=284005=rev
>> Log:
>> Remove incorrect XFAILS
>>
>> Modified:
>> libcxx/trunk/test/libcxx/utilities/optional/optional.object/
>> optional.object.assign/copy.pass.cpp
>> libcxx/trunk/test/libcxx/utilities/optional/optional.object/
>> optional.object.assign/move.pass.cpp
>> libcxx/trunk/test/libcxx/utilities/optional/optional.object/
>> optional.object.ctor/copy.pass.cpp
>> libcxx/trunk/test/libcxx/utilities/optional/optional.object/
>> optional.object.ctor/move.pass.cpp
>>
>> Modified: libcxx/trunk/test/libcxx/utilities/optional/optional.object/
>> optional.object.assign/copy.pass.cpp
>> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx
>> /utilities/optional/optional.object/optional.object.assign/
>> copy.pass.cpp?rev=284005=284004=284005=diff
>> 
>> ==
>> --- libcxx/trunk/test/libcxx/utilities/optional/optional.object/
>> optional.object.assign/copy.pass.cpp (original)
>> +++ libcxx/trunk/test/libcxx/utilities/optional/optional.object/
>> optional.object.assign/copy.pass.cpp Wed Oct 12 06:29:18 2016
>> @@ -8,7 +8,6 @@
>>  //===--
>> ===//
>>
>>  // UNSUPPORTED: c++98, c++03, c++11, c++14
>> -// XFAIL: libcpp-no-exceptions
>>  // 
>>
>>  // optional& operator=(const optional& rhs);
>> @@ -45,7 +44,6 @@ struct Z2
>>  Z2& operator=(const Z2&) = default;
>>  };
>>
>> -#if __cplusplus >= 201402
>>  template 
>>  constexpr bool
>>  test()
>> @@ -55,23 +53,18 @@ test()
>>  opt = opt2;
>>  return true;
>>  }
>> -#endif
>>
>>  int main()
>>  {
>>  {
>>  using T = int;
>>  
>> static_assert((std::is_trivially_copy_assignable::value),
>> "");
>> -#if __cplusplus >= 201402
>>  static_assert(test(), "");
>> -#endif
>>  }
>>  {
>>  using T = X;
>>  
>> static_assert((std::is_trivially_copy_assignable::value),
>> "");
>> -#if __cplusplus >= 201402
>>  static_assert(test(), "");
>> -#endif
>>  }
>>  static_assert(!(std::is_trivially_copy_assignable::value),
>> "");
>>  
>> static_assert(!(std::is_trivially_copy_assignable::value),
>> "");
>>
>> Modified: libcxx/trunk/test/libcxx/utilities/optional/optional.object/
>> optional.object.assign/move.pass.cpp
>> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx
>> /utilities/optional/optional.object/optional.object.assign/
>> move.pass.cpp?rev=284005=284004=284005=diff
>> 
>> ==
>> --- libcxx/trunk/test/libcxx/utilities/optional/optional.object/
>> optional.object.assign/move.pass.cpp (original)
>> +++ libcxx/trunk/test/libcxx/utilities/optional/optional.object/
>> optional.object.assign/move.pass.cpp Wed Oct 12 06:29:18 2016
>> @@ -8,7 +8,6 @@
>>  //===--
>> ===//
>>
>>  // UNSUPPORTED: c++98, c++03, c++11, c++14
>> -// XFAIL: libcpp-no-exceptions
>>  // 
>>
>>  // optional& operator=(optional&& rhs);
>> @@ -42,7 +41,6 @@ struct Z2
>>  Z2& operator=(Z2&&) = default;
>>  };
>>
>> -#if __cplusplus >= 201402
>>  template 
>>  constexpr bool
>>  test()
>> @@ -52,23 +50,18 @@ test()
>>  opt = std::move(opt2);
>>  return true;
>>  }
>> -#endif
>>
>>  int main()
>>  {
>>  {
>>  using T = int;
>>  
>> static_assert((std::is_trivially_copy_constructible::value),
>> "");
>> -#if __cplusplus >= 201402
>>  static_assert(test(), "");
>> -#endif
>>  }
>>  {
>>  using T = X;
>>  
>> static_assert((std::is_trivially_copy_constructible::value),
>> "");
>> -#if __cplusplus >= 201402
>>  static_assert(test(), "");
>> -#endif
>>  }
>>  static_assert(!(std::is_trivially_move_assignable::value),
>> "");
>>  
>> static_assert(!(std::is_trivially_move_assignable::value),
>> "");
>>
>> Modified: libcxx/trunk/test/libcxx/utilities/optional/optional.object/
>> optional.object.ctor/copy.pass.cpp
>> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx
>> /utilities/optional/optional.object/optional.object.ctor/
>> copy.pass.cpp?rev=284005=284004=284005=diff
>> 
>> ==
>> --- libcxx/trunk/test/libcxx/utilities/optional/optional.object/
>> 

  1   2   >