[cfe-commits] r125094 - in /cfe/trunk: include/clang/Sema/Sema.h lib/Parse/Parser.cpp lib/Sema/SemaDecl.cpp lib/Sema/SemaExprCXX.cpp test/SemaObjC/property-dot-receiver.m
Fariborz Jahanian
fjahanian at apple.com
Tue Feb 8 10:05:59 PST 2011
Author: fjahanian
Date: Tue Feb 8 12:05:59 2011
New Revision: 125094
URL: http://llvm.org/viewvc/llvm-project?rev=125094&view=rev
Log:
Support for objextive-c++ use of property-dot syntax as receiver
in liu of a class method getter.
// rdar://8962253
Modified:
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/Parse/Parser.cpp
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Sema/SemaExprCXX.cpp
cfe/trunk/test/SemaObjC/property-dot-receiver.m
Modified: cfe/trunk/include/clang/Sema/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=125094&r1=125093&r2=125094&view=diff
==============================================================================
--- cfe/trunk/include/clang/Sema/Sema.h (original)
+++ cfe/trunk/include/clang/Sema/Sema.h Tue Feb 8 12:05:59 2011
@@ -694,6 +694,7 @@
ParsedType getTypeName(IdentifierInfo &II, SourceLocation NameLoc,
Scope *S, CXXScopeSpec *SS = 0,
bool isClassName = false,
+ bool HasTrailingDot = false,
ParsedType ObjectType = ParsedType());
TypeSpecifierType isTagName(IdentifierInfo &II, Scope *S);
bool DiagnoseUnknownTypeName(const IdentifierInfo &II,
Modified: cfe/trunk/lib/Parse/Parser.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/Parser.cpp?rev=125094&r1=125093&r2=125094&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/Parser.cpp (original)
+++ cfe/trunk/lib/Parse/Parser.cpp Tue Feb 8 12:05:59 2011
@@ -1061,7 +1061,8 @@
// Determine whether the identifier is a type name.
if (ParsedType Ty = Actions.getTypeName(*Tok.getIdentifierInfo(),
Tok.getLocation(), getCurScope(),
- &SS)) {
+ &SS, false,
+ NextToken().is(tok::period))) {
// This is a typename. Replace the current token in-place with an
// annotation type token.
Tok.setKind(tok::annot_typename);
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=125094&r1=125093&r2=125094&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Tue Feb 8 12:05:59 2011
@@ -60,7 +60,7 @@
/// and then return NULL.
ParsedType Sema::getTypeName(IdentifierInfo &II, SourceLocation NameLoc,
Scope *S, CXXScopeSpec *SS,
- bool isClassName,
+ bool isClassName, bool HasTrailingDot,
ParsedType ObjectTypePtr) {
// Determine where we will perform name lookup.
DeclContext *LookupCtx = 0;
@@ -193,13 +193,15 @@
T = getElaboratedType(ETK_None, *SS, T);
} else if (ObjCInterfaceDecl *IDecl = dyn_cast<ObjCInterfaceDecl>(IIDecl)) {
- T = Context.getObjCInterfaceType(IDecl);
- } else {
+ if (!HasTrailingDot)
+ T = Context.getObjCInterfaceType(IDecl);
+ }
+
+ if (T.isNull()) {
// If it's not plausibly a type, suppress diagnostics.
Result.suppressDiagnostics();
return ParsedType();
}
-
return ParsedType::make(T);
}
Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=125094&r1=125093&r2=125094&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Tue Feb 8 12:05:59 2011
@@ -3685,7 +3685,7 @@
if (SecondTypeName.getKind() == UnqualifiedId::IK_Identifier) {
ParsedType T = getTypeName(*SecondTypeName.Identifier,
SecondTypeName.StartLocation,
- S, &SS, true, ObjectTypePtrForLookup);
+ S, &SS, true, false, ObjectTypePtrForLookup);
if (!T &&
((SS.isSet() && !computeDeclContext(SS, false)) ||
(!SS.isSet() && ObjectType->isDependentType()))) {
@@ -3741,7 +3741,7 @@
if (FirstTypeName.getKind() == UnqualifiedId::IK_Identifier) {
ParsedType T = getTypeName(*FirstTypeName.Identifier,
FirstTypeName.StartLocation,
- S, &SS, false, ObjectTypePtrForLookup);
+ S, &SS, false, false, ObjectTypePtrForLookup);
if (!T) {
Diag(FirstTypeName.StartLocation,
diag::err_pseudo_dtor_destructor_non_type)
Modified: cfe/trunk/test/SemaObjC/property-dot-receiver.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/property-dot-receiver.m?rev=125094&r1=125093&r2=125094&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/property-dot-receiver.m (original)
+++ cfe/trunk/test/SemaObjC/property-dot-receiver.m Tue Feb 8 12:05:59 2011
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -x objective-c++ -fsyntax-only -verify %s
// rdar://8962253
@interface Singleton {
More information about the cfe-commits
mailing list