[PATCH] D10024: Refactor: Simplify boolean conditional return statements in tools/libclang
Alexander Kornienko via cfe-commits
cfe-commits at lists.llvm.org
Mon Dec 28 07:27:33 PST 2015
This revision was automatically updated to reflect the committed changes.
Closed by commit rL256498: Refactor: Simplify boolean conditional return statements in tools/libclang (authored by alexfh).
Changed prior to commit:
http://reviews.llvm.org/D10024?vs=38315&id=43691#toc
Repository:
rL LLVM
http://reviews.llvm.org/D10024
Files:
cfe/trunk/tools/libclang/CIndex.cpp
cfe/trunk/tools/libclang/Indexing.cpp
cfe/trunk/tools/libclang/IndexingContext.cpp
Index: cfe/trunk/tools/libclang/IndexingContext.cpp
===================================================================
--- cfe/trunk/tools/libclang/IndexingContext.cpp
+++ cfe/trunk/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: cfe/trunk/tools/libclang/Indexing.cpp
===================================================================
--- cfe/trunk/tools/libclang/Indexing.cpp
+++ cfe/trunk/tools/libclang/Indexing.cpp
@@ -681,9 +681,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: cfe/trunk/tools/libclang/CIndex.cpp
===================================================================
--- cfe/trunk/tools/libclang/CIndex.cpp
+++ cfe/trunk/tools/libclang/CIndex.cpp
@@ -717,11 +717,8 @@
return true;
}
}
-
- if (ShouldVisitBody && VisitCXXRecordDecl(D))
- return true;
-
- return false;
+
+ return ShouldVisitBody && VisitCXXRecordDecl(D);
}
bool CursorVisitor::VisitClassTemplatePartialSpecializationDecl(
@@ -946,11 +943,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>
@@ -6239,10 +6233,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.43691.patch
Type: text/x-patch
Size: 2206 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20151228/f4d05c9a/attachment.bin>
More information about the cfe-commits
mailing list