r193648 - Changed tests_typestate to test_typestate for consistency.
Chris Wailes
chris.wailes at gmail.com
Tue Oct 29 13:28:42 PDT 2013
Author: chris.wailes
Date: Tue Oct 29 15:28:41 2013
New Revision: 193648
URL: http://llvm.org/viewvc/llvm-project?rev=193648&view=rev
Log:
Changed tests_typestate to test_typestate for consistency.
Modified:
cfe/trunk/include/clang/Basic/Attr.td
cfe/trunk/lib/Analysis/Consumed.cpp
cfe/trunk/lib/Sema/SemaDeclAttr.cpp
cfe/trunk/test/SemaCXX/warn-consumed-analysis.cpp
cfe/trunk/test/SemaCXX/warn-consumed-parsing.cpp
Modified: cfe/trunk/include/clang/Basic/Attr.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Attr.td?rev=193648&r1=193647&r2=193648&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/Attr.td (original)
+++ cfe/trunk/include/clang/Basic/Attr.td Tue Oct 29 15:28:41 2013
@@ -995,8 +995,8 @@ def SetTypestate : InheritableAttr {
["Unknown", "Consumed", "Unconsumed"]>];
}
-def TestsTypestate : InheritableAttr {
- let Spellings = [GNU<"tests_typestate">];
+def TestTypestate : InheritableAttr {
+ let Spellings = [GNU<"test_typestate">];
let Subjects = [CXXMethod];
let Args = [EnumArgument<"TestState", "ConsumedState",
["consumed", "unconsumed"],
Modified: cfe/trunk/lib/Analysis/Consumed.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/Consumed.cpp?rev=193648&r1=193647&r2=193648&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/Consumed.cpp (original)
+++ cfe/trunk/lib/Analysis/Consumed.cpp Tue Oct 29 15:28:41 2013
@@ -167,7 +167,7 @@ static bool isRValueRefish(QualType Para
}
static bool isTestingFunction(const FunctionDecl *FunDecl) {
- return FunDecl->hasAttr<TestsTypestateAttr>();
+ return FunDecl->hasAttr<TestTypestateAttr>();
}
static bool isValueType(QualType ParamType) {
@@ -248,10 +248,10 @@ static StringRef stateToString(ConsumedS
static ConsumedState testsFor(const FunctionDecl *FunDecl) {
assert(isTestingFunction(FunDecl));
- switch (FunDecl->getAttr<TestsTypestateAttr>()->getTestState()) {
- case TestsTypestateAttr::Unconsumed:
+ switch (FunDecl->getAttr<TestTypestateAttr>()->getTestState()) {
+ case TestTypestateAttr::Unconsumed:
return CS_Unconsumed;
- case TestsTypestateAttr::Consumed:
+ case TestTypestateAttr::Consumed:
return CS_Consumed;
}
llvm_unreachable("invalid enum");
Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=193648&r1=193647&r2=193648&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Tue Oct 29 15:28:41 2013
@@ -1202,8 +1202,8 @@ static void handleSetTypestateAttr(Sema
Attr.getAttributeSpellingListIndex()));
}
-static void handleTestsTypestateAttr(Sema &S, Decl *D,
- const AttributeList &Attr) {
+static void handleTestTypestateAttr(Sema &S, Decl *D,
+ const AttributeList &Attr) {
if (!checkAttributeNumArgs(S, Attr, 1))
return;
@@ -1216,11 +1216,11 @@ static void handleTestsTypestateAttr(Sem
if (!checkForConsumableClass(S, cast<CXXMethodDecl>(D), Attr))
return;
- TestsTypestateAttr::ConsumedState TestState;
+ TestTypestateAttr::ConsumedState TestState;
if (Attr.isArgIdent(0)) {
IdentifierLoc *Ident = Attr.getArgAsIdent(0);
StringRef Param = Ident->Ident->getName();
- if (!TestsTypestateAttr::ConvertStrToConsumedState(Param, TestState)) {
+ if (!TestTypestateAttr::ConvertStrToConsumedState(Param, TestState)) {
S.Diag(Ident->Loc, diag::warn_attribute_type_not_supported)
<< Attr.getName() << Param;
return;
@@ -1232,7 +1232,7 @@ static void handleTestsTypestateAttr(Sem
}
D->addAttr(::new (S.Context)
- TestsTypestateAttr(Attr.getRange(), S.Context, TestState,
+ TestTypestateAttr(Attr.getRange(), S.Context, TestState,
Attr.getAttributeSpellingListIndex()));
}
@@ -4878,8 +4878,8 @@ static void ProcessDeclAttribute(Sema &S
case AttributeList::AT_SetTypestate:
handleSetTypestateAttr(S, D, Attr);
break;
- case AttributeList::AT_TestsTypestate:
- handleTestsTypestateAttr(S, D, Attr);
+ case AttributeList::AT_TestTypestate:
+ handleTestTypestateAttr(S, D, Attr);
break;
// Type safety attributes.
Modified: cfe/trunk/test/SemaCXX/warn-consumed-analysis.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/warn-consumed-analysis.cpp?rev=193648&r1=193647&r2=193648&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/warn-consumed-analysis.cpp (original)
+++ cfe/trunk/test/SemaCXX/warn-consumed-analysis.cpp Tue Oct 29 15:28:41 2013
@@ -7,7 +7,7 @@
#define PARAM_TYPESTATE(state) __attribute__ ((param_typestate(state)))
#define RETURN_TYPESTATE(state) __attribute__ ((return_typestate(state)))
#define SET_TYPESTATE(state) __attribute__ ((set_typestate(state)))
-#define TESTS_TYPESTATE(state) __attribute__ ((tests_typestate(state)))
+#define TEST_TYPESTATE(state) __attribute__ ((test_typestate(state)))
typedef decltype(nullptr) nullptr_t;
@@ -37,10 +37,10 @@ public:
void unconsumedCall() const CALLABLE_WHEN("unconsumed");
void callableWhenUnknown() const CALLABLE_WHEN("unconsumed", "unknown");
- bool isValid() const TESTS_TYPESTATE(unconsumed);
- operator bool() const TESTS_TYPESTATE(unconsumed);
- bool operator!=(nullptr_t) const TESTS_TYPESTATE(unconsumed);
- bool operator==(nullptr_t) const TESTS_TYPESTATE(consumed);
+ bool isValid() const TEST_TYPESTATE(unconsumed);
+ operator bool() const TEST_TYPESTATE(unconsumed);
+ bool operator!=(nullptr_t) const TEST_TYPESTATE(unconsumed);
+ bool operator==(nullptr_t) const TEST_TYPESTATE(consumed);
void constCall() const;
void nonconstCall();
Modified: cfe/trunk/test/SemaCXX/warn-consumed-parsing.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/warn-consumed-parsing.cpp?rev=193648&r1=193647&r2=193648&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/warn-consumed-parsing.cpp (original)
+++ cfe/trunk/test/SemaCXX/warn-consumed-parsing.cpp Tue Oct 29 15:28:41 2013
@@ -4,7 +4,7 @@
#define CONSUMABLE(state) __attribute__ ((consumable(state)))
#define SET_TYPESTATE(state) __attribute__ ((set_typestate(state)))
#define RETURN_TYPESTATE(state) __attribute__ ((return_typestate(state)))
-#define TESTS_TYPESTATE(state) __attribute__ ((tests_typestate(state)))
+#define TEST_TYPESTATE(state) __attribute__ ((test_typestate(state)))
// FIXME: This test is here because the warning is issued by the Consumed
// analysis, not SemaDeclAttr. The analysis won't run after an error
@@ -17,28 +17,28 @@ int returnTypestateForUnconsumable() {
}
class AttrTester0 {
- void consumes() __attribute__ ((set_typestate())); // expected-error {{attribute takes one argument}}
- bool testsUnconsumed() __attribute__ ((tests_typestate())); // expected-error {{attribute takes one argument}}
- void callableWhen() __attribute__ ((callable_when())); // expected-error {{attribute takes at least 1 argument}}
+ void consumes() __attribute__ ((set_typestate())); // expected-error {{attribute takes one argument}}
+ bool testUnconsumed() __attribute__ ((test_typestate())); // expected-error {{attribute takes one argument}}
+ void callableWhen() __attribute__ ((callable_when())); // expected-error {{attribute takes at least 1 argument}}
};
int var0 SET_TYPESTATE(consumed); // expected-warning {{'set_typestate' attribute only applies to methods}}
-int var1 TESTS_TYPESTATE(consumed); // expected-warning {{'tests_typestate' attribute only applies to methods}}
+int var1 TEST_TYPESTATE(consumed); // expected-warning {{'test_typestate' attribute only applies to methods}}
int var2 CALLABLE_WHEN("consumed"); // expected-warning {{'callable_when' attribute only applies to methods}}
int var3 CONSUMABLE(consumed); // expected-warning {{'consumable' attribute only applies to classes}}
int var4 RETURN_TYPESTATE(consumed); // expected-warning {{'return_typestate' attribute only applies to functions}}
void function0() SET_TYPESTATE(consumed); // expected-warning {{'set_typestate' attribute only applies to methods}}
-void function1() TESTS_TYPESTATE(consumed); // expected-warning {{'tests_typestate' attribute only applies to methods}}
+void function1() TEST_TYPESTATE(consumed); // expected-warning {{'test_typestate' attribute only applies to methods}}
void function2() CALLABLE_WHEN("consumed"); // expected-warning {{'callable_when' attribute only applies to methods}}
void function3() CONSUMABLE(consumed); // expected-warning {{'consumable' attribute only applies to classes}}
class CONSUMABLE(unknown) AttrTester1 {
- void callableWhen0() CALLABLE_WHEN("unconsumed");
- void callableWhen1() CALLABLE_WHEN(42); // expected-error {{'callable_when' attribute requires a string}}
- void callableWhen2() CALLABLE_WHEN("foo"); // expected-warning {{'callable_when' attribute argument not supported: foo}}
- void consumes() SET_TYPESTATE(consumed);
- bool testsUnconsumed() TESTS_TYPESTATE(consumed);
+ void callableWhen0() CALLABLE_WHEN("unconsumed");
+ void callableWhen1() CALLABLE_WHEN(42); // expected-error {{'callable_when' attribute requires a string}}
+ void callableWhen2() CALLABLE_WHEN("foo"); // expected-warning {{'callable_when' attribute argument not supported: foo}}
+ void consumes() SET_TYPESTATE(consumed);
+ bool testUnconsumed() TEST_TYPESTATE(consumed);
};
AttrTester1 returnTypestateTester0() RETURN_TYPESTATE(not_a_state); // expected-warning {{'return_typestate' attribute argument not supported: 'not_a_state'}}
@@ -47,9 +47,9 @@ AttrTester1 returnTypestateTester1() RET
void returnTypestateTester2(AttrTester1 &Param RETURN_TYPESTATE(unconsumed));
class AttrTester2 {
- void callableWhen() CALLABLE_WHEN("unconsumed"); // expected-warning {{consumed analysis attribute is attached to member of class 'AttrTester2' which isn't marked as consumable}}
- void consumes() SET_TYPESTATE(consumed); // expected-warning {{consumed analysis attribute is attached to member of class 'AttrTester2' which isn't marked as consumable}}
- bool testsUnconsumed() TESTS_TYPESTATE(consumed); // expected-warning {{consumed analysis attribute is attached to member of class 'AttrTester2' which isn't marked as consumable}}
+ void callableWhen() CALLABLE_WHEN("unconsumed"); // expected-warning {{consumed analysis attribute is attached to member of class 'AttrTester2' which isn't marked as consumable}}
+ void consumes() SET_TYPESTATE(consumed); // expected-warning {{consumed analysis attribute is attached to member of class 'AttrTester2' which isn't marked as consumable}}
+ bool testUnconsumed() TEST_TYPESTATE(consumed); // expected-warning {{consumed analysis attribute is attached to member of class 'AttrTester2' which isn't marked as consumable}}
};
class CONSUMABLE(42) AttrTester3; // expected-error {{'consumable' attribute requires an identifier}}
More information about the cfe-commits
mailing list