None of these attributes require FunctionTemplate to be explicitly listed as part of their subject definition. FunctionTemplateDecls are not what the attribute appertains to in the first place -- it attaches to the underlying FunctionDecl.

The attribute emitter was using FunctionTemplate to map the diagnostic to "functions or methods", but that isn't a particularly clear diagnostic in these cases anyway (since they do not apply to ObjC methods). Updated the attribute emitter to remove custom logic for FunctionTemplateDecl, and updated the test cases for the change in diagnostic wording.

llvm-svn: 209209
This commit is contained in:
Aaron Ballman 2014-05-20 14:10:53 +00:00
parent cf5b09b5dc
commit 981ba24156
6 changed files with 83 additions and 86 deletions

View File

@ -1262,21 +1262,21 @@ def X86ForceAlignArgPointer : InheritableAttr, TargetSpecificAttr<TargetX86> {
def NoSanitizeAddress : InheritableAttr { def NoSanitizeAddress : InheritableAttr {
let Spellings = [GCC<"no_address_safety_analysis">, let Spellings = [GCC<"no_address_safety_analysis">,
GCC<"no_sanitize_address">]; GCC<"no_sanitize_address">];
let Subjects = SubjectList<[Function, FunctionTemplate], ErrorDiag>; let Subjects = SubjectList<[Function], ErrorDiag>;
let Documentation = [NoSanitizeAddressDocs]; let Documentation = [NoSanitizeAddressDocs];
} }
// Attribute to disable ThreadSanitizer checks. // Attribute to disable ThreadSanitizer checks.
def NoSanitizeThread : InheritableAttr { def NoSanitizeThread : InheritableAttr {
let Spellings = [GNU<"no_sanitize_thread">]; let Spellings = [GNU<"no_sanitize_thread">];
let Subjects = SubjectList<[Function, FunctionTemplate], ErrorDiag>; let Subjects = SubjectList<[Function], ErrorDiag>;
let Documentation = [NoSanitizeThreadDocs]; let Documentation = [NoSanitizeThreadDocs];
} }
// Attribute to disable MemorySanitizer checks. // Attribute to disable MemorySanitizer checks.
def NoSanitizeMemory : InheritableAttr { def NoSanitizeMemory : InheritableAttr {
let Spellings = [GNU<"no_sanitize_memory">]; let Spellings = [GNU<"no_sanitize_memory">];
let Subjects = SubjectList<[Function, FunctionTemplate], ErrorDiag>; let Subjects = SubjectList<[Function], ErrorDiag>;
let Documentation = [NoSanitizeMemoryDocs]; let Documentation = [NoSanitizeMemoryDocs];
} }
@ -1331,7 +1331,7 @@ def AssertCapability : InheritableAttr {
CXX11<"clang", "assert_capability">, CXX11<"clang", "assert_capability">,
GNU<"assert_shared_capability">, GNU<"assert_shared_capability">,
CXX11<"clang", "assert_shared_capability">]; CXX11<"clang", "assert_shared_capability">];
let Subjects = SubjectList<[Function, FunctionTemplate]>; let Subjects = SubjectList<[Function]>;
let LateParsed = 1; let LateParsed = 1;
let TemplateDependent = 1; let TemplateDependent = 1;
let ParseArgumentsAsUnevaluated = 1; let ParseArgumentsAsUnevaluated = 1;
@ -1350,7 +1350,7 @@ def AcquireCapability : InheritableAttr {
CXX11<"clang", "acquire_shared_capability">, CXX11<"clang", "acquire_shared_capability">,
GNU<"exclusive_lock_function">, GNU<"exclusive_lock_function">,
GNU<"shared_lock_function">]; GNU<"shared_lock_function">];
let Subjects = SubjectList<[Function, FunctionTemplate]>; let Subjects = SubjectList<[Function]>;
let LateParsed = 1; let LateParsed = 1;
let TemplateDependent = 1; let TemplateDependent = 1;
let ParseArgumentsAsUnevaluated = 1; let ParseArgumentsAsUnevaluated = 1;
@ -1368,7 +1368,7 @@ def TryAcquireCapability : InheritableAttr {
CXX11<"clang", "try_acquire_capability">, CXX11<"clang", "try_acquire_capability">,
GNU<"try_acquire_shared_capability">, GNU<"try_acquire_shared_capability">,
CXX11<"clang", "try_acquire_shared_capability">]; CXX11<"clang", "try_acquire_shared_capability">];
let Subjects = SubjectList<[Function, FunctionTemplate], let Subjects = SubjectList<[Function],
ErrorDiag>; ErrorDiag>;
let LateParsed = 1; let LateParsed = 1;
let TemplateDependent = 1; let TemplateDependent = 1;
@ -1389,7 +1389,7 @@ def ReleaseCapability : InheritableAttr {
GNU<"release_generic_capability">, GNU<"release_generic_capability">,
CXX11<"clang", "release_generic_capability">, CXX11<"clang", "release_generic_capability">,
GNU<"unlock_function">]; GNU<"unlock_function">];
let Subjects = SubjectList<[Function, FunctionTemplate]>; let Subjects = SubjectList<[Function]>;
let LateParsed = 1; let LateParsed = 1;
let TemplateDependent = 1; let TemplateDependent = 1;
let ParseArgumentsAsUnevaluated = 1; let ParseArgumentsAsUnevaluated = 1;
@ -1417,7 +1417,7 @@ def RequiresCapability : InheritableAttr {
let TemplateDependent = 1; let TemplateDependent = 1;
let ParseArgumentsAsUnevaluated = 1; let ParseArgumentsAsUnevaluated = 1;
let DuplicatesAllowedWhileMerging = 1; let DuplicatesAllowedWhileMerging = 1;
let Subjects = SubjectList<[Function, FunctionTemplate]>; let Subjects = SubjectList<[Function]>;
let Accessors = [Accessor<"isShared", [GNU<"requires_shared_capability">, let Accessors = [Accessor<"isShared", [GNU<"requires_shared_capability">,
GNU<"shared_locks_required">, GNU<"shared_locks_required">,
CXX11<"clang","requires_shared_capability">]>]; CXX11<"clang","requires_shared_capability">]>];
@ -1426,7 +1426,7 @@ def RequiresCapability : InheritableAttr {
def NoThreadSafetyAnalysis : InheritableAttr { def NoThreadSafetyAnalysis : InheritableAttr {
let Spellings = [GNU<"no_thread_safety_analysis">]; let Spellings = [GNU<"no_thread_safety_analysis">];
let Subjects = SubjectList<[Function, FunctionTemplate]>; let Subjects = SubjectList<[Function]>;
let Documentation = [Undocumented]; let Documentation = [Undocumented];
} }
@ -1485,7 +1485,7 @@ def AssertExclusiveLock : InheritableAttr {
let TemplateDependent = 1; let TemplateDependent = 1;
let ParseArgumentsAsUnevaluated = 1; let ParseArgumentsAsUnevaluated = 1;
let DuplicatesAllowedWhileMerging = 1; let DuplicatesAllowedWhileMerging = 1;
let Subjects = SubjectList<[Function, FunctionTemplate]>; let Subjects = SubjectList<[Function]>;
let Documentation = [Undocumented]; let Documentation = [Undocumented];
} }
@ -1496,7 +1496,7 @@ def AssertSharedLock : InheritableAttr {
let TemplateDependent = 1; let TemplateDependent = 1;
let ParseArgumentsAsUnevaluated = 1; let ParseArgumentsAsUnevaluated = 1;
let DuplicatesAllowedWhileMerging = 1; let DuplicatesAllowedWhileMerging = 1;
let Subjects = SubjectList<[Function, FunctionTemplate]>; let Subjects = SubjectList<[Function]>;
let Documentation = [Undocumented]; let Documentation = [Undocumented];
} }
@ -1509,7 +1509,7 @@ def ExclusiveTrylockFunction : InheritableAttr {
let TemplateDependent = 1; let TemplateDependent = 1;
let ParseArgumentsAsUnevaluated = 1; let ParseArgumentsAsUnevaluated = 1;
let DuplicatesAllowedWhileMerging = 1; let DuplicatesAllowedWhileMerging = 1;
let Subjects = SubjectList<[Function, FunctionTemplate]>; let Subjects = SubjectList<[Function]>;
let Documentation = [Undocumented]; let Documentation = [Undocumented];
} }
@ -1522,7 +1522,7 @@ def SharedTrylockFunction : InheritableAttr {
let TemplateDependent = 1; let TemplateDependent = 1;
let ParseArgumentsAsUnevaluated = 1; let ParseArgumentsAsUnevaluated = 1;
let DuplicatesAllowedWhileMerging = 1; let DuplicatesAllowedWhileMerging = 1;
let Subjects = SubjectList<[Function, FunctionTemplate]>; let Subjects = SubjectList<[Function]>;
let Documentation = [Undocumented]; let Documentation = [Undocumented];
} }
@ -1532,7 +1532,7 @@ def LockReturned : InheritableAttr {
let LateParsed = 1; let LateParsed = 1;
let TemplateDependent = 1; let TemplateDependent = 1;
let ParseArgumentsAsUnevaluated = 1; let ParseArgumentsAsUnevaluated = 1;
let Subjects = SubjectList<[Function, FunctionTemplate]>; let Subjects = SubjectList<[Function]>;
let Documentation = [Undocumented]; let Documentation = [Undocumented];
} }
@ -1543,7 +1543,7 @@ def LocksExcluded : InheritableAttr {
let TemplateDependent = 1; let TemplateDependent = 1;
let ParseArgumentsAsUnevaluated = 1; let ParseArgumentsAsUnevaluated = 1;
let DuplicatesAllowedWhileMerging = 1; let DuplicatesAllowedWhileMerging = 1;
let Subjects = SubjectList<[Function, FunctionTemplate]>; let Subjects = SubjectList<[Function]>;
let Documentation = [Undocumented]; let Documentation = [Undocumented];
} }

View File

@ -15,23 +15,23 @@ int noanal_testfn(int y) NO_SANITIZE_ADDRESS;
int noanal_testfn(int y) { int noanal_testfn(int y) {
int x NO_SANITIZE_ADDRESS = y; // \ int x NO_SANITIZE_ADDRESS = y; // \
// expected-error {{'no_sanitize_address' attribute only applies to functions and methods}} // expected-error {{'no_sanitize_address' attribute only applies to functions}}
return x; return x;
} }
int noanal_test_var NO_SANITIZE_ADDRESS; // \ int noanal_test_var NO_SANITIZE_ADDRESS; // \
// expected-error {{'no_sanitize_address' attribute only applies to functions and methods}} // expected-error {{'no_sanitize_address' attribute only applies to functions}}
class NoanalFoo { class NoanalFoo {
private: private:
int test_field NO_SANITIZE_ADDRESS; // \ int test_field NO_SANITIZE_ADDRESS; // \
// expected-error {{'no_sanitize_address' attribute only applies to functions and methods}} // expected-error {{'no_sanitize_address' attribute only applies to functions}}
void test_method() NO_SANITIZE_ADDRESS; void test_method() NO_SANITIZE_ADDRESS;
}; };
class NO_SANITIZE_ADDRESS NoanalTestClass { // \ class NO_SANITIZE_ADDRESS NoanalTestClass { // \
// expected-error {{'no_sanitize_address' attribute only applies to functions and methods}} // expected-error {{'no_sanitize_address' attribute only applies to functions}}
}; };
void noanal_fun_params(int lvar NO_SANITIZE_ADDRESS); // \ void noanal_fun_params(int lvar NO_SANITIZE_ADDRESS); // \
// expected-error {{'no_sanitize_address' attribute only applies to functions and methods}} // expected-error {{'no_sanitize_address' attribute only applies to functions}}

View File

@ -15,23 +15,23 @@ int noanal_testfn(int y) NO_SANITIZE_MEMORY;
int noanal_testfn(int y) { int noanal_testfn(int y) {
int x NO_SANITIZE_MEMORY = y; // \ int x NO_SANITIZE_MEMORY = y; // \
// expected-error {{'no_sanitize_memory' attribute only applies to functions and methods}} // expected-error {{'no_sanitize_memory' attribute only applies to functions}}
return x; return x;
} }
int noanal_test_var NO_SANITIZE_MEMORY; // \ int noanal_test_var NO_SANITIZE_MEMORY; // \
// expected-error {{'no_sanitize_memory' attribute only applies to functions and methods}} // expected-error {{'no_sanitize_memory' attribute only applies to functions}}
class NoanalFoo { class NoanalFoo {
private: private:
int test_field NO_SANITIZE_MEMORY; // \ int test_field NO_SANITIZE_MEMORY; // \
// expected-error {{'no_sanitize_memory' attribute only applies to functions and methods}} // expected-error {{'no_sanitize_memory' attribute only applies to functions}}
void test_method() NO_SANITIZE_MEMORY; void test_method() NO_SANITIZE_MEMORY;
}; };
class NO_SANITIZE_MEMORY NoanalTestClass { // \ class NO_SANITIZE_MEMORY NoanalTestClass { // \
// expected-error {{'no_sanitize_memory' attribute only applies to functions and methods}} // expected-error {{'no_sanitize_memory' attribute only applies to functions}}
}; };
void noanal_fun_params(int lvar NO_SANITIZE_MEMORY); // \ void noanal_fun_params(int lvar NO_SANITIZE_MEMORY); // \
// expected-error {{'no_sanitize_memory' attribute only applies to functions and methods}} // expected-error {{'no_sanitize_memory' attribute only applies to functions}}

View File

@ -15,23 +15,23 @@ int noanal_testfn(int y) NO_SANITIZE_THREAD;
int noanal_testfn(int y) { int noanal_testfn(int y) {
int x NO_SANITIZE_THREAD = y; // \ int x NO_SANITIZE_THREAD = y; // \
// expected-error {{'no_sanitize_thread' attribute only applies to functions and methods}} // expected-error {{'no_sanitize_thread' attribute only applies to functions}}
return x; return x;
} }
int noanal_test_var NO_SANITIZE_THREAD; // \ int noanal_test_var NO_SANITIZE_THREAD; // \
// expected-error {{'no_sanitize_thread' attribute only applies to functions and methods}} // expected-error {{'no_sanitize_thread' attribute only applies to functions}}
class NoanalFoo { class NoanalFoo {
private: private:
int test_field NO_SANITIZE_THREAD; // \ int test_field NO_SANITIZE_THREAD; // \
// expected-error {{'no_sanitize_thread' attribute only applies to functions and methods}} // expected-error {{'no_sanitize_thread' attribute only applies to functions}}
void test_method() NO_SANITIZE_THREAD; void test_method() NO_SANITIZE_THREAD;
}; };
class NO_SANITIZE_THREAD NoanalTestClass { // \ class NO_SANITIZE_THREAD NoanalTestClass { // \
// expected-error {{'no_sanitize_thread' attribute only applies to functions and methods}} // expected-error {{'no_sanitize_thread' attribute only applies to functions}}
}; };
void noanal_fun_params(int lvar NO_SANITIZE_THREAD); // \ void noanal_fun_params(int lvar NO_SANITIZE_THREAD); // \
// expected-error {{'no_sanitize_thread' attribute only applies to functions and methods}} // expected-error {{'no_sanitize_thread' attribute only applies to functions}}

View File

@ -109,26 +109,26 @@ int noanal_testfn(int y) NO_THREAD_SAFETY_ANALYSIS;
int noanal_testfn(int y) { int noanal_testfn(int y) {
int x NO_THREAD_SAFETY_ANALYSIS = y; // \ int x NO_THREAD_SAFETY_ANALYSIS = y; // \
// expected-warning {{'no_thread_safety_analysis' attribute only applies to functions and methods}} // expected-warning {{'no_thread_safety_analysis' attribute only applies to functions}}
return x; return x;
}; };
int noanal_test_var NO_THREAD_SAFETY_ANALYSIS; // \ int noanal_test_var NO_THREAD_SAFETY_ANALYSIS; // \
// expected-warning {{'no_thread_safety_analysis' attribute only applies to functions and methods}} // expected-warning {{'no_thread_safety_analysis' attribute only applies to functions}}
class NoanalFoo { class NoanalFoo {
private: private:
int test_field NO_THREAD_SAFETY_ANALYSIS; // \ int test_field NO_THREAD_SAFETY_ANALYSIS; // \
// expected-warning {{'no_thread_safety_analysis' attribute only applies to functions and methods}} // expected-warning {{'no_thread_safety_analysis' attribute only applies to functions}}
void test_method() NO_THREAD_SAFETY_ANALYSIS; void test_method() NO_THREAD_SAFETY_ANALYSIS;
}; };
class NO_THREAD_SAFETY_ANALYSIS NoanalTestClass { // \ class NO_THREAD_SAFETY_ANALYSIS NoanalTestClass { // \
// expected-warning {{'no_thread_safety_analysis' attribute only applies to functions and methods}} // expected-warning {{'no_thread_safety_analysis' attribute only applies to functions}}
}; };
void noanal_fun_params(int lvar NO_THREAD_SAFETY_ANALYSIS); // \ void noanal_fun_params(int lvar NO_THREAD_SAFETY_ANALYSIS); // \
// expected-warning {{'no_thread_safety_analysis' attribute only applies to functions and methods}} // expected-warning {{'no_thread_safety_analysis' attribute only applies to functions}}
//-----------------------------------------// //-----------------------------------------//
@ -577,26 +577,26 @@ int elf_testfn(int y) EXCLUSIVE_LOCK_FUNCTION();
int elf_testfn(int y) { int elf_testfn(int y) {
int x EXCLUSIVE_LOCK_FUNCTION() = y; // \ int x EXCLUSIVE_LOCK_FUNCTION() = y; // \
// expected-warning {{'exclusive_lock_function' attribute only applies to functions and methods}} // expected-warning {{'exclusive_lock_function' attribute only applies to functions}}
return x; return x;
}; };
int elf_test_var EXCLUSIVE_LOCK_FUNCTION(); // \ int elf_test_var EXCLUSIVE_LOCK_FUNCTION(); // \
// expected-warning {{'exclusive_lock_function' attribute only applies to functions and methods}} // expected-warning {{'exclusive_lock_function' attribute only applies to functions}}
class ElfFoo { class ElfFoo {
private: private:
int test_field EXCLUSIVE_LOCK_FUNCTION(); // \ int test_field EXCLUSIVE_LOCK_FUNCTION(); // \
// expected-warning {{'exclusive_lock_function' attribute only applies to functions and methods}} // expected-warning {{'exclusive_lock_function' attribute only applies to functions}}
void test_method() EXCLUSIVE_LOCK_FUNCTION(); void test_method() EXCLUSIVE_LOCK_FUNCTION();
}; };
class EXCLUSIVE_LOCK_FUNCTION() ElfTestClass { // \ class EXCLUSIVE_LOCK_FUNCTION() ElfTestClass { // \
// expected-warning {{'exclusive_lock_function' attribute only applies to functions and methods}} // expected-warning {{'exclusive_lock_function' attribute only applies to functions}}
}; };
void elf_fun_params(int lvar EXCLUSIVE_LOCK_FUNCTION()); // \ void elf_fun_params(int lvar EXCLUSIVE_LOCK_FUNCTION()); // \
// expected-warning {{'exclusive_lock_function' attribute only applies to functions and methods}} // expected-warning {{'exclusive_lock_function' attribute only applies to functions}}
// Check argument parsing. // Check argument parsing.
@ -649,25 +649,25 @@ int slf_testfn(int y) SHARED_LOCK_FUNCTION();
int slf_testfn(int y) { int slf_testfn(int y) {
int x SHARED_LOCK_FUNCTION() = y; // \ int x SHARED_LOCK_FUNCTION() = y; // \
// expected-warning {{'shared_lock_function' attribute only applies to functions and methods}} // expected-warning {{'shared_lock_function' attribute only applies to functions}}
return x; return x;
}; };
int slf_test_var SHARED_LOCK_FUNCTION(); // \ int slf_test_var SHARED_LOCK_FUNCTION(); // \
// expected-warning {{'shared_lock_function' attribute only applies to functions and methods}} // expected-warning {{'shared_lock_function' attribute only applies to functions}}
void slf_fun_params(int lvar SHARED_LOCK_FUNCTION()); // \ void slf_fun_params(int lvar SHARED_LOCK_FUNCTION()); // \
// expected-warning {{'shared_lock_function' attribute only applies to functions and methods}} // expected-warning {{'shared_lock_function' attribute only applies to functions}}
class SlfFoo { class SlfFoo {
private: private:
int test_field SHARED_LOCK_FUNCTION(); // \ int test_field SHARED_LOCK_FUNCTION(); // \
// expected-warning {{'shared_lock_function' attribute only applies to functions and methods}} // expected-warning {{'shared_lock_function' attribute only applies to functions}}
void test_method() SHARED_LOCK_FUNCTION(); void test_method() SHARED_LOCK_FUNCTION();
}; };
class SHARED_LOCK_FUNCTION() SlfTestClass { // \ class SHARED_LOCK_FUNCTION() SlfTestClass { // \
// expected-warning {{'shared_lock_function' attribute only applies to functions and methods}} // expected-warning {{'shared_lock_function' attribute only applies to functions}}
}; };
// Check argument parsing. // Check argument parsing.
@ -725,26 +725,26 @@ int etf_testfn(int y) EXCLUSIVE_TRYLOCK_FUNCTION(1);
int etf_testfn(int y) { int etf_testfn(int y) {
int x EXCLUSIVE_TRYLOCK_FUNCTION(1) = y; // \ int x EXCLUSIVE_TRYLOCK_FUNCTION(1) = y; // \
// expected-warning {{'exclusive_trylock_function' attribute only applies to functions and methods}} // expected-warning {{'exclusive_trylock_function' attribute only applies to functions}}
return x; return x;
}; };
int etf_test_var EXCLUSIVE_TRYLOCK_FUNCTION(1); // \ int etf_test_var EXCLUSIVE_TRYLOCK_FUNCTION(1); // \
// expected-warning {{'exclusive_trylock_function' attribute only applies to functions and methods}} // expected-warning {{'exclusive_trylock_function' attribute only applies to functions}}
class EtfFoo { class EtfFoo {
private: private:
int test_field EXCLUSIVE_TRYLOCK_FUNCTION(1); // \ int test_field EXCLUSIVE_TRYLOCK_FUNCTION(1); // \
// expected-warning {{'exclusive_trylock_function' attribute only applies to functions and methods}} // expected-warning {{'exclusive_trylock_function' attribute only applies to functions}}
void test_method() EXCLUSIVE_TRYLOCK_FUNCTION(1); void test_method() EXCLUSIVE_TRYLOCK_FUNCTION(1);
}; };
class EXCLUSIVE_TRYLOCK_FUNCTION(1) EtfTestClass { // \ class EXCLUSIVE_TRYLOCK_FUNCTION(1) EtfTestClass { // \
// expected-warning {{'exclusive_trylock_function' attribute only applies to functions and methods}} // expected-warning {{'exclusive_trylock_function' attribute only applies to functions}}
}; };
void etf_fun_params(int lvar EXCLUSIVE_TRYLOCK_FUNCTION(1)); // \ void etf_fun_params(int lvar EXCLUSIVE_TRYLOCK_FUNCTION(1)); // \
// expected-warning {{'exclusive_trylock_function' attribute only applies to functions and methods}} // expected-warning {{'exclusive_trylock_function' attribute only applies to functions}}
// Check argument parsing. // Check argument parsing.
@ -798,26 +798,26 @@ int stf_testfn(int y) SHARED_TRYLOCK_FUNCTION(1);
int stf_testfn(int y) { int stf_testfn(int y) {
int x SHARED_TRYLOCK_FUNCTION(1) = y; // \ int x SHARED_TRYLOCK_FUNCTION(1) = y; // \
// expected-warning {{'shared_trylock_function' attribute only applies to functions and methods}} // expected-warning {{'shared_trylock_function' attribute only applies to functions}}
return x; return x;
}; };
int stf_test_var SHARED_TRYLOCK_FUNCTION(1); // \ int stf_test_var SHARED_TRYLOCK_FUNCTION(1); // \
// expected-warning {{'shared_trylock_function' attribute only applies to functions and methods}} // expected-warning {{'shared_trylock_function' attribute only applies to functions}}
void stf_fun_params(int lvar SHARED_TRYLOCK_FUNCTION(1)); // \ void stf_fun_params(int lvar SHARED_TRYLOCK_FUNCTION(1)); // \
// expected-warning {{'shared_trylock_function' attribute only applies to functions and methods}} // expected-warning {{'shared_trylock_function' attribute only applies to functions}}
class StfFoo { class StfFoo {
private: private:
int test_field SHARED_TRYLOCK_FUNCTION(1); // \ int test_field SHARED_TRYLOCK_FUNCTION(1); // \
// expected-warning {{'shared_trylock_function' attribute only applies to functions and methods}} // expected-warning {{'shared_trylock_function' attribute only applies to functions}}
void test_method() SHARED_TRYLOCK_FUNCTION(1); void test_method() SHARED_TRYLOCK_FUNCTION(1);
}; };
class SHARED_TRYLOCK_FUNCTION(1) StfTestClass { // \ class SHARED_TRYLOCK_FUNCTION(1) StfTestClass { // \
// expected-warning {{'shared_trylock_function' attribute only applies to functions and methods}} // expected-warning {{'shared_trylock_function' attribute only applies to functions}}
}; };
// Check argument parsing. // Check argument parsing.
@ -868,26 +868,26 @@ int uf_testfn(int y) UNLOCK_FUNCTION();
int uf_testfn(int y) { int uf_testfn(int y) {
int x UNLOCK_FUNCTION() = y; // \ int x UNLOCK_FUNCTION() = y; // \
// expected-warning {{'unlock_function' attribute only applies to functions and methods}} // expected-warning {{'unlock_function' attribute only applies to functions}}
return x; return x;
}; };
int uf_test_var UNLOCK_FUNCTION(); // \ int uf_test_var UNLOCK_FUNCTION(); // \
// expected-warning {{'unlock_function' attribute only applies to functions and methods}} // expected-warning {{'unlock_function' attribute only applies to functions}}
class UfFoo { class UfFoo {
private: private:
int test_field UNLOCK_FUNCTION(); // \ int test_field UNLOCK_FUNCTION(); // \
// expected-warning {{'unlock_function' attribute only applies to functions and methods}} // expected-warning {{'unlock_function' attribute only applies to functions}}
void test_method() UNLOCK_FUNCTION(); void test_method() UNLOCK_FUNCTION();
}; };
class NO_THREAD_SAFETY_ANALYSIS UfTestClass { // \ class NO_THREAD_SAFETY_ANALYSIS UfTestClass { // \
// expected-warning {{'no_thread_safety_analysis' attribute only applies to functions and methods}} // expected-warning {{'no_thread_safety_analysis' attribute only applies to functions}}
}; };
void uf_fun_params(int lvar UNLOCK_FUNCTION()); // \ void uf_fun_params(int lvar UNLOCK_FUNCTION()); // \
// expected-warning {{'unlock_function' attribute only applies to functions and methods}} // expected-warning {{'unlock_function' attribute only applies to functions}}
// Check argument parsing. // Check argument parsing.
@ -944,25 +944,25 @@ int lr_testfn(int y) LOCK_RETURNED(mu1);
int lr_testfn(int y) { int lr_testfn(int y) {
int x LOCK_RETURNED(mu1) = y; // \ int x LOCK_RETURNED(mu1) = y; // \
// expected-warning {{'lock_returned' attribute only applies to functions and methods}} // expected-warning {{'lock_returned' attribute only applies to functions}}
return x; return x;
}; };
int lr_test_var LOCK_RETURNED(mu1); // \ int lr_test_var LOCK_RETURNED(mu1); // \
// expected-warning {{'lock_returned' attribute only applies to functions and methods}} // expected-warning {{'lock_returned' attribute only applies to functions}}
void lr_fun_params(int lvar LOCK_RETURNED(mu1)); // \ void lr_fun_params(int lvar LOCK_RETURNED(mu1)); // \
// expected-warning {{'lock_returned' attribute only applies to functions and methods}} // expected-warning {{'lock_returned' attribute only applies to functions}}
class LrFoo { class LrFoo {
private: private:
int test_field LOCK_RETURNED(mu1); // \ int test_field LOCK_RETURNED(mu1); // \
// expected-warning {{'lock_returned' attribute only applies to functions and methods}} // expected-warning {{'lock_returned' attribute only applies to functions}}
void test_method() LOCK_RETURNED(mu1); void test_method() LOCK_RETURNED(mu1);
}; };
class LOCK_RETURNED(mu1) LrTestClass { // \ class LOCK_RETURNED(mu1) LrTestClass { // \
// expected-warning {{'lock_returned' attribute only applies to functions and methods}} // expected-warning {{'lock_returned' attribute only applies to functions}}
}; };
// Check argument parsing. // Check argument parsing.
@ -1011,25 +1011,25 @@ int le_testfn(int y) LOCKS_EXCLUDED(mu1);
int le_testfn(int y) { int le_testfn(int y) {
int x LOCKS_EXCLUDED(mu1) = y; // \ int x LOCKS_EXCLUDED(mu1) = y; // \
// expected-warning {{'locks_excluded' attribute only applies to functions and methods}} // expected-warning {{'locks_excluded' attribute only applies to functions}}
return x; return x;
}; };
int le_test_var LOCKS_EXCLUDED(mu1); // \ int le_test_var LOCKS_EXCLUDED(mu1); // \
// expected-warning {{'locks_excluded' attribute only applies to functions and methods}} // expected-warning {{'locks_excluded' attribute only applies to functions}}
void le_fun_params(int lvar LOCKS_EXCLUDED(mu1)); // \ void le_fun_params(int lvar LOCKS_EXCLUDED(mu1)); // \
// expected-warning {{'locks_excluded' attribute only applies to functions and methods}} // expected-warning {{'locks_excluded' attribute only applies to functions}}
class LeFoo { class LeFoo {
private: private:
int test_field LOCKS_EXCLUDED(mu1); // \ int test_field LOCKS_EXCLUDED(mu1); // \
// expected-warning {{'locks_excluded' attribute only applies to functions and methods}} // expected-warning {{'locks_excluded' attribute only applies to functions}}
void test_method() LOCKS_EXCLUDED(mu1); void test_method() LOCKS_EXCLUDED(mu1);
}; };
class LOCKS_EXCLUDED(mu1) LeTestClass { // \ class LOCKS_EXCLUDED(mu1) LeTestClass { // \
// expected-warning {{'locks_excluded' attribute only applies to functions and methods}} // expected-warning {{'locks_excluded' attribute only applies to functions}}
}; };
// Check argument parsing. // Check argument parsing.
@ -1078,25 +1078,25 @@ int elr_testfn(int y) EXCLUSIVE_LOCKS_REQUIRED(mu1);
int elr_testfn(int y) { int elr_testfn(int y) {
int x EXCLUSIVE_LOCKS_REQUIRED(mu1) = y; // \ int x EXCLUSIVE_LOCKS_REQUIRED(mu1) = y; // \
// expected-warning {{'exclusive_locks_required' attribute only applies to functions and methods}} // expected-warning {{'exclusive_locks_required' attribute only applies to functions}}
return x; return x;
}; };
int elr_test_var EXCLUSIVE_LOCKS_REQUIRED(mu1); // \ int elr_test_var EXCLUSIVE_LOCKS_REQUIRED(mu1); // \
// expected-warning {{'exclusive_locks_required' attribute only applies to functions and methods}} // expected-warning {{'exclusive_locks_required' attribute only applies to functions}}
void elr_fun_params(int lvar EXCLUSIVE_LOCKS_REQUIRED(mu1)); // \ void elr_fun_params(int lvar EXCLUSIVE_LOCKS_REQUIRED(mu1)); // \
// expected-warning {{'exclusive_locks_required' attribute only applies to functions and methods}} // expected-warning {{'exclusive_locks_required' attribute only applies to functions}}
class ElrFoo { class ElrFoo {
private: private:
int test_field EXCLUSIVE_LOCKS_REQUIRED(mu1); // \ int test_field EXCLUSIVE_LOCKS_REQUIRED(mu1); // \
// expected-warning {{'exclusive_locks_required' attribute only applies to functions and methods}} // expected-warning {{'exclusive_locks_required' attribute only applies to functions}}
void test_method() EXCLUSIVE_LOCKS_REQUIRED(mu1); void test_method() EXCLUSIVE_LOCKS_REQUIRED(mu1);
}; };
class EXCLUSIVE_LOCKS_REQUIRED(mu1) ElrTestClass { // \ class EXCLUSIVE_LOCKS_REQUIRED(mu1) ElrTestClass { // \
// expected-warning {{'exclusive_locks_required' attribute only applies to functions and methods}} // expected-warning {{'exclusive_locks_required' attribute only applies to functions}}
}; };
// Check argument parsing. // Check argument parsing.
@ -1146,25 +1146,25 @@ int slr_testfn(int y) SHARED_LOCKS_REQUIRED(mu1);
int slr_testfn(int y) { int slr_testfn(int y) {
int x SHARED_LOCKS_REQUIRED(mu1) = y; // \ int x SHARED_LOCKS_REQUIRED(mu1) = y; // \
// expected-warning {{'shared_locks_required' attribute only applies to functions and methods}} // expected-warning {{'shared_locks_required' attribute only applies to functions}}
return x; return x;
}; };
int slr_test_var SHARED_LOCKS_REQUIRED(mu1); // \ int slr_test_var SHARED_LOCKS_REQUIRED(mu1); // \
// expected-warning {{'shared_locks_required' attribute only applies to functions and methods}} // expected-warning {{'shared_locks_required' attribute only applies to functions}}
void slr_fun_params(int lvar SHARED_LOCKS_REQUIRED(mu1)); // \ void slr_fun_params(int lvar SHARED_LOCKS_REQUIRED(mu1)); // \
// expected-warning {{'shared_locks_required' attribute only applies to functions and methods}} // expected-warning {{'shared_locks_required' attribute only applies to functions}}
class SlrFoo { class SlrFoo {
private: private:
int test_field SHARED_LOCKS_REQUIRED(mu1); // \ int test_field SHARED_LOCKS_REQUIRED(mu1); // \
// expected-warning {{'shared_locks_required' attribute only applies to functions and methods}} // expected-warning {{'shared_locks_required' attribute only applies to functions}}
void test_method() SHARED_LOCKS_REQUIRED(mu1); void test_method() SHARED_LOCKS_REQUIRED(mu1);
}; };
class SHARED_LOCKS_REQUIRED(mu1) SlrTestClass { // \ class SHARED_LOCKS_REQUIRED(mu1) SlrTestClass { // \
// expected-warning {{'shared_locks_required' attribute only applies to functions and methods}} // expected-warning {{'shared_locks_required' attribute only applies to functions}}
}; };
// Check argument parsing. // Check argument parsing.

View File

@ -2047,10 +2047,9 @@ static std::string CalculateDiagnostic(const Record &S) {
ObjCInterface = 1U << 9, ObjCInterface = 1U << 9,
Block = 1U << 10, Block = 1U << 10,
Namespace = 1U << 11, Namespace = 1U << 11,
FuncTemplate = 1U << 12, Field = 1U << 12,
Field = 1U << 13, CXXMethod = 1U << 13,
CXXMethod = 1U << 14, ObjCProtocol = 1U << 14
ObjCProtocol = 1U << 15
}; };
uint32_t SubMask = 0; uint32_t SubMask = 0;
@ -2082,7 +2081,6 @@ static std::string CalculateDiagnostic(const Record &S) {
.Case("Block", Block) .Case("Block", Block)
.Case("CXXRecord", Class) .Case("CXXRecord", Class)
.Case("Namespace", Namespace) .Case("Namespace", Namespace)
.Case("FunctionTemplate", FuncTemplate)
.Case("Field", Field) .Case("Field", Field)
.Case("CXXMethod", CXXMethod) .Case("CXXMethod", CXXMethod)
.Default(0); .Default(0);
@ -2121,7 +2119,6 @@ static std::string CalculateDiagnostic(const Record &S) {
case Func | ObjCMethod | Class: return "ExpectedFunctionMethodOrClass"; case Func | ObjCMethod | Class: return "ExpectedFunctionMethodOrClass";
case Func | Param: case Func | Param:
case Func | ObjCMethod | Param: return "ExpectedFunctionMethodOrParameter"; case Func | ObjCMethod | Param: return "ExpectedFunctionMethodOrParameter";
case Func | FuncTemplate:
case Func | ObjCMethod: return "ExpectedFunctionOrMethod"; case Func | ObjCMethod: return "ExpectedFunctionOrMethod";
case Func | Var: return "ExpectedVariableOrFunction"; case Func | Var: return "ExpectedVariableOrFunction";