[PATCH] D31739: Add markup for libc++ dylib availability

2017-04-16 Thread Mehdi AMINI via Phabricator via cfe-commits
mehdi_amini added a comment.

Ping?


https://reviews.llvm.org/D31739



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


r300420 - [coroutines] Fix building of new/delete expressions when get_return_object_on_allocation_failure() is present.

2017-04-16 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Sun Apr 16 04:19:59 2017
New Revision: 300420

URL: http://llvm.org/viewvc/llvm-project?rev=300420&view=rev
Log:
[coroutines] Fix building of new/delete expressions when 
get_return_object_on_allocation_failure() is present.

Summary:
This patch implements [dcl.fct.def.coroutine]p8:
> The unqualified-id get_return_object_on_allocation_failure is looked up in 
> the scope of
> class P by class member access lookup (3.4.5). If a declaration is found, 
> ..., and if a 
> global allocation function is selected, the ::operator new(size_t, nothrow_t) 
> form shall be used.
> [...]
> The allocation function used in this case must have a non-throwing 
> noexcept-specification.

Reviewers: GorNishanov, rsmith, majnemer, aaron.ballman

Reviewed By: GorNishanov

Subscribers: cfe-commits

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

Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/Sema/SemaCoroutine.cpp
cfe/trunk/test/CodeGenCoroutines/coro-alloc.cpp
cfe/trunk/test/SemaCXX/coroutines.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=300420&r1=300419&r2=300420&view=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Sun Apr 16 04:19:59 
2017
@@ -8854,6 +8854,11 @@ def err_coroutine_invalid_func_context :
 def err_implied_coroutine_type_not_found : Error<
   "%0 type was not found; include  before defining "
   "a coroutine">;
+def err_implicit_coroutine_std_nothrow_type_not_found : Error<
+  "std::nothrow was not found; include  before defining a coroutine which 
"
+  "uses get_return_object_on_allocation_failure()">;
+def err_malformed_std_nothrow : Error<
+  "std::nothrow must be a valid variable declaration">;
 def err_malformed_std_coroutine_handle : Error<
   "std::experimental::coroutine_handle must be a class template">;
 def err_coroutine_handle_missing_member : Error<
@@ -8873,7 +8878,7 @@ def err_coroutine_promise_return_ill_for
   "%0 declares both 'return_value' and 'return_void'">;
 def note_coroutine_promise_implicit_await_transform_required_here : Note<
   "call to 'await_transform' implicitly required by 'co_await' here">;
-def note_coroutine_promise_call_implicitly_required : Note<
+def note_coroutine_promise_suspend_implicitly_required : Note<
   "call to '%select{initial_suspend|final_suspend}0' implicitly "
   "required by the %select{initial suspend point|final suspend point}0">;
 def err_coroutine_promise_unhandled_exception_required : Error<
@@ -8883,6 +,11 @@ def warn_coroutine_promise_unhandled_exc
   InGroup;
 def err_coroutine_promise_get_return_object_on_allocation_failure : Error<
   "%0: 'get_return_object_on_allocation_failure()' must be a static member 
function">;
+def err_coroutine_promise_new_requires_nothrow : Error<
+  "%0 is required to have a non-throwing noexcept specification when the 
promise "
+   "type declares 'get_return_object_on_allocation_failure()'">;
+def note_coroutine_promise_call_implicitly_required : Note<
+  "call to %0 implicitly required by coroutine function here">;
 }
 
 let CategoryName = "Documentation Issue" in {

Modified: cfe/trunk/lib/Sema/SemaCoroutine.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCoroutine.cpp?rev=300420&r1=300419&r2=300420&view=diff
==
--- cfe/trunk/lib/Sema/SemaCoroutine.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCoroutine.cpp Sun Apr 16 04:19:59 2017
@@ -454,7 +454,7 @@ static bool actOnCoroutineBodyStart(Sema
  /*IsImplicit*/ true);
 Suspend = S.ActOnFinishFullExpr(Suspend.get());
 if (Suspend.isInvalid()) {
-  S.Diag(Loc, diag::note_coroutine_promise_call_implicitly_required)
+  S.Diag(Loc, diag::note_coroutine_promise_suspend_implicitly_required)
   << ((Name == "initial_suspend") ? 0 : 1);
   S.Diag(KWLoc, diag::note_declared_coroutine_here) << Keyword;
   return StmtError();
@@ -660,6 +660,39 @@ StmtResult Sema::BuildCoreturnStmt(Sourc
   return Res;
 }
 
+/// Look up the std::nothrow object.
+static Expr *buildStdNoThrowDeclRef(Sema &S, SourceLocation Loc) {
+  NamespaceDecl *Std = S.getStdNamespace();
+  assert(Std && "Should already be diagnosed");
+
+  LookupResult Result(S, &S.PP.getIdentifierTable().get("nothrow"), Loc,
+  Sema::LookupOrdinaryName);
+  if (!S.LookupQualifiedName(Result, Std)) {
+// FIXME:  should have been included already.
+// If we require it to include  then this diagnostic is no longer
+// needed.
+S.Diag(Loc, diag::err_implicit_coroutine_std_nothrow_type_not_found);
+return nullptr;
+  }
+
+  // FIXME: Mark the variable as ODR used. This currently

r300421 - Revert r300420 - [coroutines] Fix building of new/delete expressions when get_return_object_on_allocation_failure() is present

2017-04-16 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Sun Apr 16 04:34:28 2017
New Revision: 300421

URL: http://llvm.org/viewvc/llvm-project?rev=300421&view=rev
Log:
Revert r300420 - [coroutines] Fix building of new/delete expressions when 
get_return_object_on_allocation_failure() is present

Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/Sema/SemaCoroutine.cpp
cfe/trunk/test/CodeGenCoroutines/coro-alloc.cpp
cfe/trunk/test/SemaCXX/coroutines.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=300421&r1=300420&r2=300421&view=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Sun Apr 16 04:34:28 
2017
@@ -8854,11 +8854,6 @@ def err_coroutine_invalid_func_context :
 def err_implied_coroutine_type_not_found : Error<
   "%0 type was not found; include  before defining "
   "a coroutine">;
-def err_implicit_coroutine_std_nothrow_type_not_found : Error<
-  "std::nothrow was not found; include  before defining a coroutine which 
"
-  "uses get_return_object_on_allocation_failure()">;
-def err_malformed_std_nothrow : Error<
-  "std::nothrow must be a valid variable declaration">;
 def err_malformed_std_coroutine_handle : Error<
   "std::experimental::coroutine_handle must be a class template">;
 def err_coroutine_handle_missing_member : Error<
@@ -8878,7 +8873,7 @@ def err_coroutine_promise_return_ill_for
   "%0 declares both 'return_value' and 'return_void'">;
 def note_coroutine_promise_implicit_await_transform_required_here : Note<
   "call to 'await_transform' implicitly required by 'co_await' here">;
-def note_coroutine_promise_suspend_implicitly_required : Note<
+def note_coroutine_promise_call_implicitly_required : Note<
   "call to '%select{initial_suspend|final_suspend}0' implicitly "
   "required by the %select{initial suspend point|final suspend point}0">;
 def err_coroutine_promise_unhandled_exception_required : Error<
@@ -,11 +8883,6 @@ def warn_coroutine_promise_unhandled_exc
   InGroup;
 def err_coroutine_promise_get_return_object_on_allocation_failure : Error<
   "%0: 'get_return_object_on_allocation_failure()' must be a static member 
function">;
-def err_coroutine_promise_new_requires_nothrow : Error<
-  "%0 is required to have a non-throwing noexcept specification when the 
promise "
-   "type declares 'get_return_object_on_allocation_failure()'">;
-def note_coroutine_promise_call_implicitly_required : Note<
-  "call to %0 implicitly required by coroutine function here">;
 }
 
 let CategoryName = "Documentation Issue" in {

Modified: cfe/trunk/lib/Sema/SemaCoroutine.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCoroutine.cpp?rev=300421&r1=300420&r2=300421&view=diff
==
--- cfe/trunk/lib/Sema/SemaCoroutine.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCoroutine.cpp Sun Apr 16 04:34:28 2017
@@ -454,7 +454,7 @@ static bool actOnCoroutineBodyStart(Sema
  /*IsImplicit*/ true);
 Suspend = S.ActOnFinishFullExpr(Suspend.get());
 if (Suspend.isInvalid()) {
-  S.Diag(Loc, diag::note_coroutine_promise_suspend_implicitly_required)
+  S.Diag(Loc, diag::note_coroutine_promise_call_implicitly_required)
   << ((Name == "initial_suspend") ? 0 : 1);
   S.Diag(KWLoc, diag::note_declared_coroutine_here) << Keyword;
   return StmtError();
@@ -660,39 +660,6 @@ StmtResult Sema::BuildCoreturnStmt(Sourc
   return Res;
 }
 
-/// Look up the std::nothrow object.
-static Expr *buildStdNoThrowDeclRef(Sema &S, SourceLocation Loc) {
-  NamespaceDecl *Std = S.getStdNamespace();
-  assert(Std && "Should already be diagnosed");
-
-  LookupResult Result(S, &S.PP.getIdentifierTable().get("nothrow"), Loc,
-  Sema::LookupOrdinaryName);
-  if (!S.LookupQualifiedName(Result, Std)) {
-// FIXME:  should have been included already.
-// If we require it to include  then this diagnostic is no longer
-// needed.
-S.Diag(Loc, diag::err_implicit_coroutine_std_nothrow_type_not_found);
-return nullptr;
-  }
-
-  // FIXME: Mark the variable as ODR used. This currently does not work
-  // likely due to the scope at in which this function is called.
-  auto *VD = Result.getAsSingle();
-  if (!VD) {
-Result.suppressDiagnostics();
-// We found something weird. Complain about the first thing we found.
-NamedDecl *Found = *Result.begin();
-S.Diag(Found->getLocation(), diag::err_malformed_std_nothrow);
-return nullptr;
-  }
-
-  ExprResult DR = S.BuildDeclRefExpr(VD, VD->getType(), VK_LValue, Loc);
-  if (DR.isInvalid())
-return nullptr;
-
-  return DR.get();
-}
-
 // Find an appropriate delete for the promise.
 static FunctionDecl *findDele

[PATCH] D32112: [clang] Register isConstexpr matcher

2017-04-16 Thread Alexander Kornienko via Phabricator via cfe-commits
alexfh accepted this revision.
alexfh added a comment.
This revision is now accepted and ready to land.

LG


Repository:
  rL LLVM

https://reviews.llvm.org/D32112



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


[PATCH] D28832: Improve redefinition errors pointing to the same header.

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

@bruno, ok, sounds good.


https://reviews.llvm.org/D28832



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


[PATCH] D31739: Add markup for libc++ dylib availability

2017-04-16 Thread Jonathan Roelofs via Phabricator via cfe-commits
jroelofs added inline comments.



Comment at: utils/libcxx/test/config.py:289
+def configure_availability(self):
+# FIXME doc
+self.with_availability = self.get_lit_bool('with_availability', False)

Can you expand on what the FIXME here wants? Is there something that 
AvailabilityMarkup.rst doesn't cover?



Comment at: utils/libcxx/test/config.py:316
+if self.with_availability:
+self.use_clang_verify = False
+return

Why does the availability stuff clash with -verify?



Comment at: utils/libcxx/test/config.py:363
+self.config.available_features.add('%s=%s%s' % (feature, name, 
version))
+self.config.available_features.add('%s=%s%s' % (feature, name, 
version))
+

This line, and the one above it are the same. Is that intentional?



Comment at: utils/libcxx/test/config.py:387
+self.config.available_features.add(
+'with_system_cxx_lib=%s' % component)
 

Is it worth filtering out `none` and `unknown`, as they're often repeated, and 
you can't tell which part of the triple they came from?

Consider: `arm-none-linux-gnueabi` vs `arm-none-none-eabi`.

Or would it be better to include some marker in the features to say which part 
of the triple it came from, eg:

```
  - with_system_cxx_lib=arch:arm
  - with_system_cxx_lib=vendor:none
  - with_system_cxx_lib=os:linux
  - with_system_cxx_lib=sys:gnueabi
```


https://reviews.llvm.org/D31739



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


r300423 - Use setUsedForHeaderGuard() accessor function instead of direcly accessing UsedForHeaderGuard.

2017-04-16 Thread Yaron Keren via cfe-commits
Author: yrnkrn
Date: Sun Apr 16 10:53:19 2017
New Revision: 300423

URL: http://llvm.org/viewvc/llvm-project?rev=300423&view=rev
Log:
Use setUsedForHeaderGuard() accessor function instead of direcly accessing 
UsedForHeaderGuard.

Modified:
cfe/trunk/lib/Lex/PPLexerChange.cpp

Modified: cfe/trunk/lib/Lex/PPLexerChange.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPLexerChange.cpp?rev=300423&r1=300422&r2=300423&view=diff
==
--- cfe/trunk/lib/Lex/PPLexerChange.cpp (original)
+++ cfe/trunk/lib/Lex/PPLexerChange.cpp Sun Apr 16 10:53:19 2017
@@ -303,9 +303,8 @@ bool Preprocessor::HandleEndOfFile(Token
   if (const FileEntry *FE = CurPPLexer->getFileEntry()) {
 HeaderInfo.SetFileControllingMacro(FE, ControllingMacro);
 if (MacroInfo *MI =
-  getMacroInfo(const_cast(ControllingMacro))) {
-  MI->UsedForHeaderGuard = true;
-}
+  getMacroInfo(const_cast(ControllingMacro)))
+  MI->setUsedForHeaderGuard(true);
 if (const IdentifierInfo *DefinedMacro =
   CurPPLexer->MIOpt.GetDefinedMacro()) {
   if (!isMacroDefined(ControllingMacro) &&


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


[PATCH] D32113: Add path from clang to doxygen document include header

2017-04-16 Thread Raphael Isemann via Phabricator via cfe-commits
teemperor added a subscriber: cfe-commits.
teemperor added a comment.




https://reviews.llvm.org/D32113



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


Re: [libcxx] r300411 - Workaround Clang bug regarding template template parameters

2017-04-16 Thread Nico Weber via cfe-commits
Is that bug filed?

On Sat, Apr 15, 2017 at 10:47 PM, Eric Fiselier via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: ericwf
> Date: Sat Apr 15 21:47:46 2017
> New Revision: 300411
>
> URL: http://llvm.org/viewvc/llvm-project?rev=300411&view=rev
> Log:
> Workaround Clang bug regarding template template parameters
>
> Modified:
> libcxx/trunk/test/std/utilities/smartptr/unique.ptr/
> unique.ptr.class/unique.ptr.asgn/move_convert.pass.cpp
>
> Modified: libcxx/trunk/test/std/utilities/smartptr/unique.ptr/
> unique.ptr.class/unique.ptr.asgn/move_convert.pass.cpp
> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/
> utilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.
> asgn/move_convert.pass.cpp?rev=300411&r1=300410&r2=300411&view=diff
> 
> ==
> --- libcxx/trunk/test/std/utilities/smartptr/unique.ptr/
> unique.ptr.class/unique.ptr.asgn/move_convert.pass.cpp (original)
> +++ libcxx/trunk/test/std/utilities/smartptr/unique.ptr/
> unique.ptr.class/unique.ptr.asgn/move_convert.pass.cpp Sat Apr 15
> 21:47:46 2017
> @@ -46,17 +46,23 @@ using EnableIfNotSame = typename std::en
>  !std::is_same::type, typename
> std::decay::type>::value
>  >::type;
>
> -template  class Templ, class Other>
> -struct is_specialization : std::false_type {};
> +template 
> +struct is_specialization;
>
> -template  class Templ, int ID>
> -struct is_specialization > : std::true_type {};
> +template  class Templ, int ID1, class Other>
> +struct is_specialization, Other> : std::false_type {};
>
> -template  class Templ, class Other>
> +template  class Templ, int ID1, int ID2>
> +struct is_specialization, Templ > : std::true_type {};
> +
> +template 
>  using EnableIfSpecialization = typename std::enable_if<
>  is_specialization::type >::value
>>::type;
>
> +template  struct TrackingDeleter;
> +template  struct ConstTrackingDeleter;
> +
>  template 
>  struct TrackingDeleter {
>TrackingDeleter() : arg_type(&makeArgumentID<>()) {}
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [libcxx] r300411 - Workaround Clang bug regarding template template parameters

2017-04-16 Thread Eric Fiselier via cfe-commits
One better, it has already been fixed.

On Apr 16, 2017 12:48 PM, "Nico Weber"  wrote:

> Is that bug filed?
>
> On Sat, Apr 15, 2017 at 10:47 PM, Eric Fiselier via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> Author: ericwf
>> Date: Sat Apr 15 21:47:46 2017
>> New Revision: 300411
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=300411&view=rev
>> Log:
>> Workaround Clang bug regarding template template parameters
>>
>> Modified:
>> libcxx/trunk/test/std/utilities/smartptr/unique.ptr/unique.
>> ptr.class/unique.ptr.asgn/move_convert.pass.cpp
>>
>> Modified: libcxx/trunk/test/std/utilities/smartptr/unique.ptr/unique.
>> ptr.class/unique.ptr.asgn/move_convert.pass.cpp
>> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/ut
>> ilities/smartptr/unique.ptr/unique.ptr.class/unique.ptr.asgn
>> /move_convert.pass.cpp?rev=300411&r1=300410&r2=300411&view=diff
>> 
>> ==
>> --- libcxx/trunk/test/std/utilities/smartptr/unique.ptr/unique.
>> ptr.class/unique.ptr.asgn/move_convert.pass.cpp (original)
>> +++ libcxx/trunk/test/std/utilities/smartptr/unique.ptr/unique.
>> ptr.class/unique.ptr.asgn/move_convert.pass.cpp Sat Apr 15 21:47:46 2017
>> @@ -46,17 +46,23 @@ using EnableIfNotSame = typename std::en
>>  !std::is_same::type, typename
>> std::decay::type>::value
>>  >::type;
>>
>> -template  class Templ, class Other>
>> -struct is_specialization : std::false_type {};
>> +template 
>> +struct is_specialization;
>>
>> -template  class Templ, int ID>
>> -struct is_specialization > : std::true_type {};
>> +template  class Templ, int ID1, class Other>
>> +struct is_specialization, Other> : std::false_type {};
>>
>> -template  class Templ, class Other>
>> +template  class Templ, int ID1, int ID2>
>> +struct is_specialization, Templ > : std::true_type {};
>> +
>> +template 
>>  using EnableIfSpecialization = typename std::enable_if<
>>  is_specialization::type >::value
>>>::type;
>>
>> +template  struct TrackingDeleter;
>> +template  struct ConstTrackingDeleter;
>> +
>>  template 
>>  struct TrackingDeleter {
>>TrackingDeleter() : arg_type(&makeArgumentID<>()) {}
>>
>>
>> ___
>> 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] D32113: Add path from clang to doxygen document include header

2017-04-16 Thread Raphael Isemann via Phabricator via cfe-commits
teemperor added a comment.

@yamaguchi  Did you test the latest revision of this patch and get the desired 
output paths? I just tested it and it seems on my system doxygen can't handle 
the `@abs_srcdir@/../`.

At least on my system it gets correctly generated as:

  STRIP_FROM_PATH= /home/teemperor/llvm/trunk/tools/clang/docs/../

However, because doxygen seems to be only doing string-matching, it doesn't 
understand that `/home/teemperor/llvm/trunk/tools/clang/` equals 
`/home/teemperor/llvm/trunk/tools/clang/docs/../` (at least on my system). If I 
manually remove `docs/../` I get the correct result.

In theory we could just replace the `@abs_srcdir@/../`with another CMake 
variable that is already correctly replaced by the real path, but I fear we 
loose autoconf support that way unless we have a separate 
`doxygen-cmake.conf.in` or something ugly like that.


https://reviews.llvm.org/D32113



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


r300427 - [clang] Register isConstexpr matcher

2017-04-16 Thread Alexander Shaposhnikov via cfe-commits
Author: alexshap
Date: Sun Apr 16 14:05:17 2017
New Revision: 300427

URL: http://llvm.org/viewvc/llvm-project?rev=300427&view=rev
Log:
[clang] Register isConstexpr matcher

This diff registers isConstexpr matcher.

Test plan:
make check-all
check that "match varDecl(isConstexpr())" 
works in clang-query

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

Modified:
cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp

Modified: cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp?rev=300427&r1=300426&r2=300427&view=diff
==
--- cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp (original)
+++ cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp Sun Apr 16 14:05:17 2017
@@ -296,6 +296,7 @@ RegistryMaps::RegistryMaps() {
   REGISTER_MATCHER(isCatchAll);
   REGISTER_MATCHER(isClass);
   REGISTER_MATCHER(isConst);
+  REGISTER_MATCHER(isConstexpr);
   REGISTER_MATCHER(isConstQualified);
   REGISTER_MATCHER(isCopyAssignmentOperator);
   REGISTER_MATCHER(isCopyConstructor);


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


[PATCH] D32112: [clang] Register isConstexpr matcher

2017-04-16 Thread Alexander Shaposhnikov via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL300427: [clang] Register isConstexpr matcher (authored by 
alexshap).

Changed prior to commit:
  https://reviews.llvm.org/D32112?vs=95385&id=95411#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D32112

Files:
  cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp


Index: cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp
===
--- cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp
+++ cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp
@@ -296,6 +296,7 @@
   REGISTER_MATCHER(isCatchAll);
   REGISTER_MATCHER(isClass);
   REGISTER_MATCHER(isConst);
+  REGISTER_MATCHER(isConstexpr);
   REGISTER_MATCHER(isConstQualified);
   REGISTER_MATCHER(isCopyAssignmentOperator);
   REGISTER_MATCHER(isCopyConstructor);


Index: cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp
===
--- cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp
+++ cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp
@@ -296,6 +296,7 @@
   REGISTER_MATCHER(isCatchAll);
   REGISTER_MATCHER(isClass);
   REGISTER_MATCHER(isConst);
+  REGISTER_MATCHER(isConstexpr);
   REGISTER_MATCHER(isConstQualified);
   REGISTER_MATCHER(isCopyAssignmentOperator);
   REGISTER_MATCHER(isCopyConstructor);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D31992: [clangd] Escape only necessary characters in JSON output

2017-04-16 Thread Marc-Andre Laperle via Phabricator via cfe-commits
malaperle-ericsson added a comment.

In https://reviews.llvm.org/D31992#726447, @joerg wrote:

>   let's escape ... all the known ASCII control characters,


Do you mean encode all of them with \u or keep the two characters 
representation for those that exist? I think \n is nicer than \u000A and is 
probably common enough to keep the short version. Same for \r, \t.


Repository:
  rL LLVM

https://reviews.llvm.org/D31992



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


[PATCH] D31992: [clangd] Escape only necessary characters in JSON output

2017-04-16 Thread Marc-Andre Laperle via Phabricator via cfe-commits
malaperle-ericsson updated this revision to Diff 95414.
malaperle-ericsson added a comment.

Handle other control characters and add test


https://reviews.llvm.org/D31992

Files:
  clangd/ASTManager.cpp
  clangd/Protocol.cpp
  clangd/Protocol.h
  clangd/ProtocolHandlers.cpp
  test/clangd/encoding.test

Index: test/clangd/encoding.test
===
--- /dev/null
+++ test/clangd/encoding.test
@@ -0,0 +1,17 @@
+# 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: 154
+
+{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"file:///foo.c","languageId":"c","version":1,"text":"void main() {é;}"}}}
+#
+# CHECK: {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///foo.c","diagnostics":[{"range":{"start": {"line": 0, "character": 1}, "end": {"line": 0, "character": 1}},"severity":2,"message":"return type of 'main' is not 'int'"},{"range":{"start": {"line": 0, "character": 1}, "end": {"line": 0, "character": 1}},"severity":3,"message":"change return type to 'int'"},{"range":{"start": {"line": 0, "character": 14}, "end": {"line": 0, "character": 14}},"severity":1,"message":"use of undeclared identifier 'é'"}]}}
+#
+#
+Content-Length: 44
+
+{"jsonrpc":"2.0","id":5,"method":"shutdown"}
Index: clangd/ProtocolHandlers.cpp
===
--- clangd/ProtocolHandlers.cpp
+++ clangd/ProtocolHandlers.cpp
@@ -172,9 +172,9 @@
 
 if (!Edits.empty())
   Commands +=
-  R"({"title":"Apply FixIt ')" + llvm::yaml::escape(D.message) +
+  R"({"title":"Apply FixIt ')" + jsonEscape(D.message) +
   R"('", "command": "clangd.applyFix", "arguments": [")" +
-  llvm::yaml::escape(CAP->textDocument.uri.uri) +
+  jsonEscape(CAP->textDocument.uri.uri) +
   R"(", [)" + Edits +
   R"(]]},)";
   }
Index: clangd/Protocol.h
===
--- clangd/Protocol.h
+++ clangd/Protocol.h
@@ -29,6 +29,8 @@
 namespace clang {
 namespace clangd {
 
+std::string jsonEscape(llvm::StringRef Input);
+
 struct URI {
   std::string uri;
   std::string file;
Index: clangd/Protocol.cpp
===
--- clangd/Protocol.cpp
+++ clangd/Protocol.cpp
@@ -15,12 +15,48 @@
 #include "Protocol.h"
 #include "clang/Basic/LLVM.h"
 #include "llvm/ADT/SmallString.h"
+#include 
 #include "llvm/Support/Format.h"
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/Support/Path.h"
 using namespace clang::clangd;
 
 
+std::string clang::clangd::jsonEscape(llvm::StringRef Input) {
+  std::string EscapedInput;
+  for (llvm::StringRef::iterator i = Input.begin(), e = Input.end(); i != e; ++i) {
+if (*i == '\\')
+  EscapedInput += "";
+else if (*i == '"')
+  EscapedInput += "\\\"";
+// bell
+else if (*i == 0x07)
+  EscapedInput += "\\a";
+// backspace
+else if (*i == 0x08)
+  EscapedInput += "\\b";
+// hoz tab
+else if (*i == 0x09)
+  EscapedInput += "\\t";
+// new line
+else if (*i == 0x0A)
+  EscapedInput += "\\n";
+// form feed
+else if (*i == 0x0C)
+  EscapedInput += "\\f";
+// carr return
+else if (*i == 0x0D)
+  EscapedInput += "\\r";
+else if ((unsigned char)*i < 0x20) { // Control characters not handled above.
+  std::string HexStr = llvm::utohexstr(*i);
+  EscapedInput += "\\u" + std::string(4 - HexStr.size(), '0') + HexStr;
+}
+else
+  EscapedInput.push_back(*i);
+  }
+  return EscapedInput;
+}
+
 URI URI::fromUri(llvm::StringRef uri) {
   URI Result;
   Result.uri = uri;
@@ -230,7 +266,7 @@
   std::string Result;
   llvm::raw_string_ostream(Result) << llvm::format(
   R"({"range": %s, "newText": "%s"})", Range::unparse(P.range).c_str(),
-  llvm::yaml::escape(P.newText).c_str());
+  jsonEscape(P.newText).c_str());
   return Result;
 }
 
@@ -670,20 +706,20 @@
   std::string Result = "{";
   llvm::raw_string_ostream Os(Result);
   assert(!CI.label.empty() && "completion item label is required");
-  Os << R"("label":")" << llvm::yaml::escape(CI.label) << R"(",)";
+  Os << R"("label":")" << jsonEscape(CI.label) << R"(",)";
   if (CI.kind != CompletionItemKind::Missing)
 Os << R"("kind":)" << static_cast(CI.kind) << R"(,)";
   if (!CI.detail.empty())
-Os << R"("detail":")" << llvm::yaml::escape(CI.detail) << R"(",)";
+Os << R"("detail":")" << jsonEscape(CI.detail) << R"(",)";
   if (!CI.documentation.empty())
-Os << R"("documentation":")" << llvm::yaml::escape(CI.documentation)
+Os << R"("documentation":")" << jsonEscape(CI.documentation)
<< R"(",)";
   if (!CI.

[PATCH] D31992: [clangd] Escape only necessary characters in JSON output

2017-04-16 Thread Joerg Sonnenberger via Phabricator via cfe-commits
joerg added a comment.

The short version is perfectly fine as long as works for both JSON and YAML. 
Less output is always good :)


https://reviews.llvm.org/D31992



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


[PATCH] D31992: [clangd] Escape only necessary characters in JSON output

2017-04-16 Thread Marc-Andre Laperle via Phabricator via cfe-commits
malaperle-ericsson added a comment.

Once the use of "two characters representation" is clarified, I will update the 
patch again.


https://reviews.llvm.org/D31992



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


[PATCH] D31887: [clangd] Add documentation page

2017-04-16 Thread Marc-Andre Laperle via Phabricator via cfe-commits
malaperle-ericsson updated this revision to Diff 95416.
malaperle-ericsson removed a subscriber: Sarcasm.
malaperle-ericsson added a comment.

Update with comments (extra backticks, etc)


https://reviews.llvm.org/D31887

Files:
  docs/clangd.rst
  docs/index.rst

Index: docs/index.rst
===
--- docs/index.rst
+++ docs/index.rst
@@ -25,6 +25,7 @@
modularize
pp-trace
clang-rename
+   clangd
 
 
 Doxygen Documentation
Index: docs/clangd.rst
===
--- /dev/null
+++ docs/clangd.rst
@@ -0,0 +1,106 @@
+
+Clangd
+
+
+.. contents::
+
+.. toctree::
+   :maxdepth: 1
+
+:program:`Clangd` is an implementation of the `Language Server Protocol
+`_ leveraging Clang.
+Clangd's goal is to provide language "smartness" features like code completion,
+find references, etc. for clients such as C/C++ Editors.
+
+Using Clangd
+==
+
+:program:`Clangd` is not meant to be used by C/C++ developers directly but
+rather from a client implementing the protocol. A client would be typically
+implemented in an IDE or an editor.
+
+At the moment, `Visual Studio Code `_ is mainly
+used in order to test :program:`Clangd` but more clients are likely to make
+use of :program:`Clangd` in the future as it matures and becomes a production
+quality tool. If you are interested in trying :program:`Clangd` in combination
+with Visual Studio Code, you can start by `building Clangd`_, then open Visual
+Studio Code in the clangd-vscode folder and launch the extension.
+
+Building Clangd
+==
+
+You can follow the instructions for `building Clang
+`_ but "extra Clang tools" is **not**
+optional.
+
+Current Status
+==
+
+Many features could be implemented in :program:`Clangd`.
+Here is a list of features that could be useful with the status of whether or
+not they are already implemented in :program:`Clangd` and specified in the
+Language Server Protocol. Note that for some of the features, it is not clear
+whether or not they should be part of the Language Server Protocol, so those
+features might be eventually developed outside :program:`Clangd`.
+
++-++--+
+| C/C++ Editor feature|  LSP   |  Clangd  |
++=++==+
+| Formatting  | Yes|   Yes|
++-++--+
+| Completion  | Yes|   Yes|
++-++--+
+| Diagnostics | Yes|   Yes|
++-++--+ 
+| Fix-its | Yes|   Yes|
++-++--+
+| Go to Definition| Yes|   No |
++-++--+
+| Source hover| Yes|   No |
++-++--+
+| Signature Help  | Yes|   No |
++-++--+
+| Find References | Yes|   No |
++-++--+
+| Document Highlights | Yes|   No |
++-++--+
+| Rename  | Yes|   No |
++-++--+
+| Code Lens   | Yes|   No |
++-++--+
+| Syntax and Semantic Coloring| No |   No |
++-++--+
+| Code folding| No |   No |
++-++--+
+| Call hierarchy  | No |   No |
++-++--+
+| Type hierarchy  | No |   No |
++-++--+
+| Organize Includes   | No |   No |
++-++--+
+| Quick Assist| No |   No |
++-++--+
+| Extract Local Variable  | No |   No |
++-++--+
+| Extract Function/Method | No |   No |
++

[PATCH] D31992: [clangd] Escape only necessary characters in JSON output

2017-04-16 Thread Joerg Sonnenberger via Phabricator via cfe-commits
joerg added a comment.

Just to avoid any confusion: this should be the generic YAML escape routine in 
llvm/lib/Support, i.e. IMO we don't want to have separate YAML and JSON escape 
routines.
Effective, change YAMLParser.cpp line 697 to use \u and drop the whole UTF-8 
handling part.


https://reviews.llvm.org/D31992



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


[PATCH] D31992: [clangd] Escape only necessary characters in JSON output

2017-04-16 Thread Marc-Andre Laperle via Phabricator via cfe-commits
malaperle-ericsson added a comment.

In https://reviews.llvm.org/D31992#728036, @joerg wrote:

> Just to avoid any confusion: this should be the generic YAML escape routine 
> in llvm/lib/Support, i.e. IMO we don't want to have separate YAML and JSON 
> escape routines.
>  Effective, change YAMLParser.cpp line 697 to use \u and drop the whole UTF-8 
> handling part.


I'm not sure it's possible or desirable to reuse yaml::escape as they are two 
formats and it's expected that a yaml output might not be able to be read by a 
json parser. If I look at the yaml::escape routine, there are several escape 
that are incompatible with JSON like \0, \v, \e, and 32-bit handling via \U.
I think ideally this patch would be a stop-gap solution until jsoncpp is 
introduced so that one can build json output in a structured way (as opposed to 
manually appending strings now) and the output will also be escape via the 
library.


https://reviews.llvm.org/D31992



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


[PATCH] D31992: [clangd] Escape only necessary characters in JSON output

2017-04-16 Thread Joerg Sonnenberger via Phabricator via cfe-commits
joerg added a comment.

We already have a couple of case that expect the encoding to be compatible. I'm 
not very attached to the additional special cases from YAML, but having either 
a common escape function OR a JSON escape in LLVM/Support is quite important.


https://reviews.llvm.org/D31992



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


[PATCH] D31584: [coroutines] Add support for allocation elision

2017-04-16 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov added a comment.

It is a simple change. If there is no objections, I'll commit it tomorrow.


https://reviews.llvm.org/D31584



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


[PATCH] D32113: Add path from clang to doxygen document include header

2017-04-16 Thread Yuka Takahashi via Phabricator via cfe-commits
yamaguchi added a comment.

Doxygen couldn't handle @abs_srcsdir@/../ , so I changed it to @abs_arcdir@/.. 
in Diff 95410, then it worked OK.
Document will now show the path of #include "include/clang/Sema/Sema.h" .


https://reviews.llvm.org/D32113



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


[PATCH] D31976: Avoid assert when a non-static member function is qualified with __unaligned

2017-04-16 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added inline comments.



Comment at: test/CodeGenCXX/unaligned-duplicated-mangle-name.cpp:15
+
+void A::foo() // expected-error {{definition with same mangled name as another 
definition}}
+  // expected-note@-6 {{previous definition is here}}

Do you know why clang doesn't error out until it reaches IRGen when compiling 
this test? I found it interesting that Sema detects the redeclaration and 
errors out when the function is marked "restrict", but doesn't do so when it's 
marked "unaligned".


https://reviews.llvm.org/D31976



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


[PATCH] D31972: Do not force the frame pointer by default for ARM EABI

2017-04-16 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added a comment.

Can you add a test case?


https://reviews.llvm.org/D31972



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


[PATCH] D29827: [AVR] Add -mmcu option to the driver

2017-04-16 Thread Leslie Zhai via Phabricator via cfe-commits
xiangzhai added a comment.

ping :)


https://reviews.llvm.org/D29827



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


[PATCH] D27651: [clang-format] Even with AlignConsecutiveDeclarations, PointerAlignment: Right should keep *s and &s to the right

2017-04-16 Thread Daniel Jasper via Phabricator via cfe-commits
djasper added inline comments.



Comment at: lib/Format/WhitespaceManager.cpp:255
+// If PointerAlignment is PAS_Right, keep *s or &s next to the token
+if (Style.PointerAlignment == FormatStyle::PAS_Right &&
+Changes[i].Spaces != 0) {

This needs to be implemented in the Matches function that is passed in. This 
function is by now used to align many different things and special casing a 
case of variable declaration alignment here can easily have unforeseen 
consequences.



Comment at: unittests/Format/FormatTest.cpp:7878
+"  int const i   = 1;\n"
+"  int **j   = 2, ***k;\n"
+"  int  &k   = i;\n"

This looks wrong to me. Wouldn't you want to align on the */& then? I.e.:

  int const i   = 1;
  int   **j = 2, ***k;
  int   &k  = i;


https://reviews.llvm.org/D27651



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