[clang] 36c1e56 - [clang-format][NFC] Simplify the UnwrappedLine constructor

Owen Pan via cfe-commits cfe-commits at lists.llvm.org
Sat Sep 30 02:05:00 PDT 2023


Author: Owen Pan
Date: 2023-09-30T02:03:14-07:00
New Revision: 36c1e568bb4f8e482e3f713c8cb9460c5cf19863

URL: https://github.com/llvm/llvm-project/commit/36c1e568bb4f8e482e3f713c8cb9460c5cf19863
DIFF: https://github.com/llvm/llvm-project/commit/36c1e568bb4f8e482e3f713c8cb9460c5cf19863.diff

LOG: [clang-format][NFC] Simplify the UnwrappedLine constructor

Added: 
    

Modified: 
    clang/lib/Format/UnwrappedLineParser.h

Removed: 
    


################################################################################
diff  --git a/clang/lib/Format/UnwrappedLineParser.h b/clang/lib/Format/UnwrappedLineParser.h
index 8faa99bdb6b5c55..4138baaabe2693d 100644
--- a/clang/lib/Format/UnwrappedLineParser.h
+++ b/clang/lib/Format/UnwrappedLineParser.h
@@ -40,26 +40,26 @@ struct UnwrappedLineNode;
 /// \c UnwrappedLineFormatter. The key property is that changing the formatting
 /// within an unwrapped line does not affect any other unwrapped lines.
 struct UnwrappedLine {
-  UnwrappedLine();
+  UnwrappedLine() = default;
 
   /// The \c Tokens comprising this \c UnwrappedLine.
   std::list<UnwrappedLineNode> Tokens;
 
   /// The indent level of the \c UnwrappedLine.
-  unsigned Level;
+  unsigned Level = 0;
 
   /// The \c PPBranchLevel (adjusted for header guards) if this line is a
   /// \c InMacroBody line, and 0 otherwise.
-  unsigned PPLevel;
+  unsigned PPLevel = 0;
 
   /// Whether this \c UnwrappedLine is part of a preprocessor directive.
-  bool InPPDirective;
+  bool InPPDirective = false;
   /// Whether this \c UnwrappedLine is part of a pramga directive.
-  bool InPragmaDirective;
+  bool InPragmaDirective = false;
   /// Whether it is part of a macro body.
-  bool InMacroBody;
+  bool InMacroBody = false;
 
-  bool MustBeDeclaration;
+  bool MustBeDeclaration = false;
 
   /// \c True if this line should be indented by ContinuationIndent in
   /// addition to the normal indention level.
@@ -410,11 +410,6 @@ struct UnwrappedLineNode {
   SmallVector<UnwrappedLine, 0> Children;
 };
 
-inline UnwrappedLine::UnwrappedLine()
-    : Level(0), PPLevel(0), InPPDirective(false), InPragmaDirective(false),
-      InMacroBody(false), MustBeDeclaration(false),
-      MatchingOpeningBlockLineIndex(kInvalidIndex) {}
-
 } // end namespace format
 } // end namespace clang
 


        


More information about the cfe-commits mailing list