Skip to content

Commit

Permalink
iwyu
Browse files Browse the repository at this point in the history
  • Loading branch information
eggrobin committed Jan 17, 2016
1 parent 03e015c commit 0030245
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,10 @@ FIX_INCLUDES := deps/include-what-you-use/bin/fix_includes.py
IWYU_CHECK_ERROR := tee /dev/tty | test ! "`grep ' error: '`"
IWYU_TARGETS := $(wildcard */*.cpp)

no_include_bodies:
ls */*_body.hpp | awk -f generate_no_include_bodies_iwyu_mapping.awk > no_include_bodies.imp
iwyu_generate_mappings:
{ls */*_body.hpp && ls */*.generated.h} | awk -f iwyu_generate_mappings.awk > iwyu_generated_mappings.imp

%.cpp!!iwyu: no_include_bodies
%.cpp!!iwyu: iwyu_generate_mappings
$(IWYU) $(CXXFLAGS) $(subst !SLASH!,/, $*.cpp) $(IWYU_FLAGS) 2>&1 | tee $(subst !SLASH!,/, $*.iwyu) | $(IWYU_CHECK_ERROR)
$(REMOVE_BOM)
$(FIX_INCLUDES) < $(subst !SLASH!,/, $*.iwyu) | cat
Expand All @@ -179,12 +179,12 @@ iwyu: $(subst /,!SLASH!, $(addsuffix !!iwyu, $(IWYU_TARGETS)))
rm no_include_bodies.imp
rm */*.iwyu

%.cpp!!iwyu_unsafe: no_include_bodies
%.cpp!!iwyu_unsafe: iwyu_generate_mappings
$(IWYU) $(CXXFLAGS) $(subst !SLASH!,/, $*.cpp) $(IWYU_FLAGS) $(IWYU_CHECK_ALL_HPP) 2>&1 | tee $(subst !SLASH!,/, $*.iwyu) | $(IWYU_CHECK_ERROR)
$(REMOVE_BOM)
$(FIX_INCLUDES) $(IWYU_NOSAFE_HEADERS) < $(subst !SLASH!,/, $*.iwyu) | cat
$(RESTORE_BOM)

iwyu_unsafe: $(subst /,!SLASH!, $(addsuffix !!iwyu_unsafe, $(IWYU_TARGETS)))
rm no_include_bodies.imp
rm iwyu_generated_mappings.imp
rm */*.iwyu
2 changes: 1 addition & 1 deletion iwyu.imp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[
{ ref: no_include_bodies.imp },
{ ref: iwyu_generated_mappings.imp },
{ symbol: ["std::string", private, "<string>", public] },
{ include: ["<__functional_base>", private, "<functional>", public] },
{ include: ["<__tree>", private, "<map>", public] },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ BEGIN {
}
}

/^(.*)\.generated\.h/ {
body = $0
header = body
sub(/\.generated\.h$/, ".h", header)
print "{ include: [\"\\\"" body "\\\"\", private, \"\\\"" header "\\\"\", public] },"
}


END {
print "]"
}

0 comments on commit 0030245

Please sign in to comment.