================ @@ -970,6 +970,26 @@ ort \ EXPECT_EQ(Directives[1].Kind, cxx_export_module_decl); } +TEST(MinimizeSourceToDependencyDirectivesTest, ObjCMethodArgs) { + SmallVector<char, 128> Out; + SmallVector<dependency_directives_scan::Token, 4> Tokens; + SmallVector<Directive, 4> Directives; + + StringRef Source = R"( + @interface SomeObjcClass + - (void)func:(int)otherData + module:(int)module + import:(int)import; + @end + )"; + + ASSERT_FALSE( + minimizeSourceToDependencyDirectives(Source, Out, Tokens, Directives)); + // `module :` and `import :` not followed by an identifier are not treated as + // directive lines because they can be method argument decls. + EXPECT_EQ(Directives.size(), 2u); // 2 for the EOF tokens. ---------------- akyrtzi wrote:
This would be a bit more clear if you checked against the `Out` variable, which contains a "pretty-printed" string of the directives that were found, something like this: ``` TEST(MinimizeSourceToDependencyDirectivesTest, ObjCMethodArgs) { SmallVector<char, 128> Out; StringRef Source = R"( @interface SomeObjcClass - (void)func:(int)otherData module:(int)module import:(int)import; @end )"; ASSERT_FALSE(minimizeSourceToDependencyDirectives(Source, Out)); // `module :` and `import :` not followed by an identifier are not treated as // directive lines because they can be method argument decls. EXPECT_STREQ("", Out.data()); } ``` https://github.com/llvm/llvm-project/pull/97654 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits