[all-commits] [llvm/llvm-project] e421a7: [ASTImporter] Fix import of ObjCPropertyDecl that ...
Raphael Isemann via All-commits
all-commits at lists.llvm.org
Mon Mar 22 10:06:48 PDT 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: e421a74108ee86afec133c77258470d3ed7dcc90
https://github.com/llvm/llvm-project/commit/e421a74108ee86afec133c77258470d3ed7dcc90
Author: Raphael Isemann <teemperor at gmail.com>
Date: 2021-03-22 (Mon, 22 Mar 2021)
Changed paths:
M clang/lib/AST/ASTImporter.cpp
M clang/unittests/AST/ASTImporterTest.cpp
Log Message:
-----------
[ASTImporter] Fix import of ObjCPropertyDecl that share the same name
Objective-C apparently allows name conflicts between instance and class
properties, so this is valid code:
```
@protocol DupProp
@property (class, readonly) int prop;
@property (readonly) int prop;
@end
```
The ASTImporter however isn't aware of this and will consider the two properties
as if they are the same property because it just compares their name and types.
This causes that when importing both properties we only end up with one property
(whatever is imported first from what I can see).
Beside generating a different AST this also leads to a bunch of asserts and
crashes as we still correctly import the two different getters for both
properties (the import code for methods does the correct check where it
differentiated between instance and class methods). As one of the setters will
not have its associated ObjCPropertyDecl imported, any call to
`ObjCMethodDecl::findPropertyDecl` will just lead to an assert or crash.
Fixes rdar://74322659
Reviewed By: shafik, kastiglione
Differential Revision: https://reviews.llvm.org/D99077
More information about the All-commits
mailing list