Files
TheRock/compiler/amd-llvm/clang/test/ExtractAPI/macro_doc_comments.c
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

68 lines
2.4 KiB
C

// RUN: rm -rf %t
// RUN: %clang_cc1 -extract-api --pretty-sgf --emit-sgf-symbol-labels-for-testing --product-name=MacroDoc -triple arm64-apple-macosx \
// RUN: -fretain-comments-from-system-headers -isystem %S -x objective-c-header %s -o %t/output.symbols.json
// Verify documentation comments attached to `#define` macros end up in the
// symbol graph as a `docComment` block.
// RUN: FileCheck %s --input-file %t/output.symbols.json --check-prefix HELLO
/// The greeting count.
#define HELLO 1
// HELLO-LABEL: "!testLabel": "c:@macro@HELLO"
// HELLO: "docComment": {
// HELLO-NEXT: "lines": [
// HELLO: "text": "The greeting count."
// HELLO: ]
// HELLO-NEXT: },
// A C-style block doc comment also attaches.
// RUN: FileCheck %s --input-file %t/output.symbols.json --check-prefix BLOCK
/**
* \brief A version number.
*/
#define VERSION 42
// BLOCK-LABEL: "!testLabel": "c:@macro@VERSION"
// BLOCK: "docComment": {
// BLOCK-NEXT: "lines": [
// BLOCK: "text": " \\brief A version number."
// BLOCK: ]
// BLOCK-NEXT: },
// Function-like macros pick up their preceding doc comment.
// RUN: FileCheck %s --input-file %t/output.symbols.json --check-prefix SUM
/// Add two numbers.
#define SUM(x, y) ((x) + (y))
// SUM-LABEL: "!testLabel": "c:@macro@SUM"
// SUM: "docComment": {
// SUM-NEXT: "lines": [
// SUM: "text": "Add two numbers."
// SUM: ]
// SUM-NEXT: },
// Trailing `///<` doc comments attach to macros, just like fields/enumerators.
// RUN: FileCheck %s --input-file %t/output.symbols.json --check-prefix TRAIL
#define ANSWER 42 ///< The answer.
// TRAIL-LABEL: "!testLabel": "c:@macro@ANSWER"
// TRAIL: "docComment": {
// TRAIL-NEXT: "lines": [
// TRAIL: "text": "The answer."
// TRAIL: ]
// TRAIL-NEXT: },
// A macro with no documentation comment must NOT have a `docComment` key.
// RUN: FileCheck %s --input-file %t/output.symbols.json --check-prefix BARE
#define BARE 7
// BARE-LABEL: "!testLabel": "c:@macro@BARE"
// BARE-NOT: "docComment"
// BARE: "kind":
// A non-doc `//` comment must not be attached as a docComment.
// RUN: FileCheck %s --input-file %t/output.symbols.json --check-prefix PLAIN
// just an ordinary comment, not Doxygen
#define PLAIN 8
// PLAIN-LABEL: "!testLabel": "c:@macro@PLAIN"
// PLAIN-NOT: "docComment"
// PLAIN: "kind":
// expected-no-diagnostics