diff --git a/tools/cpplint.py b/tools/cpplint.py index 5d6172d5a4e8b1..622139efb1e2a7 100755 --- a/tools/cpplint.py +++ b/tools/cpplint.py @@ -6475,6 +6475,19 @@ def CheckItemIndentationInNamespace(filename, raw_lines_no_comments, linenum, error(filename, linenum, 'runtime/indentation_namespace', 4, 'Do not indent within a namespace') +def CheckLocalVectorUsage(filename, lines, error): + """Logs an error if std::vector> is used. + Args: + filename: The name of the current file. + lines: An array of strings, each representing a line of the file. + error: The function to call with any errors found. + """ + for linenum, line in enumerate(lines): + if (Search(r'\bstd::vector]+>>', line) or + Search(r'\bstd::vector]+>>', line)): + error(filename, linenum, 'runtime/local_vector', 5, + 'Do not use std::vector>. ' + 'Use v8::LocalVector instead.') def ProcessLine(filename, file_extension, clean_lines, line, include_state, function_state, nesting_state, error, @@ -6645,6 +6658,8 @@ def ProcessFileData(filename, file_extension, lines, error, CheckInlineHeader(filename, include_state, error) + CheckLocalVectorUsage(filename, lines, error) + def ProcessConfigOverrides(filename): """ Loads the configuration files and processes the config overrides.