[llvm] r279832 - FileCheck: Minor cleanup of the class Pattern

Saleem Abdulrasool via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 26 09:18:40 PDT 2016


Author: compnerd
Date: Fri Aug 26 11:18:40 2016
New Revision: 279832

URL: http://llvm.org/viewvc/llvm-project?rev=279832&view=rev
Log:
FileCheck: Minor cleanup of the class Pattern

1. Add the "explicit" specifier to the single-argument constructor of Pattern
2. Reorder the fields to remove excessive padding (8 bytes).

Patch by Alexander Shaposhnikov!

Modified:
    llvm/trunk/utils/FileCheck/FileCheck.cpp

Modified: llvm/trunk/utils/FileCheck/FileCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/FileCheck/FileCheck.cpp?rev=279832&r1=279831&r2=279832&view=diff
==============================================================================
--- llvm/trunk/utils/FileCheck/FileCheck.cpp (original)
+++ llvm/trunk/utils/FileCheck/FileCheck.cpp Fri Aug 26 11:18:40 2016
@@ -100,8 +100,6 @@ namespace Check {
 class Pattern {
   SMLoc PatternLoc;
 
-  Check::CheckType CheckTy;
-
   /// FixedStr - If non-empty, this pattern is a fixed string match with the
   /// specified fixed string.
   StringRef FixedStr;
@@ -109,9 +107,6 @@ class Pattern {
   /// RegEx - If non-empty, this is a regex pattern.
   std::string RegExStr;
 
-  /// \brief Contains the number of line this pattern is in.
-  unsigned LineNumber;
-
   /// VariableUses - Entries in this vector map to uses of a variable in the
   /// pattern, e.g. "foo[[bar]]baz".  In this case, the RegExStr will contain
   /// "foobaz" and we'll get an entry in this vector that tells us to insert the
@@ -123,10 +118,13 @@ class Pattern {
   /// E.g. for the pattern "foo[[bar:.*]]baz", VariableDefs will map "bar" to 1.
   std::map<StringRef, unsigned> VariableDefs;
 
-public:
+  Check::CheckType CheckTy;
 
-  Pattern(Check::CheckType Ty)
-    : CheckTy(Ty) { }
+  /// \brief Contains the number of line this pattern is in.
+  unsigned LineNumber;
+
+public:
+  explicit Pattern(Check::CheckType Ty) : CheckTy(Ty) {}
 
   /// getLoc - Return the location in source code.
   SMLoc getLoc() const { return PatternLoc; }




More information about the llvm-commits mailing list