[PATCH] D40072: [libclang] Support querying whether a declaration is invalid

2017-11-21 Thread Nikolai Kosjar via Phabricator via cfe-commits
nik added a comment.

Ping


https://reviews.llvm.org/D40072



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


[libcxx] r318818 - Add some tests for operations on const associative containers. Part of LWG#2542

2017-11-21 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Tue Nov 21 22:02:27 2017
New Revision: 318818

URL: http://llvm.org/viewvc/llvm-project?rev=318818=rev
Log:
Add some tests for operations on const associative containers. Part of LWG#2542

Modified:
libcxx/trunk/test/std/containers/associative/map/map.cons/compare.pass.cpp

libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/compare.pass.cpp
libcxx/trunk/test/std/containers/associative/multiset/equal_range.pass.cpp

libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/compare.pass.cpp
libcxx/trunk/test/std/containers/associative/set/set.cons/compare.pass.cpp
libcxx/trunk/test/std/containers/test_compare.h

Modified: 
libcxx/trunk/test/std/containers/associative/map/map.cons/compare.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/map/map.cons/compare.pass.cpp?rev=318818=318817=318818=diff
==
--- libcxx/trunk/test/std/containers/associative/map/map.cons/compare.pass.cpp 
(original)
+++ libcxx/trunk/test/std/containers/associative/map/map.cons/compare.pass.cpp 
Tue Nov 21 22:02:27 2017
@@ -13,6 +13,8 @@
 
 // explicit map(const key_compare& comp);
 
+// key_compare key_comp() const;
+
 #include 
 #include 
 
@@ -23,7 +25,7 @@ int main()
 {
 {
 typedef test_compare C;
-std::map m(C(3));
+const std::map m(C(3));
 assert(m.empty());
 assert(m.begin() == m.end());
 assert(m.key_comp() == C(3));
@@ -31,7 +33,7 @@ int main()
 #if TEST_STD_VER >= 11
 {
 typedef test_compare C;
-std::map> 
m(C(3));
+const std::map> m(C(3));
 assert(m.empty());
 assert(m.begin() == m.end());
 assert(m.key_comp() == C(3));

Modified: 
libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/compare.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/compare.pass.cpp?rev=318818=318817=318818=diff
==
--- 
libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/compare.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/containers/associative/multimap/multimap.cons/compare.pass.cpp
 Tue Nov 21 22:02:27 2017
@@ -13,6 +13,8 @@
 
 // explicit multimap(const key_compare& comp);
 
+// key_compare key_comp() const;
+
 #include 
 #include 
 
@@ -23,7 +25,7 @@ int main()
 {
 {
 typedef test_compare C;
-std::multimap m(C(3));
+const std::multimap m(C(3));
 assert(m.empty());
 assert(m.begin() == m.end());
 assert(m.key_comp() == C(3));
@@ -31,7 +33,7 @@ int main()
 #if TEST_STD_VER >= 11
 {
 typedef test_compare C;
-std::multimap> 
m(C(3));
+const std::multimap> m(C(3));
 assert(m.empty());
 assert(m.begin() == m.end());
 assert(m.key_comp() == C(3));

Modified: 
libcxx/trunk/test/std/containers/associative/multiset/equal_range.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multiset/equal_range.pass.cpp?rev=318818=318817=318818=diff
==
--- libcxx/trunk/test/std/containers/associative/multiset/equal_range.pass.cpp 
(original)
+++ libcxx/trunk/test/std/containers/associative/multiset/equal_range.pass.cpp 
Tue Nov 21 22:02:27 2017
@@ -77,7 +77,7 @@ int main()
 9,
 9
 };
-M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
 R r = m.equal_range(4);
 assert(r.first  == next(m.begin(), 0));
 assert(r.second == next(m.begin(), 0));
@@ -156,7 +156,7 @@ int main()
 9,
 9
 };
-M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
+const M m(ar, ar+sizeof(ar)/sizeof(ar[0]));
 R r = m.equal_range(4);
 assert(r.first  == next(m.begin(), 0));
 assert(r.second == next(m.begin(), 0));

Modified: 
libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/compare.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/compare.pass.cpp?rev=318818=318817=318818=diff
==
--- 
libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/compare.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/containers/associative/multiset/multiset.cons/compare.pass.cpp
 Tue Nov 21 22:02:27 2017
@@ -12,6 +12,10 @@
 // class multiset
 
 // explicit multiset(const value_compare& comp);
+// value_compare and key_compare 

[PATCH] D40224: [X86] Control-Flow Enforcement Technology - Shadow Stack and Indirect Branch Tracking support (Clang side)

2017-11-21 Thread Craig Topper via Phabricator via cfe-commits
craig.topper added inline comments.



Comment at: include/clang/Basic/BuiltinsX86_64.def:63
 TARGET_BUILTIN(__builtin_ia32_xsaves64, "vv*ULLi", "", "xsaves")
+TARGET_BUILTIN(__builtin_ia32_incsspq, "vULLi","u","shstk")
+TARGET_BUILTIN(__builtin_ia32_rdsspq, "ULLiULLi","Un","shstk")

Space after commas here too.



Comment at: test/Preprocessor/x86_target_features.c:336
 
+// RUN: %clang -target i386-unknown-unknown -mcet -x c -E -dM -o - %s | 
FileCheck -match-full-lines --check-prefix=CET %s
+

Should this -mcet case be removed?


Repository:
  rL LLVM

https://reviews.llvm.org/D40224



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


[PATCH] D35470: [libcxx] Implement std::to_address for C++20

2017-11-21 Thread Glen Fernandes via Phabricator via cfe-commits
glenjofe added a comment.

Thanks Eric. Can you commit on my behalf?


https://reviews.llvm.org/D35470



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


[PATCH] D40144: Implement `std::launder`

2017-11-21 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists updated this revision to Diff 123877.
mclow.lists added a comment.

`_VSTD::` qualify the call to `__launder`.
De-dup error messages in test.


https://reviews.llvm.org/D40144

Files:
  include/__config
  include/new
  
test/std/language.support/support.dynamic/ptr.launder/launder.nodiscard.fail.cpp
  test/std/language.support/support.dynamic/ptr.launder/launder.pass.cpp
  test/std/language.support/support.dynamic/ptr.launder/launder.types.fail.cpp
  www/cxx1z_status.html

Index: www/cxx1z_status.html
===
--- www/cxx1z_status.html
+++ www/cxx1z_status.html
@@ -104,6 +104,7 @@
 	https://wg21.link/p0083r3;>p0083r3LWGSplicing Maps and SetsOulu
 	https://wg21.link/p0084r2;>p0084r2LWGEmplace Return TypeOuluComplete4.0
 	https://wg21.link/p0088r3;>p0088r3LWGVariant: a type-safe union for C++17OuluComplete4.0
+	https://wg21.link/p0137r1;>p0137r1CWGCore Issue 1776: Replacement of class objects containing reference membersOuluComplete6.0
 	https://wg21.link/p0163r0;>p0163r0LWGshared_ptr::weak_typeOuluComplete3.9
 	https://wg21.link/p0174r2;>p0174r2LWGDeprecating Vestigial Library Parts in C++17Oulu
 	https://wg21.link/p0175r1;>p0175r1LWGSynopses for the C libraryOulu
Index: test/std/language.support/support.dynamic/ptr.launder/launder.types.fail.cpp
===
--- test/std/language.support/support.dynamic/ptr.launder/launder.types.fail.cpp
+++ test/std/language.support/support.dynamic/ptr.launder/launder.types.fail.cpp
@@ -0,0 +1,34 @@
+// -*- C++ -*-
+//===--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+
+// 
+
+// template  constexpr T* launder(T* p) noexcept;
+// The program is ill-formed if T is a function type or cv void.
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+#include 
+#include 
+
+#include "test_macros.h"
+
+void foo() {}
+
+int main ()
+{
+void *p = nullptr;
+(void) std::launder((   void *) nullptr);
+(void) std::launder((const  void *) nullptr);
+(void) std::launder((  volatile void *) nullptr);
+(void) std::launder((const volatile void *) nullptr);  // expected-error-re@new:* 4 {{static_assert failed{{.*}} "can't launder cv-void"}}
+
+(void) std::launder(foo);  // expected-error-re@new:* 1 {{static_assert failed{{.*}} "can't launder functions"}}
+}
Index: test/std/language.support/support.dynamic/ptr.launder/launder.pass.cpp
===
--- test/std/language.support/support.dynamic/ptr.launder/launder.pass.cpp
+++ test/std/language.support/support.dynamic/ptr.launder/launder.pass.cpp
@@ -0,0 +1,35 @@
+//===--===//
+//
+// 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.
+//
+//===--===//
+
+// 
+
+// template  constexpr T* launder(T* p) noexcept;
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+#include 
+#include 
+
+#include "test_macros.h"
+
+constexpr int gi = 5;
+constexpr float gf = 8.f;
+
+int main() {
+	static_assert(std::launder() == , "" );
+	static_assert(std::launder() == , "" );
+
+  	const int *i = 
+  	const float *f = 
+static_assert(std::is_same::value, "");
+static_assert(std::is_same::value, "");
+
+	assert(std::launder(i) == i);
+	assert(std::launder(f) == f);
+}
Index: test/std/language.support/support.dynamic/ptr.launder/launder.nodiscard.fail.cpp
===
--- test/std/language.support/support.dynamic/ptr.launder/launder.nodiscard.fail.cpp
+++ test/std/language.support/support.dynamic/ptr.launder/launder.nodiscard.fail.cpp
@@ -0,0 +1,27 @@
+// -*- C++ -*-
+//===--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+
+// 
+
+// template  constexpr T* launder(T* p) noexcept;
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8
+
+#include 
+#include 
+
+#include "test_macros.h"
+
+int main ()
+{
+int *p = 

[PATCH] D40144: Implement `std::launder`

2017-11-21 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF added inline comments.



Comment at: 
test/std/language.support/support.dynamic/ptr.launder/launder.nodiscard.fail.cpp:16
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, 
clang-3.8
+

mclow.lists wrote:
> EricWF wrote:
> > Why is this test unsupported with older compilers? The version of 
> > `std::launder` in this patch should work regardless of compiler support for 
> > `__builtin_launder`.
> > 
> > Although, it's possible the compiler requirements were intended to avoid 
> > older clang versions without `[[nodiscard]]`. However, I don't think 
> > `clang-3.8` supports C++2a, so the condition seems redundant.
> > 
> We're testing the `[[nodiscard]]` bit here, not the `launder` bit. And that 
> didn't come in until clang 3.9
Perhaps we should fall back to `__attribute__((warn_unused_result))` when we 
don't have `[[nodiscard]]`? All supported Clang versions should provide that, 
as well as GCC 4.9 and newer.


https://reviews.llvm.org/D40144



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


[PATCH] D40144: Implement `std::launder`

2017-11-21 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists added inline comments.



Comment at: 
test/std/language.support/support.dynamic/ptr.launder/launder.nodiscard.fail.cpp:16
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, 
clang-3.8
+

EricWF wrote:
> Why is this test unsupported with older compilers? The version of 
> `std::launder` in this patch should work regardless of compiler support for 
> `__builtin_launder`.
> 
> Although, it's possible the compiler requirements were intended to avoid 
> older clang versions without `[[nodiscard]]`. However, I don't think 
> `clang-3.8` supports C++2a, so the condition seems redundant.
> 
We're testing the `[[nodiscard]]` bit here, not the `launder` bit. And that 
didn't come in until clang 3.9


https://reviews.llvm.org/D40144



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


[PATCH] D40329: [CMake][Fuchsia] Disable terminfo database in Fuchsia toolchain

2017-11-21 Thread Petr Hosek via Phabricator via cfe-commits
phosek created this revision.
Herald added a subscriber: mgorny.

It's used to determine whether terminal supports colors, but within LLVM
it's only used in handful of places and in Clang it's only used in AST
dumper, otherwise Clang relies on the -fcolor-diagnostics flag which we
pass explicitly from our build system anyway. This eliminates one of the
shared libraries dependencies making the toolchain less reliant on the
host environment.


Repository:
  rL LLVM

https://reviews.llvm.org/D40329

Files:
  cmake/caches/Fuchsia-stage2.cmake
  cmake/caches/Fuchsia.cmake


Index: cmake/caches/Fuchsia.cmake
===
--- cmake/caches/Fuchsia.cmake
+++ cmake/caches/Fuchsia.cmake
@@ -8,8 +8,9 @@
 set(LLVM_INCLUDE_TESTS OFF CACHE BOOL "")
 set(LLVM_INCLUDE_DOCS OFF CACHE BOOL "")
 set(CLANG_INCLUDE_TESTS OFF CACHE BOOL "")
-set(LLVM_ENABLE_ZLIB OFF CACHE BOOL "")
 set(LLVM_ENABLE_BACKTRACES OFF CACHE BOOL "")
+set(LLVM_ENABLE_TERMINFO OFF CACHE BOOL "")
+set(LLVM_ENABLE_ZLIB OFF CACHE BOOL "")
 set(CLANG_PLUGIN_SUPPORT OFF CACHE BOOL "")
 
 set(CMAKE_BUILD_TYPE Release CACHE STRING "")
Index: cmake/caches/Fuchsia-stage2.cmake
===
--- cmake/caches/Fuchsia-stage2.cmake
+++ cmake/caches/Fuchsia-stage2.cmake
@@ -7,8 +7,9 @@
 
 set(LLVM_INCLUDE_EXAMPLES OFF CACHE BOOL "")
 set(LLVM_INCLUDE_DOCS OFF CACHE BOOL "")
-set(LLVM_ENABLE_ZLIB ON CACHE BOOL "")
 set(LLVM_ENABLE_BACKTRACES OFF CACHE BOOL "")
+set(LLVM_ENABLE_TERMINFO OFF CACHE BOOL "")
+set(LLVM_ENABLE_ZLIB ON CACHE BOOL "")
 set(LLVM_EXTERNALIZE_DEBUGINFO ON CACHE BOOL "")
 set(CLANG_PLUGIN_SUPPORT OFF CACHE BOOL "")
 


Index: cmake/caches/Fuchsia.cmake
===
--- cmake/caches/Fuchsia.cmake
+++ cmake/caches/Fuchsia.cmake
@@ -8,8 +8,9 @@
 set(LLVM_INCLUDE_TESTS OFF CACHE BOOL "")
 set(LLVM_INCLUDE_DOCS OFF CACHE BOOL "")
 set(CLANG_INCLUDE_TESTS OFF CACHE BOOL "")
-set(LLVM_ENABLE_ZLIB OFF CACHE BOOL "")
 set(LLVM_ENABLE_BACKTRACES OFF CACHE BOOL "")
+set(LLVM_ENABLE_TERMINFO OFF CACHE BOOL "")
+set(LLVM_ENABLE_ZLIB OFF CACHE BOOL "")
 set(CLANG_PLUGIN_SUPPORT OFF CACHE BOOL "")
 
 set(CMAKE_BUILD_TYPE Release CACHE STRING "")
Index: cmake/caches/Fuchsia-stage2.cmake
===
--- cmake/caches/Fuchsia-stage2.cmake
+++ cmake/caches/Fuchsia-stage2.cmake
@@ -7,8 +7,9 @@
 
 set(LLVM_INCLUDE_EXAMPLES OFF CACHE BOOL "")
 set(LLVM_INCLUDE_DOCS OFF CACHE BOOL "")
-set(LLVM_ENABLE_ZLIB ON CACHE BOOL "")
 set(LLVM_ENABLE_BACKTRACES OFF CACHE BOOL "")
+set(LLVM_ENABLE_TERMINFO OFF CACHE BOOL "")
+set(LLVM_ENABLE_ZLIB ON CACHE BOOL "")
 set(LLVM_EXTERNALIZE_DEBUGINFO ON CACHE BOOL "")
 set(CLANG_PLUGIN_SUPPORT OFF CACHE BOOL "")
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D40144: Implement `std::launder`

2017-11-21 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF added inline comments.



Comment at: include/new:274
+{
+return __launder(__p);
+}

The call should probably be qualified to `_VSTD::__launder`.



Comment at: 
test/std/language.support/support.dynamic/ptr.launder/launder.nodiscard.fail.cpp:16
+// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
+// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, 
clang-3.8
+

Why is this test unsupported with older compilers? The version of 
`std::launder` in this patch should work regardless of compiler support for 
`__builtin_launder`.

Although, it's possible the compiler requirements were intended to avoid older 
clang versions without `[[nodiscard]]`. However, I don't think `clang-3.8` 
supports C++2a, so the condition seems redundant.




Comment at: 
test/std/language.support/support.dynamic/ptr.launder/launder.types.fail.cpp:28
+void *p = nullptr;
+(void) std::launder((   void *) nullptr);  // 
expected-error-re@new:* {{static_assert failed{{.*}} "can't launder cv-void"}}
+(void) std::launder((const  void *) nullptr);  // 
expected-error-re@new:* {{static_assert failed{{.*}} "can't launder cv-void"}}

Alternatively you could de-duplicate the four identical checks into the single 
check:

```
// expected-error-re@new:* 4 {{static_assert failed{{.*}} "can't launder 
cv-void"}}
```


https://reviews.llvm.org/D40144



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


Re: [PATCH] D40073: [Analyzer] Non-determinism: don't sort indirect goto LabelDecl's by addresses

2017-11-21 Thread Grang, Mandeep Singh via cfe-commits
We have a buildbot setup to uncover such cases of non-determinism: 
http://lab.llvm.org:8011/builders/reverse-iteration


The idea is to iterate unordered containers in reverse to weed out 
pointer ordering issues.


Another instance of non-determinism is relative ordering of elements 
with the same key: 
http://lists.llvm.org/pipermail/llvm-dev/2017-October/118639.html


Feel free to reach out to me to discuss more on this :)

--Mandeep


On 11/21/2017 6:30 PM, Devin Coughlin via Phabricator via cfe-commits wrote:

dcoughlin added a comment.

For clang itself I think we also use a stage-2 clang to build the same version 
of clang and make sure that it matches the stage-2 clang. This doesn't help for 
the analyzer though.


Repository:
   rL LLVM

https://reviews.llvm.org/D40073



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


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


[PATCH] D40073: [Analyzer] Non-determinism: don't sort indirect goto LabelDecl's by addresses

2017-11-21 Thread Devin Coughlin via Phabricator via cfe-commits
dcoughlin added a comment.

For clang itself I think we also use a stage-2 clang to build the same version 
of clang and make sure that it matches the stage-2 clang. This doesn't help for 
the analyzer though.


Repository:
  rL LLVM

https://reviews.llvm.org/D40073



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


[PATCH] D39831: [Driver] Make the use of relax relocations a per target option

2017-11-21 Thread Petr Hosek via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL318816: [Driver] Make the use of relax relocations a per 
target option (authored by phosek).

Changed prior to commit:
  https://reviews.llvm.org/D39831?vs=123838=123870#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D39831

Files:
  cfe/trunk/cmake/caches/Fuchsia-stage2.cmake
  cfe/trunk/include/clang/Driver/ToolChain.h
  cfe/trunk/lib/Driver/ToolChain.cpp
  cfe/trunk/lib/Driver/ToolChains/Clang.cpp
  cfe/trunk/lib/Driver/ToolChains/Fuchsia.h
  cfe/trunk/test/Driver/fuchsia.c


Index: cfe/trunk/test/Driver/fuchsia.c
===
--- cfe/trunk/test/Driver/fuchsia.c
+++ cfe/trunk/test/Driver/fuchsia.c
@@ -5,6 +5,7 @@
 // RUN: --sysroot=%S/platform 2>&1 \
 // RUN: | FileCheck -check-prefixes=CHECK,CHECK-AARCH64 %s
 // CHECK: {{.*}}clang{{.*}}" "-cc1"
+// CHECK: "--mrelax-relocations"
 // CHECK: "-munwind-tables"
 // CHECK: "-fuse-init-array"
 // CHECK: "-isysroot" "[[SYSROOT:[^"]+]]"
Index: cfe/trunk/lib/Driver/ToolChains/Fuchsia.h
===
--- cfe/trunk/lib/Driver/ToolChains/Fuchsia.h
+++ cfe/trunk/lib/Driver/ToolChains/Fuchsia.h
@@ -43,6 +43,7 @@
   bool HasNativeLLVMSupport() const override { return true; }
   bool IsIntegratedAssemblerDefault() const override { return true; }
   bool IsMathErrnoDefault() const override { return false; }
+  bool useRelaxRelocations() const override { return true; };
   RuntimeLibType GetDefaultRuntimeLibType() const override {
 return ToolChain::RLT_CompilerRT;
   }
Index: cfe/trunk/lib/Driver/ToolChains/Clang.cpp
===
--- cfe/trunk/lib/Driver/ToolChains/Clang.cpp
+++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp
@@ -1869,7 +1869,7 @@
   // arg after parsing the '-I' arg.
   bool TakeNextArg = false;
 
-  bool UseRelaxRelocations = ENABLE_X86_RELAX_RELOCATIONS;
+  bool UseRelaxRelocations = C.getDefaultToolChain().useRelaxRelocations();
   const char *MipsTargetFeature = nullptr;
   for (const Arg *A :
Args.filtered(options::OPT_Wa_COMMA, options::OPT_Xassembler)) {
Index: cfe/trunk/lib/Driver/ToolChain.cpp
===
--- cfe/trunk/lib/Driver/ToolChain.cpp
+++ cfe/trunk/lib/Driver/ToolChain.cpp
@@ -90,6 +90,10 @@
   IsIntegratedAssemblerDefault());
 }
 
+bool ToolChain::useRelaxRelocations() const {
+  return ENABLE_X86_RELAX_RELOCATIONS;
+}
+
 const SanitizerArgs& ToolChain::getSanitizerArgs() const {
   if (!SanitizerArguments.get())
 SanitizerArguments.reset(new SanitizerArgs(*this, Args));
Index: cfe/trunk/include/clang/Driver/ToolChain.h
===
--- cfe/trunk/include/clang/Driver/ToolChain.h
+++ cfe/trunk/include/clang/Driver/ToolChain.h
@@ -316,6 +316,9 @@
   /// mixed dispatch method be used?
   virtual bool UseObjCMixedDispatch() const { return false; }
 
+  /// \brief Check whether to enable x86 relax relocations by default.
+  virtual bool useRelaxRelocations() const;
+
   /// GetDefaultStackProtectorLevel - Get the default stack protector level for
   /// this tool chain (0=off, 1=on, 2=strong, 3=all).
   virtual unsigned GetDefaultStackProtectorLevel(bool KernelOrKext) const {
Index: cfe/trunk/cmake/caches/Fuchsia-stage2.cmake
===
--- cfe/trunk/cmake/caches/Fuchsia-stage2.cmake
+++ cfe/trunk/cmake/caches/Fuchsia-stage2.cmake
@@ -18,13 +18,6 @@
   set(CLANG_DEFAULT_LINKER lld CACHE STRING "")
 endif()
 
-# This is a "Does your linker support it?" option that only applies
-# to x86-64 ELF targets.  All Fuchsia target linkers do support it.
-# For x86-64 Linux, it's supported by LLD and by GNU linkers since
-# binutils 2.27, so one can hope that all Linux hosts in use handle it.
-# Ideally this would be settable as a per-target option.
-set(ENABLE_X86_RELAX_RELOCATIONS ON CACHE BOOL "")
-
 if(APPLE)
   set(LLDB_CODESIGN_IDENTITY "" CACHE STRING "")
 endif()


Index: cfe/trunk/test/Driver/fuchsia.c
===
--- cfe/trunk/test/Driver/fuchsia.c
+++ cfe/trunk/test/Driver/fuchsia.c
@@ -5,6 +5,7 @@
 // RUN: --sysroot=%S/platform 2>&1 \
 // RUN: | FileCheck -check-prefixes=CHECK,CHECK-AARCH64 %s
 // CHECK: {{.*}}clang{{.*}}" "-cc1"
+// CHECK: "--mrelax-relocations"
 // CHECK: "-munwind-tables"
 // CHECK: "-fuse-init-array"
 // CHECK: "-isysroot" "[[SYSROOT:[^"]+]]"
Index: cfe/trunk/lib/Driver/ToolChains/Fuchsia.h
===
--- cfe/trunk/lib/Driver/ToolChains/Fuchsia.h
+++ cfe/trunk/lib/Driver/ToolChains/Fuchsia.h
@@ -43,6 +43,7 @@
   bool HasNativeLLVMSupport() const override { return true; }
   bool IsIntegratedAssemblerDefault() const override { return 

r318816 - [Driver] Make the use of relax relocations a per target option

2017-11-21 Thread Petr Hosek via cfe-commits
Author: phosek
Date: Tue Nov 21 17:38:31 2017
New Revision: 318816

URL: http://llvm.org/viewvc/llvm-project?rev=318816=rev
Log:
[Driver] Make the use of relax relocations a per target option

The support for relax relocations is dependent on the linker and
different toolchains within the same compiler can be using different
linkers some of which may or may not support relax relocations.

Give toolchains the option to control whether they want to use relax
relocations in addition to the existing (global) build system option.

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

Modified:
cfe/trunk/cmake/caches/Fuchsia-stage2.cmake
cfe/trunk/include/clang/Driver/ToolChain.h
cfe/trunk/lib/Driver/ToolChain.cpp
cfe/trunk/lib/Driver/ToolChains/Clang.cpp
cfe/trunk/lib/Driver/ToolChains/Fuchsia.h
cfe/trunk/test/Driver/fuchsia.c

Modified: cfe/trunk/cmake/caches/Fuchsia-stage2.cmake
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/cmake/caches/Fuchsia-stage2.cmake?rev=318816=318815=318816=diff
==
--- cfe/trunk/cmake/caches/Fuchsia-stage2.cmake (original)
+++ cfe/trunk/cmake/caches/Fuchsia-stage2.cmake Tue Nov 21 17:38:31 2017
@@ -18,13 +18,6 @@ if(NOT APPLE)
   set(CLANG_DEFAULT_LINKER lld CACHE STRING "")
 endif()
 
-# This is a "Does your linker support it?" option that only applies
-# to x86-64 ELF targets.  All Fuchsia target linkers do support it.
-# For x86-64 Linux, it's supported by LLD and by GNU linkers since
-# binutils 2.27, so one can hope that all Linux hosts in use handle it.
-# Ideally this would be settable as a per-target option.
-set(ENABLE_X86_RELAX_RELOCATIONS ON CACHE BOOL "")
-
 if(APPLE)
   set(LLDB_CODESIGN_IDENTITY "" CACHE STRING "")
 endif()

Modified: cfe/trunk/include/clang/Driver/ToolChain.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/ToolChain.h?rev=318816=318815=318816=diff
==
--- cfe/trunk/include/clang/Driver/ToolChain.h (original)
+++ cfe/trunk/include/clang/Driver/ToolChain.h Tue Nov 21 17:38:31 2017
@@ -316,6 +316,9 @@ public:
   /// mixed dispatch method be used?
   virtual bool UseObjCMixedDispatch() const { return false; }
 
+  /// \brief Check whether to enable x86 relax relocations by default.
+  virtual bool useRelaxRelocations() const;
+
   /// GetDefaultStackProtectorLevel - Get the default stack protector level for
   /// this tool chain (0=off, 1=on, 2=strong, 3=all).
   virtual unsigned GetDefaultStackProtectorLevel(bool KernelOrKext) const {

Modified: cfe/trunk/lib/Driver/ToolChain.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChain.cpp?rev=318816=318815=318816=diff
==
--- cfe/trunk/lib/Driver/ToolChain.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChain.cpp Tue Nov 21 17:38:31 2017
@@ -90,6 +90,10 @@ bool ToolChain::useIntegratedAs() const
   IsIntegratedAssemblerDefault());
 }
 
+bool ToolChain::useRelaxRelocations() const {
+  return ENABLE_X86_RELAX_RELOCATIONS;
+}
+
 const SanitizerArgs& ToolChain::getSanitizerArgs() const {
   if (!SanitizerArguments.get())
 SanitizerArguments.reset(new SanitizerArgs(*this, Args));

Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Clang.cpp?rev=318816=318815=318816=diff
==
--- cfe/trunk/lib/Driver/ToolChains/Clang.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp Tue Nov 21 17:38:31 2017
@@ -1869,7 +1869,7 @@ static void CollectArgsForIntegratedAsse
   // arg after parsing the '-I' arg.
   bool TakeNextArg = false;
 
-  bool UseRelaxRelocations = ENABLE_X86_RELAX_RELOCATIONS;
+  bool UseRelaxRelocations = C.getDefaultToolChain().useRelaxRelocations();
   const char *MipsTargetFeature = nullptr;
   for (const Arg *A :
Args.filtered(options::OPT_Wa_COMMA, options::OPT_Xassembler)) {

Modified: cfe/trunk/lib/Driver/ToolChains/Fuchsia.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Fuchsia.h?rev=318816=318815=318816=diff
==
--- cfe/trunk/lib/Driver/ToolChains/Fuchsia.h (original)
+++ cfe/trunk/lib/Driver/ToolChains/Fuchsia.h Tue Nov 21 17:38:31 2017
@@ -43,6 +43,7 @@ public:
   bool HasNativeLLVMSupport() const override { return true; }
   bool IsIntegratedAssemblerDefault() const override { return true; }
   bool IsMathErrnoDefault() const override { return false; }
+  bool useRelaxRelocations() const override { return true; };
   RuntimeLibType GetDefaultRuntimeLibType() const override {
 return ToolChain::RLT_CompilerRT;
   }

Modified: cfe/trunk/test/Driver/fuchsia.c
URL: 

[PATCH] D40324: [libcxx] [test] Resolve C1XX warning in new vector::size tests caused by assert(true)

2017-11-21 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists added a comment.

D'Oh - that was a paste that went wrong.
You are correct that `assert(c.size() == 3)` is correct.

However, what I was *trying* to fix were the lines before.
Pushing a `3` into a `vector` is not the best idea L#34 and L#53 should 
both read `c.push_back(true);`


https://reviews.llvm.org/D40324



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


r318815 - [X86] Update CPUSupports code to reuse LLVM .def file [NFC]

2017-11-21 Thread Erich Keane via cfe-commits
Author: erichkeane
Date: Tue Nov 21 16:54:01 2017
New Revision: 318815

URL: http://llvm.org/viewvc/llvm-project?rev=318815=rev
Log:
[X86] Update CPUSupports code to reuse LLVM .def file [NFC]

Modified:
cfe/trunk/lib/Basic/Targets/X86.cpp
cfe/trunk/lib/CodeGen/CGBuiltin.cpp

Modified: cfe/trunk/lib/Basic/Targets/X86.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/X86.cpp?rev=318815=318814=318815=diff
==
--- cfe/trunk/lib/Basic/Targets/X86.cpp (original)
+++ cfe/trunk/lib/Basic/Targets/X86.cpp Tue Nov 21 16:54:01 2017
@@ -1251,37 +1251,8 @@ bool X86TargetInfo::hasFeature(StringRef
 // X86TargetInfo::hasFeature for a somewhat comprehensive list).
 bool X86TargetInfo::validateCpuSupports(StringRef FeatureStr) const {
   return llvm::StringSwitch(FeatureStr)
-  .Case("cmov", true)
-  .Case("mmx", true)
-  .Case("popcnt", true)
-  .Case("sse", true)
-  .Case("sse2", true)
-  .Case("sse3", true)
-  .Case("ssse3", true)
-  .Case("sse4.1", true)
-  .Case("sse4.2", true)
-  .Case("avx", true)
-  .Case("avx2", true)
-  .Case("sse4a", true)
-  .Case("fma4", true)
-  .Case("xop", true)
-  .Case("fma", true)
-  .Case("avx512f", true)
-  .Case("bmi", true)
-  .Case("bmi2", true)
-  .Case("aes", true)
-  .Case("pclmul", true)
-  .Case("avx512vl", true)
-  .Case("avx512bw", true)
-  .Case("avx512dq", true)
-  .Case("avx512cd", true)
-  .Case("avx512er", true)
-  .Case("avx512pf", true)
-  .Case("avx512vbmi", true)
-  .Case("avx512ifma", true)
-  .Case("avx5124vnniw", true)
-  .Case("avx5124fmaps", true)
-  .Case("avx512vpopcntdq", true)
+#define X86_FEATURE_COMPAT(VAL, ENUM, STR) .Case(STR, true)
+#include "llvm/Support/X86TargetParser.def"
   .Default(false);
 }
 

Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=318815=318814=318815=diff
==
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Tue Nov 21 16:54:01 2017
@@ -7547,82 +7547,16 @@ Value *CodeGenFunction::EmitX86CpuSuppor
 }
 
 Value *CodeGenFunction::EmitX86CpuSupports(ArrayRef FeatureStrs) {
-  // TODO: When/if this becomes more than x86 specific then use a TargetInfo
-  // based mapping.
   // Processor features and mapping to processor feature value.
-  enum X86Features {
-CMOV = 0,
-MMX,
-POPCNT,
-SSE,
-SSE2,
-SSE3,
-SSSE3,
-SSE4_1,
-SSE4_2,
-AVX,
-AVX2,
-SSE4_A,
-FMA4,
-XOP,
-FMA,
-AVX512F,
-BMI,
-BMI2,
-AES,
-PCLMUL,
-AVX512VL,
-AVX512BW,
-AVX512DQ,
-AVX512CD,
-AVX512ER,
-AVX512PF,
-AVX512VBMI,
-AVX512IFMA,
-AVX5124VNNIW,
-AVX5124FMAPS,
-AVX512VPOPCNTDQ,
-MAX
-  };
 
   uint32_t FeaturesMask = 0;
 
   for (const StringRef  : FeatureStrs) {
-X86Features Feature =
-StringSwitch(FeatureStr)
-.Case("cmov", X86Features::CMOV)
-.Case("mmx", X86Features::MMX)
-.Case("popcnt", X86Features::POPCNT)
-.Case("sse", X86Features::SSE)
-.Case("sse2", X86Features::SSE2)
-.Case("sse3", X86Features::SSE3)
-.Case("ssse3", X86Features::SSSE3)
-.Case("sse4.1", X86Features::SSE4_1)
-.Case("sse4.2", X86Features::SSE4_2)
-.Case("avx", X86Features::AVX)
-.Case("avx2", X86Features::AVX2)
-.Case("sse4a", X86Features::SSE4_A)
-.Case("fma4", X86Features::FMA4)
-.Case("xop", X86Features::XOP)
-.Case("fma", X86Features::FMA)
-.Case("avx512f", X86Features::AVX512F)
-.Case("bmi", X86Features::BMI)
-.Case("bmi2", X86Features::BMI2)
-.Case("aes", X86Features::AES)
-.Case("pclmul", X86Features::PCLMUL)
-.Case("avx512vl", X86Features::AVX512VL)
-.Case("avx512bw", X86Features::AVX512BW)
-.Case("avx512dq", X86Features::AVX512DQ)
-.Case("avx512cd", X86Features::AVX512CD)
-.Case("avx512er", X86Features::AVX512ER)
-.Case("avx512pf", X86Features::AVX512PF)
-.Case("avx512vbmi", X86Features::AVX512VBMI)
-.Case("avx512ifma", X86Features::AVX512IFMA)
-.Case("avx5124vnniw", X86Features::AVX5124VNNIW)
-.Case("avx5124fmaps", X86Features::AVX5124FMAPS)
-.Case("avx512vpopcntdq", X86Features::AVX512VPOPCNTDQ)
-.Default(X86Features::MAX);
-assert(Feature != X86Features::MAX && "Invalid feature!");
+unsigned Feature =
+StringSwitch(FeatureStr)
+#define X86_FEATURE_COMPAT(VAL, ENUM, STR) .Case(STR, VAL)
+#include "llvm/Support/X86TargetParser.def"
+   

[PATCH] D40228: [Target] Make a copy of TargetOptions feature list before sorting during CodeGen

2017-11-21 Thread Craig Topper via Phabricator via cfe-commits
craig.topper updated this revision to Diff 123862.
craig.topper retitled this revision from "[Target] Keep the TargetOptions 
feature list sorted instead of sorting during CodeGen" to "[Target] Make a copy 
of TargetOptions feature list before sorting during CodeGen".
craig.topper edited the summary of this revision.
craig.topper added a comment.

Make a copy before sorting and combine some repeated code that this exposed.


https://reviews.llvm.org/D40228

Files:
  lib/CodeGen/CGCall.cpp


Index: lib/CodeGen/CGCall.cpp
===
--- lib/CodeGen/CGCall.cpp
+++ lib/CodeGen/CGCall.cpp
@@ -1877,13 +1877,13 @@
 // we have a decl for the function and it has a target attribute then
 // parse that and add it to the feature set.
 StringRef TargetCPU = getTarget().getTargetOpts().CPU;
+std::vector Features;
 const FunctionDecl *FD = dyn_cast_or_null(TargetDecl);
 if (FD && FD->hasAttr()) {
   llvm::StringMap FeatureMap;
   getFunctionFeatureMap(FeatureMap, FD);
 
   // Produce the canonical string for this set of features.
-  std::vector Features;
   for (llvm::StringMap::const_iterator it = FeatureMap.begin(),
  ie = FeatureMap.end();
it != ie; ++it)
@@ -1898,26 +1898,19 @@
   if (ParsedAttr.Architecture != "" &&
   getTarget().isValidCPUName(ParsedAttr.Architecture))
 TargetCPU = ParsedAttr.Architecture;
-  if (TargetCPU != "")
- FuncAttrs.addAttribute("target-cpu", TargetCPU);
-  if (!Features.empty()) {
-std::sort(Features.begin(), Features.end());
-FuncAttrs.addAttribute(
-"target-features",
-llvm::join(Features, ","));
-  }
 } else {
   // Otherwise just add the existing target cpu and target features to the
   // function.
-  std::vector  = 
getTarget().getTargetOpts().Features;
-  if (TargetCPU != "")
-FuncAttrs.addAttribute("target-cpu", TargetCPU);
-  if (!Features.empty()) {
-std::sort(Features.begin(), Features.end());
-FuncAttrs.addAttribute(
-"target-features",
-llvm::join(Features, ","));
-  }
+  Features = getTarget().getTargetOpts().Features;
+}
+
+if (TargetCPU != "")
+  FuncAttrs.addAttribute("target-cpu", TargetCPU);
+if (!Features.empty()) {
+  std::sort(Features.begin(), Features.end());
+  FuncAttrs.addAttribute(
+  "target-features",
+  llvm::join(Features, ","));
 }
   }
 


Index: lib/CodeGen/CGCall.cpp
===
--- lib/CodeGen/CGCall.cpp
+++ lib/CodeGen/CGCall.cpp
@@ -1877,13 +1877,13 @@
 // we have a decl for the function and it has a target attribute then
 // parse that and add it to the feature set.
 StringRef TargetCPU = getTarget().getTargetOpts().CPU;
+std::vector Features;
 const FunctionDecl *FD = dyn_cast_or_null(TargetDecl);
 if (FD && FD->hasAttr()) {
   llvm::StringMap FeatureMap;
   getFunctionFeatureMap(FeatureMap, FD);
 
   // Produce the canonical string for this set of features.
-  std::vector Features;
   for (llvm::StringMap::const_iterator it = FeatureMap.begin(),
  ie = FeatureMap.end();
it != ie; ++it)
@@ -1898,26 +1898,19 @@
   if (ParsedAttr.Architecture != "" &&
   getTarget().isValidCPUName(ParsedAttr.Architecture))
 TargetCPU = ParsedAttr.Architecture;
-  if (TargetCPU != "")
- FuncAttrs.addAttribute("target-cpu", TargetCPU);
-  if (!Features.empty()) {
-std::sort(Features.begin(), Features.end());
-FuncAttrs.addAttribute(
-"target-features",
-llvm::join(Features, ","));
-  }
 } else {
   // Otherwise just add the existing target cpu and target features to the
   // function.
-  std::vector  = getTarget().getTargetOpts().Features;
-  if (TargetCPU != "")
-FuncAttrs.addAttribute("target-cpu", TargetCPU);
-  if (!Features.empty()) {
-std::sort(Features.begin(), Features.end());
-FuncAttrs.addAttribute(
-"target-features",
-llvm::join(Features, ","));
-  }
+  Features = getTarget().getTargetOpts().Features;
+}
+
+if (TargetCPU != "")
+  FuncAttrs.addAttribute("target-cpu", TargetCPU);
+if (!Features.empty()) {
+  std::sort(Features.begin(), Features.end());
+  FuncAttrs.addAttribute(
+  "target-features",
+  llvm::join(Features, ","));
 }
   }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D39831: [Driver] Make the use of relax relocations a per target option

2017-11-21 Thread Rafael Avila de Espindola via cfe-commits
Petr Hosek  writes:

> That's the Fuchsia CMake cache file which is used to build Fuchsia
> toolchain, it's not needed there anymore because Fuchsia Clang driver now
> handles this. I haven't touched Clang's CMakeLists.txt which defines
> the ENABLE_X86_RELAX_RELOCATIONS option.

Oops, I guess I should have read the filename.

LGTM.

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


Re: r318692 - [OpenMP] Initial implementation of code generation for pragma 'teams distribute parallel for' on host

2017-11-21 Thread Carlo Bertolli via cfe-commits
Hi Douglas
 
Thanks for letting me know - I was not notified by bbot about this.
Thanks to Jonas too. I will keep looking at the bbot to see if this resurfaces.
 
Thanks!
 
-- Carlo
 
- Original message -From: Jonas Hahnfeld To: "Yung, Douglas" Cc: Carlo Bertolli , cfe-commits Subject: Re: r318692 - [OpenMP] Initial implementation of code generation for pragma 'teams distribute parallel for' on hostDate: Tue, Nov 21, 2017 6:11 PM 
Hi,these failures were probably introduced by r318789, Richard Trieu shouldhave fixed them in r318811.https://urldefense.proofpoint.com/v2/url?u=http-3A__lab.llvm.org-3A8011_builders_llvm-2Dclang-2Dlld-2Dx86-5F64-2Dscei-2Dps4-2Dubuntu-2Dfast_builds_20991=DwICAg=jf_iaSHvJObTbx-siA1ZOg=KVjg5Cs0EAoazAUlw8ewR94xDrSR5dmudAuVb_TqxaY=vDNoKAps3Gw9D7TKDTj2OX5kJXxfFuDTg_JeBIO65iw=rZ_dOdGiZBnt7xp_0OU6LBUvsVzllqAx8TN3gZXGf_c= is already green ;-)JonasAm 2017-11-21 17:37, schrieb Yung, Douglas via cfe-commits:> Hi Carlo,>> The following four tests that you added with this commit are failing> on the PS4 Windows and PS4 Linux bot:>>     Clang :: OpenMP/teams_distribute_parallel_for_codegen.cpp>     Clang ::> OpenMP/teams_distribute_parallel_for_firstprivate_codegen.cpp>     Clang :: OpenMP/teams_distribute_parallel_for_private_codegen.cpp>     Clang :: OpenMP/teams_distribute_parallel_for_reduction_codegen.cpp>> Can you take a look so that we can get the bot back to green?>> Linux:> https://urldefense.proofpoint.com/v2/url?u=http-3A__lab.llvm.org-3A8011_builders_llvm-2Dclang-2Dlld-2Dx86-5F64-2Dscei-2Dps4-2Dubuntu-2Dfast_builds_20990=DwICAg=jf_iaSHvJObTbx-siA1ZOg=KVjg5Cs0EAoazAUlw8ewR94xDrSR5dmudAuVb_TqxaY=vDNoKAps3Gw9D7TKDTj2OX5kJXxfFuDTg_JeBIO65iw=4k6apsaYErapXU_-dFkgo0AHHCjfiVVW22DDR3HqHNE=> Windows:> https://urldefense.proofpoint.com/v2/url?u=http-3A__lab.llvm.org-3A8011_builders_llvm-2Dclang-2Dlld-2Dx86-5F64-2Dscei-2Dps4-2Dwindows10pro-2Dfast_builds_13643=DwICAg=jf_iaSHvJObTbx-siA1ZOg=KVjg5Cs0EAoazAUlw8ewR94xDrSR5dmudAuVb_TqxaY=vDNoKAps3Gw9D7TKDTj2OX5kJXxfFuDTg_JeBIO65iw=P-lDxQcJiIo4cNAz8ui_t1tCE2_cb2xmPJ1BP9TbdS0=>> Thanks!>> Douglas Yung>>> -Original Message->> From: cfe-commits [mailto:cfe-commits-boun...@lists.llvm.org] On>> Behalf Of>> Carlo Bertolli via cfe-commits>> Sent: Monday, November 20, 2017 12:47>> To: cfe-commits@lists.llvm.org>> Subject: r318692 - [OpenMP] Initial implementation of code generation>> for>> pragma 'teams distribute parallel for' on host Author: cbertol>> Date: Mon Nov 20 12:46:39 2017>> New Revision: 318692 URL: https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D318692-26view-3Drev=DwICAg=jf_iaSHvJObTbx-siA1ZOg=KVjg5Cs0EAoazAUlw8ewR94xDrSR5dmudAuVb_TqxaY=vDNoKAps3Gw9D7TKDTj2OX5kJXxfFuDTg_JeBIO65iw=44Pq1a_TgsqIXo27HkEo8EUuutqCd262wbRbA2Sxf6s=>> Log:>> [OpenMP] Initial implementation of code generation for pragma 'teams>> distribute parallel for' on host https://urldefense.proofpoint.com/v2/url?u=https-3A__reviews.llvm.org_D40187=DwICAg=jf_iaSHvJObTbx-siA1ZOg=KVjg5Cs0EAoazAUlw8ewR94xDrSR5dmudAuVb_TqxaY=vDNoKAps3Gw9D7TKDTj2OX5kJXxfFuDTg_JeBIO65iw=kuUORMavqGBH4lopxlbrj3mN5CHrZvbBxLYuJAn7U-4= This patch implements code gen for 'teams distribute parallel for' on>> the>> host, including all its clauses and related regression tests.>> Added:>>     cfe/trunk/test/OpenMP/teams_distribute_parallel_for_codegen.cpp>>    >> cfe/trunk/test/OpenMP/teams_distribute_parallel_for_collapse_codegen.cpp>>    >> cfe/trunk/test/OpenMP/teams_distribute_parallel_for_copyin_codegen.cpp cfe/trunk/test/OpenMP/teams_distribute_parallel_for_dist_schedule_codegen.cpp cfe/trunk/test/OpenMP/teams_distribute_parallel_for_firstprivate_codegen.cpp>>     cfe/trunk/test/OpenMP/teams_distribute_parallel_for_if_codegen.cpp cfe/trunk/test/OpenMP/teams_distribute_parallel_for_lastprivate_codegen.cpp cfe/trunk/test/OpenMP/teams_distribute_parallel_for_num_threads_codegen.cpp>>    >> cfe/trunk/test/OpenMP/teams_distribute_parallel_for_private_codegen.cpp>>    >> cfe/trunk/test/OpenMP/teams_distribute_parallel_for_proc_bind_codegen.cpp>>    >> cfe/trunk/test/OpenMP/teams_distribute_parallel_for_reduction_codegen.cpp>>    >> cfe/trunk/test/OpenMP/teams_distribute_parallel_for_schedule_codegen.cpp>> Modified:>>     cfe/trunk/lib/Basic/OpenMPKinds.cpp>>     cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp>>     cfe/trunk/lib/Sema/SemaOpenMP.cpp [...] 
 

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


Re: [PATCH] D39831: [Driver] Make the use of relax relocations a per target option

2017-11-21 Thread Petr Hosek via cfe-commits
That's the Fuchsia CMake cache file which is used to build Fuchsia
toolchain, it's not needed there anymore because Fuchsia Clang driver now
handles this. I haven't touched Clang's CMakeLists.txt which defines
the ENABLE_X86_RELAX_RELOCATIONS option.

On Tue, Nov 21, 2017 at 3:14 PM Rafael Avila de Espindola <
rafael.espind...@gmail.com> wrote:

> I am probably missing something, but the patch has
>
> -# This is a "Does your linker support it?" option that only applies
> -# to x86-64 ELF targets.  All Fuchsia target linkers do support it.
> -# For x86-64 Linux, it's supported by LLD and by GNU linkers since
> -# binutils 2.27, so one can hope that all Linux hosts in use handle it.
> -# Ideally this would be settable as a per-target option.
> -set(ENABLE_X86_RELAX_RELOCATIONS ON CACHE BOOL "")
>
> And I don't see what that is replaced with.
>
> Cheers,
> Rafael
>
> Petr Hosek  writes:
>
> > I kept the CMake option, so by default the driver will use the value set
> > through CMake as before but individual targets can now set their platform
> > default.
> >
> > On Tue, Nov 21, 2017 at 1:30 PM Rafael Avila de Espindola <
> > rafael.espind...@gmail.com> wrote:
> >
> >> Petr Hosek via Phabricator  writes:
> >>
> >>
> >> > -# This is a "Does your linker support it?" option that only applies
> >> > -# to x86-64 ELF targets.  All Fuchsia target linkers do support it.
> >> > -# For x86-64 Linux, it's supported by LLD and by GNU linkers since
> >> > -# binutils 2.27, so one can hope that all Linux hosts in use handle
> it.
> >> > -# Ideally this would be settable as a per-target option.
> >> > -set(ENABLE_X86_RELAX_RELOCATIONS ON CACHE BOOL "")
> >> > -
> >>
> >> We still have to be able to set it via cmake.
> >>
> >> Cheers,
> >> Rafeal
> >>
>


smime.p7s
Description: S/MIME Cryptographic Signature
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r318813 - [AST] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

2017-11-21 Thread Eugene Zelenko via cfe-commits
Author: eugenezelenko
Date: Tue Nov 21 15:26:08 2017
New Revision: 318813

URL: http://llvm.org/viewvc/llvm-project?rev=318813=rev
Log:
[AST] Fix some Clang-tidy modernize and Include What You Use warnings; other 
minor fixes (NFC).

Modified:
cfe/trunk/include/clang/AST/DeclarationName.h
cfe/trunk/include/clang/AST/NestedNameSpecifier.h
cfe/trunk/include/clang/AST/StmtIterator.h
cfe/trunk/include/clang/AST/TemplateBase.h
cfe/trunk/include/clang/AST/TemplateName.h
cfe/trunk/include/clang/AST/UnresolvedSet.h
cfe/trunk/lib/AST/DeclarationName.cpp
cfe/trunk/lib/AST/NestedNameSpecifier.cpp
cfe/trunk/lib/AST/StmtIterator.cpp
cfe/trunk/lib/AST/TemplateBase.cpp
cfe/trunk/lib/AST/TemplateName.cpp

Modified: cfe/trunk/include/clang/AST/DeclarationName.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclarationName.h?rev=318813=318812=318813=diff
==
--- cfe/trunk/include/clang/AST/DeclarationName.h (original)
+++ cfe/trunk/include/clang/AST/DeclarationName.h Tue Nov 21 15:26:08 2017
@@ -1,4 +1,4 @@
-//===-- DeclarationName.h - Representation of declaration names -*- C++ 
-*-===//
+//===- DeclarationName.h - Representation of declaration names --*- C++ 
-*-===//
 //
 // The LLVM Compiler Infrastructure
 //
@@ -10,36 +10,42 @@
 // This file declares the DeclarationName and DeclarationNameTable classes.
 //
 
//===--===//
+
 #ifndef LLVM_CLANG_AST_DECLARATIONNAME_H
 #define LLVM_CLANG_AST_DECLARATIONNAME_H
 
+#include "clang/Basic/Diagnostic.h"
 #include "clang/Basic/IdentifierTable.h"
 #include "clang/Basic/PartialDiagnostic.h"
+#include "clang/Basic/SourceLocation.h"
+#include "llvm/ADT/DenseMapInfo.h"
 #include "llvm/Support/Compiler.h"
-
-namespace llvm {
-  template  struct DenseMapInfo;
-}
+#include "llvm/Support/type_traits.h"
+#include 
+#include 
+#include 
+#include 
 
 namespace clang {
-  class ASTContext;
-  class CXXDeductionGuideNameExtra;
-  class CXXLiteralOperatorIdName;
-  class CXXOperatorIdName;
-  class CXXSpecialName;
-  class DeclarationNameExtra;
-  class IdentifierInfo;
-  class MultiKeywordSelector;
-  enum OverloadedOperatorKind : int;
-  struct PrintingPolicy;
-  class QualType;
-  class TemplateDecl;
-  class Type;
-  class TypeSourceInfo;
-  class UsingDirectiveDecl;
 
-  template  class CanQual;
-  typedef CanQual CanQualType;
+class ASTContext;
+template  class CanQual;
+class CXXDeductionGuideNameExtra;
+class CXXLiteralOperatorIdName;
+class CXXOperatorIdName;
+class CXXSpecialName;
+class DeclarationNameExtra;
+class IdentifierInfo;
+class MultiKeywordSelector;
+enum OverloadedOperatorKind : int;
+struct PrintingPolicy;
+class QualType;
+class TemplateDecl;
+class Type;
+class TypeSourceInfo;
+class UsingDirectiveDecl;
+
+using CanQualType = CanQual;
 
 /// DeclarationName - The name of a declaration. In the common case,
 /// this just stores an IdentifierInfo pointer to a normal
@@ -63,9 +69,13 @@ public:
 CXXLiteralOperatorName,
 CXXUsingDirective
   };
+
   static const unsigned NumNameKinds = CXXUsingDirective + 1;
 
 private:
+  friend class DeclarationNameTable;
+  friend class NamedDecl;
+
   /// StoredNameKind - The kind of name that is actually stored in the
   /// upper bits of the Ptr field. This is only used internally.
   ///
@@ -99,7 +109,18 @@ private:
   ///   DeclarationNameExtra structure, whose first value will tell us
   ///   whether this is an Objective-C selector, C++ operator-id name,
   ///   or special C++ name.
-  uintptr_t Ptr;
+  uintptr_t Ptr = 0;
+
+  // Construct a declaration name from the name of a C++ constructor,
+  // destructor, or conversion function.
+  DeclarationName(DeclarationNameExtra *Name)
+  : Ptr(reinterpret_cast(Name)) {
+assert((Ptr & PtrMask) == 0 && "Improperly aligned DeclarationNameExtra");
+Ptr |= StoredDeclarationNameExtra;
+  }
+
+  /// Construct a declaration name from a raw pointer.
+  DeclarationName(uintptr_t Ptr) : Ptr(Ptr) {}
 
   /// getStoredNameKind - Return the kind of object that is stored in
   /// Ptr.
@@ -146,36 +167,22 @@ private:
 return nullptr;
   }
 
-  // Construct a declaration name from the name of a C++ constructor,
-  // destructor, or conversion function.
-  DeclarationName(DeclarationNameExtra *Name)
-: Ptr(reinterpret_cast(Name)) {
-assert((Ptr & PtrMask) == 0 && "Improperly aligned DeclarationNameExtra");
-Ptr |= StoredDeclarationNameExtra;
-  }
-
-  /// Construct a declaration name from a raw pointer.
-  DeclarationName(uintptr_t Ptr) : Ptr(Ptr) { }
-
-  friend class DeclarationNameTable;
-  friend class NamedDecl;
-
   /// getFETokenInfoAsVoidSlow - Retrieves the front end-specified pointer
   /// for this name as a void pointer if it's not an identifier.
   void *getFETokenInfoAsVoidSlow() const;
 
 public:
   /// DeclarationName - 

[PATCH] D40325: add new check to find OSSpinlock usage

2017-11-21 Thread Yan Zhang via Phabricator via cfe-commits
Wizard updated this revision to Diff 123860.
Wizard added a comment.

add doc to header file


https://reviews.llvm.org/D40325

Files:
  clang-tidy/objc/AvoidSpinlockCheck.cpp
  clang-tidy/objc/AvoidSpinlockCheck.h
  clang-tidy/objc/CMakeLists.txt
  clang-tidy/objc/ObjCTidyModule.cpp
  docs/ReleaseNotes.rst
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/objc-avoid-spinlock.rst
  test/clang-tidy/objc-avoid-spinlock.m

Index: test/clang-tidy/objc-avoid-spinlock.m
===
--- /dev/null
+++ test/clang-tidy/objc-avoid-spinlock.m
@@ -0,0 +1,16 @@
+// RUN: %check_clang_tidy %s objc-avoid-spinlock %t
+
+typedef int OSSpinLock;
+void OSSpinlockTry(OSSpinLock *__lock) {}
+
+@implementation Foo
+- (void)f {
+int i = 1;
+OSSpinlockLock();
+// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: OSSpinlock is deprecated on iOS. Please use other locks or dispatch queue. [objc-avoid-spinlock]
+OSSpinlockTry();
+// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: OSSpinlock is deprecated on iOS. Please use other locks or dispatch queue. [objc-avoid-spinlock]
+OSSpinlockUnlock();
+// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: OSSpinlock is deprecated on iOS. Please use other locks or dispatch queue. [objc-avoid-spinlock]
+}
+@end
Index: docs/clang-tidy/checks/objc-avoid-spinlock.rst
===
--- /dev/null
+++ docs/clang-tidy/checks/objc-avoid-spinlock.rst
@@ -0,0 +1,15 @@
+.. title:: clang-tidy - objc-avoid-spinlock
+
+objc-avoid-spinlock
+===
+
+Finds usages of OSSpinlock in Objective-C files, which is deprecated due to potential
+livelock problems. 
+
+This check will detect following function invocations:
+
+- `OSSpinlockLock`
+- `OSSpinlockTry`
+- `OSSpinlockUnlcok`
+
+The corresponding information about the problem of OSSpinlock: https://blog.postmates.com/why-spinlocks-are-bad-on-ios-b69fc5221058
Index: docs/clang-tidy/checks/list.rst
===
--- docs/clang-tidy/checks/list.rst
+++ docs/clang-tidy/checks/list.rst
@@ -175,6 +175,7 @@
modernize-use-using
mpi-buffer-deref
mpi-type-mismatch
+   objc-avoid-spinlock
objc-forbidden-subclassing
objc-property-declaration
performance-faster-string-find
Index: docs/ReleaseNotes.rst
===
--- docs/ReleaseNotes.rst
+++ docs/ReleaseNotes.rst
@@ -57,6 +57,11 @@
 Improvements to clang-tidy
 --
 
+- New `objc-avoid-spinlock
+  `_ check
+
+  Add new check to detect the use of OSSpinlock in Objective-C files.
+
 - New `google-avoid-throwing-objc-exception
   `_ check
 
Index: clang-tidy/objc/ObjCTidyModule.cpp
===
--- clang-tidy/objc/ObjCTidyModule.cpp
+++ clang-tidy/objc/ObjCTidyModule.cpp
@@ -10,6 +10,7 @@
 #include "../ClangTidy.h"
 #include "../ClangTidyModule.h"
 #include "../ClangTidyModuleRegistry.h"
+#include "AvoidSpinlockCheck.h"
 #include "ForbiddenSubclassingCheck.h"
 #include "PropertyDeclarationCheck.h"
 
@@ -22,6 +23,8 @@
 class ObjCModule : public ClangTidyModule {
 public:
   void addCheckFactories(ClangTidyCheckFactories ) override {
+CheckFactories.registerCheck(
+"objc-avoid-spinlock");
 CheckFactories.registerCheck(
 "objc-forbidden-subclassing");
 CheckFactories.registerCheck(
Index: clang-tidy/objc/CMakeLists.txt
===
--- clang-tidy/objc/CMakeLists.txt
+++ clang-tidy/objc/CMakeLists.txt
@@ -1,6 +1,7 @@
 set(LLVM_LINK_COMPONENTS support)
 
 add_clang_library(clangTidyObjCModule
+  AvoidSpinlockCheck.cpp
   ForbiddenSubclassingCheck.cpp
   ObjCTidyModule.cpp
   PropertyDeclarationCheck.cpp
Index: clang-tidy/objc/AvoidSpinlockCheck.h
===
--- /dev/null
+++ clang-tidy/objc/AvoidSpinlockCheck.h
@@ -0,0 +1,36 @@
+//===--- AvoidSpinlockCheck.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 LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_OBJC_AVOID_SPINLOCK_H
+#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_OBJC_AVOID_SPINLOCK_H
+
+#include "../ClangTidy.h"
+
+namespace clang {
+namespace tidy {
+namespace objc {
+
+/// Finds usages of OSSpinlock in Objective-C files, which is deprecated due to
+/// potential livelock problems.
+///
+/// For the user-facing documentation see:
+/// 

Re: [PATCH] D39831: [Driver] Make the use of relax relocations a per target option

2017-11-21 Thread Rafael Avila de Espindola via cfe-commits
I am probably missing something, but the patch has

-# This is a "Does your linker support it?" option that only applies
-# to x86-64 ELF targets.  All Fuchsia target linkers do support it.
-# For x86-64 Linux, it's supported by LLD and by GNU linkers since
-# binutils 2.27, so one can hope that all Linux hosts in use handle it.
-# Ideally this would be settable as a per-target option.
-set(ENABLE_X86_RELAX_RELOCATIONS ON CACHE BOOL "")

And I don't see what that is replaced with.

Cheers,
Rafael

Petr Hosek  writes:

> I kept the CMake option, so by default the driver will use the value set
> through CMake as before but individual targets can now set their platform
> default.
>
> On Tue, Nov 21, 2017 at 1:30 PM Rafael Avila de Espindola <
> rafael.espind...@gmail.com> wrote:
>
>> Petr Hosek via Phabricator  writes:
>>
>>
>> > -# This is a "Does your linker support it?" option that only applies
>> > -# to x86-64 ELF targets.  All Fuchsia target linkers do support it.
>> > -# For x86-64 Linux, it's supported by LLD and by GNU linkers since
>> > -# binutils 2.27, so one can hope that all Linux hosts in use handle it.
>> > -# Ideally this would be settable as a per-target option.
>> > -set(ENABLE_X86_RELAX_RELOCATIONS ON CACHE BOOL "")
>> > -
>>
>> We still have to be able to set it via cmake.
>>
>> Cheers,
>> Rafeal
>>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r318692 - [OpenMP] Initial implementation of code generation for pragma 'teams distribute parallel for' on host

2017-11-21 Thread Jonas Hahnfeld via cfe-commits

Hi,

these failures were probably introduced by r318789, Richard Trieu should 
have fixed them in r318811.
http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/20991 
is already green ;-)


Jonas

Am 2017-11-21 17:37, schrieb Yung, Douglas via cfe-commits:

Hi Carlo,

The following four tests that you added with this commit are failing
on the PS4 Windows and PS4 Linux bot:

Clang :: OpenMP/teams_distribute_parallel_for_codegen.cpp
Clang :: 
OpenMP/teams_distribute_parallel_for_firstprivate_codegen.cpp

Clang :: OpenMP/teams_distribute_parallel_for_private_codegen.cpp
Clang :: OpenMP/teams_distribute_parallel_for_reduction_codegen.cpp

Can you take a look so that we can get the bot back to green?

Linux:
http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/20990
Windows:
http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/13643

Thanks!

Douglas Yung


-Original Message-
From: cfe-commits [mailto:cfe-commits-boun...@lists.llvm.org] On 
Behalf Of

Carlo Bertolli via cfe-commits
Sent: Monday, November 20, 2017 12:47
To: cfe-commits@lists.llvm.org
Subject: r318692 - [OpenMP] Initial implementation of code generation 
for

pragma 'teams distribute parallel for' on host

Author: cbertol
Date: Mon Nov 20 12:46:39 2017
New Revision: 318692

URL: http://llvm.org/viewvc/llvm-project?rev=318692=rev
Log:
[OpenMP] Initial implementation of code generation for pragma 'teams
distribute parallel for' on host

https://reviews.llvm.org/D40187

This patch implements code gen for 'teams distribute parallel for' on 
the

host, including all its clauses and related regression tests.


Added:
cfe/trunk/test/OpenMP/teams_distribute_parallel_for_codegen.cpp

cfe/trunk/test/OpenMP/teams_distribute_parallel_for_collapse_codegen.cpp

cfe/trunk/test/OpenMP/teams_distribute_parallel_for_copyin_codegen.cpp


cfe/trunk/test/OpenMP/teams_distribute_parallel_for_dist_schedule_codegen.cpp

cfe/trunk/test/OpenMP/teams_distribute_parallel_for_firstprivate_codegen.cpp
cfe/trunk/test/OpenMP/teams_distribute_parallel_for_if_codegen.cpp

cfe/trunk/test/OpenMP/teams_distribute_parallel_for_lastprivate_codegen.cpp

cfe/trunk/test/OpenMP/teams_distribute_parallel_for_num_threads_codegen.cpp

cfe/trunk/test/OpenMP/teams_distribute_parallel_for_private_codegen.cpp

cfe/trunk/test/OpenMP/teams_distribute_parallel_for_proc_bind_codegen.cpp

cfe/trunk/test/OpenMP/teams_distribute_parallel_for_reduction_codegen.cpp

cfe/trunk/test/OpenMP/teams_distribute_parallel_for_schedule_codegen.cpp

Modified:
cfe/trunk/lib/Basic/OpenMPKinds.cpp
cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp
cfe/trunk/lib/Sema/SemaOpenMP.cpp

[...]

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


[PATCH] D40108: [clang-tidy] Adding Fuchsia checkers to clang-tidy

2017-11-21 Thread Julie Hockett via Phabricator via cfe-commits
juliehockett updated this revision to Diff 123857.
juliehockett marked 6 inline comments as done.
juliehockett added a comment.

Disabled the fix-it for `getDefaultArgRange()` that returns an empty range and 
for default args that come from a macro.


https://reviews.llvm.org/D40108

Files:
  clang-tidy/CMakeLists.txt
  clang-tidy/fuchsia/CMakeLists.txt
  clang-tidy/fuchsia/DefaultArgumentsCheck.cpp
  clang-tidy/fuchsia/DefaultArgumentsCheck.h
  clang-tidy/fuchsia/FuchsiaTidyModule.cpp
  clang-tidy/tool/CMakeLists.txt
  clang-tidy/tool/ClangTidyMain.cpp
  docs/ReleaseNotes.rst
  docs/clang-tidy/checks/fuchsia-default-arguments.rst
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/index.rst
  test/clang-tidy/fuchsia-default-arguments.cpp

Index: test/clang-tidy/fuchsia-default-arguments.cpp
===
--- /dev/null
+++ test/clang-tidy/fuchsia-default-arguments.cpp
@@ -0,0 +1,57 @@
+// RUN: %check_clang_tidy %s fuchsia-default-arguments %t
+
+int foo(int value = 5) { return value; }
+// CHECK-MESSAGES: [[@LINE-1]]:9: warning: declaring a parameter with a default argument is disallowed [fuchsia-default-arguments]
+// CHECK-FIXES: int foo(int value) { return value; }
+
+int f() {
+  foo();
+  // CHECK-MESSAGES: [[@LINE-1]]:3: warning: calling a function that uses a default argument is disallowed [fuchsia-default-arguments]
+  // CHECK-NEXT: note: the default parameter was declared here:
+  // CHECK-NEXT: int foo(int value = 5) { return value; }
+}
+
+int bar(int value) { return value; }
+
+int n() {
+  foo(0);
+  bar(0);
+}
+
+class Baz {
+public:
+  int a(int value = 5) { return value; }
+  // CHECK-MESSAGES: [[@LINE-1]]:9: warning: declaring a parameter with a default argument is disallowed [fuchsia-default-arguments]
+  // CHECK-FIXES: int a(int value) { return value; }
+
+  int b(int value) { return value; }
+};
+
+class Foo {
+  // Fix should be suggested in declaration
+  int a(int value = 53);
+  // CHECK-MESSAGES: [[@LINE-1]]:9: warning: declaring a parameter with a default argument is disallowed [fuchsia-default-arguments]
+  // CHECK-FIXES: int a(int value);
+};
+
+// Fix shouldn't be suggested in implementation
+int Foo::a(int value) {
+  return value;
+  // CHECK-MESSAGES: [[@LINE-2]]:12: warning: declaring a parameter with a default argument is disallowed [fuchsia-default-arguments]
+  // CHECK-NEXT: note: the default parameter was declared here:
+  // CHECK-NEXT: int a(int value = 53);
+}
+
+// Elided functions
+void f(int = 5) {};
+// CHECK-MESSAGES: [[@LINE-1]]:8: warning: declaring a parameter with a default argument is disallowed [fuchsia-default-arguments]
+// CHECK-FIXES: void f(int) {};
+
+void g(int) {};
+
+// Should not suggest fix for macro-defined parameters
+#define D(val) = val
+
+void h(int i D(5));
+// CHECK-MESSAGES: [[@LINE-1]]:8: warning: declaring a parameter with a default argument is disallowed [fuchsia-default-arguments]
+// CHECK-FIXES-NOT: void h(int i);
Index: docs/clang-tidy/index.rst
===
--- docs/clang-tidy/index.rst
+++ docs/clang-tidy/index.rst
@@ -61,6 +61,7 @@
 ``cert-``  Checks related to CERT Secure Coding Guidelines.
 ``cppcoreguidelines-`` Checks related to C++ Core Guidelines.
 ``clang-analyzer-``Clang Static Analyzer checks.
+``fuchsia-``   Checks related to Fuchsia coding conventions.
 ``google-``Checks related to Google coding conventions.
 ``hicpp-`` Checks related to High Integrity C++ Coding Standard.
 ``llvm-``  Checks related to the LLVM coding conventions.
Index: docs/clang-tidy/checks/list.rst
===
--- docs/clang-tidy/checks/list.rst
+++ docs/clang-tidy/checks/list.rst
@@ -55,6 +55,7 @@
cppcoreguidelines-pro-type-vararg
cppcoreguidelines-slicing
cppcoreguidelines-special-member-functions
+   fuchsia-default-arguments
google-build-explicit-make-pair
google-build-namespaces
google-build-using-namespace
Index: docs/clang-tidy/checks/fuchsia-default-arguments.rst
===
--- /dev/null
+++ docs/clang-tidy/checks/fuchsia-default-arguments.rst
@@ -0,0 +1,24 @@
+.. title:: clang-tidy - fuchsia-default-arguments
+
+fuchsia-default-arguments
+=
+
+Warns if a function is declared or called with default arguments.
+
+For example, the declaration:
+
+.. code-block:: c++
+
+  int foo(int value = 5) { return value; }
+
+will cause a warning.
+
+A function call expression that uses a default argument will be diagnosed.
+Calling it without defaults will not cause a warning:
+
+.. code-block:: c++
+
+  foo();  // warning
+  foo(0); // no warning
+
+See the features disallowed in Fuchsia at https://fuchsia.googlesource.com/zircon/+/master/docs/cxx.md
Index: docs/ReleaseNotes.rst

[PATCH] D40324: [libcxx] [test] Resolve C1XX warning in new vector::size tests caused by assert(true)

2017-11-21 Thread Billy Robert O'Neal III via Phabricator via cfe-commits
BillyONeal closed this revision.
BillyONeal added a comment.

Committed r318812


https://reviews.llvm.org/D40324



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


[PATCH] D40108: [clang-tidy] Adding Fuchsia checkers to clang-tidy

2017-11-21 Thread Julie Hockett via Phabricator via cfe-commits
juliehockett added a comment.

We're going to go with fuchsia-* for the module name, since the style applies 
to the broader project. Also, there may be zircon-specific checks at some 
point, so we want to leave the door open for that.




Comment at: clang-tidy/fuchsia/DefaultArgumentsCheck.cpp:35-38
+SourceRange RemovalRange(
+  Lexer::getLocForEndOfToken(D->getLocation(), 0, 
+*Result.SourceManager, Result.Context->getLangOpts()),
+  D->getDefaultArgRange().getEnd()

aaron.ballman wrote:
> Does `getDefaultArgRange()` not provide the correct range already (so you 
> don't need to go back to the original source)? Or does that range miss the 
> `=`?
> 
> You might want to disable the fix-it in the case `getDefaultArgRange()` 
> returns an empty range, or in case the default arg expression comes from a 
> macro (and add a test for the latter case). e.g.,
> ```
> #define DERP(val)  = val
> 
> void f(int i DERP);
> ```
> Additionally, a test where the identifier is elided would be good as well: 
> `void f(int = 12);`
`getDefaultArgRange()` misses the `=` -- though if there's a better way to do 
it I'm all ears! 


https://reviews.llvm.org/D40108



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


[libcxx] r318812 - Replace assert(true) in tests with actual asserts. Reviewed as https://reviews.llvm.org/D40324

2017-11-21 Thread Billy Robert O'Neal III via cfe-commits
Author: bion
Date: Tue Nov 21 15:03:02 2017
New Revision: 318812

URL: http://llvm.org/viewvc/llvm-project?rev=318812=rev
Log:
Replace assert(true) in tests with actual asserts. Reviewed as 
https://reviews.llvm.org/D40324

In a17cd7c641c34b6c4bd4845a4d4fb590cb6c238c Marshall added assert(true) to the 
vector::size tests, which break on C1XX:

D:\Contest\gl0qojfu.5pe\src\qa\vc\libs\libcxx\upstream\test\std\containers\sequences\vector.bool\size.pass.cpp(62):
 error C2220: warning treated as error - no 'object' file generated
d:\contest\gl0qojfu.5pe\src\qa\vc\libs\libcxx\upstream\test\std\containers\sequences\vector.bool\size.pass.cpp(33)
 : warning C6326: Potential comparison of a constant with another constant.
d:\contest\gl0qojfu.5pe\src\qa\vc\libs\libcxx\upstream\test\std\containers\sequences\vector.bool\size.pass.cpp(52)
 : warning C6326: Potential comparison of a constant with another constant.

The corresponding test for vector::size asserts assert(c.size() == 3);, so I 
changed it to do that here.

Modified:
libcxx/trunk/test/std/containers/sequences/vector.bool/size.pass.cpp

Modified: libcxx/trunk/test/std/containers/sequences/vector.bool/size.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/vector.bool/size.pass.cpp?rev=318812=318811=318812=diff
==
--- libcxx/trunk/test/std/containers/sequences/vector.bool/size.pass.cpp 
(original)
+++ libcxx/trunk/test/std/containers/sequences/vector.bool/size.pass.cpp Tue 
Nov 21 15:03:02 2017
@@ -31,7 +31,7 @@ int main()
 c.push_back(true);
 assert(c.size() == 2);
 c.push_back(C::value_type(3));
-assert(true);
+assert(c.size() == 3);
 c.erase(c.begin());
 assert(c.size() == 2);
 c.erase(c.begin());
@@ -50,7 +50,7 @@ int main()
 c.push_back(true);
 assert(c.size() == 2);
 c.push_back(C::value_type(3));
-assert(true);
+assert(c.size() == 3);
 c.erase(c.begin());
 assert(c.size() == 2);
 c.erase(c.begin());


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


r318811 - [OpenMP] Fix tests after r318789

2017-11-21 Thread Richard Trieu via cfe-commits
Author: rtrieu
Date: Tue Nov 21 14:53:19 2017
New Revision: 318811

URL: http://llvm.org/viewvc/llvm-project?rev=318811=rev
Log:
[OpenMP] Fix tests after r318789

Update use of __tgt_target that had some 32bit types updated to 64bit.

Modified:
cfe/trunk/test/OpenMP/teams_distribute_parallel_for_codegen.cpp
cfe/trunk/test/OpenMP/teams_distribute_parallel_for_firstprivate_codegen.cpp
cfe/trunk/test/OpenMP/teams_distribute_parallel_for_private_codegen.cpp
cfe/trunk/test/OpenMP/teams_distribute_parallel_for_reduction_codegen.cpp

Modified: cfe/trunk/test/OpenMP/teams_distribute_parallel_for_codegen.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/teams_distribute_parallel_for_codegen.cpp?rev=318811=318810=318811=diff
==
--- cfe/trunk/test/OpenMP/teams_distribute_parallel_for_codegen.cpp (original)
+++ cfe/trunk/test/OpenMP/teams_distribute_parallel_for_codegen.cpp Tue Nov 21 
14:53:19 2017
@@ -25,7 +25,7 @@ int teams_argument_global(int n){
   // CK1: [[TE_PAR:%.+]] = load{{.+}}, {{.+}} [[TE_CAST]],
   // CK1: [[TH_PAR:%.+]] = load{{.+}}, {{.+}} [[TH_CAST]],
 
-  // CK1: call i32 @__tgt_target(i32 -1, i8* @{{[^,]+}}, i32 4, i8** 
%{{[^,]+}}, i8** %{{[^,]+}}, i{{64|32}}* {{.+}}@{{[^,]+}}, i32 0, i32 0), i32* 
{{.+}}@{{[^,]+}}, i32 0, i32 0))
+  // CK1: call i32 @__tgt_target(i64 -1, i8* @{{[^,]+}}, i32 4, i8** 
%{{[^,]+}}, i8** %{{[^,]+}}, i{{64|32}}* {{.+}}@{{[^,]+}}, i32 0, i32 0), i64* 
{{.+}}@{{[^,]+}}, i32 0, i32 0))
 
   // CK1: call void @[[OFFL1:.+]](i{{32|64}} [[TE_PAR]], i{{32|64}} [[TH_PAR]],
   #pragma omp target
@@ -34,7 +34,7 @@ int teams_argument_global(int n){
 a[i] = 0;
   }
 
-  // CK1: call i32 @__tgt_target(i32 -1, i8* @{{[^,]+}}, i32 2, i8** 
%{{[^,]+}}, i8** %{{[^,]+}}, i{{64|32}}* {{.+}}@{{[^,]+}}, i32 0, i32 0), i32* 
{{.+}}@{{[^,]+}}, i32 0, i32 0))
+  // CK1: call i32 @__tgt_target(i64 -1, i8* @{{[^,]+}}, i32 2, i8** 
%{{[^,]+}}, i8** %{{[^,]+}}, i{{64|32}}* {{.+}}@{{[^,]+}}, i32 0, i32 0), i64* 
{{.+}}@{{[^,]+}}, i32 0, i32 0))
   // CK1: call void @[[OFFL2:.+]](i{{64|32}} %{{.+}})
   #pragma omp target
   {{{
@@ -95,7 +95,7 @@ int teams_local_arg(void) {
   int n = 100;
   int a[n];
 
-  // CK2: call i32 @__tgt_target(i32 -1, i8* @{{[^,]+}}, i32 3, i8** 
%{{[^,]+}}, i8** %{{[^,]+}}, i{{64|32}}* {{.+}}, i32* {{.+}}@{{[^,]+}}, i32 0, 
i32 0))
+  // CK2: call i32 @__tgt_target(i64 -1, i8* @{{[^,]+}}, i32 3, i8** 
%{{[^,]+}}, i8** %{{[^,]+}}, i{{64|32}}* {{.+}}, i64* {{.+}}@{{[^,]+}}, i32 0, 
i32 0))
   // CK2: call void @[[OFFL1:.+]](i{{64|32}} %{{.+}})
   #pragma omp target
   #pragma omp teams distribute parallel for
@@ -136,7 +136,7 @@ struct SS{
   // CK3: define {{.*}}i32 @{{.+}}foo{{.+}}(
   int foo(void) {
 
-  // CK3: call i32 @__tgt_target(i32 -1, i8* @{{[^,]+}}, i32 1, i8** 
%{{[^,]+}}, i8** %{{[^,]+}}, i{{64|32}}* {{.+}}@{{[^,]+}}, i32 0, i32 0), i32* 
{{.+}}@{{[^,]+}}, i32 0, i32 0))
+  // CK3: call i32 @__tgt_target(i64 -1, i8* @{{[^,]+}}, i32 1, i8** 
%{{[^,]+}}, i8** %{{[^,]+}}, i{{64|32}}* {{.+}}@{{[^,]+}}, i32 0, i32 0), i64* 
{{.+}}@{{[^,]+}}, i32 0, i32 0))
   // CK3: call void @[[OFFL1:.+]]([[SSI]]* %{{.+}})
 #pragma omp target
 #pragma omp teams distribute parallel for
@@ -201,7 +201,7 @@ int main (int argc, char **argv) {
 }
 
 // CK4:  define {{.*}}i32 @{{[^,]+}}(i{{.+}}{{.+}} %[[ARGC:.+]], {{.+}})
-// CK4:   call i32 @__tgt_target(i32 -1, i8* @{{[^,]+}}, i32 3, i8** 
%{{[^,]+}}, i8** %{{[^,]+}}, i{{64|32}}* {{.+}}, i32* {{.+}}@{{[^,]+}}, i32 0, 
i32 0)
+// CK4:   call i32 @__tgt_target(i64 -1, i8* @{{[^,]+}}, i32 3, i8** 
%{{[^,]+}}, i8** %{{[^,]+}}, i{{64|32}}* {{.+}}, i64* {{.+}}@{{[^,]+}}, i32 0, 
i32 0)
 // CK4: call void @[[OFFL1:.+]]({{.+}})
 // CK4: {{%.+}} = call{{.*}} i32 @[[TMAIN:.+]]({{.+}})
 // CK4:  ret
@@ -217,7 +217,7 @@ int main (int argc, char **argv) {
 // CK4: ret void
 
 // CK4:  define {{.*}}i32 @[[TMAIN]]({{.+}})
-// CK4:   call i32 @__tgt_target(i32 -1, i8* @{{[^,]+}}, i32 3, i8** 
%{{[^,]+}}, i8** %{{[^,]+}}, i{{64|32}}* {{.+}}@{{[^,]+}}, i32 0, i32 0), i32* 
{{.+}}@{{[^,]+}}, i32 0, i32 0))
+// CK4:   call i32 @__tgt_target(i64 -1, i8* @{{[^,]+}}, i32 3, i8** 
%{{[^,]+}}, i8** %{{[^,]+}}, i{{64|32}}* {{.+}}@{{[^,]+}}, i32 0, i32 0), i64* 
{{.+}}@{{[^,]+}}, i32 0, i32 0))
 // CK4: call void @[[OFFLT:.+]]({{.+}})
 // CK4:  ret
 // CK4-NEXT: }

Modified: 
cfe/trunk/test/OpenMP/teams_distribute_parallel_for_firstprivate_codegen.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/teams_distribute_parallel_for_firstprivate_codegen.cpp?rev=318811=318810=318811=diff
==
--- 
cfe/trunk/test/OpenMP/teams_distribute_parallel_for_firstprivate_codegen.cpp 
(original)
+++ 
cfe/trunk/test/OpenMP/teams_distribute_parallel_for_firstprivate_codegen.cpp 
Tue Nov 21 14:53:19 2017
@@ -73,7 +73,7 @@ int main() {
   // LAMBDA: call void 

[PATCH] D40323: [libcxx] Remove a broken win32 locale function redirection

2017-11-21 Thread Martin Storsjö via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL318810: Remove a broken win32 locale function redirection 
(authored by mstorsjo).

Changed prior to commit:
  https://reviews.llvm.org/D40323?vs=123851=123852#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D40323

Files:
  libcxx/trunk/include/support/win32/locale_win32.h


Index: libcxx/trunk/include/support/win32/locale_win32.h
===
--- libcxx/trunk/include/support/win32/locale_win32.h
+++ libcxx/trunk/include/support/win32/locale_win32.h
@@ -106,7 +106,6 @@
 #define strftime_l _strftime_l
 #endif
 #define sscanf_l( __s, __l, __f, ...) _sscanf_l( __s, __f, __l, __VA_ARGS__ )
-#define vsscanf_l( __s, __l, __f, ...) _sscanf_l( __s, __f, __l, __VA_ARGS__ )
 #define sprintf_l( __s, __l, __f, ... ) _sprintf_l( __s, __f, __l, __VA_ARGS__ 
)
 #define vsprintf_l( __s, __l, __f, ... ) _vsprintf_l( __s, __f, __l, 
__VA_ARGS__ )
 #define vsnprintf_l( __s, __n, __l, __f, ... ) _vsnprintf_l( __s, __n, __f, 
__l, __VA_ARGS__ )


Index: libcxx/trunk/include/support/win32/locale_win32.h
===
--- libcxx/trunk/include/support/win32/locale_win32.h
+++ libcxx/trunk/include/support/win32/locale_win32.h
@@ -106,7 +106,6 @@
 #define strftime_l _strftime_l
 #endif
 #define sscanf_l( __s, __l, __f, ...) _sscanf_l( __s, __f, __l, __VA_ARGS__ )
-#define vsscanf_l( __s, __l, __f, ...) _sscanf_l( __s, __f, __l, __VA_ARGS__ )
 #define sprintf_l( __s, __l, __f, ... ) _sprintf_l( __s, __f, __l, __VA_ARGS__ )
 #define vsprintf_l( __s, __l, __f, ... ) _vsprintf_l( __s, __f, __l, __VA_ARGS__ )
 #define vsnprintf_l( __s, __n, __l, __f, ... ) _vsnprintf_l( __s, __n, __f, __l, __VA_ARGS__ )
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r318810 - Remove a broken win32 locale function redirection

2017-11-21 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Tue Nov 21 14:41:15 2017
New Revision: 318810

URL: http://llvm.org/viewvc/llvm-project?rev=318810=rev
Log:
Remove a broken win32 locale function redirection

One can't replace vsscanf(_l) with a sscanf(_l) that doesn't
take a va_list.

This has been untouched since it was added in SVN r140728, so
apparently it hasn't been used since. One reason for this mistake
originally might have been that there was no _vsscanf_l until MSVC
2015.

Since it's unused, just remove this define.

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

Modified:
libcxx/trunk/include/support/win32/locale_win32.h

Modified: libcxx/trunk/include/support/win32/locale_win32.h
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/support/win32/locale_win32.h?rev=318810=318809=318810=diff
==
--- libcxx/trunk/include/support/win32/locale_win32.h (original)
+++ libcxx/trunk/include/support/win32/locale_win32.h Tue Nov 21 14:41:15 2017
@@ -106,7 +106,6 @@ isupper_l(int c, _locale_t loc)
 #define strftime_l _strftime_l
 #endif
 #define sscanf_l( __s, __l, __f, ...) _sscanf_l( __s, __f, __l, __VA_ARGS__ )
-#define vsscanf_l( __s, __l, __f, ...) _sscanf_l( __s, __f, __l, __VA_ARGS__ )
 #define sprintf_l( __s, __l, __f, ... ) _sprintf_l( __s, __f, __l, __VA_ARGS__ 
)
 #define vsprintf_l( __s, __l, __f, ... ) _vsprintf_l( __s, __f, __l, 
__VA_ARGS__ )
 #define vsnprintf_l( __s, __n, __l, __f, ... ) _vsnprintf_l( __s, __n, __f, 
__l, __VA_ARGS__ )


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


[clang-tools-extra] r318809 - Silence some MSVC warnings about not all control paths returning a value; NFC.

2017-11-21 Thread Aaron Ballman via cfe-commits
Author: aaronballman
Date: Tue Nov 21 14:24:13 2017
New Revision: 318809

URL: http://llvm.org/viewvc/llvm-project?rev=318809=rev
Log:
Silence some MSVC warnings about not all control paths returning a value; NFC.

Modified:
clang-tools-extra/trunk/clangd/JSONExpr.cpp
clang-tools-extra/trunk/clangd/JSONExpr.h

Modified: clang-tools-extra/trunk/clangd/JSONExpr.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/JSONExpr.cpp?rev=318809=318808=318809=diff
==
--- clang-tools-extra/trunk/clangd/JSONExpr.cpp (original)
+++ clang-tools-extra/trunk/clangd/JSONExpr.cpp Tue Nov 21 14:24:13 2017
@@ -519,6 +519,7 @@ bool operator==(const Expr , const Exp
   case Expr::Object:
 return *L.object() == *R.object();
   }
+  llvm_unreachable("Unknown expressiopn kind");
 }
 } // namespace json
 } // namespace clangd

Modified: clang-tools-extra/trunk/clangd/JSONExpr.h
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/JSONExpr.h?rev=318809=318808=318809=diff
==
--- clang-tools-extra/trunk/clangd/JSONExpr.h (original)
+++ clang-tools-extra/trunk/clangd/JSONExpr.h Tue Nov 21 14:24:13 2017
@@ -162,6 +162,7 @@ public:
 case T_Array:
   return Array;
 }
+llvm_unreachable("Unknown kind");
   }
 
   // Typed accessors return None/nullptr if the Expr is not of this type.


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


[PATCH] D40323: [libcxx] Remove a broken win32 locale function redirection

2017-11-21 Thread Martin Storsjö via Phabricator via cfe-commits
mstorsjo created this revision.

One can't replace vsscanf(_l) with a sscanf(_l) that doesn't take a va_list.

This has been untouched since it was added in SVN r140728, so apparently it 
hasn't been used since. One reason for this mistake originally might have been 
that there was no _vsscanf_l until MSVC 2015.

Since it's unused, just remove this define.


https://reviews.llvm.org/D40323

Files:
  include/support/win32/locale_win32.h


Index: include/support/win32/locale_win32.h
===
--- include/support/win32/locale_win32.h
+++ include/support/win32/locale_win32.h
@@ -106,7 +106,6 @@
 #define strftime_l _strftime_l
 #endif
 #define sscanf_l( __s, __l, __f, ...) _sscanf_l( __s, __f, __l, __VA_ARGS__ )
-#define vsscanf_l( __s, __l, __f, ...) _sscanf_l( __s, __f, __l, __VA_ARGS__ )
 #define sprintf_l( __s, __l, __f, ... ) _sprintf_l( __s, __f, __l, __VA_ARGS__ 
)
 #define vsprintf_l( __s, __l, __f, ... ) _vsprintf_l( __s, __f, __l, 
__VA_ARGS__ )
 #define vsnprintf_l( __s, __n, __l, __f, ... ) _vsnprintf_l( __s, __n, __f, 
__l, __VA_ARGS__ )


Index: include/support/win32/locale_win32.h
===
--- include/support/win32/locale_win32.h
+++ include/support/win32/locale_win32.h
@@ -106,7 +106,6 @@
 #define strftime_l _strftime_l
 #endif
 #define sscanf_l( __s, __l, __f, ...) _sscanf_l( __s, __f, __l, __VA_ARGS__ )
-#define vsscanf_l( __s, __l, __f, ...) _sscanf_l( __s, __f, __l, __VA_ARGS__ )
 #define sprintf_l( __s, __l, __f, ... ) _sprintf_l( __s, __f, __l, __VA_ARGS__ )
 #define vsprintf_l( __s, __l, __f, ... ) _vsprintf_l( __s, __f, __l, __VA_ARGS__ )
 #define vsnprintf_l( __s, __n, __l, __f, ... ) _vsnprintf_l( __s, __n, __f, __l, __VA_ARGS__ )
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D29951: Load lazily the template specialization in multi-module setups.

2017-11-21 Thread Vassil Vassilev via Phabricator via cfe-commits
v.g.vassilev added a comment.

For the record: relanded in r306903.


https://reviews.llvm.org/D29951



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


[libcxx] r318808 - Add missing test_macros.h inclusion.

2017-11-21 Thread Billy Robert O'Neal III via cfe-commits
Author: bion
Date: Tue Nov 21 14:16:57 2017
New Revision: 318808

URL: http://llvm.org/viewvc/llvm-project?rev=318808=rev
Log:
Add missing test_macros.h inclusion.

Modified:
libcxx/trunk/test/std/re/re.grammar/excessive_brace_count.pass.cpp

Modified: libcxx/trunk/test/std/re/re.grammar/excessive_brace_count.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/re/re.grammar/excessive_brace_count.pass.cpp?rev=318808=318807=318808=diff
==
--- libcxx/trunk/test/std/re/re.grammar/excessive_brace_count.pass.cpp 
(original)
+++ libcxx/trunk/test/std/re/re.grammar/excessive_brace_count.pass.cpp Tue Nov 
21 14:16:57 2017
@@ -15,6 +15,7 @@
 
 #include 
 #include 
+#include "test_macros.h"
 
 int main() {
   for (std::regex_constants::syntax_option_type op :


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


Re: [PATCH] D39831: [Driver] Make the use of relax relocations a per target option

2017-11-21 Thread Petr Hosek via cfe-commits
I kept the CMake option, so by default the driver will use the value set
through CMake as before but individual targets can now set their platform
default.

On Tue, Nov 21, 2017 at 1:30 PM Rafael Avila de Espindola <
rafael.espind...@gmail.com> wrote:

> Petr Hosek via Phabricator  writes:
>
>
> > -# This is a "Does your linker support it?" option that only applies
> > -# to x86-64 ELF targets.  All Fuchsia target linkers do support it.
> > -# For x86-64 Linux, it's supported by LLD and by GNU linkers since
> > -# binutils 2.27, so one can hope that all Linux hosts in use handle it.
> > -# Ideally this would be settable as a per-target option.
> > -set(ENABLE_X86_RELAX_RELOCATIONS ON CACHE BOOL "")
> > -
>
> We still have to be able to set it via cmake.
>
> Cheers,
> Rafeal
>


smime.p7s
Description: S/MIME Cryptographic Signature
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D38425: [clangd] Document highlights for clangd

2017-11-21 Thread William Enright via Phabricator via cfe-commits
Nebiroth updated this revision to Diff 123848.
Nebiroth added a comment.

Removed some commented lines and temporary code
Streamlined and removed some code that overlaps/conflicts with code hover patch 
so it's easier to merge (patch https://reviews.llvm.org/D35894)


https://reviews.llvm.org/D38425

Files:
  clangd/ClangdLSPServer.cpp
  clangd/ClangdLSPServer.h
  clangd/ClangdServer.cpp
  clangd/ClangdServer.h
  clangd/ClangdUnit.cpp
  clangd/ClangdUnit.h
  clangd/Protocol.cpp
  clangd/Protocol.h
  clangd/ProtocolHandlers.cpp
  clangd/ProtocolHandlers.h
  test/clangd/documenthighlight.test
  test/clangd/initialize-params-invalid.test
  test/clangd/initialize-params.test

Index: test/clangd/initialize-params.test
===
--- test/clangd/initialize-params.test
+++ test/clangd/initialize-params.test
@@ -20,6 +20,7 @@
 # CHECK-NEXT:  },
 # CHECK-NEXT:  "definitionProvider": true,
 # CHECK-NEXT:  "documentFormattingProvider": true,
+# CHECK-NEXT:	   "documentHighlightProvider": true,
 # CHECK-NEXT:  "documentOnTypeFormattingProvider": {
 # CHECK-NEXT:"firstTriggerCharacter": "}",
 # CHECK-NEXT:"moreTriggerCharacter": []
Index: test/clangd/initialize-params-invalid.test
===
--- test/clangd/initialize-params-invalid.test
+++ test/clangd/initialize-params-invalid.test
@@ -20,6 +20,7 @@
 # CHECK-NEXT:  },
 # CHECK-NEXT:  "definitionProvider": true,
 # CHECK-NEXT:  "documentFormattingProvider": true,
+# CHECK-NEXT:	   "documentHighlightProvider": true,
 # CHECK-NEXT:  "documentOnTypeFormattingProvider": {
 # CHECK-NEXT:"firstTriggerCharacter": "}",
 # CHECK-NEXT:"moreTriggerCharacter": []
Index: test/clangd/documenthighlight.test
===
--- /dev/null
+++ test/clangd/documenthighlight.test
@@ -0,0 +1,37 @@
+# RUN: clangd -run-synchronously < %s | FileCheck %s
+# It is absolutely vital that this file has CRLF line endings.
+#
+Content-Length: 125
+
+{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}}
+
+Content-Length: 455
+
+{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"file:///main.cpp","languageId":"cpp","version":1,"text":"#define MACRO 1\nnamespace ns1 {\nstruct MyClass {\nint xasd;\nvoid anotherOperation() {\n}\nstatic int foo(MyClass*) {\nreturn 0;\n}\n\n};\nstruct Foo {\nint xasd;\n};\n}\nint main() {\nint bonjour;\nbonjour = 2;\nns1::Foo bar = { xasd : 1};\nbar.xasd = 3;\nns1::MyClass* Params;\nParams->anotherOperation();}\n"}}}
+
+Content-Length: 156
+
+{"jsonrpc":"2.0","id":1,"method":"textDocument/documentHighlight","params":{"textDocument":{"uri":"file:///main.cpp"},"position":{"line":17,"character":2}}}
+# Go to local variable
+# CHECK: {"id":1,"jsonrpc":"2.0","result":[{"kind":1,"range":{"end":{"character":12,"line":16},"start":{"character":4,"line":16}}},{"kind":0,"range":{"end":{"character":7,"line":17},"start":{"character":0,"line":17}}}]}
+
+
+Content-Length: 157
+
+{"jsonrpc":"2.0","id":1,"method":"textDocument/documentHighlight","params":{"textDocument":{"uri":"file:///main.cpp"},"position":{"line":18,"character":17}}}
+# Go to local variable
+# CHECK: {"id":1,"jsonrpc":"2.0","result":[{"kind":1,"range":{"end":{"character":9,"line":12},"start":{"character":4,"line":12}}},{"kind":1,"range":{"end":{"character":21,"line":18},"start":{"character":17,"line":18}}},{"kind":216,"range":{"end":{"character":21,"line":18},"start":{"character":17,"line":18}}},{"kind":220,"range":{"end":{"character":8,"line":19},"start":{"character":4,"line":19}}}]}
+
+Content-Length: 157
+
+{"jsonrpc":"2.0","id":1,"method":"textDocument/documentHighlight","params":{"textDocument":{"uri":"file:///main.cpp"},"position":{"line":21,"character":10}}}
+# Go to local variable
+# CHECK: {"id":1,"jsonrpc":"2.0","result":[{"kind":1,"range":{"end":{"character":22,"line":4},"start":{"character":5,"line":4}}},{"kind":0,"range":{"end":{"character":25,"line":21},"start":{"character":8,"line":21}}}]}
+
+Content-Length: 48
+
+{"jsonrpc":"2.0","id":1,"method":"shutdown"}
+
+Content-Length: 33
+
+{"jsonrpc":"2.0":"method":"exit"}			
\ No newline at end of file
Index: clangd/ProtocolHandlers.h
===
--- clangd/ProtocolHandlers.h
+++ clangd/ProtocolHandlers.h
@@ -31,7 +31,6 @@
 public:
   using Ctx = RequestContext;
   virtual ~ProtocolCallbacks() = default;
-
   virtual void onInitialize(Ctx C, InitializeParams ) = 0;
   virtual void onShutdown(Ctx C, ShutdownParams ) = 0;
   virtual void onExit(Ctx C, ExitParams ) = 0;
@@ -54,6 +53,8 @@
   virtual void onFileEvent(Ctx C, DidChangeWatchedFilesParams ) = 0;
   virtual void onCommand(Ctx C, ExecuteCommandParams ) = 0;
   virtual void onRename(Ctx C, RenameParams ) = 0;
+  

[PATCH] D39673: Toolchain: Normalize dwarf, sjlj and seh eh

2017-11-21 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.

Yep, looks good


Repository:
  rL LLVM

https://reviews.llvm.org/D39673



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


[PATCH] D39673: Toolchain: Normalize dwarf, sjlj and seh eh

2017-11-21 Thread Martin Storsjö via Phabricator via cfe-commits
mstorsjo added a comment.

No objection from me about committing this now, although I have some minor 
comments (that possibly can be taken care of without reposting and 
re-reviewing). Still ok with @rnk?




Comment at: lib/Frontend/InitPreprocessor.cpp:686
+  else if ((TI.getTriple().isThumb() || TI.getTriple().isARM()) &&
+  (TI.getTriple().isOSNetBSD() || TI.getTriple().isOSWindows()))
+Builder.defineMacro("__ARM_DWARF_EH__");

I guess you could add an `|| LangOpts.DWARFExceptions` here as well? That would 
allow you to manually enable dwarf on arm on linux as well. (I did that 
manually while testing some bits in libunwind.)

Ideally I'd prefer to have a `UseDWARFExceptions` just like there already is 
`UseSEHExceptions` and `UseSjLjExceptions` in the driver, so that it'd 
explcitly pass `-fdwarf-exceptions` here in the cases where it's known to be 
the default. But at least this form shouldn't break anything right now.


Repository:
  rL LLVM

https://reviews.llvm.org/D39673



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


[PATCH] D40065: [libcxx] [test] Change (void)s to TEST_IGNORE_NODISCARD as requested by Eric.

2017-11-21 Thread Billy Robert O'Neal III via Phabricator via cfe-commits
BillyONeal closed this revision.
BillyONeal added a comment.

Committed r318804


https://reviews.llvm.org/D40065



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


[libcxx] r318804 - Change (void) casts to TEST_IGNORE_NODISCARD, as requested by Eric. Reviewed as https://reviews.llvm.org/D40065

2017-11-21 Thread Billy Robert O'Neal III via cfe-commits
Author: bion
Date: Tue Nov 21 13:37:26 2017
New Revision: 318804

URL: http://llvm.org/viewvc/llvm-project?rev=318804=rev
Log:
Change (void) casts to TEST_IGNORE_NODISCARD, as requested by Eric. Reviewed as 
https://reviews.llvm.org/D40065

Modified:

libcxx/trunk/test/std/algorithms/alg.nonmodifying/alg.search/search_n_pred.pass.cpp
libcxx/trunk/test/std/containers/associative/map/map.access/at.pass.cpp
libcxx/trunk/test/std/containers/associative/map/map.ops/count1.fail.cpp
libcxx/trunk/test/std/containers/associative/map/map.ops/count2.fail.cpp
libcxx/trunk/test/std/containers/associative/map/map.ops/count3.fail.cpp

libcxx/trunk/test/std/containers/associative/map/map.ops/equal_range1.fail.cpp

libcxx/trunk/test/std/containers/associative/map/map.ops/equal_range2.fail.cpp

libcxx/trunk/test/std/containers/associative/map/map.ops/equal_range3.fail.cpp
libcxx/trunk/test/std/containers/associative/map/map.ops/find1.fail.cpp
libcxx/trunk/test/std/containers/associative/map/map.ops/find2.fail.cpp
libcxx/trunk/test/std/containers/associative/map/map.ops/find3.fail.cpp

libcxx/trunk/test/std/containers/associative/map/map.ops/lower_bound1.fail.cpp

libcxx/trunk/test/std/containers/associative/map/map.ops/lower_bound2.fail.cpp

libcxx/trunk/test/std/containers/associative/map/map.ops/lower_bound3.fail.cpp

libcxx/trunk/test/std/containers/associative/map/map.ops/upper_bound1.fail.cpp

libcxx/trunk/test/std/containers/associative/map/map.ops/upper_bound2.fail.cpp

libcxx/trunk/test/std/containers/associative/map/map.ops/upper_bound3.fail.cpp

libcxx/trunk/test/std/containers/associative/multimap/multimap.ops/count1.fail.cpp

libcxx/trunk/test/std/containers/associative/multimap/multimap.ops/count2.fail.cpp

libcxx/trunk/test/std/containers/associative/multimap/multimap.ops/count3.fail.cpp

libcxx/trunk/test/std/containers/associative/multimap/multimap.ops/equal_range1.fail.cpp

libcxx/trunk/test/std/containers/associative/multimap/multimap.ops/equal_range2.fail.cpp

libcxx/trunk/test/std/containers/associative/multimap/multimap.ops/equal_range3.fail.cpp

libcxx/trunk/test/std/containers/associative/multimap/multimap.ops/find1.fail.cpp

libcxx/trunk/test/std/containers/associative/multimap/multimap.ops/find2.fail.cpp

libcxx/trunk/test/std/containers/associative/multimap/multimap.ops/find3.fail.cpp

libcxx/trunk/test/std/containers/associative/multimap/multimap.ops/lower_bound1.fail.cpp

libcxx/trunk/test/std/containers/associative/multimap/multimap.ops/lower_bound2.fail.cpp

libcxx/trunk/test/std/containers/associative/multimap/multimap.ops/lower_bound3.fail.cpp

libcxx/trunk/test/std/containers/associative/multimap/multimap.ops/upper_bound1.fail.cpp

libcxx/trunk/test/std/containers/associative/multimap/multimap.ops/upper_bound2.fail.cpp

libcxx/trunk/test/std/containers/associative/multimap/multimap.ops/upper_bound3.fail.cpp
libcxx/trunk/test/std/containers/sequences/array/at.pass.cpp
libcxx/trunk/test/std/containers/unord/unord.map/unord.map.elem/at.pass.cpp

libcxx/trunk/test/std/diagnostics/syserr/syserr.errcode/syserr.errcode.overview/types.pass.cpp

libcxx/trunk/test/std/diagnostics/syserr/syserr.errcondition/syserr.errcondition.overview/types.pass.cpp
libcxx/trunk/test/std/iterators/iterator.range/begin-end.fail.cpp
libcxx/trunk/test/std/iterators/iterators.general/gcc_workaround.pass.cpp

libcxx/trunk/test/std/iterators/predef.iterators/insert.iterators/insert.iterator/types.pass.cpp

libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.nonmember/make_move_iterator.pass.cpp
libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.pass.cpp
libcxx/trunk/test/std/re/re.alg/re.alg.search/grep.pass.cpp
libcxx/trunk/test/std/re/re.grammar/excessive_brace_count.pass.cpp
libcxx/trunk/test/std/strings/basic.string/string.access/at.pass.cpp

libcxx/trunk/test/std/strings/basic.string/string.ops/string_compare/size_size_T_size_size.pass.cpp

libcxx/trunk/test/std/strings/basic.string/string.ops/string_compare/size_size_pointer.pass.cpp

libcxx/trunk/test/std/strings/basic.string/string.ops/string_compare/size_size_pointer_size.pass.cpp

libcxx/trunk/test/std/strings/basic.string/string.ops/string_compare/size_size_string.pass.cpp

libcxx/trunk/test/std/strings/basic.string/string.ops/string_compare/size_size_string_size_size.pass.cpp

libcxx/trunk/test/std/strings/basic.string/string.ops/string_compare/size_size_string_view.pass.cpp

libcxx/trunk/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock.pass.cpp

libcxx/trunk/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock_for.pass.cpp


[PATCH] D40319: [libcxx] Support getentropy as a source of randomness for std::random_device

2017-11-21 Thread Roland McGrath via Phabricator via cfe-commits
mcgrathr accepted this revision.
mcgrathr added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rL LLVM

https://reviews.llvm.org/D40319



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


Re: [PATCH] D39831: [Driver] Make the use of relax relocations a per target option

2017-11-21 Thread Rafael Avila de Espindola via cfe-commits
Petr Hosek via Phabricator  writes:


> -# This is a "Does your linker support it?" option that only applies
> -# to x86-64 ELF targets.  All Fuchsia target linkers do support it.
> -# For x86-64 Linux, it's supported by LLD and by GNU linkers since
> -# binutils 2.27, so one can hope that all Linux hosts in use handle it.
> -# Ideally this would be settable as a per-target option.
> -set(ENABLE_X86_RELAX_RELOCATIONS ON CACHE BOOL "")
> -

We still have to be able to set it via cmake.

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


[PATCH] D40319: [libcxx] Support getentropy as a source of randomness for std::random_device

2017-11-21 Thread Petr Hosek via Phabricator via cfe-commits
phosek created this revision.

Use this source use on Fuchsia where this is the officially way
to obtain randomness. This could be also used on other platforms
that already support getentropy such as *BSD or Linux.


Repository:
  rL LLVM

https://reviews.llvm.org/D40319

Files:
  include/__config
  src/random.cpp


Index: src/random.cpp
===
--- src/random.cpp
+++ src/random.cpp
@@ -25,7 +25,9 @@
 #include 
 #include 
 
-#if defined(_LIBCPP_USING_DEV_RANDOM)
+#if defined(_LIBCPP_USING_GETENTROPY)
+#include 
+#elif defined(_LIBCPP_USING_DEV_RANDOM)
 #include 
 #include 
 #elif defined(_LIBCPP_USING_NACL_RANDOM)
@@ -35,7 +37,30 @@
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
-#if defined(_LIBCPP_USING_ARC4_RANDOM)
+#if defined(_LIBCPP_USING_GETENTROPY)
+
+random_device::random_device(const string& __token)
+{
+if (__token != "/dev/urandom")
+__throw_system_error(ENOENT, ("random device not supported " + 
__token).c_str());
+}
+
+random_device::~random_device()
+{
+}
+
+unsigned
+random_device::operator()()
+{
+unsigned r;
+size_t n = sizeof(r);
+int err = getentropy(, n);
+if (err)
+__throw_system_error(errno, "random_device getentropy failed");
+return r;
+}
+
+#elif defined(_LIBCPP_USING_ARC4_RANDOM)
 
 random_device::random_device(const string& __token)
 {
Index: include/__config
===
--- include/__config
+++ include/__config
@@ -273,6 +273,8 @@
   // random data even when using sandboxing mechanisms such as chroots,
   // Capsicum, etc.
 # define _LIBCPP_USING_ARC4_RANDOM
+#elif defined(__Fuchsia__)
+# define _LIBCPP_USING_GETENTROPY
 #elif defined(__native_client__)
   // NaCl's sandbox (which PNaCl also runs in) doesn't allow filesystem access,
   // including accesses to the special files under /dev. C++11's


Index: src/random.cpp
===
--- src/random.cpp
+++ src/random.cpp
@@ -25,7 +25,9 @@
 #include 
 #include 
 
-#if defined(_LIBCPP_USING_DEV_RANDOM)
+#if defined(_LIBCPP_USING_GETENTROPY)
+#include 
+#elif defined(_LIBCPP_USING_DEV_RANDOM)
 #include 
 #include 
 #elif defined(_LIBCPP_USING_NACL_RANDOM)
@@ -35,7 +37,30 @@
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
-#if defined(_LIBCPP_USING_ARC4_RANDOM)
+#if defined(_LIBCPP_USING_GETENTROPY)
+
+random_device::random_device(const string& __token)
+{
+if (__token != "/dev/urandom")
+__throw_system_error(ENOENT, ("random device not supported " + __token).c_str());
+}
+
+random_device::~random_device()
+{
+}
+
+unsigned
+random_device::operator()()
+{
+unsigned r;
+size_t n = sizeof(r);
+int err = getentropy(, n);
+if (err)
+__throw_system_error(errno, "random_device getentropy failed");
+return r;
+}
+
+#elif defined(_LIBCPP_USING_ARC4_RANDOM)
 
 random_device::random_device(const string& __token)
 {
Index: include/__config
===
--- include/__config
+++ include/__config
@@ -273,6 +273,8 @@
   // random data even when using sandboxing mechanisms such as chroots,
   // Capsicum, etc.
 # define _LIBCPP_USING_ARC4_RANDOM
+#elif defined(__Fuchsia__)
+# define _LIBCPP_USING_GETENTROPY
 #elif defined(__native_client__)
   // NaCl's sandbox (which PNaCl also runs in) doesn't allow filesystem access,
   // including accesses to the special files under /dev. C++11's
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D39831: [Driver] Make the use of relax relocations a per target option

2017-11-21 Thread Roland McGrath via Phabricator via cfe-commits
mcgrathr accepted this revision.
mcgrathr added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rL LLVM

https://reviews.llvm.org/D39831



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


[PATCH] D39831: [Driver] Make the use of relax relocations a per target option

2017-11-21 Thread Petr Hosek via Phabricator via cfe-commits
phosek updated this revision to Diff 123838.
phosek added a comment.

Added a test case.


Repository:
  rL LLVM

https://reviews.llvm.org/D39831

Files:
  cmake/caches/Fuchsia-stage2.cmake
  include/clang/Driver/ToolChain.h
  lib/Driver/ToolChain.cpp
  lib/Driver/ToolChains/Clang.cpp
  lib/Driver/ToolChains/Fuchsia.h
  test/Driver/fuchsia.c


Index: test/Driver/fuchsia.c
===
--- test/Driver/fuchsia.c
+++ test/Driver/fuchsia.c
@@ -5,6 +5,7 @@
 // RUN: --sysroot=%S/platform 2>&1 \
 // RUN: | FileCheck -check-prefixes=CHECK,CHECK-AARCH64 %s
 // CHECK: {{.*}}clang{{.*}}" "-cc1"
+// CHECK: "--mrelax-relocations"
 // CHECK: "-munwind-tables"
 // CHECK: "-fuse-init-array"
 // CHECK: "-isysroot" "[[SYSROOT:[^"]+]]"
Index: lib/Driver/ToolChains/Fuchsia.h
===
--- lib/Driver/ToolChains/Fuchsia.h
+++ lib/Driver/ToolChains/Fuchsia.h
@@ -43,6 +43,7 @@
   bool HasNativeLLVMSupport() const override { return true; }
   bool IsIntegratedAssemblerDefault() const override { return true; }
   bool IsMathErrnoDefault() const override { return false; }
+  bool useRelaxRelocations() const override { return true; };
   RuntimeLibType GetDefaultRuntimeLibType() const override {
 return ToolChain::RLT_CompilerRT;
   }
Index: lib/Driver/ToolChains/Clang.cpp
===
--- lib/Driver/ToolChains/Clang.cpp
+++ lib/Driver/ToolChains/Clang.cpp
@@ -1869,7 +1869,7 @@
   // arg after parsing the '-I' arg.
   bool TakeNextArg = false;
 
-  bool UseRelaxRelocations = ENABLE_X86_RELAX_RELOCATIONS;
+  bool UseRelaxRelocations = C.getDefaultToolChain().useRelaxRelocations();
   const char *MipsTargetFeature = nullptr;
   for (const Arg *A :
Args.filtered(options::OPT_Wa_COMMA, options::OPT_Xassembler)) {
Index: lib/Driver/ToolChain.cpp
===
--- lib/Driver/ToolChain.cpp
+++ lib/Driver/ToolChain.cpp
@@ -90,6 +90,10 @@
   IsIntegratedAssemblerDefault());
 }
 
+bool ToolChain::useRelaxRelocations() const {
+  return ENABLE_X86_RELAX_RELOCATIONS;
+}
+
 const SanitizerArgs& ToolChain::getSanitizerArgs() const {
   if (!SanitizerArguments.get())
 SanitizerArguments.reset(new SanitizerArgs(*this, Args));
Index: include/clang/Driver/ToolChain.h
===
--- include/clang/Driver/ToolChain.h
+++ include/clang/Driver/ToolChain.h
@@ -316,6 +316,9 @@
   /// mixed dispatch method be used?
   virtual bool UseObjCMixedDispatch() const { return false; }
 
+  /// \brief Check whether to enable x86 relax relocations by default.
+  virtual bool useRelaxRelocations() const;
+
   /// GetDefaultStackProtectorLevel - Get the default stack protector level for
   /// this tool chain (0=off, 1=on, 2=strong, 3=all).
   virtual unsigned GetDefaultStackProtectorLevel(bool KernelOrKext) const {
Index: cmake/caches/Fuchsia-stage2.cmake
===
--- cmake/caches/Fuchsia-stage2.cmake
+++ cmake/caches/Fuchsia-stage2.cmake
@@ -18,13 +18,6 @@
   set(CLANG_DEFAULT_LINKER lld CACHE STRING "")
 endif()
 
-# This is a "Does your linker support it?" option that only applies
-# to x86-64 ELF targets.  All Fuchsia target linkers do support it.
-# For x86-64 Linux, it's supported by LLD and by GNU linkers since
-# binutils 2.27, so one can hope that all Linux hosts in use handle it.
-# Ideally this would be settable as a per-target option.
-set(ENABLE_X86_RELAX_RELOCATIONS ON CACHE BOOL "")
-
 if(APPLE)
   set(LLDB_CODESIGN_IDENTITY "" CACHE STRING "")
 endif()


Index: test/Driver/fuchsia.c
===
--- test/Driver/fuchsia.c
+++ test/Driver/fuchsia.c
@@ -5,6 +5,7 @@
 // RUN: --sysroot=%S/platform 2>&1 \
 // RUN: | FileCheck -check-prefixes=CHECK,CHECK-AARCH64 %s
 // CHECK: {{.*}}clang{{.*}}" "-cc1"
+// CHECK: "--mrelax-relocations"
 // CHECK: "-munwind-tables"
 // CHECK: "-fuse-init-array"
 // CHECK: "-isysroot" "[[SYSROOT:[^"]+]]"
Index: lib/Driver/ToolChains/Fuchsia.h
===
--- lib/Driver/ToolChains/Fuchsia.h
+++ lib/Driver/ToolChains/Fuchsia.h
@@ -43,6 +43,7 @@
   bool HasNativeLLVMSupport() const override { return true; }
   bool IsIntegratedAssemblerDefault() const override { return true; }
   bool IsMathErrnoDefault() const override { return false; }
+  bool useRelaxRelocations() const override { return true; };
   RuntimeLibType GetDefaultRuntimeLibType() const override {
 return ToolChain::RLT_CompilerRT;
   }
Index: lib/Driver/ToolChains/Clang.cpp
===
--- lib/Driver/ToolChains/Clang.cpp
+++ lib/Driver/ToolChains/Clang.cpp
@@ -1869,7 +1869,7 @@
   // arg after parsing the '-I' arg.
   

Re: [PATCH] D36836: [clang-tidy] Implement sonarsource-function-cognitive-complexity check

2017-11-21 Thread Daniel Berlin via cfe-commits
Yes, unfortnuately, i just have no time these days with my new role. Sorry.
I'm trying to keep up with reviews where i can, but i'm prioritizing those
that are absolutely blocked on me (and trying to hand those off).



On Tue, Nov 21, 2017 at 11:11 AM, Roman Lebedev via Phabricator <
revi...@reviews.llvm.org> wrote:

> lebedev.ri updated this revision to Diff 123827.
> lebedev.ri marked an inline comment as done.
> lebedev.ri retitled this revision from "[clang-tidy] Implement
> readability-function-cognitive-complexity check" to "[clang-tidy]
> Implement sonarsource-function-cognitive-complexity check".
> lebedev.ri added a subscriber: chandlerc.
> lebedev.ri added a comment.
>
> - Rebased
> - As advised by @aaron.ballman, moved into it's own directory/module.
> Please review that, i'm not entirely sure i have done that fully correctly.
>
> @chandlerc Hi!
> @aaron.ballman has suggested for me to try to talk to you about this.
> Is there some precedent for the licensing 'issue' at hand? Do you have any
> opinion?
> @dberlin did not react to the pings, so i'm not sure i personally can come
> up with anything better for `LICENSE.txt`
>
> If there are no further ideas, i'll try to contact sonarsource.
>
>
> Repository:
>   rL LLVM
>
> https://reviews.llvm.org/D36836
>
> Files:
>   LICENSE.TXT
>   clang-tidy/CMakeLists.txt
>   clang-tidy/plugin/CMakeLists.txt
>   clang-tidy/sonarsource/CMakeLists.txt
>   clang-tidy/sonarsource/FunctionCognitiveComplexityCheck.cpp
>   clang-tidy/sonarsource/FunctionCognitiveComplexityCheck.h
>   clang-tidy/sonarsource/LICENSE.TXT
>   clang-tidy/sonarsource/SONARSOURCETidyModule.cpp
>   clang-tidy/tool/CMakeLists.txt
>   clang-tidy/tool/ClangTidyMain.cpp
>   docs/ReleaseNotes.rst
>   docs/clang-tidy/checks/list.rst
>   docs/clang-tidy/checks/sonarsource-function-cognitive-complexity.rst
>   test/clang-tidy/sonarsource-function-cognitive-complexity.cpp
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D40224: [X86] Control-Flow Enforcement Technology - Shadow Stack and Indirect Branch Tracking support (Clang side)

2017-11-21 Thread Oren Ben Simhon via Phabricator via cfe-commits
oren_ben_simhon updated this revision to Diff 123835.
oren_ben_simhon marked an inline comment as done.
oren_ben_simhon added a comment.

Implemented comments posted until 11/20 (Thanks Craig and Erich).


Repository:
  rL LLVM

https://reviews.llvm.org/D40224

Files:
  include/clang/Basic/BuiltinsX86.def
  include/clang/Basic/BuiltinsX86_64.def
  include/clang/Driver/Options.td
  lib/Basic/Targets/X86.cpp
  lib/Basic/Targets/X86.h
  lib/Headers/CMakeLists.txt
  lib/Headers/cetintrin.h
  lib/Headers/immintrin.h
  test/CodeGen/builtins-x86.c
  test/CodeGen/cetintrin.c
  test/Driver/x86-target-features.c
  test/Preprocessor/x86_target_features.c

Index: test/Preprocessor/x86_target_features.c
===
--- test/Preprocessor/x86_target_features.c
+++ test/Preprocessor/x86_target_features.c
@@ -333,6 +333,14 @@
 
 // ADX: #define __ADX__ 1
 
+// RUN: %clang -target i386-unknown-unknown -mcet -x c -E -dM -o - %s | FileCheck -match-full-lines --check-prefix=CET %s
+
+// CET: #define __SHSTK__ 1
+
+// RUN: %clang -target i386-unknown-unknown -mshstk -x c -E -dM -o - %s | FileCheck -match-full-lines --check-prefix=CETSS %s
+
+// CETSS: #define __SHSTK__ 1
+
 // RUN: %clang -target i386-unknown-unknown -march=atom -mrdseed -x c -E -dM -o - %s | FileCheck -match-full-lines --check-prefix=RDSEED %s
 
 // RDSEED: #define __RDSEED__ 1
Index: test/Driver/x86-target-features.c
===
--- test/Driver/x86-target-features.c
+++ test/Driver/x86-target-features.c
@@ -70,6 +70,16 @@
 // MPX: "-target-feature" "+mpx"
 // NO-MPX: "-target-feature" "-mpx"
 
+// RUN: %clang -target i386-unknown-linux-gnu -march=i386 -mshstk %s -### -o %t.o 2>&1 | FileCheck -check-prefix=CETSS %s
+// RUN: %clang -target i386-unknown-linux-gnu -march=i386 -mno-shstk %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NO-CETSS %s
+// CETSS: "-target-feature" "+shstk"
+// NO-CETSS: "-target-feature" "-shstk"
+
+// RUN: %clang -target i386-unknown-linux-gnu -march=i386 -mibt %s -### -o %t.o 2>&1 | FileCheck -check-prefix=CETIBT %s
+// RUN: %clang -target i386-unknown-linux-gnu -march=i386 -mno-ibt %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NO-CETIBT %s
+// CETIBT: "-target-feature" "+ibt"
+// NO-CETIBT: "-target-feature" "-ibt"
+
 // RUN: %clang -target i386-unknown-linux-gnu -march=i386 -msgx %s -### -o %t.o 2>&1 | FileCheck -check-prefix=SGX %s
 // RUN: %clang -target i386-unknown-linux-gnu -march=i386 -mno-sgx %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NO-SGX %s
 // SGX: "-target-feature" "+sgx"
Index: test/CodeGen/cetintrin.c
===
--- /dev/null
+++ test/CodeGen/cetintrin.c
@@ -0,0 +1,84 @@
+// RUN: %clang_cc1 -ffreestanding %s -triple=i386-apple-darwin -target-feature +shstk -emit-llvm -o - -Wall -Werror | FileCheck %s
+// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +shstk  -emit-llvm -o - -Wall -Werror | FileCheck %s --check-prefix=X86_64
+
+#include 
+
+void test_incsspd(int a) {
+  // CHECK-LABEL: @test_incsspd
+  // CHECK:   call void @llvm.x86.incsspd(i32 %{{[0-9]+}})
+  _incsspd(a);
+}
+
+#ifdef __x86_64__
+void test_incsspq(int a) {
+  // X86_64-LABEL: @test_incsspq
+  // X86_64:   call void @llvm.x86.incsspq(i64 %{{[a-z0-9.]+}})
+  _incsspq(a);
+}
+#endif
+
+unsigned int test_rdsspd(unsigned int a) {
+  // CHECK-LABEL: @test_rdsspd
+  // CHECK:   call i32 @llvm.x86.rdsspd(i32 %{{[a-z0-9.]+}})
+  return _rdsspd(a);
+}
+
+#ifdef __x86_64__
+unsigned long long test_rdsspq(unsigned long long a) {
+  // X86_64-LABEL: @test_rdsspq
+  // X86_64:   call i64 @llvm.x86.rdsspq(i64 %{{[a-z0-9.]+}})
+  return _rdsspq(a);
+}
+#endif
+
+void  test_saveprevssp() {
+  // CHECK-LABEL: @test_saveprevssp
+  // CHECK:   call void @llvm.x86.saveprevssp()
+  _saveprevssp();
+}
+
+void test_rstorssp(void * __p) {
+  // CHECK-LABEL: @test_rstorssp
+  // CHECK:   call void @llvm.x86.rstorssp(i8* %{{[a-z0-9.]+}})
+  _rstorssp(__p);
+}
+
+void test_wrssd(unsigned int __a, void * __p) {
+  // CHECK-LABEL: @test_wrssd
+  // CHECK:   call void @llvm.x86.wrssd(i32 %{{[a-z0-9.]+}}, i8* %{{[a-z0-9.]+}})
+  _wrssd(__a, __p);
+}
+
+#ifdef __x86_64__
+void test_wrssq(unsigned long long __a, void * __p) {
+  // X86_64-LABEL: @test_wrssq
+  // X86_64:   call void @llvm.x86.wrssq(i64 %{{[a-z0-9.]+}}, i8* %{{[a-z0-9.]+}})
+  _wrssq(__a, __p);
+}
+#endif
+
+void test_wrussd(unsigned int __a, void * __p) {
+  // CHECK-LABEL: @test_wrussd
+  // CHECK:   call void @llvm.x86.wrussd(i32 %{{[a-z0-9.]+}}, i8* %{{[a-z0-9.]+}})
+  _wrussd(__a, __p);
+}
+
+#ifdef __x86_64__
+void test_wrussq(unsigned long long __a, void * __p) {
+  // X86_64-LABEL: @test_wrussq
+  // X86_64:   call void @llvm.x86.wrussq(i64 %{{[a-z0-9.]+}}, i8* %{{[a-z0-9.]+}})
+  _wrussq(__a, __p);
+}
+#endif
+
+void test_setssbsy() {
+  // CHECK-LABEL: @test_setssbsy

[PATCH] D24998: Add a new optimization option -Og

2017-11-21 Thread Tor Arne Vestbø via Phabricator via cfe-commits
torarnv added a comment.

This seems to have hit a recent Xcode toolchain (Xcode 9.1 ?).

Xcode now complains that "[app name] was compiled with optimization - stepping 
may behave oddly; variables may not be available.", when launching a debug 
session, which seems to be the case, debugging is all over the place :)

Reproduced on both macOS and iOS targets.

See https://codereview.qt-project.org/#/c/212142/


https://reviews.llvm.org/D24998



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


[PATCH] D40224: [X86] Control-Flow Enforcement Technology - Shadow Stack and Indirect Branch Tracking support (Clang side)

2017-11-21 Thread Oren Ben Simhon via Phabricator via cfe-commits
oren_ben_simhon marked 8 inline comments as done.
oren_ben_simhon added inline comments.



Comment at: include/clang/Driver/Options.td:1801
 def mno_stackrealign : Flag<["-"], "mno-stackrealign">, Group;
+def mno_cet : Flag<["-"], "mno-cet">, Group;
+def mno_shstk : Flag<["-"], "mno-shstk">, Group;

craig.topper wrote:
> erichkeane wrote:
> > Since CET is a union of the other two, how do we handle conflicting 
> > configurations?  Is -mcet -mno-ibt an error, or the same as mno-shstk?  
> > Repeat question for all combinations.
> All the flags should go in the "X86 feature flags" section later in this file.
Since 'mcet' flag (which was supposed to superset the other two) over 
complicates things, I prefer to remove it at the moment.



Comment at: test/CodeGen/builtins-x86.c:260
 
+  __builtin_ia32_incsspd(tmp_Ui);
+  __builtin_ia32_incsspq(tmp_ULLi);

craig.topper wrote:
> I don't think you need to update this test. The intrinsic header test should 
> be enough. I don't know why this test exists.
I believe that it is for the case where someone is using the builtin directly 
instead of using the intrinsic (although this is not recommended). Builtin and 
intrinsic, although relate to each other, might not converge in the future. In 
that case it might be worth testing.


Repository:
  rL LLVM

https://reviews.llvm.org/D40224



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


[PATCH] D39831: [Driver] Make the use of relax relocations a per target option

2017-11-21 Thread Roland McGrath via Phabricator via cfe-commits
mcgrathr added a comment.

test case?


Repository:
  rL LLVM

https://reviews.llvm.org/D39831



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


[PATCH] D40242: Do not perform the analysis based warning if all warnings are ignored

2017-11-21 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

LGTM!


https://reviews.llvm.org/D40242



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


[PATCH] D39886: [ASTImporter] Fix wrong conflict detections for unnamed structures

2017-11-21 Thread Takafumi Kubota via Phabricator via cfe-commits
tk1012 added a comment.

Hello Aleksei,

Unfortunately, I find the related problem with the unnamed structs/unions, even 
if I apply https://reviews.llvm.org/D39886.

For example, in PostgreSQL, there is a part of code like below.

  typedef struct { int  a; } b;
  
  struct { const char *x; } y;

then, original AST becomse like below.

  -RecordDecl 0x7ac3900 ... struct definition
  | `-FieldDecl 0x7b18690 ... a 'int'
  |-TypedefDecl 0x7b18730 ... b 'struct b':'b'
  | `-ElaboratedType 0x7b186e0 'struct b' sugar
  |   `-RecordType 0x7ac3990 'b'
  | `-Record 0x7ac3900 ''
  |-RecordDecl 0x7b187a0 ... struct definition
  | `-FieldDecl 0x7b18868 ... x 'const char *'
  `-VarDecl 0x7b18900 ... y 'struct (anonymous struct at ...)':'struct 
(anonymous at ...)'

However, ASTImporter imports the AST incorrectly.
The result AST becomes

  |-RecordDecl 0x7f696c07ee50 ... struct definition
  | `-FieldDecl 0x7f696c177470 ... a 'int'
  |-TypedefDecl 0x7f696c177510 ...  b 'struct b':'b'
  | `-ElaboratedType 0x7f696c1774c0 'struct b' sugar
  |   `-RecordType 0x7f696c07eee0 'b'
  | `-Record 0x7f696c07ee50 ''
  |-RecordDecl 0x7f696c177568 prev 0x7f696c07ee50 ...  struct
  `-VarDecl 0x7f696c177660 ...  y 'struct b':'b'

The variable `y`'s type becomes `struct b` mistakenly.
This is because `FoundDecl` is set into `PrevDecl` at L1676.
In this case, `FoundDecl` is `struct { int a; }`.
Then, ASTImporter set  `PrevDecl` as a previous RecordDecl of the imported 
RecordDecl at L1772.

To avoid this, I think there are two possible solutions.

1. Like this patch, skipping conflict resolution part for the unnamed 
structs/unions.
2. Add a condition for setting the previous decl at L1676.

What do you think?
( I guess the first is unexpectedly dependable. )

p.s.
Should I also share this in https://reviews.llvm.org/D39886?




Comment at: lib/AST/ASTImporter.cpp:1676
 
 PrevDecl = FoundRecord;
 

highlight



Comment at: lib/AST/ASTImporter.cpp:1772
   // FIXME: do this for all Redeclarables, not just RecordDecls.
   D2->setPreviousDecl(PrevDecl);
 }

highlight


https://reviews.llvm.org/D39886



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


[PATCH] D39722: [ASTImporter] Support TypeTraitExpr Importing

2017-11-21 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments.



Comment at: lib/AST/ASTImporter.cpp:5622
+  SmallVector ToArgVec;
+  for (auto FromArg : E->getArgs()) {
+TypeSourceInfo *ToTI = Importer.Import(FromArg);

`const auto *`?



Comment at: lib/AST/ASTImporter.cpp:5631
+  // Value is always false.
+  bool ToValue = (!E->isValueDependent()) ? E->getValue() : false;
+

Remove spurious parens.



Comment at: unittests/AST/ASTImporterTest.cpp:548
+ typeTraitExpr(hasType(asString("int");
+}
 

Please add a value-dependent test as well.


https://reviews.llvm.org/D39722



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


RE: [clang-tools-extra] r318774 - [clangd] Add parsing and value inspection to JSONExpr.

2017-11-21 Thread Yung, Douglas via cfe-commits
Hi Sam,

Thanks for the quick fixes! Fingers crossed that it all works now!

Douglas Yung

From: Sam McCall [mailto:sam.mcc...@gmail.com]
Sent: Tuesday, November 21, 2017 11:39
To: Yung, Douglas
Cc: cfe-commits
Subject: Re: [clang-tools-extra] r318774 - [clangd] Add parsing and value 
inspection to JSONExpr.

Hi Douglas,
The unicode issue is fixed in r318793 and the div0 in r318798.
Sorry about that!

On Tue, Nov 21, 2017 at 8:20 PM, Yung, Douglas 
> wrote:
Hi Sam,

Thanks for looking into this. Just to clarify, the real issue is the divide by 
zero errors. The encoding related messages are only warnings.

JSONExprTests.cpp(134): error C2124: divide or mod by zero

Douglas Yung

From: Sam McCall [mailto:sam.mcc...@gmail.com]
Sent: Tuesday, November 21, 2017 11:07
To: Yung, Douglas
Cc: cfe-commits
Subject: Re: [clang-tools-extra] r318774 - [clangd] Add parsing and value 
inspection to JSONExpr.

Hi Douglas,

Sorry about that! It's an encoding problem, I forgot there were encodings other 
than UTF-8 :-)
I'll fix it.

Thanks for the heads up.

On Tue, Nov 21, 2017 at 7:56 PM, Yung, Douglas 
> wrote:
Hi Sam,

Your change is causing the PS4 Windows bot to fail because your test includes a 
divide by zero exception that the compiler is issuing an error for:

http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/13639/

FAILED: 
tools/clang/tools/extra/unittests/clangd/CMakeFiles/ClangdTests.dir/JSONExprTests.cpp.obj
C:\PROGRA~2\MICROS~1.0\VC\bin\cl.exe  /nologo /TP -DGTEST_HAS_RTTI=0 
-DGTEST_HAS_TR1_TUPLE=0 -DGTEST_LANG_CXX11=1 -DUNICODE 
-D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS 
-D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_FILE_OFFSET_BITS=64 
-D_GNU_SOURCE -D_HAS_EXCEPTIONS=0 -D_LARGEFILE_SOURCE 
-D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -D_UNICODE 
-D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS 
-Itools\clang\tools\extra\unittests\clangd 
-IC:\ps4-buildslave2\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\tools\clang\tools\extra\unittests\clangd
 
-IC:\ps4-buildslave2\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\tools\clang\include
 -Itools\clang\include -Iinclude 
-IC:\ps4-buildslave2\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\include
 
-IC:\ps4-buildslave2\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\tools\clang\tools\extra\clangd
 
-IC:\ps4-buildslave2\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\utils\unittest\googletest\include
 
-IC:\ps4-buildslave2\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\utils\unittest\googlemock\include
 /DWIN32 /D_WINDOWS   /Zc:inline /Zc:strictStrings /Oi /Zc:rvalueCast /W4 
-wd4141 -wd4146 -wd4180 -wd4244 -wd4258 -wd4267 -wd4291 -wd4345 -wd4351 -wd4355 
-wd4456 -wd4457 -wd4458 -wd4459 -wd4503 -wd4624 -wd4722 -wd4800 -wd4100 -wd4127 
-wd4512 -wd4505 -wd4610 -wd4510 -wd4702 -wd4245 -wd4706 -wd4310 -wd4701 -wd4703 
-wd4389 -wd4611 -wd4805 -wd4204 -wd4577 -wd4091 -wd4592 -wd4319 -wd4324 -w14062 
-we4238 /MD /O2 /Ob2   -UNDEBUG  /EHs-c- /GR- /showIncludes 
/Fotools\clang\tools\extra\unittests\clangd\CMakeFiles\ClangdTests.dir\JSONExprTests.cpp.obj
 /Fdtools\clang\tools\extra\unittests\clangd\CMakeFiles\ClangdTests.dir\ /FS -c 
C:\ps4-buildslave2\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\tools\clang\tools\extra\unittests\clangd\JSONExprTests.cpp
C:\ps4-buildslave2\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\tools\clang\tools\extra\unittests\clangd\JSONExprTests.cpp(140):
 warning C4566: character represented by universal-character-name '\U00010437' 
cannot be represented in the current code page (1252)
C:\ps4-buildslave2\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\tools\clang\tools\extra\unittests\clangd\JSONExprTests.cpp(141):
 warning C4566: character represented by universal-character-name '\U0001D11E' 
cannot be represented in the current code page (1252)
C:\ps4-buildslave2\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\tools\clang\tools\extra\unittests\clangd\JSONExprTests.cpp(142):
 warning C4566: character represented by universal-character-name '\uFFFD' 
cannot be represented in the current code page (1252)
C:\ps4-buildslave2\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\tools\clang\tools\extra\unittests\clangd\JSONExprTests.cpp(134):
 error C2124: divide or mod by zero

Can you fix this so that we can get the bot green again? Thanks!

Douglas Yung

> -Original Message-
> From: cfe-commits 
> [mailto:cfe-commits-boun...@lists.llvm.org]
>  On Behalf Of Sam
> McCall via cfe-commits
> Sent: Tuesday, November 21, 2017 8:01
> To: cfe-commits@lists.llvm.org
> Subject: [clang-tools-extra] r318774 - [clangd] Add parsing and value

Re: [clang-tools-extra] r318774 - [clangd] Add parsing and value inspection to JSONExpr.

2017-11-21 Thread Sam McCall via cfe-commits
Hi Douglas,
The unicode issue is fixed in r318793 and the div0 in r318798.
Sorry about that!

On Tue, Nov 21, 2017 at 8:20 PM, Yung, Douglas 
wrote:

> Hi Sam,
>
>
>
> Thanks for looking into this. Just to clarify, the real issue is the
> divide by zero errors. The encoding related messages are only warnings.
>
>
>
> JSONExprTests.cpp(134): error C2124: divide or mod by zero
>
>
>
> Douglas Yung
>
>
>
> *From:* Sam McCall [mailto:sam.mcc...@gmail.com]
> *Sent:* Tuesday, November 21, 2017 11:07
> *To:* Yung, Douglas
> *Cc:* cfe-commits
> *Subject:* Re: [clang-tools-extra] r318774 - [clangd] Add parsing and
> value inspection to JSONExpr.
>
>
>
> Hi Douglas,
>
>
>
> Sorry about that! It's an encoding problem, I forgot there were encodings
> other than UTF-8 :-)
>
> I'll fix it.
>
>
>
> Thanks for the heads up.
>
>
>
> On Tue, Nov 21, 2017 at 7:56 PM, Yung, Douglas 
> wrote:
>
> Hi Sam,
>
> Your change is causing the PS4 Windows bot to fail because your test
> includes a divide by zero exception that the compiler is issuing an error
> for:
>
> http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_
> 64-scei-ps4-windows10pro-fast/builds/13639/
>
> FAILED: tools/clang/tools/extra/unittests/clangd/CMakeFiles/
> ClangdTests.dir/JSONExprTests.cpp.obj
> C:\PROGRA~2\MICROS~1.0\VC\bin\cl.exe  /nologo /TP -DGTEST_HAS_RTTI=0
> -DGTEST_HAS_TR1_TUPLE=0 -DGTEST_LANG_CXX11=1 -DUNICODE
> -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS
> -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_FILE_OFFSET_BITS=64
> -D_GNU_SOURCE -D_HAS_EXCEPTIONS=0 -D_LARGEFILE_SOURCE
> -D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -D_UNICODE
> -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
> -Itools\clang\tools\extra\unittests\clangd -IC:\ps4-buildslave2\llvm-
> clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\
> tools\clang\tools\extra\unittests\clangd -IC:\ps4-buildslave2\llvm-
> clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\tools\clang\include
> -Itools\clang\include -Iinclude -IC:\ps4-buildslave2\llvm-
> clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\include
> -IC:\ps4-buildslave2\llvm-clang-lld-x86_64-scei-ps4-
> windows10pro-fast\llvm.src\tools\clang\tools\extra\clangd
> -IC:\ps4-buildslave2\llvm-clang-lld-x86_64-scei-ps4-
> windows10pro-fast\llvm.src\utils\unittest\googletest\include
> -IC:\ps4-buildslave2\llvm-clang-lld-x86_64-scei-ps4-
> windows10pro-fast\llvm.src\utils\unittest\googlemock\include /DWIN32
> /D_WINDOWS   /Zc:inline /Zc:strictStrings /Oi /Zc:rvalueCast /W4 -wd4141
> -wd4146 -wd4180 -wd4244 -wd4258 -wd4267 -wd4291 -wd4345 -wd4351 -wd4355
> -wd4456 -wd4457 -wd4458 -wd4459 -wd4503 -wd4624 -wd4722 -wd4800 -wd4100
> -wd4127 -wd4512 -wd4505 -wd4610 -wd4510 -wd4702 -wd4245 -wd4706 -wd4310
> -wd4701 -wd4703 -wd4389 -wd4611 -wd4805 -wd4204 -wd4577 -wd4091 -wd4592
> -wd4319 -wd4324 -w14062 -we4238 /MD /O2 /Ob2   -UNDEBUG  /EHs-c- /GR-
> /showIncludes /Fotools\clang\tools\extra\unittests\clangd\CMakeFiles\
> ClangdTests.dir\JSONExprTests.cpp.obj /Fdtools\clang\tools\extra\
> unittests\clangd\CMakeFiles\ClangdTests.dir\ /FS -c
> C:\ps4-buildslave2\llvm-clang-lld-x86_64-scei-ps4-
> windows10pro-fast\llvm.src\tools\clang\tools\extra\unittests\clangd\
> JSONExprTests.cpp
> C:\ps4-buildslave2\llvm-clang-lld-x86_64-scei-ps4-
> windows10pro-fast\llvm.src\tools\clang\tools\extra\unittests\clangd\JSONExprTests.cpp(140):
> warning C4566: character represented by universal-character-name
> '\U00010437' cannot be represented in the current code page (1252)
> C:\ps4-buildslave2\llvm-clang-lld-x86_64-scei-ps4-
> windows10pro-fast\llvm.src\tools\clang\tools\extra\unittests\clangd\JSONExprTests.cpp(141):
> warning C4566: character represented by universal-character-name
> '\U0001D11E' cannot be represented in the current code page (1252)
> C:\ps4-buildslave2\llvm-clang-lld-x86_64-scei-ps4-
> windows10pro-fast\llvm.src\tools\clang\tools\extra\unittests\clangd\JSONExprTests.cpp(142):
> warning C4566: character represented by universal-character-name '\uFFFD'
> cannot be represented in the current code page (1252)
> C:\ps4-buildslave2\llvm-clang-lld-x86_64-scei-ps4-
> windows10pro-fast\llvm.src\tools\clang\tools\extra\unittests\clangd\JSONExprTests.cpp(134):
> error C2124: divide or mod by zero
>
> Can you fix this so that we can get the bot green again? Thanks!
>
> Douglas Yung
>
> > -Original Message-
> > From: cfe-commits [mailto:cfe-commits-boun...@lists.llvm.org] On Behalf
> Of Sam
> > McCall via cfe-commits
> > Sent: Tuesday, November 21, 2017 8:01
> > To: cfe-commits@lists.llvm.org
> > Subject: [clang-tools-extra] r318774 - [clangd] Add parsing and value
> > inspection to JSONExpr.
> >
> > Author: sammccall
> > Date: Tue Nov 21 08:00:53 2017
> > New Revision: 318774
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=318774=rev
> > Log:
> > [clangd] Add parsing and value inspection to JSONExpr.
> >
> > Summary:
> > This will replace 

[clang-tools-extra] r318798 - [clangd] avoid divide by literal zero to satisfy msvc

2017-11-21 Thread Sam McCall via cfe-commits
Author: sammccall
Date: Tue Nov 21 11:37:35 2017
New Revision: 318798

URL: http://llvm.org/viewvc/llvm-project?rev=318798=rev
Log:
[clangd] avoid divide by literal zero to satisfy msvc

Modified:
clang-tools-extra/trunk/unittests/clangd/JSONExprTests.cpp

Modified: clang-tools-extra/trunk/unittests/clangd/JSONExprTests.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/unittests/clangd/JSONExprTests.cpp?rev=318798=318797=318798=diff
==
--- clang-tools-extra/trunk/unittests/clangd/JSONExprTests.cpp (original)
+++ clang-tools-extra/trunk/unittests/clangd/JSONExprTests.cpp Tue Nov 21 
11:37:35 2017
@@ -131,7 +131,7 @@ TEST(JSONTest, Parse) {
   Compare(R"(42)", 42);
   Compare(R"(2.5)", 2.5);
   Compare(R"(2e50)", 2e50);
-  Compare(R"(1.2e3456789)", 1.0 / 0.0);
+  Compare(R"(1.2e3456789)", std::numeric_limits::infinity());
 
   Compare(R"("foo")", "foo");
   Compare(R"("\"\\\b\f\n\r\t")", "\"\\\b\f\n\r\t");


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


[PATCH] D40275: [CUDA] Report "unsupported VLA" errors only on device side.

2017-11-21 Thread Artem Belevich via Phabricator via cfe-commits
tra updated this revision to Diff 123831.
tra added a comment.

Updated CUDA tests


https://reviews.llvm.org/D40275

Files:
  clang/lib/Sema/SemaType.cpp
  clang/test/SemaCUDA/call-stack-for-deferred-err.cu
  clang/test/SemaCUDA/no-call-stack-for-immediate-errs.cu
  clang/test/SemaCUDA/vla.cu


Index: clang/test/SemaCUDA/vla.cu
===
--- clang/test/SemaCUDA/vla.cu
+++ clang/test/SemaCUDA/vla.cu
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -fcuda-is-device -fsyntax-only -verify %s
-// RUN: %clang_cc1 -fsyntax-only -verify -DHOST %s
+// RUN: %clang_cc1 -triple nvptx64-nvidia-cuda -fcuda-is-device -verify %s
+// RUN: %clang_cc1 -triple nvptx64-nvidia-cuda -verify -DHOST %s
 
 #include "Inputs/cuda.h"
 
Index: clang/test/SemaCUDA/no-call-stack-for-immediate-errs.cu
===
--- clang/test/SemaCUDA/no-call-stack-for-immediate-errs.cu
+++ clang/test/SemaCUDA/no-call-stack-for-immediate-errs.cu
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fcuda-is-device -fsyntax-only -verify %s
+// RUN: %clang_cc1 -triple nvptx64-nvidia-cuda -fcuda-is-device -fsyntax-only 
-verify %s
 
 #include "Inputs/cuda.h"
 
Index: clang/test/SemaCUDA/call-stack-for-deferred-err.cu
===
--- clang/test/SemaCUDA/call-stack-for-deferred-err.cu
+++ clang/test/SemaCUDA/call-stack-for-deferred-err.cu
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fcuda-is-device -fsyntax-only -verify %s
+// RUN: %clang_cc1 -triple nvptx64-nvidia-cuda -fcuda-is-device -fsyntax-only 
-verify %s
 
 #include "Inputs/cuda.h"
 
Index: clang/lib/Sema/SemaType.cpp
===
--- clang/lib/Sema/SemaType.cpp
+++ clang/lib/Sema/SemaType.cpp
@@ -2180,14 +2180,17 @@
 Diag(Loc, diag::err_opencl_vla);
 return QualType();
   }
-  // CUDA device code doesn't support VLAs.
-  if (getLangOpts().CUDA && T->isVariableArrayType())
-CUDADiagIfDeviceCode(Loc, diag::err_cuda_vla) << CurrentCUDATarget();
-  // Some targets don't support VLAs.
-  if (T->isVariableArrayType() && !Context.getTargetInfo().isVLASupported() &&
-  shouldDiagnoseTargetSupportFromOpenMP()) {
-Diag(Loc, diag::err_vla_unsupported);
-return QualType();
+
+  if (T->isVariableArrayType() && !Context.getTargetInfo().isVLASupported()) {
+if (getLangOpts().CUDA) {
+  // CUDA device code doesn't support VLAs.
+  CUDADiagIfDeviceCode(Loc, diag::err_cuda_vla) << CurrentCUDATarget();
+} else if (!getLangOpts().OpenMP ||
+   shouldDiagnoseTargetSupportFromOpenMP()) {
+  // Some targets don't support VLAs.
+  Diag(Loc, diag::err_vla_unsupported);
+  return QualType();
+}
   }
 
   // If this is not C99, extwarn about VLA's and C99 array size modifiers.


Index: clang/test/SemaCUDA/vla.cu
===
--- clang/test/SemaCUDA/vla.cu
+++ clang/test/SemaCUDA/vla.cu
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -fcuda-is-device -fsyntax-only -verify %s
-// RUN: %clang_cc1 -fsyntax-only -verify -DHOST %s
+// RUN: %clang_cc1 -triple nvptx64-nvidia-cuda -fcuda-is-device -verify %s
+// RUN: %clang_cc1 -triple nvptx64-nvidia-cuda -verify -DHOST %s
 
 #include "Inputs/cuda.h"
 
Index: clang/test/SemaCUDA/no-call-stack-for-immediate-errs.cu
===
--- clang/test/SemaCUDA/no-call-stack-for-immediate-errs.cu
+++ clang/test/SemaCUDA/no-call-stack-for-immediate-errs.cu
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fcuda-is-device -fsyntax-only -verify %s
+// RUN: %clang_cc1 -triple nvptx64-nvidia-cuda -fcuda-is-device -fsyntax-only -verify %s
 
 #include "Inputs/cuda.h"
 
Index: clang/test/SemaCUDA/call-stack-for-deferred-err.cu
===
--- clang/test/SemaCUDA/call-stack-for-deferred-err.cu
+++ clang/test/SemaCUDA/call-stack-for-deferred-err.cu
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fcuda-is-device -fsyntax-only -verify %s
+// RUN: %clang_cc1 -triple nvptx64-nvidia-cuda -fcuda-is-device -fsyntax-only -verify %s
 
 #include "Inputs/cuda.h"
 
Index: clang/lib/Sema/SemaType.cpp
===
--- clang/lib/Sema/SemaType.cpp
+++ clang/lib/Sema/SemaType.cpp
@@ -2180,14 +2180,17 @@
 Diag(Loc, diag::err_opencl_vla);
 return QualType();
   }
-  // CUDA device code doesn't support VLAs.
-  if (getLangOpts().CUDA && T->isVariableArrayType())
-CUDADiagIfDeviceCode(Loc, diag::err_cuda_vla) << CurrentCUDATarget();
-  // Some targets don't support VLAs.
-  if (T->isVariableArrayType() && !Context.getTargetInfo().isVLASupported() &&
-  shouldDiagnoseTargetSupportFromOpenMP()) {
-Diag(Loc, diag::err_vla_unsupported);
-return QualType();
+
+  if (T->isVariableArrayType() && !Context.getTargetInfo().isVLASupported()) {
+if (getLangOpts().CUDA) {
+ 

LLVM buildmaster will be updated and restarted tonight

2017-11-21 Thread Galina Kistanova via cfe-commits
Hello everyone,

LLVM buildmaster will be updated and restarted after 7 PM Pacific time.

Thanks

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


r318797 - Avoid unecessary opsize byte in segment move to memory

2017-11-21 Thread Nirav Dave via cfe-commits
Author: niravd
Date: Tue Nov 21 11:28:13 2017
New Revision: 318797

URL: http://llvm.org/viewvc/llvm-project?rev=318797=rev
Log:
Avoid unecessary opsize byte in segment move to memory

Segment moves to memory are always 16-bit. Remove invalid 32 and 64
bit variants.

Recommiting with missing clang inline assembly test change.

Fixes PR34478.

Reviewers: rnk, craig.topper

Subscribers: llvm-commits, hiraditya

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

Modified:
cfe/trunk/test/CodeGen/ms-inline-asm.c

Modified: cfe/trunk/test/CodeGen/ms-inline-asm.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/ms-inline-asm.c?rev=318797=318796=318797=diff
==
--- cfe/trunk/test/CodeGen/ms-inline-asm.c (original)
+++ cfe/trunk/test/CodeGen/ms-inline-asm.c Tue Nov 21 11:28:13 2017
@@ -577,17 +577,17 @@ void t40(float a) {
 void t41(unsigned short a) {
 // CHECK-LABEL: define void @t41(i16 zeroext %a)
   __asm mov cs, a;
-// CHECK: mov cs, word ptr $0
+// CHECK: mov cs, $0
   __asm mov ds, a;
-// CHECK: mov ds, word ptr $1
+// CHECK: mov ds, $1
   __asm mov es, a;
-// CHECK: mov es, word ptr $2
+// CHECK: mov es, $2
   __asm mov fs, a;
-// CHECK: mov fs, word ptr $3
+// CHECK: mov fs, $3
   __asm mov gs, a;
-// CHECK: mov gs, word ptr $4
+// CHECK: mov gs, $4
   __asm mov ss, a;
-// CHECK: mov ss, word ptr $5
+// CHECK: mov ss, $5
 // CHECK: "*m,*m,*m,*m,*m,*m,~{dirflag},~{fpsr},~{flags}"(i16* {{.*}}, i16* 
{{.*}}, i16* {{.*}}, i16* {{.*}}, i16* {{.*}}, i16* {{.*}})
 }
 


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


[PATCH] D40267: WG14 DR496

2017-11-21 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman closed this revision.
aaron.ballman added a comment.

Commit in r318796.


https://reviews.llvm.org/D40267



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


r318796 - The offsetof macro is intended to work with subobjects rather than simple identifiers designating a member, making the -Wextended-offsetof diagnostic obsolete as this construct is not an ext

2017-11-21 Thread Aaron Ballman via cfe-commits
Author: aaronballman
Date: Tue Nov 21 11:25:38 2017
New Revision: 318796

URL: http://llvm.org/viewvc/llvm-project?rev=318796=rev
Log:
The offsetof macro is intended to work with subobjects rather than simple 
identifiers designating a member, making the -Wextended-offsetof diagnostic 
obsolete as this construct is not an extension. Implements WG14 DR496.

Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/test/CXX/drs/dr4xx.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=318796=318795=318796=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Tue Nov 21 11:25:38 
2017
@@ -5546,9 +5546,6 @@ def err_offsetof_incomplete_type : Error
 def err_offsetof_record_type : Error<
   "offsetof requires struct, union, or class type, %0 invalid">;
 def err_offsetof_array_type : Error<"offsetof requires array type, %0 
invalid">;
-def ext_offsetof_extended_field_designator : Extension<
-  "using extended field designator is an extension">,
-  InGroup>;
 def ext_offsetof_non_pod_type : ExtWarn<"offset of on non-POD type %0">,
   InGroup;
 def ext_offsetof_non_standardlayout_type : ExtWarn<

Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=318796=318795=318796=diff
==
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Tue Nov 21 11:25:38 2017
@@ -12588,15 +12588,7 @@ ExprResult Sema::BuildBuiltinOffsetOf(So
   && RequireCompleteType(BuiltinLoc, ArgTy,
  diag::err_offsetof_incomplete_type, TypeRange))
 return ExprError();
-  
-  // offsetof with non-identifier designators (e.g. "offsetof(x, a.b[c])") are 
a
-  // GCC extension, diagnose them.
-  // FIXME: This diagnostic isn't actually visible because the location is in
-  // a system header!
-  if (Components.size() != 1)
-Diag(BuiltinLoc, diag::ext_offsetof_extended_field_designator)
-  << SourceRange(Components[1].LocStart, Components.back().LocEnd);
-  
+
   bool DidWarnAboutNonPOD = false;
   QualType CurrentType = ArgTy;
   SmallVector Comps;

Modified: cfe/trunk/test/CXX/drs/dr4xx.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/drs/dr4xx.cpp?rev=318796=318795=318796=diff
==
--- cfe/trunk/test/CXX/drs/dr4xx.cpp (original)
+++ cfe/trunk/test/CXX/drs/dr4xx.cpp Tue Nov 21 11:25:38 2017
@@ -593,10 +593,10 @@ namespace dr447 { // dr447: yes
 U<__builtin_offsetof(A, n)>::type a;
 U<__builtin_offsetof(T, n)>::type b; // expected-error +{{}} 
expected-warning 0+{{}}
 // as an extension, we allow the member-designator to include array indices
-g(__builtin_offsetof(A, a[0])).h(); // expected-error {{extension}}
-g(__builtin_offsetof(A, a[N])).h(); // expected-error {{extension}}
-U<__builtin_offsetof(A, a[0])>::type c; // expected-error {{extension}}
-U<__builtin_offsetof(A, a[N])>::type d; // expected-error {{extension}} 
expected-error +{{}} expected-warning 0+{{}}
+g(__builtin_offsetof(A, a[0])).h();
+g(__builtin_offsetof(A, a[N])).h();
+U<__builtin_offsetof(A, a[0])>::type c;
+U<__builtin_offsetof(A, a[N])>::type d; // expected-error +{{}} 
expected-warning 0+{{}}
   }
 }
 


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


[PATCH] D40261: Add default argument AST matcher

2017-11-21 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman closed this revision.
aaron.ballman added a comment.

I've commit in r318794, thank you!


https://reviews.llvm.org/D40261



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


r318794 - Add an AST matcher for hasDefaultArgument() to match on parameter declarations that have a default value.

2017-11-21 Thread Aaron Ballman via cfe-commits
Author: aaronballman
Date: Tue Nov 21 11:22:34 2017
New Revision: 318794

URL: http://llvm.org/viewvc/llvm-project?rev=318794=rev
Log:
Add an AST matcher for hasDefaultArgument() to match on parameter declarations 
that have a default value.

Patch by Julie Hockett.

Modified:
cfe/trunk/docs/LibASTMatchersReference.html
cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp
cfe/trunk/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp

Modified: cfe/trunk/docs/LibASTMatchersReference.html
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/LibASTMatchersReference.html?rev=318794=318793=318794=diff
==
--- cfe/trunk/docs/LibASTMatchersReference.html (original)
+++ cfe/trunk/docs/LibASTMatchersReference.html Tue Nov 21 11:22:34 2017
@@ -3183,6 +3183,15 @@ Usable as: Matcherhttp://cl
 
 
 
+Matcherhttp://clang.llvm.org/doxygen/classclang_1_1ParmVarDecl.html;>ParmVarDeclhasDefaultArgument
+Matches a 
declaration that has default arguments.
+
+Example matches y (matcher = parmVarDecl(hasDefaultArgument()))
+void x(int val) {}
+void y(int val = 0) {}
+
+
+
 Matcherhttp://clang.llvm.org/doxygen/classclang_1_1QualType.html;>QualTypeasStringstd::string Name
 Matches if the matched 
type is represented by the given string.
 

Modified: cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h?rev=318794=318793=318794=diff
==
--- cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h (original)
+++ cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h Tue Nov 21 11:22:34 2017
@@ -5817,6 +5817,17 @@ AST_MATCHER(NamedDecl, hasExternalFormal
   return Node.hasExternalFormalLinkage();
 }
 
+/// \brief Matches a declaration that has default arguments.
+///
+/// Example matches y (matcher = parmVarDecl(hasDefaultArgument()))
+/// \code
+/// void x(int val) {}
+/// void y(int val = 0) {}
+/// \endcode
+AST_MATCHER(ParmVarDecl, hasDefaultArgument) { 
+  return Node.hasDefaultArg(); 
+}
+
 } // namespace ast_matchers
 } // namespace clang
 

Modified: cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp?rev=318794=318793=318794=diff
==
--- cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp (original)
+++ cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp Tue Nov 21 11:22:34 2017
@@ -248,6 +248,7 @@ RegistryMaps::RegistryMaps() {
   REGISTER_MATCHER(hasDeclaration);
   REGISTER_MATCHER(hasDeclContext);
   REGISTER_MATCHER(hasDeducedType);
+  REGISTER_MATCHER(hasDefaultArgument);
   REGISTER_MATCHER(hasDescendant);
   REGISTER_MATCHER(hasDestinationType);
   REGISTER_MATCHER(hasDynamicExceptionSpec);

Modified: cfe/trunk/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp?rev=318794=318793=318794=diff
==
--- cfe/trunk/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp (original)
+++ cfe/trunk/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp Tue Nov 21 
11:22:34 2017
@@ -1991,5 +1991,12 @@ TEST(HasExternalFormalLinkage, Basic) {
   namedDecl(hasExternalFormalLinkage(;
 }
 
+TEST(HasDefaultArgument, Basic) {
+  EXPECT_TRUE(matches("void x(int val = 0) {}", 
+  parmVarDecl(hasDefaultArgument(;
+  EXPECT_TRUE(notMatches("void x(int val) {}",
+  parmVarDecl(hasDefaultArgument(;
+}
+
 } // namespace ast_matchers
 } // namespace clang


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


RE: [clang-tools-extra] r318774 - [clangd] Add parsing and value inspection to JSONExpr.

2017-11-21 Thread Yung, Douglas via cfe-commits
Hi Sam,

Thanks for looking into this. Just to clarify, the real issue is the divide by 
zero errors. The encoding related messages are only warnings.

JSONExprTests.cpp(134): error C2124: divide or mod by zero

Douglas Yung

From: Sam McCall [mailto:sam.mcc...@gmail.com]
Sent: Tuesday, November 21, 2017 11:07
To: Yung, Douglas
Cc: cfe-commits
Subject: Re: [clang-tools-extra] r318774 - [clangd] Add parsing and value 
inspection to JSONExpr.

Hi Douglas,

Sorry about that! It's an encoding problem, I forgot there were encodings other 
than UTF-8 :-)
I'll fix it.

Thanks for the heads up.

On Tue, Nov 21, 2017 at 7:56 PM, Yung, Douglas 
> wrote:
Hi Sam,

Your change is causing the PS4 Windows bot to fail because your test includes a 
divide by zero exception that the compiler is issuing an error for:

http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/13639/

FAILED: 
tools/clang/tools/extra/unittests/clangd/CMakeFiles/ClangdTests.dir/JSONExprTests.cpp.obj
C:\PROGRA~2\MICROS~1.0\VC\bin\cl.exe  /nologo /TP -DGTEST_HAS_RTTI=0 
-DGTEST_HAS_TR1_TUPLE=0 -DGTEST_LANG_CXX11=1 -DUNICODE 
-D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS 
-D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_FILE_OFFSET_BITS=64 
-D_GNU_SOURCE -D_HAS_EXCEPTIONS=0 -D_LARGEFILE_SOURCE 
-D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -D_UNICODE 
-D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS 
-Itools\clang\tools\extra\unittests\clangd 
-IC:\ps4-buildslave2\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\tools\clang\tools\extra\unittests\clangd
 
-IC:\ps4-buildslave2\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\tools\clang\include
 -Itools\clang\include -Iinclude 
-IC:\ps4-buildslave2\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\include
 
-IC:\ps4-buildslave2\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\tools\clang\tools\extra\clangd
 
-IC:\ps4-buildslave2\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\utils\unittest\googletest\include
 
-IC:\ps4-buildslave2\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\utils\unittest\googlemock\include
 /DWIN32 /D_WINDOWS   /Zc:inline /Zc:strictStrings /Oi /Zc:rvalueCast /W4 
-wd4141 -wd4146 -wd4180 -wd4244 -wd4258 -wd4267 -wd4291 -wd4345 -wd4351 -wd4355 
-wd4456 -wd4457 -wd4458 -wd4459 -wd4503 -wd4624 -wd4722 -wd4800 -wd4100 -wd4127 
-wd4512 -wd4505 -wd4610 -wd4510 -wd4702 -wd4245 -wd4706 -wd4310 -wd4701 -wd4703 
-wd4389 -wd4611 -wd4805 -wd4204 -wd4577 -wd4091 -wd4592 -wd4319 -wd4324 -w14062 
-we4238 /MD /O2 /Ob2   -UNDEBUG  /EHs-c- /GR- /showIncludes 
/Fotools\clang\tools\extra\unittests\clangd\CMakeFiles\ClangdTests.dir\JSONExprTests.cpp.obj
 /Fdtools\clang\tools\extra\unittests\clangd\CMakeFiles\ClangdTests.dir\ /FS -c 
C:\ps4-buildslave2\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\tools\clang\tools\extra\unittests\clangd\JSONExprTests.cpp
C:\ps4-buildslave2\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\tools\clang\tools\extra\unittests\clangd\JSONExprTests.cpp(140):
 warning C4566: character represented by universal-character-name '\U00010437' 
cannot be represented in the current code page (1252)
C:\ps4-buildslave2\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\tools\clang\tools\extra\unittests\clangd\JSONExprTests.cpp(141):
 warning C4566: character represented by universal-character-name '\U0001D11E' 
cannot be represented in the current code page (1252)
C:\ps4-buildslave2\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\tools\clang\tools\extra\unittests\clangd\JSONExprTests.cpp(142):
 warning C4566: character represented by universal-character-name '\uFFFD' 
cannot be represented in the current code page (1252)
C:\ps4-buildslave2\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\tools\clang\tools\extra\unittests\clangd\JSONExprTests.cpp(134):
 error C2124: divide or mod by zero

Can you fix this so that we can get the bot green again? Thanks!

Douglas Yung

> -Original Message-
> From: cfe-commits 
> [mailto:cfe-commits-boun...@lists.llvm.org]
>  On Behalf Of Sam
> McCall via cfe-commits
> Sent: Tuesday, November 21, 2017 8:01
> To: cfe-commits@lists.llvm.org
> Subject: [clang-tools-extra] r318774 - [clangd] Add parsing and value
> inspection to JSONExpr.
>
> Author: sammccall
> Date: Tue Nov 21 08:00:53 2017
> New Revision: 318774
>
> URL: http://llvm.org/viewvc/llvm-project?rev=318774=rev
> Log:
> [clangd] Add parsing and value inspection to JSONExpr.
>
> Summary:
> This will replace the places where we're using YAMLParser to parse JSON now:
>   - the new marshalling code (T::parse()) should handle fewer cases and
> require
> fewer explicit casts
>   - we'll early-reject invalid JSON that YAMLParser accepts
>   - we'll be able to fix protocol-parsing bugs 

[PATCH] D36836: [clang-tidy] Implement sonarsource-function-cognitive-complexity check

2017-11-21 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri updated this revision to Diff 123827.
lebedev.ri marked an inline comment as done.
lebedev.ri retitled this revision from "[clang-tidy] Implement 
readability-function-cognitive-complexity check" to "[clang-tidy] Implement 
sonarsource-function-cognitive-complexity check".
lebedev.ri added a subscriber: chandlerc.
lebedev.ri added a comment.

- Rebased
- As advised by @aaron.ballman, moved into it's own directory/module. Please 
review that, i'm not entirely sure i have done that fully correctly.

@chandlerc Hi!
@aaron.ballman has suggested for me to try to talk to you about this.
Is there some precedent for the licensing 'issue' at hand? Do you have any 
opinion?
@dberlin did not react to the pings, so i'm not sure i personally can come up 
with anything better for `LICENSE.txt`

If there are no further ideas, i'll try to contact sonarsource.


Repository:
  rL LLVM

https://reviews.llvm.org/D36836

Files:
  LICENSE.TXT
  clang-tidy/CMakeLists.txt
  clang-tidy/plugin/CMakeLists.txt
  clang-tidy/sonarsource/CMakeLists.txt
  clang-tidy/sonarsource/FunctionCognitiveComplexityCheck.cpp
  clang-tidy/sonarsource/FunctionCognitiveComplexityCheck.h
  clang-tidy/sonarsource/LICENSE.TXT
  clang-tidy/sonarsource/SONARSOURCETidyModule.cpp
  clang-tidy/tool/CMakeLists.txt
  clang-tidy/tool/ClangTidyMain.cpp
  docs/ReleaseNotes.rst
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/sonarsource-function-cognitive-complexity.rst
  test/clang-tidy/sonarsource-function-cognitive-complexity.cpp

Index: test/clang-tidy/sonarsource-function-cognitive-complexity.cpp
===
--- /dev/null
+++ test/clang-tidy/sonarsource-function-cognitive-complexity.cpp
@@ -0,0 +1,954 @@
+// RUN: %check_clang_tidy %s sonarsource-function-cognitive-complexity %t -- -config='{CheckOptions: [{key: sonarsource-function-cognitive-complexity.Threshold, value: 0}]}' -- -std=c++11 -w
+
+// any function should be checked.
+
+extern int ext_func(int x = 0);
+
+int some_func(int x = 0);
+
+static int some_other_func(int x = 0) {}
+
+template void some_templ_func(T x = 0) {}
+
+class SomeClass {
+public:
+  int *begin(int x = 0);
+  int *end(int x = 0);
+  static int func(int x = 0);
+  template void some_templ_func(T x = 0) {}
+  SomeClass() = default;
+  SomeClass(SomeClass&) = delete;
+};
+
+// nothing ever decreases cognitive complexity, so we can check all the things
+// in one go. none of the following should increase cognitive complexity:
+void unittest_false() {
+  {};
+  ext_func();
+  some_func();
+  some_other_func();
+  some_templ_func();
+  some_templ_func();
+  SomeClass::func();
+  SomeClass C;
+  C.some_templ_func();
+  C.some_templ_func();
+  C.func();
+  C.end();
+  int i = some_func();
+  i = i;
+  i++;
+  --i;
+  i < 0;
+  int j = 0 ?: 1;
+  auto k = new int;
+  delete k;
+  throw i;
+  {
+throw i;
+  }
+end:
+  return;
+}
+
+#if 1
+#define CC100
+#else
+// this macro has cognitive complexity of 100.
+// it is needed to be able to compare the testcases with the
+// reference Sonar implementation. please place it right after the first
+// CHECK-NOTES in each function
+#define CC100 if(1){if(1){if(1){if(1){if(1){if(1){if(1){if(1){if(1){if(1){if(1){if(1){if(1){}if(1){}
+#endif
+
+////
+//-- B1. Increments --//
+////
+// Check that every thing listed in B1 of the specification does indeed   //
+// recieve the base increment, and that not-body does not increase nesting//
+////
+
+// break does not increase cognitive complexity.
+// only  break LABEL  does, but it is unavaliable in C or C++
+
+// continue does not increase cognitive complexity.
+// only  continue LABEL  does, but it is unavaliable in C or C++
+
+void unittest_b1_00() {
+// CHECK-NOTES: :[[@LINE-1]]:6: warning: function 'unittest_b1_00' has cognitive complexity of 33 (threshold 0) [sonarsource-function-cognitive-complexity]
+  CC100;
+
+  if (1 ? 1 : 0) {
+// CHECK-NOTES: :[[@LINE-1]]:3: note: +1, including nesting penalty of 0, nesting level increased to 1{{$}}
+// CHECK-NOTES: :[[@LINE-2]]:9: note: +1, including nesting penalty of 0, nesting level increased to 1{{$}}
+
+if (1 ? 1 : 0) {
+// CHECK-NOTES: :[[@LINE-1]]:5: note: +2, including nesting penalty of 1, nesting level increased to 2{{$}}
+// CHECK-NOTES: :[[@LINE-2]]:11: note: +2, including nesting penalty of 1, nesting level increased to 2{{$}}
+} else if (1 ? 1 : 0) {
+// CHECK-NOTES: :[[@LINE-1]]:12: note: +1, nesting level increased to 2{{$}}
+// CHECK-NOTES: :[[@LINE-2]]:18: note: +3, including nesting penalty of 2, nesting level increased to 3{{$}}
+} else {
+// CHECK-NOTES: :[[@LINE-1]]:7: note: +1, nesting level 

[clang-tools-extra] r318793 - [clangd] use u8 strings in tests to avoid problems on windows

2017-11-21 Thread Sam McCall via cfe-commits
Author: sammccall
Date: Tue Nov 21 11:10:22 2017
New Revision: 318793

URL: http://llvm.org/viewvc/llvm-project?rev=318793=rev
Log:
[clangd] use u8 strings in tests to avoid problems on windows

Modified:
clang-tools-extra/trunk/unittests/clangd/JSONExprTests.cpp

Modified: clang-tools-extra/trunk/unittests/clangd/JSONExprTests.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/unittests/clangd/JSONExprTests.cpp?rev=318793=318792=318793=diff
==
--- clang-tools-extra/trunk/unittests/clangd/JSONExprTests.cpp (original)
+++ clang-tools-extra/trunk/unittests/clangd/JSONExprTests.cpp Tue Nov 21 
11:10:22 2017
@@ -137,12 +137,12 @@ TEST(JSONTest, Parse) {
   Compare(R"("\"\\\b\f\n\r\t")", "\"\\\b\f\n\r\t");
   Compare(R"("\u")", llvm::StringRef("\0", 1));
   Compare("\"\x7f\"", "\x7f");
-  Compare(R"("\ud801\udc37")", "\U00010437"); // UTF16 surrogate pair escape.
-  Compare("\"\xE2\x82\xAC\xF0\x9D\x84\x9E\"", "\u20ac\U0001d11e"); // UTF8
+  Compare(R"("\ud801\udc37")", u8"\U00010437"); // UTF16 surrogate pair escape.
+  Compare("\"\xE2\x82\xAC\xF0\x9D\x84\x9E\"", u8"\u20ac\U0001d11e"); // UTF8
   Compare(
   R"("LoneLeading=\ud801, LoneTrailing=\udc01, 
LeadingLeadingTrailing=\ud801\ud801\udc37")",
-  "LoneLeading=\ufffd, LoneTrailing=\ufffd, "
-  "LeadingLeadingTrailing=\ufffd\U00010437"); // Invalid unicode.
+  u8"LoneLeading=\ufffd, LoneTrailing=\ufffd, "
+  u8"LeadingLeadingTrailing=\ufffd\U00010437"); // Invalid unicode.
 
   Compare(R"({"":0,"":0})", obj{{"", 0}});
   Compare(R"({"obj":{},"arr":[]})", obj{{"obj", obj{}}, {"arr", {}}});


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


Re: [clang-tools-extra] r318774 - [clangd] Add parsing and value inspection to JSONExpr.

2017-11-21 Thread Sam McCall via cfe-commits
Hi Douglas,

Sorry about that! It's an encoding problem, I forgot there were encodings
other than UTF-8 :-)
I'll fix it.

Thanks for the heads up.

On Tue, Nov 21, 2017 at 7:56 PM, Yung, Douglas 
wrote:

> Hi Sam,
>
> Your change is causing the PS4 Windows bot to fail because your test
> includes a divide by zero exception that the compiler is issuing an error
> for:
>
> http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_
> 64-scei-ps4-windows10pro-fast/builds/13639/
>
> FAILED: tools/clang/tools/extra/unittests/clangd/CMakeFiles/
> ClangdTests.dir/JSONExprTests.cpp.obj
> C:\PROGRA~2\MICROS~1.0\VC\bin\cl.exe  /nologo /TP -DGTEST_HAS_RTTI=0
> -DGTEST_HAS_TR1_TUPLE=0 -DGTEST_LANG_CXX11=1 -DUNICODE
> -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS
> -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_FILE_OFFSET_BITS=64
> -D_GNU_SOURCE -D_HAS_EXCEPTIONS=0 -D_LARGEFILE_SOURCE
> -D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -D_UNICODE
> -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
> -Itools\clang\tools\extra\unittests\clangd -IC:\ps4-buildslave2\llvm-
> clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\
> tools\clang\tools\extra\unittests\clangd -IC:\ps4-buildslave2\llvm-
> clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\tools\clang\include
> -Itools\clang\include -Iinclude -IC:\ps4-buildslave2\llvm-
> clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\include
> -IC:\ps4-buildslave2\llvm-clang-lld-x86_64-scei-ps4-
> windows10pro-fast\llvm.src\tools\clang\tools\extra\clangd
> -IC:\ps4-buildslave2\llvm-clang-lld-x86_64-scei-ps4-
> windows10pro-fast\llvm.src\utils\unittest\googletest\include
> -IC:\ps4-buildslave2\llvm-clang-lld-x86_64-scei-ps4-
> windows10pro-fast\llvm.src\utils\unittest\googlemock\include /DWIN32
> /D_WINDOWS   /Zc:inline /Zc:strictStrings /Oi /Zc:rvalueCast /W4 -wd4141
> -wd4146 -wd4180 -wd4244 -wd4258 -wd4267 -wd4291 -wd4345 -wd4351 -wd4355
> -wd4456 -wd4457 -wd4458 -wd4459 -wd4503 -wd4624 -wd4722 -wd4800 -wd4100
> -wd4127 -wd4512 -wd4505 -wd4610 -wd4510 -wd4702 -wd4245 -wd4706 -wd4310
> -wd4701 -wd4703 -wd4389 -wd4611 -wd4805 -wd4204 -wd4577 -wd4091 -wd4592
> -wd4319 -wd4324 -w14062 -we4238 /MD /O2 /Ob2   -UNDEBUG  /EHs-c- /GR-
> /showIncludes /Fotools\clang\tools\extra\unittests\clangd\CMakeFiles\
> ClangdTests.dir\JSONExprTests.cpp.obj /Fdtools\clang\tools\extra\
> unittests\clangd\CMakeFiles\ClangdTests.dir\ /FS -c
> C:\ps4-buildslave2\llvm-clang-lld-x86_64-scei-ps4-
> windows10pro-fast\llvm.src\tools\clang\tools\extra\unittests\clangd\
> JSONExprTests.cpp
> C:\ps4-buildslave2\llvm-clang-lld-x86_64-scei-ps4-
> windows10pro-fast\llvm.src\tools\clang\tools\extra\unittests\clangd\JSONExprTests.cpp(140):
> warning C4566: character represented by universal-character-name
> '\U00010437' cannot be represented in the current code page (1252)
> C:\ps4-buildslave2\llvm-clang-lld-x86_64-scei-ps4-
> windows10pro-fast\llvm.src\tools\clang\tools\extra\unittests\clangd\JSONExprTests.cpp(141):
> warning C4566: character represented by universal-character-name
> '\U0001D11E' cannot be represented in the current code page (1252)
> C:\ps4-buildslave2\llvm-clang-lld-x86_64-scei-ps4-
> windows10pro-fast\llvm.src\tools\clang\tools\extra\unittests\clangd\JSONExprTests.cpp(142):
> warning C4566: character represented by universal-character-name '\uFFFD'
> cannot be represented in the current code page (1252)
> C:\ps4-buildslave2\llvm-clang-lld-x86_64-scei-ps4-
> windows10pro-fast\llvm.src\tools\clang\tools\extra\unittests\clangd\JSONExprTests.cpp(134):
> error C2124: divide or mod by zero
>
> Can you fix this so that we can get the bot green again? Thanks!
>
> Douglas Yung
>
> > -Original Message-
> > From: cfe-commits [mailto:cfe-commits-boun...@lists.llvm.org] On Behalf
> Of Sam
> > McCall via cfe-commits
> > Sent: Tuesday, November 21, 2017 8:01
> > To: cfe-commits@lists.llvm.org
> > Subject: [clang-tools-extra] r318774 - [clangd] Add parsing and value
> > inspection to JSONExpr.
> >
> > Author: sammccall
> > Date: Tue Nov 21 08:00:53 2017
> > New Revision: 318774
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=318774=rev
> > Log:
> > [clangd] Add parsing and value inspection to JSONExpr.
> >
> > Summary:
> > This will replace the places where we're using YAMLParser to parse JSON
> now:
> >   - the new marshalling code (T::parse()) should handle fewer cases and
> > require
> > fewer explicit casts
> >   - we'll early-reject invalid JSON that YAMLParser accepts
> >   - we'll be able to fix protocol-parsing bugs caused by the fact that
> YAML
> > can
> > only parse forward
> >
> > I plan to do the conversion as soon as this lands, but I don't want it
> in one
> > patch as the protocol.cpp changes are conflict-prone.
> >
> > Reviewers: ioeric
> >
> > Subscribers: ilya-biryukov, cfe-commits
> >
> > Differential Revision: https://reviews.llvm.org/D40182
> >
> > Modified:
> > 

RE: [clang-tools-extra] r318774 - [clangd] Add parsing and value inspection to JSONExpr.

2017-11-21 Thread Yung, Douglas via cfe-commits
Hi Sam,

Your change is causing the PS4 Windows bot to fail because your test includes a 
divide by zero exception that the compiler is issuing an error for:

http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/13639/

FAILED: 
tools/clang/tools/extra/unittests/clangd/CMakeFiles/ClangdTests.dir/JSONExprTests.cpp.obj
 
C:\PROGRA~2\MICROS~1.0\VC\bin\cl.exe  /nologo /TP -DGTEST_HAS_RTTI=0 
-DGTEST_HAS_TR1_TUPLE=0 -DGTEST_LANG_CXX11=1 -DUNICODE 
-D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS 
-D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_FILE_OFFSET_BITS=64 
-D_GNU_SOURCE -D_HAS_EXCEPTIONS=0 -D_LARGEFILE_SOURCE 
-D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -D_UNICODE 
-D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS 
-Itools\clang\tools\extra\unittests\clangd 
-IC:\ps4-buildslave2\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\tools\clang\tools\extra\unittests\clangd
 
-IC:\ps4-buildslave2\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\tools\clang\include
 -Itools\clang\include -Iinclude 
-IC:\ps4-buildslave2\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\include
 
-IC:\ps4-buildslave2\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\tools\clang\tools\extra\clangd
 
-IC:\ps4-buildslave2\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\utils\unittest\googletest\include
 
-IC:\ps4-buildslave2\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\utils\unittest\googlemock\include
 /DWIN32 /D_WINDOWS   /Zc:inline /Zc:strictStrings /Oi /Zc:rvalueCast /W4 
-wd4141 -wd4146 -wd4180 -wd4244 -wd4258 -wd4267 -wd4291 -wd4345 -wd4351 -wd4355 
-wd4456 -wd4457 -wd4458 -wd4459 -wd4503 -wd4624 -wd4722 -wd4800 -wd4100 -wd4127 
-wd4512 -wd4505 -wd4610 -wd4510 -wd4702 -wd4245 -wd4706 -wd4310 -wd4701 -wd4703 
-wd4389 -wd4611 -wd4805 -wd4204 -wd4577 -wd4091 -wd4592 -wd4319 -wd4324 -w14062 
-we4238 /MD /O2 /Ob2   -UNDEBUG  /EHs-c- /GR- /showIncludes 
/Fotools\clang\tools\extra\unittests\clangd\CMakeFiles\ClangdTests.dir\JSONExprTests.cpp.obj
 /Fdtools\clang\tools\extra\unittests\clangd\CMakeFiles\ClangdTests.dir\ /FS -c 
C:\ps4-buildslave2\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\tools\clang\tools\extra\unittests\clangd\JSONExprTests.cpp
C:\ps4-buildslave2\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\tools\clang\tools\extra\unittests\clangd\JSONExprTests.cpp(140):
 warning C4566: character represented by universal-character-name '\U00010437' 
cannot be represented in the current code page (1252)
C:\ps4-buildslave2\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\tools\clang\tools\extra\unittests\clangd\JSONExprTests.cpp(141):
 warning C4566: character represented by universal-character-name '\U0001D11E' 
cannot be represented in the current code page (1252)
C:\ps4-buildslave2\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\tools\clang\tools\extra\unittests\clangd\JSONExprTests.cpp(142):
 warning C4566: character represented by universal-character-name '\uFFFD' 
cannot be represented in the current code page (1252)
C:\ps4-buildslave2\llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast\llvm.src\tools\clang\tools\extra\unittests\clangd\JSONExprTests.cpp(134):
 error C2124: divide or mod by zero

Can you fix this so that we can get the bot green again? Thanks!

Douglas Yung

> -Original Message-
> From: cfe-commits [mailto:cfe-commits-boun...@lists.llvm.org] On Behalf Of Sam
> McCall via cfe-commits
> Sent: Tuesday, November 21, 2017 8:01
> To: cfe-commits@lists.llvm.org
> Subject: [clang-tools-extra] r318774 - [clangd] Add parsing and value
> inspection to JSONExpr.
> 
> Author: sammccall
> Date: Tue Nov 21 08:00:53 2017
> New Revision: 318774
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=318774=rev
> Log:
> [clangd] Add parsing and value inspection to JSONExpr.
> 
> Summary:
> This will replace the places where we're using YAMLParser to parse JSON now:
>   - the new marshalling code (T::parse()) should handle fewer cases and
> require
> fewer explicit casts
>   - we'll early-reject invalid JSON that YAMLParser accepts
>   - we'll be able to fix protocol-parsing bugs caused by the fact that YAML
> can
> only parse forward
> 
> I plan to do the conversion as soon as this lands, but I don't want it in one
> patch as the protocol.cpp changes are conflict-prone.
> 
> Reviewers: ioeric
> 
> Subscribers: ilya-biryukov, cfe-commits
> 
> Differential Revision: https://reviews.llvm.org/D40182
> 
> Modified:
> clang-tools-extra/trunk/clangd/JSONExpr.cpp
> clang-tools-extra/trunk/clangd/JSONExpr.h
> clang-tools-extra/trunk/unittests/clangd/JSONExprTests.cpp
> 
> Modified: clang-tools-extra/trunk/clangd/JSONExpr.cpp
> URL: http://llvm.org/viewvc/llvm-project/clang-tools-
> extra/trunk/clangd/JSONExpr.cpp?rev=318774=318773=318774=diff
> ==
> --- 

[clang-tools-extra] r318791 - [clangd] Add JSON tests with invalid unicode

2017-11-21 Thread Sam McCall via cfe-commits
Author: sammccall
Date: Tue Nov 21 10:40:43 2017
New Revision: 318791

URL: http://llvm.org/viewvc/llvm-project?rev=318791=rev
Log:
[clangd] Add JSON tests with invalid unicode

Modified:
clang-tools-extra/trunk/unittests/clangd/JSONExprTests.cpp

Modified: clang-tools-extra/trunk/unittests/clangd/JSONExprTests.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/unittests/clangd/JSONExprTests.cpp?rev=318791=318790=318791=diff
==
--- clang-tools-extra/trunk/unittests/clangd/JSONExprTests.cpp (original)
+++ clang-tools-extra/trunk/unittests/clangd/JSONExprTests.cpp Tue Nov 21 
10:40:43 2017
@@ -139,7 +139,10 @@ TEST(JSONTest, Parse) {
   Compare("\"\x7f\"", "\x7f");
   Compare(R"("\ud801\udc37")", "\U00010437"); // UTF16 surrogate pair escape.
   Compare("\"\xE2\x82\xAC\xF0\x9D\x84\x9E\"", "\u20ac\U0001d11e"); // UTF8
-  Compare(R"("\ud801")", "\ufffd"); // Invalid codepoint.
+  Compare(
+  R"("LoneLeading=\ud801, LoneTrailing=\udc01, 
LeadingLeadingTrailing=\ud801\ud801\udc37")",
+  "LoneLeading=\ufffd, LoneTrailing=\ufffd, "
+  "LeadingLeadingTrailing=\ufffd\U00010437"); // Invalid unicode.
 
   Compare(R"({"":0,"":0})", obj{{"", 0}});
   Compare(R"({"obj":{},"arr":[]})", obj{{"obj", obj{}}, {"arr", {}}});


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


[PATCH] D40275: [CUDA] Report "unsupported VLA" errors only on device side.

2017-11-21 Thread Artem Belevich via Phabricator via cfe-commits
tra added a comment.

In https://reviews.llvm.org/D40275#931947, @hfinkel wrote:

> > When Sema sees this code during compilation, it can not tell whether there 
> > is an error. Calling foo from the host code is perfectly valid. Calling it 
> > from device code is not. CUDADiagIfDeviceCode creates 'postponed' 
> > diagnostics which only gets emitted if we ever need to generate code for 
> > the function on device.
>
> Interesting. I suspect that we'll end up dealing with this problem for OpenMP 
> as well (in the future - for OpenMP v5). In this next version (for which the 
> draft is available here: 
> http://www.openmp.org/wp-content/uploads/openmp-TR6.pdf), we'll have 
> "implicit declare target" functions (whereby we generate target code based on 
> the locally-defined subset of the transitive closure of the call graph 
> starting from target regions).


We've been contemplating treating all functions as `__host__ __device__` by 
default. After all, most of the source code is target-agnostic. Currently a lot 
of templated code must be `__host__ __device__` in order to be usable and it's 
a major obstacle to making standard library and other template libraries 
(somewhat) usable on device. Alas, making `__host__ __device__` the default 
would be a major departure from CUDA semantics.


https://reviews.llvm.org/D40275



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


[PATCH] D40275: [CUDA] Report "unsupported VLA" errors only on device side.

2017-11-21 Thread Artem Belevich via Phabricator via cfe-commits
tra added inline comments.



Comment at: clang/lib/Sema/SemaType.cpp:2188
+   !Context.getTargetInfo().isVLASupported() &&
+   shouldDiagnoseTargetSupportFromOpenMP()) {
+  // Some targets don't support VLAs.

tra wrote:
> rjmccall wrote:
> > Please write this check so that it trips in an "ordinary" build on a target 
> > that just happens to not support VLAs, something like:
> > 
> >   else if (!Context.getTargetInfo().isVLASupported() && 
> > shouldDiagnoseTargetSupportFromOpenMP())
> > 
> > If you want to include the explicit OpenMP check there, it would need to be:
> > 
> >   else if (!Context.getTargetInfo().isVLASupported() && 
> > (!getLangOpts().OpenMP || shouldDiagnoseTargetSupportFromOpenMP()))
> > 
> > but I think the first looks better.
> > 
> > The CUDA and OpenMP paths here seem to be trying to achieve analogous 
> > things; it's unfortunate that we can't find a way to unify their 
> > approaches, even if we'd eventually want to use different diagnostic text.  
> > I imagine that the target-environment language restrictions are basically 
> > the same, since they arise for the same fundamental reasons, so all the 
> > places using CUDADiagIfDeviceCode are likely to have a check for 
> > shouldDiagnoseTargetSupportFromOpenMP() and vice-versa.
> The problem is that in CUDA we can't just do 
> ```
> if (!Context.getTargetInfo().isVLASupported() && 
> shouldDiagnoseTargetSupportFromOpenMP())
>Diag(Loc, diag::err_vla_unsupported);
> ```
> 
> In some situations diag messages will only be emitted if we attempt to 
> generate unsupported code on device side.
> Consider 
> ```
> __host__ __device__ void foo(int n) {
>   int vla[n];
> }
> ```
> 
> When Sema sees this code during compilation, it can not tell whether there is 
> an error. Calling foo from the host code is perfectly valid. Calling it from 
> device code is not. `CUDADiagIfDeviceCode` creates 'postponed' diagnostics 
> which only gets emitted if we ever need to generate code for the function on 
> device.
> 
> So, while CUDA and OpenMP do similar things, they are not quite the same.  If 
> your goal to generalize CUDA and OpenMP handling, then it would have to be 
> folded into diagnostic-emitting itself and we'll need an analog of 
> CUDADiagIfDeviceCode which can handle both OpenMP and CUDA. 
> E.g. something like this:
> ```
> ??? DiagIfDeviceCode(???) {
>if (OpenCL || (OpenMP && shouldDiagnoseTargetSupportFromOpenMP()))
>Diag(...);
>else if (CUDA)
>CUDADiagIfDeviceCode()
> } 
> 
> ...
> 
> if (!Context.getTargetInfo().isVLASupported()) 
>DiagIfDeviceCode();
> 
> ```
> 
> Would that work for you?
There's another issue with this approach -- diagnostics itself. Each dialect 
has its own. Specifically CUDA diags have details that are relevant only to 
CUDA. I suspect OpenMP has something specific as well. If we insist emitting 
only one kind of error for particular case across all dialects, we'll have to 
stick to bare bones "feature X is not supported" which will not have sufficient 
details to explain why the error was triggered in CUDA.

IMO dialect-specific handling of cuda errors in this case is the lesser evil. 

I'll update the patch to handle non-cuda cases the way  you suggested.


https://reviews.llvm.org/D40275



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


[PATCH] D40275: [CUDA] Report "unsupported VLA" errors only on device side.

2017-11-21 Thread Artem Belevich via Phabricator via cfe-commits
tra updated this revision to Diff 123823.
tra added a comment.

Updated to partially address rjmccall@ comments.


https://reviews.llvm.org/D40275

Files:
  clang/lib/Sema/SemaType.cpp
  clang/test/SemaCUDA/vla.cu


Index: clang/test/SemaCUDA/vla.cu
===
--- clang/test/SemaCUDA/vla.cu
+++ clang/test/SemaCUDA/vla.cu
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -fcuda-is-device -fsyntax-only -verify %s
-// RUN: %clang_cc1 -fsyntax-only -verify -DHOST %s
+// RUN: %clang_cc1 -triple nvptx64-nvidia-cuda -fcuda-is-device -verify %s
+// RUN: %clang_cc1 -triple nvptx64-nvidia-cuda -verify -DHOST %s
 
 #include "Inputs/cuda.h"
 
Index: clang/lib/Sema/SemaType.cpp
===
--- clang/lib/Sema/SemaType.cpp
+++ clang/lib/Sema/SemaType.cpp
@@ -2175,19 +2175,16 @@
 T = Context.getConstantArrayType(T, ConstVal, ASM, Quals);
   }
 
-  // OpenCL v1.2 s6.9.d: variable length arrays are not supported.
-  if (getLangOpts().OpenCL && T->isVariableArrayType()) {
-Diag(Loc, diag::err_opencl_vla);
-return QualType();
-  }
-  // CUDA device code doesn't support VLAs.
-  if (getLangOpts().CUDA && T->isVariableArrayType())
-CUDADiagIfDeviceCode(Loc, diag::err_cuda_vla) << CurrentCUDATarget();
-  // Some targets don't support VLAs.
-  if (T->isVariableArrayType() && !Context.getTargetInfo().isVLASupported() &&
-  shouldDiagnoseTargetSupportFromOpenMP()) {
-Diag(Loc, diag::err_vla_unsupported);
-return QualType();
+  if (T->isVariableArrayType() && !Context.getTargetInfo().isVLASupported()) {
+if (getLangOpts().CUDA) {
+  // CUDA device code doesn't support VLAs.
+  CUDADiagIfDeviceCode(Loc, diag::err_cuda_vla) << CurrentCUDATarget();
+} else if (!getLangOpts().OpenMP ||
+   shouldDiagnoseTargetSupportFromOpenMP()) {
+  // Some targets don't support VLAs.
+  Diag(Loc, diag::err_vla_unsupported);
+  return QualType();
+}
   }
 
   // If this is not C99, extwarn about VLA's and C99 array size modifiers.


Index: clang/test/SemaCUDA/vla.cu
===
--- clang/test/SemaCUDA/vla.cu
+++ clang/test/SemaCUDA/vla.cu
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -fcuda-is-device -fsyntax-only -verify %s
-// RUN: %clang_cc1 -fsyntax-only -verify -DHOST %s
+// RUN: %clang_cc1 -triple nvptx64-nvidia-cuda -fcuda-is-device -verify %s
+// RUN: %clang_cc1 -triple nvptx64-nvidia-cuda -verify -DHOST %s
 
 #include "Inputs/cuda.h"
 
Index: clang/lib/Sema/SemaType.cpp
===
--- clang/lib/Sema/SemaType.cpp
+++ clang/lib/Sema/SemaType.cpp
@@ -2175,19 +2175,16 @@
 T = Context.getConstantArrayType(T, ConstVal, ASM, Quals);
   }
 
-  // OpenCL v1.2 s6.9.d: variable length arrays are not supported.
-  if (getLangOpts().OpenCL && T->isVariableArrayType()) {
-Diag(Loc, diag::err_opencl_vla);
-return QualType();
-  }
-  // CUDA device code doesn't support VLAs.
-  if (getLangOpts().CUDA && T->isVariableArrayType())
-CUDADiagIfDeviceCode(Loc, diag::err_cuda_vla) << CurrentCUDATarget();
-  // Some targets don't support VLAs.
-  if (T->isVariableArrayType() && !Context.getTargetInfo().isVLASupported() &&
-  shouldDiagnoseTargetSupportFromOpenMP()) {
-Diag(Loc, diag::err_vla_unsupported);
-return QualType();
+  if (T->isVariableArrayType() && !Context.getTargetInfo().isVLASupported()) {
+if (getLangOpts().CUDA) {
+  // CUDA device code doesn't support VLAs.
+  CUDADiagIfDeviceCode(Loc, diag::err_cuda_vla) << CurrentCUDATarget();
+} else if (!getLangOpts().OpenMP ||
+   shouldDiagnoseTargetSupportFromOpenMP()) {
+  // Some targets don't support VLAs.
+  Diag(Loc, diag::err_vla_unsupported);
+  return QualType();
+}
   }
 
   // If this is not C99, extwarn about VLA's and C99 array size modifiers.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D40275: [CUDA] Report "unsupported VLA" errors only on device side.

2017-11-21 Thread Hal Finkel via Phabricator via cfe-commits
hfinkel added a comment.

> When Sema sees this code during compilation, it can not tell whether there is 
> an error. Calling foo from the host code is perfectly valid. Calling it from 
> device code is not. CUDADiagIfDeviceCode creates 'postponed' diagnostics 
> which only gets emitted if we ever need to generate code for the function on 
> device.

Interesting. I suspect that we'll end up dealing with this problem for OpenMP 
as well (in the future - for OpenMP v5). In this next version (for which the 
draft is available here: 
http://www.openmp.org/wp-content/uploads/openmp-TR6.pdf), we'll have "implicit 
declare target" functions (whereby we generate target code based on the 
locally-defined subset of the transitive closure of the call graph starting 
from target regions).


https://reviews.llvm.org/D40275



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


[PATCH] D40275: [CUDA] Report "unsupported VLA" errors only on device side.

2017-11-21 Thread Artem Belevich via Phabricator via cfe-commits
tra added inline comments.



Comment at: clang/lib/Sema/SemaType.cpp:2188
+   !Context.getTargetInfo().isVLASupported() &&
+   shouldDiagnoseTargetSupportFromOpenMP()) {
+  // Some targets don't support VLAs.

rjmccall wrote:
> Please write this check so that it trips in an "ordinary" build on a target 
> that just happens to not support VLAs, something like:
> 
>   else if (!Context.getTargetInfo().isVLASupported() && 
> shouldDiagnoseTargetSupportFromOpenMP())
> 
> If you want to include the explicit OpenMP check there, it would need to be:
> 
>   else if (!Context.getTargetInfo().isVLASupported() && 
> (!getLangOpts().OpenMP || shouldDiagnoseTargetSupportFromOpenMP()))
> 
> but I think the first looks better.
> 
> The CUDA and OpenMP paths here seem to be trying to achieve analogous things; 
> it's unfortunate that we can't find a way to unify their approaches, even if 
> we'd eventually want to use different diagnostic text.  I imagine that the 
> target-environment language restrictions are basically the same, since they 
> arise for the same fundamental reasons, so all the places using 
> CUDADiagIfDeviceCode are likely to have a check for 
> shouldDiagnoseTargetSupportFromOpenMP() and vice-versa.
The problem is that in CUDA we can't just do 
```
if (!Context.getTargetInfo().isVLASupported() && 
shouldDiagnoseTargetSupportFromOpenMP())
   Diag(Loc, diag::err_vla_unsupported);
```

In some situations diag messages will only be emitted if we attempt to generate 
unsupported code on device side.
Consider 
```
__host__ __device__ void foo(int n) {
  int vla[n];
}
```

When Sema sees this code during compilation, it can not tell whether there is 
an error. Calling foo from the host code is perfectly valid. Calling it from 
device code is not. `CUDADiagIfDeviceCode` creates 'postponed' diagnostics 
which only gets emitted if we ever need to generate code for the function on 
device.

So, while CUDA and OpenMP do similar things, they are not quite the same.  If 
your goal to generalize CUDA and OpenMP handling, then it would have to be 
folded into diagnostic-emitting itself and we'll need an analog of 
CUDADiagIfDeviceCode which can handle both OpenMP and CUDA. 
E.g. something like this:
```
??? DiagIfDeviceCode(???) {
   if (OpenCL || (OpenMP && shouldDiagnoseTargetSupportFromOpenMP()))
   Diag(...);
   else if (CUDA)
   CUDADiagIfDeviceCode()
} 

...

if (!Context.getTargetInfo().isVLASupported()) 
   DiagIfDeviceCode();

```

Would that work for you?


https://reviews.llvm.org/D40275



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


[PATCH] D40276: Add -finstrument-function-entry-bare flag

2017-11-21 Thread Hans Wennborg via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL318785: Add -finstrument-function-entry-bare flag (authored 
by hans).

Changed prior to commit:
  https://reviews.llvm.org/D40276?vs=123691=123821#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D40276

Files:
  cfe/trunk/include/clang/Driver/Options.td
  cfe/trunk/include/clang/Frontend/CodeGenOptions.def
  cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
  cfe/trunk/lib/Driver/ToolChains/Clang.cpp
  cfe/trunk/lib/Frontend/CompilerInvocation.cpp
  cfe/trunk/test/CodeGen/instrument-functions.c

Index: cfe/trunk/test/CodeGen/instrument-functions.c
===
--- cfe/trunk/test/CodeGen/instrument-functions.c
+++ cfe/trunk/test/CodeGen/instrument-functions.c
@@ -1,21 +1,34 @@
 // RUN: %clang_cc1 -S -debug-info-kind=standalone -emit-llvm -o - %s -finstrument-functions -disable-llvm-passes | FileCheck %s
+// RUN: %clang_cc1 -S -debug-info-kind=standalone -emit-llvm -o - %s -finstrument-function-entry-bare -disable-llvm-passes | FileCheck -check-prefix=BARE %s
 
 int test1(int x) {
 // CHECK: @test1(i32 {{.*}}%x) #[[ATTR1:[0-9]+]]
 // CHECK: ret
+
+// BARE: @test1(i32 {{.*}}%x) #[[ATTR1:[0-9]+]]
+// BARE: ret
   return x;
 }
 
 int test2(int) __attribute__((no_instrument_function));
 int test2(int x) {
 // CHECK: @test2(i32 {{.*}}%x) #[[ATTR2:[0-9]+]]
 // CHECK: ret
+
+// BARE: @test2(i32 {{.*}}%x) #[[ATTR2:[0-9]+]]
+// BARE: ret
   return x;
 }
 
 // CHECK: attributes #[[ATTR1]] =
 // CHECK-SAME: "instrument-function-entry"="__cyg_profile_func_enter"
 // CHECK-SAME: "instrument-function-exit"="__cyg_profile_func_exit"
 
+// BARE: attributes #[[ATTR1]] =
+// BARE-SAME: "instrument-function-entry-inlined"="__cyg_profile_func_enter_bare"
+
 // CHECK: attributes #[[ATTR2]] =
 // CHECK-NOT: "instrument-function-entry"
+
+// BARE: attributes #[[ATTR2]] =
+// BARE-NOT: "instrument-function-entry"
Index: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
===
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp
@@ -782,6 +782,8 @@
   Opts.InstrumentFunctions = Args.hasArg(OPT_finstrument_functions);
   Opts.InstrumentFunctionsAfterInlining =
   Args.hasArg(OPT_finstrument_functions_after_inlining);
+  Opts.InstrumentFunctionEntryBare =
+  Args.hasArg(OPT_finstrument_function_entry_bare);
   Opts.XRayInstrumentFunctions = Args.hasArg(OPT_fxray_instrument);
   Opts.XRayInstructionThreshold =
   getLastArgIntValue(Args, OPT_fxray_instruction_threshold_EQ, 200, Diags);
Index: cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
===
--- cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
@@ -355,10 +355,11 @@
   llvm::DebugLoc Loc = EmitReturnBlock();
 
   if (ShouldInstrumentFunction()) {
-CurFn->addFnAttr(!CGM.getCodeGenOpts().InstrumentFunctionsAfterInlining
- ? "instrument-function-exit"
- : "instrument-function-exit-inlined",
- "__cyg_profile_func_exit");
+if (CGM.getCodeGenOpts().InstrumentFunctions)
+  CurFn->addFnAttr("instrument-function-exit", "__cyg_profile_func_exit");
+if (CGM.getCodeGenOpts().InstrumentFunctionsAfterInlining)
+  CurFn->addFnAttr("instrument-function-exit-inlined",
+   "__cyg_profile_func_exit");
   }
 
   // Emit debug descriptor for function end.
@@ -443,7 +444,8 @@
 /// instrumented with __cyg_profile_func_* calls
 bool CodeGenFunction::ShouldInstrumentFunction() {
   if (!CGM.getCodeGenOpts().InstrumentFunctions &&
-  !CGM.getCodeGenOpts().InstrumentFunctionsAfterInlining)
+  !CGM.getCodeGenOpts().InstrumentFunctionsAfterInlining &&
+  !CGM.getCodeGenOpts().InstrumentFunctionEntryBare)
 return false;
   if (!CurFuncDecl || CurFuncDecl->hasAttr())
 return false;
@@ -982,10 +984,14 @@
   }
 
   if (ShouldInstrumentFunction()) {
-Fn->addFnAttr(!CGM.getCodeGenOpts().InstrumentFunctionsAfterInlining
-  ? "instrument-function-entry"
-  : "instrument-function-entry-inlined",
-  "__cyg_profile_func_enter");
+if (CGM.getCodeGenOpts().InstrumentFunctions)
+  CurFn->addFnAttr("instrument-function-entry", "__cyg_profile_func_enter");
+if (CGM.getCodeGenOpts().InstrumentFunctionsAfterInlining)
+  CurFn->addFnAttr("instrument-function-entry-inlined",
+   "__cyg_profile_func_enter");
+if (CGM.getCodeGenOpts().InstrumentFunctionEntryBare)
+  CurFn->addFnAttr("instrument-function-entry-inlined",
+   "__cyg_profile_func_enter_bare");
   }
 
   // Since emitting the mcount call here impacts optimizations such as function
Index: cfe/trunk/lib/Driver/ToolChains/Clang.cpp

r318785 - Add -finstrument-function-entry-bare flag

2017-11-21 Thread Hans Wennborg via cfe-commits
Author: hans
Date: Tue Nov 21 09:30:34 2017
New Revision: 318785

URL: http://llvm.org/viewvc/llvm-project?rev=318785=rev
Log:
Add -finstrument-function-entry-bare flag

This is an instrumentation flag that's similar to
-finstrument-functions, but it only inserts calls on function entry, the
calls are inserted post-inlining, and they don't take any arugments.

This is intended for users who want to instrument function entry with
minimal overhead.

(-pg would be another alternative, but forces frame pointer emission and
affects link flags, so is probably best left alone to be used for
generating gcov data.)

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

Modified:
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/include/clang/Frontend/CodeGenOptions.def
cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
cfe/trunk/lib/Driver/ToolChains/Clang.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/test/CodeGen/instrument-functions.c

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=318785=318784=318785=diff
==
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Tue Nov 21 09:30:34 2017
@@ -1030,6 +1030,8 @@ def finstrument_functions : Flag<["-"],
   HelpText<"Generate calls to instrument function entry and exit">;
 def finstrument_functions_after_inlining : Flag<["-"], 
"finstrument-functions-after-inlining">, Group, Flags<[CC1Option]>,
   HelpText<"Like -finstrument-functions, but insert the calls after inlining">;
+def finstrument_function_entry_bare : Flag<["-"], 
"finstrument-function-entry-bare">, Group, Flags<[CC1Option]>,
+  HelpText<"Instrument function entry only, after inlining, without arguments 
to the instrumentation call">;
 
 def fxray_instrument : Flag<["-"], "fxray-instrument">, Group,
   Flags<[CC1Option]>,

Modified: cfe/trunk/include/clang/Frontend/CodeGenOptions.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/CodeGenOptions.def?rev=318785=318784=318785=diff
==
--- cfe/trunk/include/clang/Frontend/CodeGenOptions.def (original)
+++ cfe/trunk/include/clang/Frontend/CodeGenOptions.def Tue Nov 21 09:30:34 2017
@@ -78,6 +78,8 @@ CODEGENOPT(InstrumentFunctions , 1, 0) /
///< enabled.
 CODEGENOPT(InstrumentFunctionsAfterInlining , 1, 0) ///< Set when
   ///< -finstrument-functions-after-inlining is 
enabled.
+CODEGENOPT(InstrumentFunctionEntryBare , 1, 0) ///< Set when
+   ///< -finstrument-function-entry-bare is 
enabled.
 
 CODEGENOPT(XRayInstrumentFunctions , 1, 0) ///< Set when -fxray-instrument is
///< enabled.

Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.cpp?rev=318785=318784=318785=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenFunction.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.cpp Tue Nov 21 09:30:34 2017
@@ -355,10 +355,11 @@ void CodeGenFunction::FinishFunction(Sou
   llvm::DebugLoc Loc = EmitReturnBlock();
 
   if (ShouldInstrumentFunction()) {
-CurFn->addFnAttr(!CGM.getCodeGenOpts().InstrumentFunctionsAfterInlining
- ? "instrument-function-exit"
- : "instrument-function-exit-inlined",
- "__cyg_profile_func_exit");
+if (CGM.getCodeGenOpts().InstrumentFunctions)
+  CurFn->addFnAttr("instrument-function-exit", "__cyg_profile_func_exit");
+if (CGM.getCodeGenOpts().InstrumentFunctionsAfterInlining)
+  CurFn->addFnAttr("instrument-function-exit-inlined",
+   "__cyg_profile_func_exit");
   }
 
   // Emit debug descriptor for function end.
@@ -443,7 +444,8 @@ void CodeGenFunction::FinishFunction(Sou
 /// instrumented with __cyg_profile_func_* calls
 bool CodeGenFunction::ShouldInstrumentFunction() {
   if (!CGM.getCodeGenOpts().InstrumentFunctions &&
-  !CGM.getCodeGenOpts().InstrumentFunctionsAfterInlining)
+  !CGM.getCodeGenOpts().InstrumentFunctionsAfterInlining &&
+  !CGM.getCodeGenOpts().InstrumentFunctionEntryBare)
 return false;
   if (!CurFuncDecl || CurFuncDecl->hasAttr())
 return false;
@@ -982,10 +984,14 @@ void CodeGenFunction::StartFunction(Glob
   }
 
   if (ShouldInstrumentFunction()) {
-Fn->addFnAttr(!CGM.getCodeGenOpts().InstrumentFunctionsAfterInlining
-  ? "instrument-function-entry"
-  : "instrument-function-entry-inlined",
-  "__cyg_profile_func_enter");
+if (CGM.getCodeGenOpts().InstrumentFunctions)
+  

[PATCH] D39836: [clangd] Drop impossible completions (unavailable or inaccessible)

2017-11-21 Thread Sam McCall via Phabricator via cfe-commits
sammccall requested review of this revision.
sammccall added a comment.

PTAL - this is now optional. The results will be hidden by default, but can be 
turned on with a flag.


https://reviews.llvm.org/D39836



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


[PATCH] D39836: [clangd] Drop impossible completions (unavailable or inaccessible)

2017-11-21 Thread Sam McCall via Phabricator via cfe-commits
sammccall updated this revision to Diff 123819.
sammccall added a comment.

(trying to resync the diff to head)


https://reviews.llvm.org/D39836

Files:
  clangd/ClangdLSPServer.cpp
  clangd/ClangdLSPServer.h
  clangd/ClangdServer.cpp
  clangd/ClangdServer.h
  clangd/ClangdUnit.cpp
  clangd/ClangdUnit.h
  clangd/tool/ClangdMain.cpp
  test/clangd/completion-priorities.test
  test/clangd/completion-qualifiers.test
  unittests/clangd/ClangdTests.cpp

Index: unittests/clangd/ClangdTests.cpp
===
--- unittests/clangd/ClangdTests.cpp
+++ unittests/clangd/ClangdTests.cpp
@@ -788,6 +788,8 @@
   int method();
 
   int field;
+private:
+  int private_field;
 };
 
 int test() {
@@ -828,7 +830,10 @@
   // Class members. The only items that must be present in after-dor
   // completion.
   EXPECT_TRUE(ContainsItem(Results, MethodItemText));
+  EXPECT_TRUE(ContainsItem(Results, MethodItemText));
   EXPECT_TRUE(ContainsItem(Results, "field"));
+  EXPECT_EQ(Opts.IncludeIneligibleResults,
+ContainsItem(Results, "private_field"));
   // Global items.
   EXPECT_FALSE(ContainsItem(Results, "global_var"));
   EXPECT_FALSE(ContainsItem(Results, GlobalFuncItemText));
@@ -889,18 +894,26 @@
 }
   };
 
-  for (bool IncludeMacros : {true, false})
-for (bool IncludeGlobals : {true, false})
-  for (bool IncludeBriefComments : {true, false})
-for (bool EnableSnippets : {true, false})
+  clangd::CodeCompleteOptions CCOpts;
+  for (bool IncludeMacros : {true, false}){
+CCOpts.IncludeMacros = IncludeMacros;
+for (bool IncludeGlobals : {true, false}){
+  CCOpts.IncludeGlobals = IncludeGlobals;
+  for (bool IncludeBriefComments : {true, false}){
+CCOpts.IncludeBriefComments = IncludeBriefComments;
+for (bool EnableSnippets : {true, false}){
+  CCOpts.EnableSnippets = EnableSnippets;
   for (bool IncludeCodePatterns : {true, false}) {
-TestWithOpts(clangd::CodeCompleteOptions(
-/*EnableSnippets=*/EnableSnippets,
-/*IncludeCodePatterns=*/IncludeCodePatterns,
-/*IncludeMacros=*/IncludeMacros,
-/*IncludeGlobals=*/IncludeGlobals,
-/*IncludeBriefComments=*/IncludeBriefComments));
+CCOpts.IncludeCodePatterns = IncludeCodePatterns;
+for (bool IncludeIneligibleResults : {true, false}) {
+  CCOpts.IncludeIneligibleResults = IncludeIneligibleResults;
+  TestWithOpts(CCOpts);
+}
   }
+}
+  }
+}
+  }
 }
 
 class ClangdThreadingTest : public ClangdVFSTest {};
Index: test/clangd/completion-qualifiers.test
===
--- test/clangd/completion-qualifiers.test
+++ test/clangd/completion-qualifiers.test
@@ -13,7 +13,7 @@
 # CHECK-NEXT:  "result": {
 # CHECK-NEXT:"isIncomplete": false,
 # CHECK-NEXT:"items": [
-# Eligible const functions are at the top of the list.
+# Eligible functions are at the top of the list.
 # CHECK-NEXT:  {
 # CHECK-NEXT:"detail": "int",
 # CHECK-NEXT:"filterText": "bar",
@@ -32,18 +32,9 @@
 # CHECK-NEXT:"label": "Foo::foo() const",
 # CHECK-NEXT:"sortText": "37foo"
 # CHECK-NEXT:  },
-# Ineligible non-const function is at the bottom of the list.
-# CHECK-NEXT:  {
-#  CHECK:"detail": "int",
-#  CHECK:"filterText": "foo",
-# CHECK-NEXT:"insertText": "foo",
-# CHECK-NEXT:"insertTextFormat": 1,
-# CHECK-NEXT:"kind": 2,
-# CHECK-NEXT:"label": "foo() const",
-# CHECK-NEXT:"sortText": "200035foo"
-# CHECK-NEXT:  }
-# CHECK-NEXT:]
-# CHECK-NEXT:  }
+# Ineligible private functions are not present.
+#  CHECK-NOT:"label": "foo() const",
+#  CHECK:]
 Content-Length: 44
 
 {"jsonrpc":"2.0","id":4,"method":"shutdown"}
Index: test/clangd/completion-priorities.test
===
--- test/clangd/completion-priorities.test
+++ test/clangd/completion-priorities.test
@@ -61,28 +61,10 @@
 # CHECK-NEXT:"kind": 2,
 # CHECK-NEXT:"label": "pub()",
 # CHECK-NEXT:"sortText": "34pub"
-# CHECK-NEXT:  },
-# priv() and prot() are at the end of the list
-# CHECK-NEXT:  {
-#  CHECK:"detail": "void",
-#  CHECK:"filterText": "priv",
-# CHECK-NEXT:"insertText": "priv",
-# CHECK-NEXT:"insertTextFormat": 1,
-# CHECK-NEXT:"kind": 2,
-# CHECK-NEXT:"label": "priv()",
-# CHECK-NEXT:"sortText": "200034priv"
-# CHECK-NEXT:  },
-# CHECK-NEXT:  {
-# CHECK-NEXT:"detail": "void",
-# CHECK-NEXT:"filterText": "prot",
-# CHECK-NEXT:"insertText": "prot",
-# CHECK-NEXT:"insertTextFormat": 1,
-# CHECK-NEXT:"kind": 2,
-# CHECK-NEXT:   

[clang-tools-extra] r318782 - [clangd] Include the right header for std::isxdigit

2017-11-21 Thread Sam McCall via cfe-commits
Author: sammccall
Date: Tue Nov 21 09:18:30 2017
New Revision: 318782

URL: http://llvm.org/viewvc/llvm-project?rev=318782=rev
Log:
[clangd] Include the right header for std::isxdigit

Modified:
clang-tools-extra/trunk/clangd/JSONExpr.cpp

Modified: clang-tools-extra/trunk/clangd/JSONExpr.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/JSONExpr.cpp?rev=318782=318781=318782=diff
==
--- clang-tools-extra/trunk/clangd/JSONExpr.cpp (original)
+++ clang-tools-extra/trunk/clangd/JSONExpr.cpp Tue Nov 21 09:18:30 2017
@@ -1,6 +1,16 @@
+//=== JSONExpr.cpp - JSON expressions, parsing and serialization - C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===-===//
+
 #include "JSONExpr.h"
 
 #include "llvm/Support/Format.h"
+#include 
 
 using namespace llvm;
 namespace clang {


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


[PATCH] D39673: Toolchain: Normalize dwarf, sjlj and seh eh

2017-11-21 Thread Reid Kleckner via Phabricator via cfe-commits
rnk added a comment.

In https://reviews.llvm.org/D39673#931487, @martell wrote:

> Just as a note there is still a lot to be desired here. I do not particularly 
> like the `UseSEHExceptions` function default and the actual macro definition 
> guards should be based on the current `ExceptionModel` because we set that in 
> `lib/CodeGen/BackendUtil.cpp`. This way we do not need to have some silly 
> default of x64 && windows for UseSEHExceptions and can rely on the llvm 
> backend defaults but override within the driver we want like the apple 
> targets do for sjlj. This does for now keep the current functionality while 
> giving us a flag to override which is the goal of this patch.


We have to know the EH model before pre-processing, and that shouldn't rely on 
LLVM TargetOptions. We can probably reuse the `llvm::ExceptionHandling` enum 
instead of these various overlapping booleans, if that's the direction you want 
to go. However, I don't see how we can get away from the clang toolchain 
knowing the default EH model for each target.


Repository:
  rL LLVM

https://reviews.llvm.org/D39673



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


[PATCH] D39836: [clangd] Drop impossible completions (unavailable or inaccessible)

2017-11-21 Thread Sam McCall via Phabricator via cfe-commits
sammccall updated this revision to Diff 123817.
sammccall added a comment.
This revision is now accepted and ready to land.

Add an option to allow impossible completions.
While here, remove 'helpful' constructors that take some subset of the params.


https://reviews.llvm.org/D39836

Files:
  clangd/ClangdLSPServer.cpp
  clangd/ClangdLSPServer.h
  clangd/ClangdServer.cpp
  clangd/ClangdServer.h
  clangd/ClangdUnit.cpp
  clangd/ClangdUnit.h
  clangd/JSONExpr.cpp
  clangd/JSONExpr.h
  clangd/tool/ClangdMain.cpp
  test/clangd/completion-priorities.test
  test/clangd/completion-qualifiers.test
  unittests/clangd/ClangdTests.cpp
  unittests/clangd/JSONExprTests.cpp

Index: unittests/clangd/JSONExprTests.cpp
===
--- unittests/clangd/JSONExprTests.cpp
+++ unittests/clangd/JSONExprTests.cpp
@@ -15,6 +15,9 @@
 namespace clang {
 namespace clangd {
 namespace json {
+void PrintTo(const Expr , std::ostream *OS) {
+  llvm::raw_os_ostream(*OS) << llvm::formatv("{0:2}", E);
+}
 namespace {
 
 std::string s(const Expr ) { return llvm::formatv("{0}", E).str(); }
@@ -108,6 +111,77 @@
  }));
 }
 
+TEST(JSONTest, Parse) {
+  auto Compare = [](llvm::StringRef S, Expr Expected) {
+if (auto E = parse(S)) {
+  // Compare both string forms and with operator==, in case we have bugs.
+  EXPECT_EQ(*E, Expected);
+  EXPECT_EQ(sp(*E), sp(Expected));
+} else {
+  handleAllErrors(E.takeError(), [S](const llvm::ErrorInfoBase ) {
+FAIL() << "Failed to parse JSON >>> " << S << " <<<: " << E.message();
+  });
+}
+  };
+
+  Compare(R"(true)", true);
+  Compare(R"(false)", false);
+  Compare(R"(null)", nullptr);
+
+  Compare(R"(42)", 42);
+  Compare(R"(2.5)", 2.5);
+  Compare(R"(2e50)", 2e50);
+  Compare(R"(1.2e3456789)", 1.0 / 0.0);
+
+  Compare(R"("foo")", "foo");
+  Compare(R"("\"\\\b\f\n\r\t")", "\"\\\b\f\n\r\t");
+  Compare(R"("\u")", llvm::StringRef("\0", 1));
+  Compare("\"\x7f\"", "\x7f");
+  Compare(R"("\ud801\udc37")", "\U00010437"); // UTF16 surrogate pair escape.
+  Compare("\"\xE2\x82\xAC\xF0\x9D\x84\x9E\"", "\u20ac\U0001d11e"); // UTF8
+  Compare(R"("\ud801")", "\ufffd"); // Invalid codepoint.
+
+  Compare(R"({"":0,"":0})", obj{{"", 0}});
+  Compare(R"({"obj":{},"arr":[]})", obj{{"obj", obj{}}, {"arr", {}}});
+  Compare(R"({"\n":{"\u":}})",
+  obj{{"\n", obj{
+ {llvm::StringRef("\0", 1), },
+ }}});
+  Compare("\r[\n\t] ", {});
+}
+
+TEST(JSONTest, ParseErrors) {
+  auto ExpectErr = [](llvm::StringRef Msg, llvm::StringRef S) {
+if (auto E = parse(S)) {
+  // Compare both string forms and with operator==, in case we have bugs.
+  FAIL() << "Parsed JSON >>> " << S << " <<< but wanted error: " << Msg;
+} else {
+  handleAllErrors(E.takeError(), [S, Msg](const llvm::ErrorInfoBase ) {
+EXPECT_THAT(E.message(), testing::HasSubstr(Msg)) << S;
+  });
+}
+  };
+  ExpectErr("Unexpected EOF", "");
+  ExpectErr("Unexpected EOF", "[");
+  ExpectErr("Text after end of document", "[][]");
+  ExpectErr("Text after end of document", "[][]");
+  ExpectErr("Invalid bareword", "fuzzy");
+  ExpectErr("Expected , or ]", "[2?]");
+  ExpectErr("Expected object key", "{a:2}");
+  ExpectErr("Expected : after object key", R"({"a",2})");
+  ExpectErr("Expected , or } after object property", R"({"a":2 "b":3})");
+  ExpectErr("Expected JSON value", R"([&%!])");
+  ExpectErr("Invalid number", "1e1.0");
+  ExpectErr("Unterminated string", R"("abc\"def)");
+  ExpectErr("Control character in string", "\"abc\ndef\"");
+  ExpectErr("Invalid escape sequence", R"("\030")");
+  ExpectErr("Invalid \\u escape sequence", R"("\usuck")");
+  ExpectErr("[3:3, byte=19]", R"({
+  "valid": 1,
+  invalid: 2
+})");
+}
+
 } // namespace
 } // namespace json
 } // namespace clangd
Index: unittests/clangd/ClangdTests.cpp
===
--- unittests/clangd/ClangdTests.cpp
+++ unittests/clangd/ClangdTests.cpp
@@ -788,6 +788,8 @@
   int method();
 
   int field;
+private:
+  int private_field;
 };
 
 int test() {
@@ -828,7 +830,10 @@
   // Class members. The only items that must be present in after-dor
   // completion.
   EXPECT_TRUE(ContainsItem(Results, MethodItemText));
+  EXPECT_TRUE(ContainsItem(Results, MethodItemText));
   EXPECT_TRUE(ContainsItem(Results, "field"));
+  EXPECT_EQ(Opts.IncludeIneligibleResults,
+ContainsItem(Results, "private_field"));
   // Global items.
   EXPECT_FALSE(ContainsItem(Results, "global_var"));
   EXPECT_FALSE(ContainsItem(Results, GlobalFuncItemText));
@@ -889,18 +894,26 @@
 }
   };
 
-  for (bool IncludeMacros : {true, false})
-for (bool IncludeGlobals : {true, false})
-  for (bool IncludeBriefComments : {true, false})
-for (bool EnableSnippets : {true, false})
+  clangd::CodeCompleteOptions 

r318781 - [OPENMP] Initial support for asynchronous data update, NFC.

2017-11-21 Thread Alexey Bataev via cfe-commits
Author: abataev
Date: Tue Nov 21 09:08:48 2017
New Revision: 318781

URL: http://llvm.org/viewvc/llvm-project?rev=318781=rev
Log:
[OPENMP] Initial support for asynchronous data update, NFC.

OpenMP 5.0 introduces asynchronous data update/dependecies clauses on
target data directives. Patch adds initial support for outer task
regions to use task-based codegen for future async target data
directives.

Modified:
cfe/trunk/include/clang/AST/StmtOpenMP.h
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/AST/StmtOpenMP.cpp
cfe/trunk/lib/AST/StmtPrinter.cpp
cfe/trunk/lib/Basic/OpenMPKinds.cpp
cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp
cfe/trunk/lib/Parse/ParseOpenMP.cpp
cfe/trunk/lib/Sema/SemaOpenMP.cpp

Modified: cfe/trunk/include/clang/AST/StmtOpenMP.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/StmtOpenMP.h?rev=318781=318780=318781=diff
==
--- cfe/trunk/include/clang/AST/StmtOpenMP.h (original)
+++ cfe/trunk/include/clang/AST/StmtOpenMP.h Tue Nov 21 09:08:48 2017
@@ -2348,7 +2348,7 @@ class OMPTargetEnterDataDirective : publ
   unsigned NumClauses)
   : OMPExecutableDirective(this, OMPTargetEnterDataDirectiveClass,
OMPD_target_enter_data, StartLoc, EndLoc,
-   NumClauses, /*NumChildren=*/0) {}
+   NumClauses, /*NumChildren=*/1) {}
 
   /// \brief Build an empty directive.
   ///
@@ -2358,7 +2358,7 @@ class OMPTargetEnterDataDirective : publ
   : OMPExecutableDirective(this, OMPTargetEnterDataDirectiveClass,
OMPD_target_enter_data, SourceLocation(),
SourceLocation(), NumClauses,
-   /*NumChildren=*/0) {}
+   /*NumChildren=*/1) {}
 
 public:
   /// \brief Creates directive with a list of \a Clauses.
@@ -2367,11 +2367,11 @@ public:
   /// \param StartLoc Starting location of the directive kind.
   /// \param EndLoc Ending Location of the directive.
   /// \param Clauses List of clauses.
+  /// \param AssociatedStmt Statement, associated with the directive.
   ///
-  static OMPTargetEnterDataDirective *Create(const ASTContext ,
- SourceLocation StartLoc,
- SourceLocation EndLoc,
- ArrayRef Clauses);
+  static OMPTargetEnterDataDirective *
+  Create(const ASTContext , SourceLocation StartLoc, SourceLocation EndLoc,
+ ArrayRef Clauses, Stmt *AssociatedStmt);
 
   /// \brief Creates an empty directive with the place for \a N clauses.
   ///
@@ -2407,7 +2407,7 @@ class OMPTargetExitDataDirective : publi
  unsigned NumClauses)
   : OMPExecutableDirective(this, OMPTargetExitDataDirectiveClass,
OMPD_target_exit_data, StartLoc, EndLoc,
-   NumClauses, /*NumChildren=*/0) {}
+   NumClauses, /*NumChildren=*/1) {}
 
   /// \brief Build an empty directive.
   ///
@@ -2417,7 +2417,7 @@ class OMPTargetExitDataDirective : publi
   : OMPExecutableDirective(this, OMPTargetExitDataDirectiveClass,
OMPD_target_exit_data, SourceLocation(),
SourceLocation(), NumClauses,
-   /*NumChildren=*/0) {}
+   /*NumChildren=*/1) {}
 
 public:
   /// \brief Creates directive with a list of \a Clauses.
@@ -2426,11 +2426,11 @@ public:
   /// \param StartLoc Starting location of the directive kind.
   /// \param EndLoc Ending Location of the directive.
   /// \param Clauses List of clauses.
+  /// \param AssociatedStmt Statement, associated with the directive.
   ///
-  static OMPTargetExitDataDirective *Create(const ASTContext ,
-SourceLocation StartLoc,
-SourceLocation EndLoc,
-ArrayRef Clauses);
+  static OMPTargetExitDataDirective *
+  Create(const ASTContext , SourceLocation StartLoc, SourceLocation EndLoc,
+ ArrayRef Clauses, Stmt *AssociatedStmt);
 
   /// \brief Creates an empty directive with the place for \a N clauses.
   ///
@@ -2984,7 +2984,7 @@ class OMPTargetUpdateDirective : public
unsigned NumClauses)
   : OMPExecutableDirective(this, OMPTargetUpdateDirectiveClass,
OMPD_target_update, StartLoc, EndLoc, 
NumClauses,
-   0) {}
+   1) {}
 
   /// \brief Build an empty directive.
   ///
@@ -2993,7 +2993,7 @@ class OMPTargetUpdateDirective : public
   explicit OMPTargetUpdateDirective(unsigned NumClauses)
   : 

[clang-tools-extra] r318780 - [clangd] Satisfy GCC: 'changes meaning of Error'

2017-11-21 Thread Sam McCall via cfe-commits
Author: sammccall
Date: Tue Nov 21 09:02:24 2017
New Revision: 318780

URL: http://llvm.org/viewvc/llvm-project?rev=318780=rev
Log:
[clangd] Satisfy GCC: 'changes meaning of Error'

Modified:
clang-tools-extra/trunk/clangd/JSONExpr.cpp

Modified: clang-tools-extra/trunk/clangd/JSONExpr.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/JSONExpr.cpp?rev=318780=318779=318780=diff
==
--- clang-tools-extra/trunk/clangd/JSONExpr.cpp (original)
+++ clang-tools-extra/trunk/clangd/JSONExpr.cpp Tue Nov 21 09:02:24 2017
@@ -94,8 +94,8 @@ public:
   }
 
   Error takeError() {
-assert(Error);
-return std::move(*Error);
+assert(Err);
+return std::move(*Err);
   }
 
 private:
@@ -104,7 +104,7 @@ private:
   ++P;
   }
 
-  // On invalid syntax, parseX() functions return false and and set Error.
+  // On invalid syntax, parseX() functions return false and and set Err.
   bool parseNumber(char First, double );
   bool parseString(std::string );
   bool parseUnicode(std::string );
@@ -119,7 +119,7 @@ private:
   }
   static void encodeUtf8(uint32_t Rune, std::string );
 
-  Optional Error;
+  Optional Err;
   const char *Start, *P, *End;
 };
 
@@ -365,7 +365,7 @@ bool Parser::parseError(const char *Msg)
   StartOfLine = X + 1;
 }
   }
-  Error.emplace(
+  Err.emplace(
   llvm::make_unique(Msg, Line, P - StartOfLine, P - Start));
   return false;
 }


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


[PATCH] D40259: [libcxx] LWG2993: reference_wrapper conversion from T&

2017-11-21 Thread Agustín Bergé via Phabricator via cfe-commits
K-ballo updated this revision to Diff 123813.
K-ballo added a comment.

Full context diff.


https://reviews.llvm.org/D40259

Files:
  include/__functional_base
  include/functional
  
test/std/utilities/function.objects/refwrap/refwrap.assign/copy_assign.pass.cpp
  
test/std/utilities/function.objects/refwrap/refwrap.const/type_conv_ctor.fail.cpp
  
test/std/utilities/function.objects/refwrap/refwrap.const/type_conv_ctor.pass.cpp
  test/std/utilities/function.objects/refwrap/refwrap.const/type_ctor.pass.cpp

Index: test/std/utilities/function.objects/refwrap/refwrap.const/type_ctor.pass.cpp
===
--- test/std/utilities/function.objects/refwrap/refwrap.const/type_ctor.pass.cpp
+++ test/std/utilities/function.objects/refwrap/refwrap.const/type_ctor.pass.cpp
@@ -15,6 +15,7 @@
 
 #include 
 #include 
+#include 
 
 class functor1
 {
@@ -41,4 +42,19 @@
 test(i);
 const int j = 0;
 test(j);
+
+{
+using Ref = std::reference_wrapper;
+static_assert((std::is_constructible::value), "");
+static_assert((!std::is_constructible::value), "");
+static_assert((!std::is_constructible::value), "");
+}
+
+#if TEST_STD_VER >= 11
+{
+using Ref = std::reference_wrapper;
+static_assert((std::is_nothrow_constructible::value), "");
+static_assert((!std::is_nothrow_constructible::value), "");
+}
+#endif
 }
Index: test/std/utilities/function.objects/refwrap/refwrap.const/type_conv_ctor.pass.cpp
===
--- /dev/null
+++ test/std/utilities/function.objects/refwrap/refwrap.const/type_conv_ctor.pass.cpp
@@ -0,0 +1,82 @@
+//===--===//
+//
+// 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.
+//
+//===--===//
+
+// 
+
+// reference_wrapper
+
+// template 
+//   reference_wrapper(U&&) noexcept(see below);
+
+// XFAIL: c++98, c++03
+
+#include 
+#include 
+
+struct convertible_to_int_ref {
+int val = 0;
+operator int&() { return val; }
+operator int const&() const { return val; }
+};
+
+template 
+struct nothrow_convertible {
+int val = 0;
+operator int&() noexcept(IsNothrow) { return val; }
+};
+
+struct convertible_from_int {
+convertible_from_int(int) {}
+};
+
+void meow(std::reference_wrapper) {}
+void meow(convertible_from_int) {}
+
+int gi;
+std::reference_wrapper purr() { return gi; };
+
+template 
+void
+test(T& t)
+{
+std::reference_wrapper r(t);
+assert(() == );
+}
+
+void f() {}
+
+int main()
+{
+convertible_to_int_ref convi;
+test(convi);
+convertible_to_int_ref const convic;
+test(convic);
+
+{
+using Ref = std::reference_wrapper;
+static_assert((std::is_nothrow_constructible::value), "");
+static_assert((!std::is_nothrow_constructible::value), "");
+}
+
+{
+meow(0);
+(true) ? purr() : 0;
+}
+
+#ifdef __cpp_deduction_guides
+{
+int i = 0;
+std::reference_wrapper ri(i);
+static_assert((std::is_same::value), "" );
+const int j = 0;
+std::reference_wrapper rj(j);
+static_assert((std::is_same::value), "" );
+}
+#endif
+}
Index: test/std/utilities/function.objects/refwrap/refwrap.const/type_conv_ctor.fail.cpp
===
--- /dev/null
+++ test/std/utilities/function.objects/refwrap/refwrap.const/type_conv_ctor.fail.cpp
@@ -0,0 +1,31 @@
+//===--===//
+//
+// 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.
+//
+//===--===//
+
+// 
+
+// reference_wrapper
+
+// template 
+//   reference_wrapper(U&&) noexcept(see below);
+
+// XFAIL: c++98, c++03
+
+#include 
+#include 
+
+struct convertible_to_float_ref {
+float val = 0;
+operator float const&() const { return val; }
+};
+
+int main()
+{
+convertible_to_float_ref convf;
+std::reference_wrapper r(convf);
+}
Index: test/std/utilities/function.objects/refwrap/refwrap.assign/copy_assign.pass.cpp
===
--- test/std/utilities/function.objects/refwrap/refwrap.assign/copy_assign.pass.cpp
+++ test/std/utilities/function.objects/refwrap/refwrap.assign/copy_assign.pass.cpp
@@ -15,11 +15,18 @@
 
 #include 
 #include 
+#include 
 
 class functor1
 {
 };
 

[PATCH] D40276: Add -finstrument-function-entry-bare flag

2017-11-21 Thread Reid Kleckner via Phabricator via cfe-commits
rnk accepted this revision.
rnk added a comment.

Yep, looks good. :)


https://reviews.llvm.org/D40276



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


[PATCH] D40276: Add -finstrument-function-entry-bare flag

2017-11-21 Thread Hans Wennborg via Phabricator via cfe-commits
hans added a comment.

Reid, are you happy with this too?

In https://reviews.llvm.org/D40276#931502, @pasko wrote:

> Instrumenting the function entry post-inlining, without function exit, and 
> with no parameters is exactly what we need. The 
> `__cyg_profile_func_enter_bare` sounds good to me as a name. Thank you!


Great!

> Unnecessary thoughts just to get a feeling we are on the same page: this 
> could theoretically be made more orthogonal where 
> `-finstrument-functions-after-inlining` could regulate whether the call is 
> pre- or post-inlining, but I don't see how pre-inlining without parameters 
> would be usable without too much DWARF digging, which is not too practical.

The way I think about them, these flags all enable separate instrumentations 
(though you can only enable one at a time), they don't modify eachother as I 
think that might end up messier for the user.

In https://reviews.llvm.org/D40276#931706, @mattcary wrote:

> It looks like there also has to be a change to 
> llvm/lib/Transforms/Utils/EntryExitInstrumenter.cpp?


Yes, I'll land that in llvm once we're happy with this. I just wanted to make 
sure we get the flag and function names right, then the rest is trivial.


https://reviews.llvm.org/D40276



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


r318779 - Fix test/OpenMP/nvptx_data_sharing.cpp

2017-11-21 Thread Jonas Hahnfeld via cfe-commits
Author: hahnfeld
Date: Tue Nov 21 08:49:11 2017
New Revision: 318779

URL: http://llvm.org/viewvc/llvm-project?rev=318779=rev
Log:
Fix test/OpenMP/nvptx_data_sharing.cpp

This was an oversight that stayed in the test from development.

Modified:
cfe/trunk/test/OpenMP/nvptx_data_sharing.cpp

Modified: cfe/trunk/test/OpenMP/nvptx_data_sharing.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/nvptx_data_sharing.cpp?rev=318779=318778=318779=diff
==
--- cfe/trunk/test/OpenMP/nvptx_data_sharing.cpp (original)
+++ cfe/trunk/test/OpenMP/nvptx_data_sharing.cpp Tue Nov 21 08:49:11 2017
@@ -26,7 +26,7 @@ void test_ds(){
 // CK1: [[SHAREDARGS:%.+]] = alloca i8**
 // CK1: call i1 @__kmpc_kernel_parallel(i8** %work_fn, i8*** [[SHAREDARGS]])
 // CK1: [[SHARGSTMP:%.+]] = load i8**, i8*** [[SHAREDARGS]]
-// CK1: call void @__omp_outlined___wrapper{{.*}}({{.*}}, i8** %5)
+// CK1: call void @__omp_outlined___wrapper{{.*}}({{.*}}, i8** [[SHARGSTMP]])
 
 /// = In the kernel function = ///
 
@@ -49,4 +49,4 @@ void test_ds(){
 // CK1: [[SHARGSTMP6:%.+]] = load i32*, i32** [[SHARGSTMP5]]
 // CK1: call void @__omp_outlined__({{.*}}, i32* [[SHARGSTMP6]])
 
-#endif
\ No newline at end of file
+#endif


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


[clang-tools-extra] r318778 - [clangd] Fix dumb && || bug from r318774

2017-11-21 Thread Sam McCall via cfe-commits
Author: sammccall
Date: Tue Nov 21 08:44:16 2017
New Revision: 318778

URL: http://llvm.org/viewvc/llvm-project?rev=318778=rev
Log:
[clangd] Fix dumb && || bug from r318774

Modified:
clang-tools-extra/trunk/clangd/JSONExpr.cpp

Modified: clang-tools-extra/trunk/clangd/JSONExpr.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/JSONExpr.cpp?rev=318778=318777=318778=diff
==
--- clang-tools-extra/trunk/clangd/JSONExpr.cpp (original)
+++ clang-tools-extra/trunk/clangd/JSONExpr.cpp Tue Nov 21 08:44:16 2017
@@ -344,7 +344,7 @@ bool Parser::parseUnicode(std::string 
 uint16_t Second;
 if (!Parse4Hex(Second))
   return false;
-if (Second < 0xDC00 && Second >= 0xE000) {
+if (Second < 0xDC00 || Second >= 0xE000) {
   Invalid();  // Leading surrogate not followed by trailing.
   First = Second; // Second escape still needs to be processed.
   continue;


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


[PATCH] D40065: [libcxx] [test] Change (void)s to TEST_IGNORE_NODISCARD as requested by Eric.

2017-11-21 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF accepted this revision.
EricWF added a comment.
This revision is now accepted and ready to land.

LGTM.


https://reviews.llvm.org/D40065



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


[PATCH] D32751: [ASTImporter] Support new kinds of declarations (mostly Using*)

2017-11-21 Thread Aleksei Sidorin via Phabricator via cfe-commits
a.sidorin closed this revision.
a.sidorin added a comment.

Closed with https://reviews.llvm.org/rL318776 (forgot Differential Revision, 
sorry).


https://reviews.llvm.org/D32751



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


r318776 - [ASTImporter] Support new AST nodes:

2017-11-21 Thread Aleksei Sidorin via cfe-commits
Author: a.sidorin
Date: Tue Nov 21 08:08:41 2017
New Revision: 318776

URL: http://llvm.org/viewvc/llvm-project?rev=318776=rev
Log:
[ASTImporter] Support new AST nodes:

 * UnresolvedUsingType
 * EmptyDecl
 * NamespaceAliasDecl
 * UsingDecl
 * UsingShadowDecl
 * UsingDirectiveDecl
 * UnresolvedUsingValueDecl
 * UnresolvedUsingTypenameDecl

Refactor error handling in ImportTemplateArgumentLoc() method.
Add a test for inline namespaces.


Modified:
cfe/trunk/lib/AST/ASTImporter.cpp
cfe/trunk/test/ASTMerge/namespace/Inputs/namespace1.cpp
cfe/trunk/test/ASTMerge/namespace/Inputs/namespace2.cpp
cfe/trunk/test/ASTMerge/namespace/test.cpp

Modified: cfe/trunk/lib/AST/ASTImporter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTImporter.cpp?rev=318776=318775=318776=diff
==
--- cfe/trunk/lib/AST/ASTImporter.cpp (original)
+++ cfe/trunk/lib/AST/ASTImporter.cpp Tue Nov 21 08:08:41 2017
@@ -58,7 +58,7 @@ namespace clang {
 QualType VisitExtVectorType(const ExtVectorType *T);
 QualType VisitFunctionNoProtoType(const FunctionNoProtoType *T);
 QualType VisitFunctionProtoType(const FunctionProtoType *T);
-// FIXME: UnresolvedUsingType
+QualType VisitUnresolvedUsingType(const UnresolvedUsingType *T);
 QualType VisitParenType(const ParenType *T);
 QualType VisitTypedefType(const TypedefType *T);
 QualType VisitTypeOfExprType(const TypeOfExprType *T);
@@ -129,8 +129,8 @@ namespace clang {
 TemplateParameterList *ImportTemplateParameterList(
  TemplateParameterList 
*Params);
 TemplateArgument ImportTemplateArgument(const TemplateArgument );
-TemplateArgumentLoc ImportTemplateArgumentLoc(
-const TemplateArgumentLoc , bool );
+Optional ImportTemplateArgumentLoc(
+const TemplateArgumentLoc );
 bool ImportTemplateArguments(const TemplateArgument *FromArgs,
  unsigned NumFromArgs,
SmallVectorImpl );
@@ -143,10 +143,12 @@ namespace clang {
 bool IsStructuralMatch(ClassTemplateDecl *From, ClassTemplateDecl *To);
 bool IsStructuralMatch(VarTemplateDecl *From, VarTemplateDecl *To);
 Decl *VisitDecl(Decl *D);
+Decl *VisitEmptyDecl(EmptyDecl *D);
 Decl *VisitAccessSpecDecl(AccessSpecDecl *D);
 Decl *VisitStaticAssertDecl(StaticAssertDecl *D);
 Decl *VisitTranslationUnitDecl(TranslationUnitDecl *D);
 Decl *VisitNamespaceDecl(NamespaceDecl *D);
+Decl *VisitNamespaceAliasDecl(NamespaceAliasDecl *D);
 Decl *VisitTypedefNameDecl(TypedefNameDecl *D, bool IsAlias);
 Decl *VisitTypedefDecl(TypedefDecl *D);
 Decl *VisitTypeAliasDecl(TypeAliasDecl *D);
@@ -172,6 +174,12 @@ namespace clang {
 Decl *VisitObjCCategoryDecl(ObjCCategoryDecl *D);
 Decl *VisitObjCProtocolDecl(ObjCProtocolDecl *D);
 Decl *VisitLinkageSpecDecl(LinkageSpecDecl *D);
+Decl *VisitUsingDecl(UsingDecl *D);
+Decl *VisitUsingShadowDecl(UsingShadowDecl *D);
+Decl *VisitUsingDirectiveDecl(UsingDirectiveDecl *D);
+Decl *VisitUnresolvedUsingValueDecl(UnresolvedUsingValueDecl *D);
+Decl *VisitUnresolvedUsingTypenameDecl(UnresolvedUsingTypenameDecl *D);
+
 
 ObjCTypeParamList *ImportObjCTypeParamList(ObjCTypeParamList *list);
 Decl *VisitObjCInterfaceDecl(ObjCInterfaceDecl *D);
@@ -569,6 +577,22 @@ QualType ASTNodeImporter::VisitFunctionP
   return Importer.getToContext().getFunctionType(ToResultType, ArgTypes, 
ToEPI);
 }
 
+QualType ASTNodeImporter::VisitUnresolvedUsingType(
+const UnresolvedUsingType *T) {
+  UnresolvedUsingTypenameDecl *ToD = cast_or_null(
+Importer.Import(T->getDecl()));
+  if (!ToD)
+return QualType();
+
+  UnresolvedUsingTypenameDecl *ToPrevD =
+  cast_or_null(
+Importer.Import(T->getDecl()->getPreviousDecl()));
+  if (!ToPrevD && T->getDecl()->getPreviousDecl())
+return QualType();
+
+  return Importer.getToContext().getTypeDeclType(ToD, ToPrevD);
+}
+
 QualType ASTNodeImporter::VisitParenType(const ParenType *T) {
   QualType ToInnerType = Importer.Import(T->getInnerType());
   if (ToInnerType.isNull())
@@ -1183,9 +1207,8 @@ ASTNodeImporter::ImportTemplateArgument(
   llvm_unreachable("Invalid template argument kind");
 }
 
-TemplateArgumentLoc ASTNodeImporter::ImportTemplateArgumentLoc(
-const TemplateArgumentLoc , bool ) {
-  Error = false;
+Optional
+ASTNodeImporter::ImportTemplateArgumentLoc(const TemplateArgumentLoc ) {
   TemplateArgument Arg = ImportTemplateArgument(TALoc.getArgument());
   TemplateArgumentLocInfo FromInfo = TALoc.getLocInfo();
   TemplateArgumentLocInfo ToInfo;
@@ -1193,12 +1216,12 @@ TemplateArgumentLoc ASTNodeImporter::Imp
 Expr *E = Importer.Import(FromInfo.getAsExpr());
 ToInfo = TemplateArgumentLocInfo(E);
 if (!E)
-  Error = true;
+  return None;
   } else if (Arg.getKind() == TemplateArgument::Type) {

[PATCH] D33589: clang-format: consider not splitting tokens in optimization

2017-11-21 Thread Francois Ferrand via Phabricator via cfe-commits
Typz added a comment.

Btw, another issue I am having is that reflowing does not respect the 
alignment. For exemple:

  enum {
 Foo,///< This is a very long comment
 Bar,///< This is shorter  
 BarBar, ///< This is shorter
  } Stuff;

will be reflown to :

  enum {
 Foo, ///< This is a very long
  ///< comment
 Bar, ///< This is shorter  
 BarBar, ///< This is shorter
  } Stuff;

when I would expect:

  enum {
 Foo,///< This is a very
 ///< long comment
 Bar,///< This is shorter  
 BarBar, ///< This is shorter
  } Stuff;

I see there is no penalty for breaking alignment, which may be accounted for 
when compressing the whitespace 'before' the comment... Or maybe simply the 
breaking should be smarter, to try to keep the alignment; but I am not sure it 
can be done without another kind of 'global' optimization of the comment 
reflow... Any idea/hint?


https://reviews.llvm.org/D33589



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


[PATCH] D40310: Restructure how we break tokens.

2017-11-21 Thread Manuel Klimek via Phabricator via cfe-commits
klimek created this revision.

This fixes some bugs in the reflowing logic and splits out the concerns
of reflowing from BreakableToken.

Things to do after this patch:

- Refactor the breakProtrudingToken function possibly into a class, so we can 
split it up into methods that operate on the common state.
- Optimize whitespace compression when reflowing by using the next possible 
split point instead of the latest possible split point.


https://reviews.llvm.org/D40310

Files:
  lib/Format/BreakableToken.cpp
  lib/Format/BreakableToken.h
  lib/Format/ContinuationIndenter.cpp
  unittests/Format/FormatTest.cpp
  unittests/Format/FormatTestComments.cpp

Index: unittests/Format/FormatTestComments.cpp
===
--- unittests/Format/FormatTestComments.cpp
+++ unittests/Format/FormatTestComments.cpp
@@ -1096,11 +1096,12 @@
 }
 
 TEST_F(FormatTestComments, SplitsLongLinesInComments) {
+  // FIXME: Do we need to fix up the "  */" at the end?
+  // It doesn't look like any of our current logic triggers this.
   EXPECT_EQ("/* This is a long\n"
 " * comment that\n"
-" * doesn't\n"
-" * fit on one line.\n"
-" */",
+" * doesn't fit on\n"
+" * one line.  */",
 format("/* "
"This is a long "
"comment that "
@@ -2102,6 +2103,66 @@
   EXPECT_EQ("///", format(" ///  ", getLLVMStyleWithColumns(20)));
 }
 
+TEST_F(FormatTestComments, ReflowsCommentsPrecise) {
+  // FIXME: This assumes we do not continue compressing whitespace once we are
+  // in reflow mode. Consider compressing whitespace.
+
+  // Test that we stop reflowing precisely at the column limit.
+  // After reflowing, "// reflows into   foo" does not fit the column limit,
+  // so we compress the whitespace.
+  EXPECT_EQ("// some text that\n"
+"// reflows into foo\n",
+format("// some text that reflows\n"
+   "// into   foo\n",
+   getLLVMStyleWithColumns(20)));
+  // Given one more column, "// reflows into   foo" does fit the limit, so we
+  // do not compress the whitespace.
+  EXPECT_EQ("// some text that\n"
+"// reflows into   foo\n",
+format("// some text that reflows\n"
+   "// into   foo\n",
+   getLLVMStyleWithColumns(21)));
+}
+
+TEST_F(FormatTestComments, ReflowsCommentsWithExtraWhitespace) {
+  // Baseline.
+  EXPECT_EQ("// some text\n"
+"// that re flows\n",
+format("// some text that\n"
+   "// re flows\n",
+   getLLVMStyleWithColumns(16)));
+  EXPECT_EQ("// some text\n"
+"// that re flows\n",
+format("// some text that\n"
+   "// reflows\n",
+   getLLVMStyleWithColumns(16)));
+  EXPECT_EQ("/* some text\n"
+" * that re flows\n"
+" */\n",
+format("/* some text that\n"
+   "*  re   flows\n"
+   "*/\n",
+   getLLVMStyleWithColumns(16)));
+  // FIXME: We do not reflow if the indent of two subsequent lines differs;
+  // given that this is different behavior from block comments, do we want
+  // to keep this?
+  EXPECT_EQ("// some text\n"
+"// that\n"
+"// re flows\n",
+format("// some text that\n"
+   "// re   flows\n",
+   getLLVMStyleWithColumns(16)));
+  // Space within parts of a line that fit.
+  // FIXME: Use the earliest possible split while reflowing to compress the
+  // whitespace within the line.
+  EXPECT_EQ("// some text that\n"
+"// does re   flow\n"
+"// more  here\n",
+format("// some text that does\n"
+   "// re   flow  more  here\n",
+   getLLVMStyleWithColumns(21)));
+}
+
 TEST_F(FormatTestComments, IgnoresIf0Contents) {
   EXPECT_EQ("#if 0\n"
 "}{)(&*(^%%#%@! fsadj f;ldjs ,:;| <<<>>>][)(][\n"
@@ -2484,6 +2545,7 @@
   " long */\n"
   "  b);",
   format("a = f(a, /* long long */ b);", getLLVMStyleWithColumns(16)));
+
   EXPECT_EQ(
   "a = f(\n"
   "a,\n"
@@ -2888,16 +2950,15 @@
getLLVMStyleWithColumns(20)));
 }
 
-TEST_F(FormatTestComments, NoCrush_Bug34236) {
+TEST_F(FormatTestComments, NoCrash_Bug34236) {
   // This is a test case from a crasher reported in:
   // https://bugs.llvm.org/show_bug.cgi?id=34236
   // Temporarily disable formatting for readability.
   // clang-format off
   EXPECT_EQ(
 "/**/ /*\n"
 "  *   a\n"
-"  * b c\n"
-"

[PATCH] D40182: [clangd] Add parsing and value inspection to JSONExpr.

2017-11-21 Thread Sam McCall via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL318774: [clangd] Add parsing and value inspection to 
JSONExpr. (authored by sammccall).

Repository:
  rL LLVM

https://reviews.llvm.org/D40182

Files:
  clang-tools-extra/trunk/clangd/JSONExpr.cpp
  clang-tools-extra/trunk/clangd/JSONExpr.h
  clang-tools-extra/trunk/unittests/clangd/JSONExprTests.cpp

Index: clang-tools-extra/trunk/unittests/clangd/JSONExprTests.cpp
===
--- clang-tools-extra/trunk/unittests/clangd/JSONExprTests.cpp
+++ clang-tools-extra/trunk/unittests/clangd/JSONExprTests.cpp
@@ -15,6 +15,9 @@
 namespace clang {
 namespace clangd {
 namespace json {
+void PrintTo(const Expr , std::ostream *OS) {
+  llvm::raw_os_ostream(*OS) << llvm::formatv("{0:2}", E);
+}
 namespace {
 
 std::string s(const Expr ) { return llvm::formatv("{0}", E).str(); }
@@ -108,6 +111,77 @@
  }));
 }
 
+TEST(JSONTest, Parse) {
+  auto Compare = [](llvm::StringRef S, Expr Expected) {
+if (auto E = parse(S)) {
+  // Compare both string forms and with operator==, in case we have bugs.
+  EXPECT_EQ(*E, Expected);
+  EXPECT_EQ(sp(*E), sp(Expected));
+} else {
+  handleAllErrors(E.takeError(), [S](const llvm::ErrorInfoBase ) {
+FAIL() << "Failed to parse JSON >>> " << S << " <<<: " << E.message();
+  });
+}
+  };
+
+  Compare(R"(true)", true);
+  Compare(R"(false)", false);
+  Compare(R"(null)", nullptr);
+
+  Compare(R"(42)", 42);
+  Compare(R"(2.5)", 2.5);
+  Compare(R"(2e50)", 2e50);
+  Compare(R"(1.2e3456789)", 1.0 / 0.0);
+
+  Compare(R"("foo")", "foo");
+  Compare(R"("\"\\\b\f\n\r\t")", "\"\\\b\f\n\r\t");
+  Compare(R"("\u")", llvm::StringRef("\0", 1));
+  Compare("\"\x7f\"", "\x7f");
+  Compare(R"("\ud801\udc37")", "\U00010437"); // UTF16 surrogate pair escape.
+  Compare("\"\xE2\x82\xAC\xF0\x9D\x84\x9E\"", "\u20ac\U0001d11e"); // UTF8
+  Compare(R"("\ud801")", "\ufffd"); // Invalid codepoint.
+
+  Compare(R"({"":0,"":0})", obj{{"", 0}});
+  Compare(R"({"obj":{},"arr":[]})", obj{{"obj", obj{}}, {"arr", {}}});
+  Compare(R"({"\n":{"\u":}})",
+  obj{{"\n", obj{
+ {llvm::StringRef("\0", 1), },
+ }}});
+  Compare("\r[\n\t] ", {});
+}
+
+TEST(JSONTest, ParseErrors) {
+  auto ExpectErr = [](llvm::StringRef Msg, llvm::StringRef S) {
+if (auto E = parse(S)) {
+  // Compare both string forms and with operator==, in case we have bugs.
+  FAIL() << "Parsed JSON >>> " << S << " <<< but wanted error: " << Msg;
+} else {
+  handleAllErrors(E.takeError(), [S, Msg](const llvm::ErrorInfoBase ) {
+EXPECT_THAT(E.message(), testing::HasSubstr(Msg)) << S;
+  });
+}
+  };
+  ExpectErr("Unexpected EOF", "");
+  ExpectErr("Unexpected EOF", "[");
+  ExpectErr("Text after end of document", "[][]");
+  ExpectErr("Text after end of document", "[][]");
+  ExpectErr("Invalid bareword", "fuzzy");
+  ExpectErr("Expected , or ]", "[2?]");
+  ExpectErr("Expected object key", "{a:2}");
+  ExpectErr("Expected : after object key", R"({"a",2})");
+  ExpectErr("Expected , or } after object property", R"({"a":2 "b":3})");
+  ExpectErr("Expected JSON value", R"([&%!])");
+  ExpectErr("Invalid number", "1e1.0");
+  ExpectErr("Unterminated string", R"("abc\"def)");
+  ExpectErr("Control character in string", "\"abc\ndef\"");
+  ExpectErr("Invalid escape sequence", R"("\030")");
+  ExpectErr("Invalid \\u escape sequence", R"("\usuck")");
+  ExpectErr("[3:3, byte=19]", R"({
+  "valid": 1,
+  invalid: 2
+})");
+}
+
 } // namespace
 } // namespace json
 } // namespace clangd
Index: clang-tools-extra/trunk/clangd/JSONExpr.h
===
--- clang-tools-extra/trunk/clangd/JSONExpr.h
+++ clang-tools-extra/trunk/clangd/JSONExpr.h
@@ -1,30 +1,35 @@
-//===--- JSONExpr.h - composable JSON expressions ---*- C++ -*-===//
+//===--- JSONExpr.h - JSON expressions, parsing and serialization - C++ -*-===//
 //
 // The LLVM Compiler Infrastructure
 //
 // This file is distributed under the University of Illinois Open Source
 // License. See LICENSE.TXT for details.
 //
 //===-===//
 
+// FIXME: rename to JSON.h now that the scope is wider?
+
 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_JSON_H
 #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_JSON_H
 
 #include 
 
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Error.h"
 #include "llvm/Support/FormatVariadic.h"
 #include "llvm/Support/raw_ostream.h"
 
 namespace clang {
 namespace clangd {
 namespace json {
 
-// An Expr is an opaque temporary JSON structure used to compose documents.
+// An Expr is an JSON value of unknown type.
 // They can be copied, but should generally be moved.
 //
-// You can implicitly construct literals 

[clang-tools-extra] r318774 - [clangd] Add parsing and value inspection to JSONExpr.

2017-11-21 Thread Sam McCall via cfe-commits
Author: sammccall
Date: Tue Nov 21 08:00:53 2017
New Revision: 318774

URL: http://llvm.org/viewvc/llvm-project?rev=318774=rev
Log:
[clangd] Add parsing and value inspection to JSONExpr.

Summary:
This will replace the places where we're using YAMLParser to parse JSON now:
  - the new marshalling code (T::parse()) should handle fewer cases and require
fewer explicit casts
  - we'll early-reject invalid JSON that YAMLParser accepts
  - we'll be able to fix protocol-parsing bugs caused by the fact that YAML can
only parse forward

I plan to do the conversion as soon as this lands, but I don't want it in one
patch as the protocol.cpp changes are conflict-prone.

Reviewers: ioeric

Subscribers: ilya-biryukov, cfe-commits

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

Modified:
clang-tools-extra/trunk/clangd/JSONExpr.cpp
clang-tools-extra/trunk/clangd/JSONExpr.h
clang-tools-extra/trunk/unittests/clangd/JSONExprTests.cpp

Modified: clang-tools-extra/trunk/clangd/JSONExpr.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/JSONExpr.cpp?rev=318774=318773=318774=diff
==
--- clang-tools-extra/trunk/clangd/JSONExpr.cpp (original)
+++ clang-tools-extra/trunk/clangd/JSONExpr.cpp Tue Nov 21 08:00:53 2017
@@ -22,10 +22,10 @@ void Expr::copyFrom(const Expr ) {
 create(M.as());
 break;
   case T_Object:
-create(M.as());
+create(M.as());
 break;
   case T_Array:
-create(M.as());
+create(M.as());
 break;
   }
 }
@@ -46,11 +46,11 @@ void Expr::moveFrom(const Expr &) {
 M.Type = T_Null;
 break;
   case T_Object:
-create(std::move(M.as()));
+create(std::move(M.as()));
 M.Type = T_Null;
 break;
   case T_Array:
-create(std::move(M.as()));
+create(std::move(M.as()));
 M.Type = T_Null;
 break;
   }
@@ -69,14 +69,318 @@ void Expr::destroy() {
 as().~basic_string();
 break;
   case T_Object:
-as().~Object();
+as().~ObjectExpr();
 break;
   case T_Array:
-as().~Array();
+as().~ArrayExpr();
 break;
   }
 }
 
+namespace {
+// Simple recursive-descent JSON parser.
+class Parser {
+public:
+  Parser(StringRef JSON)
+  : Start(JSON.begin()), P(JSON.begin()), End(JSON.end()) {}
+
+  bool parseExpr(Expr );
+
+  bool assertEnd() {
+eatWhitespace();
+if (P == End)
+  return true;
+return parseError("Text after end of document");
+  }
+
+  Error takeError() {
+assert(Error);
+return std::move(*Error);
+  }
+
+private:
+  void eatWhitespace() {
+while (P != End && (*P == ' ' || *P == '\r' || *P == '\n' || *P == '\t'))
+  ++P;
+  }
+
+  // On invalid syntax, parseX() functions return false and and set Error.
+  bool parseNumber(char First, double );
+  bool parseString(std::string );
+  bool parseUnicode(std::string );
+  bool parseError(const char *Msg); // always returns false
+
+  char next() { return P == End ? 0 : *P++; }
+  char peek() { return P == End ? 0 : *P; }
+  static bool isNumber(char C) {
+return C == '0' || C == '1' || C == '2' || C == '3' || C == '4' ||
+   C == '5' || C == '6' || C == '7' || C == '8' || C == '9' ||
+   C == 'e' || C == 'E' || C == '+' || C == '-' || C == '.';
+  }
+  static void encodeUtf8(uint32_t Rune, std::string );
+
+  Optional Error;
+  const char *Start, *P, *End;
+};
+
+bool Parser::parseExpr(Expr ) {
+  eatWhitespace();
+  if (P == End)
+return parseError("Unexpected EOF");
+  switch (char C = next()) {
+  // Bare null/true/false are easy - first char identifies them.
+  case 'n':
+Out = nullptr;
+return (next() == 'u' && next() == 'l' && next() == 'l') ||
+   parseError("Invalid bareword");
+  case 't':
+Out = true;
+return (next() == 'r' && next() == 'u' && next() == 'e') ||
+   parseError("Invalid bareword");
+  case 'f':
+Out = false;
+return (next() == 'a' && next() == 'l' && next() == 's' && next() == 'e') 
||
+   parseError("Invalid bareword");
+  case '"': {
+std::string S;
+if (parseString(S)) {
+  Out = std::move(S);
+  return true;
+}
+return false;
+  }
+  case '[': {
+Out = json::ary{};
+json::ary  = *Out.array();
+eatWhitespace();
+if (peek() == ']') {
+  ++P;
+  return true;
+}
+for (;;) {
+  A.emplace_back(nullptr);
+  if (!parseExpr(A.back()))
+return false;
+  eatWhitespace();
+  switch (next()) {
+  case ',':
+eatWhitespace();
+continue;
+  case ']':
+return true;
+  default:
+return parseError("Expected , or ] after array element");
+  }
+}
+  }
+  case '{': {
+Out = json::obj{};
+json::obj  = *Out.object();
+eatWhitespace();
+if (peek() == '}') {
+  ++P;
+  return true;
+}
+for (;;) {
+  if (next() != '"')
+return parseError("Expected object key");
+  std::string K;

[PATCH] D40279: [libcxxabi][demangler] Add demangling for __attribute__((abi_tag))

2017-11-21 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF accepted this revision.
EricWF added a comment.
This revision is now accepted and ready to land.

LGTM. Thanks.


https://reviews.llvm.org/D40279



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


[PATCH] D33589: clang-format: consider not splitting tokens in optimization

2017-11-21 Thread Francois Ferrand via Phabricator via cfe-commits
Typz added a comment.

In https://reviews.llvm.org/D33589#925903, @klimek wrote:

> I think this patch doesn't handle a couple of cases that I'd like to see 
> handled. A counter-proposal with different trade-offs is in 
> https://reviews.llvm.org/D40068.


It may be simpler (though not to my eyes, I am not knowledgeable enough to 
really understand how you go this fixed...), and works fine for "almost 
correct" comments: e.g. when there are indeed just a few extra characters 
overall. But it still procudes strange result when each line of the (long) 
comment is too long, but not enough to trigger a line-wrap by itself.

Since that version has landed already, not sure how to improve on this. I could 
probably rewrite my patch on master, but it seems a bit redundant. As a simpler 
fix, I could imagine adding a "total" overflow counter, to allow detecting the 
situation; but when this is detected (e.g. on subsequent lines) we would need 
to "backtrack" and revisit the initial decision...


https://reviews.llvm.org/D33589



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


[PATCH] D40044: [CodeGen] convert math libcalls/builtins to equivalent LLVM intrinsics

2017-11-21 Thread Sanjay Patel via Phabricator via cfe-commits
spatel added a comment.

Ping.


https://reviews.llvm.org/D40044



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


[PATCH] D33589: clang-format: consider not splitting tokens in optimization

2017-11-21 Thread Francois Ferrand via Phabricator via cfe-commits
Typz added a comment.

In https://reviews.llvm.org/D33589#924716, @klimek wrote:

> One interesting trade-off I'm running into:
>  My gut feeling is that we really want to make local decisions about whether 
> we want to break/reflow - this makes the code significantly simpler (IMO), 
> and handles all tests in this patch correctly, but is fundamentally limiting 
> the global optimizations we can do. Specifically, we would not correctly 
> reflow this:
>
>   //   |< limit
>   // foo bar
>   // baz
>   // x
>
> to
>
>   // foo
>   // bar
>   // baz x
>
> when the excess character limit is low.


As I can see with your patch, local decision does not account for accumulated 
penalty on multi-line comment, and will thus give unexpected (e.g. no change) 
result when each line overlaps by a few characters, but not enough to trigger a 
break at this line.

> That would be a point for global optimization, but I find it really hard to 
> understand exactly why it's ok to do it. Won't we get things like this wrong:
> 
>   Limit: 13
>   // foo  bar baz
>   // bab  bob
> 
> as we'll not compress whitespace?

Indeed, this patch would not trigger whitespace compression when not reflowing; 
it would compare "not doing anything" (no reflow, no whitespace compression) 
with the complete reflowing (including whitespace compression). I don't think 
that would break anything, but indeed we could possibly get even better result 
by trying to apply whitespace compression in the no-reflow case [which should 
be simple, just a bit more code at line 1376 in the version of the patch].


https://reviews.llvm.org/D33589



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


[PATCH] D40182: [clangd] Add parsing and value inspection to JSONExpr.

2017-11-21 Thread Eric Liu via Phabricator via cfe-commits
ioeric accepted this revision.
ioeric added a comment.
This revision is now accepted and ready to land.

lg


https://reviews.llvm.org/D40182



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


  1   2   >