diff --git a/dstep/translator/HeaderIndex.d b/dstep/translator/HeaderIndex.d index ae1b2531..78ee27c7 100644 --- a/dstep/translator/HeaderIndex.d +++ b/dstep/translator/HeaderIndex.d @@ -68,6 +68,10 @@ class IncludeGraph auto pair = Inclusion(headers_[includedPath], headers_[path]); directInclusions.add(pair); + } else if (includedPath != "" && includedPath !in headers_) + { + reverse_[headers_.length] = includedPath; + headers_[includedPath] = headers_.length; } } diff --git a/tests/functional/graph/include_known.h b/tests/functional/graph/include_known.h new file mode 100644 index 00000000..339f4fc1 --- /dev/null +++ b/tests/functional/graph/include_known.h @@ -0,0 +1 @@ +#include diff --git a/tests/unit/IncludeGraphTests.d b/tests/unit/IncludeGraphTests.d index 8fcf78e5..ef37d832 100644 --- a/tests/unit/IncludeGraphTests.d +++ b/tests/unit/IncludeGraphTests.d @@ -90,3 +90,14 @@ unittest new HeaderIndex(translationUnit); } + +unittest +{ + const string file = "tests/functional/graph/subfile1.h".asAbsNormPath(); + + auto translationUnit = makeTranslationUnit( + "tests/functional/graph/include_known.h", + ["-Wno-missing-declarations", "-Itests/functional", "-include", file]); + + new HeaderIndex(translationUnit); +}