r186966 - Going back to using getName for consistency.
Aaron Ballman
aaron at aaronballman.com
Tue Jul 23 10:35:26 PDT 2013
Author: aaronballman
Date: Tue Jul 23 12:35:26 2013
New Revision: 186966
URL: http://llvm.org/viewvc/llvm-project?rev=186966&view=rev
Log:
Going back to using getName for consistency.
Modified:
cfe/trunk/lib/Sema/SemaDeclAttr.cpp
cfe/trunk/test/SemaObjC/method-sentinel-attr.m
Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=186966&r1=186965&r2=186966&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Tue Jul 23 12:35:26 2013
@@ -2580,11 +2580,6 @@ static void handleSentinelAttr(Sema &S,
return;
}
- // Normalize the attribute name, __foo__ becomes foo.
- StringRef AttrName = Attr.getName()->getName();
- if (AttrName.startswith("__") && AttrName.endswith("__"))
- AttrName = AttrName.substr(2, AttrName.size() - 4);
-
unsigned sentinel = 0;
if (Attr.getNumArgs() > 0) {
Expr *E = Attr.getArg(0);
@@ -2592,7 +2587,7 @@ static void handleSentinelAttr(Sema &S,
if (E->isTypeDependent() || E->isValueDependent() ||
!E->isIntegerConstantExpr(Idx, S.Context)) {
S.Diag(Attr.getLoc(), diag::err_attribute_argument_n_type)
- << "'" + AttrName.str() + "'" << 1 << ArgumentIntegerConstant
+ << Attr.getName() << 1 << ArgumentIntegerConstant
<< E->getSourceRange();
return;
}
@@ -2613,7 +2608,7 @@ static void handleSentinelAttr(Sema &S,
if (E->isTypeDependent() || E->isValueDependent() ||
!E->isIntegerConstantExpr(Idx, S.Context)) {
S.Diag(Attr.getLoc(), diag::err_attribute_argument_n_type)
- << "'" + AttrName.str() + "'" << 2 << ArgumentIntegerConstant
+ << Attr.getName() << 2 << ArgumentIntegerConstant
<< E->getSourceRange();
return;
}
Modified: cfe/trunk/test/SemaObjC/method-sentinel-attr.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/method-sentinel-attr.m?rev=186966&r1=186965&r2=186966&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/method-sentinel-attr.m (original)
+++ cfe/trunk/test/SemaObjC/method-sentinel-attr.m Tue Jul 23 12:35:26 2013
@@ -10,7 +10,7 @@
- (void) foo5 : (int)x, ... __attribute__ ((__sentinel__(1))); // expected-note {{method has been explicitly marked sentinel here}}
- (void) foo6 : (int)x, ... __attribute__ ((__sentinel__(5))); // expected-note {{method has been explicitly marked sentinel here}}
- (void) foo7 : (int)x, ... __attribute__ ((__sentinel__(0))); // expected-note {{method has been explicitly marked sentinel here}}
-- (void) foo8 : (int)x, ... __attribute__ ((__sentinel__("a"))); // expected-error {{'sentinel' attribute requires parameter 1 to be an integer constant}}
+- (void) foo8 : (int)x, ... __attribute__ ((__sentinel__("a"))); // expected-error {{'__sentinel__' attribute requires parameter 1 to be an integer constant}}
- (void) foo9 : (int)x, ... __attribute__ ((__sentinel__(-1))); // expected-error {{'sentinel' parameter 1 less than zero}}
- (void) foo10 : (int)x, ... __attribute__ ((__sentinel__(1,1)));
- (void) foo11 : (int)x, ... __attribute__ ((__sentinel__(1,1,3))); // expected-error {{attribute takes no more than 2 arguments}}
More information about the cfe-commits
mailing list