diff options
author | John McCall <rjmccall@apple.com> | 2011-05-01 03:04:29 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2011-05-01 03:04:29 +0000 |
commit | 09e2c524a18435211cfbc2fb355f91e1ac43ea89 (patch) | |
tree | 65e2de385126473689eb718007f0e6b3a6bb2f4c | |
parent | f1e4fbf3112f33ec5b7bc5c57ec148445190d0a8 (diff) |
Improve the documentation for the two ObjCDeclQualifiers so that I
stop considering whether I can compress them. :)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130633 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/clang/AST/DeclBase.h | 17 | ||||
-rw-r--r-- | include/clang/Sema/DeclSpec.h | 10 | ||||
-rw-r--r-- | lib/Sema/SemaDeclObjC.cpp | 16 |
3 files changed, 23 insertions, 20 deletions
diff --git a/include/clang/AST/DeclBase.h b/include/clang/AST/DeclBase.h index 0473d1ca1f..ce48187f3a 100644 --- a/include/clang/AST/DeclBase.h +++ b/include/clang/AST/DeclBase.h @@ -156,9 +156,20 @@ public: IDNS_NonMemberOperator = 0x0400 }; - /// ObjCDeclQualifier - Qualifier used on types in method declarations - /// for remote messaging. They are meant for the arguments though and - /// applied to the Decls (ObjCMethodDecl and ParmVarDecl). + /// ObjCDeclQualifier - 'Qualifiers' written next to the return and + /// parameter types in method declarations. Other than remembering + /// them and mangling them into the method's signature string, these + /// are ignored by the compiler; they are consumed by certain + /// remote-messaging frameworks. + /// + /// in, inout, and out are mutually exclusive and apply only to + /// method parameters. bycopy and byref are mutually exclusive and + /// apply only to method parameters (?). oneway applies only to + /// results. All of these expect their corresponding parameter to + /// have a particular type. None of this is currently enforced by + /// clang. + /// + /// This should be kept in sync with ObjCDeclSpec::ObjCDeclQualifier. enum ObjCDeclQualifier { OBJC_TQ_None = 0x0, OBJC_TQ_In = 0x1, diff --git a/include/clang/Sema/DeclSpec.h b/include/clang/Sema/DeclSpec.h index 1f67292f15..708c9b2084 100644 --- a/include/clang/Sema/DeclSpec.h +++ b/include/clang/Sema/DeclSpec.h @@ -652,7 +652,12 @@ public: /// "declaration specifiers" specific to objective-c class ObjCDeclSpec { public: - /// ObjCDeclQualifier - Qualifier used on types in method declarations + /// ObjCDeclQualifier - Qualifier used on types in method + /// declarations. Not all combinations are sensible. Parameters + /// can be one of { in, out, inout } with one of { bycopy, byref }. + /// Returns can either be { oneway } or not. + /// + /// This should be kept in sync with Decl::ObjCDeclQualifier. enum ObjCDeclQualifier { DQ_None = 0x0, DQ_In = 0x1, @@ -664,7 +669,8 @@ public: }; /// PropertyAttributeKind - list of property attributes. - enum ObjCPropertyAttributeKind { DQ_PR_noattr = 0x0, + enum ObjCPropertyAttributeKind { + DQ_PR_noattr = 0x0, DQ_PR_readonly = 0x01, DQ_PR_getter = 0x02, DQ_PR_assign = 0x04, diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp index 7429020126..0d95999287 100644 --- a/lib/Sema/SemaDeclObjC.cpp +++ b/lib/Sema/SemaDeclObjC.cpp @@ -1698,21 +1698,7 @@ void Sema::ActOnAtEnd(Scope *S, SourceRange AtEnd, /// objective-c's type qualifier from the parser version of the same info. static Decl::ObjCDeclQualifier CvtQTToAstBitMask(ObjCDeclSpec::ObjCDeclQualifier PQTVal) { - Decl::ObjCDeclQualifier ret = Decl::OBJC_TQ_None; - if (PQTVal & ObjCDeclSpec::DQ_In) - ret = (Decl::ObjCDeclQualifier)(ret | Decl::OBJC_TQ_In); - if (PQTVal & ObjCDeclSpec::DQ_Inout) - ret = (Decl::ObjCDeclQualifier)(ret | Decl::OBJC_TQ_Inout); - if (PQTVal & ObjCDeclSpec::DQ_Out) - ret = (Decl::ObjCDeclQualifier)(ret | Decl::OBJC_TQ_Out); - if (PQTVal & ObjCDeclSpec::DQ_Bycopy) - ret = (Decl::ObjCDeclQualifier)(ret | Decl::OBJC_TQ_Bycopy); - if (PQTVal & ObjCDeclSpec::DQ_Byref) - ret = (Decl::ObjCDeclQualifier)(ret | Decl::OBJC_TQ_Byref); - if (PQTVal & ObjCDeclSpec::DQ_Oneway) - ret = (Decl::ObjCDeclQualifier)(ret | Decl::OBJC_TQ_Oneway); - - return ret; + return (Decl::ObjCDeclQualifier) (unsigned) PQTVal; } static inline |