llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Roberto Turrado Camblor (rturrado)

<details>
<summary>Changes</summary>

Allow '[out,in]', '[inout]', and '[outin]' as doc passing directions.

---
Full diff: https://github.com/llvm/llvm-project/pull/174245.diff


3 Files Affected:

- (modified) clang/include/clang/Basic/DiagnosticCommentKinds.td (+1-1) 
- (modified) clang/lib/AST/CommentSema.cpp (+2-1) 
- (modified) clang/test/Sema/warn-documentation.cpp (+10-1) 


``````````diff
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);
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/174245
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to