From 6c64c2c86a9c6a7ab83a46db0a1047e5e2882a49 Mon Sep 17 00:00:00 2001 From: Lang Hames Date: Sat, 30 Jul 2016 21:34:04 +0000 Subject: [PATCH] [Support] Add doxygen @code tags to example code in Error comments. llvm-svn: 277282 --- llvm/include/llvm/Support/Error.h | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/llvm/include/llvm/Support/Error.h b/llvm/include/llvm/Support/Error.h index 0064e09..afd2660 100644 --- a/llvm/include/llvm/Support/Error.h +++ b/llvm/include/llvm/Support/Error.h @@ -86,12 +86,14 @@ private: /// Error instance is in. For Error instances indicating success, it /// is sufficient to invoke the boolean conversion operator. E.g.: /// +/// @code{.cpp} /// Error foo(<...>); /// /// if (auto E = foo(<...>)) /// return E; // <- Return E if it is in the error state. /// // We have verified that E was in the success state. It can now be safely /// // destroyed. +/// @endcode /// /// A success value *can not* be dropped. For example, just calling 'foo(<...>)' /// without testing the return value will raise a runtime error, even if foo @@ -100,6 +102,7 @@ private: /// For Error instances representing failure, you must use either the /// handleErrors or handleAllErrors function with a typed handler. E.g.: /// +/// @code{.cpp} /// class MyErrorInfo : public ErrorInfo { /// // Custom error info. /// }; @@ -122,6 +125,7 @@ private: /// ); /// // Note - we must check or return NewE in case any of the handlers /// // returned a new error. +/// @endcode /// /// The handleAllErrors function is identical to handleErrors, except /// that it has a void return type, and requires all errors to be handled and @@ -570,11 +574,13 @@ inline void consumeError(Error Err) { /// to check the result. This helper performs these actions automatically using /// RAII: /// -/// Result foo(Error &Err) { -/// ErrorAsOutParameter ErrAsOutParam(&Err); // 'Checked' flag set -/// // -/// // <- 'Checked' flag auto-cleared when ErrAsOutParam is destructed. -/// } +/// @code{.cpp} +/// Result foo(Error &Err) { +/// ErrorAsOutParameter ErrAsOutParam(&Err); // 'Checked' flag set +/// // +/// // <- 'Checked' flag auto-cleared when ErrAsOutParam is destructed. +/// } +/// @endcode /// /// ErrorAsOutParameter takes an Error* rather than Error& so that it can be /// used with optional Errors (Error pointers that are allowed to be null). If -- 2.7.4