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

2022-04-25 Thread Zixu Wang via Phabricator via cfe-commits
zixuw updated this revision to Diff 425083. zixuw added a comment. - Rewrite commit message for preparation - Remove shortening paths based on the current working directory: it does not work with angled includes, and unnecessary for our use - XFAIL test known_files_only_hmap.c, as it is not a val

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

2022-04-25 Thread Zixu Wang via Phabricator via cfe-commits
zixuw added inline comments. Comment at: clang/lib/ExtractAPI/ExtractAPIConsumer.cpp:134 +if (!SpelledFilename.empty()) + return SpelledFilename.str(); + zixuw wrote: > zixuw wrote: > > One problem I can see in this right now is that there might

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

2022-04-25 Thread Zixu Wang via Phabricator via cfe-commits
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 > he

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

2022-04-25 Thread Zixu Wang via Phabricator via cfe-commits
zixuw added inline comments. Comment at: clang/lib/ExtractAPI/ExtractAPIConsumer.cpp:134 +if (!SpelledFilename.empty()) + return SpelledFilename.str(); + One problem I can see in this right now is that there might be multiple headermaps that tog

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

2022-04-25 Thread Zixu Wang via Phabricator via cfe-commits
zixuw updated this revision to Diff 425017. zixuw added a comment. - Create FileManager in PrepareToExecuteAction - Use FileManager to load headermaps and reverse lookup mappings - Use FileSystem to correctly get working directory and make absolute paths Repository: rG LLVM Github Monorepo CH

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

2022-04-25 Thread Zixu Wang via Phabricator via cfe-commits
zixuw added a comment. The problem is that we are trying to shorten the input file paths in `PrepareToExecuteAction`, where the `CompilerInstance` is still primal and doesn't even have a `FileManager` that we could use. That makes it hard (if possible at all) to reverse lookup headermaps and us

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

2022-04-25 Thread Zixu Wang via Phabricator via cfe-commits
zixuw updated this revision to Diff 424959. zixuw added a comment. - Use first match in `getRelativeIncludeName` - Try to get Preprocessor and reverse lookup headermaps in `getRelativeIncludeName` - Use `getRelativeIncludeName` to check for known files in `LocationFileChecker` - Misc fixes & adju

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

2022-04-21 Thread Daniel Grumberg via Phabricator via cfe-commits
dang added a comment. In D123831#3459368 , @ributzka wrote: > In D123831#3458774 , @dang wrote: > >> In D123831#3455048 , @cishida >> wrote: >> we might not always w

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

2022-04-19 Thread Juergen Ributzka via Phabricator via cfe-commits
ributzka added a comment. In D123831#3458774 , @dang wrote: > In D123831#3455048 , @cishida wrote: > >>> we might not always want to transform an absolute path because the >>> resulting relative include name migh

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

2022-04-19 Thread Daniel Grumberg via Phabricator via cfe-commits
dang added a comment. In D123831#3455048 , @cishida wrote: >> we might not always want to transform an absolute path because the resulting >> relative include name might get remapped in a headermap, for example in test >> known_files_only_hmap.c. But ho

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

2022-04-15 Thread Cyndy Ishida via Phabricator via cfe-commits
cishida added a comment. > we might not always want to transform an absolute path because the resulting > relative include name might get remapped in a headermap, for example in test > known_files_only_hmap.c. But how does it work with modules where we need > relative includes? Is the setup in

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

2022-04-15 Thread Daniel Grumberg via Phabricator via cfe-commits
dang added inline comments. Comment at: clang/lib/ExtractAPI/ExtractAPIConsumer.cpp:65 + // Matches framework include patterns + const llvm::Regex Rule("/(.+)\\.framework/(.+)?Headers/(.+)"); + StringRef WorkingDir = CI.getFileSystemOpts().WorkingDir; This doe

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

2022-04-14 Thread Zixu Wang via Phabricator via cfe-commits
zixuw updated this revision to Diff 423011. zixuw added a comment. Add test case to demonstrate the framework case. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D123831/new/ https://reviews.llvm.org/D123831 Files: clang/lib/ExtractAPI/ExtractAPI

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

2022-04-14 Thread Zixu Wang via Phabricator via cfe-commits
zixuw added inline comments. Comment at: clang/lib/ExtractAPI/ExtractAPIConsumer.cpp:87 +Dir = DirPath; +for (auto NI = path::begin(File), NE = path::end(File), + DI = path::begin(Dir), DE = path::end(Dir); I still need to dig into this logic

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

2022-04-14 Thread Zixu Wang via Phabricator via cfe-commits
zixuw created this revision. zixuw added reviewers: ributzka, dang, cishida. Herald added a project: All. zixuw requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. Proof-of-concept patch. Needs more work. Transform input headers to relative (an