diff --git a/frontend/include/chpl/uast/PragmaList.h b/frontend/include/chpl/uast/PragmaList.h index aff4378c5e82..46ea7053c100 100644 --- a/frontend/include/chpl/uast/PragmaList.h +++ b/frontend/include/chpl/uast/PragmaList.h @@ -415,6 +415,7 @@ PRAGMA(NO_COPY_RETURN, ypr, "no copy return", ncm) PRAGMA(NO_COPY_RETURNS_OWNED, ypr, "no copy returns owned", ncm) PRAGMA(NO_DEFAULT_FUNCTIONS, ypr, "no default functions", ncm) PRAGMA(NO_DOC, ypr, "no doc", "do not generate chpldoc documentation for this symbol") +PRAGMA(NO_WHERE_DOC, ypr, "no where doc", "do not include the where clause in chpldoc documentation for this symbol") PRAGMA(NO_IMPLICIT_COPY, ypr, "no implicit copy", "function does not require autoCopy/autoDestroy") // This flag disables initialization entirely. In contrast, `= noinit` diff --git a/modules/internal/ChapelRange.chpl b/modules/internal/ChapelRange.chpl index 7cba05c63a04..ebb61ae50628 100644 --- a/modules/internal/ChapelRange.chpl +++ b/modules/internal/ChapelRange.chpl @@ -1843,6 +1843,7 @@ proc range.safeCast(type t: range(?)) { the original bounds and/or stride do not fit in the new idxType or when the original stride is not legal for the new `strides` parameter. */ +pragma "no where doc" proc range.tryCast(type t: range(?)) where chpl_tryCastIsSafe(this, t) { const r = this; checkBounds(t, r); diff --git a/test/chpldoc/functions/WhereClause.doc.chpl b/test/chpldoc/functions/WhereClause.doc.chpl index f91c064fb607..d7cd93794c6e 100644 --- a/test/chpldoc/functions/WhereClause.doc.chpl +++ b/test/chpldoc/functions/WhereClause.doc.chpl @@ -30,6 +30,11 @@ module M { writeln("processRange 2"); } + pragma "no where doc" + proc processRangeNW(r: range) where r.low > 1 { + writeln("processRange no where"); + } + // From borrowed-in-where.chpl proc foo(type t) where isSubtype(t, int) { writeln("In foo where"); diff --git a/test/chpldoc/functions/WhereClause.doc.good b/test/chpldoc/functions/WhereClause.doc.good index 075b5174c4a1..51e7f39af927 100644 --- a/test/chpldoc/functions/WhereClause.doc.good +++ b/test/chpldoc/functions/WhereClause.doc.good @@ -33,6 +33,8 @@ or .. function:: proc processRange(r: range) where r.low > 1 +.. function:: proc processRangeNW(r: range) + .. function:: proc foo(type t) where isSubtype(t, int) .. function:: operator +(a: int, b: int) where a > 0 diff --git a/tools/chpldoc/chpldoc.cpp b/tools/chpldoc/chpldoc.cpp index 4de08496e609..7e2cc9b8eb14 100644 --- a/tools/chpldoc/chpldoc.cpp +++ b/tools/chpldoc/chpldoc.cpp @@ -339,6 +339,13 @@ static bool isNoDoc(const Decl* e) { return false; } +static bool isNoWhereDoc(const Function* f) { + if (auto attrs = f->attributeGroup()) + if (attrs->hasPragma(pragmatags::PRAGMA_NO_WHERE_DOC)) + return true; + return false; +} + static std::vector splitLines(const std::string& s) { std::stringstream ss(s); std::string line; @@ -1145,8 +1152,10 @@ struct RstSignatureVisitor { // Where Clause if (const AstNode* wc = f->whereClause()) { + if (!isNoWhereDoc(f)) { os_ << " where "; wc->traverse(*this); + } } return false;