[clang-tools-extra] r304583 - [clang-tidy] Add `const` to operator() to fix a warning.

Kim Gräsman via cfe-commits cfe-commits at lists.llvm.org
Sat Jul 8 11:49:35 PDT 2017


This is even an error in VS2017, I've just fixed a number of instances of
this in an internal codebase.

- Kim

Den 6 juni 2017 4:32 em skrev "Alexander Kornienko via cfe-commits" <
cfe-commits at lists.llvm.org>:

> On Mon, Jun 5, 2017 at 7:11 PM, David Blaikie <dblaikie at gmail.com> wrote:
>
>> what was the warning?
>>
>
> I don't remember the exact warning text, but the idea was that a non-const
> operator() could not be called. The change is reasonable in any case: the
> operator() here has no reason to be non-const.
>
>
>>
>> On Fri, Jun 2, 2017 at 11:48 AM Alexander Kornienko via cfe-commits <
>> cfe-commits at lists.llvm.org> wrote:
>>
>>> Author: alexfh
>>> Date: Fri Jun  2 13:47:50 2017
>>> New Revision: 304583
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=304583&view=rev
>>> Log:
>>> [clang-tidy] Add `const` to operator() to fix a warning.
>>>
>>> Modified:
>>>     clang-tools-extra/trunk/clang-tidy/misc/LambdaFunctionNameCheck.h
>>>
>>> Modified: clang-tools-extra/trunk/clang-tidy/misc/LambdaFunctionNameCh
>>> eck.h
>>> URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/
>>> clang-tidy/misc/LambdaFunctionNameCheck.h?rev=304583&r1=
>>> 304582&r2=304583&view=diff
>>> ============================================================
>>> ==================
>>> --- clang-tools-extra/trunk/clang-tidy/misc/LambdaFunctionNameCheck.h
>>> (original)
>>> +++ clang-tools-extra/trunk/clang-tidy/misc/LambdaFunctionNameCheck.h
>>> Fri Jun  2 13:47:50 2017
>>> @@ -25,7 +25,7 @@ namespace misc {
>>>  class LambdaFunctionNameCheck : public ClangTidyCheck {
>>>  public:
>>>    struct SourceRangeLessThan {
>>> -    bool operator()(const SourceRange &L, const SourceRange &R) {
>>> +    bool operator()(const SourceRange &L, const SourceRange &R) const {
>>>        if (L.getBegin() == R.getBegin()) {
>>>          return L.getEnd() < R.getEnd();
>>>        }
>>>
>>>
>>> _______________________________________________
>>> cfe-commits mailing list
>>> cfe-commits at lists.llvm.org
>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>>>
>>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170708/37a8988f/attachment.html>


More information about the cfe-commits mailing list