diff options
Diffstat (limited to 'lib/Lex/PPDirectives.cpp')
-rw-r--r-- | lib/Lex/PPDirectives.cpp | 90 |
1 files changed, 45 insertions, 45 deletions
diff --git a/lib/Lex/PPDirectives.cpp b/lib/Lex/PPDirectives.cpp index 3e871ae7ab..cea0798f6e 100644 --- a/lib/Lex/PPDirectives.cpp +++ b/lib/Lex/PPDirectives.cpp @@ -81,17 +81,17 @@ void Preprocessor::ReleaseMacroInfo(MacroInfo *MI) { } /// DiscardUntilEndOfDirective - Read and discard all tokens remaining on the -/// current line until the tok::eom token is found. +/// current line until the tok::eod token is found. void Preprocessor::DiscardUntilEndOfDirective() { Token Tmp; do { LexUnexpandedToken(Tmp); assert(Tmp.isNot(tok::eof) && "EOF seen while discarding directive tokens"); - } while (Tmp.isNot(tok::eom)); + } while (Tmp.isNot(tok::eod)); } /// ReadMacroName - Lex and validate a macro name, which occurs after a -/// #define or #undef. This sets the token kind to eom and discards the rest +/// #define or #undef. This sets the token kind to eod and discards the rest /// of the macro line if the macro name is invalid. isDefineUndef is 1 if /// this is due to a a #define, 2 if #undef directive, 0 if it is something /// else (e.g. #ifdef). @@ -107,7 +107,7 @@ void Preprocessor::ReadMacroName(Token &MacroNameTok, char isDefineUndef) { } // Missing macro name? - if (MacroNameTok.is(tok::eom)) { + if (MacroNameTok.is(tok::eod)) { Diag(MacroNameTok, diag::err_pp_missing_macro_name); return; } @@ -143,13 +143,13 @@ void Preprocessor::ReadMacroName(Token &MacroNameTok, char isDefineUndef) { } // Invalid macro name, read and discard the rest of the line. Then set the - // token kind to tok::eom. - MacroNameTok.setKind(tok::eom); + // token kind to tok::eod. + MacroNameTok.setKind(tok::eod); return DiscardUntilEndOfDirective(); } -/// CheckEndOfDirective - Ensure that the next token is a tok::eom token. If -/// not, emit a diagnostic and consume up until the eom. If EnableMacros is +/// CheckEndOfDirective - Ensure that the next token is a tok::eod token. If +/// not, emit a diagnostic and consume up until the eod. If EnableMacros is /// true, then we consider macros that expand to zero tokens as being ok. void Preprocessor::CheckEndOfDirective(const char *DirType, bool EnableMacros) { Token Tmp; @@ -166,7 +166,7 @@ void Preprocessor::CheckEndOfDirective(const char *DirType, bool EnableMacros) { while (Tmp.is(tok::comment)) // Skip comments in -C mode. LexUnexpandedToken(Tmp); - if (Tmp.isNot(tok::eom)) { + if (Tmp.isNot(tok::eod)) { // Add a fixit in GNU/C99/C++ mode. Don't offer a fixit for strict-C89, // or if this is a macro-style preprocessing directive, because it is more // trouble than it is worth to insert /**/ and check that there is no /**/ @@ -238,7 +238,7 @@ void Preprocessor::SkipExcludedConditionalBlock(SourceLocation IfTokenLoc, // We just parsed a # character at the start of a line, so we're in // directive mode. Tell the lexer this so any newlines we see will be - // converted into an EOM token (this terminates the macro). + // converted into an EOD token (this terminates the macro). CurPPLexer->ParsingPreprocessorDirective = true; if (CurLexer) CurLexer->SetCommentRetentionState(false); @@ -425,7 +425,7 @@ void Preprocessor::PTHSkipExcludedConditionalBlock() { if (!CondInfo.FoundNonSkip) { CondInfo.FoundNonSkip = true; - // Scan until the eom token. + // Scan until the eod token. CurPTHLexer->ParsingPreprocessorDirective = true; DiscardUntilEndOfDirective(); CurPTHLexer->ParsingPreprocessorDirective = false; @@ -535,7 +535,7 @@ void Preprocessor::HandleDirective(Token &Result) { // We just parsed a # character at the start of a line, so we're in directive // mode. Tell the lexer this so any newlines we see will be converted into an - // EOM token (which terminates the directive). + // EOD token (which terminates the directive). CurPPLexer->ParsingPreprocessorDirective = true; ++NumDirectives; @@ -563,7 +563,7 @@ void Preprocessor::HandleDirective(Token &Result) { TryAgain: switch (Result.getKind()) { - case tok::eom: + case tok::eod: return; // null directive. case tok::comment: // Handle stuff like "# /*foo*/ define X" in -E -C mode. @@ -686,7 +686,7 @@ static bool GetLineValue(Token &DigitTok, unsigned &Val, if (DigitTok.isNot(tok::numeric_constant)) { PP.Diag(DigitTok, DiagID); - if (DigitTok.isNot(tok::eom)) + if (DigitTok.isNot(tok::eod)) PP.DiscardUntilEndOfDirective(); return true; } @@ -758,9 +758,9 @@ void Preprocessor::HandleLineDirective(Token &Tok) { Token StrTok; Lex(StrTok); - // If the StrTok is "eom", then it wasn't present. Otherwise, it must be a - // string followed by eom. - if (StrTok.is(tok::eom)) + // If the StrTok is "eod", then it wasn't present. Otherwise, it must be a + // string followed by eod. + if (StrTok.is(tok::eod)) ; // ok else if (StrTok.isNot(tok::string_literal)) { Diag(StrTok, diag::err_pp_line_invalid_filename); @@ -779,7 +779,7 @@ void Preprocessor::HandleLineDirective(Token &Tok) { FilenameID = SourceMgr.getLineTableFilenameID(Literal.GetString(), Literal.GetStringLength()); - // Verify that there is nothing after the string, other than EOM. Because + // Verify that there is nothing after the string, other than EOD. Because // of C99 6.10.4p5, macros that expand to empty tokens are ok. CheckEndOfDirective("line", true); } @@ -800,7 +800,7 @@ static bool ReadLineMarkerFlags(bool &IsFileEntry, bool &IsFileExit, unsigned FlagVal; Token FlagTok; PP.Lex(FlagTok); - if (FlagTok.is(tok::eom)) return false; + if (FlagTok.is(tok::eod)) return false; if (GetLineValue(FlagTok, FlagVal, diag::err_pp_linemarker_invalid_flag, PP)) return true; @@ -808,7 +808,7 @@ static bool ReadLineMarkerFlags(bool &IsFileEntry, bool &IsFileExit, IsFileEntry = true; PP.Lex(FlagTok); - if (FlagTok.is(tok::eom)) return false; + if (FlagTok.is(tok::eod)) return false; if (GetLineValue(FlagTok, FlagVal, diag::err_pp_linemarker_invalid_flag,PP)) return true; } else if (FlagVal == 2) { @@ -834,7 +834,7 @@ static bool ReadLineMarkerFlags(bool &IsFileEntry, bool &IsFileExit, } PP.Lex(FlagTok); - if (FlagTok.is(tok::eom)) return false; + if (FlagTok.is(tok::eod)) return false; if (GetLineValue(FlagTok, FlagVal, diag::err_pp_linemarker_invalid_flag,PP)) return true; } @@ -849,7 +849,7 @@ static bool ReadLineMarkerFlags(bool &IsFileEntry, bool &IsFileExit, IsSystemHeader = true; PP.Lex(FlagTok); - if (FlagTok.is(tok::eom)) return false; + if (FlagTok.is(tok::eod)) return false; if (GetLineValue(FlagTok, FlagVal, diag::err_pp_linemarker_invalid_flag, PP)) return true; @@ -863,7 +863,7 @@ static bool ReadLineMarkerFlags(bool &IsFileEntry, bool &IsFileExit, IsExternCHeader = true; PP.Lex(FlagTok); - if (FlagTok.is(tok::eom)) return false; + if (FlagTok.is(tok::eod)) return false; // There are no more valid flags here. PP.Diag(FlagTok, diag::err_pp_linemarker_invalid_flag); @@ -893,9 +893,9 @@ void Preprocessor::HandleDigitDirective(Token &DigitTok) { bool IsSystemHeader = false, IsExternCHeader = false; int FilenameID = -1; - // If the StrTok is "eom", then it wasn't present. Otherwise, it must be a - // string followed by eom. - if (StrTok.is(tok::eom)) + // If the StrTok is "eod", then it wasn't present. Otherwise, it must be a + // string followed by eod. + if (StrTok.is(tok::eod)) ; // ok else if (StrTok.isNot(tok::string_literal)) { Diag(StrTok, diag::err_pp_linemarker_invalid_filename); @@ -978,12 +978,12 @@ void Preprocessor::HandleIdentSCCSDirective(Token &Tok) { if (StrTok.isNot(tok::string_literal) && StrTok.isNot(tok::wide_string_literal)) { Diag(StrTok, diag::err_pp_malformed_ident); - if (StrTok.isNot(tok::eom)) + if (StrTok.isNot(tok::eod)) DiscardUntilEndOfDirective(); return; } - // Verify that there is nothing after the string, other than EOM. + // Verify that there is nothing after the string, other than EOD. CheckEndOfDirective("ident"); if (Callbacks) { @@ -1052,14 +1052,14 @@ bool Preprocessor::GetIncludeFilenameSpelling(SourceLocation Loc, /// /// This code concatenates and consumes tokens up to the '>' token. It returns /// false if the > was found, otherwise it returns true if it finds and consumes -/// the EOM marker. +/// the EOD marker. bool Preprocessor::ConcatenateIncludeName( llvm::SmallString<128> &FilenameBuffer, SourceLocation &End) { Token CurTok; Lex(CurTok); - while (CurTok.isNot(tok::eom)) { + while (CurTok.isNot(tok::eod)) { End = CurTok.getLocation(); // FIXME: Provide code completion for #includes. @@ -1095,8 +1095,8 @@ bool Preprocessor::ConcatenateIncludeName( Lex(CurTok); } - // If we hit the eom marker, emit an error and return true so that the caller - // knows the EOM has been read. + // If we hit the eod marker, emit an error and return true so that the caller + // knows the EOD has been read. Diag(CurTok.getLocation(), diag::err_pp_expects_filename); return true; } @@ -1120,8 +1120,8 @@ void Preprocessor::HandleIncludeDirective(SourceLocation HashLoc, SourceLocation End; switch (FilenameTok.getKind()) { - case tok::eom: - // If the token kind is EOM, the error has already been diagnosed. + case tok::eod: + // If the token kind is EOD, the error has already been diagnosed. return; case tok::angle_string_literal: @@ -1135,7 +1135,7 @@ void Preprocessor::HandleIncludeDirective(SourceLocation HashLoc, // case, glue the tokens together into FilenameBuffer and interpret those. FilenameBuffer.push_back('<'); if (ConcatenateIncludeName(FilenameBuffer, End)) - return; // Found <eom> but no ">"? Diagnostic already emitted. + return; // Found <eod> but no ">"? Diagnostic already emitted. Filename = FilenameBuffer.str(); break; default: @@ -1153,7 +1153,7 @@ void Preprocessor::HandleIncludeDirective(SourceLocation HashLoc, return; } - // Verify that there is nothing after the filename, other than EOM. Note that + // Verify that there is nothing after the filename, other than EOD. Note that // we allow macros that expand to nothing after the filename, because this // falls into the category of "#include pp-tokens new-line" specified in // C99 6.10.2p4. @@ -1302,7 +1302,7 @@ bool Preprocessor::ReadMacroDefinitionArgList(MacroInfo *MI) { MI->setIsC99Varargs(); MI->setArgumentList(&Arguments[0], Arguments.size(), BP); return false; - case tok::eom: // #define X( + case tok::eod: // #define X( Diag(Tok, diag::err_pp_missing_rparen_in_macro_def); return true; default: @@ -1366,7 +1366,7 @@ void Preprocessor::HandleDefineDirective(Token &DefineTok) { ReadMacroName(MacroNameTok, 1); // Error reading macro name? If so, diagnostic already issued. - if (MacroNameTok.is(tok::eom)) + if (MacroNameTok.is(tok::eod)) return; Token LastTok = MacroNameTok; @@ -1384,7 +1384,7 @@ void Preprocessor::HandleDefineDirective(Token &DefineTok) { // If this is a function-like macro definition, parse the argument list, // marking each of the identifiers as being used as macro arguments. Also, // check other constraints on the first token of the macro body. - if (Tok.is(tok::eom)) { + if (Tok.is(tok::eod)) { // If there is no body to this macro, we have no special handling here. } else if (Tok.hasLeadingSpace()) { // This is a normal token with leading space. Clear the leading space @@ -1439,13 +1439,13 @@ void Preprocessor::HandleDefineDirective(Token &DefineTok) { Diag(Tok, diag::warn_missing_whitespace_after_macro_name); } - if (!Tok.is(tok::eom)) + if (!Tok.is(tok::eod)) LastTok = Tok; // Read the rest of the macro body. if (MI->isObjectLike()) { // Object-like macros are very simple, just read their body. - while (Tok.isNot(tok::eom)) { + while (Tok.isNot(tok::eod)) { LastTok = Tok; MI->AddTokenToBody(Tok); // Get the next token of the macro. @@ -1456,7 +1456,7 @@ void Preprocessor::HandleDefineDirective(Token &DefineTok) { // Otherwise, read the body of a function-like macro. While we are at it, // check C99 6.10.3.2p1: ensure that # operators are followed by macro // parameters in function-like macro expansions. - while (Tok.isNot(tok::eom)) { + while (Tok.isNot(tok::eod)) { LastTok = Tok; if (Tok.isNot(tok::hash)) { @@ -1478,7 +1478,7 @@ void Preprocessor::HandleDefineDirective(Token &DefineTok) { // the '#' because '#' is often a comment character. However, change // the kind of the token to tok::unknown so that the preprocessor isn't // confused. - if (getLangOptions().AsmPreprocessor && Tok.isNot(tok::eom)) { + if (getLangOptions().AsmPreprocessor && Tok.isNot(tok::eod)) { LastTok.setKind(tok::unknown); } else { Diag(Tok, diag::err_pp_stringize_not_parameter); @@ -1573,7 +1573,7 @@ void Preprocessor::HandleUndefDirective(Token &UndefTok) { ReadMacroName(MacroNameTok, 2); // Error reading macro name? If so, diagnostic already issued. - if (MacroNameTok.is(tok::eom)) + if (MacroNameTok.is(tok::eod)) return; // Check to see if this is the last token on the #undef line. @@ -1619,7 +1619,7 @@ void Preprocessor::HandleIfdefDirective(Token &Result, bool isIfndef, ReadMacroName(MacroNameTok); // Error reading macro name? If so, diagnostic already issued. - if (MacroNameTok.is(tok::eom)) { + if (MacroNameTok.is(tok::eod)) { // Skip code until we get to #endif. This helps with recovery by not // emitting an error when the #endif is reached. SkipExcludedConditionalBlock(DirectiveTok.getLocation(), |