[llvm-branch-commits] [cfe-branch] r168730 - in /cfe/branches/release_32: ./ include/clang/Basic/DiagnosticCommentKinds.td lib/AST/CommentParser.cpp test/Sema/warn-documentation.cpp
Pawel Wodnicki
pawel at 32bitmicro.com
Tue Nov 27 13:56:38 PST 2012
Author: pawel
Date: Tue Nov 27 15:56:38 2012
New Revision: 168730
URL: http://llvm.org/viewvc/llvm-project?rev=168730&view=rev
Log:
Merging r168277: into 3.2 release branch.
Documentation parsing: propely handle a lone '\endverbatim' and emit a warning.
We actually used to assert on this.
Thanks to NAKAMURA Takumi for noticing this!
Modified:
cfe/branches/release_32/ (props changed)
cfe/branches/release_32/include/clang/Basic/DiagnosticCommentKinds.td
cfe/branches/release_32/lib/AST/CommentParser.cpp
cfe/branches/release_32/test/Sema/warn-documentation.cpp
Propchange: cfe/branches/release_32/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Nov 27 15:56:38 2012
@@ -1,3 +1,3 @@
/cfe/branches/type-system-rewrite:134693-134817
-/cfe/trunk:167749,167762,167780,167788,167790,167813-167814,167868,167884,167920,167925,167935,168024,168063,168124,168297,168355,168379
+/cfe/trunk:167749,167762,167780,167788,167790,167813-167814,167868,167884,167920,167925,167935,168024,168063,168124,168277,168297,168355,168379
/cfe/trunk/test/SemaTemplate:126920
Modified: cfe/branches/release_32/include/clang/Basic/DiagnosticCommentKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_32/include/clang/Basic/DiagnosticCommentKinds.td?rev=168730&r1=168729&r2=168730&view=diff
==============================================================================
--- cfe/branches/release_32/include/clang/Basic/DiagnosticCommentKinds.td (original)
+++ cfe/branches/release_32/include/clang/Basic/DiagnosticCommentKinds.td Tue Nov 27 15:56:38 2012
@@ -131,5 +131,11 @@
def note_add_deprecation_attr : Note<
"add a deprecation attribute to the declaration to silence this warning">;
+// verbatim block commands
+
+def warn_verbatim_block_end_without_start : Warning<
+ "'\\%0' command does not terminate a verbatim text block">,
+ InGroup<Documentation>, DefaultIgnore;
+
} // end of documentation issue category
} // end of AST component
Modified: cfe/branches/release_32/lib/AST/CommentParser.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_32/lib/AST/CommentParser.cpp?rev=168730&r1=168729&r2=168730&view=diff
==============================================================================
--- cfe/branches/release_32/lib/AST/CommentParser.cpp (original)
+++ cfe/branches/release_32/lib/AST/CommentParser.cpp Tue Nov 27 15:56:38 2012
@@ -554,6 +554,14 @@
return parseBlockCommand();
break; // Block command ahead, finish this parapgaph.
}
+ if (Info->IsVerbatimBlockEndCommand) {
+ Diag(Tok.getLocation(),
+ diag::warn_verbatim_block_end_without_start)
+ << Info->Name
+ << SourceRange(Tok.getLocation(), Tok.getEndLocation());
+ consumeToken();
+ continue;
+ }
if (Info->IsUnknownCommand) {
Content.push_back(S.actOnUnknownCommand(Tok.getLocation(),
Tok.getEndLocation(),
Modified: cfe/branches/release_32/test/Sema/warn-documentation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_32/test/Sema/warn-documentation.cpp?rev=168730&r1=168729&r2=168730&view=diff
==============================================================================
--- cfe/branches/release_32/test/Sema/warn-documentation.cpp (original)
+++ cfe/branches/release_32/test/Sema/warn-documentation.cpp Tue Nov 27 15:56:38 2012
@@ -502,6 +502,24 @@
namespace test_returns_wrong_decl_10 { };
+// expected-warning at +1 {{'\endverbatim' command does not terminate a verbatim text block}}
+/// \endverbatim
+int test_verbatim_1();
+
+// expected-warning at +1 {{'\endcode' command does not terminate a verbatim text block}}
+/// \endcode
+int test_verbatim_2();
+
+// FIXME: we give a bad diagnostic here because we throw away non-documentation
+// comments early.
+//
+// expected-warning at +2 {{'\endcode' command does not terminate a verbatim text block}}
+/// \code
+// foo
+/// \endcode
+int test_verbatim_3();
+
+
// expected-warning at +1 {{empty paragraph passed to '\brief' command}}
int test1; ///< \brief\author Aaa
More information about the llvm-branch-commits
mailing list