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 @@
ifthe input value is negative.
+std::invalid_argumentif the input value is negative.
brief
+ + +<throw.cpp>
+
+void
+f();
+
+
+| Name | +Thrown on | +
|---|---|
std::length_error |
+
|
+
| Name | +
|---|
A |
B |
| Name | +
|---|
f |
operator== |
<overloads.cpp>
+
+struct A;
+
+
+| Name | +
|---|
f |
| Name | +
|---|
g |
| Name | +
|---|
operator== |
operator== |
<overloads.cpp>
+
+void
+f();
+
+
+<overloads.cpp>
+
+int
+f(int);
+
+
+<overloads.cpp>
+
+static
+void
+g();
+
+
+<overloads.cpp>
+
+static
+int
+g(int);
+
+
+<overloads.cpp>
+
+struct B;
+
+
+<overloads.cpp>
+
+void
+f();
+
+
+<overloads.cpp>
+
+int
+f(int);
+
+
+<overloads.cpp>
+
+bool
+operator==(
+ A,
+ A);
+
+» more...
+
+
+
+bool
+operator==(
+ A,
+ int);
+
+» more...
+
+
+
+bool
+operator==(
+ B,
+ B);
+
+» more...
+
+
+
+bool
+operator==(
+ B,
+ int);
+
+» more...
+
+
+ifthe input value is negative.
+std::invalid_argumentif the input value is negative.