Issue 122847
Summary [clang-include-cleaner] suggest to insert header in source file when header would be enough
Labels false-positive, clang-include-cleaner
Assignees
Reporter EugeneZelenko
    `clang-include-cleaner` suggest to include `cstddef` because of constructor (or may be method) implementation when it its inclusion in header should be enough.

`clang-tidy misc-include-cleaner` output:

```
clang-tidy -checks="-*,misc-include-cleaner" Method.cpp 
1 warning generated.
Method.cpp:3:18: warning: no header providing "size_t" is directly included [misc-include-cleaner]
    2 | 
    3 | Test::Test(const size_t size)
      |                  ^
```

I tried `clang-include-cleaner` from `main` (7d8b4eb0ead277f41ff69525ed807f9f6e227f37).

Header file (`Method.h`):

```
#pragma once

#include <cstddef>

class Test
{
public:
    Test(const size_t size);

protected:
    size_t size_;
};
```

Source file (`Method.cpp`):

```
#include "Method.h"

Test::Test(const size_t size)
:   size_(size)
{
}
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to