[PATCH] D40671: [clang-tidy] Support specific checks for NOLINT directive

2017-12-13 Thread Anton via Phabricator via cfe-commits
xgsa added a comment.

In https://reviews.llvm.org/D40671#954661, @alexfh wrote:

> In https://reviews.llvm.org/D40671#953888, @aaron.ballman wrote:
>
> > FWIW, I think we should do something about unknown check names in NOLINT 
> > comments, but that can be done as a follow-up patch. If we're ignoring the 
> > comment, we might want to diagnose that fact so users have an idea what's 
> > going on.
>
>
> IIUC, cpplint can output a diagnostic about unknown categories inside NOLINT 
> and about NOLINT directives that happen on lines where no warning is emitted. 
> Both would be useful in clang-tidy, IMO.


I agree with your statements and I think there should be the following 
diagnostics about NOLINT usage:

- as you described, using of NOLINT with unknown check names;
- using of NOLINT for the line, on which there is no diagnostics (at all with 
NOLINT and for the swpecified diagnostics); this should help to detect dangling 
NOLINT comments, that have no meaning anymore.

Moreover, there should be a way to turn on/off these diagnostics, so possibily 
they should be a separate checks. What do you think? Is there a way for a check 
to collect the emitted diagnostics?


https://reviews.llvm.org/D40671



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


[PATCH] D41195: [ClangFormat] IndentWrappedFunctionNames should be true in the google ObjC style

2017-12-13 Thread Daniel Jasper via Phabricator via cfe-commits
djasper accepted this revision.
djasper added inline comments.
This revision is now accepted and ready to land.



Comment at: unittests/Format/FormatTestObjC.cpp:388
+  // Wrapped method parameters should be indented.
+  verifyFormat("- (VeryLongReturnTypeName)\n"
+   "veryLongMethodParameter:(VeryLongParameterName)"

Set Style.ColumnLimit to something lower so that you don't have to wrap single 
lines (for better test readability).


Repository:
  rC Clang

https://reviews.llvm.org/D41195



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


[PATCH] D41223: [libc++] Fix PR35491 - std::array of zero-size doesn't work with non-default constructible types.

2017-12-13 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF updated this revision to Diff 126898.
EricWF added a comment.

Fix begin/end/data.
===


https://reviews.llvm.org/D41223

Files:
  include/array
  test/std/containers/sequences/array/array.cons/default.pass.cpp
  test/std/containers/sequences/array/array.data/data.pass.cpp
  test/std/containers/sequences/array/array.data/data_const.pass.cpp
  test/std/containers/sequences/array/begin.pass.cpp

Index: test/std/containers/sequences/array/begin.pass.cpp
===
--- test/std/containers/sequences/array/begin.pass.cpp
+++ test/std/containers/sequences/array/begin.pass.cpp
@@ -31,4 +31,13 @@
 *i = 5.5;
 assert(c[0] == 5.5);
 }
+{
+  struct NoDefault {
+NoDefault(int) {}
+  };
+  typedef NoDefault T;
+  typedef std::array C;
+  C c = {};
+  assert(c.begin() == c.end());
+}
 }
Index: test/std/containers/sequences/array/array.data/data_const.pass.cpp
===
--- test/std/containers/sequences/array/array.data/data_const.pass.cpp
+++ test/std/containers/sequences/array/array.data/data_const.pass.cpp
@@ -38,6 +38,16 @@
 const T* p = c.data();
 (void)p; // to placate scan-build
 }
+{
+  struct NoDefault {
+NoDefault(int) {}
+  };
+  typedef NoDefault T;
+  typedef std::array C;
+  const C c = {};
+  const T* p = c.data();
+  assert(p != nullptr);
+}
 #if TEST_STD_VER > 14
 {
 typedef std::array C;
Index: test/std/containers/sequences/array/array.data/data.pass.cpp
===
--- test/std/containers/sequences/array/array.data/data.pass.cpp
+++ test/std/containers/sequences/array/array.data/data.pass.cpp
@@ -36,4 +36,14 @@
 T* p = c.data();
 (void)p; // to placate scan-build
 }
+{
+  struct NoDefault {
+NoDefault(int) {}
+  };
+  typedef NoDefault T;
+  typedef std::array C;
+  C c = {};
+  T* p = c.data();
+  assert(p != nullptr);
+}
 }
Index: test/std/containers/sequences/array/array.cons/default.pass.cpp
===
--- test/std/containers/sequences/array/array.cons/default.pass.cpp
+++ test/std/containers/sequences/array/array.cons/default.pass.cpp
@@ -14,6 +14,10 @@
 #include 
 #include 
 
+struct NoDefault {
+  NoDefault(int) {}
+};
+
 int main()
 {
 {
@@ -28,4 +32,9 @@
 C c;
 assert(c.size() == 0);
 }
+{
+  typedef std::array C;
+  C c;
+  assert(c.size() == 0);
+}
 }
Index: include/array
===
--- include/array
+++ include/array
@@ -117,6 +117,55 @@
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
+template 
+struct __array_traits {
+  typedef _Tp _StorageT[_Size];
+
+  _LIBCPP_INLINE_VISIBILITY
+  static _LIBCPP_CONSTEXPR_AFTER_CXX14 _Tp* __data(_StorageT& __store) {
+return __store;
+  }
+
+  _LIBCPP_INLINE_VISIBILITY
+  static _LIBCPP_CONSTEXPR_AFTER_CXX14 _Tp const* __data(const _StorageT& __store) {
+return __store;
+  }
+
+  _LIBCPP_INLINE_VISIBILITY
+  static void __swap(_StorageT& __lhs, _StorageT& __rhs) {
+std::swap_ranges(__lhs, __lhs + _Size, __rhs);
+  }
+
+  _LIBCPP_INLINE_VISIBILITY
+  static void __fill(_StorageT& __arr, _Tp const& __val) {
+_VSTD::fill_n(__arr, _Size, __val);
+  }
+};
+
+template 
+struct __array_traits<_Tp, 0> {
+  typedef typename aligned_storage::value>::type _StorageT;
+
+  _LIBCPP_INLINE_VISIBILITY
+  static _Tp* __data(_StorageT& __store) {
+_StorageT *__ptr = std::addressof(__store);
+return reinterpret_cast<_Tp*>(__ptr);
+  }
+
+  _LIBCPP_INLINE_VISIBILITY
+  static const _Tp* __data(const _StorageT& __store) {
+const _StorageT *__ptr = std::addressof(__store);
+return reinterpret_cast(__ptr);
+  }
+
+  _LIBCPP_INLINE_VISIBILITY
+  static void __swap(_StorageT&, _StorageT&) {}
+
+  _LIBCPP_INLINE_VISIBILITY
+  static void __fill(_StorageT&, _Tp const&) {
+  }
+};
+
 template 
 struct _LIBCPP_TEMPLATE_VIS array
 {
@@ -134,31 +183,26 @@
 typedef std::reverse_iterator   reverse_iterator;
 typedef std::reverse_iterator const_reverse_iterator;
 
-value_type __elems_[_Size > 0 ? _Size : 1];
+typedef __array_traits<_Tp, _Size> _Traits;
+typename _Traits::_StorageT __elems_;
 
 // No explicit construct/copy/destroy for aggregate type
 _LIBCPP_INLINE_VISIBILITY void fill(const value_type& __u)
-{_VSTD::fill_n(__elems_, _Size, __u);}
-_LIBCPP_INLINE_VISIBILITY
-void swap(array& __a) _NOEXCEPT_(_Size == 0 || __is_nothrow_swappable<_Tp>::value)
-{ __swap_dispatch((std::integral_constant()), __a); }
+{_Traits::__fill(__elems_, __u);}
 
 _LIBCPP_INLINE_VISIBILITY
- 

[PATCH] D40809: [WIP] [analyzer] Dump counterexample traces as C programs

2017-12-13 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment.

In https://reviews.llvm.org/D40809#954858, @dcoughlin wrote:

> One possibility is to turn this into a debug checker similar to 
> debug.ViewExplodedGraph. That checker registers for a checkEndAnalysis() 
> callback and traverses the node graph (see DebugCheckers.cpp). Can you do the 
> same here? It doesn't look like you really need this to be a 
> BugReporterVisitor -- and making it a debug checker would avoid outputting 
> multiple copies for each diagnostic consumer.


These prints are only for actual bugs, not for the whole graph


https://reviews.llvm.org/D40809



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


[PATCH] D41223: [libc++] Fix PR35491 - std::array of zero-size doesn't work with non-default constructible types.

2017-12-13 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF created this revision.
EricWF added a reviewer: mclow.lists.

This patch fixes llvm.org/PR35491

The fix attempts to maintain ABI compatibility by replacing the array with a 
instance of `aligned_storage`.


https://reviews.llvm.org/D41223

Files:
  include/array
  test/std/containers/sequences/array/array.cons/default.pass.cpp


Index: test/std/containers/sequences/array/array.cons/default.pass.cpp
===
--- test/std/containers/sequences/array/array.cons/default.pass.cpp
+++ test/std/containers/sequences/array/array.cons/default.pass.cpp
@@ -14,6 +14,10 @@
 #include 
 #include 
 
+struct NoDefault {
+  NoDefault(int) {}
+};
+
 int main()
 {
 {
@@ -28,4 +32,9 @@
 C c;
 assert(c.size() == 0);
 }
+  {
+typedef std::array C;
+C c;
+assert(c.size() == 0);
+  }
 }
Index: include/array
===
--- include/array
+++ include/array
@@ -134,7 +134,12 @@
 typedef std::reverse_iterator   reverse_iterator;
 typedef std::reverse_iterator const_reverse_iterator;
 
-value_type __elems_[_Size > 0 ? _Size : 1];
+typedef typename conditional<_Size == 0,
+typename aligned_storage::value>::type,
+value_type[_Size == 0 ? 1 : _Size]
+  >::type _StorageType;
+
+_StorageType __elems_;
 
 // No explicit construct/copy/destroy for aggregate type
 _LIBCPP_INLINE_VISIBILITY void fill(const value_type& __u)


Index: test/std/containers/sequences/array/array.cons/default.pass.cpp
===
--- test/std/containers/sequences/array/array.cons/default.pass.cpp
+++ test/std/containers/sequences/array/array.cons/default.pass.cpp
@@ -14,6 +14,10 @@
 #include 
 #include 
 
+struct NoDefault {
+  NoDefault(int) {}
+};
+
 int main()
 {
 {
@@ -28,4 +32,9 @@
 C c;
 assert(c.size() == 0);
 }
+  {
+typedef std::array C;
+C c;
+assert(c.size() == 0);
+  }
 }
Index: include/array
===
--- include/array
+++ include/array
@@ -134,7 +134,12 @@
 typedef std::reverse_iterator   reverse_iterator;
 typedef std::reverse_iterator const_reverse_iterator;
 
-value_type __elems_[_Size > 0 ? _Size : 1];
+typedef typename conditional<_Size == 0,
+typename aligned_storage::value>::type,
+value_type[_Size == 0 ? 1 : _Size]
+  >::type _StorageType;
+
+_StorageType __elems_;
 
 // No explicit construct/copy/destroy for aggregate type
 _LIBCPP_INLINE_VISIBILITY void fill(const value_type& __u)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D41102: Setup clang-doc frontend framework

2017-12-13 Thread Jonas Toth via Phabricator via cfe-commits
JonasToth added a comment.

I am happy now. But I don't have any authority to allow this patch to land 
whatsoever. Who will be the code owner for `clang-doc`? I think the tooling 
guys need to accept.




Comment at: tools/clang-doc/ClangDoc.cpp:54
+
+  // TODO: Move set attached to the initial comment parsing, not here
+  if (Comment) {

Full sentence. 
`set attached` == `setAttached`?
Removing the not here and using the method name is probably enough already.



Comment at: tools/clang-doc/tool/ClangDocMain.cpp:42
+
+  doc::OutFormat EmitFormat;
+  EmitLLVM ? EmitFormat = clang::doc::OutFormat::LLVM

The two lines could be merged when initializing `EmitFormat` directly.



Comment at: tools/clang-doc/tool/ClangDocMain.cpp:47
+  // TODO: Update the source path list to only consider changed files for
+  // incremental doc updates
+  doc::ClangDocReporter Reporter(OptionsParser.getSourcePathList());

Missing full stop. Comments are supposed to be full sentences by convention.


https://reviews.llvm.org/D41102



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


[PATCH] D41050: Fix over-release of return value of lambda implicitly converted to block/function pointer

2017-12-13 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment.

Oh, yes, that could be.


Repository:
  rC Clang

https://reviews.llvm.org/D41050



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


[PATCH] D40841: [analyzer] Fix a crash on C++17 AST for non-trivial construction into a trivial brace initializer.

2017-12-13 Thread Devin Coughlin via Phabricator via cfe-commits
dcoughlin accepted this revision.
dcoughlin added a comment.
This revision is now accepted and ready to land.

This looks good to me for a quick fix that we plan to address in a more 
principled fashion later.

However, I'd like you to add a comment at each of the places where you use the 
parent map to note something like  "This is a quick dirty fix and we really 
shouldn't be using the parent map to model behavior." I understand why you're 
doing it, but I'd like to make sure that someone reading this code doesn't 
think that it is a good pattern to use the parent map and decide to use it 
elsewhere!

Using the parent map is slow and is a sign that our reasoning isn't 
compositional. The analyzer should be able to figure out the correct behavior 
based on the expression and its state/context alone. The fact that we need the 
parent map here is an indication that we don't have the right representation 
for constructors in the analyzer. (I know you're planning on tackling this in 
the future!)


https://reviews.llvm.org/D40841



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


[PATCH] D41050: Fix over-release of return value of lambda implicitly converted to block/function pointer

2017-12-13 Thread Duncan P. N. Exon Smith via Phabricator via cfe-commits
dexonsmith added a comment.

In https://reviews.llvm.org/D41050#954863, @rjmccall wrote:

> Heh, alright, that works.  It's unfortunate that -disable-llvm-passes doesn't 
> suppress running the pass under -O0; that seems like an oversight.
>
> Anyway, LGTM.


I suspect `-O0` just generates different IR.  You can confirm what passes are 
executed by adding `-mllvm -debug-pass=Executions`.


Repository:
  rC Clang

https://reviews.llvm.org/D41050



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


[PATCH] D41217: [Concepts] Concept Specialization Expressions

2017-12-13 Thread changyu via Phabricator via cfe-commits
changyu added inline comments.



Comment at: lib/AST/ExprCXX.cpp:1481
+if (E.isInvalid() || Trap.hasErrorOccurred()) {
+// C++2a [temp.constr.atomic]p1
+//   ...If substitution results in an invalid type or expression, the

You have four spaces of indenting here.



Comment at: lib/Parse/ParseExpr.cpp:225
+  if (Res.isUsable() && !Actions.CheckConstraintExpression(Res.get())) {
+  return ExprError();
+  }

Indenting.


Repository:
  rC Clang

https://reviews.llvm.org/D41217



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


[PATCH] D41050: Fix over-release of return value of lambda implicitly converted to block/function pointer

2017-12-13 Thread John McCall via Phabricator via cfe-commits
rjmccall accepted this revision.
rjmccall added a comment.
This revision is now accepted and ready to land.

Heh, alright, that works.  It's unfortunate that -disable-llvm-passes doesn't 
suppress running the pass under -O0; that seems like an oversight.

Anyway, LGTM.


Repository:
  rC Clang

https://reviews.llvm.org/D41050



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


[PATCH] D40809: [WIP] [analyzer] Dump counterexample traces as C programs

2017-12-13 Thread Alexander Shaposhnikov via Phabricator via cfe-commits
alexshap added inline comments.



Comment at: lib/StaticAnalyzer/Core/BugReporterVisitors.cpp:1976
+unsigned FileEndOffset = SM.getFileOffset(SM.getLocForEndOfFile(FID));
+for (unsigned i=Offset; BufferStart[i] != '\n' && i < FileEndOffset; ++i)
+  Ostream << BufferStart[i];

spaces around '=' (maybe clang-format this diff ?)


https://reviews.llvm.org/D40809



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


[PATCH] D30691: [analyzer] Support for naive cross translational unit analysis

2017-12-13 Thread George Karpenkov via Phabricator via cfe-commits
george.karpenkov requested changes to this revision.
george.karpenkov added a comment.
This revision now requires changes to proceed.

I've tried using the patch, and I got blocked at the following: CTU options are 
only exposed when one goes through `analyze-build` frontend, which requires 
`compile_commands.json` to be present. I've used `libear` to generate 
`compile_commands.json`, but the generated JSON does not contain the `command` 
field, which causes `@require` before `run` to die (also, due to the passing 
style this error was unnecessarily difficult to debug).
So could you write a short documentation somewhere how all pieces fit together? 
What entry point should be used, what should people do who don't have a build 
system-generated `compile_commands.json`etc. etc.


https://reviews.llvm.org/D30691



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


[PATCH] D40809: [WIP] [analyzer] Dump counterexample traces as C programs

2017-12-13 Thread Devin Coughlin via Phabricator via cfe-commits
dcoughlin added a comment.

This is seems like a very useful visualization, *especially* for loops. Can we 
this patch get it into a state where it can be committed and used for debugging 
purposes?

One possibility is to turn this into a debug checker similar to 
debug.ViewExplodedGraph. That checker registers for a checkEndAnalysis() 
callback and traverses the node graph (see DebugCheckers.cpp). Can you do the 
same here? It doesn't look like you really need this to be a BugReporterVisitor 
-- and making it a debug checker would avoid outputting multiple copies for 
each diagnostic consumer.

You could also control file output with an analyzer-config option that takes an 
optional path.


https://reviews.llvm.org/D40809



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


[PATCH] D41189: [Frontend] Treat function with skipped body as definition

2017-12-13 Thread Serge Pavlov via Phabricator via cfe-commits
sepavloff accepted this revision.
sepavloff added a comment.
This revision is now accepted and ready to land.

LGTM.

Thanks!


Repository:
  rC Clang

https://reviews.llvm.org/D41189



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


[PATCH] D41050: Fix over-release of return value of lambda implicitly converted to block/function pointer

2017-12-13 Thread Dan Zimmerman via Phabricator via cfe-commits
danzimm updated this revision to Diff 126893.
danzimm added a comment.

Remove unnecessary checks from tests (sorry for unbatched updates)


Repository:
  rC Clang

https://reviews.llvm.org/D41050

Files:
  lib/CodeGen/CGClass.cpp
  test/CodeGenObjCXX/arc-forwarded-lambda-call.mm


Index: test/CodeGenObjCXX/arc-forwarded-lambda-call.mm
===
--- /dev/null
+++ test/CodeGenObjCXX/arc-forwarded-lambda-call.mm
@@ -0,0 +1,23 @@
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.12.0 -emit-llvm 
-disable-llvm-passes -O3 -fblocks -fobjc-arc -fobjc-runtime-has-weak -std=c++11 
-o - %s | FileCheck %s
+
+void test0(id x) {
+  extern void test0_helper(id (^)(void));
+  test0_helper([=]() { return x; });
+  // CHECK-LABEL: define internal i8* @___Z5test0P11objc_object_block_invoke
+  // CHECK: [[T0:%.*]] = call i8* @"_ZZ5test0P11objc_objectENK3$_0clEv"
+  // CHECK-NEXT: [[T1:%.*]] = call i8* @objc_retainAutoreleasedReturnValue(i8* 
[[T0]])
+  // CHECK-NEXT: [[T2:%.*]] = tail call i8* @objc_autoreleaseReturnValue(i8* 
[[T1]])
+  // CHECK-NEXT: ret i8* [[T2]]
+}
+
+id test1_rv;
+
+void test1() {
+  extern void test1_helper(id (*)(void));
+  test1_helper([](){ return test1_rv; });
+  // CHECK-LABEL: define internal i8* @"_ZZ5test1vEN3$_18__invokeEv"
+  // CHECK: [[T0:%.*]] = call i8* @"_ZZ5test1vENK3$_1clEv"
+  // CHECK-NEXT: [[T1:%.*]] = call i8* @objc_retainAutoreleasedReturnValue(i8* 
[[T0]])
+  // CHECK-NEXT: [[T2:%.*]] = tail call i8* @objc_autoreleaseReturnValue(i8* 
[[T1]])
+  // CHECK-NEXT: ret i8* [[T2]]
+}
Index: lib/CodeGen/CGClass.cpp
===
--- lib/CodeGen/CGClass.cpp
+++ lib/CodeGen/CGClass.cpp
@@ -2776,9 +2776,12 @@
   RValue RV = EmitCall(calleeFnInfo, callee, returnSlot, callArgs);
 
   // If necessary, copy the returned value into the slot.
-  if (!resultType->isVoidType() && returnSlot.isNull())
+  if (!resultType->isVoidType() && returnSlot.isNull()) {
+if (getLangOpts().ObjCAutoRefCount && resultType->isObjCRetainableType()) {
+  RV = 
RValue::get(EmitARCRetainAutoreleasedReturnValue(RV.getScalarVal()));
+}
 EmitReturnOfRValue(RV, resultType);
-  else
+  } else
 EmitBranchThroughCleanup(ReturnBlock);
 }
 


Index: test/CodeGenObjCXX/arc-forwarded-lambda-call.mm
===
--- /dev/null
+++ test/CodeGenObjCXX/arc-forwarded-lambda-call.mm
@@ -0,0 +1,23 @@
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.12.0 -emit-llvm -disable-llvm-passes -O3 -fblocks -fobjc-arc -fobjc-runtime-has-weak -std=c++11 -o - %s | FileCheck %s
+
+void test0(id x) {
+  extern void test0_helper(id (^)(void));
+  test0_helper([=]() { return x; });
+  // CHECK-LABEL: define internal i8* @___Z5test0P11objc_object_block_invoke
+  // CHECK: [[T0:%.*]] = call i8* @"_ZZ5test0P11objc_objectENK3$_0clEv"
+  // CHECK-NEXT: [[T1:%.*]] = call i8* @objc_retainAutoreleasedReturnValue(i8* [[T0]])
+  // CHECK-NEXT: [[T2:%.*]] = tail call i8* @objc_autoreleaseReturnValue(i8* [[T1]])
+  // CHECK-NEXT: ret i8* [[T2]]
+}
+
+id test1_rv;
+
+void test1() {
+  extern void test1_helper(id (*)(void));
+  test1_helper([](){ return test1_rv; });
+  // CHECK-LABEL: define internal i8* @"_ZZ5test1vEN3$_18__invokeEv"
+  // CHECK: [[T0:%.*]] = call i8* @"_ZZ5test1vENK3$_1clEv"
+  // CHECK-NEXT: [[T1:%.*]] = call i8* @objc_retainAutoreleasedReturnValue(i8* [[T0]])
+  // CHECK-NEXT: [[T2:%.*]] = tail call i8* @objc_autoreleaseReturnValue(i8* [[T1]])
+  // CHECK-NEXT: ret i8* [[T2]]
+}
Index: lib/CodeGen/CGClass.cpp
===
--- lib/CodeGen/CGClass.cpp
+++ lib/CodeGen/CGClass.cpp
@@ -2776,9 +2776,12 @@
   RValue RV = EmitCall(calleeFnInfo, callee, returnSlot, callArgs);
 
   // If necessary, copy the returned value into the slot.
-  if (!resultType->isVoidType() && returnSlot.isNull())
+  if (!resultType->isVoidType() && returnSlot.isNull()) {
+if (getLangOpts().ObjCAutoRefCount && resultType->isObjCRetainableType()) {
+  RV = RValue::get(EmitARCRetainAutoreleasedReturnValue(RV.getScalarVal()));
+}
 EmitReturnOfRValue(RV, resultType);
-  else
+  } else
 EmitBranchThroughCleanup(ReturnBlock);
 }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D41050: Fix over-release of return value of lambda implicitly converted to block/function pointer

2017-12-13 Thread Dan Zimmerman via Phabricator via cfe-commits
danzimm updated this revision to Diff 126892.
danzimm added a comment.

Pass -disable-llvm-passes with -O3 so that we can test that the IR we generate 
actually is generated


Repository:
  rC Clang

https://reviews.llvm.org/D41050

Files:
  lib/CodeGen/CGClass.cpp
  test/CodeGenObjCXX/arc-forwarded-lambda-call.mm


Index: test/CodeGenObjCXX/arc-forwarded-lambda-call.mm
===
--- /dev/null
+++ test/CodeGenObjCXX/arc-forwarded-lambda-call.mm
@@ -0,0 +1,23 @@
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.12.0 -emit-llvm 
-disable-llvm-passes -O3 -fblocks -fobjc-arc -fobjc-runtime-has-weak -std=c++11 
-o - %s | FileCheck %s
+
+void test0(id x) {
+  extern void test0_helper(id (^)(void));
+  test0_helper([=]() { return x; });
+  // CHECK-LABEL: define internal i8* @___Z5test0P11objc_object_block_invoke
+  // CHECK: [[T0:%.*]] = call i8* 
@"_ZZ5test0P11objc_objectENK3$_0clEv"({{%.*}}* {{%.*}})
+  // CHECK-NEXT: [[T1:%.*]] = call i8* @objc_retainAutoreleasedReturnValue(i8* 
[[T0]]) [[A0:#[0-9]+]]
+  // CHECK-NEXT: [[T2:%.*]] = tail call i8* @objc_autoreleaseReturnValue(i8* 
[[T1]]) [[A0]]
+  // CHECK-NEXT: ret i8* [[T2]]
+}
+
+id test1_rv;
+
+void test1() {
+  extern void test1_helper(id (*)(void));
+  test1_helper([](){ return test1_rv; });
+  // CHECK-LABEL: define internal i8* @"_ZZ5test1vEN3$_18__invokeEv"
+  // CHECK: [[T0:%.*]] = call i8* @"_ZZ5test1vENK3$_1clEv"({{%.*}}* undef)
+  // CHECK-NEXT: [[T1:%.*]] = call i8* @objc_retainAutoreleasedReturnValue(i8* 
[[T0]]) [[A0]]
+  // CHECK-NEXT: [[T2:%.*]] = tail call i8* @objc_autoreleaseReturnValue(i8* 
[[T1]]) [[A0]]
+  // CHECK-NEXT: ret i8* [[T2]]
+}
Index: lib/CodeGen/CGClass.cpp
===
--- lib/CodeGen/CGClass.cpp
+++ lib/CodeGen/CGClass.cpp
@@ -2776,9 +2776,12 @@
   RValue RV = EmitCall(calleeFnInfo, callee, returnSlot, callArgs);
 
   // If necessary, copy the returned value into the slot.
-  if (!resultType->isVoidType() && returnSlot.isNull())
+  if (!resultType->isVoidType() && returnSlot.isNull()) {
+if (getLangOpts().ObjCAutoRefCount && resultType->isObjCRetainableType()) {
+  RV = 
RValue::get(EmitARCRetainAutoreleasedReturnValue(RV.getScalarVal()));
+}
 EmitReturnOfRValue(RV, resultType);
-  else
+  } else
 EmitBranchThroughCleanup(ReturnBlock);
 }
 


Index: test/CodeGenObjCXX/arc-forwarded-lambda-call.mm
===
--- /dev/null
+++ test/CodeGenObjCXX/arc-forwarded-lambda-call.mm
@@ -0,0 +1,23 @@
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.12.0 -emit-llvm -disable-llvm-passes -O3 -fblocks -fobjc-arc -fobjc-runtime-has-weak -std=c++11 -o - %s | FileCheck %s
+
+void test0(id x) {
+  extern void test0_helper(id (^)(void));
+  test0_helper([=]() { return x; });
+  // CHECK-LABEL: define internal i8* @___Z5test0P11objc_object_block_invoke
+  // CHECK: [[T0:%.*]] = call i8* @"_ZZ5test0P11objc_objectENK3$_0clEv"({{%.*}}* {{%.*}})
+  // CHECK-NEXT: [[T1:%.*]] = call i8* @objc_retainAutoreleasedReturnValue(i8* [[T0]]) [[A0:#[0-9]+]]
+  // CHECK-NEXT: [[T2:%.*]] = tail call i8* @objc_autoreleaseReturnValue(i8* [[T1]]) [[A0]]
+  // CHECK-NEXT: ret i8* [[T2]]
+}
+
+id test1_rv;
+
+void test1() {
+  extern void test1_helper(id (*)(void));
+  test1_helper([](){ return test1_rv; });
+  // CHECK-LABEL: define internal i8* @"_ZZ5test1vEN3$_18__invokeEv"
+  // CHECK: [[T0:%.*]] = call i8* @"_ZZ5test1vENK3$_1clEv"({{%.*}}* undef)
+  // CHECK-NEXT: [[T1:%.*]] = call i8* @objc_retainAutoreleasedReturnValue(i8* [[T0]]) [[A0]]
+  // CHECK-NEXT: [[T2:%.*]] = tail call i8* @objc_autoreleaseReturnValue(i8* [[T1]]) [[A0]]
+  // CHECK-NEXT: ret i8* [[T2]]
+}
Index: lib/CodeGen/CGClass.cpp
===
--- lib/CodeGen/CGClass.cpp
+++ lib/CodeGen/CGClass.cpp
@@ -2776,9 +2776,12 @@
   RValue RV = EmitCall(calleeFnInfo, callee, returnSlot, callArgs);
 
   // If necessary, copy the returned value into the slot.
-  if (!resultType->isVoidType() && returnSlot.isNull())
+  if (!resultType->isVoidType() && returnSlot.isNull()) {
+if (getLangOpts().ObjCAutoRefCount && resultType->isObjCRetainableType()) {
+  RV = RValue::get(EmitARCRetainAutoreleasedReturnValue(RV.getScalarVal()));
+}
 EmitReturnOfRValue(RV, resultType);
-  else
+  } else
 EmitBranchThroughCleanup(ReturnBlock);
 }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D41050: Fix over-release of return value of lambda implicitly converted to block/function pointer

2017-12-13 Thread Dan Zimmerman via Phabricator via cfe-commits
danzimm added a comment.

I just dug into how the ARC optimization pass is invoked... it really shouldn't 
be invoked if `-disable-llvm-passes` is passed (or `-disable-llvm-optzns` which 
appears to just alias the first). Can you verify that my command is sane:

  /Users/danzimm/oss/build/bin/clang -cc1 -internal-isystem 
/Users/danzimm/oss/build/lib/clang/6.0.0/include -nostdsysteminc -triple 
x86_64-apple-macosx10.12.0 -disable-llvm-passes -emit-llvm -fblocks -fobjc-arc 
-std=c++11 -O0 -o - 
/Users/danzimm/oss/llvm/tools/clang/test/CodeGenObjCXX/arc-forwarded-lambda-call.mm


Repository:
  rC Clang

https://reviews.llvm.org/D41050



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


[PATCH] D33776: [libcxx] LWG2221: No formatted output operator for nullptr

2017-12-13 Thread Zhihao Yuan via Phabricator via cfe-commits
lichray added inline comments.



Comment at: include/ostream:225
+basic_ostream& operator<<(nullptr_t)
+{ return *this << (const void*)0; }
+

K-ballo wrote:
> Quuxplusone wrote:
> > mclow.lists wrote:
> > > lichray wrote:
> > > > Oh, common, I persuaded the committee to allow you to print a `(null)`  
> > > > and you don't do it...
> > > I think that `(null)` is a better thing to output here than `0x0`.
> > Are you two implying that
> > 
> > *this << (const void *)0;
> > 
> > does *not* print `(null)`? It certainly should, IMO. (I mean, it'll call 
> > `num_put` for `void*` in the current locale, but I would naturally expect 
> > that to print `(null)`.)
> > Anyway, whether the current locale prints null as `(null)` or not, there is 
> > great potential utility in using the same format for all pointers, as 
> > K-ballo is doing here. I'd really like to be able to
> > 
> > std::ostringstream oss;
> > oss << nullptr;  // equivalently: oss << (void*)0;
> > void *p;
> > std::istringstream(oss.str()) >> p;  // should read in a null pointer, 
> > not derp out
> > 
> > FWIW, it looks like libc++ currently *does* print null pointers as `(nil)`, 
> > which is not quite the same thing as `(null)`. libstdc++ prints them as `0`.
> > https://wandbox.org/permlink/yAM6tjMzvEX9HhhE
> It's been a while now, but I seem to recall that the reason we settled on 
> `(*this) << (const void*)0` was precisely so that it would go through 
> `num_put`, as the rest of the pointers do. As I read back on the 
> specification, however, I am no longer sure that such an implementation is 
> conforming. Maybe if we were to call the facet directly...
> 
> I am no longer interested in this issue. If anyone wants to take over control 
> I would be happy to yield it; otherwise, I'll implement whatever I'm 
> instructed to.
Your test code prints 0x0 0x0 on FreeBSD though.
If reliable round-tripping is the goal, maybe we can enforce printing `(nil)`?  
fmtlib does this as well:

https://github.com/fmtlib/fmt/commit/b5fda1c90d94aeaf96081477c9bfe13789c00e03


https://reviews.llvm.org/D33776



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


[PATCH] D41217: [Concepts] Concept Specialization Expressions

2017-12-13 Thread Saar Raz via Phabricator via cfe-commits
saar.raz created this revision.
saar.raz added reviewers: changyu, rsmith, hubert.reinterpretcast, nwilson.
Herald added a subscriber: cfe-commits.

Part of the P0734r0 Concepts implementation effort. Added Concept 
Specialization Expressions and tests thereof. Also added constraint expression 
type verification. This diff depends on https://reviews.llvm.org/D40381.


Repository:
  rC Clang

https://reviews.llvm.org/D41217

Files:
  include/clang/AST/DeclTemplate.h
  include/clang/AST/ExprCXX.h
  include/clang/AST/RecursiveASTVisitor.h
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/Basic/StmtNodes.td
  include/clang/Sema/Sema.h
  include/clang/Serialization/ASTBitCodes.h
  lib/AST/Expr.cpp
  lib/AST/ExprCXX.cpp
  lib/AST/ExprClassification.cpp
  lib/AST/ExprConstant.cpp
  lib/AST/ItaniumMangle.cpp
  lib/AST/StmtPrinter.cpp
  lib/AST/StmtProfile.cpp
  lib/CodeGen/CGExprScalar.cpp
  lib/Parse/ParseExpr.cpp
  lib/Parse/ParseTemplate.cpp
  lib/Sema/SemaExceptionSpec.cpp
  lib/Sema/SemaExprCXX.cpp
  lib/Sema/SemaTemplate.cpp
  lib/Sema/TreeTransform.h
  lib/Serialization/ASTReaderStmt.cpp
  lib/Serialization/ASTWriterStmt.cpp
  lib/StaticAnalyzer/Core/ExprEngine.cpp
  test/CXX/concepts-ts/expr/expr.prim/expr.prim.id/p3.cpp
  test/Parser/cxx-concept-declaration.cpp
  tools/libclang/CXCursor.cpp

Index: tools/libclang/CXCursor.cpp
===
--- tools/libclang/CXCursor.cpp
+++ tools/libclang/CXCursor.cpp
@@ -231,6 +231,7 @@
   case Stmt::TypeTraitExprClass:
   case Stmt::CoroutineBodyStmtClass:
   case Stmt::CoawaitExprClass:
+  case Stmt::ConceptSpecializationExprClass:
   case Stmt::DependentCoawaitExprClass:
   case Stmt::CoreturnStmtClass:
   case Stmt::CoyieldExprClass:
Index: test/Parser/cxx-concept-declaration.cpp
===
--- test/Parser/cxx-concept-declaration.cpp
+++ test/Parser/cxx-concept-declaration.cpp
@@ -9,8 +9,6 @@
 
 template concept D1 = true; // expected-error {{expected template parameter}}
 
-template concept C2 = 0.f; // expected-error {{constraint expression must be 'bool'}}
-
 struct S1 {
   template concept C1 = true; // expected-error {{concept declarations may only appear in global or namespace scope}}
 };
@@ -29,3 +27,12 @@
 
 // TODO: Add test to prevent explicit specialization, partial specialization
 // and explicit instantiation of concepts.
+
+template concept C7 = 2; // expected-error {{atomic constraint '2' must be of type 'bool' (found 'int')}}
+template concept C8 = 2 && x; // expected-error {{atomic constraint '2' must be of type 'bool' (found 'int')}}
+template concept C9 = x || 2 || x; // expected-error {{atomic constraint '2' must be of type 'bool' (found 'int')}}
+template concept C10 = 8ull && x || x; // expected-error {{atomic constraint '8ULL' must be of type 'bool' (found 'unsigned long long')}}
+template concept C11 = sizeof(T); // expected-error {{atomic constraint 'sizeof(T)' must be of type 'bool' (found 'unsigned long')}}
+template concept C12 = T{};
+template concept C13 = (bool&&)true;
+template concept C14 = (const bool&)true;
Index: test/CXX/concepts-ts/expr/expr.prim/expr.prim.id/p3.cpp
===
--- test/CXX/concepts-ts/expr/expr.prim/expr.prim.id/p3.cpp
+++ test/CXX/concepts-ts/expr/expr.prim/expr.prim.id/p3.cpp
@@ -1,5 +1,52 @@
 // RUN:  %clang_cc1 -std=c++2a -fconcepts-ts -verify %s
-// expected-no-diagnostics
 
-template concept C = true;
-static_assert(C);
+template concept C1 = true;
+static_assert(C1);
+
+template concept C2 = sizeof(T) == 4;
+static_assert(C2);
+static_assert(!C2);
+static_assert(C2);
+static_assert(!C2);
+
+template concept C3 = sizeof(*T{}) == 4;
+static_assert(C3);
+static_assert(!C3);
+
+struct A {
+static constexpr int add(int a, int b) {
+return a + b;
+}
+};
+struct B {
+static int add(int a, int b) {
+return a + b;
+}
+};
+template
+concept C4 = U::add(1, 2) == 3;
+static_assert(C4);
+static_assert(!C4); // expected-error {{concept specialization 'C4' resulted in a non-constant expression 'B::add(1, 2) == 3'}}
+
+template
+constexpr bool is_same_v = false;
+
+template
+constexpr bool is_same_v = true;
+
+template
+concept Same = is_same_v;
+
+static_assert(Same);
+static_assert(Same);
+static_assert(!Same);
+static_assert(!Same);
+static_assert(Same);
+
+static_assert(Same);
+static_assert(Same);
+static_assert(Same)>);
+static_assert(Same);
+
+template concept C5 = T{}; // expected-error {{atomic constraint 'int{}' must be of type 'bool' (found 'int')}}
+constexpr bool x = C5; // expected-note {{in concept specialization 'C5'}}
Index: lib/StaticAnalyzer/Core/ExprEngine.cpp

[PATCH] D41050: Fix over-release of return value of lambda implicitly converted to block/function pointer

2017-12-13 Thread Dan Zimmerman via Phabricator via cfe-commits
danzimm added a comment.

In https://reviews.llvm.org/D41050#954668, @rjmccall wrote:

> In https://reviews.llvm.org/D41050#953917, @danzimm wrote:
>
> > Change tests to use non-O2 generated IR. It looks like the combined 
> > objc_retainAutoreleasedReturnValue/objc_autoreleaseReturnValue calls 
> > annihilate each other and we just get a call/ret.
>
>
> Is that really happening at -O0?  Maybe you need to add -disable-llvm-optzns 
> to the test line if so.


Unfortunately it looks like adding `-disable-llvm-optzns` and/or 
`-disable-llvm-passes` (I also manually added `-O0` since I don't know what 
clang defaults to) doesn't generate the explicit call to 
`objc_retainAutoreleasedReturnValue`. Should we add a flag to disable that 
merging?


Repository:
  rC Clang

https://reviews.llvm.org/D41050



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


Buildbot numbers for the last week of 12/3/2017 - 12/9/2017

2017-12-13 Thread Galina Kistanova via cfe-commits
Hello everyone,

Below are some buildbot numbers for the last week of 12/3/2017 - 12/9/2017.

Please see the same data in attached csv files:

The longest time each builder was red during the week;
"Status change ratio" by active builder (percent of builds that changed the
builder status from greed to red or from red to green);
Count of commits by project;
Number of completed builds, failed builds and average build time for
successful builds per active builder;
Average waiting time for a revision to get build result per active builder
(response time).

Thanks

Galina


The longest time each builder was red during the week:

  buildername  | was_red
---+-
 clang-s390x-linux-multistage  | 77:40:28
 perf-x86_64-penryn-O3-polly-unprofitable  | 58:02:48
 clang-with-thin-lto-windows   | 57:19:47
 clang-x86_64-linux-selfhost-modules-2 | 56:49:12
 clang-x86_64-linux-selfhost-modules   | 56:06:27
 clang-cmake-armv7-a15-full| 33:41:50
 clang-cmake-aarch64-full  | 33:34:05
 clang-cmake-thumbv7-a15-full-sh   | 32:48:17
 clang-x64-ninja-win7  | 31:58:43
 clang-s390x-linux-lnt | 29:33:04
 clang-s390x-linux | 28:24:40
 sanitizer-x86_64-linux-bootstrap-ubsan| 28:11:01
 clang-ppc64be-linux-multistage| 28:07:20
 sanitizer-x86_64-linux-fast   | 27:37:22
 clang-ppc64le-linux   | 27:21:16
 clang-ppc64be-linux   | 27:14:47
 sanitizer-x86_64-linux-bootstrap-msan | 27:12:49
 clang-ppc64le-linux-multistage| 27:12:01
 sanitizer-x86_64-linux-bootstrap  | 27:07:12
 clang-ppc64le-linux-lnt   | 27:02:06
 clang-ppc64be-linux-lnt   | 26:30:54
 openmp-clang-x86_64-linux-debian  | 26:08:14
 clang-x86_64-debian-fast  | 25:41:36
 lld-x86_64-win7   | 22:48:43
 clang-with-lto-ubuntu | 22:45:24
 clang-cmake-aarch64-lld   | 22:08:52
 clang-with-thin-lto-ubuntu| 21:55:03
 clang-cmake-armv7-a15-selfhost-neon   | 21:54:05
 llvm-clang-x86_64-expensive-checks-win| 21:53:32
 clang-lld-x86_64-2stage   | 21:35:04
 clang-cmake-x86_64-avx2-linux | 21:31:56
 clang-cmake-x86_64-avx2-linux-perf| 21:31:31
 clang-cmake-armv7-a15-selfhost| 21:25:25
 sanitizer-x86_64-linux-fuzzer | 21:22:02
 perf-x86_64-penryn-O3-polly-parallel-fast | 20:53:31
 clang-cmake-x86_64-sde-avx512-linux   | 20:50:15
 sanitizer-windows | 19:57:59
 sanitizer-ppc64le-linux   | 17:03:04
 polly-amd64-linux | 16:23:42
 sanitizer-ppc64be-linux   | 16:20:58
 sanitizer-x86_64-linux| 16:06:23
 libcxx-libcxxabi-libunwind-aarch64-linux-noexceptions | 15:49:16
 polly-arm-linux   | 15:29:28
 clang-cmake-aarch64-quick | 14:25:05
 clang-cmake-thumbv7-a15   | 14:23:17
 clang-cmake-armv7-a15 | 14:21:20
 clang-cmake-aarch64-global-isel   | 14:17:21
 clang-bpf-build   | 12:33:12
 sanitizer-x86_64-linux-android| 10:37:46
 lld-x86_64-darwin13   | 05:54:54
 libcxx-libcxxabi-x86_64-linux-debian-noexceptions | 05:26:25
 reverse-iteration | 05:14:53
 clang-cuda-build  | 04:47:30
 clang-atom-d525-fedora-rel| 04:22:35
 lldb-windows7-android | 04:15:37
 ubuntu-gcc7.1-werror  | 03:57:16
 libcxx-libcxxabi-x86_64-linux-debian  | 03:53:19
 lldb-amd64-ninja-netbsd8  | 03:10:33
 llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast| 02:53:35
 lldb-x86_64-ubuntu-14.04-buildserver  | 02:41:53
 lldb-x86_64-ubuntu-14.04-cmake| 02:31:01
 lld-x86_64-freebsd| 02:17:59
 lldb-x86-windows-msvc2015 | 02:17:19
 llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast  | 01:57:35
 

Buildbot numbers for the week of 11/26/2017 - 12/02/2017

2017-12-13 Thread Galina Kistanova via cfe-commits
Hello everyone,

Below are some buildbot numbers for the week of 11/26/2017 - 12/02/2017.

Please see the same data in attached csv files:

The longest time each builder was red during the week;
"Status change ratio" by active builder (percent of builds that changed the
builder status from greed to red or from red to green);
Count of commits by project;
Number of completed builds, failed builds and average build time for
successful builds per active builder;
Average waiting time for a revision to get build result per active builder
(response time).

Thanks

Galina


The longest time each builder was red during the week:

buildername| was_red
---+-
 clang-cuda-build  | 61:24:16
 libcxx-libcxxabi-x86_64-linux-debian-noexceptions | 41:12:57
 lldb-windows7-android | 32:43:26
 clang-x64-ninja-win7  | 32:06:36
 clang-ppc64be-linux-lnt   | 31:39:03
 clang-ppc64be-linux-multistage| 29:13:55
 clang-ppc64be-linux   | 28:11:58
 clang-with-lto-ubuntu | 28:09:40
 sanitizer-ppc64be-linux   | 27:56:11
 ubuntu-gcc7.1-werror  | 27:07:44
 polly-amd64-linux | 25:26:36
 clang-s390x-linux-multistage  | 23:13:18
 polly-arm-linux   | 21:41:21
 clang-cmake-aarch64-lld   | 20:42:04
 clang-with-thin-lto-ubuntu| 19:25:29
 clang-ppc64le-linux-multistage| 14:20:48
 clang-x86_64-linux-abi-test   | 14:06:45
 clang-s390x-linux | 13:42:18
 sanitizer-x86_64-linux-autoconf   | 13:04:48
 openmp-clang-x86_64-linux-debian  | 12:37:31
 openmp-ompt-clang-x86_64-linux-debian | 12:01:16
 clang-cmake-aarch64-global-isel   | 12:01:07
 openmp-gcc-x86_64-linux-debian| 11:49:14
 sanitizer-x86_64-linux| 11:47:20
 clang-cmake-thumbv7-a15-full-sh   | 10:30:29
 sanitizer-x86_64-linux-android| 10:22:47
 sanitizer-x86_64-linux-bootstrap-msan | 10:20:06
 sanitizer-x86_64-linux-bootstrap-ubsan| 10:18:54
 llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast  | 10:09:31
 clang-lld-x86_64-2stage   | 10:00:13
 clang-atom-d525-fedora-rel| 09:35:18
 clang-cmake-aarch64-full  | 08:34:44
 sanitizer-x86_64-linux-fast   | 08:26:45
 llvm-mips-linux   | 07:56:36
 llvm-clang-x86_64-expensive-checks-win| 07:40:39
 sanitizer-x86_64-linux-bootstrap  | 07:16:52
 llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast| 05:29:37
 clang-cmake-x86_64-avx2-linux-perf| 05:20:59
 clang-cmake-x86_64-avx2-linux | 05:19:55
 clang-ppc64le-linux-lnt   | 05:11:45
 clang-cmake-thumbv7-a15   | 05:10:56
 clang-cmake-x86_64-sde-avx512-linux   | 05:04:39
 clang-cmake-aarch64-quick | 04:53:17
 lld-x86_64-win7   | 04:38:20
 clang-native-arm-lnt  | 04:31:43
 clang-s390x-linux-lnt | 04:05:59
 lldb-x86_64-ubuntu-14.04-buildserver  | 04:01:22
 clang-ppc64le-linux   | 04:00:17
 clang-x86_64-linux-selfhost-modules-2 | 03:56:22
 lldb-amd64-ninja-netbsd8  | 03:45:47
 perf-x86_64-penryn-O3-polly-unprofitable  | 03:34:31
 libcxx-libcxxabi-libunwind-arm-linux-noexceptions | 03:26:24
 libcxx-libcxxabi-libunwind-arm-linux  | 03:25:48
 lld-x86_64-darwin13   | 03:24:02
 clang-x86-windows-msvc2015| 02:47:15
 clang-cmake-armv7-a15-full| 02:36:06
 clang-cmake-armv7-a15 | 02:35:01
 libcxx-libcxxabi-x86_64-linux-ubuntu-cxx14| 01:57:19
 libcxx-libcxxabi-x86_64-linux-ubuntu-cxx11| 01:56:45
 clang-x86_64-linux-selfhost-modules   | 01:47:50
 lldb-x86_64-ubuntu-14.04-android  | 01:38:09
 clang-with-thin-lto-windows   | 01:37:00
 reverse-iteration | 01:30:16
 clang-hexagon-elf | 01:26:50
 clang-x86_64-debian-fast  | 01:26:02
 lldb-x86_64-darwin-13.4   | 01:25:19
 lldb-x86-windows-msvc2015 | 01:16:03
 perf-x86_64-penryn-O3-polly-parallel-fast | 01:08:41
 

[PATCH] D41213: [libcxx] [test] Improve MSVC portability.

2017-12-13 Thread Stephan T. Lavavej via Phabricator via cfe-commits
STL_MSFT created this revision.
STL_MSFT added reviewers: EricWF, mclow.lists.
Herald added a subscriber: jfb.

[libcxx] [test] Improve MSVC portability.

test/support/msvc_stdlib_force_include.hpp
When testing MSVC's STL with C1XX, simulate a couple more compiler feature-test 
macros.

When testing MSVC's STL, simulate a few library feature-test macros.

test/std/atomics/atomics.lockfree/isalwayslockfree.pass.cpp
The vector_size attribute is a non-Standard extension that's supported by Clang 
and GCC,
but not C1XX. Therefore, guard this with `__has_attribute(vector_size)`.

Additionally, while these tests pass when MSVC's STL is compiled with Clang,
I don't consider this to be a supported scenario for our library,
so also guard this with defined(_LIBCPP_VERSION).

test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp
N4713 23.14.10 [func.not_fn]/1 depicts only `call_wrapper(call_wrapper&&) = 
default;`
and `call_wrapper(const call_wrapper&) = default;`. According to
15.8.2 [class.copy.assign]/2 and /4, this makes call_wrapper non-assignable.
Therefore, guard the assignability tests as libc++ specific.

Add a (void) cast to tolerate not_fn() being marked as nodiscard.


https://reviews.llvm.org/D41213

Files:
  test/std/atomics/atomics.lockfree/isalwayslockfree.pass.cpp
  test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp
  test/support/msvc_stdlib_force_include.hpp

Index: test/support/msvc_stdlib_force_include.hpp
===
--- test/support/msvc_stdlib_force_include.hpp
+++ test/support/msvc_stdlib_force_include.hpp
@@ -52,6 +52,13 @@
 #define _MSVC_HAS_FEATURE_memory_sanitizer  0
 #define _MSVC_HAS_FEATURE_thread_sanitizer  0
 
+#define __has_attribute(X) _MSVC_HAS_ATTRIBUTE_ ## X
+#define _MSVC_HAS_ATTRIBUTE_vector_size 0
+
+#ifdef _NOEXCEPT_TYPES_SUPPORTED
+#define __cpp_noexcept_function_type201510
+#endif // _NOEXCEPT_TYPES_SUPPORTED
+
 // Silence compiler warnings.
 #pragma warning(disable: 4180) // qualifier applied to function type has no meaning; ignored
 #pragma warning(disable: 4324) // structure was padded due to alignment specifier
@@ -85,4 +92,12 @@
 #define TEST_STD_VER 14
 #endif // _HAS_CXX17
 
+// Simulate library feature-test macros.
+#define __cpp_lib_invoke 201411
+#define __cpp_lib_void_t 201411
+
+#if _HAS_CXX17
+#define __cpp_lib_atomic_is_always_lock_free 201603
+#endif // _HAS_CXX17
+
 #endif // SUPPORT_MSVC_STDLIB_FORCE_INCLUDE_HPP
Index: test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp
===
--- test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp
+++ test/std/utilities/function.objects/func.not_fn/not_fn.pass.cpp
@@ -305,31 +305,35 @@
 using RetT = decltype(std::not_fn(value));
 static_assert(std::is_move_constructible::value, "");
 static_assert(std::is_copy_constructible::value, "");
-static_assert(std::is_move_assignable::value, "");
-static_assert(std::is_copy_assignable::value, "");
+LIBCPP_STATIC_ASSERT(std::is_move_assignable::value, "");
+LIBCPP_STATIC_ASSERT(std::is_copy_assignable::value, "");
 auto ret = std::not_fn(value);
 assert(ret() == false);
 auto ret2 = std::not_fn(value2);
 assert(ret2() == true);
+#if defined(_LIBCPP_VERSION)
 ret = ret2;
 assert(ret() == true);
 assert(ret2() == true);
+#endif // _LIBCPP_VERSION
 }
 {
 using T = MoveAssignableWrapper;
 T value(true);
 T value2(false);
 using RetT = decltype(std::not_fn(std::move(value)));
 static_assert(std::is_move_constructible::value, "");
 static_assert(!std::is_copy_constructible::value, "");
-static_assert(std::is_move_assignable::value, "");
+LIBCPP_STATIC_ASSERT(std::is_move_assignable::value, "");
 static_assert(!std::is_copy_assignable::value, "");
 auto ret = std::not_fn(std::move(value));
 assert(ret() == false);
 auto ret2 = std::not_fn(std::move(value2));
 assert(ret2() == true);
+#if defined(_LIBCPP_VERSION)
 ret = std::move(ret2);
 assert(ret() == true);
+#endif // _LIBCPP_VERSION
 }
 }
 
@@ -426,7 +430,7 @@
 {
 ThrowsOnCopy cp;
 try {
-std::not_fn(cp);
+(void)std::not_fn(cp);
 assert(false);
 } catch (int const& value) {
 assert(value == 42);
Index: test/std/atomics/atomics.lockfree/isalwayslockfree.pass.cpp
===
--- test/std/atomics/atomics.lockfree/isalwayslockfree.pass.cpp
+++ test/std/atomics/atomics.lockfree/isalwayslockfree.pass.cpp
@@ -89,6 +89,7 @@
 CHECK_ALWAYS_LOCK_FREE(float);
 CHECK_ALWAYS_LOCK_FREE(double);
 

[PATCH] D41148: [libcxx] implement declarations based on P0214R7.

2017-12-13 Thread Tim Shen via Phabricator via cfe-commits
timshen added inline comments.



Comment at: libcxx/include/experimental/simd:594
+
+#warning " is under construction and not for practical use 
for now."
+

EricWF wrote:
> I would just remove this. The `experimental` part of the name should say 
> enough.
> 
> Also we normally wait until an implementation is mostly complete before 
> landing it. 
> Also we normally wait until an implementation is mostly complete before 
> landing it.

What's the definition of "landing"? I prefer to implement this library in 
multiple patches, does that mean I keep working on the next ones and finally 
commit all of them all at once? If that's the case, SGTM.



Comment at: libcxx/test/std/experimental/simd/traits.pass.cpp:15
+// [simd.traits]
+// template  struct is_abi_tag;
+// template  inline constexpr bool is_abi_tag_v = 
is_abi_tag::value;

EricWF wrote:
> Please create a directory called `simd/traits/` and then put each trait in a 
> separate test file under that directory.
> The `foo_v` tests should be in the same file as the `foo` tests.
> 
> 
Thanks! Done for all tests. Used directory names like "simd.cons", 
"simd.traits", "simd.casts".


https://reviews.llvm.org/D41148



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


[PATCH] D41148: [libcxx] implement declarations based on P0214R7.

2017-12-13 Thread Tim Shen via Phabricator via cfe-commits
timshen updated this revision to Diff 126872.
timshen marked 7 inline comments as done.
timshen added a comment.

Address second round of comments.


https://reviews.llvm.org/D41148

Files:
  libcxx/include/experimental/__config
  libcxx/include/experimental/simd
  libcxx/test/std/experimental/simd/nothing_to_do.pass.cpp
  libcxx/test/std/experimental/simd/simd.casts/simd_cast.pass.cpp
  libcxx/test/std/experimental/simd/simd.casts/static_simd_cast.pass.cpp
  libcxx/test/std/experimental/simd/simd.cons/broadcast.pass.cpp
  libcxx/test/std/experimental/simd/simd.cons/geneartor.pass.cpp
  libcxx/test/std/experimental/simd/simd.traits/abi_for_size.pass.cpp
  libcxx/test/std/experimental/simd/simd.traits/is_abi_tag.pass.cpp
  libcxx/test/std/experimental/simd/simd.traits/is_simd.pass.cpp
  libcxx/test/std/experimental/simd/simd.traits/is_simd_flag_type.pass.cpp
  libcxx/test/std/experimental/simd/simd.traits/is_simd_mask.pass.cpp

Index: libcxx/test/std/experimental/simd/simd.traits/is_simd_mask.pass.cpp
===
--- /dev/null
+++ libcxx/test/std/experimental/simd/simd.traits/is_simd_mask.pass.cpp
@@ -0,0 +1,119 @@
+//===--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+
+// UNSUPPORTED: c++98, c++03
+
+// 
+//
+// [simd.traits]
+// template  struct is_simd_mask;
+// template  inline constexpr bool is_simd_mask_v = is_simd_mask::value;
+
+#include 
+#include 
+
+using namespace std::experimental::parallelism_v2;
+
+static_assert(is_simd_mask::value, "");
+static_assert(is_simd_mask::value, "");
+static_assert(is_simd_mask::value, "");
+static_assert(is_simd_mask::value, "");
+static_assert(is_simd_mask::value, "");
+static_assert(is_simd_mask::value, "");
+static_assert(is_simd_mask::value, "");
+static_assert(is_simd_mask::value, "");
+static_assert(is_simd_mask::value, "");
+static_assert(is_simd_mask::value, "");
+
+static_assert(is_simd_mask>::value, "");
+static_assert(is_simd_mask>::value, "");
+static_assert(is_simd_mask>::value, "");
+static_assert(is_simd_mask>::value, "");
+static_assert(is_simd_mask>::value, "");
+static_assert(is_simd_mask>::value, "");
+static_assert(is_simd_mask>::value, "");
+static_assert(is_simd_mask>::value, "");
+static_assert(is_simd_mask>::value, "");
+static_assert(is_simd_mask>::value, "");
+
+static_assert(is_simd_mask>::value, "");
+static_assert(is_simd_mask>::value, "");
+static_assert(is_simd_mask>::value, "");
+static_assert(is_simd_mask>::value, "");
+static_assert(is_simd_mask>::value, "");
+static_assert(is_simd_mask>::value, "");
+static_assert(is_simd_mask>::value, "");
+static_assert(is_simd_mask>::value, "");
+static_assert(is_simd_mask>::value, "");
+static_assert(is_simd_mask>::value, "");
+
+static_assert(is_simd_mask>::value, "");
+static_assert(is_simd_mask>::value, "");
+static_assert(is_simd_mask>::value, "");
+static_assert(is_simd_mask>::value, "");
+static_assert(is_simd_mask>::value, "");
+static_assert(is_simd_mask>::value, "");
+static_assert(is_simd_mask>::value, "");
+static_assert(is_simd_mask>::value, "");
+static_assert(is_simd_mask>::value, "");
+static_assert(is_simd_mask>::value, "");
+
+static_assert(!is_simd_mask::value, "");
+
+#if TEST_STD_VER > 14
+
+static_assert(is_simd_mask_v, "");
+static_assert(is_simd_mask_v, "");
+static_assert(is_simd_mask_v, "");
+static_assert(is_simd_mask_v, "");
+static_assert(is_simd_mask_v, "");

[PATCH] D41050: Fix over-release of return value of lambda implicitly converted to block/function pointer

2017-12-13 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment.

In https://reviews.llvm.org/D41050#953917, @danzimm wrote:

> Change tests to use non-O2 generated IR. It looks like the combined 
> objc_retainAutoreleasedReturnValue/objc_autoreleaseReturnValue calls 
> annihilate each other and we just get a call/ret.


Is that really happening at -O0?  Maybe you need to add -disable-llvm-optzns to 
the test line if so.


Repository:
  rC Clang

https://reviews.llvm.org/D41050



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


[PATCH] D40671: [clang-tidy] Support specific checks for NOLINT directive

2017-12-13 Thread Alexander Kornienko via Phabricator via cfe-commits
alexfh accepted this revision.
alexfh added a comment.

In https://reviews.llvm.org/D40671#949732, @xgsa wrote:

> In https://reviews.llvm.org/D40671#949687, @alexfh wrote:
>
> > How are unknown check names handled? More specifically: will the `// 
> > NOLINT(runtime/explicit)` comment disable all clang-tidy checks or none?
>
>
> None. If comment is syntactically correct and contains parenthesis, it works 
> only for the known checks inside.
>
> Still, I don't think it worth mentioning all the corner cases in 
> documentation to keep things simple.


Documenting interaction with cpplint-style NOLINT categories would potentially 
save time to the users and clang-tidy maintainers (at least for codebases using 
Google style and cpplint). Fine for a follow-up.

In https://reviews.llvm.org/D40671#953888, @aaron.ballman wrote:

> In https://reviews.llvm.org/D40671#953291, @xgsa wrote:
>
> > @aaron.ballman, sorry for my insistence, but it seems all the comments are 
> > fixed and the patch is ready for commit or am I missing something? Could 
> > you please commit it on my behalf, as I don't have rights to do that?
>
>
> The check now LGTM, but I am going to wait to commit in case @alexfh has 
> concerns regarding unknown check names.
>
> FWIW, I think we should do something about unknown check names in NOLINT 
> comments, but that can be done as a follow-up patch. If we're ignoring the 
> comment, we might want to diagnose that fact so users have an idea what's 
> going on.


IIUC, cpplint can output a diagnostic about unknown categories inside NOLINT 
and about NOLINT directives that happen on lines where no warning is emitted. 
Both would be useful in clang-tidy, IMO.


https://reviews.llvm.org/D40671



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


[PATCH] D41087: [Preprocessor] Implement __is_target_{arch|vendor|os|environment} function-like builtin macros

2017-12-13 Thread Steven Wu via Phabricator via cfe-commits
steven_wu accepted this revision.
steven_wu added a comment.

LGTM


https://reviews.llvm.org/D41087



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


[PATCH] D41087: [Preprocessor] Implement __is_target_{arch|vendor|os|environment} function-like builtin macros

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

- Use separate functions for checks.
- "ARM" should match "thumb" arch too.


https://reviews.llvm.org/D41087

Files:
  include/clang/Lex/Preprocessor.h
  lib/Lex/PPMacroExpansion.cpp
  test/Preprocessor/is_target.c
  test/Preprocessor/is_target_arm.c
  test/Preprocessor/is_target_os_darwin.c
  test/Preprocessor/is_target_unknown.c

Index: test/Preprocessor/is_target_unknown.c
===
--- /dev/null
+++ test/Preprocessor/is_target_unknown.c
@@ -0,0 +1,22 @@
+// RUN: %clang_cc1 -fsyntax-only -triple i686-unknown-unknown -verify %s
+// RUN: %clang_cc1 -fsyntax-only -triple i686-- -verify %s
+// expected-no-diagnostics
+
+#if __is_target_arch(unknown)
+  #error "mismatching arch"
+#endif
+
+// Unknown vendor is allowed.
+#if !__is_target_vendor(unknown)
+  #error "mismatching vendor"
+#endif
+
+// Unknown OS is allowed.
+#if !__is_target_os(unknown)
+  #error "mismatching OS"
+#endif
+
+// Unknown environment is allowed.
+#if !__is_target_environment(unknown)
+  #error "mismatching environment"
+#endif
Index: test/Preprocessor/is_target_os_darwin.c
===
--- /dev/null
+++ test/Preprocessor/is_target_os_darwin.c
@@ -0,0 +1,26 @@
+// RUN: %clang_cc1 -fsyntax-only -triple x86_64-apple-macos -DMAC -verify %s
+// RUN: %clang_cc1 -fsyntax-only -triple x86_64-apple-ios -verify %s
+// RUN: %clang_cc1 -fsyntax-only -triple x86_64-apple-tvos -verify %s
+// RUN: %clang_cc1 -fsyntax-only -triple x86_64-apple-watchos -verify %s
+// expected-no-diagnostics
+
+#if !__is_target_os(darwin)
+  #error "mismatching os"
+#endif
+
+// macOS matches both macOS and macOSX.
+#ifdef MAC
+
+#if !__is_target_os(macos)
+  #error "mismatching os"
+#endif
+
+#if !__is_target_os(macosx)
+  #error "mismatching os"
+#endif
+
+#if __is_target_os(ios)
+  #error "mismatching os"
+#endif
+
+#endif
Index: test/Preprocessor/is_target_arm.c
===
--- /dev/null
+++ test/Preprocessor/is_target_arm.c
@@ -0,0 +1,51 @@
+// RUN: %clang_cc1 -fsyntax-only -triple thumbv7--windows-msvc19.11.0 -verify %s
+// RUN: %clang_cc1 -fsyntax-only -triple armv7--windows-msvc19.11.0 -DARM -verify %s
+// expected-no-diagnostics
+
+// ARM does match arm and thumb.
+#if !__is_target_arch(arm)
+  #error "mismatching arch"
+#endif
+
+#if __is_target_arch(armeb) || __is_target_arch(armebv7) || __is_target_arch(thumbeb) || __is_target_arch(thumbebv7)
+  #error "mismatching arch"
+#endif
+
+// ARMV7 does match armv7 and thumbv7.
+#if !__is_target_arch(armv7)
+  #error "mismatching arch"
+#endif
+
+// ARMV6 does not match armv7 or thumbv7.
+#if __is_target_arch(armv6)
+  #error "mismatching arch"
+#endif
+
+#if __is_target_arch(arm64)
+  #error "mismatching arch"
+#endif
+
+#ifndef ARM
+
+// Allow checking for precise arch + subarch.
+#if !__is_target_arch(thumbv7)
+  #error "mismatching arch"
+#endif
+
+// But also allow checking for the arch without subarch.
+#if !__is_target_arch(thumb)
+  #error "mismatching arch"
+#endif
+
+// Same arch with a different subarch doesn't match.
+#if __is_target_arch(thumbv6)
+  #error "mismatching arch"
+#endif
+
+#else
+
+#if __is_target_arch(thumbv7) || __is_target_arch(thumb)
+  #error "mismatching arch"
+#endif
+
+#endif
Index: test/Preprocessor/is_target.c
===
--- /dev/null
+++ test/Preprocessor/is_target.c
@@ -0,0 +1,67 @@
+// RUN: %clang_cc1 -fsyntax-only -triple x86_64-apple-darwin-simulator -verify %s
+
+#if !__is_target_arch(x86_64) || !__is_target_arch(X86_64)
+  #error "mismatching arch"
+#endif
+
+#if __is_target_arch(arm64)
+  #error "mismatching arch"
+#endif
+
+// Silently ignore invalid archs. This will ensure that older compilers will
+// accept headers that support new arches/vendors/os variants.
+#if __is_target_arch(foo)
+  #error "invalid arch"
+#endif
+
+#if !__is_target_vendor(apple) || !__is_target_vendor(APPLE)
+  #error "mismatching vendor"
+#endif
+
+#if __is_target_vendor(unknown)
+  #error "mismatching vendor"
+#endif
+
+#if __is_target_vendor(foo)
+  #error "invalid vendor"
+#endif
+
+#if !__is_target_os(darwin) || !__is_target_os(DARWIN)
+  #error "mismatching os"
+#endif
+
+#if __is_target_os(ios)
+  #error "mismatching os"
+#endif
+
+#if __is_target_os(foo)
+  #error "invalid os"
+#endif
+
+#if !__is_target_environment(simulator) || !__is_target_environment(SIMULATOR)
+  #error "mismatching environment"
+#endif
+
+#if __is_target_environment(unknown)
+  #error "mismatching environment"
+#endif
+
+#if __is_target_environment(foo)
+  #error "invalid environment"
+#endif
+
+#if !__has_builtin(__is_target_arch) || !__has_builtin(__is_target_os) || !__has_builtin(__is_target_vendor) || !__has_builtin(__is_target_environment)
+  #error "has builtin doesn't 

[PATCH] D41149: [CodeGen] Specialize mixed-sign mul-with-overflow (fix PR34920)

2017-12-13 Thread Vedant Kumar via Phabricator via cfe-commits
vsk updated this revision to Diff 126854.
vsk marked an inline comment as done.
vsk edited the summary of this revision.
vsk added a comment.

- Handle unsigned result types.
- Extend the test driver to validate 54 different combinations of signed,  
unsigned, and result types: 
https://gist.github.com/vedantk/3eb9c88f82e5c32f2e590555b4af5081
- Don't try to specialize irgen for cases where the result type is wider than 
the operand type.


https://reviews.llvm.org/D41149

Files:
  lib/CodeGen/CGBuiltin.cpp
  test/CodeGen/builtins-overflow.c

Index: test/CodeGen/builtins-overflow.c
===
--- test/CodeGen/builtins-overflow.c
+++ test/CodeGen/builtins-overflow.c
@@ -338,3 +338,122 @@
 return LongLongErrorCode;
   return result;
 }
+
+int test_mixed_sign_mull_overflow(int x, unsigned y) {
+// CHECK: @test_mixed_sign_mull_overflow
+// CHECK:   [[IsNeg:%.*]] = icmp slt i32 [[Op1:%.*]], 0
+// CHECK-NEXT:  [[Signed:%.*]] = sub i32 0, [[Op1]]
+// CHECK-NEXT:  [[AbsSigned:%.*]] = select i1 [[IsNeg]], i32 [[Signed]], i32 [[Op1]]
+// CHECK-NEXT:  call { i32, i1 } @llvm.umul.with.overflow.i32(i32 [[AbsSigned]], i32 %{{.*}})
+// CHECK-NEXT:  [[UnsignedOFlow:%.*]] = extractvalue { i32, i1 } %{{.*}}, 1
+// CHECK-NEXT:  [[UnsignedResult:%.*]] = extractvalue { i32, i1 } %{{.*}}, 0
+// CHECK-NEXT:  [[IsNegZext:%.*]] = zext i1 [[IsNeg]] to i32
+// CHECK-NEXT:  [[MaxResult:%.*]] = add i32 2147483647, [[IsNegZext]]
+// CHECK-NEXT:  [[SignedOFlow:%.*]] = icmp ugt i32 [[UnsignedResult]], [[MaxResult]]
+// CHECK-NEXT:  [[OFlow:%.*]] = or i1 [[UnsignedOFlow]], [[SignedOFlow]]
+// CHECK-NEXT:  [[NegativeResult:%.*]] = sub i32 0, [[UnsignedResult]]
+// CHECK-NEXT:  [[Result:%.*]] = select i1 [[IsNeg]], i32 [[NegativeResult]], i32 [[UnsignedResult]]
+// CHECK-NEXT:  store i32 [[Result]], i32* %{{.*}}, align 4
+// CHECK:   br i1 [[OFlow]]
+
+  int result;
+  if (__builtin_mul_overflow(x, y, ))
+return LongErrorCode;
+  return result;
+}
+
+int test_mixed_sign_mull_overflow_unsigned(int x, unsigned y) {
+// CHECK: @test_mixed_sign_mull_overflow_unsigned
+// CHECK:   [[IsNeg:%.*]] = icmp slt i32 [[Op1:%.*]], 0
+// CHECK-NEXT:  [[Signed:%.*]] = sub i32 0, [[Op1]]
+// CHECK-NEXT:  [[AbsSigned:%.*]] = select i1 [[IsNeg]], i32 [[Signed]], i32 [[Op1]]
+// CHECK-NEXT:  call { i32, i1 } @llvm.umul.with.overflow.i32(i32 [[AbsSigned]], i32 %{{.*}})
+// CHECK-NEXT:  [[UnsignedOFlow:%.*]] = extractvalue { i32, i1 } %{{.*}}, 1
+// CHECK-NEXT:  [[UnsignedResult:%.*]] = extractvalue { i32, i1 } %{{.*}}, 0
+// CHECK-NEXT:  [[NotNull:%.*]] = icmp ne i32 [[UnsignedResult]], 0
+// CHECK-NEXT:  [[Underflow:%.*]] = and i1 [[IsNeg]], [[NotNull]]
+// CHECK-NEXT:  [[OFlow:%.*]] = or i1 [[UnsignedOFlow]], [[Underflow]]
+// CHECK-NEXT:  store i32 [[UnsignedResult]], i32* %{{.*}}, align 4
+// CHECK:   br i1 [[OFlow]]
+
+  unsigned result;
+  if (__builtin_mul_overflow(x, y, ))
+return LongErrorCode;
+  return result;
+}
+
+int test_mixed_sign_mull_overflow_swapped(int x, unsigned y) {
+// CHECK: @test_mixed_sign_mull_overflow_swapped
+// CHECK:  call { i32, i1 } @llvm.umul.with.overflow.i32
+// CHECK:  add i32 2147483647
+  int result;
+  if (__builtin_mul_overflow(y, x, ))
+return LongErrorCode;
+  return result;
+}
+
+long long test_mixed_sign_mulll_overflow(long long x, unsigned long long y) {
+// CHECK: @test_mixed_sign_mulll_overflow
+// CHECK:  call { i64, i1 } @llvm.umul.with.overflow.i64
+// CHECK:  add i64 92233720368547
+  long long result;
+  if (__builtin_mul_overflow(x, y, ))
+return LongLongErrorCode;
+  return result;
+}
+
+long long test_mixed_sign_mulll_overflow_swapped(long long x, unsigned long long y) {
+// CHECK: @test_mixed_sign_mulll_overflow_swapped
+// CHECK:  call { i64, i1 } @llvm.umul.with.overflow.i64
+// CHECK:  add i64 92233720368547
+  long long result;
+  if (__builtin_mul_overflow(y, x, ))
+return LongLongErrorCode;
+  return result;
+}
+
+long long test_mixed_sign_mulll_overflow_trunc_signed(long long x, unsigned long long y) {
+// CHECK: @test_mixed_sign_mulll_overflow_trunc_signed
+// CHECK:  call { i64, i1 } @llvm.umul.with.overflow.i64
+// CHECK:  add i64 2147483647
+// CHECK:  trunc
+// CHECK:  store
+  int result;
+  if (__builtin_mul_overflow(y, x, ))
+return LongLongErrorCode;
+  return result;
+}
+
+long long test_mixed_sign_mulll_overflow_trunc_unsigned(long long x, unsigned long long y) {
+// CHECK: @test_mixed_sign_mulll_overflow_trunc_unsigned
+// CHECK:   call { i64, i1 } @llvm.umul.with.overflow.i64
+// CHECK:   [[NON_ZERO:%.*]] = icmp ne i64 [[UNSIGNED_RESULT:%.*]], 0
+// CHECK-NEXT:  [[UNDERFLOW:%.*]] = and i1 {{.*}}, [[NON_ZERO]]
+// CHECK-NEXT:  [[OVERFLOW_PRE_TRUNC:%.*]] = or i1 {{.*}}, [[UNDERFLOW]]
+// CHECK-NEXT:  [[TRUNC_OVERFLOW:%.*]] = icmp ugt i64 [[UNSIGNED_RESULT]], 4294967295
+// CHECK-NEXT:  [[OVERFLOW:%.*]] = or i1 [[OVERFLOW_PRE_TRUNC]], [[TRUNC_OVERFLOW]]
+// CHECK-NEXT:  trunc i64 

[PATCH] D41149: [CodeGen] Specialize mixed-sign mul-with-overflow (fix PR34920)

2017-12-13 Thread Vedant Kumar via Phabricator via cfe-commits
vsk added inline comments.



Comment at: test/CodeGen/builtins-overflow.c:402
+  int result;
+  if (__builtin_mul_overflow(y, x, ))
+return LongLongErrorCode;

efriedma wrote:
> I think the rules for __builtin_mul_overflow say you have to check whether 
> the truncate changes the value of the result.
> 
> Missing testcases for the case where the result is unsigned.
Thanks for the catch. I've updated my test driver to catch cases like this.


https://reviews.llvm.org/D41149



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


[PATCH] D40809: [WIP] [analyzer] Dump counterexample traces as C programs

2017-12-13 Thread George Karpenkov via Phabricator via cfe-commits
george.karpenkov updated this revision to Diff 126853.
george.karpenkov edited the summary of this revision.

https://reviews.llvm.org/D40809

Files:
  include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
  include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h
  lib/StaticAnalyzer/Core/AnalyzerOptions.cpp
  lib/StaticAnalyzer/Core/BugReporter.cpp
  lib/StaticAnalyzer/Core/BugReporterVisitors.cpp

Index: lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
===
--- lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
+++ lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
@@ -11,6 +11,8 @@
 //  enhance the diagnostics reported for a bug.
 //
 //===--===//
+#include 
+#include 
 #include "clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h"
 #include "clang/AST/Expr.h"
 #include "clang/AST/ExprObjC.h"
@@ -24,6 +26,7 @@
 #include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h"
 #include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/StringExtras.h"
+#include "llvm/ADT/SetVector.h"
 #include "llvm/Support/raw_ostream.h"
 
 using namespace clang;
@@ -1878,3 +1881,155 @@
 
   return std::move(Piece);
 }
+
+/// Export the counterexample to C.
+class PrinterVisitor final : public BugReporterVisitorImpl {
+
+  /// File ID followed by a line number.
+  llvm::SetVector> VisitedLines;
+
+  /// Output stream to write into.
+  raw_ostream 
+
+  /// State machine variables.
+  mutable bool DonePrinting = false;
+
+  /// Max number of chars used to display the filename.
+  static const unsigned MAX_FILENAME_MARGIN = 80;
+  static const unsigned MARGIN_SEP_LEN = 1; 
+  static constexpr const char * const REPORT_SEPARATOR =
+  "/* == */\n";
+
+public:
+  PrinterVisitor(raw_ostream ) : Ostream(Ostream) {}
+
+  PrinterVisitor() = delete;
+
+  void Profile(llvm::FoldingSetNodeID ) const override {
+static int Tag = 0;
+ID.AddPointer();
+  }
+
+  std::shared_ptr VisitNode(const ExplodedNode *N,
+ const ExplodedNode *PrevN,
+ BugReporterContext ,
+ BugReport ) override {
+SourceManager  = BRC.getSourceManager();
+
+if (DonePrinting) { // Printing was done, do nothing.
+  return nullptr;
+} else if (!PrevN->getFirstPred()) { // Finished report, do printing.
+
+  // Went through the entire bug report, now print the lines in reverse
+  // order.
+  bool Status = doPrinting(SM);
+  if (!Status)
+Ostream << "Error while printing\n";
+  Ostream << REPORT_SEPARATOR;
+  DonePrinting = true;
+  return nullptr;
+} else if (const Stmt *S = PathDiagnosticLocation::getStmt(N)) {
+
+  // Statement location with an associated SourceLocation object.
+  SourceLocation Loc = S->getSourceRange().getBegin();
+
+  // FIXME: might be necessary to insert the spelling location as well.
+  insertLoc(SM, SM.getExpansionLoc(Loc));
+}
+return nullptr;
+  }
+
+private:
+  /// Print locations serialized to \c VisitedLines.
+  bool doPrinting(SourceManager ) {
+unsigned Margin = calculateMargin(SM);
+for (auto It = VisitedLines.rbegin(),
+ItEnd = VisitedLines.rend();
+It != ItEnd; ++It) {
+  FileID FID = It->first;
+  unsigned LineNo = It->second;
+  bool Status = printLine(SM, FID, LineNo, Margin);
+  if (!Status)
+return false;
+}
+return true;
+  }
+
+  /// Print line \p LineNo from file \p FID, with left margin \p Margin.
+  /// \return \c true on success, \c false on failure.
+  bool printLine(SourceManager , FileID FID,
+ unsigned LineNo, unsigned Margin) {
+SourceLocation Location = SM.translateLineCol(FID, LineNo, 1);
+unsigned Offset = SM.getFileOffset(Location);
+
+// Print location first.
+int Status = printLocation(SM, Location, Margin);
+if (!Status)
+  return false;
+
+bool Invalid = false;
+const char *BufferStart = SM.getBufferData(FID, ).data();
+if (Invalid)
+  return false;
+
+unsigned FileEndOffset = SM.getFileOffset(SM.getLocForEndOfFile(FID));
+for (unsigned i=Offset; BufferStart[i] != '\n' && i < FileEndOffset; ++i)
+  Ostream << BufferStart[i];
+
+Ostream << "\n";
+return true;
+  }
+
+  /// Print location in left margin.
+  bool printLocation(SourceManager , SourceLocation Loc, unsigned Margin) {
+Loc = SM.getExpansionLoc(Loc);
+PresumedLoc PLoc = SM.getPresumedLoc(Loc);
+if (PLoc.isInvalid())
+  return false;
+
+uint64_t SavedPos = Ostream.tell();
+Ostream << PLoc.getFilename() << ":" << PLoc.getLine();
+uint64_t Delta = Ostream.tell() - SavedPos;
+assert(Margin >= Delta);
+for (unsigned i=Delta; i

[PATCH] D39812: [Driver, CodeGen] pass through and apply -fassociative-math

2017-12-13 Thread Hal Finkel via Phabricator via cfe-commits
hfinkel accepted this revision.
hfinkel added a comment.
This revision is now accepted and ready to land.

LGTM


https://reviews.llvm.org/D39812



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


[PATCH] D39622: Fix type name generation in DWARF for template instantiations with enum types and template specializations

2017-12-13 Thread Paul Robinson via Phabricator via cfe-commits
probinson added a comment.

Philosophically, mangled names and DWARF information serve different purposes, 
and I don't think you will find one true solution where both of them can yield 
the same name that everyone will be happy with.  Mangled names exist to provide 
unique and reproducible identifiers for the "same" entity across compilation 
units.  They are carefully specified (for example) to allow a linker to 
associate a reference in one object file to a definition in a different object 
file, and be guaranteed that the association is correct.  A demangled name is a 
necessarily context-free translation of the mangled name into something that 
has a closer relationship to how a human would think of or write the name of 
the thing, but isn't necessarily the only way to write the name of the thing.

DWARF names are (deliberately not carefully specified) strings that ought to 
bear some relationship to how source code would name the thing, but you 
probably don't want to attach semantic significance to those names.  This is 
rather emphatically true for names containing template parameters.  Typedefs 
(and their recent offspring, 'using' aliases) are your sworn enemy here.  
Enums, as you have found, are also a problem.

Basically, the type of an entity does not have a unique name, and trying to 
coerce different representations of the type into having the same unique name 
is a losing battle.


https://reviews.llvm.org/D39622



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


[PATCH] D39074: [libunwind][MIPS]: Add support for unwinding in N32 processes.

2017-12-13 Thread John Baldwin via Phabricator via cfe-commits
bsdjhb updated this revision to Diff 126841.
bsdjhb marked an inline comment as done.
bsdjhb added a comment.

- Use __SIZEOF_POINTER__ instead of __LP64__.
- Adjust comment for newabi register class.


https://reviews.llvm.org/D39074

Files:
  include/__libunwind_config.h
  src/AddressSpace.hpp
  src/DwarfInstructions.hpp
  src/Registers.hpp
  src/UnwindCursor.hpp
  src/UnwindRegistersRestore.S
  src/UnwindRegistersSave.S
  src/libunwind.cpp

Index: src/libunwind.cpp
===
--- src/libunwind.cpp
+++ src/libunwind.cpp
@@ -61,8 +61,9 @@
 # define REGISTER_KIND Registers_or1k
 #elif defined(__mips__) && defined(_ABIO32) && defined(__mips_soft_float)
 # define REGISTER_KIND Registers_mips_o32
-#elif defined(__mips__) && defined(_ABI64) && defined(__mips_soft_float)
-# define REGISTER_KIND Registers_mips_n64
+#elif defined(__mips__) && (defined(_ABIN32) || defined(_ABI64)) &&\
+defined(__mips_soft_float)
+# define REGISTER_KIND Registers_mips_newabi
 #elif defined(__mips__)
 # warning The MIPS architecture is not supported with this ABI and environment!
 #else
Index: src/UnwindRegistersSave.S
===
--- src/UnwindRegistersSave.S
+++ src/UnwindRegistersSave.S
@@ -172,7 +172,8 @@
   or$2, $0, $0
   .set pop
 
-#elif defined(__mips__) && defined(_ABI64) && defined(__mips_soft_float)
+#elif defined(__mips__) && (defined(_ABI64) || defined(_ABIN32)) &&\
+defined(__mips_soft_float)
 
 #
 # extern int unw_getcontext(unw_context_t* thread_state)
Index: src/UnwindRegistersRestore.S
===
--- src/UnwindRegistersRestore.S
+++ src/UnwindRegistersRestore.S
@@ -590,15 +590,16 @@
   lw$4, (4 * 4)($4)
   .set pop
 
-#elif defined(__mips__) && defined(_ABI64) && defined(__mips_soft_float)
+#elif defined(__mips__) && (defined(_ABI64) || defined(_ABIN32)) &&\
+defined(__mips_soft_float)
 
 //
-// void libunwind::Registers_mips_n64::jumpto()
+// void libunwind::Registers_mips_newabi::jumpto()
 //
 // On entry:
 //  thread state pointer is in a0 ($4)
 //
-DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind18Registers_mips_n646jumptoEv)
+DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind21Registers_mips_newabi6jumptoEv)
   .set push
   .set noat
   .set noreorder
Index: src/UnwindCursor.hpp
===
--- src/UnwindCursor.hpp
+++ src/UnwindCursor.hpp
@@ -514,8 +514,8 @@
   }
 #endif
 
-#if defined(_LIBUNWIND_TARGET_MIPS_N64)
-  int stepWithCompactEncoding(Registers_mips_n64 &) {
+#if defined(_LIBUNWIND_TARGET_MIPS_NEWABI)
+  int stepWithCompactEncoding(Registers_mips_newabi &) {
 return UNW_EINVAL;
   }
 #endif
@@ -570,8 +570,8 @@
   }
 #endif
 
-#if defined(_LIBUNWIND_TARGET_MIPS_N64)
-  bool compactSaysUseDwarf(Registers_mips_n64 &, uint32_t *) const {
+#if defined(_LIBUNWIND_TARGET_MIPS_NEWABI)
+  bool compactSaysUseDwarf(Registers_mips_newabi &, uint32_t *) const {
 return true;
   }
 #endif
@@ -625,8 +625,8 @@
   }
 #endif
 
-#if defined (_LIBUNWIND_TARGET_MIPS_N64)
-  compact_unwind_encoding_t dwarfEncoding(Registers_mips_n64 &) const {
+#if defined (_LIBUNWIND_TARGET_MIPS_NEWABI)
+  compact_unwind_encoding_t dwarfEncoding(Registers_mips_newabi &) const {
 return 0;
   }
 #endif
Index: src/Registers.hpp
===
--- src/Registers.hpp
+++ src/Registers.hpp
@@ -2248,13 +2248,13 @@
 }
 #endif // _LIBUNWIND_TARGET_MIPS_O32
 
-#if defined(_LIBUNWIND_TARGET_MIPS_N64)
-/// Registers_mips_n64 holds the register state of a thread in a 64-bit MIPS
-/// process.
-class _LIBUNWIND_HIDDEN Registers_mips_n64 {
+#if defined(_LIBUNWIND_TARGET_MIPS_NEWABI)
+/// Registers_mips_newabi holds the register state of a thread in a
+/// MIPS process using NEWABI (the N32 or N64 ABIs).
+class _LIBUNWIND_HIDDEN Registers_mips_newabi {
 public:
-  Registers_mips_n64();
-  Registers_mips_n64(const void *registers);
+  Registers_mips_newabi();
+  Registers_mips_newabi(const void *registers);
 
   boolvalidRegister(int num) const;
   uint64_tgetRegister(int num) const;
@@ -2275,28 +2275,28 @@
   void  setIP(uint64_t value) { _registers.__pc = value; }
 
 private:
-  struct mips_n64_thread_state_t {
+  struct mips_newabi_thread_state_t {
 uint64_t __r[32];
 uint64_t __pc;
 uint64_t __hi;
 uint64_t __lo;
   };
 
-  mips_n64_thread_state_t _registers;
+  mips_newabi_thread_state_t _registers;
 };
 
-inline Registers_mips_n64::Registers_mips_n64(const void *registers) {
-  static_assert((check_fit::does_fit),
-"mips_n64 registers do not fit into unw_context_t");
+inline Registers_mips_newabi::Registers_mips_newabi(const void *registers) {
+  static_assert((check_fit::does_fit),
+

[PATCH] D39622: Fix type name generation in DWARF for template instantiations with enum types and template specializations

2017-12-13 Thread Anton via Phabricator via cfe-commits
xgsa updated this revision to Diff 126826.
xgsa retitled this revision from "Fix type debug information generation for 
enum-based template specialization" to "Fix type name generation in DWARF for 
template instantiations with enum types and template specializations".
xgsa edited the summary of this revision.
xgsa added a comment.
Herald added a subscriber: JDevlieghere.

One more case was handled, review comments were applied, but no tests though, 
because I still not sure if the approach I have chosen is correct.


https://reviews.llvm.org/D39622

Files:
  include/clang/AST/PrettyPrinter.h
  lib/AST/TemplateBase.cpp
  lib/AST/TypePrinter.cpp
  lib/CodeGen/CGDebugInfo.cpp


Index: lib/CodeGen/CGDebugInfo.cpp
===
--- lib/CodeGen/CGDebugInfo.cpp
+++ lib/CodeGen/CGDebugInfo.cpp
@@ -234,6 +234,7 @@
   if (CGM.getCodeGenOpts().EmitCodeView)
 PP.MSVCFormatting = true;
 
+  PP.ABICompatibleFormatting = true;
   return PP;
 }
 
Index: lib/AST/TypePrinter.cpp
===
--- lib/AST/TypePrinter.cpp
+++ lib/AST/TypePrinter.cpp
@@ -1060,7 +1060,9 @@
   if (ClassTemplateSpecializationDecl *Spec
 = dyn_cast(D)) {
 ArrayRef Args;
-if (TypeSourceInfo *TAW = Spec->getTypeAsWritten()) {
+if (TypeSourceInfo *TAW = !Policy.ABICompatibleFormatting
+  ? Spec->getTypeAsWritten()
+  : nullptr) {
   const TemplateSpecializationType *TST =
 cast(TAW->getType());
   Args = TST->template_arguments();
Index: lib/AST/TemplateBase.cpp
===
--- lib/AST/TemplateBase.cpp
+++ lib/AST/TemplateBase.cpp
@@ -56,14 +56,22 @@
   const llvm::APSInt  = TemplArg.getAsIntegral();
 
   if (const EnumType *ET = T->getAs()) {
-for (const EnumConstantDecl* ECD : ET->getDecl()->enumerators()) {
-  // In Sema::CheckTemplateArugment, enum template arguments value are
-  // extended to the size of the integer underlying the enum type.  This
-  // may create a size difference between the enum value and template
-  // argument value, requiring isSameValue here instead of operator==.
-  if (llvm::APSInt::isSameValue(ECD->getInitVal(), Val)) {
-ECD->printQualifiedName(Out, Policy);
-return;
+if (Policy.ABICompatibleFormatting) {
+  Out << "(";
+  ET->getDecl()->getNameForDiagnostic(Out, Policy, true);
+  Out << ")";
+  Out << Val;
+  return;
+} else {
+  for (const EnumConstantDecl* ECD : ET->getDecl()->enumerators()) {
+// In Sema::CheckTemplateArugment, enum template arguments value are
+// extended to the size of the integer underlying the enum type.  This
+// may create a size difference between the enum value and template
+// argument value, requiring isSameValue here instead of operator==.
+if (llvm::APSInt::isSameValue(ECD->getInitVal(), Val)) {
+  ECD->printQualifiedName(Out, Policy);
+  return;
+}
   }
 }
   }
Index: include/clang/AST/PrettyPrinter.h
===
--- include/clang/AST/PrettyPrinter.h
+++ include/clang/AST/PrettyPrinter.h
@@ -52,7 +52,7 @@
   Half(LO.Half), MSWChar(LO.MicrosoftExt && !LO.WChar),
   IncludeNewlines(true), MSVCFormatting(false),
   ConstantsAsWritten(false), SuppressImplicitBase(false),
-  FullyQualifiedName(false) { }
+  FullyQualifiedName(false), ABICompatibleFormatting(false) { }
 
   /// Adjust this printing policy for cases where it's known that we're
   /// printing C++ code (for instance, if AST dumping reaches a C++-only
@@ -225,6 +225,13 @@
   /// When true, print the fully qualified name of function declarations.
   /// This is the opposite of SuppressScope and thus overrules it.
   bool FullyQualifiedName : 1;
+
+  /// Use formatting compatible with ABI specification. It is necessary for
+  /// saving entities into debug tables which have to be compatible with
+  /// the representation, described in ABI specification. In particular, this 
forces
+  /// templates parametrized with enums to be represented as "T<(Enum)0>" 
instead of
+  /// "T" and template specializations to be written in canonical 
form.
+  bool ABICompatibleFormatting : 1;
 };
 
 } // end namespace clang


Index: lib/CodeGen/CGDebugInfo.cpp
===
--- lib/CodeGen/CGDebugInfo.cpp
+++ lib/CodeGen/CGDebugInfo.cpp
@@ -234,6 +234,7 @@
   if (CGM.getCodeGenOpts().EmitCodeView)
 PP.MSVCFormatting = true;
 
+  PP.ABICompatibleFormatting = true;
   return PP;
 }
 
Index: lib/AST/TypePrinter.cpp
===
--- lib/AST/TypePrinter.cpp
+++ lib/AST/TypePrinter.cpp
@@ -1060,7 +1060,9 @@
   if (ClassTemplateSpecializationDecl *Spec
 

[PATCH] D39074: [libunwind][MIPS]: Add support for unwinding in N32 processes.

2017-12-13 Thread John Baldwin via Phabricator via cfe-commits
bsdjhb marked 2 inline comments as done.
bsdjhb added inline comments.



Comment at: src/AddressSpace.hpp:201
+inline uint64_t LocalAddressSpace::getRegister(pint_t addr) {
+#if defined(__LP64__) || (defined(__mips__) && defined(_ABIN32))
+  return get64(addr);

compnerd wrote:
> Can you use `__SIZEOF_POINTER__` rather than `__LP64__` please?  The former 
> accounts for LLP64 environments as well.
I wonder if we should adjust the #if condition used to control the types of 
pint_t and sint_t earlier in this file to also use __SIZEOF_POINTER__ (as a 
separate change)?


https://reviews.llvm.org/D39074



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


[PATCH] D41036: IRGen: When performing CFI checks, load vtable pointer from vbase when necessary.

2017-12-13 Thread Reid Kleckner via Phabricator via cfe-commits
rnk added a comment.

Looks good!


Repository:
  rL LLVM

https://reviews.llvm.org/D41036



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


[PATCH] D41148: [libcxx] implement declarations based on P0214R7.

2017-12-13 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF added inline comments.



Comment at: libcxx/include/experimental/simd:1
+#ifndef _LIBCPP_EXPERIMENTAL_SIMD
+#define _LIBCPP_EXPERIMENTAL_SIMD

Please add the license header similar to `experimental/filesystem`.



Comment at: libcxx/include/experimental/simd:581
+*/
+
+#include 

The first include should be ``



Comment at: libcxx/include/experimental/simd:590
+
+#if _LIBCPP_STD_VER < 11
+#error "Pre-C++11 is not supported"

(1) `_LIBCPP_STD_VER` is never less than 11. It's an odd libc++ quirk.
(2) We don't normally generate explicit errors when headers are used 
incorrectly.




Comment at: libcxx/include/experimental/simd:594
+
+#warning " is under construction and not for practical use 
for now."
+

I would just remove this. The `experimental` part of the name should say enough.

Also we normally wait until an implementation is mostly complete before landing 
it. 



Comment at: libcxx/include/experimental/simd:596
+
+namespace std {
+namespace experimental {

Please define macros to open and close the namespace similar to 
`_LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL_FILESYSTEM` in ``



Comment at: libcxx/test/std/experimental/simd/traits.pass.cpp:15
+// [simd.traits]
+// template  struct is_abi_tag;
+// template  inline constexpr bool is_abi_tag_v = 
is_abi_tag::value;

Please create a directory called `simd/traits/` and then put each trait in a 
separate test file under that directory.
The `foo_v` tests should be in the same file as the `foo` tests.




https://reviews.llvm.org/D41148



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


[PATCH] D41032: [CodeGen][X86] Implement _InterlockedCompareExchange128 intrinsic

2017-12-13 Thread Colden Cullen via Phabricator via cfe-commits
colden added a comment.

Thanks Reid! Would you mind submitting this for me?


https://reviews.llvm.org/D41032



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


[PATCH] D39812: [Driver, CodeGen] pass through and apply -fassociative-math

2017-12-13 Thread Sanjay Patel via Phabricator via cfe-commits
spatel added a comment.

Ping * 4.


https://reviews.llvm.org/D39812



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


[PATCH] D41036: IRGen: When performing CFI checks, load vtable pointer from vbase when necessary.

2017-12-13 Thread Peter Collingbourne via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL320638: IRGen: When performing CFI checks, load vtable 
pointer from vbase when… (authored by pcc, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D41036?vs=126220=126831#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D41036

Files:
  cfe/trunk/lib/CodeGen/CGCXXABI.h
  cfe/trunk/lib/CodeGen/CGClass.cpp
  cfe/trunk/lib/CodeGen/CGExprCXX.cpp
  cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
  cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp
  cfe/trunk/test/CodeGenCXX/cfi-ms-vbase-derived-cast.cpp
  cfe/trunk/test/CodeGenCXX/cfi-ms-vbase-nvcall.cpp

Index: cfe/trunk/test/CodeGenCXX/cfi-ms-vbase-nvcall.cpp
===
--- cfe/trunk/test/CodeGenCXX/cfi-ms-vbase-nvcall.cpp
+++ cfe/trunk/test/CodeGenCXX/cfi-ms-vbase-nvcall.cpp
@@ -0,0 +1,27 @@
+// RUN: %clang_cc1 -flto -flto-unit -emit-llvm -o - -triple=x86_64-pc-win32 %s -fsanitize=cfi-nvcall -fsanitize-trap=cfi-nvcall | FileCheck %s
+
+struct foo {
+  virtual ~foo() {}
+  virtual void f() = 0;
+};
+
+template 
+struct bar : virtual public foo {
+  void f() {}
+};
+
+struct baz : public bar {
+  virtual ~baz() {}
+  void g() {}
+};
+
+void f(baz *z) {
+  // CHECK: define{{.*}}@"\01?f@@YAXPEAUbaz@@@Z"
+  // Load z, vbtable, vbase offset and vtable.
+  // CHECK: load
+  // CHECK: load
+  // CHECK: load
+  // CHECK: load
+  // CHECK: @llvm.type.test{{.*}}!"?AUfoo@@"
+  z->g();
+}
Index: cfe/trunk/test/CodeGenCXX/cfi-ms-vbase-derived-cast.cpp
===
--- cfe/trunk/test/CodeGenCXX/cfi-ms-vbase-derived-cast.cpp
+++ cfe/trunk/test/CodeGenCXX/cfi-ms-vbase-derived-cast.cpp
@@ -0,0 +1,29 @@
+// RUN: %clang_cc1 -flto -flto-unit -emit-llvm -o - -triple=x86_64-pc-win32 %s -fsanitize=cfi-derived-cast -fsanitize-trap=cfi-derived-cast | FileCheck %s
+
+struct foo {
+  virtual ~foo() {}
+  virtual void f() = 0;
+};
+
+template 
+struct bar : virtual public foo {
+  void f() {
+// CHECK: define{{.*}}@"\01?f@?$bar@UbazUEAAXXZ"
+// Load "this", vbtable, vbase offset and vtable.
+// CHECK: load
+// CHECK: load
+// CHECK: load
+// CHECK: load
+// CHECK: @llvm.type.test{{.*}}!"?AUfoo@@"
+static_cast(*this);
+  }
+};
+
+struct baz : public bar {
+  virtual ~baz() {}
+};
+
+int main() {
+  baz *z = new baz;
+  z->f();
+}
Index: cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
===
--- cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
+++ cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
@@ -389,6 +389,10 @@
 
   void emitCXXStructor(const CXXMethodDecl *MD, StructorType Type) override;
 
+  std::pair
+  LoadVTablePtr(CodeGenFunction , Address This,
+const CXXRecordDecl *RD) override;
+
  private:
bool hasAnyUnusedVirtualInlineFunction(const CXXRecordDecl *RD) const {
  const auto  =
@@ -4041,3 +4045,9 @@
   }
   return CGF.EmitNounwindRuntimeCall(CGF.CGM.getTerminateFn());
 }
+
+std::pair
+ItaniumCXXABI::LoadVTablePtr(CodeGenFunction , Address This,
+ const CXXRecordDecl *RD) {
+  return {CGF.GetVTablePtr(This, CGM.Int8PtrTy, RD), RD};
+}
Index: cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp
===
--- cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp
+++ cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp
@@ -578,7 +578,7 @@
 return GetVBaseOffsetFromVBPtr(CGF, Base, VBPOffset, VBTOffset, VBPtr);
   }
 
-  std::pair
+  std::tuple
   performBaseAdjustment(CodeGenFunction , Address Value,
 QualType SrcRecordTy);
 
@@ -745,6 +745,10 @@
 
   llvm::GlobalVariable *getThrowInfo(QualType T) override;
 
+  std::pair
+  LoadVTablePtr(CodeGenFunction , Address This,
+const CXXRecordDecl *RD) override;
+
 private:
   typedef std::pair VFTableIdTy;
   typedef llvm::DenseMap VTablesMapTy;
@@ -926,7 +930,7 @@
 /// We need to perform a generic polymorphic operation (like a typeid
 /// or a cast), which requires an object with a vfptr.  Adjust the
 /// address to point to an object with a vfptr.
-std::pair
+std::tuple
 MicrosoftCXXABI::performBaseAdjustment(CodeGenFunction , Address Value,
QualType SrcRecordTy) {
   Value = CGF.Builder.CreateBitCast(Value, CGF.Int8PtrTy);
@@ -937,7 +941,8 @@
   // covers non-virtual base subobjects: a class with its own virtual
   // functions would be a candidate to be a primary base.
   if (Context.getASTRecordLayout(SrcDecl).hasExtendableVFPtr())
-return std::make_pair(Value, llvm::ConstantInt::get(CGF.Int32Ty, 0));
+return std::make_tuple(Value, llvm::ConstantInt::get(CGF.Int32Ty, 0),
+   

r320638 - IRGen: When performing CFI checks, load vtable pointer from vbase when necessary.

2017-12-13 Thread Peter Collingbourne via cfe-commits
Author: pcc
Date: Wed Dec 13 13:53:04 2017
New Revision: 320638

URL: http://llvm.org/viewvc/llvm-project?rev=320638=rev
Log:
IRGen: When performing CFI checks, load vtable pointer from vbase when 
necessary.

Under the Microsoft ABI, it is possible for an object not to have
a virtual table pointer of its own if all of its virtual functions
were introduced by virtual bases. In that case, we need to load the
vtable pointer from one of the virtual bases and perform the type
check using its type.

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

Added:
cfe/trunk/test/CodeGenCXX/cfi-ms-vbase-derived-cast.cpp
cfe/trunk/test/CodeGenCXX/cfi-ms-vbase-nvcall.cpp
Modified:
cfe/trunk/lib/CodeGen/CGCXXABI.h
cfe/trunk/lib/CodeGen/CGClass.cpp
cfe/trunk/lib/CodeGen/CGExprCXX.cpp
cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp

Modified: cfe/trunk/lib/CodeGen/CGCXXABI.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCXXABI.h?rev=320638=320637=320638=diff
==
--- cfe/trunk/lib/CodeGen/CGCXXABI.h (original)
+++ cfe/trunk/lib/CodeGen/CGCXXABI.h Wed Dec 13 13:53:04 2017
@@ -582,6 +582,13 @@ public:
   /// Emit a single constructor/destructor with the given type from a C++
   /// constructor Decl.
   virtual void emitCXXStructor(const CXXMethodDecl *MD, StructorType Type) = 0;
+
+  /// Load a vtable from This, an object of polymorphic type RD, or from one of
+  /// its virtual bases if it does not have its own vtable. Returns the vtable
+  /// and the class from which the vtable was loaded.
+  virtual std::pair
+  LoadVTablePtr(CodeGenFunction , Address This,
+const CXXRecordDecl *RD) = 0;
 };
 
 // Create an instance of a C++ ABI class:

Modified: cfe/trunk/lib/CodeGen/CGClass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGClass.cpp?rev=320638=320637=320638=diff
==
--- cfe/trunk/lib/CodeGen/CGClass.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGClass.cpp Wed Dec 13 13:53:04 2017
@@ -2627,8 +2627,9 @@ void CodeGenFunction::EmitVTablePtrCheck
 EmitBlock(CheckBlock);
   }
 
-  llvm::Value *VTable =
-GetVTablePtr(Address(Derived, getPointerAlign()), Int8PtrTy, ClassDecl);
+  llvm::Value *VTable;
+  std::tie(VTable, ClassDecl) = CGM.getCXXABI().LoadVTablePtr(
+  *this, Address(Derived, getPointerAlign()), ClassDecl);
 
   EmitVTablePtrCheck(ClassDecl, VTable, TCK, Loc);
 

Modified: cfe/trunk/lib/CodeGen/CGExprCXX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprCXX.cpp?rev=320638=320637=320638=diff
==
--- cfe/trunk/lib/CodeGen/CGExprCXX.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprCXX.cpp Wed Dec 13 13:53:04 2017
@@ -368,9 +368,11 @@ RValue CodeGenFunction::EmitCXXMemberOrO
   } else {
 if (SanOpts.has(SanitizerKind::CFINVCall) &&
 MD->getParent()->isDynamicClass()) {
-  llvm::Value *VTable = GetVTablePtr(This, Int8PtrTy, MD->getParent());
-  EmitVTablePtrCheckForCall(MD->getParent(), VTable, CFITCK_NVCall,
-CE->getLocStart());
+  llvm::Value *VTable;
+  const CXXRecordDecl *RD;
+  std::tie(VTable, RD) =
+  CGM.getCXXABI().LoadVTablePtr(*this, This, MD->getParent());
+  EmitVTablePtrCheckForCall(RD, VTable, CFITCK_NVCall, CE->getLocStart());
 }
 
 if (getLangOpts().AppleKext && MD->isVirtual() && HasQualifier)

Modified: cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp?rev=320638=320637=320638=diff
==
--- cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp (original)
+++ cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp Wed Dec 13 13:53:04 2017
@@ -389,6 +389,10 @@ public:
 
   void emitCXXStructor(const CXXMethodDecl *MD, StructorType Type) override;
 
+  std::pair
+  LoadVTablePtr(CodeGenFunction , Address This,
+const CXXRecordDecl *RD) override;
+
  private:
bool hasAnyUnusedVirtualInlineFunction(const CXXRecordDecl *RD) const {
  const auto  =
@@ -4041,3 +4045,9 @@ ItaniumCXXABI::emitTerminateForUnexpecte
   }
   return CGF.EmitNounwindRuntimeCall(CGF.CGM.getTerminateFn());
 }
+
+std::pair
+ItaniumCXXABI::LoadVTablePtr(CodeGenFunction , Address This,
+ const CXXRecordDecl *RD) {
+  return {CGF.GetVTablePtr(This, CGM.Int8PtrTy, RD), RD};
+}

Modified: cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp?rev=320638=320637=320638=diff
==
--- cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp (original)
+++ cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp 

[PATCH] D41032: [CodeGen][X86] Implement _InterlockedCompareExchange128 intrinsic

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

lgtm


https://reviews.llvm.org/D41032



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


[PATCH] D40819: Implement Attribute Target MultiVersioning (Improved edition!)

2017-12-13 Thread Erich Keane via Phabricator via cfe-commits
erichkeane updated this revision to Diff 126829.
erichkeane added a comment.

@aaron.ballman reminded me that this should only work on ELF targets, so this 
patch enforces that constraint.


https://reviews.llvm.org/D40819

Files:
  include/clang/AST/Decl.h
  include/clang/Basic/Attr.td
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/Basic/TargetInfo.h
  include/clang/Basic/X86Target.def
  include/clang/Sema/Overload.h
  lib/Basic/Targets/X86.cpp
  lib/Basic/Targets/X86.h
  lib/CodeGen/CGBuiltin.cpp
  lib/CodeGen/CodeGenFunction.cpp
  lib/CodeGen/CodeGenFunction.h
  lib/CodeGen/CodeGenModule.cpp
  lib/CodeGen/CodeGenModule.h
  lib/Sema/SemaDecl.cpp
  lib/Sema/SemaOverload.cpp
  lib/Serialization/ASTReaderDecl.cpp
  lib/Serialization/ASTWriterDecl.cpp
  test/CodeGen/attr-target-mv-func-ptrs.c
  test/CodeGen/attr-target-mv-va-args.c
  test/CodeGen/attr-target-mv.c
  test/CodeGenCXX/attr-target-mv-constexpr.cpp
  test/CodeGenCXX/attr-target-mv-diff-ns.cpp
  test/CodeGenCXX/attr-target-mv-func-ptrs.cpp
  test/CodeGenCXX/attr-target-mv-member-funcs.cpp
  test/CodeGenCXX/attr-target-mv-out-of-line-defs.cpp
  test/CodeGenCXX/attr-target-mv-overloads.cpp
  test/Sema/attr-target-mv-bad-target.c
  test/Sema/attr-target-mv.c
  test/SemaCXX/attr-target-mv.cpp

Index: test/SemaCXX/attr-target-mv.cpp
===
--- /dev/null
+++ test/SemaCXX/attr-target-mv.cpp
@@ -0,0 +1,131 @@
+// RUN: %clang_cc1 -triple x86_64-linux-gnu  -fsyntax-only -verify -fexceptions -fcxx-exceptions %s -std=c++14
+void __attribute__((target("sse4.2"))) no_default(void);
+void __attribute__((target("arch=sandybridge")))  no_default(void);
+
+void use1(void){
+  // expected-note@-4 {{candidate ignored: non-default multiversion function cannot be called directly}}
+  // expected-note@-4 {{candidate ignored: non-default multiversion function cannot be called directly}}
+  // expected-error@+1 {{no matching function for call to 'no_default'}}
+  no_default();
+}
+constexpr int __attribute__((target("sse4.2"))) foo(void) { return 0; }
+constexpr int __attribute__((target("arch=sandybridge"))) foo(void);
+//expected-error@+1 {{multiversion function declaration has a different constexpr specification}}
+int __attribute__((target("arch=ivybridge"))) foo(void) {return 1;}
+constexpr int __attribute__((target("default"))) foo(void) { return 2; }
+
+int __attribute__((target("sse4.2"))) foo2(void) { return 0; }
+//expected-error@+2 {{multiversion function declaration has a different constexpr specification}}
+//expected-note@+1 {{function multiversion caused by this declaration}}
+constexpr int __attribute__((target("arch=sandybridge"))) foo2(void);
+int __attribute__((target("arch=ivybridge"))) foo2(void) {return 1;}
+int __attribute__((target("default"))) foo2(void) { return 2; }
+
+static int __attribute__((target("sse4.2"))) bar(void) { return 0; }
+static int __attribute__((target("arch=sandybridge"))) bar(void);
+//expected-error@+1 {{multiversion function declaration has a different storage class}}
+int __attribute__((target("arch=ivybridge"))) bar(void) {return 1;}
+static int __attribute__((target("default"))) bar(void) { return 2; }
+
+int __attribute__((target("sse4.2"))) bar2(void) { return 0; }
+//expected-error@+2 {{multiversion function declaration has a different storage class}}
+//expected-note@+1 {{function multiversion caused by this declaration}}
+static int __attribute__((target("arch=sandybridge"))) bar2(void);
+int __attribute__((target("arch=ivybridge"))) bar2(void) {return 1;}
+int __attribute__((target("default"))) bar2(void) { return 2; }
+
+
+inline int __attribute__((target("sse4.2"))) baz(void) { return 0; }
+inline int __attribute__((target("arch=sandybridge"))) baz(void);
+//expected-error@+1 {{multiversion function declaration has a different inline specification}}
+int __attribute__((target("arch=ivybridge"))) baz(void) {return 1;}
+inline int __attribute__((target("default"))) baz(void) { return 2; }
+
+int __attribute__((target("sse4.2"))) baz2(void) { return 0; }
+//expected-error@+2 {{multiversion function declaration has a different inline specification}}
+//expected-note@+1 {{function multiversion caused by this declaration}}
+inline int __attribute__((target("arch=sandybridge"))) baz2(void);
+int __attribute__((target("arch=ivybridge"))) baz2(void) {return 1;}
+int __attribute__((target("default"))) baz2(void) { return 2; }
+
+float __attribute__((target("sse4.2"))) bock(void) { return 0; }
+//expected-error@+2 {{multiversion function declaration has a different return type}}
+//expected-note@+1 {{function multiversion caused by this declaration}}
+int __attribute__((target("arch=sandybridge"))) bock(void);
+//expected-error@+2 {{multiversion function declaration has a different return type}}
+//expected-note@+1 {{function multiversion caused by this declaration}}
+int __attribute__((target("arch=ivybridge"))) bock(void) {return 1;}

[PATCH] D39457: [OPENMP] Current status of OpenMP support.

2017-12-13 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev updated this revision to Diff 126820.
ABataev added a comment.

Status update


Repository:
  rC Clang

https://reviews.llvm.org/D39457

Files:
  docs/OpenMPSupport.rst
  docs/index.rst


Index: docs/index.rst
===
--- docs/index.rst
+++ docs/index.rst
@@ -39,6 +39,7 @@
SourceBasedCodeCoverage
Modules
MSVCCompatibility
+   OpenMPSupport
ThinLTO
CommandGuide/index
FAQ
Index: docs/OpenMPSupport.rst
===
--- /dev/null
+++ docs/OpenMPSupport.rst
@@ -0,0 +1,69 @@
+.. raw:: html
+
+  
+.none { background-color: #FF }
+.partial { background-color: #99 }
+.good { background-color: #CCFF99 }
+  
+
+.. role:: none
+.. role:: partial
+.. role:: good
+
+==
+OpenMP Support
+==
+
+Clang fully supports OpenMP 3.1 + some elements of OpenMP 4.5. Clang supports 
offloading to X86_64, AArch64, PPC64[LE] and Cuda devices.
+The status of major OpenMP 4.5 features support in Clang.
+
+Standalone directives
+=
+
+* #pragma omp [for] simd: :good:`Complete`.
+
+* #pragma omp declare simd: :partial:`Partial`.  We support parsing/semantic
+  analysis + generation of special attributes for X86 target, but still
+  missing the LLVM pass for vectorization.
+
+* #pragma omp taskloop [simd]: :good:`Complete`.
+
+* #pragma omp target [enter|exit] data: :good:`Mostly complete`.  Some rework 
is
+  required for better stability.
+
+* #pragma omp target update: :good:`Mostly complete`.  Some rework is
+  required for better stability.
+
+* #pragma omp target: :partial:`Partial`.  No support for the `depend` clauses.
+
+* #pragma omp declare target: :partial:`Partial`.  No full codegen support.
+
+* #pragma omp teams: :good:`Complete`.
+
+* #pragma omp distribute [simd]: :good:`Complete`.
+
+* #pragma omp distribute parallel for [simd]: :good:`Complete`.
+
+Combined directives
+===
+
+* #pragma omp parallel for simd: :good:`Complete`.
+
+* #pragma omp target parallel: :partial:`Partial`.  No support for the 
`depend` clauses.
+
+* #pragma omp target parallel for [simd]: :partial:`Partial`.  No support for 
the `depend` clauses.
+
+* #pragma omp target simd: :partial:`Partial`.  No support for the `depend` 
clauses.
+
+* #pragma omp target teams: :partial:`Partial`.  No support for the `depend` 
clauses.
+
+* #pragma omp teams distribute [simd]: :good:`Complete`.
+
+* #pragma omp target teams distribute [simd]: :partial:`Partial`.  No support 
for the and `depend` clauses.
+
+* #pragma omp teams distribute parallel for [simd]: :good:`Complete`.
+
+* #pragma omp target teams distribute parallel for [simd]: :partial:`Partial`. 
 No full codegen support.
+
+Clang does not support any constructs/updates from upcoming OpenMP 5.0 except 
for `reduction`-based clauses in the `task` and `target`-based directives.
+


Index: docs/index.rst
===
--- docs/index.rst
+++ docs/index.rst
@@ -39,6 +39,7 @@
SourceBasedCodeCoverage
Modules
MSVCCompatibility
+   OpenMPSupport
ThinLTO
CommandGuide/index
FAQ
Index: docs/OpenMPSupport.rst
===
--- /dev/null
+++ docs/OpenMPSupport.rst
@@ -0,0 +1,69 @@
+.. raw:: html
+
+  
+.none { background-color: #FF }
+.partial { background-color: #99 }
+.good { background-color: #CCFF99 }
+  
+
+.. role:: none
+.. role:: partial
+.. role:: good
+
+==
+OpenMP Support
+==
+
+Clang fully supports OpenMP 3.1 + some elements of OpenMP 4.5. Clang supports offloading to X86_64, AArch64, PPC64[LE] and Cuda devices.
+The status of major OpenMP 4.5 features support in Clang.
+
+Standalone directives
+=
+
+* #pragma omp [for] simd: :good:`Complete`.
+
+* #pragma omp declare simd: :partial:`Partial`.  We support parsing/semantic
+  analysis + generation of special attributes for X86 target, but still
+  missing the LLVM pass for vectorization.
+
+* #pragma omp taskloop [simd]: :good:`Complete`.
+
+* #pragma omp target [enter|exit] data: :good:`Mostly complete`.  Some rework is
+  required for better stability.
+
+* #pragma omp target update: :good:`Mostly complete`.  Some rework is
+  required for better stability.
+
+* #pragma omp target: :partial:`Partial`.  No support for the `depend` clauses.
+
+* #pragma omp declare target: :partial:`Partial`.  No full codegen support.
+
+* #pragma omp teams: :good:`Complete`.
+
+* #pragma omp distribute [simd]: :good:`Complete`.
+
+* #pragma omp distribute parallel for [simd]: :good:`Complete`.
+
+Combined directives
+===
+
+* #pragma omp parallel for simd: :good:`Complete`.
+
+* #pragma omp target parallel: :partial:`Partial`.  No support for the `depend` clauses.
+
+* #pragma omp target parallel for [simd]: 

[PATCH] D41168: [X86][avx512] Lowering X86 avx512 sqrt intrinsics to IR

2017-12-13 Thread Craig Topper via Phabricator via cfe-commits
craig.topper added inline comments.



Comment at: lib/CodeGen/CGBuiltin.cpp:8145
+  case X86::BI__builtin_ia32_sqrtpd512_mask_nr:
+  case X86::BI__builtin_ia32_sqrtps512_mask_nr: {
+Function *F = CGM.getIntrinsic(Intrinsic::sqrt, Ops[0]->getType());

I would suggest just using __builtin_i32_sqrtpd512_mask here and select 
different intrinsics based on the value of the rounding mode operand. The user 
should get the same behavior if they use the explicit rounding mode intrinsic, 
but pass CUR_DIRECTION.


https://reviews.llvm.org/D41168



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


r320613 - [OPENMP] Add codegen for `nowait` clause in target directives.

2017-12-13 Thread Alexey Bataev via cfe-commits
Author: abataev
Date: Wed Dec 13 13:04:20 2017
New Revision: 320613

URL: http://llvm.org/viewvc/llvm-project?rev=320613=rev
Log:
[OPENMP] Add codegen for `nowait` clause in target directives.

Added basic codegen for `nowait` clauses in target-based directives.

Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
cfe/trunk/test/OpenMP/target_codegen.cpp
cfe/trunk/test/OpenMP/target_parallel_codegen.cpp
cfe/trunk/test/OpenMP/target_parallel_for_codegen.cpp
cfe/trunk/test/OpenMP/target_parallel_for_simd_codegen.cpp
cfe/trunk/test/OpenMP/target_simd_codegen.cpp
cfe/trunk/test/OpenMP/target_teams_codegen.cpp
cfe/trunk/test/OpenMP/target_teams_distribute_codegen.cpp
cfe/trunk/test/OpenMP/target_teams_distribute_simd_codegen.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=320613=320612=320613=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Wed Dec 13 13:04:20 
2017
@@ -8852,9 +8852,9 @@ def err_omp_function_expected : Error<
 def err_omp_wrong_cancel_region : Error<
   "one of 'for', 'parallel', 'sections' or 'taskgroup' is expected">;
 def err_omp_parent_cancel_region_nowait : Error<
-  "parent region for 'omp %select{cancellation point/cancel}0' construct 
cannot be nowait">;
+  "parent region for 'omp %select{cancellation point|cancel}0' construct 
cannot be nowait">;
 def err_omp_parent_cancel_region_ordered : Error<
-  "parent region for 'omp %select{cancellation point/cancel}0' construct 
cannot be ordered">;
+  "parent region for 'omp %select{cancellation point|cancel}0' construct 
cannot be ordered">;
 def err_omp_reduction_wrong_type : Error<"reduction type cannot be 
%select{qualified with 'const', 'volatile' or 'restrict'|a function|a 
reference|an array}0 type">;
 def err_omp_wrong_var_in_declare_reduction : Error<"only %select{'omp_priv' or 
'omp_orig'|'omp_in' or 'omp_out'}0 variables are allowed in 
%select{initializer|combiner}0 expression">;
 def err_omp_declare_reduction_redefinition : Error<"redefinition of 
user-defined reduction for type %0">;

Modified: cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp?rev=320613=320612=320613=diff
==
--- cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp Wed Dec 13 13:04:20 2017
@@ -672,10 +672,18 @@ enum OpenMPRTLFunction {
   // arg_num, void** args_base, void **args, size_t *arg_sizes, int64_t
   // *arg_types);
   OMPRTL__tgt_target,
+  // Call to int32_t __tgt_target_nowait(int64_t device_id, void *host_ptr,
+  // int32_t arg_num, void** args_base, void **args, size_t *arg_sizes, int64_t
+  // *arg_types);
+  OMPRTL__tgt_target_nowait,
   // Call to int32_t __tgt_target_teams(int64_t device_id, void *host_ptr,
   // int32_t arg_num, void** args_base, void **args, size_t *arg_sizes, int64_t
   // *arg_types, int32_t num_teams, int32_t thread_limit);
   OMPRTL__tgt_target_teams,
+  // Call to int32_t __tgt_target_teams_nowait(int64_t device_id, void
+  // *host_ptr, int32_t arg_num, void** args_base, void **args, size_t
+  // *arg_sizes, int64_t *arg_types, int32_t num_teams, int32_t thread_limit);
+  OMPRTL__tgt_target_teams_nowait,
   // Call to void __tgt_register_lib(__tgt_bin_desc *desc);
   OMPRTL__tgt_register_lib,
   // Call to void __tgt_unregister_lib(__tgt_bin_desc *desc);
@@ -2042,6 +2050,22 @@ CGOpenMPRuntime::createRuntimeFunction(u
 RTLFn = CGM.CreateRuntimeFunction(FnTy, "__tgt_target");
 break;
   }
+  case OMPRTL__tgt_target_nowait: {
+// Build int32_t __tgt_target_nowait(int64_t device_id, void *host_ptr,
+// int32_t arg_num, void** args_base, void **args, size_t *arg_sizes,
+// int64_t *arg_types);
+llvm::Type *TypeParams[] = {CGM.Int64Ty,
+CGM.VoidPtrTy,
+CGM.Int32Ty,
+CGM.VoidPtrPtrTy,
+CGM.VoidPtrPtrTy,
+CGM.SizeTy->getPointerTo(),
+CGM.Int64Ty->getPointerTo()};
+llvm::FunctionType *FnTy =
+llvm::FunctionType::get(CGM.Int32Ty, TypeParams, /*isVarArg*/ false);
+RTLFn = CGM.CreateRuntimeFunction(FnTy, "__tgt_target_nowait");
+break;
+  }
   case OMPRTL__tgt_target_teams: {
 // Build int32_t __tgt_target_teams(int64_t device_id, void *host_ptr,
 // int32_t arg_num, void** args_base, void **args, size_t *arg_sizes,
@@ -2060,6 +2084,24 @@ CGOpenMPRuntime::createRuntimeFunction(u
 RTLFn = CGM.CreateRuntimeFunction(FnTy, 

[PATCH] D41102: Setup clang-doc frontend framework

2017-12-13 Thread Julie Hockett via Phabricator via cfe-commits
juliehockett added inline comments.



Comment at: tools/clang-doc/ClangDocReporter.cpp:171
+  CurrentCI->Name = getCommandName(C->getCommandID());
+  for (unsigned i = 0, e = C->getNumArgs(); i > e; ++i)
+CurrentCI->Args.push_back(C->getArgText(i));

JonasToth wrote:
> Now I have a question :)
> 
> the condition `i > e` seems odd to me. `i == 0` in the first iteration and i 
> expect `e > 0` so this loop should never execute or did I oversee something?
> 
> Same below
Oops my bad -- you're right. Same above/below.


https://reviews.llvm.org/D41102



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


[PATCH] D41102: Setup clang-doc frontend framework

2017-12-13 Thread Julie Hockett via Phabricator via cfe-commits
juliehockett updated this revision to Diff 126814.
juliehockett marked 5 inline comments as done.
juliehockett added a comment.

Fixing typos


https://reviews.llvm.org/D41102

Files:
  tools/CMakeLists.txt
  tools/clang-doc/CMakeLists.txt
  tools/clang-doc/ClangDoc.cpp
  tools/clang-doc/ClangDoc.h
  tools/clang-doc/ClangDocReporter.cpp
  tools/clang-doc/ClangDocReporter.h
  tools/clang-doc/tool/CMakeLists.txt
  tools/clang-doc/tool/ClangDocMain.cpp

Index: tools/clang-doc/tool/ClangDocMain.cpp
===
--- /dev/null
+++ tools/clang-doc/tool/ClangDocMain.cpp
@@ -0,0 +1,69 @@
+//===-- ClangDocMain.cpp - Clangdoc -*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "ClangDoc.h"
+#include "clang/Driver/Options.h"
+#include "clang/Frontend/FrontendActions.h"
+#include "clang/Tooling/CommonOptionsParser.h"
+#include "clang/Tooling/Tooling.h"
+#include "llvm/Support/Process.h"
+#include "llvm/Support/Signals.h"
+#include 
+
+using namespace clang;
+using namespace llvm;
+
+namespace {
+
+cl::OptionCategory ClangDocCategory("clang-doc options");
+
+cl::opt
+EmitLLVM("emit-llvm",
+ cl::desc("Output in LLVM bitstream format (default is YAML)."),
+ cl::init(false), cl::cat(ClangDocCategory));
+
+cl::opt
+DoxygenOnly("doxygen",
+cl::desc("Use only doxygen-style comments to generate docs."),
+cl::init(false), cl::cat(ClangDocCategory));
+
+} // namespace
+
+int main(int argc, const char **argv) {
+  sys::PrintStackTraceOnErrorSignal(argv[0]);
+  tooling::CommonOptionsParser OptionsParser(argc, argv, ClangDocCategory);
+
+  doc::OutFormat EmitFormat;
+  EmitLLVM ? EmitFormat = clang::doc::OutFormat::LLVM
+   : EmitFormat = clang::doc::OutFormat::YAML;
+
+  // TODO: Update the source path list to only consider changed files for
+  // incremental doc updates
+  doc::ClangDocReporter Reporter(OptionsParser.getSourcePathList());
+  doc::ClangDocContext Context{EmitFormat};
+
+  tooling::ClangTool Tool(OptionsParser.getCompilations(),
+  OptionsParser.getSourcePathList());
+
+  if (!DoxygenOnly)
+Tool.appendArgumentsAdjuster(tooling::getInsertArgumentAdjuster(
+"-fparse-all-comments", tooling::ArgumentInsertPosition::BEGIN));
+
+  doc::ClangDocActionFactory Factory(Context, Reporter);
+
+  outs() << "Parsing codebase...\n";
+  int Status = Tool.run();
+  if (Status)
+return Status;
+
+  outs() << "Writing docs...\n";
+  Reporter.Serialize(EmitFormat, outs());
+
+  return 0;
+}
Index: tools/clang-doc/tool/CMakeLists.txt
===
--- /dev/null
+++ tools/clang-doc/tool/CMakeLists.txt
@@ -0,0 +1,18 @@
+include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..)
+
+add_clang_executable(clang-doc
+  ClangDocMain.cpp
+  )
+
+target_link_libraries(clang-doc
+  PRIVATE
+  clangAST
+  clangASTMatchers
+  clangBasic
+  clangFormat
+  clangFrontend
+  clangDoc
+  clangRewrite
+  clangTooling
+  clangToolingCore
+  )
Index: tools/clang-doc/ClangDocReporter.h
===
--- /dev/null
+++ tools/clang-doc/ClangDocReporter.h
@@ -0,0 +1,117 @@
+//===-- Doc.cpp - ClangDoc --*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_DOC_CLANG_DOC_REPORTER_H
+#define LLVM_CLANG_TOOLS_EXTRA_CLANG_DOC_CLANG_DOC_REPORTER_H
+
+#include "clang/AST/AST.h"
+#include "clang/AST/ASTConsumer.h"
+#include "clang/AST/ASTContext.h"
+#include "clang/AST/CommentVisitor.h"
+#include "clang/AST/RecursiveASTVisitor.h"
+#include "clang/Frontend/ASTConsumers.h"
+#include "clang/Frontend/FrontendActions.h"
+#include "clang/Tooling/Tooling.h"
+#include "llvm/ADT/SmallVector.h"
+#include "llvm/Support/raw_ostream.h"
+#include 
+#include 
+#include 
+#include 
+
+using namespace clang::comments;
+
+namespace clang {
+namespace doc {
+
+enum class OutFormat { YAML, LLVM };
+
+struct StringPair {
+  std::string Key;
+  std::string Value;
+};
+
+struct CommentInfo {
+  std::string Kind;
+  std::string Text;
+  std::string Name;
+  std::string Direction;
+  std::string ParamName;
+  std::string CloseName;
+  bool SelfClosing = false;
+  bool Explicit = false;
+  llvm::StringMap Attrs;
+  llvm::SmallVector Args;
+  llvm::SmallVector Position;
+  std::vector Children;
+};
+
+// TODO: collect declarations of the same 

[PATCH] D41195: [ClangFormat] IndentWrappedFunctionNames should be true in the google ObjC style

2017-12-13 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton created this revision.
benhamilton added reviewers: krasimir, djasper, klimek.
Herald added a subscriber: cfe-commits.

If we write the following code, it goes over 100 columns, so we need to wrap it:

- 
(VeryLongReturnTypeName)veryLongMethodParameter:(VeryLongParameterName)thisIsAVeryLongParameterName
 longMethodParameter:(LongParameterName)thisIsAlsoAnotherLongParameterName;

Currently, clang-format with the google style aligns the method parameter names 
on the first column:

- (VeryLongReturnTypeName)

veryLongMethodParameter:(VeryLongParameterName)thisIsAVeryLongParameterName

  longMethodParameter:(LongParameterName)thisIsAlsoAnotherLongParameterName;

We'd like clang-format in the google style to align these to column 4 for 
Objective-C:

- (VeryLongReturnTypeName) 
veryLongMethodParameter:(VeryLongParameterName)thisIsAVeryLongParameterName 
longMethodParameter:(LongParameterName)thisIsAlsoAnotherLongParameterName;

Test Plan: make -j12 FormatTests && ./tools/clang/unittests/Format/FormatTests


Repository:
  rC Clang

https://reviews.llvm.org/D41195

Files:
  lib/Format/Format.cpp
  unittests/Format/FormatTestObjC.cpp


Index: unittests/Format/FormatTestObjC.cpp
===
--- unittests/Format/FormatTestObjC.cpp
+++ unittests/Format/FormatTestObjC.cpp
@@ -229,6 +229,7 @@
   verifyFormat("@interface Foo (HackStuff)\n"
"+ (id)init;\n"
"@end");
+
   Style.BinPackParameters = false;
   Style.ColumnLimit = 80;
   verifyFormat("@interface a ()<\n"
@@ -382,9 +383,15 @@
"ofSize:(size_t)height\n"
"  :(size_t)width;");
 
+  Style = getGoogleStyle(FormatStyle::LK_ObjC);
+  // Wrapped method parameters should be indented.
+  verifyFormat("- (VeryLongReturnTypeName)\n"
+   "veryLongMethodParameter:(VeryLongParameterName)"
+   "thisIsAVeryLongParameterName\n"
+   "longMethodParameter:(LongParameterName)"
+   "thisIsAlsoAnotherLongParameterName;");
   // Continuation indent width should win over aligning colons if the function
   // name is long.
-  Style = getGoogleStyle(FormatStyle::LK_ObjC);
   Style.ColumnLimit = 40;
   Style.IndentWrappedFunctionNames = true;
   verifyFormat("- (void)shortf:(GTMFoo *)theFoo\n"
Index: lib/Format/Format.cpp
===
--- lib/Format/Format.cpp
+++ lib/Format/Format.cpp
@@ -732,6 +732,7 @@
 GoogleStyle.SpacesInContainerLiterals = false;
   } else if (Language == FormatStyle::LK_ObjC) {
 GoogleStyle.ColumnLimit = 100;
+GoogleStyle.IndentWrappedFunctionNames = true;
   }
 
   return GoogleStyle;


Index: unittests/Format/FormatTestObjC.cpp
===
--- unittests/Format/FormatTestObjC.cpp
+++ unittests/Format/FormatTestObjC.cpp
@@ -229,6 +229,7 @@
   verifyFormat("@interface Foo (HackStuff)\n"
"+ (id)init;\n"
"@end");
+
   Style.BinPackParameters = false;
   Style.ColumnLimit = 80;
   verifyFormat("@interface a ()<\n"
@@ -382,9 +383,15 @@
"ofSize:(size_t)height\n"
"  :(size_t)width;");
 
+  Style = getGoogleStyle(FormatStyle::LK_ObjC);
+  // Wrapped method parameters should be indented.
+  verifyFormat("- (VeryLongReturnTypeName)\n"
+   "veryLongMethodParameter:(VeryLongParameterName)"
+   "thisIsAVeryLongParameterName\n"
+   "longMethodParameter:(LongParameterName)"
+   "thisIsAlsoAnotherLongParameterName;");
   // Continuation indent width should win over aligning colons if the function
   // name is long.
-  Style = getGoogleStyle(FormatStyle::LK_ObjC);
   Style.ColumnLimit = 40;
   Style.IndentWrappedFunctionNames = true;
   verifyFormat("- (void)shortf:(GTMFoo *)theFoo\n"
Index: lib/Format/Format.cpp
===
--- lib/Format/Format.cpp
+++ lib/Format/Format.cpp
@@ -732,6 +732,7 @@
 GoogleStyle.SpacesInContainerLiterals = false;
   } else if (Language == FormatStyle::LK_ObjC) {
 GoogleStyle.ColumnLimit = 100;
+GoogleStyle.IndentWrappedFunctionNames = true;
   }
 
   return GoogleStyle;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D41148: [libcxx] implement declarations based on P0214R7.

2017-12-13 Thread Tim Shen via Phabricator via cfe-commits
timshen marked 4 inline comments as done.
timshen added inline comments.



Comment at: libcxx/include/experimental/simd:1069
+std::is_same<_Abi, simd_abi::fixed_size>::value &&
+__is_non_narrowing_convertible<_Up, _Tp>()>::type>
+  simd(const simd<_Up, simd_abi::fixed_size>&) {}

lichray wrote:
> Does it causes a problem if the logic of `is_convertible` is folded into 
> `__is_non_narrowing_convertible`?
Avoided to answer this question by sfinae on is_arithmetic.


https://reviews.llvm.org/D41148



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


[PATCH] D41148: [libcxx] implement declarations based on P0214R7.

2017-12-13 Thread Tim Shen via Phabricator via cfe-commits
timshen updated this revision to Diff 126813.
timshen added a comment.

Address comments:

- Generator ctor is implementable
- Format issues of tests
- SFINAE on __is_non_narrowing_convertible for arithmetics only.


https://reviews.llvm.org/D41148

Files:
  libcxx/include/experimental/simd
  libcxx/test/std/experimental/simd/ctor.pass.cpp
  libcxx/test/std/experimental/simd/nothing_to_do.pass.cpp
  libcxx/test/std/experimental/simd/simd_cast.pass.cpp
  libcxx/test/std/experimental/simd/traits.pass.cpp

Index: libcxx/test/std/experimental/simd/traits.pass.cpp
===
--- /dev/null
+++ libcxx/test/std/experimental/simd/traits.pass.cpp
@@ -0,0 +1,179 @@
+//===--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+
+// UNSUPPORTED: c++98, c++03
+
+// 
+//
+// [simd.traits]
+// template  struct is_abi_tag;
+// template  inline constexpr bool is_abi_tag_v = is_abi_tag::value;
+// template  struct is_simd;
+// template  inline constexpr bool is_simd_v = is_simd::value;
+// template  struct is_simd_mask;
+// template  inline constexpr bool is_simd_mask_v = is_simd_mask::value;
+// template  struct is_simd_flag_type;
+// template  inline constexpr bool is_simd_flag_type_v = is_simd_flag_type::value;
+// template  struct abi_for_size { using type = see below ; };
+// template  using abi_for_size_t = typename abi_for_size::type;
+// template > struct simd_size;
+// template >
+// inline constexpr size_t simd_size_v = simd_size::value;
+// template  struct memory_alignment;
+// template 
+// inline constexpr size_t memory_alignment_v = memory_alignment::value;
+
+#include 
+#include 
+
+using namespace std::experimental::parallelism_v2;
+
+static_assert(is_abi_tag::value, "");
+static_assert(is_abi_tag::value, "");
+static_assert(is_abi_tag::value, "");
+static_assert(is_abi_tag::value, "");
+static_assert(is_abi_tag::value, "");
+static_assert(is_abi_tag::value, "");
+static_assert(is_abi_tag::value, "");
+static_assert(is_abi_tag::value, "");
+static_assert(is_abi_tag::value, "");
+static_assert(is_abi_tag::value, "");
+
+static_assert(is_abi_tag::value, "");
+static_assert(is_abi_tag::value, "");
+static_assert(is_abi_tag::value, "");
+static_assert(is_abi_tag::value, "");
+static_assert(is_abi_tag::value, "");
+static_assert(is_abi_tag::value, "");
+static_assert(is_abi_tag::value, "");
+static_assert(is_abi_tag::value, "");
+static_assert(is_abi_tag::value, "");
+static_assert(is_abi_tag::value, "");
+
+static_assert(is_abi_tag::value, "");
+static_assert(!std::is_same>::value,
+  "");
+
+static_assert(is_abi_tag>::value, "");
+static_assert(is_abi_tag>::value, "");
+static_assert(is_abi_tag>::value, "");
+static_assert(is_abi_tag>::value, "");
+static_assert(is_abi_tag>::value, "");
+static_assert(is_abi_tag>::value, "");
+
+static_assert(is_simd::value, "");
+static_assert(is_simd::value, "");
+static_assert(is_simd::value, "");
+static_assert(is_simd::value, "");
+static_assert(is_simd::value, "");
+static_assert(is_simd::value, "");
+static_assert(is_simd::value, "");
+static_assert(is_simd::value, "");
+static_assert(is_simd::value, "");
+static_assert(is_simd::value, "");
+
+static_assert(is_simd>::value, "");
+static_assert(is_simd>::value, "");
+static_assert(is_simd>::value, "");
+static_assert(is_simd>::value, "");
+static_assert(is_simd>::value, "");
+static_assert(is_simd>::value, "");
+static_assert(is_simd>::value, "");
+static_assert(is_simd>::value, "");
+static_assert(is_simd>::value, "");
+static_assert(is_simd>::value, "");
+
+static_assert(is_simd>::value, "");

[PATCH] D41073: Wasm: add support in libcxx

2017-12-13 Thread Dan Gohman via Phabricator via cfe-commits
sunfish added a comment.

Either way. I won't be able to get to it until next week, so feel free to land 
it earlier.


Repository:
  rCXX libc++

https://reviews.llvm.org/D41073



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


[PATCH] D41149: [CodeGen] Specialize mixed-sign mul-with-overflow (fix PR34920)

2017-12-13 Thread Eli Friedman via Phabricator via cfe-commits
efriedma added inline comments.



Comment at: test/CodeGen/builtins-overflow.c:402
+  int result;
+  if (__builtin_mul_overflow(y, x, ))
+return LongLongErrorCode;

I think the rules for __builtin_mul_overflow say you have to check whether the 
truncate changes the value of the result.

Missing testcases for the case where the result is unsigned.


https://reviews.llvm.org/D41149



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


[PATCH] D40478: Added Instrument Control Flow Flag

2017-12-13 Thread Craig Topper via Phabricator via cfe-commits
craig.topper added inline comments.



Comment at: include/clang/Driver/Options.td:1035
   HelpText<"Instrument function entry only, after inlining, without arguments 
to the instrumentation call">;
-
+def finstrument_control_flow : Flag<["-"], "finstrument-control-flow">,
+  Group, Flags<[CC1Option]>,

pcc wrote:
> oren_ben_simhon wrote:
> > pcc wrote:
> > > oren_ben_simhon wrote:
> > > > pcc wrote:
> > > > > oren_ben_simhon wrote:
> > > > > > pcc wrote:
> > > > > > > My comments about the attribute name in D40482 also apply to this 
> > > > > > > flag name. GCC appears to have chosen a better name for this 
> > > > > > > flag, `-mcet`. Can we use that name instead?
> > > > > > Again, I am sorry for the late response, I was off for about a week.
> > > > > > GCC is only using -mcet as a super set for -mibt and -mshstk. I am 
> > > > > > planning to add it in a different review.
> > > > > > -mcet/-mibt/-mshstk only enables the HW technology (ISA/Intrinsics).
> > > > > > GCC is using -cf-protection for actually instrumenting the control 
> > > > > > flow.
> > > > > > I think it will be best to stay coherent with GCC (and ICC and soon 
> > > > > > MS) and use -cf-protection.
> > > > > > What do you think?
> > > > > I see. As far as I can tell, there are no released versions of GCC 
> > > > > and ICC with the new flags, so I think there is still a possibility 
> > > > > to change them. (MS is a different story, their flags are 
> > > > > incompatible anyway.)
> > > > > 
> > > > > I took a closer look at what GCC does, and here are my thoughts:
> > > > > - As far as I can tell, IBT does not introduce any new instructions 
> > > > > other than ENDBRANCH, and it doesn't seem to make sense for ENDBRANCH 
> > > > > to be exposed via intrinsics (but rather via attributes, as you have 
> > > > > done). That means that `-mibt` basically does nothing except for 
> > > > > allowing the use of `-fcf-protection`.
> > > > > - SHSTK introduces ISA extensions that seem reasonable to expose via 
> > > > > intrinsics, so it would probably be fine to have a `-mshstk` flag 
> > > > > that enables the intrinsics.
> > > > > - In GCC, `-fcf-protection` means "emit code that is compatible with 
> > > > > CET" and requires that the user pass `-mibt` or `-mshstk`. But the 
> > > > > code that it emits is also compatible with non-CET processors, so it 
> > > > > doesn't make sense to me to require the use of flags such as 
> > > > > `-mshstk` which imply that SHSTK is required.
> > > > > 
> > > > > As for the name of the flag: there is nothing about the name 
> > > > > `-fcf-protection` that implies hardware-based protection, so the 
> > > > > presence of this flag could confuse users who want software-based 
> > > > > protection. The hardware-based protection is sort of implied by the 
> > > > > requirement to pass `-mibt` or `-mshstk`, but that is a little 
> > > > > awkward, and I don't think it makes sense either for the reasons I 
> > > > > mentioned. What we want is a clear way to say "I want to generate 
> > > > > code that is compatible with (but does not require) this hardware 
> > > > > feature", but there doesn't seem to be any precedent for how to 
> > > > > express that. The most straightforward way to express it is to 
> > > > > mention the name of the hardware feature in the flag.
> > > > > 
> > > > > So here are the changes that I would propose across compilers:
> > > > > - Remove the `-mibt` flag.
> > > > > - Change the flag that emits ENDBRANCH to something like 
> > > > > `-mcet-compatible` and stop requiring the use of other flags.
> > > > > Please let me know what you think.
> > > > It is true that -mibt doesn't enable intrinsics however it is required 
> > > > for the case of inline asm.
> > > > The code that -cf-protection produce is not always compatible with 
> > > > non-CET processors.
> > > > For example, consider the required fix to the shadow stack in the case 
> > > > of setJmp/longJmp. 
> > > > In that case, we need to use SHSTK instructions (like incssp) that are 
> > > > not compatible.
> > > > Would the flag -fcf-arch-protection make more sense (as it implies on 
> > > > HW support)?
> > > > It is true that -mibt doesn't enable intrinsics however it is required 
> > > > for the case of inline asm.
> > > 
> > > For enabling ENDBRANCH in inline asm? Would there be any harm in allowing 
> > > ENDBRANCH unconditionally?
> > > 
> > > > For example, consider the required fix to the shadow stack in the case 
> > > > of setJmp/longJmp.
> > > > In that case, we need to use SHSTK instructions (like incssp) that are 
> > > > not compatible.
> > > 
> > > I don't think that is true. I looked at the code that GCC emits for 
> > > `setjmp` and `longjmp`, and it appears to quite cleverly avoid the need 
> > > to execute SHSTK-required instructions on older processors by taking 
> > > advantage of the fact that RDSSP is a NOP on older processors.
> > > 
> > > With this program:
> > > 

[PATCH] D40775: [libcxx] Add underscores to win32 locale headers.

2017-12-13 Thread Andrey Khalyavin via Phabricator via cfe-commits
halyavin added a comment.

@EricWF , could you please look at this change? It doesn't have any functional 
changes.


https://reviews.llvm.org/D40775



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


[PATCH] D41074: [ClangFormat] ObjCSpaceBeforeProtocolList should be true in the google style

2017-12-13 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton updated this revision to Diff 126806.
benhamilton added a comment.
Herald added a subscriber: klimek.

Rebase


Repository:
  rC Clang

https://reviews.llvm.org/D41074

Files:
  lib/Format/Format.cpp
  unittests/Format/FormatTestObjC.cpp


Index: unittests/Format/FormatTestObjC.cpp
===
--- unittests/Format/FormatTestObjC.cpp
+++ unittests/Format/FormatTestObjC.cpp
@@ -211,7 +211,7 @@
"@end");
 
   Style = getGoogleStyle(FormatStyle::LK_ObjC);
-  verifyFormat("@interface Foo : NSObject {\n"
+  verifyFormat("@interface Foo : NSObject  {\n"
" @public\n"
"  int field1;\n"
" @protected\n"
@@ -223,15 +223,15 @@
"}\n"
"+ (id)init;\n"
"@end");
-  verifyFormat("@interface Foo : Bar\n"
+  verifyFormat("@interface Foo : Bar \n"
"+ (id)init;\n"
"@end");
-  verifyFormat("@interface Foo (HackStuff)\n"
+  verifyFormat("@interface Foo (HackStuff) \n"
"+ (id)init;\n"
"@end");
   Style.BinPackParameters = false;
   Style.ColumnLimit = 80;
-  verifyFormat("@interface a ()<\n"
+  verifyFormat("@interface a () <\n"
"a,\n"
",\n"
"aa,\n"
@@ -354,7 +354,7 @@
"@end");
 
   Style = getGoogleStyle(FormatStyle::LK_ObjC);
-  verifyFormat("@protocol MyProtocol\n"
+  verifyFormat("@protocol MyProtocol \n"
"- (NSUInteger)numberOfThings;\n"
"@end");
 }
Index: lib/Format/Format.cpp
===
--- lib/Format/Format.cpp
+++ lib/Format/Format.cpp
@@ -693,7 +693,7 @@
   GoogleStyle.IndentCaseLabels = true;
   GoogleStyle.KeepEmptyLinesAtTheStartOfBlocks = false;
   GoogleStyle.ObjCSpaceAfterProperty = false;
-  GoogleStyle.ObjCSpaceBeforeProtocolList = false;
+  GoogleStyle.ObjCSpaceBeforeProtocolList = true;
   GoogleStyle.PointerAlignment = FormatStyle::PAS_Left;
   GoogleStyle.SpacesBeforeTrailingComments = 2;
   GoogleStyle.Standard = FormatStyle::LS_Auto;


Index: unittests/Format/FormatTestObjC.cpp
===
--- unittests/Format/FormatTestObjC.cpp
+++ unittests/Format/FormatTestObjC.cpp
@@ -211,7 +211,7 @@
"@end");
 
   Style = getGoogleStyle(FormatStyle::LK_ObjC);
-  verifyFormat("@interface Foo : NSObject {\n"
+  verifyFormat("@interface Foo : NSObject  {\n"
" @public\n"
"  int field1;\n"
" @protected\n"
@@ -223,15 +223,15 @@
"}\n"
"+ (id)init;\n"
"@end");
-  verifyFormat("@interface Foo : Bar\n"
+  verifyFormat("@interface Foo : Bar \n"
"+ (id)init;\n"
"@end");
-  verifyFormat("@interface Foo (HackStuff)\n"
+  verifyFormat("@interface Foo (HackStuff) \n"
"+ (id)init;\n"
"@end");
   Style.BinPackParameters = false;
   Style.ColumnLimit = 80;
-  verifyFormat("@interface a ()<\n"
+  verifyFormat("@interface a () <\n"
"a,\n"
",\n"
"aa,\n"
@@ -354,7 +354,7 @@
"@end");
 
   Style = getGoogleStyle(FormatStyle::LK_ObjC);
-  verifyFormat("@protocol MyProtocol\n"
+  verifyFormat("@protocol MyProtocol \n"
"- (NSUInteger)numberOfThings;\n"
"@end");
 }
Index: lib/Format/Format.cpp
===
--- lib/Format/Format.cpp
+++ lib/Format/Format.cpp
@@ -693,7 +693,7 @@
   GoogleStyle.IndentCaseLabels = true;
   GoogleStyle.KeepEmptyLinesAtTheStartOfBlocks = false;
   GoogleStyle.ObjCSpaceAfterProperty = false;
-  GoogleStyle.ObjCSpaceBeforeProtocolList = false;
+  GoogleStyle.ObjCSpaceBeforeProtocolList = true;
   GoogleStyle.PointerAlignment = FormatStyle::PAS_Left;
   GoogleStyle.SpacesBeforeTrailingComments = 2;
   GoogleStyle.Standard = FormatStyle::LS_Auto;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D39133: [Sema] Better fix for tags defined inside an enumeration (PR28903).

2017-12-13 Thread Volodymyr Sapsai via Phabricator via cfe-commits
vsapsai added a comment.

Ping. The change can be still applied on trunk without changes, all tests are 
passing.


https://reviews.llvm.org/D39133



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


[PATCH] D39074: [libunwind][MIPS]: Add support for unwinding in N32 processes.

2017-12-13 Thread Simon Dardis via Phabricator via cfe-commits
sdardis added inline comments.



Comment at: include/__libunwind_config.h:73
+#  elif defined(_ABIN32) && defined(__mips_soft_float)
+#define _LIBUNWIND_TARGET_MIPS_NEWABI 1
+#define _LIBUNWIND_CONTEXT_SIZE 35

compnerd wrote:
> Minor nit: I prefer either `NABI` or `NEW_ABI`.
Normally mips documentation/source code either spells out n32/n64 when 
referring to the 64 bit abis or calls it a variation of NewABI/newabi/NEWABI 
(all one word).



Comment at: src/Registers.hpp:2252-2253
+#if defined(_LIBUNWIND_TARGET_MIPS_NEWABI)
+/// Registers_mips_newabi holds the register state of a thread in a NEWABI
+/// MIPS process including both the N32 and N64 ABIs.
+class _LIBUNWIND_HIDDEN Registers_mips_newabi {

Nit on the wording:

Registers_mips_newabi holds the register state of a thread in a NEWABI MIPS 
process including both the N32 and N64 ABIs. ->

Registers_mips_newabi holds the register state of a thread in a MIPS process 
using NEWABI (the N32 or N64 ABIs).


https://reviews.llvm.org/D39074



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


[PATCH] D33776: [libcxx] LWG2221: No formatted output operator for nullptr

2017-12-13 Thread Agustín Bergé via Phabricator via cfe-commits
K-ballo added inline comments.



Comment at: include/ostream:225
+basic_ostream& operator<<(nullptr_t)
+{ return *this << (const void*)0; }
+

Quuxplusone wrote:
> mclow.lists wrote:
> > lichray wrote:
> > > Oh, common, I persuaded the committee to allow you to print a `(null)`  
> > > and you don't do it...
> > I think that `(null)` is a better thing to output here than `0x0`.
> Are you two implying that
> 
> *this << (const void *)0;
> 
> does *not* print `(null)`? It certainly should, IMO. (I mean, it'll call 
> `num_put` for `void*` in the current locale, but I would naturally expect 
> that to print `(null)`.)
> Anyway, whether the current locale prints null as `(null)` or not, there is 
> great potential utility in using the same format for all pointers, as K-ballo 
> is doing here. I'd really like to be able to
> 
> std::ostringstream oss;
> oss << nullptr;  // equivalently: oss << (void*)0;
> void *p;
> std::istringstream(oss.str()) >> p;  // should read in a null pointer, 
> not derp out
> 
> FWIW, it looks like libc++ currently *does* print null pointers as `(nil)`, 
> which is not quite the same thing as `(null)`. libstdc++ prints them as `0`.
> https://wandbox.org/permlink/yAM6tjMzvEX9HhhE
It's been a while now, but I seem to recall that the reason we settled on 
`(*this) << (const void*)0` was precisely so that it would go through 
`num_put`, as the rest of the pointers do. As I read back on the specification, 
however, I am no longer sure that such an implementation is conforming. Maybe 
if we were to call the facet directly...

I am no longer interested in this issue. If anyone wants to take over control I 
would be happy to yield it; otherwise, I'll implement whatever I'm instructed 
to.


https://reviews.llvm.org/D33776



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


[PATCH] D41073: Wasm: add support in libcxx

2017-12-13 Thread Sam Clegg via Phabricator via cfe-commits
sbc100 added a comment.

Do you want to land this dan?  Or I can if you prefer.


Repository:
  rCXX libc++

https://reviews.llvm.org/D41073



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


[PATCH] D40813: [clang-tidy] Adding Fuchsia checker for virtual inheritance

2017-12-13 Thread Julie Hockett via Phabricator via cfe-commits
juliehockett added inline comments.



Comment at: test/clang-tidy/fuchsia-virtual-inheritance.cpp:34-36
+  // CHECK-MESSAGES: [[@LINE-1]]:28: warning: constructing a class that 
inherits a virtual base class is disallowed [fuchsia-virtual-inheritance]
+  // CHECK-NEXT:  D(int value) : A(value), B(), C() {}
+  // CHECK-MESSAGES: [[@LINE-3]]:33: warning: constructing a class that 
inherits a virtual base class is disallowed [fuchsia-virtual-inheritance]

aaron.ballman wrote:
> I'm also not certain this should be diagnosed either. It's technically 
> correct because it's calling the base class constructors here, but at the 
> same time, it seems very low-value and likely to cause the user to do 
> something really bad, like silence the warning by not calling the base class 
> constructors.
I see what you mean, but where then would you draw the line between warning and 
not? We could warn for construction everywhere except in initialization lists, 
but that seems like it might open the door to trivially get around the check in 
ways that should be disallowed.


https://reviews.llvm.org/D40813



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


[PATCH] D40813: [clang-tidy] Adding Fuchsia checker for virtual inheritance

2017-12-13 Thread Julie Hockett via Phabricator via cfe-commits
juliehockett updated this revision to Diff 126804.
juliehockett marked an inline comment as done.
juliehockett added a comment.

Updated matcher to only match direct virtual base classes.


https://reviews.llvm.org/D40813

Files:
  clang-tidy/fuchsia/CMakeLists.txt
  clang-tidy/fuchsia/FuchsiaTidyModule.cpp
  clang-tidy/fuchsia/VirtualInheritanceCheck.cpp
  clang-tidy/fuchsia/VirtualInheritanceCheck.h
  docs/ReleaseNotes.rst
  docs/clang-tidy/checks/fuchsia-virtual-inheritance.rst
  docs/clang-tidy/checks/list.rst
  test/clang-tidy/fuchsia-virtual-inheritance.cpp

Index: test/clang-tidy/fuchsia-virtual-inheritance.cpp
===
--- /dev/null
+++ test/clang-tidy/fuchsia-virtual-inheritance.cpp
@@ -0,0 +1,50 @@
+// RUN: %check_clang_tidy %s fuchsia-virtual-inheritance %t
+
+class A {
+public:
+  A(int value) : val(value) {}
+
+  int do_A() { return val; }
+
+private:
+  int val;
+};
+
+class B : public virtual A {
+  // CHECK-MESSAGES: [[@LINE-1]]:1: warning: direct virtual inheritance is disallowed [fuchsia-virtual-inheritance]
+  // CHECK-NEXT: class B : public virtual A {
+public:
+  B() : A(0) {}
+  int do_B() { return 1 + do_A(); }
+};
+
+class C : public virtual A {
+  // CHECK-MESSAGES: [[@LINE-1]]:1: warning: direct virtual inheritance is disallowed [fuchsia-virtual-inheritance]
+  // CHECK-NEXT: class C : public virtual A {
+public:
+  C() : A(0) {}
+  int do_C() { return 2 + do_A(); }
+};
+
+class D : public B, public C {
+public:
+  D(int value) : A(value), B(), C() {}
+  // CHECK-MESSAGES: [[@LINE-1]]:28: warning: constructing a class that directly inherits a virtual base class is disallowed [fuchsia-virtual-inheritance]
+  // CHECK-NEXT:  D(int value) : A(value), B(), C() {}
+  // CHECK-MESSAGES: [[@LINE-3]]:33: warning: constructing a class that directly inherits a virtual base class is disallowed [fuchsia-virtual-inheritance]
+  // CHECK-NEXT:  D(int value) : A(value), B(), C() {}
+
+  int do_D() { return do_A() + do_B() + do_C(); }
+};
+
+int main() {
+  A *a = new A(0);
+  B *b = new B();
+  // CHECK-MESSAGES: [[@LINE-1]]:14: warning: constructing a class that directly inherits a virtual base class is disallowed [fuchsia-virtual-inheritance]
+  // CHECK-NEXT:  B *b = new B();
+  C *c = new C();
+  // CHECK-MESSAGES: [[@LINE-1]]:14: warning: constructing a class that directly inherits a virtual base class is disallowed [fuchsia-virtual-inheritance]
+  // CHECK-NEXT:  C *c = new C();
+  D *d = new D(0);
+  return 0;
+}
Index: docs/clang-tidy/checks/list.rst
===
--- docs/clang-tidy/checks/list.rst
+++ docs/clang-tidy/checks/list.rst
@@ -69,6 +69,7 @@
cppcoreguidelines-slicing
cppcoreguidelines-special-member-functions
fuchsia-default-arguments
+   fuchsia-virtual-inheritance
google-build-explicit-make-pair
google-build-namespaces
google-build-using-namespace
Index: docs/clang-tidy/checks/fuchsia-virtual-inheritance.rst
===
--- /dev/null
+++ docs/clang-tidy/checks/fuchsia-virtual-inheritance.rst
@@ -0,0 +1,20 @@
+.. title:: clang-tidy - fuchsia-virtual-inheritance
+
+fuchsia-virtual-inheritance
+===
+
+Warns if classes are defined or created with virtual inheritance.
+
+For example, classes should not be defined with virtual inheritance:
+
+.. code-block:: c++
+
+  class B : public virtual A {};   // warning
+
+Classes with virtual inheritance should not be created:
+
+.. code-block:: c++
+
+  B *b = new B();   // warning
+
+See the features disallowed in Fuchsia at https://fuchsia.googlesource.com/zircon/+/master/docs/cxx.md
Index: docs/ReleaseNotes.rst
===
--- docs/ReleaseNotes.rst
+++ docs/ReleaseNotes.rst
@@ -134,7 +134,12 @@
   `_ check
 
   Warns if a function or method is declared or called with default arguments.
+  
+- New `fuchsia-virtual-inheritance
+  `_ check
 
+  Warns if classes are defined or created with virtual inheritance.
+
 - New `google-objc-avoid-throwing-exception
   `_ check
 
Index: clang-tidy/fuchsia/VirtualInheritanceCheck.h
===
--- /dev/null
+++ clang-tidy/fuchsia/VirtualInheritanceCheck.h
@@ -0,0 +1,35 @@
+//===--- VirtualInheritanceCheck.h - clang-tidy--*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#ifndef 

[PATCH] D41102: Setup clang-doc frontend framework

2017-12-13 Thread Jonas Toth via Phabricator via cfe-commits
JonasToth added inline comments.



Comment at: tools/clang-doc/ClangDocReporter.cpp:157
+  if (C->getNumAttrs() > 0) {
+for (unsigned i = 0, e = C->getNumAttrs(); i != e; ++i) {
+  const HTMLStartTagComment::Attribute  = C->getAttr(i);

minor nit: the loop condition is correct! when reading really fast one might 
overlook the if above and wonder if `i < e` might be better. but this is 
opinionated and just a suggestion.



Comment at: tools/clang-doc/ClangDocReporter.cpp:171
+  CurrentCI->Name = getCommandName(C->getCommandID());
+  for (unsigned i = 0, e = C->getNumArgs(); i > e; ++i)
+CurrentCI->Args.push_back(C->getArgText(i));

Now I have a question :)

the condition `i > e` seems odd to me. `i == 0` in the first iteration and i 
expect `e > 0` so this loop should never execute or did I oversee something?

Same below



Comment at: tools/clang-doc/ClangDocReporter.cpp:228
+  for (comments::Comment *Child :
+   llvm::make_range(C->child_begin(), C->child_end())) {
+CommentInfo ChildCI;

juliehockett wrote:
> JonasToth wrote:
> > Extract range into utility method of `Comment`
> See above -- `comments::Comment` is a clang type that stores all the 
> information about a particular piece of a comment -- the `CommentInfo` struct 
> is specific to the clang-doc setup. Is that what you're thinking about?
I was just thinking that creating this range here is clumsy. But if there is no 
way to fix that easily you can leave it as is. 

This means the suggested `Children` thing above is a non-issue is it? If yes 
just ignore my comments then :)



Comment at: tools/clang-doc/ClangDocReporter.h:51
+  llvm::SmallVector Position;
+  std::vector Children;
+};

juliehockett wrote:
> JonasToth wrote:
> > Here a short `children()` method return llvm::make_range shortens the code 
> > in a later loop and might benefit in the future for iterations over 
> > children.
> Is there a reason you wouldn't be able to just use `for (const CommentInfo  
> : CI.Children)` ? The later loop I believe you're referencing doesn't loop 
> over this struct, it looks at the children of a `comments::Comment` type.
Yes of course. But you can not enforce that the user of `Children` will not 
modify it. This is a struct with seemingly no constraints on its values meaning 
that would be ok.

If some values belong together and must work together and kept consistent and 
`const` method returning `const&` to `Children` might be better. Modfying 
`Children` can then be done via methods that ensure consistency between the 
values.


https://reviews.llvm.org/D41102



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


[PATCH] D39457: [OPENMP] Current status of OpenMP support.

2017-12-13 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev updated this revision to Diff 126800.
ABataev added a comment.

Status update


Repository:
  rC Clang

https://reviews.llvm.org/D39457

Files:
  docs/OpenMPSupport.rst
  docs/index.rst


Index: docs/index.rst
===
--- docs/index.rst
+++ docs/index.rst
@@ -39,6 +39,7 @@
SourceBasedCodeCoverage
Modules
MSVCCompatibility
+   OpenMPSupport
ThinLTO
CommandGuide/index
FAQ
Index: docs/OpenMPSupport.rst
===
--- /dev/null
+++ docs/OpenMPSupport.rst
@@ -0,0 +1,69 @@
+.. raw:: html
+
+  
+.none { background-color: #FF }
+.partial { background-color: #99 }
+.good { background-color: #CCFF99 }
+  
+
+.. role:: none
+.. role:: partial
+.. role:: good
+
+==
+OpenMP Support
+==
+
+Clang fully supports OpenMP 3.1 + some elements of OpenMP 4.5. Clang supports 
offloading to X86_64, AArch64, PPC64[LE] and Cuda devices.
+The status of major OpenMP 4.5 features support in Clang.
+
+Standalone directives
+=
+
+* #pragma omp [for] simd: :good:`Complete`.
+
+* #pragma omp declare simd: :partial:`Partial`.  We support parsing/semantic
+  analysis + generation of special attributes for X86 target, but still
+  missing the LLVM pass for vectorization.
+
+* #pragma omp taskloop [simd]: :good:`Complete`.
+
+* #pragma omp target [enter|exit] data: :good:`Mostly complete`.  Some rework 
is
+  required for better stability.
+
+* #pragma omp target update: :good:`Mostly complete`.  Some rework is
+  required for better stability.
+
+* #pragma omp target: :partial:`Partial`.  No support for the `nowait` and 
`depend` clauses.
+
+* #pragma omp declare target: :partial:`Partial`.  No full codegen support.
+
+* #pragma omp teams: :good:`Complete`.
+
+* #pragma omp distribute [simd]: :good:`Complete`.
+
+* #pragma omp distribute parallel for [simd]: :good:`Complete`.
+
+Combined directives
+===
+
+* #pragma omp parallel for simd: :good:`Complete`.
+
+* #pragma omp target parallel: :partial:`Partial`.  No support for the 
`nowait` and `depend` clauses.
+
+* #pragma omp target parallel for [simd]: :partial:`Partial`.  No support for 
the `nowait` and `depend` clauses.
+
+* #pragma omp target simd: :partial:`Partial`.  No support for the `nowait` 
and `depend` clauses.
+
+* #pragma omp target teams: :partial:`Partial`.  No support for the `nowait` 
and `depend` clauses.
+
+* #pragma omp teams distribute [simd]: :good:`Complete`.
+
+* #pragma omp target teams distribute [simd]: :partial:`Partial`.  No support 
for the `nowait` and `depend` clauses.
+
+* #pragma omp teams distribute parallel for [simd]: :good:`Complete`.
+
+* #pragma omp target teams distribute parallel for [simd]: :partial:`Partial`. 
 No full codegen support.
+
+Clang does not support any constructs/updates from upcoming OpenMP 5.0 except 
for `reduction`-based clauses in the `task` and `target`-based directives.
+


Index: docs/index.rst
===
--- docs/index.rst
+++ docs/index.rst
@@ -39,6 +39,7 @@
SourceBasedCodeCoverage
Modules
MSVCCompatibility
+   OpenMPSupport
ThinLTO
CommandGuide/index
FAQ
Index: docs/OpenMPSupport.rst
===
--- /dev/null
+++ docs/OpenMPSupport.rst
@@ -0,0 +1,69 @@
+.. raw:: html
+
+  
+.none { background-color: #FF }
+.partial { background-color: #99 }
+.good { background-color: #CCFF99 }
+  
+
+.. role:: none
+.. role:: partial
+.. role:: good
+
+==
+OpenMP Support
+==
+
+Clang fully supports OpenMP 3.1 + some elements of OpenMP 4.5. Clang supports offloading to X86_64, AArch64, PPC64[LE] and Cuda devices.
+The status of major OpenMP 4.5 features support in Clang.
+
+Standalone directives
+=
+
+* #pragma omp [for] simd: :good:`Complete`.
+
+* #pragma omp declare simd: :partial:`Partial`.  We support parsing/semantic
+  analysis + generation of special attributes for X86 target, but still
+  missing the LLVM pass for vectorization.
+
+* #pragma omp taskloop [simd]: :good:`Complete`.
+
+* #pragma omp target [enter|exit] data: :good:`Mostly complete`.  Some rework is
+  required for better stability.
+
+* #pragma omp target update: :good:`Mostly complete`.  Some rework is
+  required for better stability.
+
+* #pragma omp target: :partial:`Partial`.  No support for the `nowait` and `depend` clauses.
+
+* #pragma omp declare target: :partial:`Partial`.  No full codegen support.
+
+* #pragma omp teams: :good:`Complete`.
+
+* #pragma omp distribute [simd]: :good:`Complete`.
+
+* #pragma omp distribute parallel for [simd]: :good:`Complete`.
+
+Combined directives
+===
+
+* #pragma omp parallel for simd: :good:`Complete`.
+
+* #pragma omp target parallel: :partial:`Partial`.  No support 

[PATCH] D41087: [Preprocessor] Implement __is_target_{arch|vendor|os|environment} function-like builtin macros

2017-12-13 Thread Alex Lorenz via Phabricator via cfe-commits
arphaman marked an inline comment as done.
arphaman added inline comments.



Comment at: test/Preprocessor/is_target_os_darwin.c:22
+
+#if __is_target_os(ios)
+  #error "mismatching os"

compnerd wrote:
> Is this supposed to be within the `MAC` clause?
Yep, this should not succeed on Mac.


https://reviews.llvm.org/D41087



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


[PATCH] D41087: [Preprocessor] Implement __is_target_{arch|vendor|os|environment} function-like builtin macros

2017-12-13 Thread Alex Lorenz via Phabricator via cfe-commits
arphaman added inline comments.



Comment at: lib/Lex/PPMacroExpansion.cpp:1923
+  Tok, *this, diag::err_feature_check_malformed);
+  return II ? getTargetInfo().getTriple().getArchName().equals_lower(
+  II->getName())

compnerd wrote:
> arphaman wrote:
> > compnerd wrote:
> > > Hmm, the one thing to consider here is the canonicalized vs spelt target. 
> > >  e.g. `armv7-windows` will map to `thumbv7-unknown-windows-msvc`.
> > I think it's ok to only allow "thumb" check to succeed instead of "arm", 
> > otherwise how would we differentiate between the two? However, we should 
> > take the sub arch into account, so when arch is "thumbv7", these checks 
> > should succeed:
> > 
> > ```
> > __is_target_arch(thumb)
> > __is_target_arch(thumbv7)
> > ```
> > 
> > but this one should fail:
> > 
> > ```
> > __is_target_arch(thumbv6)
> > ```
> > 
> > I fixed this in the updated patch.
> I'm considering the scenario where the user specifies `-target armv7-windows` 
> and the `__is_target_arch(thumb)` passes but `__is_target_arch(arm)` fails.  
> Is that really what people would expect?
I suppose `__is_target_arch(arm)` should probably work in that case too, 
especially seeing that we define the ARM macros already. The users would just 
have to differentiate between thumb and non-thumb by checking if 
`__is_target_arch(thumb)` succeeds too.


https://reviews.llvm.org/D41087



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


[PATCH] D39963: [RISCV] Add initial RISC-V target and driver support

2017-12-13 Thread Eli Friedman via Phabricator via cfe-commits
efriedma added reviewers: mgorny, efriedma, bkramer, sylvestre.ledru.
efriedma added a comment.

Adding some reviewers to hopefully find someone comfortable reviewing the Linux 
multilib bits.  (Not sure I'm adding the right people; this stuff hasn't been 
touched for a while, as far as I can tell.)

The rest LGTM.


https://reviews.llvm.org/D39963



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


[PATCH] D41179: [Sema] Diagnose template specializations with C linkage

2017-12-13 Thread Roger Ferrer Ibanez via Phabricator via cfe-commits
rogfer01 added inline comments.



Comment at: lib/Sema/SemaTemplate.cpp:7021
+  // C++ [temp]p6:
+  //   A template, a template explicit specialization, and a class template
+  //   partial specialization shall not have C linkage.

miyuki wrote:
> rogfer01 wrote:
> > Can you add a test for a partial specialization? Your test for the class 
> > case only includes an explicit specialization.
> > 
> > ```lang=cpp
> > template 
> > struct A { };
> > 
> > extern "C" { 
> > 
> > template// I'd expect a diagnostic around here
> > struct A
> > {
> > };
> > 
> > }
> > ```
> Currently the location used for template specialization-related diagnostics 
> is on the next line, e.g.:
> 
> ```
> /work/llvm/src/tools/clang/test/SemaTemplate/class-template-spec.cpp:242:10: 
> error: templates must have C++ linkage
>   struct C {};
>  ^
> ```
> 
> Do we want to use a different location for this particular diagnostic?
Oh sorry, I was not precise when I put that example. I don't think it should be 
different in this case.


https://reviews.llvm.org/D41179



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


[PATCH] D41102: Setup clang-doc frontend framework

2017-12-13 Thread Julie Hockett via Phabricator via cfe-commits
juliehockett updated this revision to Diff 126797.
juliehockett marked 10 inline comments as done.
juliehockett added a comment.

Fixing comments


https://reviews.llvm.org/D41102

Files:
  tools/CMakeLists.txt
  tools/clang-doc/CMakeLists.txt
  tools/clang-doc/ClangDoc.cpp
  tools/clang-doc/ClangDoc.h
  tools/clang-doc/ClangDocReporter.cpp
  tools/clang-doc/ClangDocReporter.h
  tools/clang-doc/tool/CMakeLists.txt
  tools/clang-doc/tool/ClangDocMain.cpp

Index: tools/clang-doc/tool/ClangDocMain.cpp
===
--- /dev/null
+++ tools/clang-doc/tool/ClangDocMain.cpp
@@ -0,0 +1,69 @@
+//===-- ClangDocMain.cpp - Clangdoc -*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "ClangDoc.h"
+#include "clang/Driver/Options.h"
+#include "clang/Frontend/FrontendActions.h"
+#include "clang/Tooling/CommonOptionsParser.h"
+#include "clang/Tooling/Tooling.h"
+#include "llvm/Support/Process.h"
+#include "llvm/Support/Signals.h"
+#include 
+
+using namespace clang;
+using namespace llvm;
+
+namespace {
+
+cl::OptionCategory ClangDocCategory("clang-doc options");
+
+cl::opt
+EmitLLVM("emit-llvm",
+ cl::desc("Output in LLVM bitstream format (default is YAML)."),
+ cl::init(false), cl::cat(ClangDocCategory));
+
+cl::opt
+DoxygenOnly("doxygen",
+cl::desc("Use only doxygen-style comments to generate docs."),
+cl::init(false), cl::cat(ClangDocCategory));
+
+} // namespace
+
+int main(int argc, const char **argv) {
+  llvm::sys::PrintStackTraceOnErrorSignal(argv[0]);
+  tooling::CommonOptionsParser OptionsParser(argc, argv, ClangDocCategory);
+
+  clang::doc::OutFormat EmitFormat;
+  EmitLLVM ? EmitFormat = clang::doc::OutFormat::LLVM
+   : EmitFormat = clang::doc::OutFormat::YAML;
+
+  // TODO: Update the source path list to only consider changed files for
+  // incremental doc updates
+  doc::ClangDocReporter Reporter(OptionsParser.getSourcePathList());
+  doc::ClangDocContext Context{EmitFormat};
+
+  tooling::ClangTool Tool(OptionsParser.getCompilations(),
+  OptionsParser.getSourcePathList());
+
+  if (!DoxygenOnly)
+Tool.appendArgumentsAdjuster(tooling::getInsertArgumentAdjuster(
+"-fparse-all-comments", tooling::ArgumentInsertPosition::BEGIN));
+
+  doc::ClangDocActionFactory Factory(Context, Reporter);
+
+  llvm::outs() << "Parsing codebase...\n";
+  int Status = Tool.run();
+  if (Status)
+return Status;
+
+  llvm::outs() << "Writing docs...\n";
+  Reporter.Serialize(EmitFormat, llvm::outs());
+
+  return 0;
+}
Index: tools/clang-doc/tool/CMakeLists.txt
===
--- /dev/null
+++ tools/clang-doc/tool/CMakeLists.txt
@@ -0,0 +1,18 @@
+include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..)
+
+add_clang_executable(clang-doc
+  ClangDocMain.cpp
+  )
+
+target_link_libraries(clang-doc
+  PRIVATE
+  clangAST
+  clangASTMatchers
+  clangBasic
+  clangFormat
+  clangFrontend
+  clangDoc
+  clangRewrite
+  clangTooling
+  clangToolingCore
+  )
Index: tools/clang-doc/ClangDocReporter.h
===
--- /dev/null
+++ tools/clang-doc/ClangDocReporter.h
@@ -0,0 +1,117 @@
+//===-- Doc.cpp - ClangDoc --*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_DOC_CLANG_DOC_REPORTER_H
+#define LLVM_CLANG_TOOLS_EXTRA_CLANG_DOC_CLANG_DOC_REPORTER_H
+
+#include "clang/AST/AST.h"
+#include "clang/AST/ASTConsumer.h"
+#include "clang/AST/ASTContext.h"
+#include "clang/AST/CommentVisitor.h"
+#include "clang/AST/RecursiveASTVisitor.h"
+#include "clang/Frontend/ASTConsumers.h"
+#include "clang/Frontend/FrontendActions.h"
+#include "clang/Tooling/Tooling.h"
+#include "llvm/ADT/SmallVector.h"
+#include "llvm/Support/raw_ostream.h"
+#include 
+#include 
+#include 
+#include 
+
+using namespace clang::comments;
+
+namespace clang {
+namespace doc {
+
+enum class OutFormat { YAML, LLVM };
+
+struct StringPair {
+  std::string Key;
+  std::string Value;
+};
+
+struct CommentInfo {
+  std::string Kind;
+  std::string Text;
+  std::string Name;
+  std::string Direction;
+  std::string ParamName;
+  std::string CloseName;
+  bool SelfClosing = false;
+  bool Explicit = false;
+  llvm::StringMap Attrs;
+  llvm::SmallVector Args;
+  llvm::SmallVector Position;
+  std::vector Children;
+};
+
+// 

[PATCH] D41102: Setup clang-doc frontend framework

2017-12-13 Thread Julie Hockett via Phabricator via cfe-commits
juliehockett added inline comments.



Comment at: tools/clang-doc/ClangDocReporter.cpp:228
+  for (comments::Comment *Child :
+   llvm::make_range(C->child_begin(), C->child_end())) {
+CommentInfo ChildCI;

JonasToth wrote:
> Extract range into utility method of `Comment`
See above -- `comments::Comment` is a clang type that stores all the 
information about a particular piece of a comment -- the `CommentInfo` struct 
is specific to the clang-doc setup. Is that what you're thinking about?



Comment at: tools/clang-doc/ClangDocReporter.h:51
+  llvm::SmallVector Position;
+  std::vector Children;
+};

JonasToth wrote:
> Here a short `children()` method return llvm::make_range shortens the code in 
> a later loop and might benefit in the future for iterations over children.
Is there a reason you wouldn't be able to just use `for (const CommentInfo  : 
CI.Children)` ? The later loop I believe you're referencing doesn't loop over 
this struct, it looks at the children of a `comments::Comment` type.


https://reviews.llvm.org/D41102



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


[PATCH] D41036: IRGen: When performing CFI checks, load vtable pointer from vbase when necessary.

2017-12-13 Thread Peter Collingbourne via Phabricator via cfe-commits
pcc added a comment.

Ping.


https://reviews.llvm.org/D41036



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


[PATCH] D41147: git-clang-format: Add new --staged option.

2017-12-13 Thread Mark Lodato via Phabricator via cfe-commits
lodato updated this revision to Diff 126793.
lodato added a comment.

Update after change to https://reviews.llvm.org/D41145 that fixed `len(commits) 
> 2` case.


https://reviews.llvm.org/D41147

Files:
  google3/third_party/llvm/llvm/tools/clang/tools/clang-format/git-clang-format

Index: google3/third_party/llvm/llvm/tools/clang/tools/clang-format/git-clang-format
===
--- google3/third_party/llvm/llvm/tools/clang/tools/clang-format/git-clang-format
+++ google3/third_party/llvm/llvm/tools/clang/tools/clang-format/git-clang-format
@@ -33,11 +33,12 @@
 import subprocess
 import sys
 
-usage = 'git clang-format [OPTIONS] [] [] [--] [...]'
+usage = ('git clang-format [OPTIONS] [] [|--staged] '
+ '[--] [...]')
 
 desc = '''
-Run clang-format on all modified lines in the working directory or in a given
-commit.
+Run clang-format on all modified lines in the working directory, in a given
+commit, or in the stage/index.
 
 Forms:
 
@@ -57,6 +58,10 @@
 Run clang-format on all lines in  that differ from .
 Requires --diff.
 
+git clang-format [] --staged --diff
+Run clang-format on all lines in the git stage/index that differ from
+, which defaults to HEAD. Requires --diff.
+
 In all of the forms above, ... can be used to limit what files are
 affected, using the same syntax as `git diff`. Use `--` to disambiguate between
 files and commits.
@@ -126,6 +131,8 @@
  help='select hunks interactively')
   p.add_argument('-q', '--quiet', action='count', default=0,
  help='print less information')
+  p.add_argument('--staged', '--cached', action='store_true',
+ help='format lines in the stage instead of the working dir')
   p.add_argument('--style',
  default=config.get('clangformat.style', None),
  help='passed to clang-format'),
@@ -144,7 +151,10 @@
   del opts.quiet
 
   source, dest, files = interpret_args(opts.args, dash_dash,
-   default_commit=opts.commit)
+   default_commit=opts.commit,
+   staged=opts.staged)
+  if isinstance(dest, Stage) and not opts.diff:
+die('--diff is required when --staged is used')
   if isinstance(dest, Revision) and not opts.diff:
 die('--diff is required when two commits are given')
   changed_lines = dest.compute_diff_from(source, files)
@@ -207,7 +217,7 @@
   return out
 
 
-def interpret_args(args, dash_dash, default_commit):
+def interpret_args(args, dash_dash, default_commit, staged):
   """Interpret `args` as "[commits] [--] [files]" and return (src, dest, files).
 
   It is assumed that "--" and everything that follows has been removed from
@@ -252,7 +262,11 @@
   if len(commits) > 2:
 die('at most two commits allowed; %d given' % len(commits))
   elif len(commits) == 2:
+if staged:
+  die('--staged is not allowed when two commits are given')
 return Revision(commits[0]), Revision(commits[1]), files
+  elif staged:
+return Revision(commits[0]), Stage(), files
   else:
 return Revision(commits[0]), Workdir(), files
 
@@ -283,7 +297,7 @@
 
 
 class TreeLocation (object):
-  """Represents either a commit or the working directory.
+  """Represents either a commit, the stage, or the working directory.
 
   Do not use this directly. Instead, use one of the subclasses."""
 
@@ -439,6 +453,24 @@
   is_workdir = True
 
 
+class Stage (TreeLocation):
+  """Represents the git stage, a.k.a. the index."""
+
+  def create_tree(self, unused_filenames):
+return run('git', 'write-tree')
+
+  def _file_mode(self, filename):
+stdout = run('git', 'ls-files', '--stage', filename)
+# note: there is an optional  as the first element.
+return int(stdout.split()[-4], 8)
+
+  def _compute_diff_from_base_command(self, source):
+return ['git', 'diff-index', '-p', '-U0', '--cached', source.revision]
+
+  def _blob_name(self, filename):
+return ':%s' % filename
+
+
 class Revision (TreeLocation):
   """Represents a specific revision, a.k.a. a commit."""
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D41087: [Preprocessor] Implement __is_target_{arch|vendor|os|environment} function-like builtin macros

2017-12-13 Thread Saleem Abdulrasool via Phabricator via cfe-commits
compnerd accepted this revision.
compnerd added a comment.
This revision is now accepted and ready to land.

It would be good to straighten out the corner case of the canonicalized vs 
specified triple before merging this as that would make it harder to change.

Minor nit with the style, I'm not too fond of the longer lambdas being inlined, 
having a separate function being passed instead would be easier to read I think.




Comment at: lib/Lex/PPMacroExpansion.cpp:1923
+  Tok, *this, diag::err_feature_check_malformed);
+  return II ? getTargetInfo().getTriple().getArchName().equals_lower(
+  II->getName())

arphaman wrote:
> compnerd wrote:
> > Hmm, the one thing to consider here is the canonicalized vs spelt target.  
> > e.g. `armv7-windows` will map to `thumbv7-unknown-windows-msvc`.
> I think it's ok to only allow "thumb" check to succeed instead of "arm", 
> otherwise how would we differentiate between the two? However, we should take 
> the sub arch into account, so when arch is "thumbv7", these checks should 
> succeed:
> 
> ```
> __is_target_arch(thumb)
> __is_target_arch(thumbv7)
> ```
> 
> but this one should fail:
> 
> ```
> __is_target_arch(thumbv6)
> ```
> 
> I fixed this in the updated patch.
I'm considering the scenario where the user specifies `-target armv7-windows` 
and the `__is_target_arch(thumb)` passes but `__is_target_arch(arm)` fails.  Is 
that really what people would expect?



Comment at: test/Preprocessor/is_target_os_darwin.c:22
+
+#if __is_target_os(ios)
+  #error "mismatching os"

Is this supposed to be within the `MAC` clause?


https://reviews.llvm.org/D41087



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


[PATCH] D41145: git-clang-format: refactor to support upcoming --staged flag

2017-12-13 Thread Mark Lodato via Phabricator via cfe-commits
lodato added a comment.

Oops! Fixed. Thanks for catching this!


https://reviews.llvm.org/D41145



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


[PATCH] D41145: git-clang-format: refactor to support upcoming --staged flag

2017-12-13 Thread Mark Lodato via Phabricator via cfe-commits
lodato updated this revision to Diff 126792.
lodato added a comment.

Re-add check for `len(commits) > 2`.


https://reviews.llvm.org/D41145

Files:
  google3/third_party/llvm/llvm/tools/clang/tools/clang-format/git-clang-format

Index: google3/third_party/llvm/llvm/tools/clang/tools/clang-format/git-clang-format
===
--- google3/third_party/llvm/llvm/tools/clang/tools/clang-format/git-clang-format
+++ google3/third_party/llvm/llvm/tools/clang/tools/clang-format/git-clang-format
@@ -36,12 +36,30 @@
 usage = 'git clang-format [OPTIONS] [] [] [--] [...]'
 
 desc = '''
-If zero or one commits are given, run clang-format on all lines that differ
-between the working directory and , which defaults to HEAD.  Changes are
-only applied to the working directory.
+Run clang-format on all modified lines in the working directory or in a given
+commit.
 
-If two commits are given (requires --diff), run clang-format on all lines in the
-second  that differ from the first .
+Forms:
+
+git clang-format []
+Run clang-format on all lines in the working directory that differ from
+, which defaults to HEAD. Changes are written in-place.
+
+git clang-format [] --diff
+Same as first form, but print the diff instead of writing changes
+in-place.
+
+git clang-format [] --patch
+Same as first form, but interactively choose hunks to apply, a la `git
+add -p`.
+
+git clang-format   --diff
+Run clang-format on all lines in  that differ from .
+Requires --diff.
+
+In all of the forms above, ... can be used to limit what files are
+affected, using the same syntax as `git diff`. Use `--` to disambiguate between
+files and commits.
 
 The following git-config settings set the default of the corresponding option:
   clangFormat.binary
@@ -125,14 +143,11 @@
   opts.verbose -= opts.quiet
   del opts.quiet
 
-  commits, files = interpret_args(opts.args, dash_dash, opts.commit)
-  if len(commits) > 1:
-if not opts.diff:
-  die('--diff is required when two commits are given')
-  else:
-if len(commits) > 2:
-  die('at most two commits allowed; %d given' % len(commits))
-  changed_lines = compute_diff_and_extract_lines(commits, files)
+  source, dest, files = interpret_args(opts.args, dash_dash,
+   default_commit=opts.commit)
+  if isinstance(dest, Revision) and not opts.diff:
+die('--diff is required when two commits are given')
+  changed_lines = dest.compute_diff_from(source, files)
   if opts.verbose >= 1:
 ignored_files = set(changed_lines)
   filter_by_extension(changed_lines, opts.extensions.lower().split(','))
@@ -152,17 +167,10 @@
   # The computed diff outputs absolute paths, so we must cd before accessing
   # those files.
   cd_to_toplevel()
-  if len(commits) > 1:
-old_tree = commits[1]
-new_tree = run_clang_format_and_save_to_tree(changed_lines,
- revision=commits[1],
- binary=opts.binary,
- style=opts.style)
-  else:
-old_tree = create_tree_from_workdir(changed_lines)
-new_tree = run_clang_format_and_save_to_tree(changed_lines,
- binary=opts.binary,
- style=opts.style)
+  old_tree = dest.create_tree(changed_lines)
+  new_tree = dest.run_clang_format_and_save_to_tree(changed_lines,
+binary=opts.binary,
+style=opts.style)
   if opts.verbose >= 1:
 print('old tree: %s' % old_tree)
 print('new tree: %s' % new_tree)
@@ -172,6 +180,7 @@
   elif opts.diff:
 print_diff(old_tree, new_tree)
   else:
+assert isinstance(dest, Workdir)
 changed_files = apply_changes(old_tree, new_tree, force=opts.force,
   patch_mode=opts.patch)
 if (opts.verbose >= 0 and not opts.patch) or opts.verbose >= 1:
@@ -199,15 +208,20 @@
 
 
 def interpret_args(args, dash_dash, default_commit):
-  """Interpret `args` as "[commits] [--] [files]" and return (commits, files).
+  """Interpret `args` as "[commits] [--] [files]" and return (src, dest, files).
 
   It is assumed that "--" and everything that follows has been removed from
   args and placed in `dash_dash`.
 
   If "--" is present (i.e., `dash_dash` is non-empty), the arguments to its
   left (if present) are taken as commits.  Otherwise, the arguments are checked
   from left to right if they are commits or files.  If commits are not given,
-  a list with `default_commit` is used."""
+  a list with `default_commit` is used.
+
+  Return value is `(src, dest, files)`, where `src` and `dest` are TreeLocation
+  objects and `files` is a (possibly empty) list of filenames.
+  """
+  # First, get the list 

[PATCH] D33776: [libcxx] LWG2221: No formatted output operator for nullptr

2017-12-13 Thread Arthur O'Dwyer via Phabricator via cfe-commits
Quuxplusone added inline comments.



Comment at: include/ostream:225
+basic_ostream& operator<<(nullptr_t)
+{ return *this << (const void*)0; }
+

mclow.lists wrote:
> lichray wrote:
> > Oh, common, I persuaded the committee to allow you to print a `(null)`  and 
> > you don't do it...
> I think that `(null)` is a better thing to output here than `0x0`.
Are you two implying that

*this << (const void *)0;

does *not* print `(null)`? It certainly should, IMO. (I mean, it'll call 
`num_put` for `void*` in the current locale, but I would naturally expect that 
to print `(null)`.)
Anyway, whether the current locale prints null as `(null)` or not, there is 
great potential utility in using the same format for all pointers, as K-ballo 
is doing here. I'd really like to be able to

std::ostringstream oss;
oss << nullptr;  // equivalently: oss << (void*)0;
void *p;
std::istringstream(oss.str()) >> p;  // should read in a null pointer, not 
derp out

FWIW, it looks like libc++ currently *does* print null pointers as `(nil)`, 
which is not quite the same thing as `(null)`. libstdc++ prints them as `0`.
https://wandbox.org/permlink/yAM6tjMzvEX9HhhE


https://reviews.llvm.org/D33776



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


[PATCH] D39074: [libunwind][MIPS]: Add support for unwinding in N32 processes.

2017-12-13 Thread Saleem Abdulrasool via Phabricator via cfe-commits
compnerd added inline comments.



Comment at: include/__libunwind_config.h:73
+#  elif defined(_ABIN32) && defined(__mips_soft_float)
+#define _LIBUNWIND_TARGET_MIPS_NEWABI 1
+#define _LIBUNWIND_CONTEXT_SIZE 35

Minor nit: I prefer either `NABI` or `NEW_ABI`.



Comment at: src/AddressSpace.hpp:201
+inline uint64_t LocalAddressSpace::getRegister(pint_t addr) {
+#if defined(__LP64__) || (defined(__mips__) && defined(_ABIN32))
+  return get64(addr);

Can you use `__SIZEOF_POINTER__` rather than `__LP64__` please?  The former 
accounts for LLP64 environments as well.



Comment at: src/UnwindRegistersRestore.S:548
 
-#elif defined(__mips__) && defined(_ABI64) && defined(__mips_soft_float)
+#elif defined(__mips__) && (defined(_ABI64) || defined(_ABIN32)) && 
defined(__mips_soft_float)
 

sdardis wrote:
> This line is overly long, break with '\' after the second &&.
clang-format should also fix the width correctly.


https://reviews.llvm.org/D39074



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


[PATCH] D41189: [Frontend] Treat function with skipped body as definition

2017-12-13 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov updated this revision to Diff 126787.
ilya-biryukov added a comment.

- Reverted accidental whitespace change.


Repository:
  rC Clang

https://reviews.llvm.org/D41189

Files:
  include/clang/AST/Decl.h
  test/Index/skipped_function_bodies.cpp


Index: test/Index/skipped_function_bodies.cpp
===
--- /dev/null
+++ test/Index/skipped_function_bodies.cpp
@@ -0,0 +1,9 @@
+// RUN: env CINDEXTEST_SKIP_FUNCTION_BODIES=1 c-index-test -test-load-source 
all %s 2>&1 \
+// RUN: | FileCheck %s
+
+inline int with_body() { return 10; }
+inline int without_body();
+
+int x = with_body() + without_body();
+// CHECK: warning: inline function 'without_body' is not defined
+// CHECK-NOT: warning: inline function 'with_body' is not defined
Index: include/clang/AST/Decl.h
===
--- include/clang/AST/Decl.h
+++ include/clang/AST/Decl.h
@@ -1967,8 +1967,8 @@
   /// This does not determine whether the function has been defined (e.g., in a
   /// previous definition); for that information, use isDefined.
   bool isThisDeclarationADefinition() const {
-return IsDeleted || IsDefaulted || Body || IsLateTemplateParsed ||
-  WillHaveBody || hasDefiningAttr();
+return IsDeleted || IsDefaulted || Body || HasSkippedBody ||
+   IsLateTemplateParsed || WillHaveBody || hasDefiningAttr();
   }
 
   /// doesThisDeclarationHaveABody - Returns whether this specific


Index: test/Index/skipped_function_bodies.cpp
===
--- /dev/null
+++ test/Index/skipped_function_bodies.cpp
@@ -0,0 +1,9 @@
+// RUN: env CINDEXTEST_SKIP_FUNCTION_BODIES=1 c-index-test -test-load-source all %s 2>&1 \
+// RUN: | FileCheck %s
+
+inline int with_body() { return 10; }
+inline int without_body();
+
+int x = with_body() + without_body();
+// CHECK: warning: inline function 'without_body' is not defined
+// CHECK-NOT: warning: inline function 'with_body' is not defined
Index: include/clang/AST/Decl.h
===
--- include/clang/AST/Decl.h
+++ include/clang/AST/Decl.h
@@ -1967,8 +1967,8 @@
   /// This does not determine whether the function has been defined (e.g., in a
   /// previous definition); for that information, use isDefined.
   bool isThisDeclarationADefinition() const {
-return IsDeleted || IsDefaulted || Body || IsLateTemplateParsed ||
-  WillHaveBody || hasDefiningAttr();
+return IsDeleted || IsDefaulted || Body || HasSkippedBody ||
+   IsLateTemplateParsed || WillHaveBody || hasDefiningAttr();
   }
 
   /// doesThisDeclarationHaveABody - Returns whether this specific
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D41189: [Frontend] Treat function with skipped body as definition

2017-12-13 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov created this revision.
ilya-biryukov added reviewers: bkramer, sepavloff.

This fixes an invalid warning about missing definition of a function when
parsing with SkipFunctionBodies=true


Repository:
  rC Clang

https://reviews.llvm.org/D41189

Files:
  include/clang/AST/Decl.h
  test/Index/skipped_function_bodies.cpp
  tools/libclang/CIndex.cpp


Index: tools/libclang/CIndex.cpp
===
--- tools/libclang/CIndex.cpp
+++ tools/libclang/CIndex.cpp
@@ -830,7 +830,6 @@
 
 // FIXME: Attributes?
   }
-  
   if (ND->doesThisDeclarationHaveABody() && !ND->isLateTemplateParsed()) {
 if (CXXConstructorDecl *Constructor = dyn_cast(ND)) {
   // Find the initializers that were written in the source.
Index: test/Index/skipped_function_bodies.cpp
===
--- /dev/null
+++ test/Index/skipped_function_bodies.cpp
@@ -0,0 +1,9 @@
+// RUN: env CINDEXTEST_SKIP_FUNCTION_BODIES=1 c-index-test -test-load-source 
all %s 2>&1 \
+// RUN: | FileCheck %s
+
+inline int with_body() { return 10; }
+inline int without_body();
+
+int x = with_body() + without_body();
+// CHECK: warning: inline function 'without_body' is not defined
+// CHECK-NOT: warning: inline function 'with_body' is not defined
Index: include/clang/AST/Decl.h
===
--- include/clang/AST/Decl.h
+++ include/clang/AST/Decl.h
@@ -1967,8 +1967,8 @@
   /// This does not determine whether the function has been defined (e.g., in a
   /// previous definition); for that information, use isDefined.
   bool isThisDeclarationADefinition() const {
-return IsDeleted || IsDefaulted || Body || IsLateTemplateParsed ||
-  WillHaveBody || hasDefiningAttr();
+return IsDeleted || IsDefaulted || Body || HasSkippedBody ||
+   IsLateTemplateParsed || WillHaveBody || hasDefiningAttr();
   }
 
   /// doesThisDeclarationHaveABody - Returns whether this specific


Index: tools/libclang/CIndex.cpp
===
--- tools/libclang/CIndex.cpp
+++ tools/libclang/CIndex.cpp
@@ -830,7 +830,6 @@
 
 // FIXME: Attributes?
   }
-  
   if (ND->doesThisDeclarationHaveABody() && !ND->isLateTemplateParsed()) {
 if (CXXConstructorDecl *Constructor = dyn_cast(ND)) {
   // Find the initializers that were written in the source.
Index: test/Index/skipped_function_bodies.cpp
===
--- /dev/null
+++ test/Index/skipped_function_bodies.cpp
@@ -0,0 +1,9 @@
+// RUN: env CINDEXTEST_SKIP_FUNCTION_BODIES=1 c-index-test -test-load-source all %s 2>&1 \
+// RUN: | FileCheck %s
+
+inline int with_body() { return 10; }
+inline int without_body();
+
+int x = with_body() + without_body();
+// CHECK: warning: inline function 'without_body' is not defined
+// CHECK-NOT: warning: inline function 'with_body' is not defined
Index: include/clang/AST/Decl.h
===
--- include/clang/AST/Decl.h
+++ include/clang/AST/Decl.h
@@ -1967,8 +1967,8 @@
   /// This does not determine whether the function has been defined (e.g., in a
   /// previous definition); for that information, use isDefined.
   bool isThisDeclarationADefinition() const {
-return IsDeleted || IsDefaulted || Body || IsLateTemplateParsed ||
-  WillHaveBody || hasDefiningAttr();
+return IsDeleted || IsDefaulted || Body || HasSkippedBody ||
+   IsLateTemplateParsed || WillHaveBody || hasDefiningAttr();
   }
 
   /// doesThisDeclarationHaveABody - Returns whether this specific
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D40819: Implement Attribute Target MultiVersioning (Improved edition!)

2017-12-13 Thread Erich Keane via Phabricator via cfe-commits
erichkeane updated this revision to Diff 126781.
erichkeane marked 2 inline comments as done.
erichkeane added a comment.

Fixed all of @aaron.ballman comments.


https://reviews.llvm.org/D40819

Files:
  include/clang/AST/Decl.h
  include/clang/Basic/Attr.td
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/Basic/TargetInfo.h
  include/clang/Basic/X86Target.def
  include/clang/Sema/Overload.h
  lib/Basic/Targets/X86.cpp
  lib/Basic/Targets/X86.h
  lib/CodeGen/CGBuiltin.cpp
  lib/CodeGen/CodeGenFunction.cpp
  lib/CodeGen/CodeGenFunction.h
  lib/CodeGen/CodeGenModule.cpp
  lib/CodeGen/CodeGenModule.h
  lib/Sema/SemaDecl.cpp
  lib/Sema/SemaOverload.cpp
  lib/Serialization/ASTReaderDecl.cpp
  lib/Serialization/ASTWriterDecl.cpp
  test/CodeGen/attr-target-mv-func-ptrs.c
  test/CodeGen/attr-target-mv-va-args.c
  test/CodeGen/attr-target-mv.c
  test/CodeGenCXX/attr-target-mv-constexpr.cpp
  test/CodeGenCXX/attr-target-mv-diff-ns.cpp
  test/CodeGenCXX/attr-target-mv-func-ptrs.cpp
  test/CodeGenCXX/attr-target-mv-member-funcs.cpp
  test/CodeGenCXX/attr-target-mv-out-of-line-defs.cpp
  test/CodeGenCXX/attr-target-mv-overloads.cpp
  test/Sema/attr-target-mv.c
  test/SemaCXX/attr-target-mv.cpp

Index: test/SemaCXX/attr-target-mv.cpp
===
--- /dev/null
+++ test/SemaCXX/attr-target-mv.cpp
@@ -0,0 +1,131 @@
+// RUN: %clang_cc1 -triple x86_64-linux-gnu  -fsyntax-only -verify -fexceptions -fcxx-exceptions %s -std=c++14
+void __attribute__((target("sse4.2"))) no_default(void);
+void __attribute__((target("arch=sandybridge")))  no_default(void);
+
+void use1(void){
+  // expected-note@-4 {{candidate ignored: non-default multiversion function cannot be called directly}}
+  // expected-note@-4 {{candidate ignored: non-default multiversion function cannot be called directly}}
+  // expected-error@+1 {{no matching function for call to 'no_default'}}
+  no_default();
+}
+constexpr int __attribute__((target("sse4.2"))) foo(void) { return 0; }
+constexpr int __attribute__((target("arch=sandybridge"))) foo(void);
+//expected-error@+1 {{multiversion function declaration has a different constexpr specification}}
+int __attribute__((target("arch=ivybridge"))) foo(void) {return 1;}
+constexpr int __attribute__((target("default"))) foo(void) { return 2; }
+
+int __attribute__((target("sse4.2"))) foo2(void) { return 0; }
+//expected-error@+2 {{multiversion function declaration has a different constexpr specification}}
+//expected-note@+1 {{function multiversion caused by this declaration}}
+constexpr int __attribute__((target("arch=sandybridge"))) foo2(void);
+int __attribute__((target("arch=ivybridge"))) foo2(void) {return 1;}
+int __attribute__((target("default"))) foo2(void) { return 2; }
+
+static int __attribute__((target("sse4.2"))) bar(void) { return 0; }
+static int __attribute__((target("arch=sandybridge"))) bar(void);
+//expected-error@+1 {{multiversion function declaration has a different storage class}}
+int __attribute__((target("arch=ivybridge"))) bar(void) {return 1;}
+static int __attribute__((target("default"))) bar(void) { return 2; }
+
+int __attribute__((target("sse4.2"))) bar2(void) { return 0; }
+//expected-error@+2 {{multiversion function declaration has a different storage class}}
+//expected-note@+1 {{function multiversion caused by this declaration}}
+static int __attribute__((target("arch=sandybridge"))) bar2(void);
+int __attribute__((target("arch=ivybridge"))) bar2(void) {return 1;}
+int __attribute__((target("default"))) bar2(void) { return 2; }
+
+
+inline int __attribute__((target("sse4.2"))) baz(void) { return 0; }
+inline int __attribute__((target("arch=sandybridge"))) baz(void);
+//expected-error@+1 {{multiversion function declaration has a different inline specification}}
+int __attribute__((target("arch=ivybridge"))) baz(void) {return 1;}
+inline int __attribute__((target("default"))) baz(void) { return 2; }
+
+int __attribute__((target("sse4.2"))) baz2(void) { return 0; }
+//expected-error@+2 {{multiversion function declaration has a different inline specification}}
+//expected-note@+1 {{function multiversion caused by this declaration}}
+inline int __attribute__((target("arch=sandybridge"))) baz2(void);
+int __attribute__((target("arch=ivybridge"))) baz2(void) {return 1;}
+int __attribute__((target("default"))) baz2(void) { return 2; }
+
+float __attribute__((target("sse4.2"))) bock(void) { return 0; }
+//expected-error@+2 {{multiversion function declaration has a different return type}}
+//expected-note@+1 {{function multiversion caused by this declaration}}
+int __attribute__((target("arch=sandybridge"))) bock(void);
+//expected-error@+2 {{multiversion function declaration has a different return type}}
+//expected-note@+1 {{function multiversion caused by this declaration}}
+int __attribute__((target("arch=ivybridge"))) bock(void) {return 1;}
+//expected-error@+2 {{multiversion function declaration has a different return 

[PATCH] D40819: Implement Attribute Target MultiVersioning (Improved edition!)

2017-12-13 Thread Erich Keane via Phabricator via cfe-commits
erichkeane marked 17 inline comments as done.
erichkeane added a comment.

Patch incoming,  Thank you very much for the review @aaron.ballman




Comment at: include/clang/Basic/DiagnosticSemaKinds.td:9333-9335
+  "multiversion function would have identical mangling to a previous "
+  "definition.  Duplicate declarations must have identical target attribute "
+  "values">;

aaron.ballman wrote:
> Diagnostics are not complete sentences, so this should be reworded to be even 
> less grammatically correct. ;-)
I tried again, hopefully this one is better? :)  Let me know if my grammar is 
still too good...



Comment at: include/clang/Basic/DiagnosticSemaKinds.td:9339-9340
+def err_multiversion_no_other_attrs : Error<
+  "attribute 'target' multiversioning cannot be combined with other "
+  "attributes">;
+def err_multiversion_diff : Error<

aaron.ballman wrote:
> This worries me slightly. Is there a benefit to prohibiting this attribute 
> with any other attribute? For instance, I'm thinking about a multiversioned 
> noreturn function or a multiversioned function with a calling convention as 
> plausible use cases.
This attribute can have negative effects if combined with certain others, 
though I don't have a complete list.  GCC seems to 'ignore' a handful of 
others, but I don't have the complete list.  It is my intent to disallow all 
others in this patch, and upon request/further work, permit them as an opt-in.  



Comment at: lib/Sema/SemaDecl.cpp:9448
+  if (NewFD->isMain()) {
+if (NewTA && NewTA->getFeaturesStr() == "default") {
+  S.Diag(NewFD->getLocation(), diag::err_multiversion_not_allowed_on_main);

aaron.ballman wrote:
> So any other form of target attribute and feature string is fine to place on 
> `main()`?
It IS, it just doesn't cause multiversioning.  The "return false" at the bottom 
of this condition returns to CheckFunctionDeclaration.  


https://reviews.llvm.org/D40819



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


[PATCH] D41179: [Sema] Diagnose template specializations with C linkage

2017-12-13 Thread Mikhail Maltsev via Phabricator via cfe-commits
miyuki added inline comments.



Comment at: lib/Sema/SemaTemplate.cpp:7021
+  // C++ [temp]p6:
+  //   A template, a template explicit specialization, and a class template
+  //   partial specialization shall not have C linkage.

rogfer01 wrote:
> Can you add a test for a partial specialization? Your test for the class case 
> only includes an explicit specialization.
> 
> ```lang=cpp
> template 
> struct A { };
> 
> extern "C" { 
> 
> template// I'd expect a diagnostic around here
> struct A
> {
> };
> 
> }
> ```
Currently the location used for template specialization-related diagnostics is 
on the next line, e.g.:

```
/work/llvm/src/tools/clang/test/SemaTemplate/class-template-spec.cpp:242:10: 
error: templates must have C++ linkage
  struct C {};
 ^
```

Do we want to use a different location for this particular diagnostic?


https://reviews.llvm.org/D41179



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


[PATCH] D40707: [libcxx] Fix basic_stringbuf constructor

2017-12-13 Thread Zhihao Yuan via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL320604: [libcxx] Fix basic_stringbuf constructor (authored 
by lichray, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D40707?vs=126739=126779#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D40707

Files:
  libcxx/trunk/include/sstream
  
libcxx/trunk/test/std/input.output/string.streams/stringbuf/stringbuf.cons/default.pass.cpp


Index: libcxx/trunk/include/sstream
===
--- libcxx/trunk/include/sstream
+++ libcxx/trunk/include/sstream
@@ -243,7 +243,6 @@
 : __hm_(0),
   __mode_(__wch)
 {
-str(string_type());
 }
 
 template 
Index: 
libcxx/trunk/test/std/input.output/string.streams/stringbuf/stringbuf.cons/default.pass.cpp
===
--- 
libcxx/trunk/test/std/input.output/string.streams/stringbuf/stringbuf.cons/default.pass.cpp
+++ 
libcxx/trunk/test/std/input.output/string.streams/stringbuf/stringbuf.cons/default.pass.cpp
@@ -17,6 +17,21 @@
 #include 
 #include 
 
+template
+struct testbuf
+: std::basic_stringbuf
+{
+void check()
+{
+assert(this->eback() == NULL);
+assert(this->gptr() == NULL);
+assert(this->egptr() == NULL);
+assert(this->pbase() == NULL);
+assert(this->pptr() == NULL);
+assert(this->epptr() == NULL);
+}
+};
+
 int main()
 {
 {
@@ -27,4 +42,12 @@
 std::wstringbuf buf;
 assert(buf.str() == L"");
 }
+{
+testbuf buf;
+buf.check();
+}
+{
+testbuf buf;
+buf.check();
+}
 }


Index: libcxx/trunk/include/sstream
===
--- libcxx/trunk/include/sstream
+++ libcxx/trunk/include/sstream
@@ -243,7 +243,6 @@
 : __hm_(0),
   __mode_(__wch)
 {
-str(string_type());
 }
 
 template 
Index: libcxx/trunk/test/std/input.output/string.streams/stringbuf/stringbuf.cons/default.pass.cpp
===
--- libcxx/trunk/test/std/input.output/string.streams/stringbuf/stringbuf.cons/default.pass.cpp
+++ libcxx/trunk/test/std/input.output/string.streams/stringbuf/stringbuf.cons/default.pass.cpp
@@ -17,6 +17,21 @@
 #include 
 #include 
 
+template
+struct testbuf
+: std::basic_stringbuf
+{
+void check()
+{
+assert(this->eback() == NULL);
+assert(this->gptr() == NULL);
+assert(this->egptr() == NULL);
+assert(this->pbase() == NULL);
+assert(this->pptr() == NULL);
+assert(this->epptr() == NULL);
+}
+};
+
 int main()
 {
 {
@@ -27,4 +42,12 @@
 std::wstringbuf buf;
 assert(buf.str() == L"");
 }
+{
+testbuf buf;
+buf.check();
+}
+{
+testbuf buf;
+buf.check();
+}
 }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r320604 - [libcxx] Fix basic_stringbuf constructor

2017-12-13 Thread Zhihao Yuan via cfe-commits
Author: lichray
Date: Wed Dec 13 10:12:55 2017
New Revision: 320604

URL: http://llvm.org/viewvc/llvm-project?rev=320604=rev
Log:
[libcxx] Fix basic_stringbuf constructor

Summary:
[libcxx] Fix basic_stringbuf constructor

The C++ Standard [stringbuf.cons]p1 defines the effects of the basic_stringbuf
constructor that takes ios_base::openmode as follows:
  Effects: Constructs an object of class basic_stringbuf, initializing the
  base class with basic_streambuf(), and initializing mode with which.
  Postconditions: str() == "".

The default constructor of basic_streambuf shall initialize all its
pointer member objects to null pointers [streambuf.cons]p1.

Currently libc++ calls "str(string_type());" in the aforementioned constructor
setting basic_streambuf's pointers to a non-null value.

This patch removes the call (note that the postcondition str() == ""
remains valid because __str_ is default-initialized) and adds a test checking
that the basic_streambuf's pointers are null after construction.

Thanks Mikhail Maltsev for the patch.

Reviewers: EricWF, mclow.lists

Reviewed By: mclow.lists

Subscribers: cfe-commits

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

Modified:
libcxx/trunk/include/sstream

libcxx/trunk/test/std/input.output/string.streams/stringbuf/stringbuf.cons/default.pass.cpp

Modified: libcxx/trunk/include/sstream
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/sstream?rev=320604=320603=320604=diff
==
--- libcxx/trunk/include/sstream (original)
+++ libcxx/trunk/include/sstream Wed Dec 13 10:12:55 2017
@@ -243,7 +243,6 @@ basic_stringbuf<_CharT, _Traits, _Alloca
 : __hm_(0),
   __mode_(__wch)
 {
-str(string_type());
 }
 
 template 

Modified: 
libcxx/trunk/test/std/input.output/string.streams/stringbuf/stringbuf.cons/default.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/string.streams/stringbuf/stringbuf.cons/default.pass.cpp?rev=320604=320603=320604=diff
==
--- 
libcxx/trunk/test/std/input.output/string.streams/stringbuf/stringbuf.cons/default.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/input.output/string.streams/stringbuf/stringbuf.cons/default.pass.cpp
 Wed Dec 13 10:12:55 2017
@@ -17,6 +17,21 @@
 #include 
 #include 
 
+template
+struct testbuf
+: std::basic_stringbuf
+{
+void check()
+{
+assert(this->eback() == NULL);
+assert(this->gptr() == NULL);
+assert(this->egptr() == NULL);
+assert(this->pbase() == NULL);
+assert(this->pptr() == NULL);
+assert(this->epptr() == NULL);
+}
+};
+
 int main()
 {
 {
@@ -27,4 +42,12 @@ int main()
 std::wstringbuf buf;
 assert(buf.str() == L"");
 }
+{
+testbuf buf;
+buf.check();
+}
+{
+testbuf buf;
+buf.check();
+}
 }


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


[PATCH] D40903: [Sanitizers] Basic Solaris sanitizer support (PR 33274)

2017-12-13 Thread Aleksey Shlyapnikov via Phabricator via cfe-commits
alekseyshl added inline comments.



Comment at: lib/Driver/ToolChains/CommonArgs.cpp:528
 StringRef Sanitizer) {
+  // Solaris ld doesn't need this.  Inhibit use of non-existant
+  // --export-dynamic.

Can you elaborate why Solaris ld does not need dynamic lists? How does it 
export sanitizer symbols then?


Repository:
  rC Clang

https://reviews.llvm.org/D40903



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


[PATCH] D40548: [clangd] Symbol index interfaces and index-based code completion.

2017-12-13 Thread Eric Liu via Phabricator via cfe-commits
ioeric updated this revision to Diff 126775.
ioeric added a comment.

- Remove everything except for SymbolIndex interface and MemIndex
- Added unit tests for MemIndex


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D40548

Files:
  clangd/CMakeLists.txt
  clangd/index/Index.cpp
  clangd/index/Index.h
  clangd/index/MemIndex.cpp
  clangd/index/MemIndex.h
  unittests/clangd/CMakeLists.txt
  unittests/clangd/IndexTests.cpp

Index: unittests/clangd/IndexTests.cpp
===
--- /dev/null
+++ unittests/clangd/IndexTests.cpp
@@ -0,0 +1,118 @@
+//===-- IndexTests.cpp  ---*- C++ -*---===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "index/Index.h"
+#include "index/MemIndex.h"
+#include "gmock/gmock.h"
+#include "gtest/gtest.h"
+
+using testing::UnorderedElementsAre;
+
+namespace clang {
+namespace clangd {
+
+namespace {
+
+Symbol symbol(llvm::StringRef ID) {
+  Symbol Sym;
+  Sym.ID = SymbolID(ID);
+  Sym.QualifiedName = ID;
+  return Sym;
+}
+
+struct CountedSymbolSlab {
+  CountedSymbolSlab() = delete;
+
+  explicit CountedSymbolSlab(int ) : Counter(Counter) { ++Counter; }
+
+  ~CountedSymbolSlab() { Counter--; }
+
+  SymbolSlab Slab;
+  // A counter for the number of living slabs.
+  int 
+};
+
+class MemIndexTest : public ::testing::Test {
+protected:
+  std::vector
+  match(std::shared_ptr Symbols,
+const FuzzyFindRequest ) {
+Index.build(std::move(Symbols));
+std::vector Matches;
+Index.fuzzyFind(
+Req, [&](const Symbol ) { Matches.push_back(Sym.QualifiedName); });
+return Matches;
+  }
+
+  // Build a CountedSymbolSlab containing symbols with IDs and names [Begin,
+  // End]. The life time of the slab is managed by the returned shared_ptr,
+  // which points to a vector of pointers pointing to all symbols in the slab.
+  std::shared_ptr
+  generateNumSymbols(int Begin, int End) {
+auto Slab = std::make_shared(SlabCounter);
+
+for (int i = Begin; i <= End; i++)
+  Slab->Slab.insert(symbol(std::to_string(i)));
+auto *Symbols = new std::vector();
+
+for (const auto  : Slab->Slab)
+  Symbols->push_back();
+return std::shared_ptr(std::move(Slab),
+Symbols);
+  }
+
+  int SlabCounter = 0;
+  MemIndex Index;
+};
+
+TEST_F(MemIndexTest, MemIndexSymbolsRecycled) {
+  FuzzyFindRequest Req;
+  Req.Query = "7";
+  auto Matches = match(generateNumSymbols(0, 10), Req);
+  EXPECT_THAT(Matches, UnorderedElementsAre("7"));
+
+  EXPECT_EQ(SlabCounter, 1);
+  // Release old symbols.
+  Index.build(std::make_shared());
+  EXPECT_EQ(SlabCounter, 0);
+}
+
+TEST_F(MemIndexTest, MemIndexMatchSubstring) {
+  FuzzyFindRequest Req;
+  Req.Query = "5";
+  auto Matches = match(generateNumSymbols(5, 25), Req);
+  EXPECT_THAT(Matches, UnorderedElementsAre("5", "15", "25"));
+}
+
+TEST_F(MemIndexTest, MemIndexDeduplicate) {
+  auto Symbols = generateNumSymbols(0, 10);
+
+  // Inject some duplicates and make sure we only match the same symbol once.
+  auto Sym = symbol("7");
+  Symbols->push_back();
+  Symbols->push_back();
+  Symbols->push_back();
+
+  FuzzyFindRequest Req;
+  Req.Query = "7";
+  auto Matches = match(std::move(Symbols), Req);
+  EXPECT_EQ(Matches.size(), 1u);
+}
+
+TEST_F(MemIndexTest, MemIndexLimitedNumMatches) {
+  FuzzyFindRequest Req;
+  Req.Query = "5";
+  Req.MaxCandidateCount = 3;
+  auto Matches = match(generateNumSymbols(0, 100), Req);
+  EXPECT_EQ(Matches.size(), Req.MaxCandidateCount);
+}
+
+} // namespace
+} // namespace clangd
+} // namespace clang
Index: unittests/clangd/CMakeLists.txt
===
--- unittests/clangd/CMakeLists.txt
+++ unittests/clangd/CMakeLists.txt
@@ -13,6 +13,7 @@
   CodeCompleteTests.cpp
   ContextTests.cpp
   FuzzyMatchTests.cpp
+  IndexTests.cpp
   JSONExprTests.cpp
   TestFS.cpp
   TraceTests.cpp
Index: clangd/index/MemIndex.h
===
--- /dev/null
+++ clangd/index/MemIndex.h
@@ -0,0 +1,41 @@
+//===--- MemIndex.h - Dynamic in-memory symbol index. -- C++-*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_INDEX_MEMINDEX_H
+#define LLVM_CLANG_TOOLS_EXTRA_CLANGD_INDEX_MEMINDEX_H
+
+#include "Index.h"
+#include 
+
+namespace clang {
+namespace clangd {
+
+/// \brief This implements an index for 

[PATCH] D40478: Added Instrument Control Flow Flag

2017-12-13 Thread Peter Collingbourne via Phabricator via cfe-commits
pcc added inline comments.



Comment at: include/clang/Driver/Options.td:1035
   HelpText<"Instrument function entry only, after inlining, without arguments 
to the instrumentation call">;
-
+def finstrument_control_flow : Flag<["-"], "finstrument-control-flow">,
+  Group, Flags<[CC1Option]>,

oren_ben_simhon wrote:
> pcc wrote:
> > oren_ben_simhon wrote:
> > > pcc wrote:
> > > > oren_ben_simhon wrote:
> > > > > pcc wrote:
> > > > > > My comments about the attribute name in D40482 also apply to this 
> > > > > > flag name. GCC appears to have chosen a better name for this flag, 
> > > > > > `-mcet`. Can we use that name instead?
> > > > > Again, I am sorry for the late response, I was off for about a week.
> > > > > GCC is only using -mcet as a super set for -mibt and -mshstk. I am 
> > > > > planning to add it in a different review.
> > > > > -mcet/-mibt/-mshstk only enables the HW technology (ISA/Intrinsics).
> > > > > GCC is using -cf-protection for actually instrumenting the control 
> > > > > flow.
> > > > > I think it will be best to stay coherent with GCC (and ICC and soon 
> > > > > MS) and use -cf-protection.
> > > > > What do you think?
> > > > I see. As far as I can tell, there are no released versions of GCC and 
> > > > ICC with the new flags, so I think there is still a possibility to 
> > > > change them. (MS is a different story, their flags are incompatible 
> > > > anyway.)
> > > > 
> > > > I took a closer look at what GCC does, and here are my thoughts:
> > > > - As far as I can tell, IBT does not introduce any new instructions 
> > > > other than ENDBRANCH, and it doesn't seem to make sense for ENDBRANCH 
> > > > to be exposed via intrinsics (but rather via attributes, as you have 
> > > > done). That means that `-mibt` basically does nothing except for 
> > > > allowing the use of `-fcf-protection`.
> > > > - SHSTK introduces ISA extensions that seem reasonable to expose via 
> > > > intrinsics, so it would probably be fine to have a `-mshstk` flag that 
> > > > enables the intrinsics.
> > > > - In GCC, `-fcf-protection` means "emit code that is compatible with 
> > > > CET" and requires that the user pass `-mibt` or `-mshstk`. But the code 
> > > > that it emits is also compatible with non-CET processors, so it doesn't 
> > > > make sense to me to require the use of flags such as `-mshstk` which 
> > > > imply that SHSTK is required.
> > > > 
> > > > As for the name of the flag: there is nothing about the name 
> > > > `-fcf-protection` that implies hardware-based protection, so the 
> > > > presence of this flag could confuse users who want software-based 
> > > > protection. The hardware-based protection is sort of implied by the 
> > > > requirement to pass `-mibt` or `-mshstk`, but that is a little awkward, 
> > > > and I don't think it makes sense either for the reasons I mentioned. 
> > > > What we want is a clear way to say "I want to generate code that is 
> > > > compatible with (but does not require) this hardware feature", but 
> > > > there doesn't seem to be any precedent for how to express that. The 
> > > > most straightforward way to express it is to mention the name of the 
> > > > hardware feature in the flag.
> > > > 
> > > > So here are the changes that I would propose across compilers:
> > > > - Remove the `-mibt` flag.
> > > > - Change the flag that emits ENDBRANCH to something like 
> > > > `-mcet-compatible` and stop requiring the use of other flags.
> > > > Please let me know what you think.
> > > It is true that -mibt doesn't enable intrinsics however it is required 
> > > for the case of inline asm.
> > > The code that -cf-protection produce is not always compatible with 
> > > non-CET processors.
> > > For example, consider the required fix to the shadow stack in the case of 
> > > setJmp/longJmp. 
> > > In that case, we need to use SHSTK instructions (like incssp) that are 
> > > not compatible.
> > > Would the flag -fcf-arch-protection make more sense (as it implies on HW 
> > > support)?
> > > It is true that -mibt doesn't enable intrinsics however it is required 
> > > for the case of inline asm.
> > 
> > For enabling ENDBRANCH in inline asm? Would there be any harm in allowing 
> > ENDBRANCH unconditionally?
> > 
> > > For example, consider the required fix to the shadow stack in the case of 
> > > setJmp/longJmp.
> > > In that case, we need to use SHSTK instructions (like incssp) that are 
> > > not compatible.
> > 
> > I don't think that is true. I looked at the code that GCC emits for 
> > `setjmp` and `longjmp`, and it appears to quite cleverly avoid the need to 
> > execute SHSTK-required instructions on older processors by taking advantage 
> > of the fact that RDSSP is a NOP on older processors.
> > 
> > With this program:
> > ```
> > #include 
> > 
> > jmp_buf env;
> > void f() {
> >   __builtin_setjmp(env);
> > }
> > 
> > void g() {
> >   __builtin_longjmp(env, 1);
> > }
> > ```
> > I get this asm for saving 

[PATCH] D40478: Added Instrument Control Flow Flag

2017-12-13 Thread Craig Topper via Phabricator via cfe-commits
craig.topper added a comment.

-mibt isn't required for inline assembly, There's no AssemblePredicate defined 
with HasIBT in X86InstrInfo.td. We don't normally do fine grained assembler 
feature enabling so I believe we should always support it.


Repository:
  rL LLVM

https://reviews.llvm.org/D40478



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


[PATCH] D40448: Add a printing policy for AST dumping

2017-12-13 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

Ping


https://reviews.llvm.org/D40448



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


[PATCH] D39457: [OPENMP] Current status of OpenMP support.

2017-12-13 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev updated this revision to Diff 126773.
ABataev added a comment.

Status update.


Repository:
  rC Clang

https://reviews.llvm.org/D39457

Files:
  docs/OpenMPSupport.rst
  docs/index.rst


Index: docs/index.rst
===
--- docs/index.rst
+++ docs/index.rst
@@ -39,6 +39,7 @@
SourceBasedCodeCoverage
Modules
MSVCCompatibility
+   OpenMPSupport
ThinLTO
CommandGuide/index
FAQ
Index: docs/OpenMPSupport.rst
===
--- /dev/null
+++ docs/OpenMPSupport.rst
@@ -0,0 +1,69 @@
+.. raw:: html
+
+  
+.none { background-color: #FF }
+.partial { background-color: #99 }
+.good { background-color: #CCFF99 }
+  
+
+.. role:: none
+.. role:: partial
+.. role:: good
+
+==
+OpenMP Support
+==
+
+Clang fully supports OpenMP 3.1 + some elements of OpenMP 4.5. Clang supports 
offloading to X86_64, AArch64, PPC64[LE] and Cuda devices.
+The status of major OpenMP 4.5 features support in Clang.
+
+Standalone directives
+=
+
+* #pragma omp [for] simd: :good:`Complete`.
+
+* #pragma omp declare simd: :partial:`Partial`.  We support parsing/semantic
+  analysis + generation of special attributes for X86 target, but still
+  missing the LLVM pass for vectorization.
+
+* #pragma omp taskloop [simd]: :good:`Complete`.
+
+* #pragma omp target [enter|exit] data: :good:`Mostly complete`.  Some rework 
is
+  required for better stability.
+
+* #pragma omp target update: :good:`Mostly complete`.  Some rework is
+  required for better stability.
+
+* #pragma omp target: :partial:`Partial`.  No support for the `nowait` and 
`depend` clauses.
+
+* #pragma omp declare target: :partial:`Partial`.  No full codegen support.
+
+* #pragma omp teams: :good:`Complete`.
+
+* #pragma omp distribute [simd]: :good:`Complete`.
+
+* #pragma omp distribute parallel for [simd]: :good:`Complete`.
+
+Combined directives
+===
+
+* #pragma omp parallel for simd: :good:`Complete`.
+
+* #pragma omp target parallel: :partial:`Partial`.  No support for the 
`nowait` and `depend` clauses.
+
+* #pragma omp target parallel for [simd]: :partial:`Partial`.  No support for 
the `nowait` and `depend` clauses.
+
+* #pragma omp target simd: :partial:`Partial`.  No support for the `nowait` 
and `depend` clauses.
+
+* #pragma omp target teams: :partial:`Partial`.  No support for the `nowait` 
and `depend` clauses.
+
+* #pragma omp teams distribute [simd]: :good:`Complete`.
+
+* #pragma omp target teams distribute [simd]: :partial:`Partial`.  No full 
codegen support.
+
+* #pragma omp teams distribute parallel for [simd]: :good:`Complete`.
+
+* #pragma omp target teams distribute parallel for [simd]: :partial:`Partial`. 
 No full codegen support.
+
+Clang does not support any constructs/updates from upcoming OpenMP 5.0 except 
for `reduction`-based clauses in the `task` and `target`-based directives.
+


Index: docs/index.rst
===
--- docs/index.rst
+++ docs/index.rst
@@ -39,6 +39,7 @@
SourceBasedCodeCoverage
Modules
MSVCCompatibility
+   OpenMPSupport
ThinLTO
CommandGuide/index
FAQ
Index: docs/OpenMPSupport.rst
===
--- /dev/null
+++ docs/OpenMPSupport.rst
@@ -0,0 +1,69 @@
+.. raw:: html
+
+  
+.none { background-color: #FF }
+.partial { background-color: #99 }
+.good { background-color: #CCFF99 }
+  
+
+.. role:: none
+.. role:: partial
+.. role:: good
+
+==
+OpenMP Support
+==
+
+Clang fully supports OpenMP 3.1 + some elements of OpenMP 4.5. Clang supports offloading to X86_64, AArch64, PPC64[LE] and Cuda devices.
+The status of major OpenMP 4.5 features support in Clang.
+
+Standalone directives
+=
+
+* #pragma omp [for] simd: :good:`Complete`.
+
+* #pragma omp declare simd: :partial:`Partial`.  We support parsing/semantic
+  analysis + generation of special attributes for X86 target, but still
+  missing the LLVM pass for vectorization.
+
+* #pragma omp taskloop [simd]: :good:`Complete`.
+
+* #pragma omp target [enter|exit] data: :good:`Mostly complete`.  Some rework is
+  required for better stability.
+
+* #pragma omp target update: :good:`Mostly complete`.  Some rework is
+  required for better stability.
+
+* #pragma omp target: :partial:`Partial`.  No support for the `nowait` and `depend` clauses.
+
+* #pragma omp declare target: :partial:`Partial`.  No full codegen support.
+
+* #pragma omp teams: :good:`Complete`.
+
+* #pragma omp distribute [simd]: :good:`Complete`.
+
+* #pragma omp distribute parallel for [simd]: :good:`Complete`.
+
+Combined directives
+===
+
+* #pragma omp parallel for simd: :good:`Complete`.
+
+* #pragma omp target parallel: :partial:`Partial`.  No support for the `nowait` and 

[PATCH] D33776: [libcxx] LWG2221: No formatted output operator for nullptr

2017-12-13 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists added a comment.

Other than the actual text being output, this LGTM.
I'ld like to see the changes I suggested in the test go in, but they're really 
minor.




Comment at: include/ostream:225
+basic_ostream& operator<<(nullptr_t)
+{ return *this << (const void*)0; }
+

lichray wrote:
> Oh, common, I persuaded the committee to allow you to print a `(null)`  and 
> you don't do it...
I think that `(null)` is a better thing to output here than `0x0`.



Comment at: 
test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/nullptr_t.pass.cpp:72
+// at least ensure that it does not generate an empty string.
+assert(!s.empty());
+}

You could just say `assert(!sb.str().empty()) here; no need to save the string 
in a variable.



Comment at: 
test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/nullptr_t.pass.cpp:79
+os << n;
+assert(os.good());
+}

Might as well check for a non-empty string here, too.


https://reviews.llvm.org/D33776



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


r320596 - [OPENMP] Support `reduction` clause on target-based directives.

2017-12-13 Thread Alexey Bataev via cfe-commits
Author: abataev
Date: Wed Dec 13 09:31:39 2017
New Revision: 320596

URL: http://llvm.org/viewvc/llvm-project?rev=320596=rev
Log:
[OPENMP] Support `reduction` clause on target-based directives.

OpenMP 5.0 added support for `reduction` clause in target-based
directives. Patch adds this support to clang.

Added:
cfe/trunk/test/OpenMP/target_reduction_codegen.cpp
cfe/trunk/test/OpenMP/target_reduction_messages.cpp
Modified:
cfe/trunk/include/clang/Basic/OpenMPKinds.def
cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
cfe/trunk/lib/Sema/SemaOpenMP.cpp
cfe/trunk/test/OpenMP/target_teams_distribute_reduction_codegen.cpp

Modified: cfe/trunk/include/clang/Basic/OpenMPKinds.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/OpenMPKinds.def?rev=320596=320595=320596=diff
==
--- cfe/trunk/include/clang/Basic/OpenMPKinds.def (original)
+++ cfe/trunk/include/clang/Basic/OpenMPKinds.def Wed Dec 13 09:31:39 2017
@@ -454,6 +454,7 @@ OPENMP_TARGET_CLAUSE(depend)
 OPENMP_TARGET_CLAUSE(defaultmap)
 OPENMP_TARGET_CLAUSE(firstprivate)
 OPENMP_TARGET_CLAUSE(is_device_ptr)
+OPENMP_TARGET_CLAUSE(reduction)
 
 // Clauses allowed for OpenMP directive 'target data'.
 OPENMP_TARGET_DATA_CLAUSE(if)

Modified: cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp?rev=320596=320595=320596=diff
==
--- cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp Wed Dec 13 09:31:39 2017
@@ -6037,6 +6037,8 @@ private:
 
   /// \brief Set of all first private variables in the current directive.
   llvm::SmallPtrSet FirstPrivateDecls;
+  /// Set of all reduction variables in the current directive.
+  llvm::SmallPtrSet ReductionDecls;
 
   /// Map between device pointer declarations and their expression components.
   /// The key value for declarations in 'this' is null.
@@ -6429,6 +6431,12 @@ private:
 if (FirstPrivateDecls.count(Cap.getCapturedVar()))
   return MappableExprsHandler::OMP_MAP_PRIVATE |
  MappableExprsHandler::OMP_MAP_TO;
+// Reduction variable  will use only the 'private ptr' and 'map to_from'
+// flag.
+if (ReductionDecls.count(Cap.getCapturedVar())) {
+  return MappableExprsHandler::OMP_MAP_TO |
+ MappableExprsHandler::OMP_MAP_FROM;
+}
 
 // We didn't modify anything.
 return CurrentModifiers;
@@ -6442,6 +6450,12 @@ public:
   for (const auto *D : C->varlists())
 FirstPrivateDecls.insert(
 
cast(cast(D)->getDecl())->getCanonicalDecl());
+for (const auto *C : Dir.getClausesOfKind()) {
+  for (const auto *D : C->varlists()) {
+ReductionDecls.insert(
+
cast(cast(D)->getDecl())->getCanonicalDecl());
+  }
+}
 // Extract device pointer clause information.
 for (const auto *C : Dir.getClausesOfKind())
   for (auto L : C->component_lists())
@@ -6721,15 +6735,9 @@ public:
   // The default map type for a scalar/complex type is 'to' because by
   // default the value doesn't have to be retrieved. For an aggregate
   // type, the default is 'tofrom'.
-  CurMapTypes.push_back(ElementType->isAggregateType()
-? (OMP_MAP_TO | OMP_MAP_FROM)
-: OMP_MAP_TO);
-
-  // If we have a capture by reference we may need to add the private
-  // pointer flag if the base declaration shows in some first-private
-  // clause.
-  CurMapTypes.back() =
-  adjustMapModifiersForPrivateClauses(CI, CurMapTypes.back());
+  CurMapTypes.emplace_back(adjustMapModifiersForPrivateClauses(
+  CI, ElementType->isAggregateType() ? (OMP_MAP_TO | OMP_MAP_FROM)
+ : OMP_MAP_TO));
 }
 // Every default map produces a single argument which is a target 
parameter.
 CurMapTypes.back() |= OMP_MAP_TARGET_PARAM;

Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOpenMP.cpp?rev=320596=320595=320596=diff
==
--- cfe/trunk/lib/Sema/SemaOpenMP.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOpenMP.cpp Wed Dec 13 09:31:39 2017
@@ -1279,9 +1279,13 @@ bool Sema::IsOpenMPCapturedByRef(ValueDe
   // reference except if it is a pointer that is dereferenced somehow.
   IsByRef = !(Ty->isPointerType() && IsVariableAssociatedWithSection);
 } else {
-  // By default, all the data that has a scalar type is mapped by copy.
-  IsByRef = !Ty->isScalarType() ||
-DSAStack->getDefaultDMAAtLevel(Level) == DMA_tofrom_scalar;
+  // By default, all the data that has a scalar type is mapped by copy
+  // (except for reduction variables).
+  

[PATCH] D39963: [RISCV] Add initial RISC-V target and driver support

2017-12-13 Thread Alex Bradbury via Phabricator via cfe-commits
asb updated this revision to Diff 126771.
asb added a comment.

Apologies, the last version had a few lines of debug code left in.

I should say that this is to the best of my knowledge ready to merge (i.e. 
there are no outstanding flagged issues). Particularly now that the majority of 
the RV32I codegen patches are merged in LLVM, it would be really helpful to get 
this merged in to clang asap in order to make larger scale testing of the LLVM 
backend possible without out-of-tree patches.


https://reviews.llvm.org/D39963

Files:
  lib/Basic/CMakeLists.txt
  lib/Basic/Targets.cpp
  lib/Basic/Targets/RISCV.cpp
  lib/Basic/Targets/RISCV.h
  lib/Driver/CMakeLists.txt
  lib/Driver/ToolChains/Arch/RISCV.cpp
  lib/Driver/ToolChains/Arch/RISCV.h
  lib/Driver/ToolChains/Clang.cpp
  lib/Driver/ToolChains/Clang.h
  lib/Driver/ToolChains/Gnu.cpp
  lib/Driver/ToolChains/Linux.cpp
  test/Driver/Inputs/multilib_riscv_linux_sdk/bin/.keep
  test/Driver/Inputs/multilib_riscv_linux_sdk/include/.keep
  
test/Driver/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/crtbegin.o
  
test/Driver/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/lib32/ilp32/crtbegin.o
  
test/Driver/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/lib32/ilp32d/crtbegin.o
  
test/Driver/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/lib64/lp64/crtbegin.o
  
test/Driver/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/lib64/lp64d/crtbegin.o
  test/Driver/Inputs/multilib_riscv_linux_sdk/riscv64-unknown-linux-gnu/bin/ld
  test/Driver/Inputs/multilib_riscv_linux_sdk/sysroot/lib/.keep
  test/Driver/Inputs/multilib_riscv_linux_sdk/sysroot/lib32/ilp32/.keep
  test/Driver/Inputs/multilib_riscv_linux_sdk/sysroot/lib32/ilp32d/.keep
  test/Driver/Inputs/multilib_riscv_linux_sdk/sysroot/lib64/lp64/.keep
  test/Driver/Inputs/multilib_riscv_linux_sdk/sysroot/lib64/lp64d/.keep
  test/Driver/Inputs/multilib_riscv_linux_sdk/sysroot/usr/lib32/ilp32/.keep
  test/Driver/Inputs/multilib_riscv_linux_sdk/sysroot/usr/lib32/ilp32d/.keep
  test/Driver/Inputs/multilib_riscv_linux_sdk/sysroot/usr/lib64/lp64/.keep
  test/Driver/Inputs/multilib_riscv_linux_sdk/sysroot/usr/lib64/lp64d/.keep
  test/Driver/frame-pointer.c
  test/Driver/riscv-abi.c
  test/Driver/riscv-features.c
  test/Driver/riscv32-toolchain.c
  test/Driver/riscv64-toolchain.c
  test/Preprocessor/init.c

Index: test/Preprocessor/init.c
===
--- test/Preprocessor/init.c
+++ test/Preprocessor/init.c
@@ -10003,3 +10003,398 @@
 // ARM-DARWIN-BAREMETAL-64: #define __PTRDIFF_TYPE__ long int
 // ARM-DARWIN-BAREMETAL-64: #define __SIZE_TYPE__ long unsigned int
 
+// RUN: %clang_cc1 -E -dM -ffreestanding -triple=riscv32 < /dev/null \
+// RUN:   | FileCheck -match-full-lines -check-prefix=RISCV32 %s
+// RISCV32: #define _ILP32 1
+// RISCV32: #define __ATOMIC_ACQUIRE 2
+// RISCV32: #define __ATOMIC_ACQ_REL 4
+// RISCV32: #define __ATOMIC_CONSUME 1
+// RISCV32: #define __ATOMIC_RELAXED 0
+// RISCV32: #define __ATOMIC_RELEASE 3
+// RISCV32: #define __ATOMIC_SEQ_CST 5
+// RISCV32: #define __BIGGEST_ALIGNMENT__ 16
+// RISCV32: #define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__
+// RISCV32: #define __CHAR16_TYPE__ unsigned short
+// RISCV32: #define __CHAR32_TYPE__ unsigned int
+// RISCV32: #define __CHAR_BIT__ 8
+// RISCV32: #define __DBL_DECIMAL_DIG__ 17
+// RISCV32: #define __DBL_DENORM_MIN__ 4.9406564584124654e-324
+// RISCV32: #define __DBL_DIG__ 15
+// RISCV32: #define __DBL_EPSILON__ 2.2204460492503131e-16
+// RISCV32: #define __DBL_HAS_DENORM__ 1
+// RISCV32: #define __DBL_HAS_INFINITY__ 1
+// RISCV32: #define __DBL_HAS_QUIET_NAN__ 1
+// RISCV32: #define __DBL_MANT_DIG__ 53
+// RISCV32: #define __DBL_MAX_10_EXP__ 308
+// RISCV32: #define __DBL_MAX_EXP__ 1024
+// RISCV32: #define __DBL_MAX__ 1.7976931348623157e+308
+// RISCV32: #define __DBL_MIN_10_EXP__ (-307)
+// RISCV32: #define __DBL_MIN_EXP__ (-1021)
+// RISCV32: #define __DBL_MIN__ 2.2250738585072014e-308
+// RISCV32: #define __DECIMAL_DIG__ __LDBL_DECIMAL_DIG__
+// RISCV32: #define __ELF__ 1
+// RISCV32: #define __FINITE_MATH_ONLY__ 0
+// RISCV32: #define __FLT_DECIMAL_DIG__ 9
+// RISCV32: #define __FLT_DENORM_MIN__ 1.40129846e-45F
+// RISCV32: #define __FLT_DIG__ 6
+// RISCV32: #define __FLT_EPSILON__ 1.19209290e-7F
+// RISCV32: #define __FLT_EVAL_METHOD__ 0
+// RISCV32: #define __FLT_HAS_DENORM__ 1
+// RISCV32: #define __FLT_HAS_INFINITY__ 1
+// RISCV32: #define __FLT_HAS_QUIET_NAN__ 1
+// RISCV32: #define __FLT_MANT_DIG__ 24
+// RISCV32: #define __FLT_MAX_10_EXP__ 38
+// RISCV32: #define __FLT_MAX_EXP__ 128
+// RISCV32: #define __FLT_MAX__ 3.40282347e+38F
+// RISCV32: #define __FLT_MIN_10_EXP__ (-37)
+// RISCV32: #define __FLT_MIN_EXP__ (-125)
+// RISCV32: #define __FLT_MIN__ 1.17549435e-38F
+// RISCV32: #define __FLT_RADIX__ 2
+// RISCV32: #define __GCC_ATOMIC_BOOL_LOCK_FREE 1
+// 

[PATCH] D39963: [RISCV] Add initial RISC-V target and driver support

2017-12-13 Thread Alex Bradbury via Phabricator via cfe-commits
asb updated this revision to Diff 126769.
asb edited the summary of this revision.
asb added a comment.

Update to add test cases based on the multilib Linux SDK produced by 
https://github.com/riscv/riscv-gnu-toolchain/.


https://reviews.llvm.org/D39963

Files:
  lib/Basic/CMakeLists.txt
  lib/Basic/Targets.cpp
  lib/Basic/Targets/RISCV.cpp
  lib/Basic/Targets/RISCV.h
  lib/Driver/CMakeLists.txt
  lib/Driver/ToolChains/Arch/RISCV.cpp
  lib/Driver/ToolChains/Arch/RISCV.h
  lib/Driver/ToolChains/Clang.cpp
  lib/Driver/ToolChains/Clang.h
  lib/Driver/ToolChains/Gnu.cpp
  lib/Driver/ToolChains/Linux.cpp
  test/Driver/Inputs/multilib_riscv_linux_sdk/bin/.keep
  test/Driver/Inputs/multilib_riscv_linux_sdk/include/.keep
  
test/Driver/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/crtbegin.o
  
test/Driver/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/lib32/ilp32/crtbegin.o
  
test/Driver/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/lib32/ilp32d/crtbegin.o
  
test/Driver/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/lib64/lp64/crtbegin.o
  
test/Driver/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/lib64/lp64d/crtbegin.o
  test/Driver/Inputs/multilib_riscv_linux_sdk/riscv64-unknown-linux-gnu/bin/ld
  test/Driver/Inputs/multilib_riscv_linux_sdk/sysroot/lib/.keep
  test/Driver/Inputs/multilib_riscv_linux_sdk/sysroot/lib32/ilp32/.keep
  test/Driver/Inputs/multilib_riscv_linux_sdk/sysroot/lib32/ilp32d/.keep
  test/Driver/Inputs/multilib_riscv_linux_sdk/sysroot/lib64/lp64/.keep
  test/Driver/Inputs/multilib_riscv_linux_sdk/sysroot/lib64/lp64d/.keep
  test/Driver/Inputs/multilib_riscv_linux_sdk/sysroot/usr/lib32/ilp32/.keep
  test/Driver/Inputs/multilib_riscv_linux_sdk/sysroot/usr/lib32/ilp32d/.keep
  test/Driver/Inputs/multilib_riscv_linux_sdk/sysroot/usr/lib64/lp64/.keep
  test/Driver/Inputs/multilib_riscv_linux_sdk/sysroot/usr/lib64/lp64d/.keep
  test/Driver/frame-pointer.c
  test/Driver/riscv-abi.c
  test/Driver/riscv-features.c
  test/Driver/riscv32-toolchain.c
  test/Driver/riscv64-toolchain.c
  test/Preprocessor/init.c

Index: test/Preprocessor/init.c
===
--- test/Preprocessor/init.c
+++ test/Preprocessor/init.c
@@ -10003,3 +10003,398 @@
 // ARM-DARWIN-BAREMETAL-64: #define __PTRDIFF_TYPE__ long int
 // ARM-DARWIN-BAREMETAL-64: #define __SIZE_TYPE__ long unsigned int
 
+// RUN: %clang_cc1 -E -dM -ffreestanding -triple=riscv32 < /dev/null \
+// RUN:   | FileCheck -match-full-lines -check-prefix=RISCV32 %s
+// RISCV32: #define _ILP32 1
+// RISCV32: #define __ATOMIC_ACQUIRE 2
+// RISCV32: #define __ATOMIC_ACQ_REL 4
+// RISCV32: #define __ATOMIC_CONSUME 1
+// RISCV32: #define __ATOMIC_RELAXED 0
+// RISCV32: #define __ATOMIC_RELEASE 3
+// RISCV32: #define __ATOMIC_SEQ_CST 5
+// RISCV32: #define __BIGGEST_ALIGNMENT__ 16
+// RISCV32: #define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__
+// RISCV32: #define __CHAR16_TYPE__ unsigned short
+// RISCV32: #define __CHAR32_TYPE__ unsigned int
+// RISCV32: #define __CHAR_BIT__ 8
+// RISCV32: #define __DBL_DECIMAL_DIG__ 17
+// RISCV32: #define __DBL_DENORM_MIN__ 4.9406564584124654e-324
+// RISCV32: #define __DBL_DIG__ 15
+// RISCV32: #define __DBL_EPSILON__ 2.2204460492503131e-16
+// RISCV32: #define __DBL_HAS_DENORM__ 1
+// RISCV32: #define __DBL_HAS_INFINITY__ 1
+// RISCV32: #define __DBL_HAS_QUIET_NAN__ 1
+// RISCV32: #define __DBL_MANT_DIG__ 53
+// RISCV32: #define __DBL_MAX_10_EXP__ 308
+// RISCV32: #define __DBL_MAX_EXP__ 1024
+// RISCV32: #define __DBL_MAX__ 1.7976931348623157e+308
+// RISCV32: #define __DBL_MIN_10_EXP__ (-307)
+// RISCV32: #define __DBL_MIN_EXP__ (-1021)
+// RISCV32: #define __DBL_MIN__ 2.2250738585072014e-308
+// RISCV32: #define __DECIMAL_DIG__ __LDBL_DECIMAL_DIG__
+// RISCV32: #define __ELF__ 1
+// RISCV32: #define __FINITE_MATH_ONLY__ 0
+// RISCV32: #define __FLT_DECIMAL_DIG__ 9
+// RISCV32: #define __FLT_DENORM_MIN__ 1.40129846e-45F
+// RISCV32: #define __FLT_DIG__ 6
+// RISCV32: #define __FLT_EPSILON__ 1.19209290e-7F
+// RISCV32: #define __FLT_EVAL_METHOD__ 0
+// RISCV32: #define __FLT_HAS_DENORM__ 1
+// RISCV32: #define __FLT_HAS_INFINITY__ 1
+// RISCV32: #define __FLT_HAS_QUIET_NAN__ 1
+// RISCV32: #define __FLT_MANT_DIG__ 24
+// RISCV32: #define __FLT_MAX_10_EXP__ 38
+// RISCV32: #define __FLT_MAX_EXP__ 128
+// RISCV32: #define __FLT_MAX__ 3.40282347e+38F
+// RISCV32: #define __FLT_MIN_10_EXP__ (-37)
+// RISCV32: #define __FLT_MIN_EXP__ (-125)
+// RISCV32: #define __FLT_MIN__ 1.17549435e-38F
+// RISCV32: #define __FLT_RADIX__ 2
+// RISCV32: #define __GCC_ATOMIC_BOOL_LOCK_FREE 1
+// RISCV32: #define __GCC_ATOMIC_CHAR16_T_LOCK_FREE 1
+// RISCV32: #define __GCC_ATOMIC_CHAR32_T_LOCK_FREE 1
+// RISCV32: #define __GCC_ATOMIC_CHAR_LOCK_FREE 1
+// RISCV32: #define __GCC_ATOMIC_INT_LOCK_FREE 1
+// RISCV32: #define __GCC_ATOMIC_LLONG_LOCK_FREE 1
+// RISCV32: #define 

[PATCH] D41050: Fix over-release of return value of lambda implicitly converted to block/function pointer

2017-12-13 Thread Dan Zimmerman via Phabricator via cfe-commits
danzimm added a comment.

Ah, just found test/Transforms/ObjCARC/rv.ll test3:

  ; Delete a redundant retainRV,autoreleaseRV when forwaring a call result
  ; directly to a return value.
  
  ; CHECK-LABEL: define i8* @test3(
  ; CHECK: call i8* @returner()
  ; CHECK-NEXT: ret i8* %call
  define i8* @test3() {
  entry:
%call = call i8* @returner()
%0 = call i8* @objc_retainAutoreleasedReturnValue(i8* %call) nounwind
%1 = call i8* @objc_autoreleaseReturnValue(i8* %0) nounwind
ret i8* %1
  }


Repository:
  rC Clang

https://reviews.llvm.org/D41050



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


[PATCH] D41179: [Sema] Diagnose template specializations with C linkage

2017-12-13 Thread Roger Ferrer Ibanez via Phabricator via cfe-commits
rogfer01 added inline comments.



Comment at: lib/Sema/SemaTemplate.cpp:7021
+  // C++ [temp]p6:
+  //   A template, a template explicit specialization, and a class template
+  //   partial specialization shall not have C linkage.

Can you add a test for a partial specialization? Your test for the class case 
only includes an explicit specialization.

```lang=cpp
template 
struct A { };

extern "C" { 

template// I'd expect a diagnostic around here
struct A
{
};

}
```


https://reviews.llvm.org/D41179



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


[PATCH] D36892: [clang-tidy] check_clang_tidy.py: support CHECK-NOTES prefix

2017-12-13 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

In https://reviews.llvm.org/D36892#953953, @lebedev.ri wrote:

> In https://reviews.llvm.org/D36892#953891, @aaron.ballman wrote:
>
> > I think you're set to commit this
>
>
> Should i commit it though?
>  Until licensing concerns with https://reviews.llvm.org/D36836 are finally 
> magically resolved and it is committed, there won't be any users, and since 
> there is no tests for this, that would be a dead code with all the 
> consequences.


Hmm, I thought we had other tests that could make use of this functionality? 
However, I might be misremembering. Hold off on committing until there's test 
coverage, but it'd be good to look at existing tests to see if any of them can 
be modified.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D36892



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


  1   2   >