refactor: centralize comment generation checks (fixes #445)

- Add doc_comment() method to FieldData that checks generate_comments flag
- Add doc_comment() method to EnumVariant that checks generate_comments flag
- Remove redundant generate_comments checks from field codegen
- Remove redundant generate_comments checks from enum variant codegen

This makes the code more idiomatic by having types that generate comments
handle the flag check themselves, eliminating duplication and centralizing
the decision logic.
diff --git a/bindgen/codegen/mod.rs b/bindgen/codegen/mod.rs
index a28f5b3..2e2621a 100644
--- a/bindgen/codegen/mod.rs
+++ b/bindgen/codegen/mod.rs
@@ -1619,11 +1619,8 @@
         };
 
         let mut field = quote! {};
-        if ctx.options().generate_comments {
-            if let Some(raw_comment) = self.comment() {
-                let comment = ctx.options().process_comment(raw_comment);
-                field = attributes::doc(&comment);
-            }
+        if let Some(comment) = self.doc_comment(ctx) {
+            field = attributes::doc(&comment);
         }
 
         let field_name = self
@@ -3925,14 +3922,11 @@
                 continue;
             }
 
-            let mut variant_doc = quote! {};
-            if ctx.options().generate_comments {
-                if let Some(raw_comment) = variant.comment() {
-                    let processed_comment =
-                        ctx.options().process_comment(raw_comment);
-                    variant_doc = attributes::doc(&processed_comment);
-                }
-            }
+            let variant_doc = if let Some(comment) = variant.doc_comment(ctx) {
+                attributes::doc(&comment)
+            } else {
+                quote! {}
+            };
 
             match seen_values.entry(variant.val()) {
                 Entry::Occupied(ref entry) => {
diff --git a/bindgen/ir/comp.rs b/bindgen/ir/comp.rs
index 7ba65de..a41fa6f 100644
--- a/bindgen/ir/comp.rs
+++ b/bindgen/ir/comp.rs
@@ -142,6 +142,7 @@
     fn ty(&self) -> TypeId;
 
     /// Get the comment for this field.
+    #[allow(dead_code)] // Used by trait implementations in Field wrapper types
     fn comment(&self) -> Option<&str>;
 
     /// If this is a bitfield, how many bits does it need?
@@ -902,6 +903,20 @@
     }
 }
 
+impl FieldData {
+    /// Get this field's documentation comment, if it has any, already preprocessed
+    /// and with the right indentation. Returns `None` if comment generation is disabled.
+    pub(crate) fn doc_comment(&self, ctx: &BindgenContext) -> Option<String> {
+        if !ctx.options().generate_comments {
+            return None;
+        }
+
+        self.comment
+            .as_ref()
+            .map(|comment| ctx.options().process_comment(comment))
+    }
+}
+
 /// The kind of inheritance a base class is using.
 #[derive(Clone, Debug, PartialEq, Eq)]
 pub(crate) enum BaseKind {
diff --git a/bindgen/ir/enum_ty.rs b/bindgen/ir/enum_ty.rs
index 9b08da3..3c84c9b 100644
--- a/bindgen/ir/enum_ty.rs
+++ b/bindgen/ir/enum_ty.rs
@@ -302,9 +302,16 @@
         self.val
     }
 
-    /// Get this variant's documentation.
-    pub(crate) fn comment(&self) -> Option<&str> {
-        self.comment.as_deref()
+    /// Get this variant's documentation comment, if it has any, already preprocessed
+    /// and with the right indentation. Returns `None` if comment generation is disabled.
+    pub(crate) fn doc_comment(&self, ctx: &BindgenContext) -> Option<String> {
+        if !ctx.options().generate_comments {
+            return None;
+        }
+
+        self.comment
+            .as_ref()
+            .map(|comment| ctx.options().process_comment(comment))
     }
 
     /// Returns whether this variant should be enforced to be a constant by code