summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Poveda <christian.poveda@ferrous-systems.com>2022-09-01 12:16:43 -0500
committerEmilio Cobos Álvarez <emilio@crisal.io>2022-09-22 20:25:33 -1000
commit15f5094d45a8858ba2d244dc8c6f018a28d48eaa (patch)
tree93142cb23280ad253582ce95cbec8025b2be4882
parent2251aed4d0a2422d7b94cceeafcfe9ac98a69ad6 (diff)
document `Attribute`
-rw-r--r--src/clang.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/clang.rs b/src/clang.rs
index 05ef5d05..d66fe445 100644
--- a/src/clang.rs
+++ b/src/clang.rs
@@ -12,6 +12,10 @@ use std::hash::Hasher;
use std::os::raw::{c_char, c_int, c_longlong, c_uint, c_ulong, c_ulonglong};
use std::{mem, ptr, slice};
+/// Type representing a clang attribute.
+///
+/// Values of this type can be used to check for different attributes using the `has_attrs`
+/// function.
pub struct Attribute {
name: &'static [u8],
kind: CXCursorKind,
@@ -19,6 +23,7 @@ pub struct Attribute {
}
impl Attribute {
+ /// A `warn_unused_result` attribute.
pub const MUST_USE: Self = Self {
name: b"warn_unused_result",
// FIXME(emilio): clang-sys doesn't expose `CXCursor_WarnUnusedResultAttr` (from clang 9).
@@ -26,6 +31,7 @@ impl Attribute {
token_kind: CXToken_Identifier,
};
+ /// A `_Noreturn` attribute.
pub const NO_RETURN: Self = Self {
name: b"_Noreturn",
kind: CXCursor_UnexposedAttr,