]> granicus.if.org Git - clang/commitdiff
AST: Improve a couple of comments and cast unused values to void
authorJustin Bogner <mail@justinbogner.com>
Sun, 16 Oct 2016 20:12:42 +0000 (20:12 +0000)
committerJustin Bogner <mail@justinbogner.com>
Sun, 16 Oct 2016 20:12:42 +0000 (20:12 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@284341 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/RawCommentList.cpp

index 8317f76b8569f8bb4ccde19a137437e03278fabb..881a7d9c61bee88a631357f58067ac32c0bf0a81 100644 (file)
@@ -175,8 +175,8 @@ StringRef RawComment::getRawTextSlow(const SourceManager &SourceMgr) const {
 }
 
 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(const ASTContext &Context) const {
 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::addDeserializedComments(ArrayRef<RawComment *> Deserialized
              BeforeThanCompare<RawComment>(SourceMgr));
   std::swap(Comments, MergedComments);
 }
-