Replace double-negated !SourceLocation.isInvalid() with SourceLocation.isValid().

llvm-svn: 249228
This commit is contained in:
Yaron Keren 2015-10-03 05:15:57 +00:00
parent a8180a238c
commit ed1fe5d093
10 changed files with 15 additions and 15 deletions

View File

@ -736,7 +736,7 @@ static bool rewriteToNSEnumDecl(const EnumDecl *EnumDcl,
SourceLocation EndOfEnumDclLoc = EnumDcl->getLocEnd();
EndOfEnumDclLoc = trans::findSemiAfterLocation(EndOfEnumDclLoc,
NS.getASTContext(), /*IsDecl*/true);
if (!EndOfEnumDclLoc.isInvalid()) {
if (EndOfEnumDclLoc.isValid()) {
SourceRange EnumDclRange(EnumDcl->getLocStart(), EndOfEnumDclLoc);
commit.insertFromRange(TypedefDcl->getLocStart(), EnumDclRange);
}
@ -746,7 +746,7 @@ static bool rewriteToNSEnumDecl(const EnumDecl *EnumDcl,
SourceLocation EndTypedefDclLoc = TypedefDcl->getLocEnd();
EndTypedefDclLoc = trans::findSemiAfterLocation(EndTypedefDclLoc,
NS.getASTContext(), /*IsDecl*/true);
if (!EndTypedefDclLoc.isInvalid()) {
if (EndTypedefDclLoc.isValid()) {
SourceRange TDRange(TypedefDcl->getLocStart(), EndTypedefDclLoc);
commit.remove(TDRange);
}
@ -755,7 +755,7 @@ static bool rewriteToNSEnumDecl(const EnumDecl *EnumDcl,
EndOfEnumDclLoc = trans::findLocationAfterSemi(EnumDcl->getLocEnd(), NS.getASTContext(),
/*IsDecl*/true);
if (!EndOfEnumDclLoc.isInvalid()) {
if (EndOfEnumDclLoc.isValid()) {
SourceLocation BeginOfEnumDclLoc = EnumDcl->getLocStart();
// FIXME. This assumes that enum decl; is immediately preceded by eoln.
// It is trying to remove the enum decl. lines entirely.

View File

@ -192,7 +192,7 @@ SourceLocation TypeLoc::getBeginLoc() const {
Cur = Cur.getNextTypeLoc();
continue;
default:
if (!Cur.getLocalSourceRange().getBegin().isInvalid())
if (Cur.getLocalSourceRange().getBegin().isValid())
LeftMost = Cur;
Cur = Cur.getNextTypeLoc();
if (Cur.isNull())

View File

@ -787,7 +787,7 @@ static void findBlockLocations(CFG *CFGraph,
}
}
if (!CurrBlockInfo->ExitLoc.isInvalid()) {
if (CurrBlockInfo->ExitLoc.isValid()) {
// This block contains at least one statement. Find the source location
// of the first statement in the block.
for (CFGBlock::const_iterator BI = CurrBlock->begin(),

View File

@ -40,7 +40,7 @@ bool SanitizerBlacklist::isBlacklistedFile(StringRef FileName,
bool SanitizerBlacklist::isBlacklistedLocation(SourceLocation Loc,
StringRef Category) const {
return !Loc.isInvalid() &&
return Loc.isValid() &&
isBlacklistedFile(SM.getFilename(SM.getFileLoc(Loc)), Category);
}

View File

@ -1281,7 +1281,7 @@ bool CodeGenModule::isInSanitizerBlacklist(llvm::Function *Fn,
if (SanitizerBL.isBlacklistedFunction(Fn->getName()))
return true;
// Blacklist by location.
if (!Loc.isInvalid())
if (Loc.isValid())
return SanitizerBL.isBlacklistedLocation(Loc);
// If location is unknown, this may be a compiler-generated function. Assume
// it's located in the main file.

View File

@ -163,7 +163,7 @@ public:
unsigned Depth = 0;
for (SourceLocation Parent = getIncludeOrExpansionLoc(Loc);
!Parent.isInvalid(); Parent = getIncludeOrExpansionLoc(Parent))
Parent.isValid(); Parent = getIncludeOrExpansionLoc(Parent))
++Depth;
FileLocs.push_back(std::make_pair(Loc, Depth));
}
@ -569,7 +569,7 @@ struct CounterCoverageMappingBuilder
}
void VisitStmt(const Stmt *S) {
if (!S->getLocStart().isInvalid())
if (S->getLocStart().isValid())
extendRegion(S);
for (const Stmt *Child : S->children())
if (Child)

View File

@ -518,7 +518,7 @@ void DiagnosticRenderer::emitMacroExpansions(SourceLocation Loc,
ArrayRef<CharSourceRange> Ranges,
ArrayRef<FixItHint> Hints,
const SourceManager &SM) {
assert(!Loc.isInvalid() && "must have a valid source location here");
assert(Loc.isValid() && "must have a valid source location here");
// Produce a stack of macro backtraces.
SmallVector<SourceLocation, 8> LocationStack;
@ -541,7 +541,7 @@ void DiagnosticRenderer::emitMacroExpansions(SourceLocation Loc,
// backtraces.
if (Loc.isFileID())
Loc = SM.getImmediateMacroCallerLoc(LocationStack.back());
assert(!Loc.isInvalid() && "must have a valid source location here");
assert(Loc.isValid() && "must have a valid source location here");
}
LocationStack.erase(LocationStack.begin(),
@ -598,7 +598,7 @@ void DiagnosticNoteRenderer::emitImportLocation(SourceLocation Loc,
SmallString<200> MessageStorage;
llvm::raw_svector_ostream Message(MessageStorage);
Message << "in module '" << ModuleName;
if (!PLoc.isInvalid())
if (PLoc.isValid())
Message << "' imported from " << PLoc.getFilename() << ':'
<< PLoc.getLine();
Message << ":";

View File

@ -160,7 +160,7 @@ void InclusionRewriter::FileChanged(SourceLocation Loc,
void InclusionRewriter::FileSkipped(const FileEntry &/*SkippedFile*/,
const Token &/*FilenameTok*/,
SrcMgr::CharacteristicKind /*FileType*/) {
assert(!LastInclusionLocation.isInvalid() &&
assert(LastInclusionLocation.isValid() &&
"A file, that wasn't found via an inclusion directive, was skipped");
LastInclusionLocation = SourceLocation();
}

View File

@ -1060,7 +1060,7 @@ void TextDiagnostic::emitSnippetAndCaret(
SmallVectorImpl<CharSourceRange>& Ranges,
ArrayRef<FixItHint> Hints,
const SourceManager &SM) {
assert(!Loc.isInvalid() && "must have a valid source location here");
assert(Loc.isValid() && "must have a valid source location here");
assert(Loc.isFileID() && "must have a file location here");
// If caret diagnostics are enabled and we have location, we want to

View File

@ -952,7 +952,7 @@ void DeclSpec::Finish(DiagnosticsEngine &D, Preprocessor &PP, const PrintingPoli
FixItHint Hints[NumLocs];
SourceLocation FirstLoc;
for (unsigned I = 0; I != NumLocs; ++I) {
if (!ExtraLocs[I].isInvalid()) {
if (ExtraLocs[I].isValid()) {
if (FirstLoc.isInvalid() ||
PP.getSourceManager().isBeforeInTranslationUnit(ExtraLocs[I],
FirstLoc))