https://github.com/rturrado updated https://github.com/llvm/llvm-project/pull/174245
>From ede0412b1e8b0a22e0fb91da3d889ee9e516e63b Mon Sep 17 00:00:00 2001 From: rturrado <[email protected]> Date: Fri, 2 Jan 2026 22:55:10 +0100 Subject: [PATCH 1/2] Allow '[out,in]', '[inout]', and '[outin]' as doc passing directions --- clang/include/clang/Basic/DiagnosticCommentKinds.td | 2 +- clang/lib/AST/CommentSema.cpp | 3 ++- clang/test/Sema/warn-documentation.cpp | 11 ++++++++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/clang/include/clang/Basic/DiagnosticCommentKinds.td b/clang/include/clang/Basic/DiagnosticCommentKinds.td index 588cd3615e7e6..fed5f90fee252 100644 --- a/clang/include/clang/Basic/DiagnosticCommentKinds.td +++ b/clang/include/clang/Basic/DiagnosticCommentKinds.td @@ -64,7 +64,7 @@ def note_doc_block_command_previous_alias : Note< def warn_doc_param_invalid_direction : Warning< "unrecognized parameter passing direction, " - "valid directions are '[in]', '[out]' and '[in,out]'">, + "valid directions are '[in]', '[out]', '[in,out]', '[out,in]', '[inout]', and '[outin]'">, InGroup<Documentation>, DefaultIgnore; def warn_doc_param_spaces_in_direction : Warning< diff --git a/clang/lib/AST/CommentSema.cpp b/clang/lib/AST/CommentSema.cpp index d5ba240cb2bde..61ea0970f4f48 100644 --- a/clang/lib/AST/CommentSema.cpp +++ b/clang/lib/AST/CommentSema.cpp @@ -225,7 +225,8 @@ static ParamCommandPassDirection getParamPassDirection(StringRef Arg) { return llvm::StringSwitch<ParamCommandPassDirection>(Arg) .Case("[in]", ParamCommandPassDirection::In) .Case("[out]", ParamCommandPassDirection::Out) - .Cases({"[in,out]", "[out,in]"}, ParamCommandPassDirection::InOut) + .Cases({"[in,out]", "[out,in]", "[inout]", "[outin]"}, + ParamCommandPassDirection::InOut) .Default(static_cast<ParamCommandPassDirection>(-1)); } diff --git a/clang/test/Sema/warn-documentation.cpp b/clang/test/Sema/warn-documentation.cpp index 0d1faa1b562fe..762e1811f2c9f 100644 --- a/clang/test/Sema/warn-documentation.cpp +++ b/clang/test/Sema/warn-documentation.cpp @@ -242,6 +242,15 @@ int test_param6(int a); /// \param [in,out] a Blah blah. int test_param7(int a); +/// \param [out,in] a Blah blah. +int test_param7b(int a); + +/// \param [inout] a Blah blah. +int test_param7c(int a); + +/// \param [outin] a Blah blah. +int test_param7d(int a); + // expected-warning@+1 {{whitespace is not allowed in parameter passing direction}} /// \param [ in ] a Blah blah. int test_param8(int a); @@ -250,7 +259,7 @@ int test_param8(int a); /// \param [in, out] a Blah blah. int test_param9(int a); -// expected-warning@+1 {{unrecognized parameter passing direction, valid directions are '[in]', '[out]' and '[in,out]'}} +// expected-warning@+1 {{unrecognized parameter passing direction, valid directions are '[in]', '[out]', '[in,out]', '[out,in]', '[inout]', and '[outin]'}} /// \param [ junk] a Blah blah. int test_param10(int a); >From 8d693bd38d6aeda448de5f106f9513a5680afb30 Mon Sep 17 00:00:00 2001 From: rturrado <[email protected]> Date: Tue, 6 Jan 2026 18:59:15 +0100 Subject: [PATCH 2/2] Allow '[in out]', and '[out in]' as doc passing directions --- clang/include/clang/Basic/DiagnosticCommentKinds.td | 2 +- clang/lib/AST/CommentSema.cpp | 3 ++- clang/test/Sema/warn-documentation.cpp | 12 +++++++++--- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/clang/include/clang/Basic/DiagnosticCommentKinds.td b/clang/include/clang/Basic/DiagnosticCommentKinds.td index fed5f90fee252..b7bf68139a369 100644 --- a/clang/include/clang/Basic/DiagnosticCommentKinds.td +++ b/clang/include/clang/Basic/DiagnosticCommentKinds.td @@ -64,7 +64,7 @@ def note_doc_block_command_previous_alias : Note< def warn_doc_param_invalid_direction : Warning< "unrecognized parameter passing direction, " - "valid directions are '[in]', '[out]', '[in,out]', '[out,in]', '[inout]', and '[outin]'">, + "valid directions are '[in]', '[out]', '[in,out]', '[out,in]', '[in out]', '[out in]', '[inout]', and '[outin]'">, InGroup<Documentation>, DefaultIgnore; def warn_doc_param_spaces_in_direction : Warning< diff --git a/clang/lib/AST/CommentSema.cpp b/clang/lib/AST/CommentSema.cpp index 61ea0970f4f48..72bf3fb6530c0 100644 --- a/clang/lib/AST/CommentSema.cpp +++ b/clang/lib/AST/CommentSema.cpp @@ -225,7 +225,8 @@ static ParamCommandPassDirection getParamPassDirection(StringRef Arg) { return llvm::StringSwitch<ParamCommandPassDirection>(Arg) .Case("[in]", ParamCommandPassDirection::In) .Case("[out]", ParamCommandPassDirection::Out) - .Cases({"[in,out]", "[out,in]", "[inout]", "[outin]"}, + .Cases({"[in,out]", "[out,in]", "[in out]", "[out in]", "[inout]", + "[outin]"}, ParamCommandPassDirection::InOut) .Default(static_cast<ParamCommandPassDirection>(-1)); } diff --git a/clang/test/Sema/warn-documentation.cpp b/clang/test/Sema/warn-documentation.cpp index 762e1811f2c9f..ec2d53848dc3c 100644 --- a/clang/test/Sema/warn-documentation.cpp +++ b/clang/test/Sema/warn-documentation.cpp @@ -245,12 +245,18 @@ int test_param7(int a); /// \param [out,in] a Blah blah. int test_param7b(int a); -/// \param [inout] a Blah blah. +/// \param [in out] a Blah blah. int test_param7c(int a); -/// \param [outin] a Blah blah. +/// \param [out in] a Blah blah. int test_param7d(int a); +/// \param [inout] a Blah blah. +int test_param7e(int a); + +/// \param [outin] a Blah blah. +int test_param7f(int a); + // expected-warning@+1 {{whitespace is not allowed in parameter passing direction}} /// \param [ in ] a Blah blah. int test_param8(int a); @@ -259,7 +265,7 @@ int test_param8(int a); /// \param [in, out] a Blah blah. int test_param9(int a); -// expected-warning@+1 {{unrecognized parameter passing direction, valid directions are '[in]', '[out]', '[in,out]', '[out,in]', '[inout]', and '[outin]'}} +// expected-warning@+1 {{unrecognized parameter passing direction, valid directions are '[in]', '[out]', '[in,out]', '[out,in]', '[in out]', '[out in]', '[inout]', and '[outin]'}} /// \param [ junk] a Blah blah. int test_param10(int a); _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
