diff options
| author | Erich Keane <erich.keane@intel.com> | 2017-09-28 20:08:03 +0000 |
|---|---|---|
| committer | Erich Keane <erich.keane@intel.com> | 2017-09-28 20:08:03 +0000 |
| commit | de22fe5b5b7dbc825494a5d7c50fb09adcc6524f (patch) | |
| tree | 8d998a92cc02f40c4e0229792a65d2ba01f6fb77 /clang | |
| parent | 2ca6c3da630ad577d319a37dc8d4b05c91225efc (diff) | |
| download | bcm5719-llvm-de22fe5b5b7dbc825494a5d7c50fb09adcc6524f.tar.gz bcm5719-llvm-de22fe5b5b7dbc825494a5d7c50fb09adcc6524f.zip | |
Add Documentation to attribute-nothrow. Additionally, limit to functions.
Attribute nothrow is only allowed on functions, so I added that. Additionally,
it lacks any documentation, so I added some.
Differential Revision: https://reviews.llvm.org/D38202
llvm-svn: 314456
Diffstat (limited to 'clang')
| -rw-r--r-- | clang/include/clang/Basic/Attr.td | 3 | ||||
| -rw-r--r-- | clang/include/clang/Basic/AttrDocs.td | 12 | ||||
| -rw-r--r-- | clang/test/Misc/pragma-attribute-supported-attributes-list.test | 1 |
3 files changed, 15 insertions, 1 deletions
diff --git a/clang/include/clang/Basic/Attr.td b/clang/include/clang/Basic/Attr.td index c3567709ee0..17d2be28611 100644 --- a/clang/include/clang/Basic/Attr.td +++ b/clang/include/clang/Basic/Attr.td @@ -1437,7 +1437,8 @@ def NotTailCalled : InheritableAttr { def NoThrow : InheritableAttr { let Spellings = [GCC<"nothrow">, Declspec<"nothrow">]; - let Documentation = [Undocumented]; + let Subjects = SubjectList<[Function]>; + let Documentation = [NoThrowDocs]; } def NvWeak : IgnoredAttr { diff --git a/clang/include/clang/Basic/AttrDocs.td b/clang/include/clang/Basic/AttrDocs.td index 0500c283861..e51c65073fe 100644 --- a/clang/include/clang/Basic/AttrDocs.td +++ b/clang/include/clang/Basic/AttrDocs.td @@ -2727,6 +2727,18 @@ Marking virtual functions as ``not_tail_called`` is an error: }]; } +def NoThrowDocs : Documentation { + let Category = DocCatFunction; + let Content = [{ +Clang supports the GNU style ``__attribute__((nothrow))`` and Microsoft style +``__declspec(nothrow)`` attribute as an equivilent of `noexcept` on function +declarations. This attribute informs the compiler that the annotated function +does not throw an exception. This prevents exception-unwinding. This attribute +is particularly useful on functions in the C Standard Library that are +guaranteed to not throw an exception. + }]; +} + def InternalLinkageDocs : Documentation { let Category = DocCatFunction; let Content = [{ diff --git a/clang/test/Misc/pragma-attribute-supported-attributes-list.test b/clang/test/Misc/pragma-attribute-supported-attributes-list.test index 7529a2425d3..da024a43947 100644 --- a/clang/test/Misc/pragma-attribute-supported-attributes-list.test +++ b/clang/test/Misc/pragma-attribute-supported-attributes-list.test @@ -40,6 +40,7 @@ // CHECK-NEXT: NoSanitize (SubjectMatchRule_function, SubjectMatchRule_objc_method, SubjectMatchRule_variable_is_global) // CHECK-NEXT: NoSanitizeSpecific (SubjectMatchRule_function, SubjectMatchRule_variable_is_global) // CHECK-NEXT: NoSplitStack (SubjectMatchRule_function) +// CHECK-NEXT: NoThrow (SubjectMatchRule_function) // CHECK-NEXT: NotTailCalled (SubjectMatchRule_function) // CHECK-NEXT: ObjCBoxable (SubjectMatchRule_record) // CHECK-NEXT: ObjCMethodFamily (SubjectMatchRule_objc_method) |

