Will post shortly another patch that relies on comparing ObjCCategoryDecl.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
This make sense to me at a first pass, please make sure you run check-lldb as well.
clang/lib/AST/ASTStructuralEquivalence.cpp | ||
---|---|---|
1979 | I am curious what case are we catching here? Does NumArgs ever have the value 1? |
Hi Volodymyr,
Unfortunately, I'm not familiar with Objective-C and its frontend but I have a question.
clang/lib/AST/ASTStructuralEquivalence.cpp | ||
---|---|---|
1997 | Should we check if the parameter count is different? |
Thanks for the reviews! I'm going to address the comments, check-lldb, check tests failing on Debian.
clang/lib/AST/ASTStructuralEquivalence.cpp | ||
---|---|---|
1979 | Here I'm trying to handle the case with argument-less methods. For example, -(void)test; has 0 arguments but we still want to compare the first slot. At the moment I don't know how to clarify the code to make the intention clearer. Can add a comment explaining the intention (though there is a test that should catch breaking code accidentally). And to answer your question, NumArgs can have value 1. | |
1997 | Mismatch in the number of parameters should be caught by NumArgs != Selector2.getNumArgs() earlier. But I think it makes sense to add an assertion verifying param_size is equal at this point. |
clang/lib/AST/ASTStructuralEquivalence.cpp | ||
---|---|---|
1248 | By the way, the alternative to introducing parameter Owner2Type was to use ...Owner2 = cast<TypeDecl>(...). But that would work only for ObjCInterfaceDecl and would require making ObjCInterfaceDecl TypeDecl. Conceptually, it makes sense for ObjCInterfaceDecl to be TypeDecl as @interface does represent a type. But I've decided that such invasive change is not justified. |
check-lldb has the following tests failing
lldb-shell :: Expr/TestIRMemoryMap.test lldb-shell :: Process/TestEnvironment.test lldb-shell :: Register/x86-64-gp-read.test lldb-shell :: Register/x86-64-read.test lldb-shell :: Register/x86-64-ymm-read.test lldb-shell :: Register/x86-multithread-read.test lldb-shell :: Register/x86-multithread-write.test
All of them look irrelevant as they are failing with various "file not found" errors, e.g., cstdlib, cstdint, cinttypes. I guess my local toolchain configuration differs from LLDB expectations.
clang/lib/AST/ASTStructuralEquivalence.cpp | ||
---|---|---|
1979 | Added a comment. | |
1997 | Added an assertion for param_size (not triggered during running the test suite). |
Basically, this looks good to me. But my confidence with ObjC is low, so, I'd like @shafik as well to approve.
Besides, seems like the pre-merge check fails with the new tests on Debian, could you please address that?
Fix tests on Debian by using -fobjc-nonfragile-abi explicitly as declaring ivars in extensions is supported only with non-fragile ABI.
Thanks for the review! My confidence with the structural equivalence is low and I appreciate your expertise in this area.
Fixed the tests by using non-fragile ABI explicitly. The only remaining failing test is Clang :: Driver/clang_f_opts.c which is failing for unrelated reasons.
@shafik, can you please check the patch? Or maybe recommend somebody who worked both on ASTStructuralEquivalence and Objective-C part of clang?
Thanks for the review, Gabor! Now I'll work on rebasing the patch and testing one final time.
By the way, the alternative to introducing parameter Owner2Type was to use ...Owner2 = cast<TypeDecl>(...). But that would work only for ObjCInterfaceDecl and would require making ObjCInterfaceDecl TypeDecl. Conceptually, it makes sense for ObjCInterfaceDecl to be TypeDecl as @interface does represent a type. But I've decided that such invasive change is not justified.