aboutsummaryrefslogtreecommitdiff
path: root/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2007-11-01 17:18:37 +0000
committerFariborz Jahanian <fjahanian@apple.com>2007-11-01 17:18:37 +0000
commitecb01e666665efabd2aa76a76f6080e2a78965fa (patch)
tree4937c2a7bd0d4b3e272a60d4b569bef3c3abf14d /Sema/SemaDecl.cpp
parent0496005559e9b60bbebb564c787b81f90b618614 (diff)
Remaining work to collect objective-c's type qualifiers and use them to encode
method types. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43617 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'Sema/SemaDecl.cpp')
-rw-r--r--Sema/SemaDecl.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/Sema/SemaDecl.cpp b/Sema/SemaDecl.cpp
index ee5327f0cd..437ec30930 100644
--- a/Sema/SemaDecl.cpp
+++ b/Sema/SemaDecl.cpp
@@ -1968,6 +1968,27 @@ void Sema::ActOnAddMethodsToObjcDecl(Scope* S, DeclTy *classDecl,
}
}
+/// CvtQTToAstBitMask - utility routine to produce an AST bitmask for
+/// 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;
+}
+
Sema::DeclTy *Sema::ActOnMethodDeclaration(
SourceLocation MethodLoc, SourceLocation EndLoc,
tok::TokenKind MethodType, ObjcDeclSpec &ReturnQT, TypeTy *ReturnType,
@@ -1988,6 +2009,8 @@ Sema::DeclTy *Sema::ActOnMethodDeclaration(
argType = Context.getObjcIdType();
ParmVarDecl* Param = new ParmVarDecl(SourceLocation(/*FIXME*/), ArgNames[i],
argType, VarDecl::None, 0);
+ Param->setObjcDeclQualifier(
+ CvtQTToAstBitMask(ArgQT[i].getObjcDeclQualifier()));
Params.push_back(Param);
}
QualType resultDeclType;
@@ -2004,6 +2027,8 @@ Sema::DeclTy *Sema::ActOnMethodDeclaration(
ObjcMethodDecl::Optional :
ObjcMethodDecl::Required);
ObjcMethod->setMethodParams(&Params[0], Sel.getNumArgs());
+ ObjcMethod->setObjcDeclQualifier(
+ CvtQTToAstBitMask(ReturnQT.getObjcDeclQualifier()));
return ObjcMethod;
}