Skip to content

Commit

Permalink
FileCheck: Minor cleanup of the class Pattern
Browse files Browse the repository at this point in the history
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!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279832 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
compnerd committed Aug 26, 2016
1 parent f222adf commit 4403f2c
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions utils/FileCheck/FileCheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,18 +100,13 @@ 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;

/// 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
Expand All @@ -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; }
Expand Down

0 comments on commit 4403f2c

Please sign in to comment.