[LLVM] Change error messages to start with lower case (#113748)

Change LLVM Asm and TableGen Lexer/Parser error messages to begin with
lower case.
This commit is contained in:
Rahul Joshi 2024-10-29 12:26:33 -07:00 committed by GitHub
parent 9cc5a4bf66
commit a18af41c20
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
23 changed files with 81 additions and 80 deletions

View File

@ -60,8 +60,8 @@ uint64_t LLLexer::atoull(const char *Buffer, const char *End) {
uint64_t OldRes = Result; uint64_t OldRes = Result;
Result *= 10; Result *= 10;
Result += *Buffer-'0'; Result += *Buffer-'0';
if (Result < OldRes) { // Uh, oh, overflow detected!!! if (Result < OldRes) { // overflow detected.
LexError("constant bigger than 64 bits detected!"); LexError("constant bigger than 64 bits detected");
return 0; return 0;
} }
} }
@ -75,8 +75,8 @@ uint64_t LLLexer::HexIntToVal(const char *Buffer, const char *End) {
Result *= 16; Result *= 16;
Result += hexDigitValue(*Buffer); Result += hexDigitValue(*Buffer);
if (Result < OldRes) { // Uh, oh, overflow detected!!! if (Result < OldRes) { // overflow detected.
LexError("constant bigger than 64 bits detected!"); LexError("constant bigger than 64 bits detected");
return 0; return 0;
} }
} }
@ -99,7 +99,7 @@ void LLLexer::HexToIntPair(const char *Buffer, const char *End,
Pair[1] += hexDigitValue(*Buffer); Pair[1] += hexDigitValue(*Buffer);
} }
if (Buffer != End) if (Buffer != End)
LexError("constant bigger than 128 bits detected!"); LexError("constant bigger than 128 bits detected");
} }
/// FP80HexToIntPair - translate an 80 bit FP80 number (20 hexits) into /// FP80HexToIntPair - translate an 80 bit FP80 number (20 hexits) into
@ -118,7 +118,7 @@ void LLLexer::FP80HexToIntPair(const char *Buffer, const char *End,
Pair[0] += hexDigitValue(*Buffer); Pair[0] += hexDigitValue(*Buffer);
} }
if (Buffer != End) if (Buffer != End)
LexError("constant bigger than 128 bits detected!"); LexError("constant bigger than 128 bits detected");
} }
// UnEscapeLexed - Run through the specified buffer and change \xx codes to the // UnEscapeLexed - Run through the specified buffer and change \xx codes to the
@ -292,7 +292,7 @@ lltok::Kind LLLexer::LexDollar() {
StrVal.assign(TokStart + 2, CurPtr - 1); StrVal.assign(TokStart + 2, CurPtr - 1);
UnEscapeLexed(StrVal); UnEscapeLexed(StrVal);
if (StringRef(StrVal).contains(0)) { if (StringRef(StrVal).contains(0)) {
LexError("Null bytes are not allowed in names"); LexError("NUL character is not allowed in names");
return lltok::Error; return lltok::Error;
} }
return lltok::ComdatVar; return lltok::ComdatVar;
@ -354,7 +354,7 @@ lltok::Kind LLLexer::LexUIntID(lltok::Kind Token) {
uint64_t Val = atoull(TokStart + 1, CurPtr); uint64_t Val = atoull(TokStart + 1, CurPtr);
if ((unsigned)Val != Val) if ((unsigned)Val != Val)
LexError("invalid value number (too large)!"); LexError("invalid value number (too large)");
UIntVal = unsigned(Val); UIntVal = unsigned(Val);
return Token; return Token;
} }
@ -375,7 +375,7 @@ lltok::Kind LLLexer::LexVar(lltok::Kind Var, lltok::Kind VarID) {
StrVal.assign(TokStart+2, CurPtr-1); StrVal.assign(TokStart+2, CurPtr-1);
UnEscapeLexed(StrVal); UnEscapeLexed(StrVal);
if (StringRef(StrVal).contains(0)) { if (StringRef(StrVal).contains(0)) {
LexError("Null bytes are not allowed in names"); LexError("NUL character is not allowed in names");
return lltok::Error; return lltok::Error;
} }
return Var; return Var;
@ -410,7 +410,7 @@ lltok::Kind LLLexer::LexQuote() {
if (CurPtr[0] == ':') { if (CurPtr[0] == ':') {
++CurPtr; ++CurPtr;
if (StringRef(StrVal).contains(0)) { if (StringRef(StrVal).contains(0)) {
LexError("Null bytes are not allowed in names"); LexError("NUL character is not allowed in names");
kind = lltok::Error; kind = lltok::Error;
} else { } else {
kind = lltok::LabelStr; kind = lltok::LabelStr;
@ -492,7 +492,7 @@ lltok::Kind LLLexer::LexIdentifier() {
uint64_t NumBits = atoull(StartChar, CurPtr); uint64_t NumBits = atoull(StartChar, CurPtr);
if (NumBits < IntegerType::MIN_INT_BITS || if (NumBits < IntegerType::MIN_INT_BITS ||
NumBits > IntegerType::MAX_INT_BITS) { NumBits > IntegerType::MAX_INT_BITS) {
LexError("bitwidth for integer type out of range!"); LexError("bitwidth for integer type out of range");
return lltok::Error; return lltok::Error;
} }
TyVal = IntegerType::get(Context, NumBits); TyVal = IntegerType::get(Context, NumBits);
@ -1122,7 +1122,7 @@ lltok::Kind LLLexer::LexDigitOrNegative() {
uint64_t Val = atoull(TokStart, CurPtr); uint64_t Val = atoull(TokStart, CurPtr);
++CurPtr; // Skip the colon. ++CurPtr; // Skip the colon.
if ((unsigned)Val != Val) if ((unsigned)Val != Val)
LexError("invalid value number (too large)!"); LexError("invalid value number (too large)");
UIntVal = unsigned(Val); UIntVal = unsigned(Val);
return lltok::LabelID; return lltok::LabelID;
} }

View File

@ -89,7 +89,7 @@ TGLexer::TGLexer(SourceMgr &SM, ArrayRef<std::string> Macros) : SrcMgr(SM) {
for (StringRef MacroName : Macros) { for (StringRef MacroName : Macros) {
const char *End = lexMacroName(MacroName); const char *End = lexMacroName(MacroName);
if (End != MacroName.end()) if (End != MacroName.end())
PrintFatalError("Invalid macro name `" + MacroName + PrintFatalError("invalid macro name `" + MacroName +
"` specified on command line"); "` specified on command line");
DefinedMacros.insert(MacroName); DefinedMacros.insert(MacroName);
@ -188,7 +188,7 @@ tgtok::TokKind TGLexer::LexToken(bool FileOrLineStart) {
return LexIdentifier(); return LexIdentifier();
// Unknown character, emit an error. // Unknown character, emit an error.
return ReturnError(TokStart, "Unexpected character"); return ReturnError(TokStart, "unexpected character");
case EOF: case EOF:
// Lex next token, if we just left an include file. // Lex next token, if we just left an include file.
// Note that leaving an include file means that the next // Note that leaving an include file means that the next
@ -231,7 +231,7 @@ tgtok::TokKind TGLexer::LexToken(bool FileOrLineStart) {
++CurPtr; // Eat third dot. ++CurPtr; // Eat third dot.
return tgtok::dotdotdot; return tgtok::dotdotdot;
} }
return ReturnError(TokStart, "Invalid '..' punctuation"); return ReturnError(TokStart, "invalid '..' punctuation");
} }
return tgtok::dot; return tgtok::dot;
@ -255,7 +255,7 @@ tgtok::TokKind TGLexer::LexToken(bool FileOrLineStart) {
if (SkipCComment()) if (SkipCComment())
return tgtok::Error; return tgtok::Error;
} else // Otherwise, this is an error. } else // Otherwise, this is an error.
return ReturnError(TokStart, "Unexpected character"); return ReturnError(TokStart, "unexpected character");
return LexToken(FileOrLineStart); return LexToken(FileOrLineStart);
case '-': case '+': case '-': case '+':
case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '0': case '1': case '2': case '3': case '4': case '5': case '6':
@ -313,10 +313,10 @@ tgtok::TokKind TGLexer::LexString() {
while (*CurPtr != '"') { while (*CurPtr != '"') {
// If we hit the end of the buffer, report an error. // If we hit the end of the buffer, report an error.
if (*CurPtr == 0 && CurPtr == CurBuf.end()) if (*CurPtr == 0 && CurPtr == CurBuf.end())
return ReturnError(StrStart, "End of file in string literal"); return ReturnError(StrStart, "end of file in string literal");
if (*CurPtr == '\n' || *CurPtr == '\r') if (*CurPtr == '\n' || *CurPtr == '\r')
return ReturnError(StrStart, "End of line in string literal"); return ReturnError(StrStart, "end of line in string literal");
if (*CurPtr != '\\') { if (*CurPtr != '\\') {
CurStrVal += *CurPtr++; CurStrVal += *CurPtr++;
@ -346,7 +346,7 @@ tgtok::TokKind TGLexer::LexString() {
// If we hit the end of the buffer, report an error. // If we hit the end of the buffer, report an error.
case '\0': case '\0':
if (CurPtr == CurBuf.end()) if (CurPtr == CurBuf.end())
return ReturnError(StrStart, "End of file in string literal"); return ReturnError(StrStart, "end of file in string literal");
[[fallthrough]]; [[fallthrough]];
default: default:
return ReturnError(CurPtr, "invalid escape in string literal"); return ReturnError(CurPtr, "invalid escape in string literal");
@ -359,7 +359,7 @@ tgtok::TokKind TGLexer::LexString() {
tgtok::TokKind TGLexer::LexVarName() { tgtok::TokKind TGLexer::LexVarName() {
if (!isValidIDChar(CurPtr[0], /*First=*/true)) if (!isValidIDChar(CurPtr[0], /*First=*/true))
return ReturnError(TokStart, "Invalid variable name"); return ReturnError(TokStart, "invalid variable name");
// Otherwise, we're ok, consume the rest of the characters. // Otherwise, we're ok, consume the rest of the characters.
const char *VarNameStart = CurPtr++; const char *VarNameStart = CurPtr++;
@ -433,7 +433,7 @@ bool TGLexer::LexInclude() {
tgtok::TokKind Tok = LexToken(); tgtok::TokKind Tok = LexToken();
if (Tok == tgtok::Error) return true; if (Tok == tgtok::Error) return true;
if (Tok != tgtok::StrVal) { if (Tok != tgtok::StrVal) {
PrintError(getLoc(), "Expected filename after include"); PrintError(getLoc(), "expected filename after include");
return true; return true;
} }
@ -444,7 +444,7 @@ bool TGLexer::LexInclude() {
CurBuffer = SrcMgr.AddIncludeFile(Filename, SMLoc::getFromPointer(CurPtr), CurBuffer = SrcMgr.AddIncludeFile(Filename, SMLoc::getFromPointer(CurPtr),
IncludedFile); IncludedFile);
if (!CurBuffer) { if (!CurBuffer) {
PrintError(getLoc(), "Could not find include file '" + Filename + "'"); PrintError(getLoc(), "could not find include file '" + Filename + "'");
return true; return true;
} }
@ -476,7 +476,7 @@ bool TGLexer::SkipCComment() {
int CurChar = getNextChar(); int CurChar = getNextChar();
switch (CurChar) { switch (CurChar) {
case EOF: case EOF:
PrintError(TokStart, "Unterminated comment!"); PrintError(TokStart, "unterminated comment");
return true; return true;
case '*': case '*':
// End of the comment? // End of the comment?
@ -543,7 +543,7 @@ tgtok::TokKind TGLexer::LexNumber() {
// Requires at least one digit. // Requires at least one digit.
if (CurPtr == NumStart) if (CurPtr == NumStart)
return ReturnError(TokStart, "Invalid number"); return ReturnError(TokStart, "invalid number");
errno = 0; errno = 0;
if (IsMinus) if (IsMinus)
@ -552,9 +552,9 @@ tgtok::TokKind TGLexer::LexNumber() {
CurIntVal = strtoull(NumStart, nullptr, Base); CurIntVal = strtoull(NumStart, nullptr, Base);
if (errno == EINVAL) if (errno == EINVAL)
return ReturnError(TokStart, "Invalid number"); return ReturnError(TokStart, "invalid number");
if (errno == ERANGE) if (errno == ERANGE)
return ReturnError(TokStart, "Number out of range"); return ReturnError(TokStart, "number out of range");
return Base == 2 ? tgtok::BinaryIntVal : tgtok::IntVal; return Base == 2 ? tgtok::BinaryIntVal : tgtok::IntVal;
} }
@ -580,13 +580,13 @@ tgtok::TokKind TGLexer::LexBracket() {
} }
} }
return ReturnError(CodeStart - 2, "Unterminated code block"); return ReturnError(CodeStart - 2, "unterminated code block");
} }
/// LexExclaim - Lex '!' and '![a-zA-Z]+'. /// LexExclaim - Lex '!' and '![a-zA-Z]+'.
tgtok::TokKind TGLexer::LexExclaim() { tgtok::TokKind TGLexer::LexExclaim() {
if (!isAlpha(*CurPtr)) if (!isAlpha(*CurPtr))
return ReturnError(CurPtr - 1, "Invalid \"!operator\""); return ReturnError(CurPtr - 1, "invalid \"!operator\"");
const char *Start = CurPtr++; const char *Start = CurPtr++;
while (isAlpha(*CurPtr)) while (isAlpha(*CurPtr))
@ -648,7 +648,8 @@ tgtok::TokKind TGLexer::LexExclaim() {
.Case("repr", tgtok::XRepr) .Case("repr", tgtok::XRepr)
.Default(tgtok::Error); .Default(tgtok::Error);
return Kind != tgtok::Error ? Kind : ReturnError(Start-1, "Unknown operator"); return Kind != tgtok::Error ? Kind
: ReturnError(Start - 1, "unknown operator");
} }
bool TGLexer::prepExitInclude(bool IncludeStackMustBeEmpty) { bool TGLexer::prepExitInclude(bool IncludeStackMustBeEmpty) {
@ -662,17 +663,17 @@ bool TGLexer::prepExitInclude(bool IncludeStackMustBeEmpty) {
// Pop the preprocessing controls from the include stack. // Pop the preprocessing controls from the include stack.
if (PrepIncludeStack.empty()) { if (PrepIncludeStack.empty()) {
PrintFatalError("Preprocessor include stack is empty"); PrintFatalError("preprocessor include stack is empty");
} }
PrepIncludeStack.pop_back(); PrepIncludeStack.pop_back();
if (IncludeStackMustBeEmpty) { if (IncludeStackMustBeEmpty) {
if (!PrepIncludeStack.empty()) if (!PrepIncludeStack.empty())
PrintFatalError("Preprocessor include stack is not empty"); PrintFatalError("preprocessor include stack is not empty");
} else { } else {
if (PrepIncludeStack.empty()) if (PrepIncludeStack.empty())
PrintFatalError("Preprocessor include stack is empty"); PrintFatalError("preprocessor include stack is empty");
} }
return true; return true;
@ -732,7 +733,7 @@ bool TGLexer::prepEatPreprocessorDirective(tgtok::TokKind Kind) {
return true; return true;
} }
PrintFatalError("Unsupported preprocessing token in " PrintFatalError("unsupported preprocessing token in "
"prepEatPreprocessorDirective()"); "prepEatPreprocessorDirective()");
return false; return false;
} }
@ -748,7 +749,7 @@ tgtok::TokKind TGLexer::lexPreprocessor(tgtok::TokKind Kind,
StringRef MacroName = prepLexMacroName(); StringRef MacroName = prepLexMacroName();
StringRef IfTokName = Kind == tgtok::Ifdef ? "#ifdef" : "#ifndef"; StringRef IfTokName = Kind == tgtok::Ifdef ? "#ifdef" : "#ifndef";
if (MacroName.empty()) if (MacroName.empty())
return ReturnError(TokStart, "Expected macro name after " + IfTokName); return ReturnError(TokStart, "expected macro name after " + IfTokName);
bool MacroIsDefined = DefinedMacros.count(MacroName) != 0; bool MacroIsDefined = DefinedMacros.count(MacroName) != 0;
@ -763,7 +764,7 @@ tgtok::TokKind TGLexer::lexPreprocessor(tgtok::TokKind Kind,
{tgtok::Ifdef, MacroIsDefined, SMLoc::getFromPointer(TokStart)}); {tgtok::Ifdef, MacroIsDefined, SMLoc::getFromPointer(TokStart)});
if (!prepSkipDirectiveEnd()) if (!prepSkipDirectiveEnd())
return ReturnError(CurPtr, "Only comments are supported after " + return ReturnError(CurPtr, "only comments are supported after " +
IfTokName + " NAME"); IfTokName + " NAME");
// If we were not processing tokens before this #ifdef, // If we were not processing tokens before this #ifdef,
@ -794,7 +795,7 @@ tgtok::TokKind TGLexer::lexPreprocessor(tgtok::TokKind Kind,
if (IfdefEntry.Kind != tgtok::Ifdef) { if (IfdefEntry.Kind != tgtok::Ifdef) {
PrintError(TokStart, "double #else"); PrintError(TokStart, "double #else");
return ReturnError(IfdefEntry.SrcPos, "Previous #else is here"); return ReturnError(IfdefEntry.SrcPos, "previous #else is here");
} }
// Replace the corresponding #ifdef's control with its negation // Replace the corresponding #ifdef's control with its negation
@ -804,7 +805,7 @@ tgtok::TokKind TGLexer::lexPreprocessor(tgtok::TokKind Kind,
{Kind, !IfdefEntry.IsDefined, SMLoc::getFromPointer(TokStart)}); {Kind, !IfdefEntry.IsDefined, SMLoc::getFromPointer(TokStart)});
if (!prepSkipDirectiveEnd()) if (!prepSkipDirectiveEnd())
return ReturnError(CurPtr, "Only comments are supported after #else"); return ReturnError(CurPtr, "only comments are supported after #else");
// If we were processing tokens before this #else, // If we were processing tokens before this #else,
// we have to start skipping lines until the matching #endif. // we have to start skipping lines until the matching #endif.
@ -827,12 +828,12 @@ tgtok::TokKind TGLexer::lexPreprocessor(tgtok::TokKind Kind,
if (IfdefOrElseEntry.Kind != tgtok::Ifdef && if (IfdefOrElseEntry.Kind != tgtok::Ifdef &&
IfdefOrElseEntry.Kind != tgtok::Else) { IfdefOrElseEntry.Kind != tgtok::Else) {
PrintFatalError("Invalid preprocessor control on the stack"); PrintFatalError("invalid preprocessor control on the stack");
return tgtok::Error; return tgtok::Error;
} }
if (!prepSkipDirectiveEnd()) if (!prepSkipDirectiveEnd())
return ReturnError(CurPtr, "Only comments are supported after #endif"); return ReturnError(CurPtr, "only comments are supported after #endif");
PrepIncludeStack.back()->pop_back(); PrepIncludeStack.back()->pop_back();
@ -847,15 +848,15 @@ tgtok::TokKind TGLexer::lexPreprocessor(tgtok::TokKind Kind,
} else if (Kind == tgtok::Define) { } else if (Kind == tgtok::Define) {
StringRef MacroName = prepLexMacroName(); StringRef MacroName = prepLexMacroName();
if (MacroName.empty()) if (MacroName.empty())
return ReturnError(TokStart, "Expected macro name after #define"); return ReturnError(TokStart, "expected macro name after #define");
if (!DefinedMacros.insert(MacroName).second) if (!DefinedMacros.insert(MacroName).second)
PrintWarning(getLoc(), PrintWarning(getLoc(),
"Duplicate definition of macro: " + Twine(MacroName)); "duplicate definition of macro: " + Twine(MacroName));
if (!prepSkipDirectiveEnd()) if (!prepSkipDirectiveEnd())
return ReturnError(CurPtr, return ReturnError(CurPtr,
"Only comments are supported after #define NAME"); "only comments are supported after #define NAME");
if (!ReturnNextLiveToken) { if (!ReturnNextLiveToken) {
PrintFatalError("#define must be ignored during the lines skipping"); PrintFatalError("#define must be ignored during the lines skipping");
@ -865,13 +866,13 @@ tgtok::TokKind TGLexer::lexPreprocessor(tgtok::TokKind Kind,
return LexToken(); return LexToken();
} }
PrintFatalError("Preprocessing directive is not supported"); PrintFatalError("preprocessing directive is not supported");
return tgtok::Error; return tgtok::Error;
} }
bool TGLexer::prepSkipRegion(bool MustNeverBeFalse) { bool TGLexer::prepSkipRegion(bool MustNeverBeFalse) {
if (!MustNeverBeFalse) if (!MustNeverBeFalse)
PrintFatalError("Invalid recursion."); PrintFatalError("invalid recursion.");
do { do {
// Skip all symbols to the line end. // Skip all symbols to the line end.
@ -917,7 +918,7 @@ bool TGLexer::prepSkipRegion(bool MustNeverBeFalse) {
// due to #else or #endif. // due to #else or #endif.
if (prepIsProcessingEnabled()) { if (prepIsProcessingEnabled()) {
if (Kind != tgtok::Else && Kind != tgtok::Endif) { if (Kind != tgtok::Else && Kind != tgtok::Endif) {
PrintFatalError("Tokens processing was enabled by an unexpected " PrintFatalError("tokens processing was enabled by an unexpected "
"preprocessing directive"); "preprocessing directive");
return false; return false;
} }
@ -1032,7 +1033,7 @@ bool TGLexer::prepSkipDirectiveEnd() {
return false; return false;
} else { } else {
TokStart = CurPtr; TokStart = CurPtr;
PrintError(CurPtr, "Unexpected character"); PrintError(CurPtr, "unexpected character");
return false; return false;
} }
@ -1067,8 +1068,8 @@ void TGLexer::prepReportPreprocessorStackError() {
"empty control stack"); "empty control stack");
auto &PrepControl = PrepIncludeStack.back()->back(); auto &PrepControl = PrepIncludeStack.back()->back();
PrintError(CurBuf.end(), "Reached EOF without matching #endif"); PrintError(CurBuf.end(), "reached EOF without matching #endif");
PrintError(PrepControl.SrcPos, "The latest preprocessor control is here"); PrintError(PrepControl.SrcPos, "the latest preprocessor control is here");
TokStart = CurPtr; TokStart = CurPtr;
} }

View File

@ -1,5 +1,5 @@
; RUN: not llvm-as --disable-output %s 2>&1 | FileCheck -DFILE=%s %s ; RUN: not llvm-as --disable-output %s 2>&1 | FileCheck -DFILE=%s %s
; i8388609 is the smallest integer type that can't be represented in LLVM IR ; i8388609 is the smallest integer type that can't be represented in LLVM IR
; CHECK: [[FILE]]:[[@LINE+1]]:21: error: bitwidth for integer type out of range! ; CHECK: [[FILE]]:[[@LINE+1]]:21: error: bitwidth for integer type out of range
@i2 = common global i8388609 0, align 4 @i2 = common global i8388609 0, align 4

Binary file not shown.

Binary file not shown.

View File

@ -16,7 +16,7 @@ def {
#ifdef OOR3 #ifdef OOR3
bits<64> Val = 0x10000000000000000; bits<64> Val = 0x10000000000000000;
#endif #endif
// CHECK-OOR: error: Number out of range // CHECK-OOR: error: number out of range
bits<64> BinVal0 = 0x8000000000000000; bits<64> BinVal0 = 0x8000000000000000;
bits<64> HexVal0 = 0b1000000000000000000000000000000000000000000000000000000000000000; bits<64> HexVal0 = 0b1000000000000000000000000000000000000000000000000000000000000000;

View File

@ -3,7 +3,7 @@
// RUN: not llvm-tblgen %s -D_MAC# 2>&1 | FileCheck %s --check-prefix=CHECK-TEST-3 // RUN: not llvm-tblgen %s -D_MAC# 2>&1 | FileCheck %s --check-prefix=CHECK-TEST-3
// RUN: not llvm-tblgen %s -D 2>&1 | FileCheck %s --check-prefix=CHECK-TEST-4 // RUN: not llvm-tblgen %s -D 2>&1 | FileCheck %s --check-prefix=CHECK-TEST-4
// CHECK-TEST-1: error: Invalid macro name `MACRO=1` specified on command line // CHECK-TEST-1: error: invalid macro name `MACRO=1` specified on command line
// CHECK-TEST-2: error: Invalid macro name `0MAC` specified on command line // CHECK-TEST-2: error: invalid macro name `0MAC` specified on command line
// CHECK-TEST-3: error: Invalid macro name `_MAC#` specified on command line // CHECK-TEST-3: error: invalid macro name `_MAC#` specified on command line
// CHECK-TEST-4: for the -D option: requires a value! // CHECK-TEST-4: for the -D option: requires a value!

View File

@ -4,22 +4,22 @@
// RUN: not llvm-tblgen -I %p %s 2>&1 | FileCheck --check-prefixes=DIAG3 %s // RUN: not llvm-tblgen -I %p %s 2>&1 | FileCheck --check-prefixes=DIAG3 %s
#ifdef DIAG1 #ifdef DIAG1
// DIAG1: error: Only comments are supported after #define NAME // DIAG1: error: only comments are supported after #define NAME
#define ENABLED1/* #define ENABLED1/*
*/class C; */class C;
#endif // DIAG1 #endif // DIAG1
#ifdef DIAG4 #ifdef DIAG4
// DIAG4: warning: Duplicate definition of macro: ENABLED1 // DIAG4: warning: duplicate definition of macro: ENABLED1
#define ENABLED1 #define ENABLED1
#define ENABLED1 #define ENABLED1
#endif // DIAG4 #endif // DIAG4
#ifdef DIAG2 #ifdef DIAG2
// DIAG2: error: Only comments are supported after #ifdef NAME // DIAG2: error: only comments are supported after #ifdef NAME
// Invalid #ifdef below should be detected even if DIAG2 is not defined. // Invalid #ifdef below should be detected even if DIAG2 is not defined.
// DIAG3: error: Only comments are supported after #ifdef NAME // DIAG3: error: only comments are supported after #ifdef NAME
#ifdef DIAG2/* #ifdef DIAG2/*
*/class C; */class C;
#endif #endif

View File

@ -1,6 +1,6 @@
// RUN: not llvm-tblgen -I %p %s 2>&1 | FileCheck %s // RUN: not llvm-tblgen -I %p %s 2>&1 | FileCheck %s
// CHECK: error: Reached EOF without matching #endif // CHECK: error: reached EOF without matching #endif
// CHECK: error: The latest preprocessor control is here // CHECK: error: the latest preprocessor control is here
#ifdef DISABLED #ifdef DISABLED
#else #else

View File

@ -1,7 +1,7 @@
// RUN: not llvm-tblgen -I %p %s 2>&1 | FileCheck %s // RUN: not llvm-tblgen -I %p %s 2>&1 | FileCheck %s
// CHECK: error: Reached EOF without matching #endif // CHECK: error: reached EOF without matching #endif
// CHECK: error: The latest preprocessor control is here // CHECK: error: the latest preprocessor control is here
#ifdef DISABLED #ifdef DISABLED
#else #else
#define ENABLED #define ENABLED

View File

@ -1,7 +1,7 @@
// RUN: not llvm-tblgen -I %p %s 2>&1 | FileCheck %s // RUN: not llvm-tblgen -I %p %s 2>&1 | FileCheck %s
// CHECK: error: Reached EOF without matching #endif // CHECK: error: reached EOF without matching #endif
// CHECK: error: The latest preprocessor control is here // CHECK: error: the latest preprocessor control is here
#ifdef DISABLED #ifdef DISABLED
#else #else
#define ENABLED #define ENABLED

View File

@ -1,7 +1,7 @@
// RUN: not llvm-tblgen -I %p %s 2>&1 | FileCheck %s // RUN: not llvm-tblgen -I %p %s 2>&1 | FileCheck %s
// CHECK: error: Reached EOF without matching #endif // CHECK: error: reached EOF without matching #endif
// CHECK: error: The latest preprocessor control is here // CHECK: error: the latest preprocessor control is here
#ifdef DISABLED #ifdef DISABLED
/* /*
#else #else

View File

@ -1,6 +1,6 @@
// RUN: not llvm-tblgen -I %p %s 2>&1 | FileCheck %s // RUN: not llvm-tblgen -I %p %s 2>&1 | FileCheck %s
// CHECK: error: Reached EOF without matching #endif // CHECK: error: reached EOF without matching #endif
// CHECK: error: The latest preprocessor control is here // CHECK: error: the latest preprocessor control is here
#ifdef DISABLED #ifdef DISABLED
// #endif // #endif

View File

@ -2,10 +2,10 @@
// RUN: not llvm-tblgen -I %p %s 2>&1 | FileCheck --check-prefixes=DIAG2 %s // RUN: not llvm-tblgen -I %p %s 2>&1 | FileCheck --check-prefixes=DIAG2 %s
#ifdef DIAG1 #ifdef DIAG1
// DIAG1: error: Only comments are supported after #else // DIAG1: error: only comments are supported after #else
// Invalid #else below should be detected even if DIAG1 is not defined. // Invalid #else below should be detected even if DIAG1 is not defined.
// DIAG2: error: Only comments are supported after #else // DIAG2: error: only comments are supported after #else
#ifdef DIAG2//DIAG2 #ifdef DIAG2//DIAG2
#else/* #else/*
*/class C; */class C;

View File

@ -2,10 +2,10 @@
// RUN: not llvm-tblgen -I %p %s 2>&1 | FileCheck --check-prefixes=DIAG2 %s // RUN: not llvm-tblgen -I %p %s 2>&1 | FileCheck --check-prefixes=DIAG2 %s
#ifdef DIAG1 #ifdef DIAG1
// DIAG1: error: Only comments are supported after #endif // DIAG1: error: only comments are supported after #endif
// Invalid #else below should be detected even if DIAG1 is not defined. // Invalid #else below should be detected even if DIAG1 is not defined.
// DIAG2: error: Only comments are supported after #endif // DIAG2: error: only comments are supported after #endif
#ifdef DIAG2//DIAG2 #ifdef DIAG2//DIAG2
#else/*!DIAG2*/ #else/*!DIAG2*/
#endif/* !DIAG2 #endif/* !DIAG2

View File

@ -1,7 +1,7 @@
// RUN: not llvm-tblgen -I %p %s 2>&1 | FileCheck %s // RUN: not llvm-tblgen -I %p %s 2>&1 | FileCheck %s
// CHECK: error: double #else // CHECK: error: double #else
// CHECK: error: Previous #else is here // CHECK: error: previous #else is here
#ifdef DIAG1 #ifdef DIAG1
#else #else
#else #else

View File

@ -1,6 +1,6 @@
// RUN: not llvm-tblgen -I %p %s 2>&1 | FileCheck %s // RUN: not llvm-tblgen -I %p %s 2>&1 | FileCheck %s
// CHECK: error: Expected macro name after #ifdef // CHECK: error: expected macro name after #ifdef
#ifdef #ifdef
#else #else
#else #else

View File

@ -1,5 +1,5 @@
// RUN: not llvm-tblgen -I %p %s 2>&1 | FileCheck %s // RUN: not llvm-tblgen -I %p %s 2>&1 | FileCheck %s
// CHECK: error: Expected macro name after #define // CHECK: error: expected macro name after #define
#define #define
#endif #endif

View File

@ -1,5 +1,5 @@
// RUN: not llvm-tblgen -I %p %s 2>&1 | FileCheck %s // RUN: not llvm-tblgen -I %p %s 2>&1 | FileCheck %s
// CHECK: error: Reached EOF without matching #endif // CHECK: error: reached EOF without matching #endif
// CHECK: error: The latest preprocessor control is here // CHECK: error: the latest preprocessor control is here
#ifdef DISABLED #ifdef DISABLED

View File

@ -1,4 +1,4 @@
// RUN: not llvm-tblgen %s 2>&1 | FileCheck %s // RUN: not llvm-tblgen %s 2>&1 | FileCheck %s
// CHECK: error: Expected macro name after #ifndef // CHECK: error: expected macro name after #ifndef
#ifndef 1 #ifndef 1

View File

@ -1,4 +1,4 @@
// RUN: not llvm-tblgen %s 2>&1 | FileCheck %s // RUN: not llvm-tblgen %s 2>&1 | FileCheck %s
// CHECK: error: Only comments are supported after #ifndef NAME // CHECK: error: only comments are supported after #ifndef NAME
#ifndef MACRO 42 #ifndef MACRO 42

View File

@ -1,5 +1,5 @@
// RUN: not llvm-tblgen -I %p %s 2>&1 | FileCheck %s // RUN: not llvm-tblgen -I %p %s 2>&1 | FileCheck %s
// CHECK: error: Unterminated comment! // CHECK: error: unterminated comment
include "unterminated-c-comment-include.inc" */ include "unterminated-c-comment-include.inc" */

View File

@ -1,5 +1,5 @@
// RUN: not llvm-tblgen -I %p %s 2>&1 | FileCheck %s // RUN: not llvm-tblgen -I %p %s 2>&1 | FileCheck %s
// CHECK: error: Unterminated code block // CHECK: error: unterminated code block
include "unterminated-code-block-include.inc" }]>; include "unterminated-code-block-include.inc" }]>;