r212496 - ASTContext: Factor 'getObjCEncodingForPropertyType' as its own method.
Joe Groff
arcata at gmail.com
Mon Jul 7 15:25:15 PDT 2014
Author: joe
Date: Mon Jul 7 17:25:15 2014
New Revision: 212496
URL: http://llvm.org/viewvc/llvm-project?rev=212496&view=rev
Log:
ASTContext: Factor 'getObjCEncodingForPropertyType' as its own method.
It is useful to get the property encoding for an ObjC type without a full
ObjCPropertyDecl.
Modified:
cfe/trunk/include/clang/AST/ASTContext.h
cfe/trunk/lib/AST/ASTContext.cpp
Modified: cfe/trunk/include/clang/AST/ASTContext.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTContext.h?rev=212496&r1=212495&r2=212496&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/ASTContext.h (original)
+++ cfe/trunk/include/clang/AST/ASTContext.h Mon Jul 7 17:25:15 2014
@@ -1373,6 +1373,10 @@ public:
void getObjCEncodingForType(QualType T, std::string &S,
const FieldDecl *Field=nullptr) const;
+ /// \brief Emit the Objective-C property type encoding for the given
+ /// type \p T into \p S.
+ void getObjCEncodingForPropertyType(QualType T, std::string &S) const;
+
void getLegacyIntegralTypeEncoding(QualType &t) const;
/// \brief Put the string version of the type qualifiers \p QT into \p S.
Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=212496&r1=212495&r2=212496&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Mon Jul 7 17:25:15 2014
@@ -5022,9 +5022,7 @@ void ASTContext::getObjCEncodingForPrope
// Encode result type.
// GCC has some special rules regarding encoding of properties which
// closely resembles encoding of ivars.
- getObjCEncodingForTypeImpl(PD->getType(), S, true, true, nullptr,
- true /* outermost type */,
- true /* encoding for property */);
+ getObjCEncodingForPropertyType(PD->getType(), S);
if (PD->isReadOnly()) {
S += ",R";
@@ -5097,6 +5095,16 @@ void ASTContext::getObjCEncodingForType(
true /* outermost type */);
}
+void ASTContext::getObjCEncodingForPropertyType(QualType T,
+ std::string& S) const {
+ // Encode result type.
+ // GCC has some special rules regarding encoding of properties which
+ // closely resembles encoding of ivars.
+ getObjCEncodingForTypeImpl(T, S, true, true, nullptr,
+ true /* outermost type */,
+ true /* encoding property */);
+}
+
static char getObjCEncodingForPrimitiveKind(const ASTContext *C,
BuiltinType::Kind kind) {
switch (kind) {
More information about the cfe-commits
mailing list