[clang-tools-extra] r249235 - Replace double negation of !FileID.isInvalid() with FileID.isValid().
Alexander Kornienko via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 6 17:12:42 PDT 2015
I'd say that the SourceLocation::isInvalid is more confusing than useful.
Not sure why it was added in the first place.
On Sat, Oct 3, 2015 at 12:46 PM, Yaron Keren via cfe-commits <
cfe-commits at lists.llvm.org> wrote:
> Author: yrnkrn
> Date: Sat Oct 3 05:46:20 2015
> New Revision: 249235
>
> URL: http://llvm.org/viewvc/llvm-project?rev=249235&view=rev
> Log:
> Replace double negation of !FileID.isInvalid() with FileID.isValid().
> +couple more of double-negated !SourceLocation.isInvalid() unfixed in
> r249228.
>
>
> Modified:
>
> clang-tools-extra/trunk/clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp
> clang-tools-extra/trunk/clang-modernize/Core/IncludeDirectives.cpp
> clang-tools-extra/trunk/clang-modernize/LoopConvert/LoopActions.cpp
> clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertUtils.cpp
>
> Modified:
> clang-tools-extra/trunk/clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp?rev=249235&r1=249234&r2=249235&view=diff
>
> ==============================================================================
> ---
> clang-tools-extra/trunk/clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp
> (original)
> +++
> clang-tools-extra/trunk/clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp
> Sat Oct 3 05:46:20 2015
> @@ -118,7 +118,7 @@ getRewrittenData(const std::vector<tooli
> const clang::FileEntry *Entry = Files.getFile(FileName);
> assert(Entry && "Expected an existing file");
> FileID ID = SM.translateFile(Entry);
> - assert(!ID.isInvalid() && "Expected a valid FileID");
> + assert(ID.isValid() && "Expected a valid FileID");
> const RewriteBuffer *Buffer = Rewrites.getRewriteBufferFor(ID);
> Result = std::string(Buffer->begin(), Buffer->end());
>
>
> Modified:
> clang-tools-extra/trunk/clang-modernize/Core/IncludeDirectives.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-modernize/Core/IncludeDirectives.cpp?rev=249235&r1=249234&r2=249235&view=diff
>
> ==============================================================================
> --- clang-tools-extra/trunk/clang-modernize/Core/IncludeDirectives.cpp
> (original)
> +++ clang-tools-extra/trunk/clang-modernize/Core/IncludeDirectives.cpp Sat
> Oct 3 05:46:20 2015
> @@ -354,7 +354,7 @@ bool IncludeDirectives::hasInclude(const
> Replacement IncludeDirectives::addAngledInclude(const clang::FileEntry
> *File,
> llvm::StringRef Include) {
> FileID FID = Sources.translateFile(File);
> - assert(!FID.isInvalid() && "Invalid file entry given!");
> + assert(FID.isValid() && "Invalid file entry given!");
>
> if (hasInclude(File, Include))
> return Replacement();
>
> Modified:
> clang-tools-extra/trunk/clang-modernize/LoopConvert/LoopActions.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-modernize/LoopConvert/LoopActions.cpp?rev=249235&r1=249234&r2=249235&view=diff
>
> ==============================================================================
> --- clang-tools-extra/trunk/clang-modernize/LoopConvert/LoopActions.cpp
> (original)
> +++ clang-tools-extra/trunk/clang-modernize/LoopConvert/LoopActions.cpp
> Sat Oct 3 05:46:20 2015
> @@ -578,7 +578,7 @@ bool ForLoopIndexUseVisitor::TraverseMem
> Context->getLangOpts());
> // If something complicated is happening (i.e. the next token isn't an
> // arrow), give up on making this work.
> - if (!ArrowLoc.isInvalid()) {
> + if (ArrowLoc.isValid()) {
> Usages.push_back(Usage(ResultExpr, /*IsArrow=*/true,
> SourceRange(Base->getExprLoc(), ArrowLoc)));
> return true;
>
> Modified: clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertUtils.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertUtils.cpp?rev=249235&r1=249234&r2=249235&view=diff
>
> ==============================================================================
> --- clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertUtils.cpp
> (original)
> +++ clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertUtils.cpp Sat
> Oct 3 05:46:20 2015
> @@ -559,7 +559,7 @@ bool ForLoopIndexUseVisitor::TraverseMem
> Context->getLangOpts());
> // If something complicated is happening (i.e. the next token isn't an
> // arrow), give up on making this work.
> - if (!ArrowLoc.isInvalid()) {
> + if (ArrowLoc.isValid()) {
> addUsage(Usage(ResultExpr, Usage::UK_MemberThroughArrow,
> SourceRange(Base->getExprLoc(), ArrowLoc)));
> return true;
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20151007/f2d33596/attachment-0001.html>
More information about the cfe-commits
mailing list