mirror of
https://github.com/facebook/react-native.git
synced 2026-11-18 20:19:07 +00:00
Fix double constexpr in constructors (#55846)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/55846 Changelog: [Internal] When constructors are marked as "constexpr", doxygen will output them as a function of type "constexpr" with "is-constexpr=yes". This causes the script to duplicate the keyword. This diff fixes that by explicitly covering this edge case. Reviewed By: cipolleschi Differential Revision: D94901507 fbshipit-source-id: 384513381a86ba2efe07f14fd5976216ea5a8572
This commit is contained in:
1 parent
44bb931446
commit
1fdddb09fe
3 files changed
+32
No files matched your search
@@ -324,6 +324,12 @@ def get_function_member(
|
||||
# Strip the trailing "=0" from the type string.
|
||||
function_type = re.sub(r"\s*=\s*0\s*$", "", function_type)
|
||||
|
||||
# For constexpr constructors, Doxygen outputs "constexpr" both as an
|
||||
# attribute (constexpr="yes") and as the return type (<type>constexpr</type>).
|
||||
# Remove the redundant type to avoid "constexpr constexpr" in output.
|
||||
if is_constexpr and function_type == "constexpr":
|
||||
function_type = ""
|
||||
|
||||
doxygen_params = get_doxygen_params(function_def)
|
||||
|
||||
function = FunctionMember(
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
class test::Clss {
|
||||
public constexpr Clss() = default;
|
||||
public constexpr Clss(const test::Clss&) = default;
|
||||
public constexpr Clss(int value);
|
||||
public constexpr Clss(test::Clss&&) = default;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace test {
|
||||
|
||||
class Clss {
|
||||
public:
|
||||
constexpr Clss() = default;
|
||||
constexpr Clss(const Clss &) = default;
|
||||
constexpr Clss(Clss &&) = default;
|
||||
explicit constexpr Clss(int value);
|
||||
};
|
||||
|
||||
} // namespace test
|
||||
Reference in new issue
Block a user