You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Under the current scheme (f6a99a4), redeclaring a method in an @interface block that belongs to a different namespace produces a declaration of a method in that namespace. The only way to tell the compiler "no, I really just want to advertise to clients that I implement this method" is to move the redeclaration into a category that belongs to the namespace of the declaration. Without that, the compiler would complain that the @implementation block is lacking a definition of a method with the same name as the redeclared method, but in a different namespace:
@namespace MyNS
@interface MyObject : NSObject
- (instancetype)init;
@implementation MyObject
@end
// ^ error: definition of -[MyNS init] in namespace 'MyNS' not found
@end
This is actually kind of fragile, since it requires updating the subclasses whenever the namespaces of their superclasses change. (This might actually be an instance of a larger issue.)
It might be preferable to take the heuristic described for @implementation blocks and make it opt-in within the @interface as well. This could be done with an override keyword:
The intent to declare a method of the same name in a different namespace can be made explicit via another keyword. I can't think of a good one right now, but perhaps alongside would work (since the new method lives "alongside" the one in the other namespace):
1) Fix a specific bug when certain conversion functions are called in a program compiled as mips16 with hard float and
the program is linked as c++. There are two libraries that are reversed in the link order with gcc/g++ and clang/clang++ for
mips16 in this case and the proper stubs will then not be called. These stubs are normally handled in the Mips16HardFloat pass
but in this case we don't know at that time that we need to generate the stubs. This must all be handled later in code generation
and we have moved this functionality to MipsAsmPrinter. When linked as C (gcc or clang) the proper stubs are linked in from libc.
2) Set up the infrastructure to handle 90% of what is in the Mips16HardFloat pass in this new area of MipsAsmPrinter. This is a more
logical place to handle this and we have known for some time that we needed to move the code later and not implement it using
inline asm as we do now but it was not clear exactly where to do this and what mechanism should be used. Now it's clear to us
how to do this and this patch contains the infrastructure to move most of this to MipsAsmPrinter but the actual moving will be done
in a follow on patch. The same infrastructure is used to fix this current bug as described in #1. This change was requested by the list
during the original putback of the Mips16HardFloat pass but was not practical for us do at that time.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201426 91177308-0d34-0410-b5e6-96231b3b80d8
Under the current scheme (f6a99a4), redeclaring a method in an
@interface
block that belongs to a different namespace produces a declaration of a method in that namespace. The only way to tell the compiler "no, I really just want to advertise to clients that I implement this method" is to move the redeclaration into a category that belongs to the namespace of the declaration. Without that, the compiler would complain that the@implementation
block is lacking a definition of a method with the same name as the redeclared method, but in a different namespace:This is actually kind of fragile, since it requires updating the subclasses whenever the namespaces of their superclasses change. (This might actually be an instance of a larger issue.)
It might be preferable to take the heuristic described for
@implementation
blocks and make it opt-in within the@interface
as well. This could be done with anoverride
keyword:If the
override
is omitted, the compiler should probably warn about the ambiguity:The intent to declare a method of the same name in a different namespace can be made explicit via another keyword. I can't think of a good one right now, but perhaps
alongside
would work (since the new method lives "alongside" the one in the other namespace):The text was updated successfully, but these errors were encountered: