]> granicus.if.org Git - clang/commitdiff
[comment parsing] source fidelity for tparam command too.
authorFariborz Jahanian <fjahanian@apple.com>
Mon, 4 Mar 2013 20:08:47 +0000 (20:08 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Mon, 4 Mar 2013 20:08:47 +0000 (20:08 +0000)
// rdar://13066276

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176448 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/DiagnosticCommentKinds.td
lib/AST/CommentSema.cpp
test/Sema/warn-documentation.cpp

index 73c0dc9dd08d734f1fef5dfb59dd1fcae03d5391..829f98dfd75f4ca6517dc5246fb0180dae5e3aed 100644 (file)
@@ -87,10 +87,10 @@ def warn_doc_param_not_found : Warning<
 def note_doc_param_name_suggestion : Note<
   "did you mean '%0'?">;
 
-// \tparam command
+// tparam command
 
 def warn_doc_tparam_not_attached_to_a_template_decl : Warning<
-  "'\\tparam' command used in a comment that is not attached to "
+  "'%select{\\|@}0tparam' command used in a comment that is not attached to "
   "a template declaration">,
   InGroup<Documentation>, DefaultIgnore;
 
index 3e4b28356b9bcd7156f3dc4c0fc8e80c2257ad52..dab48e05df84aaeaa2c664679d2a38775c98deb9 100644 (file)
@@ -173,6 +173,7 @@ TParamCommandComment *Sema::actOnTParamCommandStart(SourceLocation LocBegin,
   if (!isTemplateOrSpecialization())
     Diag(Command->getLocation(),
          diag::warn_doc_tparam_not_attached_to_a_template_decl)
+      << AtCommand
       << Command->getCommandNameRange(Traits);
 
   return Command;
index 220f84508f4c501f78109649bbf2a97ee8e6be4c..d054fac99073b38b2b6c23032e29b856e3d475e9 100644 (file)
@@ -799,6 +799,10 @@ void test_attach37<int>::test_attach38(int aaa, int bbb) {}
 template<typename T>
 void test_attach37<T>::test_attach39(int aaa, int bbb) {}
 
+// expected-warning@+1 {{'@tparam' command used in a comment that is not attached to a template declaration}}
+/// @tparam T Aaa
+int test_tparam22;
+
 // We used to emit warning that parameter 'a' is not found because we parsed
 // the comment in context of the redeclaration which does not have parameter
 // names.