[clang] [clang-tools-extra] [clang] Don't add documentation comments to the AST if not requested (PR #206363)

via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 1 04:28:28 PDT 2026


================
@@ -74,8 +74,12 @@ Parser::Parser(Preprocessor &pp, Sema &actions, bool skipFunctionBodies)
   // destructor.
   initializePragmaHandlers();
 
-  CommentSemaHandler.reset(new ActionCommentHandler(actions));
-  PP.addCommentHandler(CommentSemaHandler.get());
+  // Only install the comment handler when some consumer may read documentation
+  // comments back.
+  if (actions.shouldRetainCommentsFromLexer(SourceLocation())) {
----------------
AnonMiraj wrote:

Yeah
reverted all changes to Pasrer.cpp

https://github.com/llvm/llvm-project/pull/206363


More information about the cfe-commits mailing list