[PATCH] D128774: [libTooling] Add a comment about comment parsing to getAssociatedRange.
jacobsa created this revision. jacobsa added a reviewer: klimek. Herald added a project: All. jacobsa requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. It took me multiple hours of debugging plus asking an expert for help to figure out why this function didn't do what it promised to do. It turns out there is a flag that needs to be set. Document this, in an attempt to save the next person the surprise. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D128774 Files: clang/include/clang/Tooling/Transformer/SourceCode.h Index: clang/include/clang/Tooling/Transformer/SourceCode.h === --- clang/include/clang/Tooling/Transformer/SourceCode.h +++ clang/include/clang/Tooling/Transformer/SourceCode.h @@ -41,6 +41,10 @@ /// terminators. The returned range consists of file locations, if valid file /// locations can be found for the associated content; otherwise, an invalid /// range is returned. +/// +/// Note that parsing comments is disabled by default. In order to select a +/// range containing associated comments, you may need to invoke the tool with +/// -fparse-all-comments. CharSourceRange getAssociatedRange(const Decl &D, ASTContext &Context); /// Returns the source-code text in the specified range. Index: clang/include/clang/Tooling/Transformer/SourceCode.h === --- clang/include/clang/Tooling/Transformer/SourceCode.h +++ clang/include/clang/Tooling/Transformer/SourceCode.h @@ -41,6 +41,10 @@ /// terminators. The returned range consists of file locations, if valid file /// locations can be found for the associated content; otherwise, an invalid /// range is returned. +/// +/// Note that parsing comments is disabled by default. In order to select a +/// range containing associated comments, you may need to invoke the tool with +/// -fparse-all-comments. CharSourceRange getAssociatedRange(const Decl &D, ASTContext &Context); /// Returns the source-code text in the specified range. ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D128774: [libTooling] Add a comment about comment parsing to getAssociatedRange.
jacobsa updated this revision to Diff 441203. jacobsa added a comment. Address formatting comment from ymandel. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D128774/new/ https://reviews.llvm.org/D128774 Files: clang/include/clang/Tooling/Transformer/SourceCode.h Index: clang/include/clang/Tooling/Transformer/SourceCode.h === --- clang/include/clang/Tooling/Transformer/SourceCode.h +++ clang/include/clang/Tooling/Transformer/SourceCode.h @@ -41,6 +41,10 @@ /// terminators. The returned range consists of file locations, if valid file /// locations can be found for the associated content; otherwise, an invalid /// range is returned. +/// +/// Note that parsing comments is disabled by default. In order to select a +/// range containing associated comments, you may need to invoke the tool with +/// `-fparse-all-comments`. CharSourceRange getAssociatedRange(const Decl &D, ASTContext &Context); /// Returns the source-code text in the specified range. Index: clang/include/clang/Tooling/Transformer/SourceCode.h === --- clang/include/clang/Tooling/Transformer/SourceCode.h +++ clang/include/clang/Tooling/Transformer/SourceCode.h @@ -41,6 +41,10 @@ /// terminators. The returned range consists of file locations, if valid file /// locations can be found for the associated content; otherwise, an invalid /// range is returned. +/// +/// Note that parsing comments is disabled by default. In order to select a +/// range containing associated comments, you may need to invoke the tool with +/// `-fparse-all-comments`. CharSourceRange getAssociatedRange(const Decl &D, ASTContext &Context); /// Returns the source-code text in the specified range. ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D128774: [libTooling] Add a comment about comment parsing to getAssociatedRange.
jacobsa marked an inline comment as done. jacobsa added a comment. @ymandel: thanks! Are you able to commit? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D128774/new/ https://reviews.llvm.org/D128774 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits