aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-10-03 06:36:29 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-10-03 06:36:29 +0000
commitda92a7f91cf88f49e02050919676f7fb8e3bdff8 (patch)
treee4dec1c9b9c773d166b24bc64268d193cb7ea93f
parent951376242c076c3f62dd78bf672909fc011991db (diff)
Don't keep NumSelectorArgs in the ObjCMethodDecl, the number can be derived from the selector.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140983 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/AST/DeclObjC.h22
-rw-r--r--lib/AST/ASTImporter.cpp3
-rw-r--r--lib/AST/DeclObjC.cpp6
-rw-r--r--lib/Sema/SemaDeclObjC.cpp3
-rw-r--r--lib/Sema/SemaObjCProperty.cpp2
-rw-r--r--lib/Serialization/ASTReaderDecl.cpp4
-rw-r--r--lib/Serialization/ASTWriterDecl.cpp1
7 files changed, 11 insertions, 30 deletions
diff --git a/include/clang/AST/DeclObjC.h b/include/clang/AST/DeclObjC.h
index b9d2ba3a7b..d4ce117b30 100644
--- a/include/clang/AST/DeclObjC.h
+++ b/include/clang/AST/DeclObjC.h
@@ -137,9 +137,6 @@ private:
/// \brief Indicates whether this method has a related result type.
unsigned RelatedResultType : 1;
-
- // Number of args separated by ':' in a method declaration.
- unsigned NumSelectorArgs;
// Result type of this method.
QualType MethodDeclType;
@@ -175,15 +172,14 @@ private:
bool isImplicitlyDeclared = false,
bool isDefined = false,
ImplementationControl impControl = None,
- bool HasRelatedResultType = false,
- unsigned numSelectorArgs = 0)
+ bool HasRelatedResultType = false)
: NamedDecl(ObjCMethod, contextDecl, beginLoc, SelInfo),
DeclContext(ObjCMethod), Family(InvalidObjCMethodFamily),
IsInstance(isInstance), IsVariadic(isVariadic),
IsSynthesized(isSynthesized),
IsDefined(isDefined),
DeclImplementation(impControl), objcDeclQualifier(OBJC_TQ_None),
- RelatedResultType(HasRelatedResultType), NumSelectorArgs(numSelectorArgs),
+ RelatedResultType(HasRelatedResultType),
MethodDeclType(T), ResultTInfo(ResultTInfo),
EndLoc(endLoc), Body(0), SelfDecl(0), CmdDecl(0) {
setImplicit(isImplicitlyDeclared);
@@ -207,8 +203,7 @@ public:
bool isImplicitlyDeclared = false,
bool isDefined = false,
ImplementationControl impControl = None,
- bool HasRelatedResultType = false,
- unsigned numSelectorArgs = 0);
+ bool HasRelatedResultType = false);
virtual ObjCMethodDecl *getCanonicalDecl();
const ObjCMethodDecl *getCanonicalDecl() const {
@@ -227,11 +222,6 @@ public:
/// \brief Note whether this method has a related result type.
void SetRelatedResultType(bool RRT = true) { RelatedResultType = RRT; }
- unsigned getNumSelectorArgs() const { return NumSelectorArgs; }
- void setNumSelectorArgs(unsigned numSelectorArgs) {
- NumSelectorArgs = numSelectorArgs;
- }
-
// Location information, modeled after the Stmt API.
SourceLocation getLocStart() const { return getLocation(); }
SourceLocation getLocEnd() const { return EndLoc; }
@@ -267,13 +257,11 @@ public:
// This method returns and of the parameters which are part of the selector
// name mangling requirements.
param_iterator sel_param_end() const {
- return ParamInfo.begin() + NumSelectorArgs;
+ return ParamInfo.begin() + getSelector().getNumArgs();
}
- void setMethodParams(ASTContext &C, ParmVarDecl *const *List, unsigned Num,
- unsigned numSelectorArgs) {
+ void setMethodParams(ASTContext &C, ParmVarDecl *const *List, unsigned Num) {
ParamInfo.set(List, Num, C);
- NumSelectorArgs = numSelectorArgs;
}
// Iterator access to parameter types.
diff --git a/lib/AST/ASTImporter.cpp b/lib/AST/ASTImporter.cpp
index 55610cbc63..09151a7888 100644
--- a/lib/AST/ASTImporter.cpp
+++ b/lib/AST/ASTImporter.cpp
@@ -2955,8 +2955,7 @@ Decl *ASTNodeImporter::VisitObjCMethodDecl(ObjCMethodDecl *D) {
ToMethod->addDecl(ToParams[I]);
}
ToMethod->setMethodParams(Importer.getToContext(),
- ToParams.data(), ToParams.size(),
- ToParams.size());
+ ToParams.data(), ToParams.size());
ToMethod->setLexicalDeclContext(LexicalDC);
Importer.Imported(D, ToMethod);
diff --git a/lib/AST/DeclObjC.cpp b/lib/AST/DeclObjC.cpp
index 97f215fb7f..a461eaaeae 100644
--- a/lib/AST/DeclObjC.cpp
+++ b/lib/AST/DeclObjC.cpp
@@ -341,16 +341,14 @@ ObjCMethodDecl *ObjCMethodDecl::Create(ASTContext &C,
bool isImplicitlyDeclared,
bool isDefined,
ImplementationControl impControl,
- bool HasRelatedResultType,
- unsigned numSelectorArgs) {
+ bool HasRelatedResultType) {
return new (C) ObjCMethodDecl(beginLoc, endLoc,
SelInfo, T, ResultTInfo, contextDecl,
isInstance,
isVariadic, isSynthesized, isImplicitlyDeclared,
isDefined,
impControl,
- HasRelatedResultType,
- numSelectorArgs);
+ HasRelatedResultType);
}
/// \brief A definition will return its interface declaration.
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp
index f1a2637077..23e44748c8 100644
--- a/lib/Sema/SemaDeclObjC.cpp
+++ b/lib/Sema/SemaDeclObjC.cpp
@@ -2609,8 +2609,7 @@ Decl *Sema::ActOnMethodDeclaration(
Params.push_back(Param);
}
- ObjCMethod->setMethodParams(Context, Params.data(), Params.size(),
- Sel.getNumArgs());
+ ObjCMethod->setMethodParams(Context, Params.data(), Params.size());
ObjCMethod->setObjCDeclQualifier(
CvtQTToAstBitMask(ReturnQT.getObjCDeclQualifier()));
diff --git a/lib/Sema/SemaObjCProperty.cpp b/lib/Sema/SemaObjCProperty.cpp
index 34c7020765..655adde37e 100644
--- a/lib/Sema/SemaObjCProperty.cpp
+++ b/lib/Sema/SemaObjCProperty.cpp
@@ -1576,7 +1576,7 @@ void Sema::ProcessPropertyDecl(ObjCPropertyDecl *property,
SC_None,
SC_None,
0);
- SetterMethod->setMethodParams(Context, &Argument, 1, 1);
+ SetterMethod->setMethodParams(Context, &Argument, 1);
AddPropertyAttrs(*this, SetterMethod, property);
diff --git a/lib/Serialization/ASTReaderDecl.cpp b/lib/Serialization/ASTReaderDecl.cpp
index 1ed8a266a0..53155b118e 100644
--- a/lib/Serialization/ASTReaderDecl.cpp
+++ b/lib/Serialization/ASTReaderDecl.cpp
@@ -485,7 +485,6 @@ void ASTDeclReader::VisitObjCMethodDecl(ObjCMethodDecl *MD) {
MD->setDeclImplementation((ObjCMethodDecl::ImplementationControl)Record[Idx++]);
MD->setObjCDeclQualifier((Decl::ObjCDeclQualifier)Record[Idx++]);
MD->SetRelatedResultType(Record[Idx++]);
- MD->setNumSelectorArgs(unsigned(Record[Idx++]));
MD->setResultType(Reader.readType(F, Record, Idx));
MD->setResultTypeSourceInfo(GetTypeSourceInfo(Record, Idx));
MD->setEndLoc(ReadSourceLocation(Record, Idx));
@@ -494,8 +493,7 @@ void ASTDeclReader::VisitObjCMethodDecl(ObjCMethodDecl *MD) {
Params.reserve(NumParams);
for (unsigned I = 0; I != NumParams; ++I)
Params.push_back(ReadDeclAs<ParmVarDecl>(Record, Idx));
- MD->setMethodParams(Reader.getContext(), Params.data(), NumParams,
- NumParams);
+ MD->setMethodParams(Reader.getContext(), Params.data(), NumParams);
}
void ASTDeclReader::VisitObjCContainerDecl(ObjCContainerDecl *CD) {
diff --git a/lib/Serialization/ASTWriterDecl.cpp b/lib/Serialization/ASTWriterDecl.cpp
index 46eb53b731..77fc3f0988 100644
--- a/lib/Serialization/ASTWriterDecl.cpp
+++ b/lib/Serialization/ASTWriterDecl.cpp
@@ -407,7 +407,6 @@ void ASTDeclWriter::VisitObjCMethodDecl(ObjCMethodDecl *D) {
// FIXME: stable encoding for in/out/inout/bycopy/byref/oneway
Record.push_back(D->getObjCDeclQualifier());
Record.push_back(D->hasRelatedResultType());
- Record.push_back(D->getNumSelectorArgs());
Writer.AddTypeRef(D->getResultType(), Record);
Writer.AddTypeSourceInfo(D->getResultTypeSourceInfo(), Record);
Writer.AddSourceLocation(D->getLocEnd(), Record);