File tree Expand file tree Collapse file tree 5 files changed +39
-1
lines changed Expand file tree Collapse file tree 5 files changed +39
-1
lines changed Original file line number Diff line number Diff line change @@ -57,6 +57,7 @@ def DeprecatedImplementations :DiagGroup<"deprecated-implementations">;
57
57
def : DiagGroup<"disabled-optimization">;
58
58
def : DiagGroup<"discard-qual">;
59
59
def : DiagGroup<"div-by-zero">;
60
+ def Doxygen : DiagGroup<"doxygen">;
60
61
def EmptyBody : DiagGroup<"empty-body">;
61
62
def ExtraTokens : DiagGroup<"extra-tokens">;
62
63
Original file line number Diff line number Diff line change @@ -5665,5 +5665,10 @@ def err_module_private_definition : Error<
5665
5665
"definition of %0 must be imported before it is required">;
5666
5666
}
5667
5667
5668
+ let CategoryName = "Documentation Issue" in {
5669
+ def warn_not_a_doxygen_trailing_member_comment : Warning<
5670
+ "not a Doxygen trailing comment">, InGroup<Doxygen>;
5671
+ } // end of documentation issue category
5672
+
5668
5673
} // end of sema component.
5669
5674
Original file line number Diff line number Diff line change @@ -1016,6 +1016,24 @@ LambdaScopeInfo *Sema::getCurLambda() {
1016
1016
1017
1017
void Sema::ActOnComment (SourceRange Comment) {
1018
1018
RawComment RC (SourceMgr, Comment);
1019
+ if (RC.isAlmostTrailingComment ()) {
1020
+ SourceRange MagicMarkerRange (Comment.getBegin (),
1021
+ Comment.getBegin ().getLocWithOffset (3 ));
1022
+ StringRef MagicMarkerText;
1023
+ switch (RC.getKind ()) {
1024
+ case RawComment::CK_OrdinaryBCPL:
1025
+ MagicMarkerText = " ///<" ;
1026
+ break ;
1027
+ case RawComment::CK_OrdinaryC:
1028
+ MagicMarkerText = " /**<" ;
1029
+ break ;
1030
+ default :
1031
+ llvm_unreachable (" if this is an almost Doxygen comment, "
1032
+ " it should be ordinary" );
1033
+ }
1034
+ Diag (Comment.getBegin (), diag::warn_not_a_doxygen_trailing_member_comment) <<
1035
+ FixItHint::CreateReplacement (MagicMarkerRange, MagicMarkerText);
1036
+ }
1019
1037
Context.addComment (RC);
1020
1038
}
1021
1039
Original file line number Diff line number Diff line change @@ -753,7 +753,7 @@ - (OtherRef)_copyOtherRef {
753
753
@end
754
754
755
755
// ===----------------------------------------------------------------------===//
756
- // <rdar://problem/6320065> false positive - init method returns an object
756
+ // <rdar://problem/6320065> false positive - init method returns an object
757
757
// owned by caller
758
758
// ===----------------------------------------------------------------------===//
759
759
Original file line number Diff line number Diff line change
1
+ // RUN: %clang_cc1 -fsyntax-only -verify %s
2
+ // RUN: %clang_cc1 -fsyntax-only -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
3
+ // RUN: cp %s %t
4
+ // RUN: %clang_cc1 -fsyntax-only -fixit %t
5
+ // RUN: %clang_cc1 -fsyntax-only -Werror %t
6
+
7
+ struct a {
8
+ int x ; //< comment // expected-warning {{not a Doxygen trailing comment}}
9
+ int y ; /*< comment */ // expected-warning {{not a Doxygen trailing comment}}
10
+ };
11
+
12
+ // CHECK: fix-it:"{{.*}}":{8:10-8:13}:"///<"
13
+ // CHECK: fix-it:"{{.*}}":{9:10-9:13}:"/**<"
14
+
You can’t perform that action at this time.
0 commit comments