[NFC] Move CommentOpts checks to the call sites that depend on it.
authorDavid L. Jones <dlj@google.com>
Thu, 1 Mar 2018 22:41:53 +0000 (22:41 +0000)
committerDavid L. Jones <dlj@google.com>
Thu, 1 Mar 2018 22:41:53 +0000 (22:41 +0000)
commit40388bdfb96f6cae8c1dcd5ca341c9e3dd2c8d31
tree275d0639b8e7d28f9e4033d4730d7432a68418e9
parente7ca6f5456a3b5a836a39b3c99e7d1d740883805
[NFC] Move CommentOpts checks to the call sites that depend on it.

When parsing comments, for example, for -Wdocumentation, slightly different
behaviour occurs when -fparse-all-comments is specified. However, these
differences are subtle:

 1. All comments are saved during parsing, regardless of whether they are doc
    comments or not.
 2. "Maybe-doc" comments, like //<, //!, etc, are saved as such, instead of
    marking them as ordinary comments. The maybe-doc type of comment is never
    saved otherwise. (Warning on these is the impetus of -Wdocumentation.)
 3. All comments are treated as doc comments in ASTContext, even if they are
    ordinary.

This change moves the logic for checking CommentOptions.ParseAllComments closer
to where it has an effect. The overall logic is unchanged, but checks of the
ParseAllComments flag are now done where the effect will be clearer.

Reviewers: rsmith

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D43663

llvm-svn: 326501
clang/include/clang/AST/ASTContext.h
clang/include/clang/AST/RawCommentList.h
clang/lib/AST/ASTContext.cpp
clang/lib/AST/RawCommentList.cpp
clang/lib/Sema/Sema.cpp
clang/lib/Serialization/ASTReader.cpp