Re: [clang] ee88c0c - [NFCI] Fix unused variable/function warnings in MacroCallReconstructorTest.cpp when asserts are disabled.

2022-11-25 Thread Manuel Klimek via cfe-commits
Fixed in ca8c6156f27003ffa0e24bace2be7c25307f50a3.

On Thu, Jul 21, 2022 at 3:21 PM Manuel Klimek  wrote:

> Ping :)
>
> On Mon, Jul 18, 2022 at 1:22 PM Manuel Klimek  wrote:
>
>> Ping :)
>>
>> On Wed, Jul 13, 2022 at 11:43 AM Manuel Klimek  wrote:
>>
>>> This is a functional change, as it removes the debug output when the
>>> tokens do not match, which is important for understanding test failures.
>>>
>>> On Wed, Jul 13, 2022 at 1:47 AM Jorge Gorbe Moya via cfe-commits <
>>> cfe-commits@lists.llvm.org> wrote:
>>>

 Author: Jorge Gorbe Moya
 Date: 2022-07-12T16:46:58-07:00
 New Revision: ee88c0cf09969ba44307068797e12533b94768a6

 URL:
 https://github.com/llvm/llvm-project/commit/ee88c0cf09969ba44307068797e12533b94768a6
 DIFF:
 https://github.com/llvm/llvm-project/commit/ee88c0cf09969ba44307068797e12533b94768a6.diff

 LOG: [NFCI] Fix unused variable/function warnings in
 MacroCallReconstructorTest.cpp when asserts are disabled.

 Added:


 Modified:
 clang/unittests/Format/MacroCallReconstructorTest.cpp

 Removed:




 
 diff  --git a/clang/unittests/Format/MacroCallReconstructorTest.cpp
 b/clang/unittests/Format/MacroCallReconstructorTest.cpp
 index 2bda62aa42be..3abe0383aeae 100644
 --- a/clang/unittests/Format/MacroCallReconstructorTest.cpp
 +++ b/clang/unittests/Format/MacroCallReconstructorTest.cpp
 @@ -91,14 +91,6 @@ struct Chunk {
llvm::SmallVector Children;
  };

 -bool tokenMatches(const FormatToken *Left, const FormatToken *Right) {
 -  if (Left->getType() == Right->getType() &&
 -  Left->TokenText == Right->TokenText)
 -return true;
 -  llvm::dbgs() << Left->TokenText << " != " << Right->TokenText <<
 "\n";
 -  return false;
 -}
 -
  // Allows to produce chunks of a token list by typing the code of
 equal tokens.
  //
  // Created from a list of tokens, users call "consume" to get the next
 chunk
 @@ -110,7 +102,9 @@ struct Matcher {
Chunk consume(StringRef Tokens) {
  TokenList Result;
  for (const FormatToken *Token : uneof(Lex.lex(Tokens))) {
 -  assert(tokenMatches(*It, Token));
 +  (void)Token;  // Fix unused variable warning when asserts are
 disabled.
 +  assert((*It)->getType() == Token->getType() &&
 + (*It)->TokenText == Token->TokenText);
Result.push_back(*It);
++It;
  }



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

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


Re: [clang] ee88c0c - [NFCI] Fix unused variable/function warnings in MacroCallReconstructorTest.cpp when asserts are disabled.

2022-07-21 Thread Manuel Klimek via cfe-commits
Ping :)

On Mon, Jul 18, 2022 at 1:22 PM Manuel Klimek  wrote:

> Ping :)
>
> On Wed, Jul 13, 2022 at 11:43 AM Manuel Klimek  wrote:
>
>> This is a functional change, as it removes the debug output when the
>> tokens do not match, which is important for understanding test failures.
>>
>> On Wed, Jul 13, 2022 at 1:47 AM Jorge Gorbe Moya via cfe-commits <
>> cfe-commits@lists.llvm.org> wrote:
>>
>>>
>>> Author: Jorge Gorbe Moya
>>> Date: 2022-07-12T16:46:58-07:00
>>> New Revision: ee88c0cf09969ba44307068797e12533b94768a6
>>>
>>> URL:
>>> https://github.com/llvm/llvm-project/commit/ee88c0cf09969ba44307068797e12533b94768a6
>>> DIFF:
>>> https://github.com/llvm/llvm-project/commit/ee88c0cf09969ba44307068797e12533b94768a6.diff
>>>
>>> LOG: [NFCI] Fix unused variable/function warnings in
>>> MacroCallReconstructorTest.cpp when asserts are disabled.
>>>
>>> Added:
>>>
>>>
>>> Modified:
>>> clang/unittests/Format/MacroCallReconstructorTest.cpp
>>>
>>> Removed:
>>>
>>>
>>>
>>>
>>> 
>>> diff  --git a/clang/unittests/Format/MacroCallReconstructorTest.cpp
>>> b/clang/unittests/Format/MacroCallReconstructorTest.cpp
>>> index 2bda62aa42be..3abe0383aeae 100644
>>> --- a/clang/unittests/Format/MacroCallReconstructorTest.cpp
>>> +++ b/clang/unittests/Format/MacroCallReconstructorTest.cpp
>>> @@ -91,14 +91,6 @@ struct Chunk {
>>>llvm::SmallVector Children;
>>>  };
>>>
>>> -bool tokenMatches(const FormatToken *Left, const FormatToken *Right) {
>>> -  if (Left->getType() == Right->getType() &&
>>> -  Left->TokenText == Right->TokenText)
>>> -return true;
>>> -  llvm::dbgs() << Left->TokenText << " != " << Right->TokenText << "\n";
>>> -  return false;
>>> -}
>>> -
>>>  // Allows to produce chunks of a token list by typing the code of equal
>>> tokens.
>>>  //
>>>  // Created from a list of tokens, users call "consume" to get the next
>>> chunk
>>> @@ -110,7 +102,9 @@ struct Matcher {
>>>Chunk consume(StringRef Tokens) {
>>>  TokenList Result;
>>>  for (const FormatToken *Token : uneof(Lex.lex(Tokens))) {
>>> -  assert(tokenMatches(*It, Token));
>>> +  (void)Token;  // Fix unused variable warning when asserts are
>>> disabled.
>>> +  assert((*It)->getType() == Token->getType() &&
>>> + (*It)->TokenText == Token->TokenText);
>>>Result.push_back(*It);
>>>++It;
>>>  }
>>>
>>>
>>>
>>> ___
>>> cfe-commits mailing list
>>> cfe-commits@lists.llvm.org
>>> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>>>
>>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [clang] ee88c0c - [NFCI] Fix unused variable/function warnings in MacroCallReconstructorTest.cpp when asserts are disabled.

2022-07-18 Thread Manuel Klimek via cfe-commits
Ping :)

On Wed, Jul 13, 2022 at 11:43 AM Manuel Klimek  wrote:

> This is a functional change, as it removes the debug output when the
> tokens do not match, which is important for understanding test failures.
>
> On Wed, Jul 13, 2022 at 1:47 AM Jorge Gorbe Moya via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>>
>> Author: Jorge Gorbe Moya
>> Date: 2022-07-12T16:46:58-07:00
>> New Revision: ee88c0cf09969ba44307068797e12533b94768a6
>>
>> URL:
>> https://github.com/llvm/llvm-project/commit/ee88c0cf09969ba44307068797e12533b94768a6
>> DIFF:
>> https://github.com/llvm/llvm-project/commit/ee88c0cf09969ba44307068797e12533b94768a6.diff
>>
>> LOG: [NFCI] Fix unused variable/function warnings in
>> MacroCallReconstructorTest.cpp when asserts are disabled.
>>
>> Added:
>>
>>
>> Modified:
>> clang/unittests/Format/MacroCallReconstructorTest.cpp
>>
>> Removed:
>>
>>
>>
>>
>> 
>> diff  --git a/clang/unittests/Format/MacroCallReconstructorTest.cpp
>> b/clang/unittests/Format/MacroCallReconstructorTest.cpp
>> index 2bda62aa42be..3abe0383aeae 100644
>> --- a/clang/unittests/Format/MacroCallReconstructorTest.cpp
>> +++ b/clang/unittests/Format/MacroCallReconstructorTest.cpp
>> @@ -91,14 +91,6 @@ struct Chunk {
>>llvm::SmallVector Children;
>>  };
>>
>> -bool tokenMatches(const FormatToken *Left, const FormatToken *Right) {
>> -  if (Left->getType() == Right->getType() &&
>> -  Left->TokenText == Right->TokenText)
>> -return true;
>> -  llvm::dbgs() << Left->TokenText << " != " << Right->TokenText << "\n";
>> -  return false;
>> -}
>> -
>>  // Allows to produce chunks of a token list by typing the code of equal
>> tokens.
>>  //
>>  // Created from a list of tokens, users call "consume" to get the next
>> chunk
>> @@ -110,7 +102,9 @@ struct Matcher {
>>Chunk consume(StringRef Tokens) {
>>  TokenList Result;
>>  for (const FormatToken *Token : uneof(Lex.lex(Tokens))) {
>> -  assert(tokenMatches(*It, Token));
>> +  (void)Token;  // Fix unused variable warning when asserts are
>> disabled.
>> +  assert((*It)->getType() == Token->getType() &&
>> + (*It)->TokenText == Token->TokenText);
>>Result.push_back(*It);
>>++It;
>>  }
>>
>>
>>
>> ___
>> cfe-commits mailing list
>> cfe-commits@lists.llvm.org
>> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [clang] ee88c0c - [NFCI] Fix unused variable/function warnings in MacroCallReconstructorTest.cpp when asserts are disabled.

2022-07-13 Thread Manuel Klimek via cfe-commits
This is a functional change, as it removes the debug output when the tokens
do not match, which is important for understanding test failures.

On Wed, Jul 13, 2022 at 1:47 AM Jorge Gorbe Moya via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

>
> Author: Jorge Gorbe Moya
> Date: 2022-07-12T16:46:58-07:00
> New Revision: ee88c0cf09969ba44307068797e12533b94768a6
>
> URL:
> https://github.com/llvm/llvm-project/commit/ee88c0cf09969ba44307068797e12533b94768a6
> DIFF:
> https://github.com/llvm/llvm-project/commit/ee88c0cf09969ba44307068797e12533b94768a6.diff
>
> LOG: [NFCI] Fix unused variable/function warnings in
> MacroCallReconstructorTest.cpp when asserts are disabled.
>
> Added:
>
>
> Modified:
> clang/unittests/Format/MacroCallReconstructorTest.cpp
>
> Removed:
>
>
>
>
> 
> diff  --git a/clang/unittests/Format/MacroCallReconstructorTest.cpp
> b/clang/unittests/Format/MacroCallReconstructorTest.cpp
> index 2bda62aa42be..3abe0383aeae 100644
> --- a/clang/unittests/Format/MacroCallReconstructorTest.cpp
> +++ b/clang/unittests/Format/MacroCallReconstructorTest.cpp
> @@ -91,14 +91,6 @@ struct Chunk {
>llvm::SmallVector Children;
>  };
>
> -bool tokenMatches(const FormatToken *Left, const FormatToken *Right) {
> -  if (Left->getType() == Right->getType() &&
> -  Left->TokenText == Right->TokenText)
> -return true;
> -  llvm::dbgs() << Left->TokenText << " != " << Right->TokenText << "\n";
> -  return false;
> -}
> -
>  // Allows to produce chunks of a token list by typing the code of equal
> tokens.
>  //
>  // Created from a list of tokens, users call "consume" to get the next
> chunk
> @@ -110,7 +102,9 @@ struct Matcher {
>Chunk consume(StringRef Tokens) {
>  TokenList Result;
>  for (const FormatToken *Token : uneof(Lex.lex(Tokens))) {
> -  assert(tokenMatches(*It, Token));
> +  (void)Token;  // Fix unused variable warning when asserts are
> disabled.
> +  assert((*It)->getType() == Token->getType() &&
> + (*It)->TokenText == Token->TokenText);
>Result.push_back(*It);
>++It;
>  }
>
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] ee88c0c - [NFCI] Fix unused variable/function warnings in MacroCallReconstructorTest.cpp when asserts are disabled.

2022-07-12 Thread Jorge Gorbe Moya via cfe-commits

Author: Jorge Gorbe Moya
Date: 2022-07-12T16:46:58-07:00
New Revision: ee88c0cf09969ba44307068797e12533b94768a6

URL: 
https://github.com/llvm/llvm-project/commit/ee88c0cf09969ba44307068797e12533b94768a6
DIFF: 
https://github.com/llvm/llvm-project/commit/ee88c0cf09969ba44307068797e12533b94768a6.diff

LOG: [NFCI] Fix unused variable/function warnings in 
MacroCallReconstructorTest.cpp when asserts are disabled.

Added: 


Modified: 
clang/unittests/Format/MacroCallReconstructorTest.cpp

Removed: 




diff  --git a/clang/unittests/Format/MacroCallReconstructorTest.cpp 
b/clang/unittests/Format/MacroCallReconstructorTest.cpp
index 2bda62aa42be..3abe0383aeae 100644
--- a/clang/unittests/Format/MacroCallReconstructorTest.cpp
+++ b/clang/unittests/Format/MacroCallReconstructorTest.cpp
@@ -91,14 +91,6 @@ struct Chunk {
   llvm::SmallVector Children;
 };
 
-bool tokenMatches(const FormatToken *Left, const FormatToken *Right) {
-  if (Left->getType() == Right->getType() &&
-  Left->TokenText == Right->TokenText)
-return true;
-  llvm::dbgs() << Left->TokenText << " != " << Right->TokenText << "\n";
-  return false;
-}
-
 // Allows to produce chunks of a token list by typing the code of equal tokens.
 //
 // Created from a list of tokens, users call "consume" to get the next chunk
@@ -110,7 +102,9 @@ struct Matcher {
   Chunk consume(StringRef Tokens) {
 TokenList Result;
 for (const FormatToken *Token : uneof(Lex.lex(Tokens))) {
-  assert(tokenMatches(*It, Token));
+  (void)Token;  // Fix unused variable warning when asserts are disabled.
+  assert((*It)->getType() == Token->getType() &&
+ (*It)->TokenText == Token->TokenText);
   Result.push_back(*It);
   ++It;
 }



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