[PATCH] D123831: [POC][WIP] Use relative include in extract-api

Zixu Wang via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 25 15:39:25 PDT 2022

zixuw added inline comments.

Comment at: clang/lib/ExtractAPI/ExtractAPIConsumer.cpp:134
+        if (!SpelledFilename.empty())
+          return SpelledFilename.str();
zixuw wrote:
> One problem I can see in this right now is that there might be multiple headermaps that together construct a chain of mapping, for example
> ```
> // A.hmap
> Header.h -> Product/Header.h
> // B.hmap
> Product/Header.h -> /Absolute/path/to/Header.h
> ```
> Then this iteration would conclude on using `Product/Header.h` and missed the first mapping (if the command line goes `clang -extract-api -I A.hmap -I B.hmap ...`).
> It's also possible that a headermap and a search path together resolve the header. For example:
> ```
> //A.hmap
> Header.h -> Product/Header.h
> // Invocation:
> clang -extract-api /Some/Path/to/Product/Header.h -I A.hmap -I /Some/path/to/
> ```
> I think we need to keep records and iterate backwards on the search paths again to get the full reverse lookup
Or, iterate once in reverse and find the last match? 🤔 

  rG LLVM Github Monorepo



More information about the cfe-commits mailing list