Rename tok::eom to tok::eod.

The previous name was inaccurate as this token in fact appears at
the end of every preprocessing directive, not just macro definitions.
No functionality change, except for a diagnostic tweak.

llvm-svn: 126631
This commit is contained in:
Peter Collingbourne 2011-02-28 02:37:51 +00:00
parent e96ab55b28
commit 2f1e36bfd0
18 changed files with 113 additions and 112 deletions

View File

@ -821,7 +821,7 @@ code is vectorized on X86 and PowerPC hosts).</p>
within the filename.</li> within the filename.</li>
<li>When parsing a preprocessor directive (after "<tt>#</tt>") the <li>When parsing a preprocessor directive (after "<tt>#</tt>") the
ParsingPreprocessorDirective mode is entered. This changes the parser to ParsingPreprocessorDirective mode is entered. This changes the parser to
return EOM at a newline.</li> return EOD at a newline.</li>
<li>The Lexer uses a LangOptions object to know whether trigraphs are enabled, <li>The Lexer uses a LangOptions object to know whether trigraphs are enabled,
whether C++ or ObjC keywords are recognized, etc.</li> whether C++ or ObjC keywords are recognized, etc.</li>
</ul> </ul>

View File

@ -247,8 +247,8 @@ def ext_stdc_pragma_ignored : ExtWarn<"unknown pragma in STDC namespace">,
def ext_on_off_switch_syntax : def ext_on_off_switch_syntax :
ExtWarn<"expected 'ON' or 'OFF' or 'DEFAULT' in pragma">, ExtWarn<"expected 'ON' or 'OFF' or 'DEFAULT' in pragma">,
InGroup<UnknownPragmas>; InGroup<UnknownPragmas>;
def ext_pragma_syntax_eom : def ext_pragma_syntax_eod :
ExtWarn<"expected end of macro in pragma">, ExtWarn<"expected end of directive in pragma">,
InGroup<UnknownPragmas>; InGroup<UnknownPragmas>;
def warn_stdc_fenv_access_not_supported : def warn_stdc_fenv_access_not_supported :
Warning<"pragma STDC FENV_ACCESS ON is not supported, ignoring pragma">, Warning<"pragma STDC FENV_ACCESS ON is not supported, ignoring pragma">,

View File

@ -94,7 +94,8 @@ PPKEYWORD(unassert)
TOK(unknown) // Not a token. TOK(unknown) // Not a token.
TOK(eof) // End of file. TOK(eof) // End of file.
TOK(eom) // End of macro (end of line inside a macro). TOK(eod) // End of preprocessing directive (end of line inside a
// directive).
TOK(code_completion) // Code completion marker TOK(code_completion) // Code completion marker
TOK(cxx_defaultarg_end) // C++ default argument end marker TOK(cxx_defaultarg_end) // C++ default argument end marker

View File

@ -782,13 +782,13 @@ public:
/// read is the correct one. /// read is the correct one.
void HandleDirective(Token &Result); void HandleDirective(Token &Result);
/// CheckEndOfDirective - Ensure that the next token is a tok::eom token. If /// CheckEndOfDirective - Ensure that the next token is a tok::eod token. If
/// not, emit a diagnostic and consume up until the eom. If EnableMacros is /// 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. /// true, then we consider macros that expand to zero tokens as being ok.
void CheckEndOfDirective(const char *Directive, bool EnableMacros = false); void CheckEndOfDirective(const char *Directive, bool EnableMacros = false);
/// DiscardUntilEndOfDirective - Read and discard all tokens remaining on the /// 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 DiscardUntilEndOfDirective(); void DiscardUntilEndOfDirective();
/// SawDateOrTime - This returns true if the preprocessor has seen a use of /// SawDateOrTime - This returns true if the preprocessor has seen a use of
@ -839,12 +839,12 @@ public:
/// ///
/// This code concatenates and consumes tokens up to the '>' token. It /// This code concatenates and consumes tokens up to the '>' token. It
/// returns false if the > was found, otherwise it returns true if it finds /// returns false if the > was found, otherwise it returns true if it finds
/// and consumes the EOM marker. /// and consumes the EOD marker.
bool ConcatenateIncludeName(llvm::SmallString<128> &FilenameBuffer, bool ConcatenateIncludeName(llvm::SmallString<128> &FilenameBuffer,
SourceLocation &End); SourceLocation &End);
/// LexOnOffSwitch - Lex an on-off-switch (C99 6.10.6p2) and verify that it is /// LexOnOffSwitch - Lex an on-off-switch (C99 6.10.6p2) and verify that it is
/// followed by EOM. Return true if the token is not a valid on-off-switch. /// followed by EOD. Return true if the token is not a valid on-off-switch.
bool LexOnOffSwitch(tok::OnOffSwitch &OOS); bool LexOnOffSwitch(tok::OnOffSwitch &OOS);
private: private:
@ -875,7 +875,7 @@ private:
void ReleaseMacroInfo(MacroInfo* MI); void ReleaseMacroInfo(MacroInfo* MI);
/// ReadMacroName - Lex and validate a macro name, which occurs after a /// ReadMacroName - Lex and validate a macro name, which occurs after a
/// #define or #undef. This emits a diagnostic, sets the token kind to eom, /// #define or #undef. This emits a diagnostic, sets the token kind to eod,
/// and discards the rest of the macro line if the macro name is invalid. /// and discards the rest of the macro line if the macro name is invalid.
void ReadMacroName(Token &MacroNameTok, char isDefineUndef = 0); void ReadMacroName(Token &MacroNameTok, char isDefineUndef = 0);

View File

@ -36,7 +36,7 @@ protected:
//===--------------------------------------------------------------------===// //===--------------------------------------------------------------------===//
/// ParsingPreprocessorDirective - This is true when parsing #XXX. This turns /// ParsingPreprocessorDirective - This is true when parsing #XXX. This turns
/// '\n' into a tok::eom token. /// '\n' into a tok::eod token.
bool ParsingPreprocessorDirective; bool ParsingPreprocessorDirective;
/// ParsingFilename - True after #include: this turns <xx> into a /// ParsingFilename - True after #include: this turns <xx> into a
@ -131,7 +131,7 @@ public:
/// LexIncludeFilename - After the preprocessor has parsed a #include, lex and /// LexIncludeFilename - After the preprocessor has parsed a #include, lex and
/// (potentially) macro expand the filename. If the sequence parsed is not /// (potentially) macro expand the filename. If the sequence parsed is not
/// lexically legal, emit a diagnostic and return a result EOM token. /// lexically legal, emit a diagnostic and return a result EOD token.
void LexIncludeFilename(Token &Result); void LexIncludeFilename(Token &Result);
/// setParsingPreprocessorDirective - Inform the lexer whether or not /// setParsingPreprocessorDirective - Inform the lexer whether or not

View File

@ -288,12 +288,12 @@ PTHEntry PTHWriter::LexTokens(Lexer& L) {
if ((Tok.isAtStartOfLine() || Tok.is(tok::eof)) && if ((Tok.isAtStartOfLine() || Tok.is(tok::eof)) &&
ParsingPreprocessorDirective) { ParsingPreprocessorDirective) {
// Insert an eom token into the token cache. It has the same // Insert an eod token into the token cache. It has the same
// position as the next token that is not on the same line as the // position as the next token that is not on the same line as the
// preprocessor directive. Observe that we continue processing // preprocessor directive. Observe that we continue processing
// 'Tok' when we exit this branch. // 'Tok' when we exit this branch.
Token Tmp = Tok; Token Tmp = Tok;
Tmp.setKind(tok::eom); Tmp.setKind(tok::eod);
Tmp.clearFlag(Token::StartOfLine); Tmp.clearFlag(Token::StartOfLine);
Tmp.setIdentifierInfo(0); Tmp.setIdentifierInfo(0);
EmitToken(Tmp); EmitToken(Tmp);

View File

@ -432,7 +432,7 @@ struct UnknownPragmaHandler : public PragmaHandler {
Callbacks->OS.write(Prefix, strlen(Prefix)); Callbacks->OS.write(Prefix, strlen(Prefix));
Callbacks->SetEmittedTokensOnThisLine(); Callbacks->SetEmittedTokensOnThisLine();
// Read and print all of the pragma tokens. // Read and print all of the pragma tokens.
while (PragmaTok.isNot(tok::eom)) { while (PragmaTok.isNot(tok::eod)) {
if (PragmaTok.hasLeadingSpace()) if (PragmaTok.hasLeadingSpace())
Callbacks->OS << ' '; Callbacks->OS << ' ';
std::string TokSpell = PP.getSpelling(PragmaTok); std::string TokSpell = PP.getSpelling(PragmaTok);

View File

@ -178,7 +178,7 @@ Lexer *Lexer::Create_PragmaLexer(SourceLocation SpellingLoc,
InstantiationLocEnd, TokLen); InstantiationLocEnd, TokLen);
// Ensure that the lexer thinks it is inside a directive, so that end \n will // Ensure that the lexer thinks it is inside a directive, so that end \n will
// return an EOM token. // return an EOD token.
L->ParsingPreprocessorDirective = true; L->ParsingPreprocessorDirective = true;
// This lexer really is for _Pragma. // This lexer really is for _Pragma.
@ -1407,7 +1407,7 @@ bool Lexer::SkipBCPLComment(Token &Result, const char *CurPtr) {
return SaveBCPLComment(Result, CurPtr); return SaveBCPLComment(Result, CurPtr);
// If we are inside a preprocessor directive and we see the end of line, // If we are inside a preprocessor directive and we see the end of line,
// return immediately, so that the lexer can return this as an EOM token. // return immediately, so that the lexer can return this as an EOD token.
if (ParsingPreprocessorDirective || CurPtr == BufferEnd) { if (ParsingPreprocessorDirective || CurPtr == BufferEnd) {
BufferPtr = CurPtr; BufferPtr = CurPtr;
return false; return false;
@ -1715,14 +1715,14 @@ std::string Lexer::ReadToEndOfLine() {
assert(CurPtr[-1] == Char && "Trigraphs for newline?"); assert(CurPtr[-1] == Char && "Trigraphs for newline?");
BufferPtr = CurPtr-1; BufferPtr = CurPtr-1;
// Next, lex the character, which should handle the EOM transition. // Next, lex the character, which should handle the EOD transition.
Lex(Tmp); Lex(Tmp);
if (Tmp.is(tok::code_completion)) { if (Tmp.is(tok::code_completion)) {
if (PP && PP->getCodeCompletionHandler()) if (PP && PP->getCodeCompletionHandler())
PP->getCodeCompletionHandler()->CodeCompleteNaturalLanguage(); PP->getCodeCompletionHandler()->CodeCompleteNaturalLanguage();
Lex(Tmp); Lex(Tmp);
} }
assert(Tmp.is(tok::eom) && "Unexpected token!"); assert(Tmp.is(tok::eod) && "Unexpected token!");
// Finally, we're done, return the string we found. // Finally, we're done, return the string we found.
return Result; return Result;
@ -1758,7 +1758,7 @@ bool Lexer::LexEndOfFile(Token &Result, const char *CurPtr) {
// Done parsing the "line". // Done parsing the "line".
ParsingPreprocessorDirective = false; ParsingPreprocessorDirective = false;
// Update the location of token as well as BufferPtr. // Update the location of token as well as BufferPtr.
FormTokenWithChars(Result, CurPtr, tok::eom); FormTokenWithChars(Result, CurPtr, tok::eod);
// Restore comment saving mode, in case it was disabled for directive. // Restore comment saving mode, in case it was disabled for directive.
SetCommentRetentionState(PP->getCommentRetentionState()); SetCommentRetentionState(PP->getCommentRetentionState());
@ -2006,7 +2006,7 @@ LexNextToken:
case '\n': case '\n':
case '\r': case '\r':
// If we are inside a preprocessor directive and we see the end of line, // If we are inside a preprocessor directive and we see the end of line,
// we know we are done with the directive, so return an EOM token. // we know we are done with the directive, so return an EOD token.
if (ParsingPreprocessorDirective) { if (ParsingPreprocessorDirective) {
// Done parsing the "line". // Done parsing the "line".
ParsingPreprocessorDirective = false; ParsingPreprocessorDirective = false;
@ -2017,7 +2017,7 @@ LexNextToken:
// Since we consumed a newline, we are back at the start of a line. // Since we consumed a newline, we are back at the start of a line.
IsAtStartOfLine = true; IsAtStartOfLine = true;
Kind = tok::eom; Kind = tok::eod;
break; break;
} }
// The returned token is at the start of the line. // The returned token is at the start of the line.

View File

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

View File

@ -180,7 +180,7 @@ static bool EvaluateValue(PPValue &Result, Token &PeekTok, DefinedTracker &DT,
default: // Non-value token. default: // Non-value token.
PP.Diag(PeekTok, diag::err_pp_expr_bad_token_start_expr); PP.Diag(PeekTok, diag::err_pp_expr_bad_token_start_expr);
return true; return true;
case tok::eom: case tok::eod:
case tok::r_paren: case tok::r_paren:
// If there is no expression, report and exit. // If there is no expression, report and exit.
PP.Diag(PeekTok, diag::err_pp_expected_value_in_expr); PP.Diag(PeekTok, diag::err_pp_expected_value_in_expr);
@ -372,7 +372,7 @@ static bool EvaluateValue(PPValue &Result, Token &PeekTok, DefinedTracker &DT,
/// token. This returns: /// token. This returns:
/// ~0 - Invalid token. /// ~0 - Invalid token.
/// 14 -> 3 - various operators. /// 14 -> 3 - various operators.
/// 0 - 'eom' or ')' /// 0 - 'eod' or ')'
static unsigned getPrecedence(tok::TokenKind Kind) { static unsigned getPrecedence(tok::TokenKind Kind) {
switch (Kind) { switch (Kind) {
default: return ~0U; default: return ~0U;
@ -397,8 +397,8 @@ static unsigned getPrecedence(tok::TokenKind Kind) {
case tok::question: return 4; case tok::question: return 4;
case tok::comma: return 3; case tok::comma: return 3;
case tok::colon: return 2; case tok::colon: return 2;
case tok::r_paren: return 0; // Lowest priority, end of expr. case tok::r_paren: return 0;// Lowest priority, end of expr.
case tok::eom: return 0; // Lowest priority, end of macro. case tok::eod: return 0;// Lowest priority, end of directive.
} }
} }
@ -713,7 +713,7 @@ EvaluateDirectiveExpression(IdentifierInfo *&IfNDefMacro) {
DefinedTracker DT; DefinedTracker DT;
if (EvaluateValue(ResVal, Tok, DT, true, *this)) { if (EvaluateValue(ResVal, Tok, DT, true, *this)) {
// Parse error, skip the rest of the macro line. // Parse error, skip the rest of the macro line.
if (Tok.isNot(tok::eom)) if (Tok.isNot(tok::eod))
DiscardUntilEndOfDirective(); DiscardUntilEndOfDirective();
// Restore 'DisableMacroExpansion'. // Restore 'DisableMacroExpansion'.
@ -724,7 +724,7 @@ EvaluateDirectiveExpression(IdentifierInfo *&IfNDefMacro) {
// If we are at the end of the expression after just parsing a value, there // If we are at the end of the expression after just parsing a value, there
// must be no (unparenthesized) binary operators involved, so we can exit // must be no (unparenthesized) binary operators involved, so we can exit
// directly. // directly.
if (Tok.is(tok::eom)) { if (Tok.is(tok::eod)) {
// If the expression we parsed was of the form !defined(macro), return the // If the expression we parsed was of the form !defined(macro), return the
// macro in IfNDefMacro. // macro in IfNDefMacro.
if (DT.State == DefinedTracker::NotDefinedMacro) if (DT.State == DefinedTracker::NotDefinedMacro)
@ -740,7 +740,7 @@ EvaluateDirectiveExpression(IdentifierInfo *&IfNDefMacro) {
if (EvaluateDirectiveSubExpr(ResVal, getPrecedence(tok::question), if (EvaluateDirectiveSubExpr(ResVal, getPrecedence(tok::question),
Tok, true, *this)) { Tok, true, *this)) {
// Parse error, skip the rest of the macro line. // Parse error, skip the rest of the macro line.
if (Tok.isNot(tok::eom)) if (Tok.isNot(tok::eod))
DiscardUntilEndOfDirective(); DiscardUntilEndOfDirective();
// Restore 'DisableMacroExpansion'. // Restore 'DisableMacroExpansion'.
@ -748,9 +748,9 @@ EvaluateDirectiveExpression(IdentifierInfo *&IfNDefMacro) {
return false; return false;
} }
// If we aren't at the tok::eom token, something bad happened, like an extra // If we aren't at the tok::eod token, something bad happened, like an extra
// ')' token. // ')' token.
if (Tok.isNot(tok::eom)) { if (Tok.isNot(tok::eod)) {
Diag(Tok, diag::err_pp_expected_eol); Diag(Tok, diag::err_pp_expected_eol);
DiscardUntilEndOfDirective(); DiscardUntilEndOfDirective();
} }

View File

@ -301,7 +301,7 @@ void Preprocessor::HandleMicrosoftCommentPaste(Token &Tok) {
// We handle this by scanning for the closest real lexer, switching it to // We handle this by scanning for the closest real lexer, switching it to
// raw mode and preprocessor mode. This will cause it to return \n as an // raw mode and preprocessor mode. This will cause it to return \n as an
// explicit EOM token. // explicit EOD token.
PreprocessorLexer *FoundLexer = 0; PreprocessorLexer *FoundLexer = 0;
bool LexerWasInPPMode = false; bool LexerWasInPPMode = false;
for (unsigned i = 0, e = IncludeMacroStack.size(); i != e; ++i) { for (unsigned i = 0, e = IncludeMacroStack.size(); i != e; ++i) {
@ -309,11 +309,11 @@ void Preprocessor::HandleMicrosoftCommentPaste(Token &Tok) {
if (ISI.ThePPLexer == 0) continue; // Scan for a real lexer. if (ISI.ThePPLexer == 0) continue; // Scan for a real lexer.
// Once we find a real lexer, mark it as raw mode (disabling macro // Once we find a real lexer, mark it as raw mode (disabling macro
// expansions) and preprocessor mode (return EOM). We know that the lexer // expansions) and preprocessor mode (return EOD). We know that the lexer
// was *not* in raw mode before, because the macro that the comment came // was *not* in raw mode before, because the macro that the comment came
// from was expanded. However, it could have already been in preprocessor // from was expanded. However, it could have already been in preprocessor
// mode (#if COMMENT) in which case we have to return it to that mode and // mode (#if COMMENT) in which case we have to return it to that mode and
// return EOM. // return EOD.
FoundLexer = ISI.ThePPLexer; FoundLexer = ISI.ThePPLexer;
FoundLexer->LexingRawMode = true; FoundLexer->LexingRawMode = true;
LexerWasInPPMode = FoundLexer->ParsingPreprocessorDirective; LexerWasInPPMode = FoundLexer->ParsingPreprocessorDirective;
@ -326,22 +326,22 @@ void Preprocessor::HandleMicrosoftCommentPaste(Token &Tok) {
// the next token. // the next token.
if (!HandleEndOfTokenLexer(Tok)) Lex(Tok); if (!HandleEndOfTokenLexer(Tok)) Lex(Tok);
// Discarding comments as long as we don't have EOF or EOM. This 'comments // Discarding comments as long as we don't have EOF or EOD. This 'comments
// out' the rest of the line, including any tokens that came from other macros // out' the rest of the line, including any tokens that came from other macros
// that were active, as in: // that were active, as in:
// #define submacro a COMMENT b // #define submacro a COMMENT b
// submacro c // submacro c
// which should lex to 'a' only: 'b' and 'c' should be removed. // which should lex to 'a' only: 'b' and 'c' should be removed.
while (Tok.isNot(tok::eom) && Tok.isNot(tok::eof)) while (Tok.isNot(tok::eod) && Tok.isNot(tok::eof))
Lex(Tok); Lex(Tok);
// If we got an eom token, then we successfully found the end of the line. // If we got an eod token, then we successfully found the end of the line.
if (Tok.is(tok::eom)) { if (Tok.is(tok::eod)) {
assert(FoundLexer && "Can't get end of line without an active lexer"); assert(FoundLexer && "Can't get end of line without an active lexer");
// Restore the lexer back to normal mode instead of raw mode. // Restore the lexer back to normal mode instead of raw mode.
FoundLexer->LexingRawMode = false; FoundLexer->LexingRawMode = false;
// If the lexer was already in preprocessor mode, just return the EOM token // If the lexer was already in preprocessor mode, just return the EOD token
// to finish the preprocessor line. // to finish the preprocessor line.
if (LexerWasInPPMode) return; if (LexerWasInPPMode) return;
@ -352,7 +352,7 @@ void Preprocessor::HandleMicrosoftCommentPaste(Token &Tok) {
// If we got an EOF token, then we reached the end of the token stream but // If we got an EOF token, then we reached the end of the token stream but
// didn't find an explicit \n. This can only happen if there was no lexer // didn't find an explicit \n. This can only happen if there was no lexer
// active (an active lexer would return EOM at EOF if there was no \n in // active (an active lexer would return EOD at EOF if there was no \n in
// preprocessor directive mode), so just return EOF as our token. // preprocessor directive mode), so just return EOF as our token.
assert(!FoundLexer && "Lexer should return EOM before EOF in PP mode"); assert(!FoundLexer && "Lexer should return EOD before EOF in PP mode");
} }

View File

@ -355,9 +355,9 @@ MacroArgs *Preprocessor::ReadFunctionLikeMacroArgs(Token &MacroName,
LexUnexpandedToken(Tok); LexUnexpandedToken(Tok);
} }
if (Tok.is(tok::eof) || Tok.is(tok::eom)) { // "#if f(<eof>" & "#if f(\n" if (Tok.is(tok::eof) || Tok.is(tok::eod)) { // "#if f(<eof>" & "#if f(\n"
Diag(MacroName, diag::err_unterm_macro_invoc); Diag(MacroName, diag::err_unterm_macro_invoc);
// Do not lose the EOF/EOM. Return it to the client. // Do not lose the EOF/EOD. Return it to the client.
MacroName = Tok; MacroName = Tok;
return 0; return 0;
} else if (Tok.is(tok::r_paren)) { } else if (Tok.is(tok::r_paren)) {
@ -626,8 +626,8 @@ static bool EvaluateHasIncludeCommon(Token &Tok,
SourceLocation EndLoc; SourceLocation EndLoc;
switch (Tok.getKind()) { switch (Tok.getKind()) {
case tok::eom: case tok::eod:
// If the token kind is EOM, the error has already been diagnosed. // If the token kind is EOD, the error has already been diagnosed.
return false; return false;
case tok::angle_string_literal: case tok::angle_string_literal:
@ -644,7 +644,7 @@ static bool EvaluateHasIncludeCommon(Token &Tok,
// case, glue the tokens together into FilenameBuffer and interpret those. // case, glue the tokens together into FilenameBuffer and interpret those.
FilenameBuffer.push_back('<'); FilenameBuffer.push_back('<');
if (PP.ConcatenateIncludeName(FilenameBuffer, EndLoc)) if (PP.ConcatenateIncludeName(FilenameBuffer, EndLoc))
return false; // Found <eom> but no ">"? Diagnostic already emitted. return false; // Found <eod> but no ">"? Diagnostic already emitted.
Filename = FilenameBuffer.str(); Filename = FilenameBuffer.str();
break; break;
default: default:

View File

@ -125,7 +125,7 @@ LexNextToken:
return PP->Lex(Tok); return PP->Lex(Tok);
} }
if (TKind == tok::eom) { if (TKind == tok::eod) {
assert(ParsingPreprocessorDirective); assert(ParsingPreprocessorDirective);
ParsingPreprocessorDirective = false; ParsingPreprocessorDirective = false;
return; return;

View File

@ -229,8 +229,8 @@ void Preprocessor::HandleMicrosoft__pragma(Token &Tok) {
PragmaToks.front().setFlag(Token::LeadingSpace); PragmaToks.front().setFlag(Token::LeadingSpace);
// Replace the ')' with an EOM to mark the end of the pragma. // Replace the ')' with an EOD to mark the end of the pragma.
PragmaToks.back().setKind(tok::eom); PragmaToks.back().setKind(tok::eod);
Token *TokArray = new Token[PragmaToks.size()]; Token *TokArray = new Token[PragmaToks.size()];
std::copy(PragmaToks.begin(), PragmaToks.end(), TokArray); std::copy(PragmaToks.begin(), PragmaToks.end(), TokArray);
@ -283,7 +283,7 @@ void Preprocessor::HandlePragmaPoison(Token &PoisonTok) {
if (CurPPLexer) CurPPLexer->LexingRawMode = false; if (CurPPLexer) CurPPLexer->LexingRawMode = false;
// If we reached the end of line, we're done. // If we reached the end of line, we're done.
if (Tok.is(tok::eom)) return; if (Tok.is(tok::eod)) return;
// Can only poison identifiers. // Can only poison identifiers.
if (Tok.isNot(tok::raw_identifier)) { if (Tok.isNot(tok::raw_identifier)) {
@ -348,8 +348,8 @@ void Preprocessor::HandlePragmaDependency(Token &DependencyTok) {
Token FilenameTok; Token FilenameTok;
CurPPLexer->LexIncludeFilename(FilenameTok); CurPPLexer->LexIncludeFilename(FilenameTok);
// If the token kind is EOM, the error has already been diagnosed. // If the token kind is EOD, the error has already been diagnosed.
if (FilenameTok.is(tok::eom)) if (FilenameTok.is(tok::eod))
return; return;
// Reserve a buffer to get the spelling. // Reserve a buffer to get the spelling.
@ -381,7 +381,7 @@ void Preprocessor::HandlePragmaDependency(Token &DependencyTok) {
// Lex tokens at the end of the message and include them in the message. // Lex tokens at the end of the message and include them in the message.
std::string Message; std::string Message;
Lex(DependencyTok); Lex(DependencyTok);
while (DependencyTok.isNot(tok::eom)) { while (DependencyTok.isNot(tok::eod)) {
Message += getSpelling(DependencyTok) + " "; Message += getSpelling(DependencyTok) + " ";
Lex(DependencyTok); Lex(DependencyTok);
} }
@ -470,7 +470,7 @@ void Preprocessor::HandlePragmaComment(Token &Tok) {
} }
Lex(Tok); // eat the r_paren. Lex(Tok); // eat the r_paren.
if (Tok.isNot(tok::eom)) { if (Tok.isNot(tok::eod)) {
Diag(Tok.getLocation(), diag::err_pragma_comment_malformed); Diag(Tok.getLocation(), diag::err_pragma_comment_malformed);
return; return;
} }
@ -541,7 +541,7 @@ void Preprocessor::HandlePragmaMessage(Token &Tok) {
Lex(Tok); // eat the r_paren. Lex(Tok); // eat the r_paren.
} }
if (Tok.isNot(tok::eom)) { if (Tok.isNot(tok::eod)) {
Diag(Tok.getLocation(), diag::err_pragma_message_malformed); Diag(Tok.getLocation(), diag::err_pragma_message_malformed);
return; return;
} }
@ -737,10 +737,10 @@ bool Preprocessor::LexOnOffSwitch(tok::OnOffSwitch &Result) {
return true; return true;
} }
// Verify that this is followed by EOM. // Verify that this is followed by EOD.
LexUnexpandedToken(Tok); LexUnexpandedToken(Tok);
if (Tok.isNot(tok::eom)) if (Tok.isNot(tok::eod))
Diag(Tok, diag::ext_pragma_syntax_eom); Diag(Tok, diag::ext_pragma_syntax_eod);
return false; return false;
} }
@ -883,7 +883,7 @@ public:
PP.LexUnexpandedToken(Tok); PP.LexUnexpandedToken(Tok);
} }
if (Tok.isNot(tok::eom)) { if (Tok.isNot(tok::eod)) {
PP.Diag(Tok.getLocation(), diag::warn_pragma_diagnostic_invalid_token); PP.Diag(Tok.getLocation(), diag::warn_pragma_diagnostic_invalid_token);
return; return;
} }

View File

@ -34,7 +34,7 @@ void PreprocessorLexer::LexIncludeFilename(Token &FilenameTok) {
ParsingFilename = false; ParsingFilename = false;
// No filename? // No filename?
if (FilenameTok.is(tok::eom)) if (FilenameTok.is(tok::eod))
PP->Diag(FilenameTok.getLocation(), diag::err_pp_expects_filename); PP->Diag(FilenameTok.getLocation(), diag::err_pp_expects_filename);
} }

View File

@ -546,7 +546,7 @@ unsigned TokenLexer::isNextTokenLParen() const {
/// isParsingPreprocessorDirective - Return true if we are in the middle of a /// isParsingPreprocessorDirective - Return true if we are in the middle of a
/// preprocessor directive. /// preprocessor directive.
bool TokenLexer::isParsingPreprocessorDirective() const { bool TokenLexer::isParsingPreprocessorDirective() const {
return Tokens[NumTokens-1].is(tok::eom) && !isAtEnd(); return Tokens[NumTokens-1].is(tok::eod) && !isAtEnd();
} }
/// HandleMicrosoftCommentPaste - In microsoft compatibility mode, /##/ pastes /// HandleMicrosoftCommentPaste - In microsoft compatibility mode, /##/ pastes

View File

@ -74,7 +74,7 @@ void PragmaGCCVisibilityHandler::HandlePragma(Preprocessor &PP,
return; return;
} }
PP.Lex(Tok); PP.Lex(Tok);
if (Tok.isNot(tok::eom)) { if (Tok.isNot(tok::eod)) {
PP.Diag(Tok.getLocation(), diag::warn_pragma_extra_tokens_at_eol) PP.Diag(Tok.getLocation(), diag::warn_pragma_extra_tokens_at_eol)
<< "visibility"; << "visibility";
return; return;
@ -168,7 +168,7 @@ void PragmaPackHandler::HandlePragma(Preprocessor &PP,
SourceLocation RParenLoc = Tok.getLocation(); SourceLocation RParenLoc = Tok.getLocation();
PP.Lex(Tok); PP.Lex(Tok);
if (Tok.isNot(tok::eom)) { if (Tok.isNot(tok::eod)) {
PP.Diag(Tok.getLocation(), diag::warn_pragma_extra_tokens_at_eol) << "pack"; PP.Diag(Tok.getLocation(), diag::warn_pragma_extra_tokens_at_eol) << "pack";
return; return;
} }
@ -228,7 +228,7 @@ static void ParseAlignPragma(Sema &Actions, Preprocessor &PP, Token &FirstTok,
SourceLocation KindLoc = Tok.getLocation(); SourceLocation KindLoc = Tok.getLocation();
PP.Lex(Tok); PP.Lex(Tok);
if (Tok.isNot(tok::eom)) { if (Tok.isNot(tok::eod)) {
PP.Diag(Tok.getLocation(), diag::warn_pragma_extra_tokens_at_eol) PP.Diag(Tok.getLocation(), diag::warn_pragma_extra_tokens_at_eol)
<< (IsOptions ? "options" : "align"); << (IsOptions ? "options" : "align");
return; return;
@ -302,7 +302,7 @@ void PragmaUnusedHandler::HandlePragma(Preprocessor &PP,
} }
PP.Lex(Tok); PP.Lex(Tok);
if (Tok.isNot(tok::eom)) { if (Tok.isNot(tok::eod)) {
PP.Diag(Tok.getLocation(), diag::warn_pragma_extra_tokens_at_eol) << PP.Diag(Tok.getLocation(), diag::warn_pragma_extra_tokens_at_eol) <<
"unused"; "unused";
return; return;
@ -359,7 +359,7 @@ void PragmaWeakHandler::HandlePragma(Preprocessor &PP,
PP.Lex(Tok); PP.Lex(Tok);
} }
if (Tok.isNot(tok::eom)) { if (Tok.isNot(tok::eod)) {
PP.Diag(Tok.getLocation(), diag::warn_pragma_extra_tokens_at_eol) << "weak"; PP.Diag(Tok.getLocation(), diag::warn_pragma_extra_tokens_at_eol) << "weak";
return; return;
} }

View File

@ -21,7 +21,7 @@
#pragma STDC CX_LIMITED_RANGE IN_BETWEEN // expected-warning {{expected 'ON' or 'OFF' or 'DEFAULT' in pragma}} #pragma STDC CX_LIMITED_RANGE IN_BETWEEN // expected-warning {{expected 'ON' or 'OFF' or 'DEFAULT' in pragma}}
#pragma STDC CX_LIMITED_RANGE // expected-warning {{expected 'ON' or 'OFF' or 'DEFAULT' in pragma}} #pragma STDC CX_LIMITED_RANGE // expected-warning {{expected 'ON' or 'OFF' or 'DEFAULT' in pragma}}
#pragma STDC CX_LIMITED_RANGE ON FULL POWER // expected-warning {{expected end of macro in pragma}} #pragma STDC CX_LIMITED_RANGE ON FULL POWER // expected-warning {{expected end of directive in pragma}}
#pragma STDC SO_GREAT // expected-warning {{unknown pragma in STDC namespace}} #pragma STDC SO_GREAT // expected-warning {{unknown pragma in STDC namespace}}
#pragma STDC // expected-warning {{unknown pragma in STDC namespace}} #pragma STDC // expected-warning {{unknown pragma in STDC namespace}}