llvm/llvm-project

clang-include-cleaner - replaces chrono with bits/chrono

Open

#68,213 opened on Oct 4, 2023

View on GitHub
 (12 comments) (3 reactions) (0 assignees)C++ (10,782 forks)batch import
clang-include-cleanergood first issuehelp wanted

Repository metrics

Stars
 (26,378 stars)
PR merge metrics
 (Avg merge 1d 2h) (1,000 merged PRs in 30d)

Description

Issues found:

a)

+#include <bits/basic_string.h>
+#include <string>

b)

-#include <chrono>
+#include <bits/chrono.h>

Tested version from LLVM 17.0.2

misc-include-cleaner provide more information:

160   - DiagnosticName:  misc-include-cleaner
161     DiagnosticMessage:
162       Message:         'no header providing "std::operator""s" is directly included'
163       FilePath:        'some-file.cpp'
164       FileOffset:      982
165       Replacements:
166         - FilePath:        'some-file.cpp'
167           Offset:          52
168           Length:          0
169           ReplacementText: "#include <bits/basic_string.h>\n"

And:

304   - DiagnosticName:  misc-include-cleaner
305     DiagnosticMessage:
306       Message:         'no header providing "std::chrono::ceil" is directly included'
307       FilePath:        'some-file.cpp'
308       FileOffset:      3133
309       Replacements:
310         - FilePath:        'some-file.cpp'
311           Offset:          43
312           Length:          0
313           ReplacementText: "#include <bits/chrono.h>\n"

When <chrono> is already included.

Contributor guide