Add array and atomic to IWYU in cpplint

This commit is contained in:
Mmanu Chaturvedi 2020-02-24 15:28:04 -05:00
parent e25d7f648c
commit ca8fa95ae6
2 changed files with 24 additions and 0 deletions

2
cpplint/cpplint.py vendored
View File

@ -5344,6 +5344,8 @@ def ExpectingFunctionArgs(clean_lines, linenum):
_HEADERS_CONTAINING_TEMPLATES = ( _HEADERS_CONTAINING_TEMPLATES = (
('<array>', ('array',)),
('<atomic>', ('atomic',)),
('<deque>', ('deque',)), ('<deque>', ('deque',)),
('<functional>', ('unary_function', 'binary_function', ('<functional>', ('unary_function', 'binary_function',
'plus', 'minus', 'multiplies', 'divides', 'modulus', 'plus', 'minus', 'multiplies', 'divides', 'modulus',

View File

@ -1076,6 +1076,28 @@ class CpplintTest(CpplintTestBase):
""", """,
'Add #include <utility> for swap' 'Add #include <utility> for swap'
' [build/include_what_you_use] [4]') ' [build/include_what_you_use] [4]')
self.TestIncludeWhatYouUse(
"""#include <array>
std::array<int, 10> A;
""",
'')
self.TestIncludeWhatYouUse(
"""#include <string>
std::array<int, 10> A;
""",
'Add #include <array> for array<>'
' [build/include_what_you_use] [4]')
self.TestIncludeWhatYouUse(
"""#include <atomic>
std::atomic<int> A;
""",
'')
self.TestIncludeWhatYouUse(
"""#include <string>
std::atomic<int> A;
""",
'Add #include <atomic> for atomic<>'
' [build/include_what_you_use] [4]')
# Test the UpdateIncludeState code path. # Test the UpdateIncludeState code path.
mock_header_contents = ['#include "blah/foo.h"', '#include "blah/bar.h"'] mock_header_contents = ['#include "blah/foo.h"', '#include "blah/bar.h"']