r284341 - AST: Improve a couple of comments and cast unused values to void

Justin Bogner via cfe-commits cfe-commits at lists.llvm.org
Sun Oct 16 13:12:42 PDT 2016


Author: bogner
Date: Sun Oct 16 15:12:42 2016
New Revision: 284341

URL: http://llvm.org/viewvc/llvm-project?rev=284341&view=rev
Log:
AST: Improve a couple of comments and cast unused values to void

Make these comments a bit more explicit that they're initializing the
RawText member, and explicitly cast the unused result of getRawText to
void for clarity.

Modified:
    cfe/trunk/lib/AST/RawCommentList.cpp

Modified: cfe/trunk/lib/AST/RawCommentList.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/RawCommentList.cpp?rev=284341&r1=284340&r2=284341&view=diff
==============================================================================
--- cfe/trunk/lib/AST/RawCommentList.cpp (original)
+++ cfe/trunk/lib/AST/RawCommentList.cpp Sun Oct 16 15:12:42 2016
@@ -175,8 +175,8 @@ StringRef RawComment::getRawTextSlow(con
 }
 
 const char *RawComment::extractBriefText(const ASTContext &Context) const {
-  // Make sure that RawText is valid.
-  getRawText(Context.getSourceManager());
+  // Lazily initialize RawText using the accessor before using it.
+  (void)getRawText(Context.getSourceManager());
 
   // Since we will be copying the resulting text, all allocations made during
   // parsing are garbage after resulting string is formed.  Thus we can use
@@ -202,8 +202,8 @@ const char *RawComment::extractBriefText
 comments::FullComment *RawComment::parse(const ASTContext &Context,
                                          const Preprocessor *PP,
                                          const Decl *D) const {
-  // Make sure that RawText is valid.
-  getRawText(Context.getSourceManager());
+  // Lazily initialize RawText using the accessor before using it.
+  (void)getRawText(Context.getSourceManager());
 
   comments::Lexer L(Context.getAllocator(), Context.getDiagnostics(),
                     Context.getCommentCommandTraits(),
@@ -334,4 +334,3 @@ void RawCommentList::addDeserializedComm
              BeforeThanCompare<RawComment>(SourceMgr));
   std::swap(Comments, MergedComments);
 }
-




More information about the cfe-commits mailing list