diff --git a/include/mrdocs/Metadata/Javadoc.hpp b/include/mrdocs/Metadata/Javadoc.hpp index 0fd51a1075..43da81c9e4 100644 --- a/include/mrdocs/Metadata/Javadoc.hpp +++ b/include/mrdocs/Metadata/Javadoc.hpp @@ -683,7 +683,7 @@ struct TParam : Paragraph */ struct Throws : Paragraph { - String exception; + Reference exception; static constexpr Kind static_kind = Kind::throws; diff --git a/src/lib/AST/ParseJavadoc.cpp b/src/lib/AST/ParseJavadoc.cpp index 8cc75a2740..12e57993ce 100644 --- a/src/lib/AST/ParseJavadoc.cpp +++ b/src/lib/AST/ParseJavadoc.cpp @@ -1143,28 +1143,14 @@ visitBlockCommandComment( doc::Throws throws; auto scope = enterScope(throws); visitChildren(C->getParagraph()); - // KRYSTIAN NOTE: clang doesn't consider these commands - // to have any arguments, so we have to extract the exception - // type manually - if(! throws.children.empty()) + if (C->getNumArgs()) { - // string will start with a non-whitespace character - doc::String& text = - throws.children.front()->string; - constexpr char ws[] = " \t\n\v\f\r"; - const auto except_end = text.find_first_of(ws); - throws.exception = text.substr(0, except_end); - // find the start of the next word, ignoring whitespace - const auto word_start = - text.find_first_not_of(ws, except_end); - // if we ran out of string, remove this block - if(word_start == doc::String::npos) - throws.children.erase(throws.children.begin()); - // otherwise, trim the string to exclude the argument - else - text.erase(0, word_start); + throws.exception.string = C->getArgText(0); + } + else + { + throws.exception.string = "undefined"; } - jd_.emplace_back(std::move(throws)); return; } diff --git a/src/lib/Gen/hbs/HandlebarsCorpus.cpp b/src/lib/Gen/hbs/HandlebarsCorpus.cpp index ed8c087233..54ed35225f 100644 --- a/src/lib/Gen/hbs/HandlebarsCorpus.cpp +++ b/src/lib/Gen/hbs/HandlebarsCorpus.cpp @@ -80,7 +80,7 @@ domCreate( const HandlebarsCorpus& corpus) { dom::Object::storage_type entries = { - { "exception", I.exception } + { "exception", I.exception.string } }; std::string s = corpus.toStringFn(corpus, I); if (!s.empty()) diff --git a/test-files/golden-tests/core/libcxx.adoc b/test-files/golden-tests/core/libcxx.adoc index f92d2fa4e9..4f98fa9603 100644 --- a/test-files/golden-tests/core/libcxx.adoc +++ b/test-files/golden-tests/core/libcxx.adoc @@ -64,8 +64,8 @@ This function calculates the square root of a given integral value using bit |=== | Name | Thrown on -| `if` -| the input value is negative. +| `std::invalid_argument` +| if the input value is negative. |=== diff --git a/test-files/golden-tests/core/libcxx.html b/test-files/golden-tests/core/libcxx.html index 1ed03ad8bf..df50908d0c 100644 --- a/test-files/golden-tests/core/libcxx.html +++ b/test-files/golden-tests/core/libcxx.html @@ -79,8 +79,8 @@

Exceptions

-if -

the input value is negative.

+std::invalid_argument +

if the input value is negative.

diff --git a/test-files/golden-tests/core/libcxx.xml b/test-files/golden-tests/core/libcxx.xml index 10a6d96959..c9ace632b4 100644 --- a/test-files/golden-tests/core/libcxx.xml +++ b/test-files/golden-tests/core/libcxx.xml @@ -22,7 +22,7 @@ This function calculates the square root of a given integral value using bit manipulation. - the input value is negative. + if the input value is negative. The type of the input value. Must be an integral type. diff --git a/test-files/golden-tests/javadoc/throw.adoc b/test-files/golden-tests/javadoc/throw.adoc new file mode 100644 index 0000000000..a71954e62e --- /dev/null +++ b/test-files/golden-tests/javadoc/throw.adoc @@ -0,0 +1,54 @@ += Reference +:mrdocs: + +[#index] +== Global namespace + + +=== Functions + +[cols=2] +|=== +| Name | Description + +| <> +| brief + + + +|=== + +[#f] +== f + + +brief + + + +=== Synopsis + + +Declared in `<throw.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +void +f(); +---- + +=== Exceptions + + +|=== +| Name | Thrown on + +| `std::length_error` +| `dest_size < ipv4_address::max_str_len` + + +|=== + + + +[.small]#Created with https://www.mrdocs.com[MrDocs]# diff --git a/test-files/golden-tests/javadoc/throw.cpp b/test-files/golden-tests/javadoc/throw.cpp new file mode 100644 index 0000000000..57f1de1e5c --- /dev/null +++ b/test-files/golden-tests/javadoc/throw.cpp @@ -0,0 +1,5 @@ +/** brief + + @throw std::length_error `dest_size < ipv4_address::max_str_len` + */ +void f(); diff --git a/test-files/golden-tests/javadoc/throw.html b/test-files/golden-tests/javadoc/throw.html new file mode 100644 index 0000000000..18f51940fc --- /dev/null +++ b/test-files/golden-tests/javadoc/throw.html @@ -0,0 +1,72 @@ + + +Reference + + +
+

Reference

+
+
+

Global namespace

+
+

Functions

+ + + + + + + + + + +
NameDescription
f

brief

+ +
+
+
+
+

f

+
+

brief

+ + +
+
+
+

Synopsis

+
+Declared in <throw.cpp>
+
+
+void
+f();
+
+
+
+
+

Exceptions

+ + + + + + + + + + + + + +
NameThrown on
std::length_error

dest_size < ipv4_address::max_str_len

+
+
+
+ +
+
+

Created with MrDocs

+
+ + \ No newline at end of file diff --git a/test-files/golden-tests/javadoc/throw.xml b/test-files/golden-tests/javadoc/throw.xml new file mode 100644 index 0000000000..9744c2de35 --- /dev/null +++ b/test-files/golden-tests/javadoc/throw.xml @@ -0,0 +1,17 @@ + + + + + + + + brief + + + dest_size < ipv4_address::max_str_len + + + + + diff --git a/test-files/golden-tests/metadata/overloads.adoc b/test-files/golden-tests/metadata/overloads.adoc new file mode 100644 index 0000000000..96dd00d8da --- /dev/null +++ b/test-files/golden-tests/metadata/overloads.adoc @@ -0,0 +1,410 @@ += Reference +:mrdocs: + +[#index] +== Global namespace + + +=== Types + +[cols=1] +|=== +| Name + +| <> +| <> +|=== +=== Functions + +[cols=1] +|=== +| Name + +| <> +| <> +|=== + +[#A] +== A + + +=== Synopsis + + +Declared in `<overloads.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +struct A; +---- + +=== Member Functions + +[cols=1] +|=== +| Name + +| <> +|=== +=== Static Member Functions + +[cols=1] +|=== +| Name + +| <> +|=== +=== Friends + +[cols=1] +|=== +| Name + +| <> +| <> +|=== + + + +[#A-f] +== <>::f + + +=== Synopsis + + +Declared in `<overloads.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +void +<>(); +---- + +[.small]#<># + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +int +<>(int); +---- + +[.small]#<># + +[#A-f-08] +== <>::f + + +=== Synopsis + + +Declared in `<overloads.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +void +f(); +---- + +[#A-f-0e] +== <>::f + + +=== Synopsis + + +Declared in `<overloads.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +int +f(int); +---- + +[#A-g] +== <>::g + + +=== Synopsis + + +Declared in `<overloads.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +static +void +<>(); +---- + +[.small]#<># + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +static +int +<>(int); +---- + +[.small]#<># + +[#A-g-0a] +== <>::g + + +=== Synopsis + + +Declared in `<overloads.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +static +void +g(); +---- + +[#A-g-01] +== <>::g + + +=== Synopsis + + +Declared in `<overloads.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +static +int +g(int); +---- + +[#A-08friend-0a] +== operator== + + +=== Synopsis + + +Declared in `<overloads.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +friend +bool +operator==( + <>, + <>); +---- + +[#A-08friend-0e] +== operator== + + +=== Synopsis + + +Declared in `<overloads.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +friend +bool +operator==( + <>, + int); +---- + +[#B] +== B + + +=== Synopsis + + +Declared in `<overloads.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +struct B; +---- + + + + +[#f] +== f + + +=== Synopsis + + +Declared in `<overloads.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +void +<>(); +---- + +[.small]#<># + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +int +<>(int); +---- + +[.small]#<># + +[#f-0b] +== f + + +=== Synopsis + + +Declared in `<overloads.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +void +f(); +---- + +[#f-06] +== f + + +=== Synopsis + + +Declared in `<overloads.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +int +f(int); +---- + +[#operator_eq] +== operator== + + +=== Synopsis + + +Declared in `<overloads.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +bool +<>( + <>, + <>); +---- + +[.small]#<># + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +bool +<>( + <>, + int); +---- + +[.small]#<># + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +bool +<>( + <>, + <>); +---- + +[.small]#<># + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +bool +<>( + <>, + int); +---- + +[.small]#<># + +[#operator_eq-0a] +== operator== + + +=== Synopsis + + +Declared in `<overloads.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +bool +operator==( + <>, + <>); +---- + +[#operator_eq-0e] +== operator== + + +=== Synopsis + + +Declared in `<overloads.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +bool +operator==( + <>, + int); +---- + +[#operator_eq-08] +== operator== + + +=== Synopsis + + +Declared in `<overloads.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +bool +operator==( + <>, + <>); +---- + +[#operator_eq-07] +== operator== + + +=== Synopsis + + +Declared in `<overloads.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +bool +operator==( + <>, + int); +---- + + + +[.small]#Created with https://www.mrdocs.com[MrDocs]# diff --git a/test-files/golden-tests/metadata/overloads.cpp b/test-files/golden-tests/metadata/overloads.cpp new file mode 100644 index 0000000000..578b0b0ef7 --- /dev/null +++ b/test-files/golden-tests/metadata/overloads.cpp @@ -0,0 +1,19 @@ +struct A { + void f(); + int f(int); + + static void g(); + static int g(int); + + friend bool operator==(A, A); + friend bool operator==(A, int); +}; + +void f(); +int f(int); + +struct B {}; + +bool operator==(B, B); +bool operator==(B, int); + diff --git a/test-files/golden-tests/metadata/overloads.html b/test-files/golden-tests/metadata/overloads.html new file mode 100644 index 0000000000..e030fa1cb1 --- /dev/null +++ b/test-files/golden-tests/metadata/overloads.html @@ -0,0 +1,448 @@ + + +Reference + + +
+

Reference

+
+
+

Global namespace

+
+

Types

+ + + + + + + + + + + +
Name
A
B
+

Functions

+ + + + + + + + + + + +
Name
f
operator==
+
+
+
+

A

+
+
+

Synopsis

+
+Declared in <overloads.cpp>
+
+
+struct A;
+
+
+
+

Member Functions

+ + + + + + + + + + +
Name
f
+

Static Member Functions

+ + + + + + + + + + +
Name
g
+

Friends

+ + + + + + + + + + + +
Name
operator==
operator==
+ + +
+
+
+

A::f

+
+
+

Synopsis

+
+Declared in <overloads.cpp>
+
+
+void
+f();
+
+
» more... + +
+
+int
+f(int);
+
+
» more... + + +
+
+
+
+

A::f

+
+
+

Synopsis

+
+Declared in <overloads.cpp>
+
+
+void
+f();
+
+
+
+
+
+
+

A::f

+
+
+

Synopsis

+
+Declared in <overloads.cpp>
+
+
+int
+f(int);
+
+
+
+
+
+
+

A::g

+
+
+

Synopsis

+
+Declared in <overloads.cpp>
+
+
+static
+void
+g();
+
+
» more... + +
+
+static
+int
+g(int);
+
+
» more... + + +
+
+
+
+

A::g

+
+
+

Synopsis

+
+Declared in <overloads.cpp>
+
+
+static
+void
+g();
+
+
+
+
+
+
+

A::g

+
+
+

Synopsis

+
+Declared in <overloads.cpp>
+
+
+static
+int
+g(int);
+
+
+
+
+
+
+

operator==

+
+
+

Synopsis

+
+Declared in <overloads.cpp>
+
+
+friend
+bool
+operator==(
+    A,
+    A);
+
+
+
+
+
+
+

operator==

+
+
+

Synopsis

+
+Declared in <overloads.cpp>
+
+
+friend
+bool
+operator==(
+    A,
+    int);
+
+
+
+
+
+
+

B

+
+
+

Synopsis

+
+Declared in <overloads.cpp>
+
+
+struct B;
+
+
+
+ + +
+
+
+

f

+
+
+

Synopsis

+
+Declared in <overloads.cpp>
+
+
+void
+f();
+
+
» more... + +
+
+int
+f(int);
+
+
» more... + + +
+
+
+
+

f

+
+
+

Synopsis

+
+Declared in <overloads.cpp>
+
+
+void
+f();
+
+
+
+
+
+
+

f

+
+
+

Synopsis

+
+Declared in <overloads.cpp>
+
+
+int
+f(int);
+
+
+
+
+
+
+

operator==

+
+
+

Synopsis

+
+Declared in <overloads.cpp>
+
+
+bool
+operator==(
+    A,
+    A);
+
+
» more... + +
+
+bool
+operator==(
+    A,
+    int);
+
+
» more... + +
+
+bool
+operator==(
+    B,
+    B);
+
+
» more... + +
+
+bool
+operator==(
+    B,
+    int);
+
+
» more... + + +
+
+
+
+

operator==

+
+
+

Synopsis

+
+Declared in <overloads.cpp>
+
+
+bool
+operator==(
+    A,
+    A);
+
+
+
+
+
+
+

operator==

+
+
+

Synopsis

+
+Declared in <overloads.cpp>
+
+
+bool
+operator==(
+    A,
+    int);
+
+
+
+
+
+
+

operator==

+
+
+

Synopsis

+
+Declared in <overloads.cpp>
+
+
+bool
+operator==(
+    B,
+    B);
+
+
+
+
+
+
+

operator==

+
+
+

Synopsis

+
+Declared in <overloads.cpp>
+
+
+bool
+operator==(
+    B,
+    int);
+
+
+
+
+ +
+
+

Created with MrDocs

+
+ + \ No newline at end of file diff --git a/test-files/golden-tests/metadata/overloads.xml b/test-files/golden-tests/metadata/overloads.xml new file mode 100644 index 0000000000..825bad9dd3 --- /dev/null +++ b/test-files/golden-tests/metadata/overloads.xml @@ -0,0 +1,110 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test-files/golden-tests/snippets/sqrt.adoc b/test-files/golden-tests/snippets/sqrt.adoc index ab257e8e5c..931d91fd1a 100644 --- a/test-files/golden-tests/snippets/sqrt.adoc +++ b/test-files/golden-tests/snippets/sqrt.adoc @@ -64,8 +64,8 @@ This function calculates the square root of a given integral value using bit |=== | Name | Thrown on -| `if` -| the input value is negative. +| `std::invalid_argument` +| if the input value is negative. |=== diff --git a/test-files/golden-tests/snippets/sqrt.html b/test-files/golden-tests/snippets/sqrt.html index bea9414900..464d9bbfcd 100644 --- a/test-files/golden-tests/snippets/sqrt.html +++ b/test-files/golden-tests/snippets/sqrt.html @@ -79,8 +79,8 @@

Exceptions

-if -

the input value is negative.

+std::invalid_argument +

if the input value is negative.

diff --git a/test-files/golden-tests/snippets/sqrt.xml b/test-files/golden-tests/snippets/sqrt.xml index cb0db2e2ec..6929d29b2b 100644 --- a/test-files/golden-tests/snippets/sqrt.xml +++ b/test-files/golden-tests/snippets/sqrt.xml @@ -22,7 +22,7 @@ This function calculates the square root of a given integral value using bit manipulation. - the input value is negative. + if the input value is negative. The type of the input value. Must be an integral type.