Skip to content

Commit 072e81d

Browse files
committed
Revert "[Clang][Comments] Attach comments to decl even if preproc directives are in between (#88367)"
This reverts commit 9f04d75. There was post-commit feedback on the direction this PR took.
1 parent 2f89d4a commit 072e81d

File tree

6 files changed

+5
-358
lines changed

6 files changed

+5
-358
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -147,22 +147,6 @@ Clang Frontend Potentially Breaking Changes
147147
- The ``hasTypeLoc`` AST matcher will no longer match a ``classTemplateSpecializationDecl``;
148148
existing uses should switch to ``templateArgumentLoc`` or ``hasAnyTemplateArgumentLoc`` instead.
149149

150-
- The comment parser now matches comments to declarations even if there is a
151-
preprocessor macro in between the comment and declaration. This change is
152-
intended to improve Clang's support for parsing documentation comments and
153-
to better conform to Doxygen's behavior.
154-
155-
This has the potential to cause ``-Wdocumentation`` warnings, especially in
156-
cases where a function-like macro has a documentation comment and is followed
157-
immediately by a normal function. The function-like macro's documentation
158-
comments will be attributed to the subsequent function and may cause
159-
``-Wdocumentation`` warnings such as mismatched parameter names, or invalid
160-
return documentation comments.
161-
162-
In cases where the ``-Wdocumentation`` warnings are thrown, the suggested fix
163-
is to document the declaration following the macro so that the warnings are
164-
fixed.
165-
166150
Clang Python Bindings Potentially Breaking Changes
167151
--------------------------------------------------
168152
- Renamed ``CursorKind`` variant 272 from ``OMP_TEAMS_DISTRIBUTE_DIRECTIVE``

clang/lib/AST/ASTContext.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -284,10 +284,9 @@ RawComment *ASTContext::getRawCommentForDeclNoCacheImpl(
284284
StringRef Text(Buffer + CommentEndOffset,
285285
DeclLocDecomp.second - CommentEndOffset);
286286

287-
// There should be no other declarations between comment and declaration.
288-
// Preprocessor directives are implicitly allowed to be between a comment and
289-
// its associated decl.
290-
if (Text.find_last_of(";{}@") != StringRef::npos)
287+
// There should be no other declarations or preprocessor directives between
288+
// comment and declaration.
289+
if (Text.find_last_of(";{}#@") != StringRef::npos)
291290
return nullptr;
292291

293292
return CommentBeforeDecl;

clang/lib/Headers/amxcomplexintrin.h

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -107,24 +107,6 @@
107107
/// The 2nd source tile. Max size is 1024 Bytes.
108108
#define _tile_cmmrlfp16ps(dst, a, b) __builtin_ia32_tcmmrlfp16ps(dst, a, b)
109109

110-
/// Perform matrix multiplication of two tiles containing complex elements and
111-
/// accumulate the results into a packed single precision tile.
112-
///
113-
/// \param m
114-
/// The number of rows in the first tile and the number of rows in the result
115-
/// tile.
116-
/// \param n
117-
/// The number of columns in the second tile and the number of columns in the
118-
/// result tile.
119-
/// \param k
120-
/// The number of columns in the first tile and the number of rows in the
121-
/// second tile.
122-
/// \param dst
123-
/// Pointer to the destination tile where the result will be stored.
124-
/// \param src1
125-
/// Pointer to the first source tile.
126-
/// \param src2
127-
/// Pointer to the second source tile.
128110
static __inline__ _tile1024i __DEFAULT_FN_ATTRS_COMPLEX
129111
_tile_cmmimfp16ps_internal(unsigned short m, unsigned short n, unsigned short k,
130112
_tile1024i dst, _tile1024i src1, _tile1024i src2) {

clang/lib/Headers/ia32intrin.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -533,13 +533,6 @@ __rdtscp(unsigned int *__A) {
533533
/// \see __rdpmc
534534
#define _rdpmc(A) __rdpmc(A)
535535

536-
/// Invalidates the contents of the processor's internal caches.
537-
/// This function writes back and invalidates all modified cache lines in
538-
/// the processor.
539-
///
540-
/// \headerfile <x86intrin.h>
541-
///
542-
/// This intrinsic corresponds to the \c WBINVD instruction.
543536
static __inline__ void __DEFAULT_FN_ATTRS
544537
_wbinvd(void) {
545538
__builtin_ia32_wbinvd();

clang/test/Index/annotate-comments.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,9 +204,9 @@ void isdoxy45(void);
204204
/// Ggg. IS_DOXYGEN_END
205205
void isdoxy46(void);
206206

207-
/// isdoxy47 IS_DOXYGEN_SINGLE
207+
/// IS_DOXYGEN_NOT_ATTACHED
208208
#define FOO
209-
void isdoxy47(void);
209+
void notdoxy47(void);
210210

211211
/// IS_DOXYGEN_START Aaa bbb
212212
/// \param ccc
@@ -330,7 +330,6 @@ void isdoxy54(int);
330330
// CHECK: annotate-comments.cpp:185:6: FunctionDecl=isdoxy44:{{.*}} BriefComment=[IS_DOXYGEN_START Aaa bbb ccc.]
331331
// CHECK: annotate-comments.cpp:195:6: FunctionDecl=isdoxy45:{{.*}} BriefComment=[Ddd eee. Fff.]
332332
// CHECK: annotate-comments.cpp:205:6: FunctionDecl=isdoxy46:{{.*}} BriefComment=[Ddd eee. Fff.]
333-
// CHECK: annotate-comments.cpp:209:6: FunctionDecl=isdoxy47:{{.*}} isdoxy47 IS_DOXYGEN_SINGLE
334333
// CHECK: annotate-comments.cpp:214:6: FunctionDecl=isdoxy48:{{.*}} BriefComment=[IS_DOXYGEN_START Aaa bbb]
335334
// CHECK: annotate-comments.cpp:218:6: FunctionDecl=isdoxy49:{{.*}} BriefComment=[IS_DOXYGEN_START Aaa]
336335
// CHECK: annotate-comments.cpp:222:6: FunctionDecl=isdoxy50:{{.*}} BriefComment=[Returns ddd IS_DOXYGEN_END]

0 commit comments

Comments
 (0)