[PATCH] D128677: [clang][Tooling] Add support for generating #import edits

David Goldman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 6 07:21:14 PST 2022


dgoldman added inline comments.


================
Comment at: clang/unittests/Tooling/HeaderIncludesTest.cpp:65
 
+TEST_F(HeaderIncludesTest, InsertImportWithSameInclude) {
+  std::string Code = "#include \"a.h\"\n";
----------------
kadircet wrote:
> can you also add a removal test?
> 
> i know we didn't change the implementation, but today there's nothing checking the behaviour. so explicitly encoding the expectation here, especially for the case where we have both #include and #import with same spelling is useful. btw is it likely that `#include "foo.h"` and `#import "foo.h"` can refer to different physical headers (e.g. due to framework handling and whatnot)?
> 
> we're not changing the behaviour today, but if there's a difference, this is likely a bug (that already exists), so we should leave a fixme (or address it here if you got time, by introducing a IncludeDirective parameter into remove. updating users is likely harder in this case, as everyone needs to propagate/store the directive during their analysis).
No, I don't think #import and #include can refer to different headers.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D128677/new/

https://reviews.llvm.org/D128677



More information about the cfe-commits mailing list