From: Yaron Keren Date: Sat, 3 Oct 2015 05:15:57 +0000 (+0000) Subject: Replace double-negated !SourceLocation.isInvalid() with SourceLocation.isValid(). X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=facf2d2c3bb56076e57f4f2b2a74b9b8c4071fad;p=clang Replace double-negated !SourceLocation.isInvalid() with SourceLocation.isValid(). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@249228 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/ARCMigrate/ObjCMT.cpp b/lib/ARCMigrate/ObjCMT.cpp index 921495824e..1747dca066 100644 --- a/lib/ARCMigrate/ObjCMT.cpp +++ b/lib/ARCMigrate/ObjCMT.cpp @@ -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. diff --git a/lib/AST/TypeLoc.cpp b/lib/AST/TypeLoc.cpp index f7f7b05b38..d08b07b2cc 100644 --- a/lib/AST/TypeLoc.cpp +++ b/lib/AST/TypeLoc.cpp @@ -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()) diff --git a/lib/Analysis/ThreadSafety.cpp b/lib/Analysis/ThreadSafety.cpp index 922b157a2a..bce5175ece 100644 --- a/lib/Analysis/ThreadSafety.cpp +++ b/lib/Analysis/ThreadSafety.cpp @@ -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(), diff --git a/lib/Basic/SanitizerBlacklist.cpp b/lib/Basic/SanitizerBlacklist.cpp index 095fcd6cca..de78c94bc1 100644 --- a/lib/Basic/SanitizerBlacklist.cpp +++ b/lib/Basic/SanitizerBlacklist.cpp @@ -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); } diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp index 647cf0bd6a..9e9963cd19 100644 --- a/lib/CodeGen/CodeGenModule.cpp +++ b/lib/CodeGen/CodeGenModule.cpp @@ -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. diff --git a/lib/CodeGen/CoverageMappingGen.cpp b/lib/CodeGen/CoverageMappingGen.cpp index 1c7656fa34..3561a57aae 100644 --- a/lib/CodeGen/CoverageMappingGen.cpp +++ b/lib/CodeGen/CoverageMappingGen.cpp @@ -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) diff --git a/lib/Frontend/DiagnosticRenderer.cpp b/lib/Frontend/DiagnosticRenderer.cpp index 923d5e97c1..6ef9a89d86 100644 --- a/lib/Frontend/DiagnosticRenderer.cpp +++ b/lib/Frontend/DiagnosticRenderer.cpp @@ -518,7 +518,7 @@ void DiagnosticRenderer::emitMacroExpansions(SourceLocation Loc, ArrayRef Ranges, ArrayRef 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 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 << ":"; diff --git a/lib/Frontend/Rewrite/InclusionRewriter.cpp b/lib/Frontend/Rewrite/InclusionRewriter.cpp index 08d6cf1f92..97baa72023 100644 --- a/lib/Frontend/Rewrite/InclusionRewriter.cpp +++ b/lib/Frontend/Rewrite/InclusionRewriter.cpp @@ -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(); } diff --git a/lib/Frontend/TextDiagnostic.cpp b/lib/Frontend/TextDiagnostic.cpp index ee24c3b1c5..d2dd192561 100644 --- a/lib/Frontend/TextDiagnostic.cpp +++ b/lib/Frontend/TextDiagnostic.cpp @@ -1060,7 +1060,7 @@ void TextDiagnostic::emitSnippetAndCaret( SmallVectorImpl& Ranges, ArrayRef 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 diff --git a/lib/Sema/DeclSpec.cpp b/lib/Sema/DeclSpec.cpp index 2cf35b9d28..05ec5d4abc 100644 --- a/lib/Sema/DeclSpec.cpp +++ b/lib/Sema/DeclSpec.cpp @@ -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))