[clang-tools-extra] [clang-doc] add enum test (PR #97679)

Paul Kirth via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 15 07:57:57 PDT 2024


================
@@ -0,0 +1,121 @@
+// RUN: rm -rf %t && mkdir -p %t
+// RUN: clang-doc --format=html --doxygen --output=%t --executor=standalone %s
+// RUN: clang-doc --format=md --doxygen --output=%t --executor=standalone %s
+// RUN: FileCheck %s < %t/GlobalNamespace/index.html -check-prefix=HTML-INDEX
+// RUN: FileCheck %s < %t/GlobalNamespace/Animals.html -check-prefix=HTML-ANIMAL
+// RUN: FileCheck %s < %t/Vehicles/index.html -check-prefix=HTML-VEHICLES
+// RUN: FileCheck %s < %t/GlobalNamespace/index.md -check-prefix=MD-INDEX
+// RUN: FileCheck %s < %t/GlobalNamespace/Animals.md -check-prefix=MD-ANIMAL
+// RUN: FileCheck %s < %t/Vehicles/index.md -check-prefix=MD-VEHICLES
+
+
+/**
+ * @brief For specifying RGB colors
+ */
+enum Color {
+  Red, // Red
+  Green, // Green
+  Blue // Blue
+};
+
+/**
+ * @brief Shape Types
+ */
+enum Shapes {
+  // Circle
+  Circle,
+  // Rectangle
+  Rectangle,
+  // Triangle
+  Triangle
+};
+
+class Animals {
+public:
+      /**
+       * @brief specify what animal the class is
+       */
+      enum AnimalType {
+          Dog, // Man's best friend
+          Cat, // Man's other best friend
+          Iguana // A lizard
+      };
+};
+
+
+namespace Vehicles {
+    /**
+     * @brief specify type of car
+     */
+    enum Car {
+       Sedan, // Sedan
----------------
ilovepi wrote:

Shouldn’t these be documentation comments? So using /// or the doxygen style comments?

My earlier point was that in LLVM and other projects, there are often documentation comments attached the the enum entries. It would be good to test that. If it doesn’t work, we can add a TODO and a tracking bug on GitHub. 

https://github.com/llvm/llvm-project/pull/97679


More information about the cfe-commits mailing list