[cfe-commits] r46131 - in /cfe/trunk: AST/Decl.cpp Sema/SemaExpr.cpp include/clang/AST/DeclObjC.h
Fariborz Jahanian
fjahanian at apple.com
Thu Jan 17 09:37:26 PST 2008
Author: fjahanian
Date: Thu Jan 17 11:37:26 2008
New Revision: 46131
URL: http://llvm.org/viewvc/llvm-project?rev=46131&view=rev
Log:
Renamed getSynthesizedSelectorSize to getSynthesizedMethodSize. Compute method name
size in accordance with how rewriter synthesizes method name.
Modified:
cfe/trunk/AST/Decl.cpp
cfe/trunk/Sema/SemaExpr.cpp
cfe/trunk/include/clang/AST/DeclObjC.h
Modified: cfe/trunk/AST/Decl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/AST/Decl.cpp?rev=46131&r1=46130&r2=46131&view=diff
==============================================================================
--- cfe/trunk/AST/Decl.cpp (original)
+++ cfe/trunk/AST/Decl.cpp Thu Jan 17 11:37:26 2008
@@ -549,12 +549,19 @@
return NULL;
}
-int ObjCMethodDecl::getSynthesizedSelectorSize() const {
+/// getSynthesizedMethodSize - Compute size of synthesized method name
+/// as done be the rewrite.
+///
+unsigned ObjCMethodDecl::getSynthesizedMethodSize() const {
// syntesized method name is a concatenation of -/+[class-name selector]
// Get length of this name.
- int length = 4; // for '+' or '-', '[', space in between and ']'
- length += getSelector().getName().size(); // for selector name.
- length += strlen(getMethodContext()->getName()); // for its class name
+ unsigned length = 3; // _I_ or _C_
+ length += strlen(getClassInterface()->getName()) +1; // extra for _
+ NamedDecl *MethodContext = getMethodContext();
+ if (ObjCCategoryImplDecl *CID =
+ dyn_cast<ObjCCategoryImplDecl>(MethodContext))
+ length += strlen(CID->getName()) +1;
+ length += getSelector().getName().size(); // selector name
return length;
}
Modified: cfe/trunk/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Sema/SemaExpr.cpp?rev=46131&r1=46130&r2=46131&view=diff
==============================================================================
--- cfe/trunk/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/Sema/SemaExpr.cpp Thu Jan 17 11:37:26 2008
@@ -131,7 +131,7 @@
if (CurFunctionDecl)
Length = CurFunctionDecl->getIdentifier()->getLength();
else
- Length = CurMethodDecl->getSynthesizedSelectorSize();
+ Length = CurMethodDecl->getSynthesizedMethodSize();
llvm::APInt LengthI(32, Length + 1);
QualType ResTy = Context.CharTy.getQualifiedType(QualType::Const);
Modified: cfe/trunk/include/clang/AST/DeclObjC.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclObjC.h?rev=46131&r1=46130&r2=46131&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DeclObjC.h (original)
+++ cfe/trunk/include/clang/AST/DeclObjC.h Thu Jan 17 11:37:26 2008
@@ -116,7 +116,7 @@
ObjCInterfaceDecl *const getClassInterface() const;
Selector getSelector() const { return SelName; }
- int getSynthesizedSelectorSize() const;
+ unsigned getSynthesizedMethodSize() const;
QualType getResultType() const { return MethodDeclType; }
// Iterator access to formal parameters.
More information about the cfe-commits
mailing list