Re: [PATCH] D10024: Refactor: Simplify boolean conditional return statements in tools/libclang

2015-12-28 Thread Alexander Kornienko via cfe-commits
alexfh added a subscriber: alexfh.
alexfh accepted this revision.
alexfh added a reviewer: alexfh.
alexfh added a comment.
This revision is now accepted and ready to land.

LG


http://reviews.llvm.org/D10024



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D10024: Refactor: Simplify boolean conditional return statements in tools/libclang

2015-12-28 Thread Alexander Kornienko via cfe-commits
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=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
   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  = *static_cast(context);
   IdxCtx.indexTopLevelDecl(D);
-  if (IdxCtx.shouldAbort())
-return false;
-  return true;
+  return !IdxCtx.shouldAbort();
 }
 
 static void indexTranslationUnit(ASTUnit , IndexingContext ) {
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 
@@ -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,


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
   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  = *static_cast(context);
   IdxCtx.indexTopLevelDecl(D);
-  if (IdxCtx.shouldAbort())
-return false;
-  return true;
+  return !IdxCtx.shouldAbort();
 }
 
 static void indexTranslationUnit(ASTUnit , IndexingContext ) {
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 
@@ -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,
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D10024: Refactor: Simplify boolean conditional return statements in tools/libclang

2015-10-24 Thread Richard via cfe-commits
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
   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  = *static_cast(context);
   IdxCtx.indexTopLevelDecl(D);
-  if (IdxCtx.shouldAbort())
-return false;
-  return true;
+  return !IdxCtx.shouldAbort();
 }
 
 static void indexTranslationUnit(ASTUnit , IndexingContext ) {
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 
@@ -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,


Index: tools/libclang/IndexingContext.cpp
===
--- tools/libclang/IndexingContext.cpp
+++ tools/libclang/IndexingContext.cpp
@@ -804,10 +804,7 @@
   RefFileOccurrence RefOccur(FE, D);
   std::pair
   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  = *static_cast(context);
   IdxCtx.indexTopLevelDecl(D);
-  if (IdxCtx.shouldAbort())
-return false;
-  return true;
+  return !IdxCtx.shouldAbort();
 }
 
 static void indexTranslationUnit(ASTUnit , IndexingContext ) {
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 
@@ -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,
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits