Allow getRawCommentForDecl to find comments in macros
The key part of getRawCommentForDecl() required to find a comment is determining where to look for it. The location of the decl itself is usually right, except when macros get involved. The comment in the macro is stored in RawCommentList at the spelling location of the decl, not at the place where the decl comes into being as the macro is instantiated. getDeclLocForCommentSearch() already contained to branches to try handle comments inside macros, and we are able to replace them and handle more cases as well, by returning the spelling location of the decl's begin location. That is: SourceMgr.getSpellingLoc(D->getBeginLoc()) Reviewed By: gribozavr2 Differential Revision: https://reviews.llvm.org/D142560
Loading
Please sign in to comment