r263854 - [TLS on Darwin] use CXX_FAST_TLS calling convention for tls_init.

2016-03-18 Thread Manman Ren via cfe-commits
Author: mren
Date: Fri Mar 18 18:35:21 2016
New Revision: 263854

URL: http://llvm.org/viewvc/llvm-project?rev=263854=rev
Log:
[TLS on Darwin] use CXX_FAST_TLS calling convention for tls_init.

This makes sure we don't generate a lot of code to spill/reload
CSRs when calling tls_init from the access functions.

This helps performance when tls_init is not inlined into the access
functions.

Modified:
cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
cfe/trunk/test/CodeGenCXX/cxx11-thread-local-reference.cpp
cfe/trunk/test/CodeGenCXX/cxx11-thread-local.cpp

Modified: cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp?rev=263854=263853=263854=diff
==
--- cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp (original)
+++ cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp Fri Mar 18 18:35:21 2016
@@ -2237,6 +2237,11 @@ void ItaniumCXXABI::EmitThreadLocalInitF
 CodeGenFunction(CGM)
 .GenerateCXXGlobalInitFunc(InitFunc, CXXThreadLocalInits,
Address(Guard, GuardAlign));
+// On Darwin platforms, use CXX_FAST_TLS calling convention.
+if (CGM.getTarget().getTriple().isOSDarwin()) {
+  InitFunc->setCallingConv(llvm::CallingConv::CXX_FAST_TLS);
+  InitFunc->addFnAttr(llvm::Attribute::NoUnwind);
+}
   }
   for (const VarDecl *VD : CXXThreadLocals) {
 llvm::GlobalVariable *Var =
@@ -2286,8 +2291,11 @@ void ItaniumCXXABI::EmitThreadLocalInitF
 llvm::BasicBlock *Entry = llvm::BasicBlock::Create(Context, "", Wrapper);
 CGBuilderTy Builder(CGM, Entry);
 if (InitIsInitFunc) {
-  if (Init)
-Builder.CreateCall(Init);
+  if (Init) {
+llvm::CallInst *CallVal = Builder.CreateCall(Init);
+if (isThreadWrapperReplaceable(VD, CGM))
+  CallVal->setCallingConv(llvm::CallingConv::CXX_FAST_TLS);
+  }
 } else {
   // Don't know whether we have an init function. Call it if it exists.
   llvm::Value *Have = Builder.CreateIsNotNull(Init);

Modified: cfe/trunk/test/CodeGenCXX/cxx11-thread-local-reference.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/cxx11-thread-local-reference.cpp?rev=263854=263853=263854=diff
==
--- cfe/trunk/test/CodeGenCXX/cxx11-thread-local-reference.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/cxx11-thread-local-reference.cpp Fri Mar 18 
18:35:21 2016
@@ -23,11 +23,13 @@ int () { return r; }
 
 // LINUX: define weak_odr hidden i32* @_ZTW1r() [[ATTR0:#[0-9]+]] {
 // DARWIN: define cxx_fast_tlscc i32* @_ZTW1r() [[ATTR1:#[0-9]+]] {
-// CHECK: call void @_ZTH1r()
+// LINUX: call void @_ZTH1r()
+// DARWIN: call cxx_fast_tlscc void @_ZTH1r()
 // CHECK: load i32*, i32** @r, align 8
 // CHECK: ret i32* %{{.*}}
 
-// CHECK-LABEL: define internal void @__tls_init()
+// LINUX-LABEL: define internal void @__tls_init()
+// DARWIN-LABEL: define internal cxx_fast_tlscc void @__tls_init()
 // CHECK: call void @[[R_INIT]]()
 
 // LINUX: attributes [[ATTR0]] = { {{.*}}"target-features"{{.*}} }

Modified: cfe/trunk/test/CodeGenCXX/cxx11-thread-local.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/cxx11-thread-local.cpp?rev=263854=263853=263854=diff
==
--- cfe/trunk/test/CodeGenCXX/cxx11-thread-local.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/cxx11-thread-local.cpp Fri Mar 18 18:35:21 2016
@@ -122,7 +122,8 @@ int f() {
 
 // LINUX-LABEL: define weak_odr hidden i32* @_ZTWN1VIiE1mE()
 // DARWIN-LABEL: define weak_odr hidden cxx_fast_tlscc i32* @_ZTWN1VIiE1mE()
-// CHECK: call void @_ZTHN1VIiE1mE()
+// LINUX: call void @_ZTHN1VIiE1mE()
+// DARWIN: call cxx_fast_tlscc void @_ZTHN1VIiE1mE()
 // CHECK: ret i32* @_ZN1VIiE1mE
 
 
@@ -212,7 +213,8 @@ void set_anon_i() {
 
 // LIUNX: define weak_odr hidden i32* @_ZTW1a() {
 // DARWIN: define cxx_fast_tlscc i32* @_ZTW1a()
-// CHECK:   call void @_ZTH1a()
+// LINUX:   call void @_ZTH1a()
+// DARWIN: call cxx_fast_tlscc void @_ZTH1a()
 // CHECK:   ret i32* @a
 // CHECK: }
 
@@ -222,12 +224,14 @@ void set_anon_i() {
 
 // LINUX-LABEL: define internal i32* @_ZTWL1d()
 // DARWIN-LABEL: define internal cxx_fast_tlscc i32* @_ZTWL1d()
-// CHECK: call void @_ZTHL1d()
+// LINUX: call void @_ZTHL1d()
+// DARWIN: call cxx_fast_tlscc void @_ZTHL1d()
 // CHECK: ret i32* @_ZL1d
 
 // LINUX-LABEL: define weak_odr hidden i32* @_ZTWN1U1mE()
 // DARWIN-LABEL: define cxx_fast_tlscc i32* @_ZTWN1U1mE()
-// CHECK: call void @_ZTHN1U1mE()
+// LINUX: call void @_ZTHN1U1mE()
+// DARWIN: call cxx_fast_tlscc void @_ZTHN1U1mE()
 // CHECK: ret i32* @_ZN1U1mE
 
 // LINUX: attributes [[ATTR]] = { {{.+}} }


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


Re: [PATCH] D18191: [clang-tidy] Add check for function parameters that are const& to builtin types

2016-03-18 Thread Steve Downey via cfe-commits
sdowney updated this revision to Diff 50982.
sdowney added a comment.

Add more test cases, covering templates, template specializations, function 
definitions, member function templates.

Check if parent function of the argument is a nullptr.

Fix spelling mistake.


http://reviews.llvm.org/D18191

Files:
  clang-tidy/misc/CMakeLists.txt
  clang-tidy/misc/ConstRefBuiltinCheck.cpp
  clang-tidy/misc/ConstRefBuiltinCheck.h
  clang-tidy/misc/MiscTidyModule.cpp
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/misc-const-ref-builtin.rst
  test/clang-tidy/misc-const-ref-builtin.cpp

Index: test/clang-tidy/misc-const-ref-builtin.cpp
===
--- /dev/null
+++ test/clang-tidy/misc-const-ref-builtin.cpp
@@ -0,0 +1,94 @@
+// RUN: %check_clang_tidy %s misc-const-ref-builtin %t
+
+void f(const int& i);
+// CHECK-MESSAGES: :[[@LINE-1]]:19: warning: const reference to 'int' at parameter 'i' in function 'f' [misc-const-ref-builtin]
+
+void f(const int& i) {
+  // CHECK-MESSAGES: :[[@LINE-1]]:19: warning: const reference to 'int' at parameter 'i' in function 'f' [misc-const-ref-builtin]
+  int k = i;
+}
+
+void f2(const int&);
+// CHECK-MESSAGES: :[[@LINE-1]]:19: warning: const reference to 'int' type at index '0' in function 'f2' [misc-const-ref-builtin]
+
+void f2(const int& i) {
+  // CHECK-MESSAGES: :[[@LINE-1]]:20: warning: const reference to 'int' at parameter 'i' in function 'f2' [misc-const-ref-builtin]
+  int k = i;
+}
+
+typedef int Int;
+void t(const Int& i);
+// CHECK-MESSAGES: :[[@LINE-1]]:19:  warning: const reference to 'Int' (aka 'int') at parameter 'i' in function 't' [misc-const-ref-builtin]
+
+void t(const Int& i) {
+  // CHECK-MESSAGES: :[[@LINE-1]]:19:  warning: const reference to 'Int' (aka 'int') at parameter 'i' in function 't' [misc-const-ref-builtin]
+  int k = i;
+}
+
+//Function template
+template
+void g(const T& t_) {
+  T t = t_;
+}
+
+// Explicit Specialization
+template<>
+void g(const long& l) {
+  //CHECK-MESSAGES: :[[@LINE-1]]:26: warning: const reference to 'long' at parameter 'l' in function 'g' [misc-const-ref-builtin]
+  long i = l;
+}
+
+
+// Explicit Specialization (deduced type)
+template<>
+void g(const double& d) {
+  //CHECK-MESSAGES: :[[@LINE-1]]:22:  warning: const reference to 'double' at parameter 'd' in function 'g' [misc-const-ref-builtin]
+ double f = d;
+}
+
+template
+void g2(const T&, const char& c);
+//CHECK-MESSAGES: :[[@LINE-1]]:31: warning: const reference to 'char' at parameter 'c' in function 'g2' [misc-const-ref-builtin]
+
+template
+class Klass {
+public:
+  void k(const T& t);
+  void k2(const short& s);
+  //CHECK-MESSAGES: :[[@LINE-1]]:24: warning: const reference to 'short' at parameter 's' in function 'k2' [misc-const-ref-builtin]
+  void k3(const T& t, const short& s);
+  //CHECK-MESSAGES: :[[@LINE-1]]:36: warning: const reference to 'short' at parameter 's' in function 'k3' [misc-const-ref-builtin]
+};
+
+class K2 {
+public:
+  template
+  void f(const T& t);
+};
+
+class Bar {};
+
+void X() {
+  g(5);
+  g(123.456);
+  g2(5,'a');
+  Klass kbar;
+  K2 k2;
+  k2.f(6);
+};
+
+void f3();
+
+void h(int& i);
+
+void f4(const Bar& bar);
+
+class Baz {
+  int i;
+};
+
+void f5(const Baz& baz);
+
+void f(const int& i, const int& j);
+// CHECK-MESSAGES: :[[@LINE-1]]:19: warning: const reference to 'int' at parameter 'i' in function 'f' [misc-const-ref-builtin]
+// CHECK-MESSAGES: :[[@LINE-2]]:33: warning: const reference to 'int' at parameter 'j' in function 'f' [misc-const-ref-builtin]
Index: docs/clang-tidy/checks/misc-const-ref-builtin.rst
===
--- /dev/null
+++ docs/clang-tidy/checks/misc-const-ref-builtin.rst
@@ -0,0 +1,28 @@
+.. title:: clang-tidy - misc-const-ref-builtin
+
+misc-const-ref-builtin
+==
+
+This check will warn about function arguments that are const refs to builtin
+types, such as int or double. It will also warn about const refs to typedefs to
+builtin types. It will not flag function arguments that are due to template
+instantiations.
+
+Example code::
+
+  void f(const int& i);
+
+
+The parameter i will be flagged.
+
+Example code::
+
+  template
+  void g(const T&);
+
+  void X() {
+  g(5);
+  }
+
+
+The instantiation of g will not be flagged.
Index: docs/clang-tidy/checks/list.rst
===
--- docs/clang-tidy/checks/list.rst
+++ docs/clang-tidy/checks/list.rst
@@ -48,6 +48,7 @@
misc-assert-side-effect
misc-assign-operator-signature
misc-bool-pointer-implicit-conversion
+   misc-const-ref-builtin
misc-definitions-in-headers
misc-inaccurate-erase
misc-incorrect-roundings
Index: clang-tidy/misc/MiscTidyModule.cpp
===
--- clang-tidy/misc/MiscTidyModule.cpp
+++ clang-tidy/misc/MiscTidyModule.cpp
@@ -14,6 +14,7 @@
 #include 

Re: [PATCH] D17482: [clang-tidy] Allow tests to verify changes made to header files

2016-03-18 Thread Richard via cfe-commits
LegalizeAdulthood added a comment.

In http://reviews.llvm.org/D17482#372677, @alexfh wrote:

> Can you [...] say how many times this feature is going to be used, if it gets 
> added to the testing script?


Since you can't verify changes against headers right now, noone has bothered to 
add test cases for their checks against headers.

However, I think a case can be made that every check potentially operates 
against headers and that they should be verified as such.  But, since you can't 
do this in the build right now, noone has written such tests.


http://reviews.llvm.org/D17482



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


[libcxx] r263746 - unord: Extract key to avoid preemptive mallocs in insert/emplace

2016-03-18 Thread Duncan P. N. Exon Smith via cfe-commits
Author: dexonsmith
Date: Thu Mar 17 15:45:20 2016
New Revision: 263746

URL: http://llvm.org/viewvc/llvm-project?rev=263746=rev
Log:
unord: Extract key to avoid preemptive mallocs in insert/emplace

unordered_set::emplace and unordered_map::emplace construct a node, then
try to insert it.  If insertion fails, the node gets deleted.

To avoid this unnecessary malloc traffic, check to see if the argument
to emplace has the appropriate key_type.  If so, we can use that key
directly and delay the malloc until we're sure we're inserting something
new.

Test updates by Eric Fiselier, who rewrote the old allocation tests to
include the new cases.

There are two orthogonal future directions:

1. Apply the same optimization to set and map.

2. Extend the optimization to when the argument is not key_type, but can
   be converted to it without side effects.  Ideally, we could do this
   whenever key_type is trivially destructible and the argument is
   trivially convertible to key_type, but in practise the relevant type
   traits "blow up sometimes".  At least, we should catch a few simple
   cases (such as when both are primitive types).

Added:

libcxx/trunk/test/std/containers/unord/unord.map/unord.map.modifiers/insert_and_emplace_allocator_requirements.pass.cpp
  - copied, changed from r263688, 
libcxx/trunk/test/std/containers/unord/unord.map/unord.map.modifiers/insert_allocator_requirements.pass.cpp

libcxx/trunk/test/std/containers/unord/unord.set/insert_and_emplace_allocator_requirements.pass.cpp
  - copied, changed from r263688, 
libcxx/trunk/test/std/containers/unord/unord.set/insert_allocator_requirements.pass.cpp
Removed:

libcxx/trunk/test/libcxx/containers/unord/unord.set/insert_dup_alloc.pass.cpp

libcxx/trunk/test/std/containers/unord/unord.map/unord.map.modifiers/insert_allocator_requirements.pass.cpp

libcxx/trunk/test/std/containers/unord/unord.set/insert_allocator_requirements.pass.cpp
Modified:
libcxx/trunk/include/__hash_table

Modified: libcxx/trunk/include/__hash_table
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__hash_table?rev=263746=263745=263746=diff
==
--- libcxx/trunk/include/__hash_table (original)
+++ libcxx/trunk/include/__hash_table Thu Mar 17 15:45:20 2016
@@ -100,6 +100,23 @@ __next_hash_pow2(size_t __n)
 return size_t(1) << (std::numeric_limits::digits - __clz(__n-1));
 }
 
+#ifndef _LIBCPP_CXX03_LANG
+struct __extract_key_fail_tag {};
+struct __extract_key_self_tag {};
+struct __extract_key_first_tag {};
+
+template ::type>
+struct __can_extract_key
+: conditional::value, __extract_key_self_tag,
+  __extract_key_fail_tag>::type {};
+
+template 
+struct __can_extract_key<_Pair, _Key, pair<_First, _Second>>
+: conditional::value,
+  __extract_key_first_tag, __extract_key_fail_tag>::type {};
+#endif
+
 template  class 
__hash_table;
 
 template   class _LIBCPP_TYPE_VIS_ONLY __hash_iterator;
@@ -903,6 +920,7 @@ public:
 
 typedef typename _NodeTypes::__node_value_type   __node_value_type;
 typedef typename _NodeTypes::__container_value_type  
__container_value_type;
+typedef typename _NodeTypes::key_typekey_type;
 typedef value_type&  reference;
 typedef const value_type&const_reference;
 typedef typename __alloc_traits::pointer pointer;
@@ -1041,13 +1059,49 @@ public:
 
 #ifndef _LIBCPP_CXX03_LANG
 template 
+_LIBCPP_INLINE_VISIBILITY
 pair __emplace_unique_key_args(_Key const& __k, _Args&&... 
__args);
 
 template 
-pair __emplace_unique(_Args&&... __args);
+_LIBCPP_INLINE_VISIBILITY
+pair __emplace_unique_impl(_Args&&... __args);
+
+template 
+_LIBCPP_INLINE_VISIBILITY
+pair __emplace_unique(_Pp&& __x) {
+  return __emplace_unique_extract_key(_VSTD::forward<_Pp>(__x),
+  __can_extract_key<_Pp, key_type>());
+}
+template 
+_LIBCPP_INLINE_VISIBILITY
+pair __emplace_unique(_Args&&... __args) {
+  return __emplace_unique_impl(_VSTD::forward<_Args>(__args)...);
+}
+
+template 
+_LIBCPP_INLINE_VISIBILITY
+pair
+__emplace_unique_extract_key(_Pp&& __x, __extract_key_fail_tag) {
+  return __emplace_unique_impl(_VSTD::forward<_Pp>(__x));
+}
+template 
+_LIBCPP_INLINE_VISIBILITY
+pair
+__emplace_unique_extract_key(_Pp&& __x, __extract_key_self_tag) {
+  return __emplace_unique_key_args(__x, _VSTD::forward<_Pp>(__x));
+}
+template 
+_LIBCPP_INLINE_VISIBILITY
+pair
+__emplace_unique_extract_key(_Pp&& __x, __extract_key_first_tag) {
+  return 

[PATCH] D18268: [Objective-c] Fix a crash in WeakObjectProfileTy::getBaseInfo

2016-03-18 Thread Akira Hatanaka via cfe-commits
ahatanak created this revision.
ahatanak added a reviewer: jordan_rose.
ahatanak added a subscriber: cfe-commits.

The crash occurs in WeakObjectProfileTy::getBaseInfo when getBase() is called 
on an ObjCPropertyRefExpr object whose receiver is an interface. This patch 
fixes the crash by checking the type of the receiver and setting IsExact to 
true if it is an interface.

http://reviews.llvm.org/D18268

Files:
  lib/Sema/ScopeInfo.cpp
  test/SemaObjC/arc-repeated-weak.mm

Index: test/SemaObjC/arc-repeated-weak.mm
===
--- test/SemaObjC/arc-repeated-weak.mm
+++ test/SemaObjC/arc-repeated-weak.mm
@@ -439,3 +439,15 @@
 }
 @end
 
+// This used to crash in WeakObjectProfileTy::getBaseInfo when getBase() was
+// called on an ObjCPropertyRefExpr object whose receiver was an interface.
+
+@class NSString;
+@interface NSBundle
++(NSBundle *)foo;
+@property NSString *prop;
+@end
+
+void foo() {
+  NSString * t = NSBundle.foo.prop;
+}
Index: lib/Sema/ScopeInfo.cpp
===
--- lib/Sema/ScopeInfo.cpp
+++ lib/Sema/ScopeInfo.cpp
@@ -86,11 +86,15 @@
 if (BaseProp) {
   D = getBestPropertyDecl(BaseProp);
 
-  const Expr *DoubleBase = BaseProp->getBase();
-  if (const OpaqueValueExpr *OVE = dyn_cast(DoubleBase))
-DoubleBase = OVE->getSourceExpr();
-
-  IsExact = DoubleBase->isObjCSelfExpr();
+  if (BaseProp->isClassReceiver())
+IsExact = true;
+  else {
+const Expr *DoubleBase = BaseProp->getBase();
+if (const OpaqueValueExpr *OVE = dyn_cast(DoubleBase))
+  DoubleBase = OVE->getSourceExpr();
+
+IsExact = DoubleBase->isObjCSelfExpr();
+  }
 }
 break;
   }


Index: test/SemaObjC/arc-repeated-weak.mm
===
--- test/SemaObjC/arc-repeated-weak.mm
+++ test/SemaObjC/arc-repeated-weak.mm
@@ -439,3 +439,15 @@
 }
 @end
 
+// This used to crash in WeakObjectProfileTy::getBaseInfo when getBase() was
+// called on an ObjCPropertyRefExpr object whose receiver was an interface.
+
+@class NSString;
+@interface NSBundle
++(NSBundle *)foo;
+@property NSString *prop;
+@end
+
+void foo() {
+  NSString * t = NSBundle.foo.prop;
+}
Index: lib/Sema/ScopeInfo.cpp
===
--- lib/Sema/ScopeInfo.cpp
+++ lib/Sema/ScopeInfo.cpp
@@ -86,11 +86,15 @@
 if (BaseProp) {
   D = getBestPropertyDecl(BaseProp);
 
-  const Expr *DoubleBase = BaseProp->getBase();
-  if (const OpaqueValueExpr *OVE = dyn_cast(DoubleBase))
-DoubleBase = OVE->getSourceExpr();
-
-  IsExact = DoubleBase->isObjCSelfExpr();
+  if (BaseProp->isClassReceiver())
+IsExact = true;
+  else {
+const Expr *DoubleBase = BaseProp->getBase();
+if (const OpaqueValueExpr *OVE = dyn_cast(DoubleBase))
+  DoubleBase = OVE->getSourceExpr();
+
+IsExact = DoubleBase->isObjCSelfExpr();
+  }
 }
 break;
   }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D17951: Implement is_always_lock_free

2016-03-18 Thread Ben Craig via cfe-commits
bcraig added a subscriber: bcraig.


Comment at: include/atomic:859
@@ +858,3 @@
+template <> _LIBCPP_CONSTEXPR bool __libcpp_always_lock_free = 2 == 
ATOMIC_CHAR32_T_LOCK_FREE;
+template <> _LIBCPP_CONSTEXPR bool __libcpp_always_lock_free = 2 == 
ATOMIC_WCHAR_T_LOCK_FREE;
+template <> _LIBCPP_CONSTEXPR bool __libcpp_always_lock_free = 2 == 
ATOMIC_SHORT_LOCK_FREE;

Do we need to support configurations were wchar_t is a typedef to an integer 
type, or is that an abomination too painful to deal with?

I have no idea if the rest of libcxx attempts to deal with wchar_t typedefs.


http://reviews.llvm.org/D17951



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


Re: [PATCH] D16579: Warn if friend function depends on template parameters.

2016-03-18 Thread Richard Smith via cfe-commits
rsmith added a subscriber: rsmith.
rsmith added a comment.

It seems useful to warn on this, but I'm concerned that there are valid code 
patterns that this will warn about where there is no reasonable way to rewrite 
the code that would suppress the warning. For instance:

  template class X {
friend void process(X);
// ...
  };
  void process(X) { /* ... */ }
  void process(X) ( /* ... */ }

As an alternative, can we suppress the warning until we see an "almost 
matching" template declaration in the surrounding scope? For instance:

  template void process(X) { /* ... */ } // warning, not a 
friend of X



Comment at: include/clang/Basic/DiagnosticSemaKinds.td:1155-1157
@@ -1153,1 +1154,5 @@
+  "non-template function">, InGroup;
+def note_non_template_friend : Note<"if this is not what you intended, make "
+  "sure the function template has already been declared and add <> after the "
+  "function name here">;
 

Maybe just: "to befriend a template specialization, use <>", along with a 
FixItHint showing where to add the <>.

It would also seem like a good idea to check if there is such a function 
template declared, and give different diagnostic if not.


http://reviews.llvm.org/D16579



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


[PATCH] D18217: [libcxx] Fix -Wdeprecated warnings

2016-03-18 Thread don hinton via cfe-commits
hintonda created this revision.
hintonda added reviewers: rsmith, howard.hinnant, logan.
hintonda added a subscriber: cfe-commits.

Fix -Wdeprecated warning for throw() specs and implicit copy
ctor's and assignmen oper's.

http://reviews.llvm.org/D18217

Files:
  include/__bit_reference
  include/__sso_allocator
  include/codecvt
  include/exception
  include/future
  include/ios
  include/memory
  include/new
  include/regex
  include/stdexcept
  include/system_error
  include/typeinfo
  src/ios.cpp
  src/regex.cpp

Index: src/regex.cpp
===
--- src/regex.cpp
+++ src/regex.cpp
@@ -65,7 +65,7 @@
   __code_(ecode)
 {}
 
-regex_error::~regex_error() throw() {}
+regex_error::~regex_error() _NOEXCEPT {}
 
 namespace {
 
Index: src/ios.cpp
===
--- src/ios.cpp
+++ src/ios.cpp
@@ -84,7 +84,7 @@
 {
 }
 
-ios_base::failure::~failure() throw()
+ios_base::failure::~failure() _NOEXCEPT
 {
 }
 
Index: include/typeinfo
===
--- include/typeinfo
+++ include/typeinfo
@@ -150,7 +150,9 @@
 {
 public:
 bad_cast() _NOEXCEPT;
-virtual ~bad_cast() _NOEXCEPT;
+bad_cast(const bad_cast&) _NOEXCEPT = default;
+bad_cast& operator=(const bad_cast&) _NOEXCEPT = default;
+~bad_cast() _NOEXCEPT;
 virtual const char* what() const _NOEXCEPT;
 };
 
Index: include/system_error
===
--- include/system_error
+++ include/system_error
@@ -626,6 +626,8 @@
 system_error(int __ev, const error_category& __ecat, const string& __what_arg);
 system_error(int __ev, const error_category& __ecat, const char* __what_arg);
 system_error(int __ev, const error_category& __ecat);
+system_error(const system_error&) _NOEXCEPT = default;
+system_error& operator=(const system_error&) _NOEXCEPT = default;
 ~system_error() _NOEXCEPT;
 
 _LIBCPP_ALWAYS_INLINE
Index: include/stdexcept
===
--- include/stdexcept
+++ include/stdexcept
@@ -102,6 +102,9 @@
 _LIBCPP_INLINE_VISIBILITY explicit domain_error(const string& __s) : logic_error(__s) {}
 _LIBCPP_INLINE_VISIBILITY explicit domain_error(const char* __s)   : logic_error(__s) {}
 
+domain_error(const domain_error&) _NOEXCEPT = default;
+domain_error& operator=(const domain_error&) _NOEXCEPT = default;
+
 virtual ~domain_error() _NOEXCEPT;
 };
 
@@ -112,6 +115,9 @@
 _LIBCPP_INLINE_VISIBILITY explicit invalid_argument(const string& __s) : logic_error(__s) {}
 _LIBCPP_INLINE_VISIBILITY explicit invalid_argument(const char* __s)   : logic_error(__s) {}
 
+invalid_argument(const invalid_argument&) _NOEXCEPT = default;
+invalid_argument& operator=(const invalid_argument&) _NOEXCEPT = default;
+
 virtual ~invalid_argument() _NOEXCEPT;
 };
 
@@ -122,6 +128,9 @@
 _LIBCPP_INLINE_VISIBILITY explicit length_error(const string& __s) : logic_error(__s) {}
 _LIBCPP_INLINE_VISIBILITY explicit length_error(const char* __s)   : logic_error(__s) {}
 
+length_error(const length_error&) _NOEXCEPT = default;
+length_error& operator=(const length_error&) _NOEXCEPT = default;
+
 virtual ~length_error() _NOEXCEPT;
 };
 
@@ -132,6 +141,9 @@
 _LIBCPP_INLINE_VISIBILITY explicit out_of_range(const string& __s) : logic_error(__s) {}
 _LIBCPP_INLINE_VISIBILITY explicit out_of_range(const char* __s)   : logic_error(__s) {}
 
+out_of_range(const out_of_range&) _NOEXCEPT = default;
+out_of_range& operator=(const out_of_range&) _NOEXCEPT = default;
+
 virtual ~out_of_range() _NOEXCEPT;
 };
 
@@ -142,6 +154,9 @@
 _LIBCPP_INLINE_VISIBILITY explicit range_error(const string& __s) : runtime_error(__s) {}
 _LIBCPP_INLINE_VISIBILITY explicit range_error(const char* __s)   : runtime_error(__s) {}
 
+range_error(const range_error&) _NOEXCEPT = default;
+range_error& operator=(const range_error&) _NOEXCEPT = default;
+
 virtual ~range_error() _NOEXCEPT;
 };
 
@@ -152,6 +167,9 @@
 _LIBCPP_INLINE_VISIBILITY explicit overflow_error(const string& __s) : runtime_error(__s) {}
 _LIBCPP_INLINE_VISIBILITY explicit overflow_error(const char* __s)   : runtime_error(__s) {}
 
+overflow_error(const overflow_error&) _NOEXCEPT = default;
+overflow_error& operator=(const overflow_error&) _NOEXCEPT = default;
+
 virtual ~overflow_error() _NOEXCEPT;
 };
 
@@ -162,6 +180,9 @@
 _LIBCPP_INLINE_VISIBILITY explicit underflow_error(const string& __s) : runtime_error(__s) {}
 _LIBCPP_INLINE_VISIBILITY explicit underflow_error(const char* __s)   : runtime_error(__s) {}
 
+underflow_error(const underflow_error&) _NOEXCEPT = default;
+underflow_error& operator=(const underflow_error&) _NOEXCEPT = default;
+
 virtual ~underflow_error() _NOEXCEPT;
 };
 
Index: include/regex

Re: [PATCH] D18088: Add a new warning to notify users of mismatched SDK and deployment target

2016-03-18 Thread Edoardo Prezioso via cfe-commits
edward-san added a subscriber: edward-san.
edward-san added a comment.

Excuse me for intruding, but from what I see, this warning applies only to 
Apple SDK. Since SDK could mean everything, what about naming the warning 
accordingly, like '-Wincompatible-apple-sdk' or '-Wapple-incompatible-sdk' and 
adjust the description accordingly?


http://reviews.llvm.org/D18088



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


Re: [PATCH] D18191: [clang-tidy] Add check for function parameters that are const& to builtin types

2016-03-18 Thread Steve Downey via cfe-commits
sdowney added a comment.

In http://reviews.llvm.org/D18191#376471, @LegalizeAdulthood wrote:

> There is utility in the definition of a function in saying that an argument 
> is `const int i` instead of `int i`.  The const-ness declares the intent that 
> this local variable is not going to be modified.  However, there is that 
> oddity in C++ that allows a declaration to say `void f(int i);` and the 
> implementation to say `void f(const int i) { ... }`.
>
> I think I would like the fixit to preserve the const-ness of the argument 
> while still stripping it of it's reference.


The usual pattern for that is to have the definition use const, and the 
declaration not, since it's an implementation detail if the passed parameter is 
modified. And, unfortunately, I'm stuck with one compiler that mangles those 
two differently, causing link errors.

Having void foo(const int i) in a declaration makes me suspicious, since the 
const is meaningless.

I could make this an option? If the option is set, emit 'const type' if the 
Decl hasBody?


http://reviews.llvm.org/D18191



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


Re: [PATCH] D17104: [VFS] Drop path traversal assertion

2016-03-18 Thread Bruno Cardoso Lopes via cfe-commits
Thanks!

On Wed, Mar 16, 2016 at 5:35 AM, NAKAMURA Takumi  wrote:
> chapuni added a subscriber: chapuni.
> chapuni added a comment.
>
> Excuse me, I have reverted it in r263636.
>
>
> 
> Comment at: lib/Frontend/ModuleDependencyCollector.cpp:65
> @@ +64,3 @@
> +static bool real_path(StringRef SrcPath, SmallVectorImpl ) {
> +#ifdef HAVE_REALPATH
> +  char CanonicalPath[256];
> 
> "clang/Config/config.h" doesn't have it and "llvm/Config/config.h" should be 
> unavailable in clang tree.
>
> I suggest you may do;
>
>   # Move it to LLVMSupport.
>   # Detect HAVE_REALPATH in clang's cmakefiles.
>   # Export HAVE_REALPATH into llvm-config.h.
>
>
>
>
> http://reviews.llvm.org/D17104
>
>
>



-- 
Bruno Cardoso Lopes
http://www.brunocardoso.cc
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D17784: Check if LLVM_PREFIX is defined before using it.

2016-03-18 Thread Chaoren Lin via cfe-commits
chaoren updated this revision to Diff 50993.
chaoren added a comment.

Remove usage of LLVM_PREFIX altogether.


http://reviews.llvm.org/D17784

Files:
  lib/Driver/ToolChains.cpp

Index: lib/Driver/ToolChains.cpp
===
--- lib/Driver/ToolChains.cpp
+++ lib/Driver/ToolChains.cpp
@@ -2607,10 +2607,6 @@
   if (getVFS().exists(InstallRelDir = InstalledDir + "/../target"))
 return InstallRelDir;
 
-  std::string PrefixRelDir = std::string(LLVM_PREFIX) + "/target";
-  if (getVFS().exists(PrefixRelDir))
-return PrefixRelDir;
-
   return InstallRelDir;
 }
 


Index: lib/Driver/ToolChains.cpp
===
--- lib/Driver/ToolChains.cpp
+++ lib/Driver/ToolChains.cpp
@@ -2607,10 +2607,6 @@
   if (getVFS().exists(InstallRelDir = InstalledDir + "/../target"))
 return InstallRelDir;
 
-  std::string PrefixRelDir = std::string(LLVM_PREFIX) + "/target";
-  if (getVFS().exists(PrefixRelDir))
-return PrefixRelDir;
-
   return InstallRelDir;
 }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D16989: Change interpretation of function definition in friend declaration of template class.

2016-03-18 Thread Serge Pavlov via cfe-commits
sepavloff added a comment.

Topic of friend function instantiation in C++ Standard discussion group 



http://reviews.llvm.org/D16989



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


Re: r263732 - Remove defaulted move ops, the type is zero-cost copyable anyway, so there's no need for specific move ops

2016-03-18 Thread don hinton via cfe-commits
I just did some tests, and when a derived class is explicitly moved, e.g.,
with std::move(), the current behavior is (clang++/g++/vc++):

1) if base has implicit move, it gets called
2) if base doesn't have an implicit move (because a copy ctor was define,
etc) copy ctor is called
3) if base class move was explicitly deleted, compile time error

I was surprised by #2.

On Thu, Mar 17, 2016 at 4:51 PM, David Blaikie  wrote:

>
>
> On Thu, Mar 17, 2016 at 1:41 PM, don hinton  wrote:
>
>> Dave:
>>
>> Won't this prevent UnresolvedSet from being movable?
>>
>> I was under the impression that all subobjects (base class in this case)
>> had to be movable in order for the compiler to generate implicit move ops.
>> Is that not the case?
>>
>
> Yeah, I think you're right (I thought the language had been fixed/changed
> here, so that a type with a copyable-but-not-movable member, and a movable
> (but possibly non-copyable member) could still be moved, and just move the
> moveable parts and copy the non-movable parts - but I can't see any
> evidence of that). Added explicit (empty) move ops in r263747
>
>
>>
>> thanks...
>> don
>>
>> On Thu, Mar 17, 2016 at 2:28 PM, David Blaikie via cfe-commits <
>> cfe-commits@lists.llvm.org> wrote:
>>
>>> Author: dblaikie
>>> Date: Thu Mar 17 13:28:16 2016
>>> New Revision: 263732
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=263732=rev
>>> Log:
>>> Remove defaulted move ops, the type is zero-cost copyable anyway, so
>>> there's no need for specific move ops
>>>
>>> (addresses MSVC build error, since MSVC 2013 can't generate default move
>>> ops)
>>>
>>> Modified:
>>> cfe/trunk/include/clang/AST/UnresolvedSet.h
>>>
>>> Modified: cfe/trunk/include/clang/AST/UnresolvedSet.h
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/UnresolvedSet.h?rev=263732=263731=263732=diff
>>>
>>> ==
>>> --- cfe/trunk/include/clang/AST/UnresolvedSet.h (original)
>>> +++ cfe/trunk/include/clang/AST/UnresolvedSet.h Thu Mar 17 13:28:16 2016
>>> @@ -61,9 +61,7 @@ private:
>>>template  friend class UnresolvedSet;
>>>UnresolvedSetImpl() = default;
>>>UnresolvedSetImpl(const UnresolvedSetImpl &) = default;
>>> -  UnresolvedSetImpl(UnresolvedSetImpl &&) = default;
>>>UnresolvedSetImpl =(const UnresolvedSetImpl &) = default;
>>> -  UnresolvedSetImpl =(UnresolvedSetImpl &&) = default;
>>>
>>>  public:
>>>// We don't currently support assignment through this iterator, so we
>>> might
>>>
>>>
>>> ___
>>> 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


r263766 - Remove usage of LLVM_PREFIX.

2016-03-18 Thread Chaoren Lin via cfe-commits
Author: chaoren
Date: Thu Mar 17 19:05:37 2016
New Revision: 263766

URL: http://llvm.org/viewvc/llvm-project?rev=263766=rev
Log:
Remove usage of LLVM_PREFIX.

Summary: LLVM_PREFIX could be undefined if CMAKE_INSTALL_PREFIX were set to 
empty.

Reviewers: kparzysz, bkramer, chandlerc

Subscribers: cfe-commits

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

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

Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=263766=263765=263766=diff
==
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Thu Mar 17 19:05:37 2016
@@ -2581,10 +2581,6 @@ std::string HexagonToolChain::getHexagon
   if (getVFS().exists(InstallRelDir = InstalledDir + "/../target"))
 return InstallRelDir;
 
-  std::string PrefixRelDir = std::string(LLVM_PREFIX) + "/target";
-  if (getVFS().exists(PrefixRelDir))
-return PrefixRelDir;
-
   return InstallRelDir;
 }
 


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


Re: [PATCH] D18263: [clang-tools-extra] Add release notes documentation

2016-03-18 Thread Alexander Kornienko via cfe-commits
alexfh accepted this revision.
alexfh added a comment.
This revision is now accepted and ready to land.

Looks good with one comment. Thank you, Richard!



Comment at: docs/ReleaseNotes.rst:29
@@ +28,3 @@
+For more information about Clang or LLVM, including information about
+the latest release, please check out the main please see the `Clang Web
+Site `_ or the `LLVM Web

"please check out the main" seems to have been left here unintentionally.


http://reviews.llvm.org/D18263



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


Re: [PATCH] D18280: [tsan] Allow -fsanitize=thread for iOS-style simulator targets

2016-03-18 Thread Devin Coughlin via cfe-commits
dcoughlin added a comment.

There is a related patch for compiler-rt at http://reviews.llvm.org/D18277


http://reviews.llvm.org/D18280



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


Re: [PATCH] D17950: Implement is_always_lock_free

2016-03-18 Thread James Y Knight via cfe-commits
On Thu, Mar 17, 2016 at 12:55 PM, Craig, Ben 
wrote:

> I know that MIPS does that, and an out-of-tree implementation of hexagon
> implements 1-byte cmpxchg in terms of the 4-byte version. The emulation
> code isn't particularly small, and it seems reasonable to make it a libcall.


That's fine. Either do it inline or via an out-of-line version of the same
code, in a libcall. Either way acts the same, that is something that the
target backend can decide to do whenever it wants.

The important property for Clang is that it know whether it's lock-free or
not. And I don't believe there's any reason to use a mutex to implement a
1-byte ,cmpxchg on a platform with a 4-byte cmpxchg instruction available.

  The emulation code seems sketchy from a correctness perspective, as you
> end up generating unsolicited loads and stores on adjacent bytes.


I disagree. I do not see how expanding a subword cmpxchg into a
word-size-and-aligned cmpxchg could possibly cause a problem.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D17950: Implement is_always_lock_free

2016-03-18 Thread JF Bastien via cfe-commits
jfb added a comment.

In http://reviews.llvm.org/D17950#376349, @jyknight wrote:

> This conflicts with http://reviews.llvm.org/D17933. Most of this change also 
> seems unnecessary.
>
> - I think the `is_always_lock_free` function should be defined based on the 
> existing `__atomic_always_lock_free` builtin, not on defines (just like 
> is_lock_free uses `__atomic_is_lock_free`, or `__c11_atomic_is_lock_free`, 
> which is effectively an alias).
> - Then, the new `__GCC_ATOMIC_DOUBLE_LOCK_FREE` macros are unnecessary, 
> unless we need to actually define a `ATOMIC_DOUBLE_LOCK_FREE` macro.
> - `__LLVM_ATOMIC_1_BYTES_LOCK_FREE` effectively duplicates 
> `__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1`, so aren't needed.


Hmm, when I originally wrote the paper I though I'd tried that. Can't remember 
why I went the other way, let me try out `__atomic_always_lock_free`. That 
would indeed be much simpler as it would be a pure libc++ change., thanks for 
raising the issue.



Comment at: lib/Frontend/InitPreprocessor.cpp:305
@@ +304,3 @@
+if (TypeWidth == TypeAlign && (TypeWidth & (TypeWidth - 1)) == 0 &&
+TypeWidth <= InlineWidth)
+  return Always;

bcraig wrote:
> On some targets (like Hexagon), 4-byte values are cheap to inline, but 1-byte 
> values are not.  Clang is spotty about checking this, but 
> TargetInfo::hasBuiltinAtomic seems like the right function to ask, if you 
> have access to it.
You're commenting on:
```
if (TypeWidth == TypeAlign && (TypeWidth & (TypeWidth - 1)) == 0 &&
TypeWidth <= InlineWidth)
```
?

Are you asking for a separate change, or for a change to my patch?


http://reviews.llvm.org/D17950



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


Re: [PATCH] D17950: Implement is_always_lock_free

2016-03-18 Thread James Y Knight via cfe-commits
> A 4 byte cmpxchg could be lock free, while a 1 byte cmpxchg may not be
lock free.

That's not possible: if you have a 4-byte cmpxchg instruction, you can use
it to implement a 1-byte cmpxchg, too. Many targets do this already. (It
would be better if that was available generically so that code didn't need
to be written separately fit each target, but that's not the case at the
moment.)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] r263726 - Fix Clang-tidy modernize-deprecated-headers warnings; other minor fixes.

2016-03-18 Thread Eugene Zelenko via cfe-commits
Author: eugenezelenko
Date: Thu Mar 17 12:02:25 2016
New Revision: 263726

URL: http://llvm.org/viewvc/llvm-project?rev=263726=rev
Log:
Fix Clang-tidy modernize-deprecated-headers warnings; other minor fixes.

Differential revision: http://reviews.llvm.org/D18231

Modified:
clang-tools-extra/trunk/clang-query/QueryParser.h
clang-tools-extra/trunk/clang-rename/RenamingAction.cpp
clang-tools-extra/trunk/clang-rename/USRFindingAction.cpp
clang-tools-extra/trunk/clang-rename/tool/ClangRename.cpp
clang-tools-extra/trunk/pp-trace/PPCallbacksTracker.cpp
clang-tools-extra/trunk/unittests/clang-rename/USRLocFindingTest.cpp

Modified: clang-tools-extra/trunk/clang-query/QueryParser.h
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-query/QueryParser.h?rev=263726=263725=263726=diff
==
--- clang-tools-extra/trunk/clang-query/QueryParser.h (original)
+++ clang-tools-extra/trunk/clang-query/QueryParser.h Thu Mar 17 12:02:25 2016
@@ -13,7 +13,7 @@
 #include "Query.h"
 #include "QuerySession.h"
 #include "llvm/LineEditor/LineEditor.h"
-#include 
+#include 
 
 namespace clang {
 namespace query {
@@ -69,4 +69,4 @@ private:
 } // namespace query
 } // namespace clang
 
-#endif
+#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_QUERY_QUERY_PARSER_H

Modified: clang-tools-extra/trunk/clang-rename/RenamingAction.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-rename/RenamingAction.cpp?rev=263726=263725=263726=diff
==
--- clang-tools-extra/trunk/clang-rename/RenamingAction.cpp (original)
+++ clang-tools-extra/trunk/clang-rename/RenamingAction.cpp Thu Mar 17 12:02:25 
2016
@@ -24,9 +24,6 @@
 #include "clang/Tooling/CommonOptionsParser.h"
 #include "clang/Tooling/Refactoring.h"
 #include "clang/Tooling/Tooling.h"
-#include 
-#include 
-#include 
 #include 
 #include 
 
@@ -86,5 +83,5 @@ std::unique_ptr RenamingAct
 Replaces, PrintLocations);
 }
 
-}
-}
+} // namespace rename
+} // namespace clang

Modified: clang-tools-extra/trunk/clang-rename/USRFindingAction.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-rename/USRFindingAction.cpp?rev=263726=263725=263726=diff
==
--- clang-tools-extra/trunk/clang-rename/USRFindingAction.cpp (original)
+++ clang-tools-extra/trunk/clang-rename/USRFindingAction.cpp Thu Mar 17 
12:02:25 2016
@@ -25,9 +25,6 @@
 #include "clang/Tooling/CommonOptionsParser.h"
 #include "clang/Tooling/Refactoring.h"
 #include "clang/Tooling/Tooling.h"
-#include 
-#include 
-#include 
 #include 
 #include 
 

Modified: clang-tools-extra/trunk/clang-rename/tool/ClangRename.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-rename/tool/ClangRename.cpp?rev=263726=263725=263726=diff
==
--- clang-tools-extra/trunk/clang-rename/tool/ClangRename.cpp (original)
+++ clang-tools-extra/trunk/clang-rename/tool/ClangRename.cpp Thu Mar 17 
12:02:25 2016
@@ -35,12 +35,8 @@
 #include "clang/Tooling/Tooling.h"
 #include "llvm/ADT/IntrusiveRefCntPtr.h"
 #include "llvm/Support/Host.h"
-#include 
-#include 
-#include 
+#include 
 #include 
-#include 
-#include 
 
 using namespace llvm;
 

Modified: clang-tools-extra/trunk/pp-trace/PPCallbacksTracker.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/pp-trace/PPCallbacksTracker.cpp?rev=263726=263725=263726=diff
==
--- clang-tools-extra/trunk/pp-trace/PPCallbacksTracker.cpp (original)
+++ clang-tools-extra/trunk/pp-trace/PPCallbacksTracker.cpp Thu Mar 17 12:02:25 
2016
@@ -1,24 +1,22 @@
-//===--- PPCallbacksTracker.cpp - Preprocessor tracker -*--*-===//
+//===--- PPCallbacksTracker.cpp - Preprocessor tracker 
-*--*---===//
 //
 // The LLVM Compiler Infrastructure
 //
 // This file is distributed under the University of Illinois Open Source
 // License. See LICENSE.TXT for details.
 //
-//======//
+//===--===//
 ///
 /// \file
 /// \brief Implementations for preprocessor tracking.
 ///
 /// See the header for details.
 ///
-//======//
+//===--===//
 
 #include "PPCallbacksTracker.h"
 #include "clang/Lex/MacroArgs.h"
 #include "llvm/Support/raw_ostream.h"
-#include 
-#include 
 
 // Utility functions.
 

Modified: clang-tools-extra/trunk/unittests/clang-rename/USRLocFindingTest.cpp
URL: 

Re: [PATCH] D17482: [clang-tidy] Allow tests to verify changes made to header files

2016-03-18 Thread Richard via cfe-commits
LegalizeAdulthood added a comment.

test/clang-tidy/misc-unused-parameters.cpp currently does a hack to verify 
headers by committing the manually fixed header and diffing it:

  // RUN: echo "static void staticFunctionHeader(int i) {}" > %T/header.h
  // RUN: echo "static void staticFunctionHeader(int  /*i*/) {}" > 
%T/header-fixed.h
  // RUN: %check_clang_tidy %s misc-unused-parameters %t -- -header-filter='.*' 
-- -std=c++11 -fno-delayed-template-parsing
  // RUN: diff %T/header.h %T/header-fixed.h
  
  #include "header.h"
  // CHECK-MESSAGES: header.h:1:38: warning

I think this would be much cleaner with `header.h` as a regularly comitted file 
with `CHECK-MESSAGES` and `CHECK-FIXES` lines in that file.


http://reviews.llvm.org/D17482



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


Re: [PATCH] D18268: [Objective-c] Fix a crash in WeakObjectProfileTy::getBaseInfo

2016-03-18 Thread Jordan Rose via cfe-commits
jordan_rose accepted this revision.
jordan_rose added a comment.
This revision is now accepted and ready to land.

Ah, of course! Thanks for catching this, Akira. Can you add this case to the 
table in the doc comment for WeakObjectProfileTy? (That's how I convinced 
myself it was correct.)


http://reviews.llvm.org/D18268



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


Re: [PATCH] D17407: [Sema] PR25755 Fix crash when initializing out-of-order struct references

2016-03-18 Thread Richard Smith via cfe-commits
rsmith added inline comments.


Comment at: lib/Sema/SemaInit.cpp:1732
@@ +1731,3 @@
+  unsigned FieldIdx = 0;
+  std::vector SeenFields;
+  RecordDecl::field_iterator FieldStart = Field;

Please use an `llvm::BitVector` here instead.


Comment at: lib/Sema/SemaInit.cpp:1756-1769
@@ -1752,2 +1755,16 @@
 
+  if (CheckForMissingFields)
+for (unsigned i = 0; i < FieldIdx; ++i)
+  SeenFields.push_back(i);
+  unsigned idx = 0;
+  for (RecordDecl::field_iterator f = FieldStart;
+   f != FieldEnd; ++idx, ++f) {
+auto Next = f;
+if (++Next == Field) {
+  FieldIdx = idx;
+  break;
+}
+  }
+  SeenFields.push_back(FieldIdx);
+  ++FieldIdx;
   InitializedSomething = true;

You can get the field index with `Field->getFieldIndex() - 1` rather than 
computing it here (though watch out for the case where `Field == FieldEnd`).


Comment at: lib/Sema/SemaInit.cpp:1793-1795
@@ -1775,2 +1792,5 @@
   // Don't initialize unnamed bitfields, e.g. "int : 20;"
+  if (!CheckForMissingFields)
+SeenFields.push_back(FieldIdx);
+  ++FieldIdx;
   ++Field;

We don't need to track whether unnamed bit-fields have been "seen". This isn't 
meaningful.


Comment at: lib/Sema/SemaInit.cpp:1808-1809
@@ -1787,1 +1807,4 @@
 if (InvalidUse) {
+  if (!CheckForMissingFields)
+SeenFields.push_back(FieldIdx);
+  ++FieldIdx;

Once we're in the `hadError` state, we don't need to track `SeenFields` any 
more. I don't think we need this change.


http://reviews.llvm.org/D17407



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


r263718 - Use a simpler set of mock headers for the vfs+modules crash recovery tests.

2016-03-18 Thread Benjamin Kramer via cfe-commits
Author: d0k
Date: Thu Mar 17 11:19:51 2016
New Revision: 263718

URL: http://llvm.org/viewvc/llvm-project?rev=263718=rev
Log:
Use a simpler set of mock headers for the vfs+modules crash recovery tests.

The System/ mock is large and too complex for this test. It can cause
the tests to fail in mysterious ways as it depends on the resource dir
being present, which is not really supported for driver tests (using
%clang instead of %clang_cc1). Copy the tree and trim out all the
%unnecessary fat.

Added:
cfe/trunk/test/Modules/Inputs/crash-recovery/
cfe/trunk/test/Modules/Inputs/crash-recovery/usr/
cfe/trunk/test/Modules/Inputs/crash-recovery/usr/include/
cfe/trunk/test/Modules/Inputs/crash-recovery/usr/include/module.map
cfe/trunk/test/Modules/Inputs/crash-recovery/usr/include/stdio.h
cfe/trunk/test/Modules/Inputs/crash-recovery/usr/include/tcl-private/

cfe/trunk/test/Modules/Inputs/crash-recovery/usr/include/tcl-private/header.h
Modified:
cfe/trunk/test/Modules/crash-vfs-path-symlink-component.m
cfe/trunk/test/Modules/crash-vfs-path-traversal.m

Added: cfe/trunk/test/Modules/Inputs/crash-recovery/usr/include/module.map
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/crash-recovery/usr/include/module.map?rev=263718=auto
==
--- cfe/trunk/test/Modules/Inputs/crash-recovery/usr/include/module.map (added)
+++ cfe/trunk/test/Modules/Inputs/crash-recovery/usr/include/module.map Thu Mar 
17 11:19:51 2016
@@ -0,0 +1,6 @@
+module cstd [system] {
+  // Only in system headers directory
+  module stdio {
+header "stdio.h"
+  }
+}

Added: cfe/trunk/test/Modules/Inputs/crash-recovery/usr/include/stdio.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/crash-recovery/usr/include/stdio.h?rev=263718=auto
==
--- cfe/trunk/test/Modules/Inputs/crash-recovery/usr/include/stdio.h (added)
+++ cfe/trunk/test/Modules/Inputs/crash-recovery/usr/include/stdio.h Thu Mar 17 
11:19:51 2016
@@ -0,0 +1,3 @@
+typedef struct { int id; } FILE;
+int fprintf(FILE*restrict, const char* restrict format, ...);
+extern FILE *__stderrp;

Added: 
cfe/trunk/test/Modules/Inputs/crash-recovery/usr/include/tcl-private/header.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/crash-recovery/usr/include/tcl-private/header.h?rev=263718=auto
==
--- 
cfe/trunk/test/Modules/Inputs/crash-recovery/usr/include/tcl-private/header.h 
(added)
+++ 
cfe/trunk/test/Modules/Inputs/crash-recovery/usr/include/tcl-private/header.h 
Thu Mar 17 11:19:51 2016
@@ -0,0 +1,2 @@
+// tcl-private/header.h
+#define TCL_PRIVATE 1

Modified: cfe/trunk/test/Modules/crash-vfs-path-symlink-component.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/crash-vfs-path-symlink-component.m?rev=263718=263717=263718=diff
==
--- cfe/trunk/test/Modules/crash-vfs-path-symlink-component.m (original)
+++ cfe/trunk/test/Modules/crash-vfs-path-symlink-component.m Thu Mar 17 
11:19:51 2016
@@ -8,7 +8,7 @@
 
 // RUN: rm -rf %t
 // RUN: mkdir -p %t/i %t/m %t %t/sysroot
-// RUN: cp -a %S/Inputs/System/usr %t/i/
+// RUN: cp -a %S/Inputs/crash-recovery/usr %t/i/
 // RUN: ln -s include/tcl-private %t/i/usr/x
 
 // RUN: not env FORCE_CLANG_DIAGNOSTICS_CRASH= TMPDIR=%t TEMP=%t TMP=%t \

Modified: cfe/trunk/test/Modules/crash-vfs-path-traversal.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/crash-vfs-path-traversal.m?rev=263718=263717=263718=diff
==
--- cfe/trunk/test/Modules/crash-vfs-path-traversal.m (original)
+++ cfe/trunk/test/Modules/crash-vfs-path-traversal.m Thu Mar 17 11:19:51 2016
@@ -9,7 +9,7 @@
 // RUN: mkdir -p %t/i %t/m %t
 
 // RUN: not env FORCE_CLANG_DIAGNOSTICS_CRASH= TMPDIR=%t TEMP=%t TMP=%t \
-// RUN: %clang -fsyntax-only %s -I %S/Inputs/System -isysroot %/t/i/\
+// RUN: %clang -fsyntax-only %s -I %S/Inputs/crash-recovery -isysroot %/t/i/   
 \
 // RUN: -fmodules -fmodules-cache-path=%t/m/ 2>&1 | FileCheck %s
 
 // RUN: FileCheck --check-prefix=CHECKSRC %s -input-file %t/crash-vfs-*.m
@@ -17,7 +17,7 @@
 // RUN: FileCheck --check-prefix=CHECKYAML %s -input-file \
 // RUN: %t/crash-vfs-*.cache/vfs/vfs.yaml
 // RUN: find %t/crash-vfs-*.cache/vfs | \
-// RUN:   grep "Inputs/System/usr/include/stdio.h" | count 1
+// RUN:   grep "Inputs/crash-recovery/usr/include/stdio.h" | count 1
 
 #include "usr/././//include/../include/./././../include/stdio.h"
 
@@ -37,12 +37,12 @@
 // CHECKSH: "-ivfsoverlay" "crash-vfs-{{[^ ]*}}.cache/vfs/vfs.yaml"
 
 // CHECKYAML: 'type': 'directory'
-// CHECKYAML: 'name': "{{[^ ]*}}/Inputs/System/usr/include",
+// CHECKYAML: 'name': "{{[^ 

Re: [PATCH] D18024: Remove compile time PreserveName switch based on NDEBUG

2016-03-18 Thread Mehdi AMINI via cfe-commits
joker.eph closed this revision.
joker.eph added a comment.

r263257


http://reviews.llvm.org/D18024



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


Re: [PATCH] D17893: Sema: Add semantic analysis for the C++ ABI stability attributes and whitelist.

2016-03-18 Thread Mehdi AMINI via cfe-commits
joker.eph added a comment.

LGTM, but I'm not a clang expert, so if Richard or someone else could 
double-check?



Comment at: lib/Sema/SemaDeclCXX.cpp:4999
@@ +4998,3 @@
+return;
+  }
+

Isn't this correct by the loop which starts with `DC = InnermostExternalDC`?


http://reviews.llvm.org/D17893



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


Re: [PATCH] D15469: Expose cxx constructor and method properties through libclang and python bindings.

2016-03-18 Thread Jonathan B Coe via cfe-commits
jbcoe added a comment.

If I remove `= delete` from the declaration of the member function `foo` in 
test/Index/index-file.cpp line 36 then `foo` is reported in the output as

  [indexDeclaration]: kind: c++-instance-method | name: foo | USR: 
c:@S@B@F@foo# | lang: C++ | cursor: CXXMethod=foo:36:8 | loc: 36:8 | 
semantic-container: [B:27:7] | lexical-container: [B:27:7] | isRedecl: 0 | 
isDef: 0 | isContainer: 0 | isImplicit: 0

with `=delete` in place, `foo` is not reported at all.

This is a behaviour change since I wrote this patch. I'm not sure what the 
correct behaviour should be. I can update the test and not check for the 
deleted function `foo` when we are confident that behaviour is correct.

The changed behaviour (not reporting deleted functions) is not part of my patch.


http://reviews.llvm.org/D15469



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


Re: [PATCH] D17990: [clang-tidy] minor improvements in modernise-deprecated-headers check

2016-03-18 Thread Alexander Kornienko via cfe-commits
alexfh added inline comments.


Comment at: clang-tidy/modernize/DeprecatedHeadersCheck.cpp:59
@@ +58,3 @@
+{"float.h", "cfloat"},
+{"inttypes.h", "cinttypes"},
+{"limits.h", "climits"},

According to http://www.cplusplus.com/reference/cinttypes/, this header should 
be changed in C++11 mode only. See also http://llvm.org/PR26982


Comment at: clang-tidy/modernize/DeprecatedHeadersCheck.cpp:67
@@ +66,3 @@
+{"stddef.h", "cstddef"},
+{"stdint.h", "cstdint"},
+{"stdio.h", "cstdio"},

According to http://www.cplusplus.com/reference/cstdint/, this header is a part 
of C++11 standard, so we should move this to the list below.


Comment at: docs/clang-tidy/checks/modernize-deprecated-headers.rst:23
@@ +22,3 @@
+* `` -> ``
+* `` -> `` // deprecated since C++11
+* `` -> ``

Is this header actually "deprecated since C++11"?


Comment at: docs/clang-tidy/checks/modernize-deprecated-headers.rst:39
@@ +38,3 @@
+* `` -> ``
+* `` -> `` // deprecated since C++11
+* `` -> ``

Not sure if "deprecated" is the right word here. The wording seems to be 
slightly different: "This header simply includes  and ."


Comment at: docs/clang-tidy/checks/modernize-deprecated-headers.rst:41
@@ +40,3 @@
+* `` -> ``
+* `` -> ``   // deprecated since C++11
+* `` -> ``

It's not exactly "deprecated". It has appeared in C++11 and is not particularly 
useful (just contains a couple of feature macros). Maybe we should just remove 
#includes of this header as well.


http://reviews.llvm.org/D17990



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


r263710 - clang-format: [JS] Fix incorrect spacing around contextual keywords.

2016-03-18 Thread Daniel Jasper via cfe-commits
Author: djasper
Date: Thu Mar 17 07:17:59 2016
New Revision: 263710

URL: http://llvm.org/viewvc/llvm-project?rev=263710=rev
Log:
clang-format: [JS] Fix incorrect spacing around contextual keywords.

Before:
  x.of ();

After:
  x.of();

Modified:
cfe/trunk/lib/Format/TokenAnnotator.cpp
cfe/trunk/unittests/Format/FormatTestJS.cpp

Modified: cfe/trunk/lib/Format/TokenAnnotator.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/TokenAnnotator.cpp?rev=263710=263709=263710=diff
==
--- cfe/trunk/lib/Format/TokenAnnotator.cpp (original)
+++ cfe/trunk/lib/Format/TokenAnnotator.cpp Thu Mar 17 07:17:59 2016
@@ -2038,8 +2038,11 @@ bool TokenAnnotator::spaceRequiredBefore
 Left.isOneOf(Keywords.kw_returns, Keywords.kw_option))
   return true;
   } else if (Style.Language == FormatStyle::LK_JavaScript) {
-if (Left.isOneOf(Keywords.kw_let, Keywords.kw_var, TT_JsFatArrow,
- Keywords.kw_in, Keywords.kw_of))
+if (Left.is(TT_JsFatArrow))
+  return true;
+if (Left.isOneOf(Keywords.kw_let, Keywords.kw_var, Keywords.kw_in,
+ Keywords.kw_of) &&
+(!Left.Previous || !Left.Previous->is(tok::period)))
   return true;
 if (Left.is(tok::kw_default) && Left.Previous &&
 Left.Previous->is(tok::kw_export))

Modified: cfe/trunk/unittests/Format/FormatTestJS.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTestJS.cpp?rev=263710=263709=263710=diff
==
--- cfe/trunk/unittests/Format/FormatTestJS.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTestJS.cpp Thu Mar 17 07:17:59 2016
@@ -125,6 +125,10 @@ TEST_F(FormatTestJS, ReservedWords) {
   verifyFormat("x.class.struct = 1;");
   verifyFormat("x.case = 1;");
   verifyFormat("x.interface = 1;");
+  verifyFormat("x.of() = 1;");
+  verifyFormat("x.in() = 1;");
+  verifyFormat("x.let() = 1;");
+  verifyFormat("x.var() = 1;");
   verifyFormat("x = {\n"
"  a: 12,\n"
"  interface: 1,\n"


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


Re: [PATCH] D18280: [tsan] Allow -fsanitize=thread for iOS-style simulator targets

2016-03-18 Thread Kuba Brecka via cfe-commits
kubabrecka added a comment.

LGTM after adding a check for a simulator.


http://reviews.llvm.org/D18280



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


Re: [PATCH] D18261: Show members of DeclContexts (i.e., class members) in Visual Studio native visualizers

2016-03-18 Thread Mike Spertus via cfe-commits
mspertus closed this revision.
mspertus added a comment.

Thanks, Aaron. Committed as revision 263794


http://reviews.llvm.org/D18261



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


Re: [PATCH] D18138: Add -fnative-half-arguments-and-returns

2016-03-18 Thread Pirama Arumuga Nainar via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL263795: Add -fnative-half-arguments-and-returns (authored by 
pirama).

Changed prior to commit:
  http://reviews.llvm.org/D18138?vs=50564=51036#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D18138

Files:
  cfe/trunk/include/clang/Basic/LangOptions.def
  cfe/trunk/include/clang/Driver/CC1Options.td
  cfe/trunk/lib/CodeGen/TargetInfo.cpp
  cfe/trunk/lib/Frontend/CompilerInvocation.cpp
  cfe/trunk/test/CodeGen/arm-fp16-arguments.c

Index: cfe/trunk/include/clang/Basic/LangOptions.def
===
--- cfe/trunk/include/clang/Basic/LangOptions.def
+++ cfe/trunk/include/clang/Basic/LangOptions.def
@@ -163,6 +163,7 @@
 LANGOPT(OpenCL, 1, 0, "OpenCL")
 LANGOPT(OpenCLVersion , 32, 0, "OpenCL version")
 LANGOPT(NativeHalfType, 1, 0, "Native half type support")
+LANGOPT(NativeHalfArgsAndReturns, 1, 0, "Native half args and returns")
 LANGOPT(HalfArgsAndReturns, 1, 0, "half args and returns")
 LANGOPT(CUDA  , 1, 0, "CUDA")
 LANGOPT(OpenMP, 1, 0, "OpenMP support")
Index: cfe/trunk/include/clang/Driver/CC1Options.td
===
--- cfe/trunk/include/clang/Driver/CC1Options.td
+++ cfe/trunk/include/clang/Driver/CC1Options.td
@@ -603,6 +603,8 @@
   HelpText<"Control emission of RTTI data">;
 def fnative_half_type: Flag<["-"], "fnative-half-type">,
   HelpText<"Use the native half type for __fp16 instead of promoting to float">;
+def fnative_half_arguments_and_returns : Flag<["-"], "fnative-half-arguments-and-returns">,
+  HelpText<"Use the native __fp16 type for arguments and returns (and skip ABI-specific lowering)">;
 def fallow_half_arguments_and_returns : Flag<["-"], "fallow-half-arguments-and-returns">,
   HelpText<"Allow function arguments and returns of type half">;
 
Index: cfe/trunk/test/CodeGen/arm-fp16-arguments.c
===
--- cfe/trunk/test/CodeGen/arm-fp16-arguments.c
+++ cfe/trunk/test/CodeGen/arm-fp16-arguments.c
@@ -1,5 +1,6 @@
 // RUN: %clang_cc1 -triple armv7a--none-eabi -target-abi aapcs -mfloat-abi soft -fallow-half-arguments-and-returns -emit-llvm -o - -O1 %s | FileCheck %s --check-prefix=CHECK --check-prefix=SOFT
 // RUN: %clang_cc1 -triple armv7a--none-eabi -target-abi aapcs -mfloat-abi hard -fallow-half-arguments-and-returns -emit-llvm -o - -O1 %s | FileCheck %s --check-prefix=CHECK --check-prefix=HARD
+// RUN: %clang_cc1 -triple armv7a--none-eabi -target-abi aapcs -mfloat-abi soft -fnative-half-arguments-and-returns -emit-llvm -o - -O1 %s | FileCheck %s --check-prefix=NATIVE
 
 __fp16 g;
 
@@ -10,12 +11,17 @@
 // HARD: [[BITCAST:%.*]] = bitcast float [[PARAM]] to i32
 // HARD: [[TRUNC:%.*]] = trunc i32 [[BITCAST]] to i16
 // CHECK: store i16 [[TRUNC]], i16* bitcast (half* @g to i16*)
+// NATIVE: define void @t1(half [[PARAM:%.*]])
+// NATIVE: store half [[PARAM]], half* @g
 
 __fp16 t2() { return g; }
 // SOFT: define i32 @t2()
 // HARD: define arm_aapcs_vfpcc float @t2()
+// NATIVE: define half @t2()
 // CHECK: [[LOAD:%.*]] = load i16, i16* bitcast (half* @g to i16*)
 // CHECK: [[ZEXT:%.*]] = zext i16 [[LOAD]] to i32
 // SOFT: ret i32 [[ZEXT]]
 // HARD: [[BITCAST:%.*]] = bitcast i32 [[ZEXT]] to float
 // HARD: ret float [[BITCAST]]
+// NATIVE: [[LOAD:%.*]] = load half, half* @g
+// NATIVE: ret half [[LOAD]]
Index: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
===
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp
@@ -1434,6 +1434,7 @@
 Opts.LaxVectorConversions = 0;
 Opts.DefaultFPContract = 1;
 Opts.NativeHalfType = 1;
+Opts.NativeHalfArgsAndReturns = 1;
   }
 
   Opts.CUDA = IK == IK_CUDA || IK == IK_PreprocessedCuda ||
@@ -1795,7 +1796,11 @@
   Opts.ModuleFeatures = Args.getAllArgValues(OPT_fmodule_feature);
   std::sort(Opts.ModuleFeatures.begin(), Opts.ModuleFeatures.end());
   Opts.NativeHalfType |= Args.hasArg(OPT_fnative_half_type);
-  Opts.HalfArgsAndReturns = Args.hasArg(OPT_fallow_half_arguments_and_returns);
+  Opts.NativeHalfArgsAndReturns |= Args.hasArg(OPT_fnative_half_arguments_and_returns);
+  // Enable HalfArgsAndReturns if present in Args or if NativeHalfArgsAndReturns
+  // is enabled.
+  Opts.HalfArgsAndReturns = Args.hasArg(OPT_fallow_half_arguments_and_returns)
+| Opts.NativeHalfArgsAndReturns;
   Opts.GNUAsm = !Args.hasArg(OPT_fno_gnu_inline_asm);
 
   // __declspec is enabled by default for the PS4 by the driver, and also
Index: cfe/trunk/lib/CodeGen/TargetInfo.cpp
===
--- cfe/trunk/lib/CodeGen/TargetInfo.cpp
+++ cfe/trunk/lib/CodeGen/TargetInfo.cpp
@@ -5106,7 +5106,7 @@
   // __fp16 gets passed as if it were an int or float, but with the top 16 

[PATCH] D18243: [ASTMatchers] Existing matcher hasAnyArgument fixed

2016-03-18 Thread Balogh , Ádám via cfe-commits
baloghadamsoftware created this revision.
baloghadamsoftware added reviewers: klimek, sbenza.
baloghadamsoftware added subscribers: cfe-commits, xazax.hun.
Herald added a subscriber: klimek.

A checker (will be uploaded after this patch) needs to check implicit casts. 
The checker needs matcher hasAnyArgument but it ignores implicit casts and 
parenthesized expressions which disables checking of implicit casts for 
arguments in the checker. However the documentation of the matcher contains a 
FIXME that this should be removed once separate matchers for ignoring implicit 
casts and parenthesized expressions are ready. Since these matchers were 
already there the fix could be executed. Only one Clang checker was affected 
which was also fixed (ignoreParenImpCasts added) and is separately uploaded. 
Third party checkers (not in the Clang repository) may be affected by this fix 
so the fix must be emphasized in the release notes.

http://reviews.llvm.org/D18243

Files:
  include/clang/ASTMatchers/ASTMatchers.h

Index: include/clang/ASTMatchers/ASTMatchers.h
===
--- include/clang/ASTMatchers/ASTMatchers.h
+++ include/clang/ASTMatchers/ASTMatchers.h
@@ -2859,18 +2859,13 @@
 ///   matches x(1, y, 42)
 /// with hasAnyArgument(...)
 ///   matching y
-///
-/// FIXME: Currently this will ignore parentheses and implicit casts on
-/// the argument before applying the inner matcher. We'll want to remove
-/// this to allow for greater control by the user once \c ignoreImplicit()
-/// has been implemented.
 AST_POLYMORPHIC_MATCHER_P(hasAnyArgument,
   AST_POLYMORPHIC_SUPPORTED_TYPES(CallExpr,
   CXXConstructExpr),
   internal::Matcher, InnerMatcher) {
   for (const Expr *Arg : Node.arguments()) {
 BoundNodesTreeBuilder Result(*Builder);
-if (InnerMatcher.matches(*Arg->IgnoreParenImpCasts(), Finder, )) {
+if (InnerMatcher.matches(*Arg, Finder, )) {
   *Builder = std::move(Result);
   return true;
 }


Index: include/clang/ASTMatchers/ASTMatchers.h
===
--- include/clang/ASTMatchers/ASTMatchers.h
+++ include/clang/ASTMatchers/ASTMatchers.h
@@ -2859,18 +2859,13 @@
 ///   matches x(1, y, 42)
 /// with hasAnyArgument(...)
 ///   matching y
-///
-/// FIXME: Currently this will ignore parentheses and implicit casts on
-/// the argument before applying the inner matcher. We'll want to remove
-/// this to allow for greater control by the user once \c ignoreImplicit()
-/// has been implemented.
 AST_POLYMORPHIC_MATCHER_P(hasAnyArgument,
   AST_POLYMORPHIC_SUPPORTED_TYPES(CallExpr,
   CXXConstructExpr),
   internal::Matcher, InnerMatcher) {
   for (const Expr *Arg : Node.arguments()) {
 BoundNodesTreeBuilder Result(*Builder);
-if (InnerMatcher.matches(*Arg->IgnoreParenImpCasts(), Finder, )) {
+if (InnerMatcher.matches(*Arg, Finder, )) {
   *Builder = std::move(Result);
   return true;
 }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r263635 - Directly get the canonical Type instead of going around through a CanQualType temporary, NFC.

2016-03-18 Thread Yaron Keren via cfe-commits
Author: yrnkrn
Date: Wed Mar 16 07:14:43 2016
New Revision: 263635

URL: http://llvm.org/viewvc/llvm-project?rev=263635=rev
Log:
Directly get the canonical Type instead of going around through a CanQualType 
temporary, NFC.


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

Modified: cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp?rev=263635=263634=263635=diff
==
--- cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp (original)
+++ cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp Wed Mar 16 07:14:43 2016
@@ -2883,7 +2883,7 @@ static llvm::GlobalVariable::LinkageType
 
 llvm::Constant *ItaniumRTTIBuilder::BuildTypeInfo(QualType Ty, bool Force) {
   // We want to operate on the canonical type.
-  Ty = CGM.getContext().getCanonicalType(Ty);
+  Ty = Ty.getCanonicalType();
 
   // Check if we've already emitted an RTTI descriptor for this type.
   SmallString<256> Name;


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


Re: [PATCH] D18123: Fix implicit copy ctor and copy assignment operator warnings when -Wdeprecated passed.

2016-03-18 Thread don hinton via cfe-commits
The current behavior, albeit deprecated, is to implicitly define these.
Therefore, it would be incorrect not to delete them if the implicit
versions don't do the right thing.

I'd be happy to add a FIXME, but I doubt they will ever be removed.  At
best, they'd be #ifdef'd away for some future compiler that no longer
implicitly defines them.

Just not sure it's worth it.  Deleting them will be valid no matter what
the future holds.

On Wed, Mar 16, 2016 at 12:56 PM, David Blaikie  wrote:

>
>
> On Wed, Mar 16, 2016 at 7:54 AM, don hinton via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> hintonda updated this revision to Diff 50823.
>> hintonda added a comment.
>>
>> Address FIXME now that Sema::LookupInlineAsmField() has been fixed.
>>
>>
>> http://reviews.llvm.org/D18123
>>
>> Files:
>>   include/clang/AST/UnresolvedSet.h
>>   include/clang/Sema/Lookup.h
>>
>> Index: include/clang/Sema/Lookup.h
>> ===
>> --- include/clang/Sema/Lookup.h
>> +++ include/clang/Sema/Lookup.h
>> @@ -185,6 +185,9 @@
>>Shadowed(false)
>>{}
>>
>> +  LookupResult(const LookupResult &) = delete;
>> +  LookupResult & operator=(const LookupResult &) = delete;
>>
>
> Not sure how much to bother explicitly deleting ops like this if
> eventually the -Wdeprecated warning will just catch it that way. Maybe
> leave a "FIXME: Remove these once the warning for deprecated copy ops is
> enabled"?
>
>
>> +
>>~LookupResult() {
>>  if (Diagnose) diagnose();
>>  if (Paths) deletePaths(Paths);
>> Index: include/clang/AST/UnresolvedSet.h
>> ===
>> --- include/clang/AST/UnresolvedSet.h
>> +++ include/clang/AST/UnresolvedSet.h
>> @@ -59,8 +59,11 @@
>>// UnresolvedSet.
>>  private:
>>template  friend class UnresolvedSet;
>> -  UnresolvedSetImpl() {}
>> -  UnresolvedSetImpl(const UnresolvedSetImpl &) {}
>> +  UnresolvedSetImpl() = default;
>> +  UnresolvedSetImpl(const UnresolvedSetImpl &) = default;
>> +  UnresolvedSetImpl(UnresolvedSetImpl &&) = default;
>> +  UnresolvedSetImpl& operator=(const UnresolvedSetImpl &) = default;
>> +  UnresolvedSetImpl& operator=(UnresolvedSetImpl &&) = default;
>>
>>  public:
>>// We don't currently support assignment through this iterator, so we
>> might
>>
>>
>>
>> ___
>> cfe-commits mailing list
>> cfe-commits@lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>>
>>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D18199: CodeGen: Implement IR generation for the relative vtable ABI (PR26723).

2016-03-18 Thread Peter Collingbourne via cfe-commits
pcc added inline comments.


Comment at: lib/CodeGen/ItaniumCXXABI.cpp:1627
@@ +1626,3 @@
+
+llvm::Value *CodeGenFunction::GetVirtualFunctionFromVTable(const CXXRecordDecl 
*RD,
+   llvm::Value *VTable,

rnk wrote:
> Maybe this should live in CGVTables.cpp or CGClass.cpp instead of 
> ItaniumCXXABI.cpp?
Yes, sorry, I forgot to move this somewhere more sensible before sending this 
out for review.


http://reviews.llvm.org/D18199



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


Re: [PATCH] D18127: Remove compile time PreserveName in favor of a runtime cc1 -discard-value-names option

2016-03-18 Thread Mehdi AMINI via cfe-commits
joker.eph closed this revision.
joker.eph added a comment.

r263394


http://reviews.llvm.org/D18127



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


r263816 - [clang-cl] Allow use of -gline-tables-only

2016-03-18 Thread Reid Kleckner via cfe-commits
Author: rnk
Date: Fri Mar 18 13:42:56 2016
New Revision: 263816

URL: http://llvm.org/viewvc/llvm-project?rev=263816=rev
Log:
[clang-cl] Allow use of -gline-tables-only

Modified:
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/test/Driver/cl-options.c

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=263816=263815=263816=diff
==
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Fri Mar 18 13:42:56 2016
@@ -1173,7 +1173,7 @@ def fdebug_prefix_map_EQ
 def g_Flag : Flag<["-"], "g">, Group,
   HelpText<"Generate source-level debug information">;
 def gline_tables_only : Flag<["-"], "gline-tables-only">, Group,
-  HelpText<"Emit debug line number tables only">;
+  Flags<[CoreOption]>, HelpText<"Emit debug line number tables only">;
 def gmlt : Flag<["-"], "gmlt">, Alias;
 def g0 : Flag<["-"], "g0">, Group;
 def g1 : Flag<["-"], "g1">, Group, Alias;

Modified: cfe/trunk/test/Driver/cl-options.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/cl-options.c?rev=263816=263815=263816=diff
==
--- cfe/trunk/test/Driver/cl-options.c (original)
+++ cfe/trunk/test/Driver/cl-options.c Fri Mar 18 13:42:56 2016
@@ -394,6 +394,10 @@
 // Z7: "-gcodeview"
 // Z7: "-debug-info-kind=limited"
 
+// RUN: %clang_cl -gline-tables-only /Z7 /c -### -- %s 2>&1 | FileCheck 
-check-prefix=Z7GMLT %s
+// Z7GMLT: "-gcodeview"
+// Z7GMLT: "-debug-info-kind=line-tables-only"
+
 // RUN: %clang_cl /c -### -- %s 2>&1 | FileCheck -check-prefix=BreproDefault %s
 // BreproDefault: "-mincremental-linker-compatible"
 


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


Re: [PATCH] D18263: [clang-tools-extra] Add release notes documentation

2016-03-18 Thread Richard via cfe-commits
LegalizeAdulthood updated this revision to Diff 51102.
LegalizeAdulthood marked 2 inline comments as done.
LegalizeAdulthood added a comment.

Update from review comments.

I do not have commit access.

Patch by Richard Thomson


http://reviews.llvm.org/D18263

Files:
  docs/ReleaseNotes.rst
  docs/clang-tidy/checks/list.rst
  docs/index.rst

Index: docs/index.rst
===
--- docs/index.rst
+++ docs/index.rst
@@ -10,6 +10,10 @@
 Welcome to the clang-tools-extra project which contains extra tools built using
 Clang's tooling API's.
 
+.. toctree::
+   :maxdepth: 1
+
+   ReleaseNotes
 
 Contents
 
Index: docs/clang-tidy/checks/list.rst
===
--- docs/clang-tidy/checks/list.rst
+++ docs/clang-tidy/checks/list.rst
@@ -88,6 +88,7 @@
performance-faster-string-find
performance-for-range-copy
performance-implicit-cast-in-loop
+   performance-unnecessary-copy-initialization
readability-braces-around-statements
readability-container-size-empty
readability-else-after-return
Index: docs/ReleaseNotes.rst
===
--- /dev/null
+++ docs/ReleaseNotes.rst
@@ -0,0 +1,71 @@
+=
+Extra Clang Tools 3.9 (In-Progress) Release Notes
+=
+
+.. contents::
+   :local:
+   :depth: 2
+
+Written by the `LLVM Team `_
+
+.. warning::
+
+   These are in-progress notes for the upcoming Clang 3.9 release. You may
+   prefer the `Clang 3.8 Release Notes
+   `_.
+
+Introduction
+
+
+This document contains the release notes for the Extra Clang Tools, part of the
+Clang release 3.9.  Here we describe the status of the Extra Clang Tools in some
+detail, including major improvements from the previous release and new feature
+work. For the general Clang release notes, see `the Clang documentation
+`_.  All LLVM
+releases may be downloaded from the `LLVM releases web
+site `_.
+
+For more information about Clang or LLVM, including information about
+the latest release, please see the `Clang Web Site `_ or
+the `LLVM Web Site `_.
+
+Note that if you are reading this file from a Subversion checkout or the
+main Clang web page, this document applies to the *next* release, not
+the current one. To see the release notes for a specific release, please
+see the `releases page `_.
+
+What's New in Extra Clang Tools 3.9?
+
+
+Some of the major new features and improvements to Extra Clang Tools are listed
+here. Generic improvements to Extra Clang Tools as a whole or to its underlying
+infrastructure are described first, followed by tool-specific sections.
+
+Major New Features
+--
+
+- Feature1...
+
+Improvements to ``clang-query``
+^^^
+
+The improvements are...
+
+Improvements to ``clang-rename``
+
+
+The improvements are...
+
+Improvements to ``clang-tidy``
+^^
+
+``clang-tidy``'s checks are constantly being improved to catch more issues,
+explain them more clearly, and provide more accurate fix-its for the issues
+identified.  The improvements since the 3.8 release include:
+
+-  ...
+
+Improvements to ``modularize``
+^^
+
+The improvements are...
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D18270: Typesafe visualization of PointerIntPairs in Visual Studio

2016-03-18 Thread Mike Spertus via cfe-commits
mspertus closed this revision.
mspertus added a comment.

Committed as revision 263821.

Thanks for the trust, Aaron! Note that my next revision (function and member 
prototype visualization) will be largish, and I would still appreciate a review 
before commit.


http://reviews.llvm.org/D18270



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


Re: [PATCH] D18271: Avoid -Wshadow warnings about constructor parameters named after fields

2016-03-18 Thread David Blaikie via cfe-commits
dblaikie added a subscriber: dblaikie.
dblaikie added a comment.

It's not just modifications of shadowed variables that are a problem - one of 
the one's I'm concerned we should catch is:

  struct foo {
std::unique_ptr p;
foo(std::unique_ptr p) : p(std::move(p)) {
  f(*p);
}
  };


http://reviews.llvm.org/D18271



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


Re: [PATCH] D17451: PR26448: [Sema] Fix determined type of ternary operator acting on two xvalue class types

2016-03-18 Thread Erik Pilkington via cfe-commits
erik.pilkington updated this revision to Diff 51045.
erik.pilkington added a comment.

Fix the wording of the quoted section of the standard. Would you mind 
committing this? Thanks for reviewing!


http://reviews.llvm.org/D17451

Files:
  lib/Sema/SemaExprCXX.cpp
  test/SemaCXX/conditional-expr.cpp

Index: test/SemaCXX/conditional-expr.cpp
===
--- test/SemaCXX/conditional-expr.cpp
+++ test/SemaCXX/conditional-expr.cpp
@@ -384,3 +384,12 @@
 int () { return b_ ? i_ : throw 1; }
   };
 }
+
+namespace PR26448 {
+struct Base {};
+struct Derived : Base {};
+Base b;
+Derived d;
+typedef decltype(true ? static_cast(b) : static_cast(d)) x;
+typedef Base &
+}
Index: lib/Sema/SemaExprCXX.cpp
===
--- lib/Sema/SemaExprCXX.cpp
+++ lib/Sema/SemaExprCXX.cpp
@@ -4672,7 +4672,7 @@
   return Result;
 }
 
-/// \brief Try to convert a type to another according to C++0x 5.16p3.
+/// \brief Try to convert a type to another according to C++11 5.16p3.
 ///
 /// This is part of the parameter validation for the ? operator. If either
 /// value operand is a class type, the two operands are attempted to be
@@ -4688,17 +4688,21 @@
 
   InitializationKind Kind = InitializationKind::CreateCopy(To->getLocStart(),
SourceLocation());
-  // C++0x 5.16p3
+  // C++11 5.16p3
   //   The process for determining whether an operand expression E1 of type T1
   //   can be converted to match an operand expression E2 of type T2 is defined
   //   as follows:
-  //   -- If E2 is an lvalue:
-  bool ToIsLvalue = To->isLValue();
-  if (ToIsLvalue) {
-//   E1 can be converted to match E2 if E1 can be implicitly converted to
-//   type "lvalue reference to T2", subject to the constraint that in the
-//   conversion the reference must bind directly to E1.
-QualType T = Self.Context.getLValueReferenceType(ToType);
+  //   -- If E2 is an lvalue: E1 can be converted to match E2 if E1 can be
+  //  implicitly converted to type "lvalue reference to T2", subject to the
+  //  constraint that in the conversion the reference must bind directly to
+  //  an lvalue.
+  //   -- If E2 is an xvalue: E1 can be converted to match E2 if E1 can be
+  //  implicitly conveted to the type "rvalue reference to R2", subject to
+  //  the constraint that the reference must bind directly.
+  if (To->isLValue() || To->isXValue()) {
+QualType T = To->isLValue() ? Self.Context.getLValueReferenceType(ToType)
+: Self.Context.getRValueReferenceType(ToType);
+
 InitializedEntity Entity = InitializedEntity::InitializeTemporary(T);
 
 InitializationSequence InitSeq(Self, Entity, Kind, From);


Index: test/SemaCXX/conditional-expr.cpp
===
--- test/SemaCXX/conditional-expr.cpp
+++ test/SemaCXX/conditional-expr.cpp
@@ -384,3 +384,12 @@
 int () { return b_ ? i_ : throw 1; }
   };
 }
+
+namespace PR26448 {
+struct Base {};
+struct Derived : Base {};
+Base b;
+Derived d;
+typedef decltype(true ? static_cast(b) : static_cast(d)) x;
+typedef Base &
+}
Index: lib/Sema/SemaExprCXX.cpp
===
--- lib/Sema/SemaExprCXX.cpp
+++ lib/Sema/SemaExprCXX.cpp
@@ -4672,7 +4672,7 @@
   return Result;
 }
 
-/// \brief Try to convert a type to another according to C++0x 5.16p3.
+/// \brief Try to convert a type to another according to C++11 5.16p3.
 ///
 /// This is part of the parameter validation for the ? operator. If either
 /// value operand is a class type, the two operands are attempted to be
@@ -4688,17 +4688,21 @@
 
   InitializationKind Kind = InitializationKind::CreateCopy(To->getLocStart(),
SourceLocation());
-  // C++0x 5.16p3
+  // C++11 5.16p3
   //   The process for determining whether an operand expression E1 of type T1
   //   can be converted to match an operand expression E2 of type T2 is defined
   //   as follows:
-  //   -- If E2 is an lvalue:
-  bool ToIsLvalue = To->isLValue();
-  if (ToIsLvalue) {
-//   E1 can be converted to match E2 if E1 can be implicitly converted to
-//   type "lvalue reference to T2", subject to the constraint that in the
-//   conversion the reference must bind directly to E1.
-QualType T = Self.Context.getLValueReferenceType(ToType);
+  //   -- If E2 is an lvalue: E1 can be converted to match E2 if E1 can be
+  //  implicitly converted to type "lvalue reference to T2", subject to the
+  //  constraint that in the conversion the reference must bind directly to
+  //  an lvalue.
+  //   -- If E2 is an xvalue: E1 can be converted to match E2 if E1 can be
+  //  implicitly conveted to the type "rvalue reference to R2", subject to
+  //  the 

Re: [PATCH] D18123: Fix implicit copy ctor and copy assignment operator warnings when -Wdeprecated passed.

2016-03-18 Thread don hinton via cfe-commits
-Werror clean is great.

If you could add -Wdeprecated, then we wouldn't need to delete them -- the
warning is only issued with -Wdeprecated is passed.


On Wed, Mar 16, 2016 at 1:49 PM, David Blaikie  wrote:

>
>
> On Wed, Mar 16, 2016 at 10:19 AM, don hinton  wrote:
>
>> The current behavior, albeit deprecated, is to implicitly define these.
>> Therefore, it would be incorrect not to delete them if the implicit
>> versions don't do the right thing.
>>
>> I'd be happy to add a FIXME, but I doubt they will ever be removed.  At
>> best, they'd be #ifdef'd away for some future compiler that no longer
>> implicitly defines them.
>>
>> Just not sure it's worth it.  Deleting them will be valid no matter what
>> the future holds.
>>
>
> Sure, but it's a lot of extra deletes (if you search the mailing list for
> "author: dblaikie" and "deprecated" you'll find many other instances I
> cleaned up, in which we'd have to explicitly delete these ops if that's
> going to be our approach)
>
> I don't think we'd only ifdef them away. Keeping the clang build -Werror
> clean is a pretty well established bar, so if anyone accidentally
> introduced a call to any of these, we'd find/fix it pretty quickly as we do
> other errors/mistakes, even when they're not hard language-required errors.
>
>
>>
>> On Wed, Mar 16, 2016 at 12:56 PM, David Blaikie 
>> wrote:
>>
>>>
>>>
>>> On Wed, Mar 16, 2016 at 7:54 AM, don hinton via cfe-commits <
>>> cfe-commits@lists.llvm.org> wrote:
>>>
 hintonda updated this revision to Diff 50823.
 hintonda added a comment.

 Address FIXME now that Sema::LookupInlineAsmField() has been fixed.


 http://reviews.llvm.org/D18123

 Files:
   include/clang/AST/UnresolvedSet.h
   include/clang/Sema/Lookup.h

 Index: include/clang/Sema/Lookup.h
 ===
 --- include/clang/Sema/Lookup.h
 +++ include/clang/Sema/Lookup.h
 @@ -185,6 +185,9 @@
Shadowed(false)
{}

 +  LookupResult(const LookupResult &) = delete;
 +  LookupResult & operator=(const LookupResult &) = delete;

>>>
>>> Not sure how much to bother explicitly deleting ops like this if
>>> eventually the -Wdeprecated warning will just catch it that way. Maybe
>>> leave a "FIXME: Remove these once the warning for deprecated copy ops is
>>> enabled"?
>>>
>>>
 +
~LookupResult() {
  if (Diagnose) diagnose();
  if (Paths) deletePaths(Paths);
 Index: include/clang/AST/UnresolvedSet.h
 ===
 --- include/clang/AST/UnresolvedSet.h
 +++ include/clang/AST/UnresolvedSet.h
 @@ -59,8 +59,11 @@
// UnresolvedSet.
  private:
template  friend class UnresolvedSet;
 -  UnresolvedSetImpl() {}
 -  UnresolvedSetImpl(const UnresolvedSetImpl &) {}
 +  UnresolvedSetImpl() = default;
 +  UnresolvedSetImpl(const UnresolvedSetImpl &) = default;
 +  UnresolvedSetImpl(UnresolvedSetImpl &&) = default;
 +  UnresolvedSetImpl& operator=(const UnresolvedSetImpl &) = default;
 +  UnresolvedSetImpl& operator=(UnresolvedSetImpl &&) = default;

  public:
// We don't currently support assignment through this iterator, so
 we might



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


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


Re: [PATCH] D18231: [Clang-tools-extra] Fix Clang-tidy modernize-deprecated-headers warnings; other minor fixes

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

LGTM, thanks!


Repository:
  rL LLVM

http://reviews.llvm.org/D18231



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


Re: [PATCH] D18238: [clang-tidy] Fix clang-tidy crashes when using -fdelayed-template-parsing.

2016-03-18 Thread Aaron Ballman via cfe-commits
aaron.ballman requested changes to this revision.
aaron.ballman added a comment.
This revision now requires changes to proceed.

Oops, I take that LGTM back. ;-) Almost LGTM -- this is missing test cases that 
exercise the behavior.


http://reviews.llvm.org/D18238



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


Re: [modules] PR24954

2016-03-18 Thread Vassil Vassilev via cfe-commits

On 16/03/16 03:22, Richard Smith wrote:

Please restrict this to the case where the function template is a
friend (check D->getFriendObjectKind()). Otherwise, this looks good to
me. Thanks!

Done and committed in r263634.
Thanks!


On Mon, Mar 7, 2016 at 2:23 AM, Vassil Vassilev  wrote:

ping...

On 22/02/16 21:51, Vassil Vassilev wrote:

On 02/02/16 02:52, Richard Smith via cfe-commits wrote:

On Thu, Jan 28, 2016 at 8:23 AM, Vassil Vassilev 
wrote:

Would this patch be more reasonable? It follows what
RegisterTemplateSpecialization (introduced in r245779) does. AFAICT this
adds an update record far less often.

It's still adding redundant update records. We'll write the
appropriate update record as part of serializing the declaration
itself, so we only need to ensure that the declaration is emitted, not
actually emit an update record for it. Perhaps you could store a list
of such declarations on the ASTWriter, and call GetDeclRef on each of
them once we start emitting the AST file (or maybe just push them into
UpdatingVisibleDecls). Please also restrict this to the template
friend corner case.

The attached patch fixes the issues more or less in the direction you
suggest. I am not sure if I expressed well enough the conditions of the
template friend corner case. Could you have a look?



--Vassil

On 12/12/15 16:13, Vassil Vassilev wrote:

I couldn't find GetDecl routine in the ASTWriter. Could you elaborate?

Assuming you meant ASTWriter::GetDeclRef(D): It seems that the
conditions
when calling GetDeclRef differ from the conditions of
AddedCXXTemplateSpecialization. Eg:

ASTWriter::AddedCXXTemplateSpecialization {
assert(!WritingAST && "Already writing the AST!");
...
}
ASTWriter::GetDeclRef {
assert(WritingAST && "Cannot request a declaration ID before AST
writing");
..
}

IIUC this particular instantiation happens *after* module B was built,
thus
it needs to be retrospectively added to the serialized namespace. It
looks
like even avoiding somehow the asserts of GetDeclRef it wouldn't help
much.

Alternatively I could try to reduce the redundant update records by
narrowing down to instantiations coming in the context of friends.

--Vassil

On 12/12/15 01:07, Richard Smith wrote:

Instead of adding an update record directly in this case (which will
emit
far more update records than necessary), how about just calling
GetDecl(D)
from AddedCXXTemplateSpecialization to ensure that it gets emitted?

On Fri, Dec 4, 2015 at 7:46 AM, Vassil Vassilev 
wrote:

Hi,
Could you review my fix please.
Many thanks,
Vassil

On 08/10/15 15:53, Vassil Vassilev wrote:

Hi Richard,
I started working on https://llvm.org/bugs/show_bug.cgi?id=24954

IIUC r228485 introduces an abstraction to deal with
not-really-anonymous friend decls
(serialization::needsAnonymousDeclarationNumber in ASTCommon.cpp).

A comment explicitly says:
"// This doesn't apply to friend tag decls; Sema makes those
available
to name
 // lookup in the surrounding context."

In the bug reproducer, the friend function (wrt __iom_t10) is
forward
declared in the same namespace, where Sema makes the friend available
for a
name lookup.

It seems that the friend operator<< in __iom_t10 (sorry about the
names
they come from libcxx) doesn't get registered in the ASTWriter's
DeclIDs but
it gets registered in outer namespace's lookup table. Thus, assert is
triggered when finalizing module A, since it rebuilds the lookups of
the
updated contexts.

The issue only appears when building module A deserializes/uses
module
B.

Currently I was assume that something wrong happens in either
needsAnonymousDeclarationNumber or I hit a predicted issue
ASTWriterDecl.cpp:1602
  // FIXME: This is not correct; when we reach an imported
declaration
we
  // won't emit its previous declaration.
  (void)Writer.GetDeclRef(D->getPreviousDecl());
  (void)Writer.GetDeclRef(MostRecent);

The issue seems a fairly complex one and I am a bit stuck.

Any hints are very very welcome ;)
Many thanks,
Vassil






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




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


Re: [PATCH] D18275: [ASTMatchers] Add own version of VariadicFunction.

2016-03-18 Thread Samuel Benzaquen via cfe-commits
sbenza added a comment.

Alex, this is what we discussed to make `hasAnyName` take a `vector` 
directly.


http://reviews.llvm.org/D18275



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


Re: [PATCH] D18203: [OPENMP] Implementation of codegen for firstprivate clause of target directive

2016-03-18 Thread Carlo Bertolli via cfe-commits
carlo.bertolli updated this revision to Diff 50829.
carlo.bertolli marked an inline comment as done.
carlo.bertolli added a comment.

Modify diff to reflect comments.


Repository:
  rL LLVM

http://reviews.llvm.org/D18203

Files:
  include/clang/Basic/DiagnosticSemaKinds.td
  lib/CodeGen/CGOpenMPRuntime.cpp
  lib/Sema/SemaOpenMP.cpp
  test/OpenMP/nvptx_target_firstprivate_codegen.cpp
  test/OpenMP/target_firstprivate_codegen.cpp
  test/OpenMP/target_firstprivate_messages.cpp
  test/OpenMP/target_map_messages.cpp
  test/OpenMP/target_private_messages.cpp

Index: test/OpenMP/target_private_messages.cpp
===
--- test/OpenMP/target_private_messages.cpp
+++ test/OpenMP/target_private_messages.cpp
@@ -189,6 +189,8 @@
   static int si;
 #pragma omp target private(si) // OK
   {}
+#pragma omp target map(i) private(i) // expected-error {{private variable cannot be in a map clause in '#pragma omp target' directive}}
+  {}
   s6 = s6_0; // expected-note {{in instantiation of member function 'S6::operator=' requested here}}
   s7 = s7_0; // expected-note {{in instantiation of member function 'S7::operator=' requested here}}
   return foomain(argc, argv); // expected-note {{in instantiation of function template specialization 'foomain' requested here}}
Index: test/OpenMP/target_map_messages.cpp
===
--- test/OpenMP/target_map_messages.cpp
+++ test/OpenMP/target_map_messages.cpp
@@ -500,6 +500,10 @@
 #pragma omp target data map(always, tofrom: always, tofrom, x)
 #pragma omp target map(tofrom j) // expected-error {{expected ',' or ')' in 'map' clause}}
   foo();
+#pragma omp target private(j) map(j) // expected-error {{private variable cannot be in a map clause in '#pragma omp target' directive}}  expected-note {{defined as private}}
+  {}
+#pragma omp target firstprivate(j) map(j)  // expected-error {{firstprivate variable cannot be in a map clause in '#pragma omp target' directive}} expected-note {{defined as firstprivate}}
+  {}
   return tmain(argc)+tmain(argc); // expected-note {{in instantiation of function template specialization 'tmain' requested here}} expected-note {{in instantiation of function template specialization 'tmain' requested here}}
 }
 #endif
Index: test/OpenMP/target_firstprivate_messages.cpp
===
--- test/OpenMP/target_firstprivate_messages.cpp
+++ test/OpenMP/target_firstprivate_messages.cpp
@@ -189,6 +189,8 @@
   static int si;
 #pragma omp target firstprivate(si) // OK
   {}
+#pragma omp target map(i) firstprivate(i) // expected-error {{firstprivate variable cannot be in a map clause in '#pragma omp target' directive}}
+  {}
   s6 = s6_0; // expected-note {{in instantiation of member function 'S6::operator=' requested here}}
   s7 = s7_0; // expected-note {{in instantiation of member function 'S7::operator=' requested here}}
   return foomain(argc, argv); // expected-note {{in instantiation of function template specialization 'foomain' requested here}}
Index: test/OpenMP/target_firstprivate_codegen.cpp
===
--- /dev/null
+++ test/OpenMP/target_firstprivate_codegen.cpp
@@ -0,0 +1,595 @@
+// Test host codegen.
+// RUN: %clang_cc1 -verify -fopenmp -x c++ -triple powerpc64le-unknown-unknown -omptargets=powerpc64le-ibm-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefix CHECK --check-prefix CHECK-64
+// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -omptargets=powerpc64le-ibm-linux-gnu -emit-pch -o %t %s
+// RUN: %clang_cc1 -fopenmp -x c++ -triple powerpc64le-unknown-unknown -omptargets=powerpc64le-ibm-linux-gnu -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CHECK --check-prefix CHECK-64
+// RUN: %clang_cc1 -verify -fopenmp -x c++ -triple i386-unknown-unknown -omptargets=i386-pc-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefix CHECK --check-prefix CHECK-32
+// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple i386-unknown-unknown -omptargets=i386-pc-linux-gnu -emit-pch -o %t %s
+// RUN: %clang_cc1 -fopenmp -x c++ -triple i386-unknown-unknown -omptargets=i386-pc-linux-gnu -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CHECK --check-prefix CHECK-32
+
+// Test target codegen - host bc file has to be created first.
+// RUN: %clang_cc1 -verify -fopenmp -x c++ -triple powerpc64le-unknown-unknown -omptargets=powerpc64le-ibm-linux-gnu -emit-llvm-bc %s -o %t-ppc-host.bc
+// RUN: %clang_cc1 -verify -fopenmp -x c++ -triple powerpc64le-unknown-unknown -omptargets=powerpc64le-ibm-linux-gnu -emit-llvm %s -fopenmp-is-device -omp-host-ir-file-path %t-ppc-host.bc -o - | FileCheck %s --check-prefix TCHECK --check-prefix TCHECK-64
+// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 

Re: [PATCH] D17951: Implement is_always_lock_free

2016-03-18 Thread Eric Fiselier via cfe-commits
EricWF added inline comments.


Comment at: include/atomic:859
@@ +858,3 @@
+template <> _LIBCPP_CONSTEXPR bool __libcpp_always_lock_free = 2 == 
ATOMIC_CHAR32_T_LOCK_FREE;
+template <> _LIBCPP_CONSTEXPR bool __libcpp_always_lock_free = 2 == 
ATOMIC_WCHAR_T_LOCK_FREE;
+template <> _LIBCPP_CONSTEXPR bool __libcpp_always_lock_free = 2 == 
ATOMIC_SHORT_LOCK_FREE;

jfb wrote:
> EricWF wrote:
> > jfb wrote:
> > > bcraig wrote:
> > > > Do we need to support configurations were wchar_t is a typedef to an 
> > > > integer type, or is that an abomination too painful to deal with?
> > > > 
> > > > I have no idea if the rest of libcxx attempts to deal with wchar_t 
> > > > typedefs.
> > > Do you have examples of such platforms? The standard is pretty clear that 
> > > they're wrong:
> > > 
> > > >  [basic.fundamental]
> > > >
> > > > Type `wchar_t` is a distinct type whose values can represent distinct 
> > > > codes for all members of the largest extended character set specified 
> > > > among the supported locales. Type `wchar_t` shall have the same size, 
> > > > signedness, and alignment requirements as one of the other integral 
> > > > types, called its *underlying type*.
> > > 
> > > I'll defer to @mclow.lists on whether we can about such implementations 
> > > or not.
> > I don't think we have to deal with such typedefs for `wchar_t` but we do 
> > have to deal with non-sense typedefs (that we unfortunately supply) for 
> > `char16_t` and `char32_t` in C++03 mode with GCC. 
> > 
> > And our  implementation needs to compile in C++03 (Sorry, I did 
> > that).
> `__cpp_lib_atomic_is_always_lock_free` takes care of it: it's only defined in 
> C++17 and later so `` should compile just fine.
> 
> Is there a test that would catch C++03 breakage?
Ah I didn't realize that. We have a C++03 bot that will catch any breakage but 
if your only exposing this in C++17 then we are fine.


Comment at: include/atomic:898
@@ -834,1 +897,3 @@
 
+#if defined(__cpp_lib_atomic_is_always_lock_free)
+# if defined(_LIBCPP_LOCK_FREE_IS_SIZE_BASED)

jfb wrote:
> EricWF wrote:
> > @mclow.lists I'm fine exposing this typedef retroactively in C++11 and 
> > earlier. Do you have any objections to that?
> Which typedef do you mean? Looks like phabricator may have tagged the wrong 
> line.
Sorry I haven't had my coffee yet :-S. I meant the "is_always_lock_free" 
variable. IDK why  I said typedef. However I missed that this is already only 
exposed in C++17 and beyond. That's even better.


Comment at: test/std/atomics/atomics.lockfree/lockfree.pass.cpp:66
@@ +65,3 @@
+
+// structs and unions can't be defined in the template invocation.
+// Work around this with a typedef.

This needs to be guarded by `#if TEST_STD_VER > 14`. The macro lives in 
`test_macros.h`.


http://reviews.llvm.org/D17951



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


Re: [PATCH] D18238: [clang-tidy] Fix clang-tidy crashes when using -fdelayed-template-parsing.

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

LGTM now (this time for sure), thank you!


http://reviews.llvm.org/D18238



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


Re: [PATCH] D18123: Fix implicit copy ctor and copy assignment operator warnings when -Wdeprecated passed.

2016-03-18 Thread don hinton via cfe-commits
Done, however, I don't have commit access, so once it's approved, could you
commit it for me?

thanks...
don

On Wed, Mar 16, 2016 at 6:00 PM, David Blaikie  wrote:

>
>
> On Wed, Mar 16, 2016 at 11:38 AM, don hinton via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> hintonda updated this revision to Diff 50843.
>> hintonda added a comment.
>>
>> Added FIXME comment, and reformated with clang-format.
>>
>>
>> http://reviews.llvm.org/D18123
>>
>> Files:
>>   include/clang/AST/UnresolvedSet.h
>>   include/clang/Sema/Lookup.h
>>
>> Index: include/clang/Sema/Lookup.h
>> ===
>> --- include/clang/Sema/Lookup.h
>> +++ include/clang/Sema/Lookup.h
>> @@ -185,6 +185,11 @@
>>Shadowed(false)
>>{}
>>
>> +  // FIXME: These deleted methods can be removed once the default build
>> includes
>> +  // both -Werror and -Wdeprecated.
>>
>
> I wouldn't worry about the default build being -Werror. It's an option, we
> keep the build warning clean (we do that by many of us using -Werror, but
> it's not necessary as such - some buildbots us it too (-Wunused flags often
> enough)).
>
> So if you could drop that clause (just leave it as "removed once the
> default build uses -Wdeprecated", perhaps?)
>
>
> After taht, please go ahead & commit without the need for another round of
> review or anything.
>
>
>> +  LookupResult(const LookupResult &) = delete;
>> +  LookupResult =(const LookupResult &) = delete;
>> +
>>~LookupResult() {
>>  if (Diagnose) diagnose();
>>  if (Paths) deletePaths(Paths);
>> Index: include/clang/AST/UnresolvedSet.h
>> ===
>> --- include/clang/AST/UnresolvedSet.h
>> +++ include/clang/AST/UnresolvedSet.h
>> @@ -59,8 +59,11 @@
>>// UnresolvedSet.
>>  private:
>>template  friend class UnresolvedSet;
>> -  UnresolvedSetImpl() {}
>> -  UnresolvedSetImpl(const UnresolvedSetImpl &) {}
>> +  UnresolvedSetImpl() = default;
>> +  UnresolvedSetImpl(const UnresolvedSetImpl &) = default;
>> +  UnresolvedSetImpl(UnresolvedSetImpl &&) = default;
>> +  UnresolvedSetImpl =(const UnresolvedSetImpl &) = default;
>> +  UnresolvedSetImpl =(UnresolvedSetImpl &&) = default;
>>
>>  public:
>>// We don't currently support assignment through this iterator, so we
>> might
>>
>>
>>
>> ___
>> cfe-commits mailing list
>> cfe-commits@lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>>
>>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D18271: Avoid -Wshadow warnings about constructor parameters named after fields

2016-03-18 Thread David Blaikie via cfe-commits
+Lang, because he was asking me recently about this improvement & thinking
of chipping in

On Fri, Mar 18, 2016 at 10:56 AM, David Blaikie via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> dblaikie added a subscriber: dblaikie.
> dblaikie added a comment.
>
> It's not just modifications of shadowed variables that are a problem - one
> of the one's I'm concerned we should catch is:
>
>   struct foo {
> std::unique_ptr p;
> foo(std::unique_ptr p) : p(std::move(p)) {
>   f(*p);
> }
>   };
>
>
> http://reviews.llvm.org/D18271
>
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D18163: Add visualizers for more clang types. Create more C++-like visualizations for existing Clang types

2016-03-18 Thread Aaron Ballman via cfe-commits
aaron.ballman added inline comments.


Comment at: clang.natvis:25
@@ +24,3 @@
+{*(clang::BuiltinType *)this}
+{*(clang::PointerType *)this}
+{*(clang::AttributedType *)this}

If we're handling pointers, perhaps we should also do references similarly? 
Also, perhaps functions as well (bonus points if you can suss out the function 
prototype and display it!)?


Comment at: clang.natvis:26
@@ +25,3 @@
+{*(clang::PointerType *)this}
+{*(clang::AttributedType *)this}
+{*(clang::TemplateTypeParmType *)this}

I think this should be `TypeBits.TC==clang::Type::TypeClass::Attributed` 
instead.


http://reviews.llvm.org/D18163



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


Re: r263687 - Add an optional named argument (replacement = "xxx") to AvailabilityAttr.

2016-03-18 Thread Manman Ren via cfe-commits
Revert it in r263752.

Thanks,
Manman

On Thu, Mar 17, 2016 at 2:17 PM, Manman Ren  wrote:

> Sorry, working on it.
>
> Manman
>
> On Thu, Mar 17, 2016 at 12:45 PM, Kostya Serebryany 
> wrote:
>
>> This change is causing ubsan bot to complain
>> 
>> .
>> Please fix or revert.
>>
>> Most likely the guilty part is this:
>>
>> +*getReplacementSlot() = replacementExpr;
>>
>> /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/clang/include/clang/Sema/AttributeList.h:276:5:
>>  runtime error: store to misaligned address 0x19b3784c for type 'const 
>> clang::Expr *', which requires 8 byte alignment
>> 0x19b3784c: note: pointer points here
>>   00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  
>> 00 00 00 00 00 00 00 00  ^
>> #0 0x448295e in 
>> clang::AttributeList::AttributeList(clang::IdentifierInfo*, 
>> clang::SourceRange, clang::IdentifierInfo*, clang::SourceLocation, 
>> clang::IdentifierLoc*, clang::AvailabilityChange const&, 
>> clang::AvailabilityChange const&, clang::AvailabilityChange const&, 
>> clang::SourceLocation, clang::Expr const*, clang::AttributeList::Syntax, 
>> clang::SourceLocation, clang::Expr const*) 
>> /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/clang/include/clang/Sema/AttributeList.h:276:27
>> #1 0x448269c in clang::AttributePool::create(clang::IdentifierInfo*, 
>> clang::SourceRange, clang::IdentifierInfo*, clang::SourceLocation, 
>> clang::IdentifierLoc*, clang::AvailabilityChange const&, 
>> clang::AvailabilityChange const&, clang::AvailabilityChange const&, 
>> clang::SourceLocation, clang::Expr const*, clang::AttributeList::Syntax, 
>> clang::SourceLocation, clang::Expr const*) 
>> /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/clang/include/clang/Sema/AttributeList.h:662:29
>> #2 0x447c52d in clang::ParsedAttributes::addNew(clang::IdentifierInfo*, 
>> clang::SourceRange, clang::IdentifierInfo*, clang::SourceLocation, 
>> clang::IdentifierLoc*, clang::AvailabilityChange const&, 
>> clang::AvailabilityChange const&, clang::AvailabilityChange const&, 
>> clang::SourceLocation, clang::Expr const*, clang::AttributeList::Syntax, 
>> clang::SourceLocation, clang::Expr const*) 
>> /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/clang/include/clang/Sema/AttributeList.h:798:7
>> #3 0x4465a73 in clang::Parser::Pa
>>
>>
>>
>>
>> On Wed, Mar 16, 2016 at 8:09 PM, Manman Ren via cfe-commits <
>> cfe-commits@lists.llvm.org> wrote:
>>
>>> Author: mren
>>> Date: Wed Mar 16 22:09:55 2016
>>> New Revision: 263687
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=263687=rev
>>> Log:
>>> Add an optional named argument (replacement = "xxx") to AvailabilityAttr.
>>>
>>> This commit adds a named argument to AvailabilityAttr, while r263652
>>> adds an
>>> optional string argument to __attribute__((deprecated)). This enables the
>>> compiler to provide Fix-Its for deprecated declarations.
>>>
>>> rdar://20588929
>>>
>>> Modified:
>>> cfe/trunk/include/clang/Basic/Attr.td
>>> cfe/trunk/include/clang/Basic/AttrDocs.td
>>> cfe/trunk/include/clang/Parse/Parser.h
>>> cfe/trunk/include/clang/Sema/AttributeList.h
>>> cfe/trunk/include/clang/Sema/Sema.h
>>> cfe/trunk/lib/Lex/PPMacroExpansion.cpp
>>> cfe/trunk/lib/Parse/ParseDecl.cpp
>>> cfe/trunk/lib/Parse/Parser.cpp
>>> cfe/trunk/lib/Sema/SemaDecl.cpp
>>> cfe/trunk/lib/Sema/SemaDeclAttr.cpp
>>> cfe/trunk/test/SemaCXX/attr-deprecated-replacement-fixit.cpp
>>>
>>> Modified: cfe/trunk/include/clang/Basic/Attr.td
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Attr.td?rev=263687=263686=263687=diff
>>>
>>> ==
>>> --- cfe/trunk/include/clang/Basic/Attr.td (original)
>>> +++ cfe/trunk/include/clang/Basic/Attr.td Wed Mar 16 22:09:55 2016
>>> @@ -467,7 +467,7 @@ def Availability : InheritableAttr {
>>>let Args = [IdentifierArgument<"platform">,
>>> VersionArgument<"introduced">,
>>>VersionArgument<"deprecated">,
>>> VersionArgument<"obsoleted">,
>>>BoolArgument<"unavailable">, StringArgument<"message">,
>>> -  BoolArgument<"strict">];
>>> +  BoolArgument<"strict">, StringArgument<"replacement">];
>>>let AdditionalMembers =
>>>  [{static llvm::StringRef getPrettyPlatformName(llvm::StringRef
>>> Platform) {
>>>  return llvm::StringSwitch(Platform)
>>>
>>> Modified: cfe/trunk/include/clang/Basic/AttrDocs.td
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/AttrDocs.td?rev=263687=263686=263687=diff
>>>
>>> ==
>>> --- 

Re: [PATCH] D17407: [Sema] PR25755 Fix crash when initializing out-of-order struct references

2016-03-18 Thread don hinton via cfe-commits
hintonda updated this revision to Diff 51099.
hintonda added a comment.

Addressed comments.


http://reviews.llvm.org/D17407

Files:
  lib/Sema/SemaInit.cpp
  test/SemaCXX/cxx0x-initializer-constructor.cpp

Index: test/SemaCXX/cxx0x-initializer-constructor.cpp
===
--- test/SemaCXX/cxx0x-initializer-constructor.cpp
+++ test/SemaCXX/cxx0x-initializer-constructor.cpp
@@ -407,3 +407,34 @@
 [0] = 1, [2] = 3
   }; // expected-error {{ambiguous}} expected-note {{in implicit initialization of array element 1}}
 }
+
+namespace PR23514 {
+struct Test {
+  int& a;
+  int& b;
+};
+
+int d = 0;
+auto a = Test { .b = d, .a = d, };
+
+struct S { // expected-note-re 2{{candidate constructor (the implicit {{.*}} constructor) not viable: requires 1 argument, but 0 were provided}}
+  S(int a) {} // expected-note {{candidate constructor not viable: requires single argument 'a', but no arguments were provided}}
+};
+
+struct P {
+  char i1;
+  char i2;
+  S s;
+};
+
+P p1 { .s = 2, .i1 = 1, 1, };
+P p2 { .s = 2, .i1 = 1, };
+
+struct PP {
+  char i1;
+  S s1;
+  S s2; // expected-note {{in implicit initialization of field 's2' with omitted initializer}}
+};
+
+PP pp { .s1 = 2, .i1 = 1, }; // expected-error {{no matching constructor for initialization of 'PR23514::S'}}
+}
Index: lib/Sema/SemaInit.cpp
===
--- lib/Sema/SemaInit.cpp
+++ lib/Sema/SemaInit.cpp
@@ -1812,6 +1812,10 @@
   // anything except look at designated initializers; That's okay,
   // because an error should get printed out elsewhere. It might be
   // worthwhile to skip over the rest of the initializer, though.
+  unsigned FieldIdx = 0;
+  unsigned MaxFieldIdx = 0;
+  llvm::BitVector SeenFields;
+  RecordDecl::field_iterator FieldStart = Field;
   RecordDecl *RD = DeclType->getAs()->getDecl();
   RecordDecl::field_iterator FieldEnd = RD->field_end();
   bool CheckForMissingFields = true;
@@ -1833,6 +1837,26 @@
  true, TopLevelObject))
 hadError = true;
 
+  if (!hadError) {
+if (CheckForMissingFields) {
+  unsigned FieldSize{0};
+  for (RecordDecl::field_iterator f = FieldStart; f != FieldEnd; ++f) {
+FieldSize++;
+  }
+  MaxFieldIdx = FieldSize - 1;
+  SeenFields.resize(FieldSize);
+  for (unsigned i = 0; i < FieldIdx; ++i)
+SeenFields.set(i);
+}
+if (Field == FieldEnd) {
+  FieldIdx = MaxFieldIdx;
+} else {
+  FieldIdx = Field->getFieldIndex() - 1;
+}
+SeenFields.set(FieldIdx);
+++FieldIdx;
+  }
+
   InitializedSomething = true;
 
   // Disable check for missing fields when designators are used.
@@ -1856,6 +1880,7 @@
 
 if (Field->isUnnamedBitfield()) {
   // Don't initialize unnamed bitfields, e.g. "int : 20;"
+  ++FieldIdx;
   ++Field;
   continue;
 }
@@ -1885,6 +1910,9 @@
   StructuredList->setInitializedFieldInUnion(*Field);
 }
 
+if (!CheckForMissingFields && !hadError)
+  SeenFields.set(FieldIdx);
+++FieldIdx;
 ++Field;
   }
 
@@ -1904,15 +1932,37 @@
 }
   }
 
-  // Check that any remaining fields can be value-initialized.
-  if (VerifyOnly && Field != FieldEnd && !DeclType->isUnionType() &&
-  !Field->getType()->isIncompleteArrayType()) {
-// FIXME: Should check for holes left by designated initializers too.
-for (; Field != FieldEnd && !hadError; ++Field) {
-  if (!Field->isUnnamedBitfield() && !Field->hasInClassInitializer())
-CheckEmptyInitializable(
-InitializedEntity::InitializeMember(*Field, ),
-IList->getLocEnd());
+  if (!hadError) {
+SmallVector MissingFields;
+if (CheckForMissingFields) {
+  FieldStart = Field;
+} else {
+  for (int Idx = 0, SeenIdx = SeenFields.find_first(); SeenIdx != -1;
+   SeenIdx = SeenFields.find_next(SeenIdx)) {
+while (Idx < SeenIdx) {
+  MissingFields.push_back(FieldStart);
+  ++FieldStart;
+  ++Idx;
+}
+++FieldStart;
+++Idx;
+  }
+}
+while (FieldStart != FieldEnd) {
+  MissingFields.push_back(FieldStart);
+  ++FieldStart;
+}
+
+// Check that any remaining fields can be value-initialized.
+if (VerifyOnly && MissingFields.size() && !DeclType->isUnionType()) {
+  for (auto MissedField : MissingFields) {
+Field = MissedField;
+if (!Field->isUnnamedBitfield() && !Field->hasInClassInitializer() &&
+!Field->getType()->isIncompleteArrayType())
+  CheckEmptyInitializable(
+  InitializedEntity::InitializeMember(*Field, ),
+  IList->getLocEnd());
+  }
 }
   }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org

Re: [PATCH] D18088: Add a new warning to notify users of mismatched SDK and deployment target

2016-03-18 Thread Bob Wilson via cfe-commits
bob.wilson added a comment.

Yes, in its current usage this warning is only used for Apple's SDKs, but how 
does it help to put "apple" in the name of the diagnostic? Are you concerned 
about a name conflict with a similar diagnostic for non-Apple SDKs?


http://reviews.llvm.org/D18088



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


Re: [PATCH] D17285: Fix printing of anonymous struct typedefs

2016-03-18 Thread Steven Watanabe via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL263836: Fix printing of anonymous struct typedefs. (authored 
by steven_watanabe).

Changed prior to commit:
  http://reviews.llvm.org/D17285?vs=48042=51072#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D17285

Files:
  cfe/trunk/include/clang/AST/PrettyPrinter.h
  cfe/trunk/include/clang/AST/Type.h
  cfe/trunk/lib/AST/DeclPrinter.cpp
  cfe/trunk/lib/AST/TypePrinter.cpp
  cfe/trunk/test/Sema/ast-print.c

Index: cfe/trunk/include/clang/AST/PrettyPrinter.h
===
--- cfe/trunk/include/clang/AST/PrettyPrinter.h
+++ cfe/trunk/include/clang/AST/PrettyPrinter.h
@@ -36,7 +36,8 @@
   /// \brief Create a default printing policy for C.
   PrintingPolicy(const LangOptions )
 : LangOpts(LO), Indentation(2), SuppressSpecifiers(false),
-  SuppressTagKeyword(false), SuppressTag(false), SuppressScope(false),
+  SuppressTagKeyword(false),
+  IncludeTagDefinition(false), SuppressScope(false),
   SuppressUnwrittenScope(false), SuppressInitializers(false),
   ConstantArraySizeAsWritten(false), AnonymousTagLocations(true),
   SuppressStrongLifetime(false), SuppressLifetimeQualifiers(false),
@@ -77,15 +78,15 @@
   /// \endcode
   bool SuppressTagKeyword : 1;
 
-  /// \brief Whether type printing should skip printing the actual tag type.
+  /// \brief When true, include the body of a tag definition.
   ///
-  /// This is used when the caller needs to print a tag definition in front
-  /// of the type, as in constructs like the following:
+  /// This is used to place the definition of a struct
+  /// in the middle of another declaration as with:
   ///
   /// \code
   /// typedef struct { int x, y; } Point;
   /// \endcode
-  bool SuppressTag : 1;
+  bool IncludeTagDefinition : 1;
 
   /// \brief Suppresses printing of scope specifiers.
   bool SuppressScope : 1;
Index: cfe/trunk/include/clang/AST/Type.h
===
--- cfe/trunk/include/clang/AST/Type.h
+++ cfe/trunk/include/clang/AST/Type.h
@@ -909,16 +909,19 @@
   std::string getAsString(const PrintingPolicy ) const;
 
   void print(raw_ostream , const PrintingPolicy ,
- const Twine  = Twine()) const {
-print(split(), OS, Policy, PlaceHolder);
+ const Twine  = Twine(),
+ unsigned Indentation = 0) const {
+print(split(), OS, Policy, PlaceHolder, Indentation);
   }
   static void print(SplitQualType split, raw_ostream ,
-const PrintingPolicy , const Twine ) {
-return print(split.Ty, split.Quals, OS, policy, PlaceHolder);
+const PrintingPolicy , const Twine ,
+unsigned Indentation = 0) {
+return print(split.Ty, split.Quals, OS, policy, PlaceHolder, Indentation);
   }
   static void print(const Type *ty, Qualifiers qs,
 raw_ostream , const PrintingPolicy ,
-const Twine );
+const Twine ,
+unsigned Indentation = 0);
 
   void getAsStringInternal(std::string ,
const PrintingPolicy ) const {
@@ -936,21 +939,24 @@
 const QualType 
 const PrintingPolicy 
 const Twine 
+unsigned Indentation;
   public:
 StreamedQualTypeHelper(const QualType , const PrintingPolicy ,
-   const Twine )
-  : T(T), Policy(Policy), PlaceHolder(PlaceHolder) { }
+   const Twine , unsigned Indentation)
+  : T(T), Policy(Policy), PlaceHolder(PlaceHolder),
+Indentation(Indentation) { }
 
 friend raw_ostream <<(raw_ostream ,
const StreamedQualTypeHelper ) {
-  SQT.T.print(OS, SQT.Policy, SQT.PlaceHolder);
+  SQT.T.print(OS, SQT.Policy, SQT.PlaceHolder, SQT.Indentation);
   return OS;
 }
   };
 
   StreamedQualTypeHelper stream(const PrintingPolicy ,
-const Twine  = Twine()) const {
-return StreamedQualTypeHelper(*this, Policy, PlaceHolder);
+const Twine  = Twine(),
+unsigned Indentation = 0) const {
+return StreamedQualTypeHelper(*this, Policy, PlaceHolder, Indentation);
   }
 
   void dump(const char *s) const;
Index: cfe/trunk/test/Sema/ast-print.c
===
--- cfe/trunk/test/Sema/ast-print.c
+++ cfe/trunk/test/Sema/ast-print.c
@@ -1,4 +1,5 @@
 // RUN: %clang_cc1 %s -ast-print | FileCheck %s
+// RUN: %clang_cc1 %s -ast-print | %clang_cc1 -fsyntax-only -
 
 typedef void func_typedef();
 func_typedef xxx;
@@ -39,6 +40,7 @@
   return a[2];
 }
 
+// CHECK: typedef struct {
 typedef struct {
   int f;
 } T __attribute__ ((__aligned__));
Index: cfe/trunk/lib/AST/TypePrinter.cpp
===
--- 

Re: [PATCH] D18136: boost-use-to-string check

2016-03-18 Thread Piotr Padlewski via cfe-commits
Prazek updated the summary for this revision.
Prazek updated this revision to Diff 51057.
Prazek added a comment.

fixed many things thaks to Alexander


http://reviews.llvm.org/D18136

Files:
  clang-tidy/boost/BoostTidyModule.cpp
  clang-tidy/boost/CMakeLists.txt
  clang-tidy/boost/UseToStringCheck.cpp
  clang-tidy/boost/UseToStringCheck.h
  docs/clang-tidy/checks/boost-use-to-string.rst
  docs/clang-tidy/checks/list.rst
  test/clang-tidy/boost-use-to-string.cpp

Index: test/clang-tidy/boost-use-to-string.cpp
===
--- /dev/null
+++ test/clang-tidy/boost-use-to-string.cpp
@@ -0,0 +1,138 @@
+// RUN: %check_clang_tidy %s boost-use-to-string %t
+
+
+namespace std {
+
+template  class basic_string {};
+
+using string = basic_string;
+using wstring = basic_string;
+}
+
+namespace boost {
+template 
+T lexical_cast(const V&) {
+  return T();
+};
+}
+
+struct my_weird_type {};
+
+std::string fun(const std::string &) {}
+
+void test_to_string1() {
+
+  auto xa = boost::lexical_cast(5);
+// CHECK-MESSAGES: :[[@LINE-1]]:13: warning: use std::to_string instead of boost::lexical_cast [boost-use-to-string]
+// CHECK-FIXES: auto xa = std::to_string(5);
+
+ auto z = boost::lexical_cast(42LL);
+// CHECK-MESSAGES: :[[@LINE-1]]:11: warning: use std::to_string {{..}}
+// CHECK-FIXES: auto z = std::to_string(42LL);
+
+  // this should not trigger
+  fun(boost::lexical_cast(42.0));
+  auto non = boost::lexical_cast(42);
+  boost::lexical_cast("12");
+}
+
+void test_to_string2() {
+  int a;
+  long b;
+  long long c;
+  unsigned d;
+  unsigned long e;
+  unsigned long long f;
+  float g;
+  double h;
+  long double i;
+  bool j;
+
+  fun(boost::lexical_cast(a));
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_string {{..}}
+// CHECK-FIXES: fun(std::to_string(a));
+  fun(boost::lexical_cast(b));
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_string {{..}}
+// CHECK-FIXES: fun(std::to_string(b));
+  fun(boost::lexical_cast(c));
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_string {{..}}
+// CHECK-FIXES: fun(std::to_string(c));
+  fun(boost::lexical_cast(d));
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_string {{..}}
+// CHECK-FIXES: fun(std::to_string(d));
+  fun(boost::lexical_cast(e));
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_string {{..}}
+// CHECK-FIXES: fun(std::to_string(e));
+  fun(boost::lexical_cast(f));
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_string {{..}}
+// CHECK-FIXES: fun(std::to_string(f));
+
+  // No change for floating numbers.
+  fun(boost::lexical_cast(g));
+  fun(boost::lexical_cast(h));
+  fun(boost::lexical_cast(i));
+  // And bool.
+  fun(boost::lexical_cast(j));
+}
+
+std::string fun(const std::wstring &) {}
+
+void test_to_wstring() {
+  int a;
+  long b;
+  long long c;
+  unsigned d;
+  unsigned long e;
+  unsigned long long f;
+  float g;
+  double h;
+  long double i;
+  bool j;
+
+  fun(boost::lexical_cast(a));
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_wstring instead of boost::lexical_cast [boost-use-to-string]
+// CHECK-FIXES: fun(std::to_wstring(a));
+  fun(boost::lexical_cast(b));
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_wstring {{..}}
+// CHECK-FIXES: fun(std::to_wstring(b));
+  fun(boost::lexical_cast(c));
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_wstring {{..}}
+// CHECK-FIXES: fun(std::to_wstring(c));
+  fun(boost::lexical_cast(d));
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_wstring {{..}}
+// CHECK-FIXES: fun(std::to_wstring(d));
+  fun(boost::lexical_cast(e));
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_wstring {{..}}
+// CHECK-FIXES: fun(std::to_wstring(e));
+  fun(boost::lexical_cast(f));
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::to_wstring {{..}}
+// CHECK-FIXES: fun(std::to_wstring(f));
+
+  // No change for floating numbers
+  fun(boost::lexical_cast(g));
+  fun(boost::lexical_cast(h));
+  fun(boost::lexical_cast(i));
+  // and bool.
+  fun(boost::lexical_cast(j));
+}
+
+template 
+void string_as_T() {
+  boost::lexical_cast(42);
+// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use std::to_string{{..}}
+// CHECK-FIXES: std::to_string(42);
+  // FIXME it should not replace this call
+  //boost::lexical_cast(42);
+}
+
+
+void no_warnings() {
+  fun(boost::lexical_cast("abc"));
+  fun(boost::lexical_cast("abc"));
+  fun(boost::lexical_cast(my_weird_type{}));
+  string_as_T();
+  string_as_T();
+}
+
+
+
Index: docs/clang-tidy/checks/list.rst
===
--- docs/clang-tidy/checks/list.rst
+++ docs/clang-tidy/checks/list.rst
@@ -4,6 +4,7 @@
 =
 
 .. toctree::   
+   boost-use-to-string
cert-dcl03-c (redirects to misc-static-assert) 
cert-dcl50-cpp
cert-dcl54-cpp (redirects to misc-new-delete-overloads) 
Index: docs/clang-tidy/checks/boost-use-to-string.rst

Re: [PATCH] D12147: Fix typos in lib/AST

2016-03-18 Thread Richard Smith via cfe-commits
rsmith added a comment.

All the changes other than 'modelled' look fine :) Do you need someone to 
commit this for you?



Comment at: lib/AST/ASTContext.cpp:1631
@@ -1630,3 +1630,3 @@
 case BuiltinType::OCLSampler:
-  // Samplers are modeled as integers.
+  // Samplers are modelled as integers.
   Width = Target->getIntWidth();

Both of these spellings are considered correct; the existing spelling is the US 
English spelling, which will likely be more familiar to more Clang developers.


http://reviews.llvm.org/D12147



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


[PATCH] D18275: [ASTMatchers] Add own version of VariadicFunction.

2016-03-18 Thread Samuel Benzaquen via cfe-commits
sbenza created this revision.
sbenza added a reviewer: alexfh.
sbenza added a subscriber: cfe-commits.
Herald added a subscriber: klimek.

llvm::VariadicFunction is only being used by ASTMatchers.
Having own copy here allows us to remove the other one from llvm/ADT.
Also, we can extend the API to our needs without modifying the common
implementation.

http://reviews.llvm.org/D18275

Files:
  include/clang/ASTMatchers/ASTMatchers.h
  include/clang/ASTMatchers/ASTMatchersInternal.h
  lib/ASTMatchers/Dynamic/Marshallers.h
  unittests/ASTMatchers/ASTMatchersTest.cpp

Index: unittests/ASTMatchers/ASTMatchersTest.cpp
===
--- unittests/ASTMatchers/ASTMatchersTest.cpp
+++ unittests/ASTMatchers/ASTMatchersTest.cpp
@@ -2892,6 +2892,9 @@
   EXPECT_TRUE(notMatches(Code, recordDecl(hasAnyName("::C", "::b::C";
   EXPECT_TRUE(
   matches(Code, recordDecl(hasAnyName("::C", "::b::C", "::a::b::C";
+
+  std::vector Names = {"::C", "::b::C", "::a::b::C"};
+  EXPECT_TRUE(matches(Code, recordDecl(hasAnyName(Names;
 }
 
 TEST(Matcher, IsDefinition) {
Index: lib/ASTMatchers/Dynamic/Marshallers.h
===
--- lib/ASTMatchers/Dynamic/Marshallers.h
+++ lib/ASTMatchers/Dynamic/Marshallers.h
@@ -325,8 +325,9 @@
 
   template )>
-  VariadicFuncMatcherDescriptor(llvm::VariadicFunction Func,
-  StringRef MatcherName)
+  VariadicFuncMatcherDescriptor(
+  ast_matchers::internal::VariadicFunction Func,
+  StringRef MatcherName)
   : Func(),
 MatcherName(MatcherName.str()),
 ArgsKind(ArgTypeTraits::getKind()) {
@@ -655,9 +656,9 @@
 /// \brief Variadic overload.
 template )>
-MatcherDescriptor *
-makeMatcherAutoMarshall(llvm::VariadicFunction VarFunc,
-StringRef MatcherName) {
+MatcherDescriptor *makeMatcherAutoMarshall(
+ast_matchers::internal::VariadicFunction VarFunc,
+StringRef MatcherName) {
   return new VariadicFuncMatcherDescriptor(VarFunc, MatcherName);
 }
 
Index: include/clang/ASTMatchers/ASTMatchersInternal.h
===
--- include/clang/ASTMatchers/ASTMatchersInternal.h
+++ include/clang/ASTMatchers/ASTMatchersInternal.h
@@ -47,7 +47,6 @@
 #include "clang/AST/StmtObjC.h"
 #include "clang/AST/Type.h"
 #include "llvm/ADT/Optional.h"
-#include "llvm/ADT/VariadicFunction.h"
 #include "llvm/Support/ManagedStatic.h"
 #include 
 #include 
@@ -60,6 +59,39 @@
 
 namespace internal {
 
+/// \brief Variadic function object.
+///
+/// Most of the functions below that use VariadicFunction could be implemented
+/// using plain C++11 variadic functions, but the function object allows us to
+/// capture it on the dynamic matcher registry.
+template )>
+struct VariadicFunction {
+  ResultT operator()() const { return Func({}); }
+
+  template 
+  ResultT operator()(const ArgT , const ArgsT &... Args) const {
+return Execute(Arg1, static_cast(Args)...);
+  }
+
+  // We also allow calls with an already created array, in case the caller
+  // already had it.
+  ResultT operator()(ArrayRef Args) const {
+std::vector InnerArgs;
+for (const ArgT  : Args)
+  InnerArgs.push_back();
+return Func(InnerArgs);
+  }
+
+private:
+  // Trampoline function to allow for implicit conversions to take place
+  // before we make the array.
+  template  ResultT Execute(const ArgsT &... Args) const {
+const ArgT *const ArgsArray[] = {};
+return Func(ArgsArray);
+  }
+};
+
 /// \brief Unifies obtaining the underlying type of a regular node through
 /// `getType` and a TypedefNameDecl node through `getUnderlyingType`.
 template 
@@ -1408,9 +1440,8 @@
 /// casted to CXXRecordDecl and all given matchers match.
 template 
 class VariadicDynCastAllOfMatcher
-: public llvm::VariadicFunction<
-BindableMatcher, Matcher,
-makeDynCastAllOfComposite > {
+: public VariadicFunction> {
 public:
   VariadicDynCastAllOfMatcher() {}
 };
@@ -1426,9 +1457,9 @@
 /// \c Matcher.
 /// The returned matcher matches if all given matchers match.
 template 
-class VariadicAllOfMatcher : public llvm::VariadicFunction<
-   BindableMatcher, Matcher,
-   makeAllOfComposite > {
+class VariadicAllOfMatcher
+: public VariadicFunction {
 public:
   VariadicAllOfMatcher() {}
 };
@@ -1549,8 +1580,8 @@
 new MatcherImpl(InnerMatcher, Getter::value()));
   }
 
-  struct Func : public llvm::VariadicFunction {
+  struct Func
+  : public 

Re: [PATCH] D18191: [clang-tidy] Add check for function parameters that are const& to builtin types

2016-03-18 Thread Richard via cfe-commits
LegalizeAdulthood added a comment.

In http://reviews.llvm.org/D18191#377686, @sdowney wrote:

> In http://reviews.llvm.org/D18191#376471, @LegalizeAdulthood wrote:
>
> > There is utility in the definition of a function in saying that an argument 
> > is `const int i` instead of `int i`.  The const-ness declares the intent 
> > that this local variable is not going to be modified.  However, there is 
> > that oddity in C++ that allows a declaration to say `void f(int i);` and 
> > the implementation to say `void f(const int i) { ... }`.
> >
> > I think I would like the fixit to preserve the const-ness of the argument 
> > while still stripping it of it's reference.
>
>
> The usual pattern for that is to have the definition use const, and the 
> declaration not, since it's an implementation detail if the passed parameter 
> is modified. And, unfortunately, I'm stuck with one compiler that mangles 
> those two differently, causing link errors.
>
> Having void foo(const int i) in a declaration makes me suspicious, since the 
> const is meaningless.
>
> I could make this an option? If the option is set, emit 'const type' if the 
> Decl hasBody?


It seems reasonable to do this as a refinement after this check is in place.


http://reviews.llvm.org/D18191



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


Re: [PATCH] D15031: CFG: Add CFGElement for automatic variables that leave the scope

2016-03-18 Thread Alexander Kornienko via cfe-commits
alexfh added a subscriber: alexfh.
alexfh added a comment.

Richard, can you review this?


http://reviews.llvm.org/D15031



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


[libcxx] r263798 - Missing ATOMIC_*_LOCK_FREE tests

2016-03-18 Thread JF Bastien via cfe-commits
Author: jfb
Date: Fri Mar 18 12:48:58 2016
New Revision: 263798

URL: http://llvm.org/viewvc/llvm-project?rev=263798=rev
Log:
Missing ATOMIC_*_LOCK_FREE tests

Forked from D17951, these tests should have been there but weren't.

Modified:
libcxx/trunk/test/std/atomics/atomics.lockfree/lockfree.pass.cpp

Modified: libcxx/trunk/test/std/atomics/atomics.lockfree/lockfree.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/atomics/atomics.lockfree/lockfree.pass.cpp?rev=263798=263797=263798=diff
==
--- libcxx/trunk/test/std/atomics/atomics.lockfree/lockfree.pass.cpp (original)
+++ libcxx/trunk/test/std/atomics/atomics.lockfree/lockfree.pass.cpp Fri Mar 18 
12:48:58 2016
@@ -11,6 +11,7 @@
 
 // 
 
+// #define ATOMIC_BOOL_LOCK_FREE unspecified
 // #define ATOMIC_CHAR_LOCK_FREE unspecified
 // #define ATOMIC_CHAR16_T_LOCK_FREE unspecified
 // #define ATOMIC_CHAR32_T_LOCK_FREE unspecified
@@ -19,12 +20,16 @@
 // #define ATOMIC_INT_LOCK_FREE unspecified
 // #define ATOMIC_LONG_LOCK_FREE unspecified
 // #define ATOMIC_LLONG_LOCK_FREE unspecified
+// #define ATOMIC_POINTER_LOCK_FREE unspecified
 
 #include 
 #include 
 
 int main()
 {
+assert(ATOMIC_BOOL_LOCK_FREE == 0 ||
+   ATOMIC_BOOL_LOCK_FREE == 1 ||
+   ATOMIC_BOOL_LOCK_FREE == 2);
 assert(ATOMIC_CHAR_LOCK_FREE == 0 ||
ATOMIC_CHAR_LOCK_FREE == 1 ||
ATOMIC_CHAR_LOCK_FREE == 2);
@@ -49,4 +54,7 @@ int main()
 assert(ATOMIC_LLONG_LOCK_FREE == 0 ||
ATOMIC_LLONG_LOCK_FREE == 1 ||
ATOMIC_LLONG_LOCK_FREE == 2);
+assert(ATOMIC_POINTER_LOCK_FREE == 0 ||
+   ATOMIC_POINTER_LOCK_FREE == 1 ||
+   ATOMIC_POINTER_LOCK_FREE == 2);
 }


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