Re: [PATCH] D39360: [C++11] Don't put empty quotes in static_assert diagnostic.

2017-11-12 Thread Nicolas Lesser via cfe-commits
Agreed! Just wanted to do it but then I noticed that there's already one
that landed in r307791! :)

On Sun, Oct 29, 2017 at 2:06 PM, Kim Gräsman  wrote:

> A clang-tidy check to remove empty messages from source would be nice,
> though...
>
> - Kim
>
> Den 27 okt. 2017 10:24 fm skrev "Nicolas Lesser via Phabricator" <
> revi...@reviews.llvm.org>:
>
>> Rakete abandoned this revision.
>> Rakete added a comment.
>>
>> @kimgr Well, mostly because they bother me a bit, don't know what others
>> think though. I just thought it would be nice if they didn't appear, mainly
>> because there is no need to show empty quotes in the error message. Hmm,
>> you have a point though... Didn't think of that. Thanks +1
>>
>>
>> https://reviews.llvm.org/D39360
>>
>>
>>
>>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D39360: [C++11] Don't put empty quotes in static_assert diagnostic.

2017-10-29 Thread Kim Gräsman via cfe-commits
A clang-tidy check to remove empty messages from source would be nice,
though...

- Kim

Den 27 okt. 2017 10:24 fm skrev "Nicolas Lesser via Phabricator" <
revi...@reviews.llvm.org>:

> Rakete abandoned this revision.
> Rakete added a comment.
>
> @kimgr Well, mostly because they bother me a bit, don't know what others
> think though. I just thought it would be nice if they didn't appear, mainly
> because there is no need to show empty quotes in the error message. Hmm,
> you have a point though... Didn't think of that. Thanks +1
>
>
> https://reviews.llvm.org/D39360
>
>
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D39360: [C++11] Don't put empty quotes in static_assert diagnostic.

2017-10-27 Thread Nicolas Lesser via Phabricator via cfe-commits
Rakete abandoned this revision.
Rakete added a comment.

@kimgr Well, mostly because they bother me a bit, don't know what others think 
though. I just thought it would be nice if they didn't appear, mainly because 
there is no need to show empty quotes in the error message. Hmm, you have a 
point though... Didn't think of that. Thanks +1


https://reviews.llvm.org/D39360



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


[PATCH] D39360: [C++11] Don't put empty quotes in static_assert diagnostic.

2017-10-27 Thread Kim Gräsman via Phabricator via cfe-commits
kimgr added a comment.

Why? It seems easier to me to map back if the diagnostic mirrors the code 
as-written.


https://reviews.llvm.org/D39360



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


[PATCH] D39360: [C++11] Don't put empty quotes in static_assert diagnostic.

2017-10-26 Thread Nicolas Lesser via Phabricator via cfe-commits
Rakete created this revision.
Rakete added a project: clang.

This patch removes the empty `""` when using `static_assert(1 + 1 == 3, "");` 
in the diagnostic:

  main.cpp:1:1: error: static_assert failed
  static_assert(1 + 1 == 3, "");
  ^ ~~


https://reviews.llvm.org/D39360

Files:
  lib/Sema/SemaDeclCXX.cpp


Index: lib/Sema/SemaDeclCXX.cpp
===
--- lib/Sema/SemaDeclCXX.cpp
+++ lib/Sema/SemaDeclCXX.cpp
@@ -13319,8 +13319,9 @@
  Expr *AssertExpr,
  Expr *AssertMessageExpr,
  SourceLocation RParenLoc) {
-  StringLiteral *AssertMessage =
-  AssertMessageExpr ? cast(AssertMessageExpr) : nullptr;
+  auto *AssertMessage = cast_or_null(AssertMessageExpr);
+  if (AssertMessage && !AssertMessage->getLength())
+AssertMessage = nullptr;
 
   if (DiagnoseUnexpandedParameterPack(AssertExpr, UPPC_StaticAssertExpression))
 return nullptr;


Index: lib/Sema/SemaDeclCXX.cpp
===
--- lib/Sema/SemaDeclCXX.cpp
+++ lib/Sema/SemaDeclCXX.cpp
@@ -13319,8 +13319,9 @@
  Expr *AssertExpr,
  Expr *AssertMessageExpr,
  SourceLocation RParenLoc) {
-  StringLiteral *AssertMessage =
-  AssertMessageExpr ? cast(AssertMessageExpr) : nullptr;
+  auto *AssertMessage = cast_or_null(AssertMessageExpr);
+  if (AssertMessage && !AssertMessage->getLength())
+AssertMessage = nullptr;
 
   if (DiagnoseUnexpandedParameterPack(AssertExpr, UPPC_StaticAssertExpression))
 return nullptr;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits