Skip to content

Commit 6dd21b4

Browse files
committed
Add pre-processed header support.
This is a expanded version of #205 It adds more header file extensions.
1 parent 1e08f8e commit 6dd21b4

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

refresh.template.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ def _parse_headers_from_makefile_deps(d_file_content: str, source_path_for_sanit
173173
# For example, `d_file_content` might be: `"foo.o : foo.cc bar.h \\\n baz.hpp"`.
174174
target, dependencies = d_file_content.split(': ', 1) # Needs to handle absolute Windows paths, like C:\
175175
target = target.strip() # Remove the optional trailing space.
176-
assert target.endswith(('.o', '.obj')), "Something went wrong in makefile parsing to get headers. The target should be an object file. Output:\n" + d_file_content
176+
assert target.endswith(('.o', '.obj', '.processed')), "Something went wrong in makefile parsing to get headers. The target should be an object file. Output:\n" + d_file_content
177177
# Undo shell-like line wrapping because the newlines aren't eaten by shlex.join. Note also that it's the line wrapping is inconsistently generated across compilers and depends on the lengths of the filenames, so you can't just split on the escaped newlines.
178178
dependencies = dependencies.replace('\\\n', '')
179179
# On Windows, swap out (single) backslash path directory separators for forward slash. Shlex otherwise eats the separators...and Windows gcc intermixes backslash separators with backslash escaped spaces. For a real example of gcc run from Windows, see https://github.com/hedronvision/bazel-compile-commands-extractor/issues/81
@@ -691,8 +691,8 @@ def _get_files(compile_action):
691691
_get_files.has_logged_missing_file_error = False
692692
# Setup extensions and flags for the whole C-language family.
693693
# Clang has a list: https://github.com/llvm/llvm-project/blob/b9f3b7f89a4cb4cf541b7116d9389c73690f78fa/clang/lib/Driver/Types.cpp#L293
694-
_get_files.c_source_extensions = ('.c', '.i')
695-
_get_files.cpp_source_extensions = ('.cc', '.cpp', '.cxx', '.c++', '.C', '.CC', '.cp', '.CPP', '.C++', '.CXX', '.ii')
694+
_get_files.c_source_extensions = ('.c', '.i', '.h')
695+
_get_files.cpp_source_extensions = ('.cc', '.cpp', '.cxx', '.c++', '.C', '.CC', '.cp', '.CPP', '.C++', '.CXX', '.ii', '.hh', '.hpp', '.hxx')
696696
_get_files.objc_source_extensions = ('.m',)
697697
_get_files.objcpp_source_extensions = ('.mm', '.M')
698698
_get_files.cuda_source_extensions = ('.cu', '.cui')

0 commit comments

Comments
 (0)