The change infers whether a source file is Objective-C using LangOpts, and if it detects Objective-C, it uses "#import" instead of "#include" for all inserted imports.
Details
Details
Diff Detail
Diff Detail
Event Timeline
Comment Actions
Please add a unittest for it, you can add it in unittests/clang-tidy/IncludeInserterTest.cpp.
clang-tidy/utils/IncludeSorter.cpp | ||
---|---|---|
116 | 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? |
clang-tidy/utils/IncludeSorter.cpp | ||
---|---|---|
116 | Yeah, came here to say this. Let's enable #import for ObjC but disable for C++ (which will include ObjC++). |
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?