Fix code style violation in compiler/preprocessor

BUG=angle:650
TEST=no behavior change

Change-Id: Ib52f15f6471fc7897b66d11baee11216cf08158a
Reviewed-on: https://chromium-review.googlesource.com/199591
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Tested-by: Zhenyao Mo <zmo@chromium.org>
diff --git a/src/compiler/preprocessor/DirectiveParser.cpp b/src/compiler/preprocessor/DirectiveParser.cpp
index 9834b9b..6434d5c 100644
--- a/src/compiler/preprocessor/DirectiveParser.cpp
+++ b/src/compiler/preprocessor/DirectiveParser.cpp
@@ -35,9 +35,8 @@
     DIRECTIVE_VERSION,
     DIRECTIVE_LINE
 };
-}  // namespace
 
-static DirectiveType getDirective(const pp::Token* token)
+DirectiveType getDirective(const pp::Token *token)
 {
     static const std::string kDirectiveDefine("define");
     static const std::string kDirectiveUndef("undef");
@@ -58,35 +57,35 @@
 
     if (token->text == kDirectiveDefine)
         return DIRECTIVE_DEFINE;
-    else if (token->text == kDirectiveUndef)
+    if (token->text == kDirectiveUndef)
         return DIRECTIVE_UNDEF;
-    else if (token->text == kDirectiveIf)
+    if (token->text == kDirectiveIf)
         return DIRECTIVE_IF;
-    else if (token->text == kDirectiveIfdef)
+    if (token->text == kDirectiveIfdef)
         return DIRECTIVE_IFDEF;
-    else if (token->text == kDirectiveIfndef)
+    if (token->text == kDirectiveIfndef)
         return DIRECTIVE_IFNDEF;
-    else if (token->text == kDirectiveElse)
+    if (token->text == kDirectiveElse)
         return DIRECTIVE_ELSE;
-    else if (token->text == kDirectiveElif)
+    if (token->text == kDirectiveElif)
         return DIRECTIVE_ELIF;
-    else if (token->text == kDirectiveEndif)
+    if (token->text == kDirectiveEndif)
         return DIRECTIVE_ENDIF;
-    else if (token->text == kDirectiveError)
+    if (token->text == kDirectiveError)
         return DIRECTIVE_ERROR;
-    else if (token->text == kDirectivePragma)
+    if (token->text == kDirectivePragma)
         return DIRECTIVE_PRAGMA;
-    else if (token->text == kDirectiveExtension)
+    if (token->text == kDirectiveExtension)
         return DIRECTIVE_EXTENSION;
-    else if (token->text == kDirectiveVersion)
+    if (token->text == kDirectiveVersion)
         return DIRECTIVE_VERSION;
-    else if (token->text == kDirectiveLine)
+    if (token->text == kDirectiveLine)
         return DIRECTIVE_LINE;
 
     return DIRECTIVE_NONE;
 }
 
-static bool isConditionalDirective(DirectiveType directive)
+bool isConditionalDirective(DirectiveType directive)
 {
     switch (directive)
     {
@@ -103,12 +102,12 @@
 }
 
 // Returns true if the token represents End Of Directive.
-static bool isEOD(const pp::Token* token)
+bool isEOD(const pp::Token *token)
 {
     return (token->type == '\n') || (token->type == pp::Token::LAST);
 }
 
-static void skipUntilEOD(pp::Lexer* lexer, pp::Token* token)
+void skipUntilEOD(pp::Lexer *lexer, pp::Token *token)
 {
     while(!isEOD(token))
     {
@@ -116,7 +115,7 @@
     }
 }
 
-static bool isMacroNameReserved(const std::string& name)
+bool isMacroNameReserved(const std::string &name)
 {
     // Names prefixed with "GL_" are reserved.
     if (name.substr(0, 3) == "GL_")
@@ -129,30 +128,32 @@
     return false;
 }
 
-static bool isMacroPredefined(const std::string& name,
-                              const pp::MacroSet& macroSet)
+bool isMacroPredefined(const std::string &name,
+                       const pp::MacroSet &macroSet)
 {
     pp::MacroSet::const_iterator iter = macroSet.find(name);
     return iter != macroSet.end() ? iter->second.predefined : false;
 }
 
+}  // namespace anonymous
+
 namespace pp
 {
 
 class DefinedParser : public Lexer
 {
   public:
-    DefinedParser(Lexer* lexer,
-                  const MacroSet* macroSet,
-                  Diagnostics* diagnostics) :
-        mLexer(lexer),
-        mMacroSet(macroSet),
-        mDiagnostics(diagnostics)
+    DefinedParser(Lexer *lexer,
+                  const MacroSet *macroSet,
+                  Diagnostics *diagnostics)
+        : mLexer(lexer),
+          mMacroSet(macroSet),
+          mDiagnostics(diagnostics)
     {
     }
 
   protected:
-    virtual void lex(Token* token)
+    virtual void lex(Token *token)
     {
         static const std::string kDefined("defined");
 
@@ -199,24 +200,24 @@
     }
 
   private:
-    Lexer* mLexer;
-    const MacroSet* mMacroSet;
-    Diagnostics* mDiagnostics;
+    Lexer *mLexer;
+    const MacroSet *mMacroSet;
+    Diagnostics *mDiagnostics;
 };
 
-DirectiveParser::DirectiveParser(Tokenizer* tokenizer,
-                                 MacroSet* macroSet,
-                                 Diagnostics* diagnostics,
-                                 DirectiveHandler* directiveHandler) :
-    mPastFirstStatement(false),
-    mTokenizer(tokenizer),
-    mMacroSet(macroSet),
-    mDiagnostics(diagnostics),
-    mDirectiveHandler(directiveHandler)
+DirectiveParser::DirectiveParser(Tokenizer *tokenizer,
+                                 MacroSet *macroSet,
+                                 Diagnostics *diagnostics,
+                                 DirectiveHandler *directiveHandler)
+    : mPastFirstStatement(false),
+      mTokenizer(tokenizer),
+      mMacroSet(macroSet),
+      mDiagnostics(diagnostics),
+      mDirectiveHandler(directiveHandler)
 {
 }
 
-void DirectiveParser::lex(Token* token)
+void DirectiveParser::lex(Token *token)
 {
     do
     {
@@ -232,19 +233,20 @@
         {
             if (!mConditionalStack.empty())
             {
-                const ConditionalBlock& block = mConditionalStack.back();
+                const ConditionalBlock &block = mConditionalStack.back();
                 mDiagnostics->report(Diagnostics::PP_CONDITIONAL_UNTERMINATED,
                                      block.location, block.type);
             }
             break;
         }
 
-    } while (skipping() || (token->type == '\n'));
+    }
+    while (skipping() || (token->type == '\n'));
 
     mPastFirstStatement = true;
 }
 
-void DirectiveParser::parseDirective(Token* token)
+void DirectiveParser::parseDirective(Token *token)
 {
     assert(token->type == Token::PP_HASH);
 
@@ -324,7 +326,7 @@
     }
 }
 
-void DirectiveParser::parseDefine(Token* token)
+void DirectiveParser::parseDefine(Token *token)
 {
     assert(getDirective(token) == DIRECTIVE_DEFINE);
 
@@ -357,14 +359,16 @@
     {
         // Function-like macro. Collect arguments.
         macro.type = Macro::kTypeFunc;
-        do {
+        do
+        {
             mTokenizer->lex(token);
             if (token->type != Token::IDENTIFIER)
                 break;
             macro.parameters.push_back(token->text);
 
             mTokenizer->lex(token);  // Get ','.
-        } while (token->type == ',');
+        }
+        while (token->type == ',');
 
         if (token->type != ')')
         {
@@ -404,7 +408,7 @@
     mMacroSet->insert(std::make_pair(macro.name, macro));
 }
 
-void DirectiveParser::parseUndef(Token* token)
+void DirectiveParser::parseUndef(Token *token)
 {
     assert(getDirective(token) == DIRECTIVE_UNDEF);
 
@@ -433,25 +437,25 @@
     mTokenizer->lex(token);
 }
 
-void DirectiveParser::parseIf(Token* token)
+void DirectiveParser::parseIf(Token *token)
 {
     assert(getDirective(token) == DIRECTIVE_IF);
     parseConditionalIf(token);
 }
 
-void DirectiveParser::parseIfdef(Token* token)
+void DirectiveParser::parseIfdef(Token *token)
 {
     assert(getDirective(token) == DIRECTIVE_IFDEF);
     parseConditionalIf(token);
 }
 
-void DirectiveParser::parseIfndef(Token* token)
+void DirectiveParser::parseIfndef(Token *token)
 {
     assert(getDirective(token) == DIRECTIVE_IFNDEF);
     parseConditionalIf(token);
 }
 
-void DirectiveParser::parseElse(Token* token)
+void DirectiveParser::parseElse(Token *token)
 {
     assert(getDirective(token) == DIRECTIVE_ELSE);
 
@@ -463,7 +467,7 @@
         return;
     }
 
-    ConditionalBlock& block = mConditionalStack.back();
+    ConditionalBlock &block = mConditionalStack.back();
     if (block.skipBlock)
     {
         // No diagnostics. Just skip the whole line.
@@ -492,7 +496,7 @@
     }
 }
 
-void DirectiveParser::parseElif(Token* token)
+void DirectiveParser::parseElif(Token *token)
 {
     assert(getDirective(token) == DIRECTIVE_ELIF);
 
@@ -504,7 +508,7 @@
         return;
     }
 
-    ConditionalBlock& block = mConditionalStack.back();
+    ConditionalBlock &block = mConditionalStack.back();
     if (block.skipBlock)
     {
         // No diagnostics. Just skip the whole line.
@@ -532,7 +536,7 @@
     block.foundValidGroup = expression != 0;
 }
 
-void DirectiveParser::parseEndif(Token* token)
+void DirectiveParser::parseEndif(Token *token)
 {
     assert(getDirective(token) == DIRECTIVE_ENDIF);
 
@@ -556,7 +560,7 @@
     }
 }
 
-void DirectiveParser::parseError(Token* token)
+void DirectiveParser::parseError(Token *token)
 {
     assert(getDirective(token) == DIRECTIVE_ERROR);
 
@@ -571,7 +575,7 @@
 }
 
 // Parses pragma of form: #pragma name[(value)].
-void DirectiveParser::parsePragma(Token* token)
+void DirectiveParser::parsePragma(Token *token)
 {
     assert(getDirective(token) == DIRECTIVE_PRAGMA);
 
@@ -627,7 +631,7 @@
     }
 }
 
-void DirectiveParser::parseExtension(Token* token)
+void DirectiveParser::parseExtension(Token *token)
 {
     assert(getDirective(token) == DIRECTIVE_EXTENSION);
 
@@ -694,7 +698,7 @@
         mDirectiveHandler->handleExtension(token->location, name, behavior);
 }
 
-void DirectiveParser::parseVersion(Token* token)
+void DirectiveParser::parseVersion(Token *token)
 {
     assert(getDirective(token) == DIRECTIVE_VERSION);
 
@@ -772,7 +776,7 @@
     }
 }
 
-void DirectiveParser::parseLine(Token* token)
+void DirectiveParser::parseLine(Token *token)
 {
     assert(getDirective(token) == DIRECTIVE_LINE);
 
@@ -841,19 +845,21 @@
     if (valid)
     {
         mTokenizer->setLineNumber(line);
-        if (state == FILE_NUMBER + 1) mTokenizer->setFileNumber(file);
+        if (state == FILE_NUMBER + 1)
+            mTokenizer->setFileNumber(file);
     }
 }
 
 bool DirectiveParser::skipping() const
 {
-    if (mConditionalStack.empty()) return false;
+    if (mConditionalStack.empty())
+        return false;
 
     const ConditionalBlock& block = mConditionalStack.back();
     return block.skipBlock || block.skipGroup;
 }
 
-void DirectiveParser::parseConditionalIf(Token* token)
+void DirectiveParser::parseConditionalIf(Token *token)
 {
     ConditionalBlock block;
     block.type = token->text;
@@ -894,7 +900,7 @@
     mConditionalStack.push_back(block);
 }
 
-int DirectiveParser::parseExpressionIf(Token* token)
+int DirectiveParser::parseExpressionIf(Token *token)
 {
     assert((getDirective(token) == DIRECTIVE_IF) ||
            (getDirective(token) == DIRECTIVE_ELIF));
@@ -918,7 +924,7 @@
     return expression;
 }
 
-int DirectiveParser::parseExpressionIfdef(Token* token)
+int DirectiveParser::parseExpressionIfdef(Token *token)
 {
     assert((getDirective(token) == DIRECTIVE_IFDEF) ||
            (getDirective(token) == DIRECTIVE_IFNDEF));