[PATCH] D10024: Refactor: Simplify boolean conditional return statements in tools/libclang
Richard via cfe-commits
cfe-commits at lists.llvm.org
Sat Oct 24 11:24:50 PDT 2015
LegalizeAdulthood updated this revision to Diff 38315.
LegalizeAdulthood marked 2 inline comments as done.
LegalizeAdulthood added a comment.
Update to latest.
Update from comments.
I don't have commit access.
http://reviews.llvm.org/D10024
Files:
tools/libclang/CIndex.cpp
tools/libclang/Indexing.cpp
tools/libclang/IndexingContext.cpp
Index: tools/libclang/IndexingContext.cpp
===================================================================
--- tools/libclang/IndexingContext.cpp
+++ tools/libclang/IndexingContext.cpp
@@ -804,10 +804,7 @@
RefFileOccurrence RefOccur(FE, D);
std::pair<llvm::DenseSet<RefFileOccurrence>::iterator, bool>
res = RefFileOccurrences.insert(RefOccur);
- if (!res.second)
- return true; // already in map.
-
- return false;
+ return !res.second; // already in map
}
const NamedDecl *IndexingContext::getEntityDecl(const NamedDecl *D) const {
Index: tools/libclang/Indexing.cpp
===================================================================
--- tools/libclang/Indexing.cpp
+++ tools/libclang/Indexing.cpp
@@ -669,9 +669,7 @@
static bool topLevelDeclVisitor(void *context, const Decl *D) {
IndexingContext &IdxCtx = *static_cast<IndexingContext*>(context);
IdxCtx.indexTopLevelDecl(D);
- if (IdxCtx.shouldAbort())
- return false;
- return true;
+ return !IdxCtx.shouldAbort();
}
static void indexTranslationUnit(ASTUnit &Unit, IndexingContext &IdxCtx) {
Index: tools/libclang/CIndex.cpp
===================================================================
--- tools/libclang/CIndex.cpp
+++ tools/libclang/CIndex.cpp
@@ -710,11 +710,8 @@
return true;
}
}
-
- if (ShouldVisitBody && VisitCXXRecordDecl(D))
- return true;
-
- return false;
+
+ return ShouldVisitBody && VisitCXXRecordDecl(D);
}
bool CursorVisitor::VisitClassTemplatePartialSpecializationDecl(
@@ -939,11 +936,8 @@
return true;
}
- if (ND->isThisDeclarationADefinition() &&
- Visit(MakeCXCursor(ND->getBody(), StmtParent, TU, RegionOfInterest)))
- return true;
-
- return false;
+ return ND->isThisDeclarationADefinition() &&
+ Visit(MakeCXCursor(ND->getBody(), StmtParent, TU, RegionOfInterest));
}
template <typename DeclIt>
@@ -6074,10 +6068,7 @@
++NextIdx;
Lex.LexFromRawLexer(Tok);
- if (Tok.is(tok::eof))
- return true;
-
- return false;
+ return Tok.is(tok::eof);
}
static void annotatePreprocessorTokens(CXTranslationUnit TU,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D10024.38315.patch
Type: text/x-patch
Size: 2116 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20151024/ab3a28de/attachment.bin>
More information about the cfe-commits
mailing list