Index: lib/Support/FileCheck.cpp =================================================================== --- lib/Support/FileCheck.cpp +++ lib/Support/FileCheck.cpp @@ -737,6 +737,8 @@ // LineNumber keeps track of the line on which CheckPrefix instances are // found. unsigned LineNumber = 1; + bool HasNonLabelPrefix = false; + StringRef MatchedPrefix; while (1) { Check::FileCheckType CheckTy; @@ -746,6 +748,7 @@ CheckTy); if (UsedPrefix.empty()) break; + MatchedPrefix = UsedPrefix; assert(UsedPrefix.data() == Buffer.data() && "Failed to move Buffer's start forward, or pointed prefix outside " "of the buffer!"); @@ -763,8 +766,11 @@ return true; } - // Okay, we found the prefix, yay. Remember the rest of the line, but ignore - // leading whitespace. + // Okay, we found the prefix, yay. + if (CheckTy != Check::CheckLabel) + HasNonLabelPrefix = true; + + // Remember the rest of the line, but ignore leading whitespace. if (!(Req.NoCanonicalizeWhiteSpace && Req.MatchFullLines)) Buffer = Buffer.substr(Buffer.find_first_not_of(" \t")); @@ -840,6 +846,12 @@ return true; } + if (!HasNonLabelPrefix) + SM.PrintMessage(SMLoc::getFromPointer(Buffer.data()), + SourceMgr::DK_Note, + "Prefix " + MatchedPrefix + " only occurs in a LABEL check, " + "this is probably not what you want"); + return false; }