[PATCH] D55545: Allow IncludeSorter to use #import for Objective-C files

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 13 10:06:21 PST 2018


hokein added a comment.

Please add a unittest for it, you can add it in `unittests/clang-tidy/IncludeInserterTest.cpp`.



================
Comment at: clang-tidy/utils/IncludeSorter.cpp:116
                                                           bool IsAngled) {
+  std::string IncludeDirective = LangOpts->ObjC ? "#import " : "#include ";
   std::string IncludeStmt =
----------------
What about the ObjC++? The current behavior is always using `#import`, google objc style guide says `#import Objective-C and Objective-C++ headers, and #include C/C++ headers.`, I don't think we have a way to do it smartly.

Maybe a conservative way is to use `#import ` for ObjC only?


Repository:
  rCTE Clang Tools Extra

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

https://reviews.llvm.org/D55545





More information about the cfe-commits mailing list