Eugene.Zelenko updated the summary for this revision.
Eugene.Zelenko added a reviewer: aaron.ballman.
Eugene.Zelenko updated this revision to Diff 39778.
Eugene.Zelenko added a comment.
Synchronize with current code.
Repository:
rL LLVM
http://reviews.llvm.org/D13759
Files:
include/clang/AST/ASTVector.h
include/clang/AST/DeclContextInternals.h
include/clang/AST/DeclTemplate.h
include/clang/ASTMatchers/ASTMatchersInternal.h
include/clang/Analysis/Analyses/Consumed.h
include/clang/Rewrite/Core/Rewriter.h
include/clang/Sema/Template.h
include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h
include/clang/StaticAnalyzer/Core/CheckerManager.h
tools/libclang/Indexing.cpp
utils/TableGen/ClangAttrEmitter.cpp
Index: utils/TableGen/ClangAttrEmitter.cpp
===================================================================
--- utils/TableGen/ClangAttrEmitter.cpp
+++ utils/TableGen/ClangAttrEmitter.cpp
@@ -956,7 +956,7 @@
}
void writeTemplateInstantiation(raw_ostream &OS) const override {
- OS << " " << getType() << " *tempInst" << getUpperName()
+ OS << " auto *tempInst" << getUpperName()
<< " = new (C, 16) " << getType()
<< "[A->" << getLowerName() << "_size()];\n";
OS << " {\n";
@@ -1535,7 +1535,7 @@
}
OS << ", SourceRange Loc = SourceRange()";
OS << ") {\n";
- OS << " " << R.getName() << "Attr *A = new (Ctx) " << R.getName();
+ OS << " auto *A = new (Ctx) " << R.getName();
OS << "Attr(Loc, Ctx, ";
for (auto const &ai : Args) {
if (ai->isFake() && !emitFake) continue;
@@ -1879,8 +1879,7 @@
OS << " case attr::" << R.getName() << ": {\n";
Args = R.getValueAsListOfDefs("Args");
if (R.isSubClassOf(InhClass) || !Args.empty())
- OS << " const " << R.getName() << "Attr *SA = cast<" << R.getName()
- << "Attr>(A);\n";
+ OS << " const auto *SA = cast<" << R.getName() << "Attr>(A);\n";
if (R.isSubClassOf(InhClass))
OS << " Record.push_back(SA->isInherited());\n";
OS << " Record.push_back(A->isImplicit());\n";
@@ -2195,8 +2194,7 @@
continue;
}
- OS << " const " << R.getName() << "Attr *A = cast<"
- << R.getName() << "Attr>(At);\n";
+ OS << " const auto *A = cast<" << R.getName() << "Attr>(At);\n";
bool TDependent = R.getValueAsBit("TemplateDependent");
if (!TDependent) {
@@ -2798,8 +2796,7 @@
Args = R.getValueAsListOfDefs("Args");
if (!Args.empty()) {
- OS << " const " << R.getName() << "Attr *SA = cast<" << R.getName()
- << "Attr>(A);\n";
+ OS << " const auto *SA = cast<" << R.getName() << "Attr>(A);\n";
for (const auto *Arg : Args)
createArgument(*Arg, R.getName())->writeDump(OS);
Index: tools/libclang/Indexing.cpp
===================================================================
--- tools/libclang/Indexing.cpp
+++ tools/libclang/Indexing.cpp
@@ -111,7 +111,7 @@
typedef llvm::DenseSet<PPRegion> PPRegionSetTy;
-} // end anonymous namespace
+} // anonymous namespace
namespace llvm {
template <> struct isPodLike<PPRegion> {
@@ -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) {
@@ -1028,4 +1026,3 @@
}
} // end: extern "C"
-
Index: include/clang/ASTMatchers/ASTMatchersInternal.h
===================================================================
--- include/clang/ASTMatchers/ASTMatchersInternal.h
+++ include/clang/ASTMatchers/ASTMatchersInternal.h
@@ -76,19 +76,13 @@
/// it cannot be converted to the specified type.
template <typename T>
const T *getNodeAs(StringRef ID) const {
- IDToNodeMap::const_iterator It = NodeMap.find(ID);
- if (It == NodeMap.end()) {
- return nullptr;
- }
- return It->second.get<T>();
+ const auto It = NodeMap.find(ID);
+ return It == NodeMap.end() ? nullptr : It->second.get<T>();
}
ast_type_traits::DynTypedNode getNode(StringRef ID) const {
- IDToNodeMap::const_iterator It = NodeMap.find(ID);
- if (It == NodeMap.end()) {
- return ast_type_traits::DynTypedNode();
- }
- return It->second;
+ const auto It = NodeMap.find(ID);
+ return It == NodeMap.end() ? ast_type_traits::DynTypedNode() : It->second;
}
/// \brief Imposes an order on BoundNodesMaps.
@@ -131,7 +125,7 @@
/// BoundNodesTree.
class Visitor {
public:
- virtual ~Visitor() {}
+ virtual ~Visitor() = default;
/// \brief Called multiple times during a single call to VisitMatches(...).
///
@@ -209,7 +203,7 @@
template <typename T>
class MatcherInterface : public DynMatcherInterface {
public:
- ~MatcherInterface() override {}
+ ~MatcherInterface() override = default;
/// \brief Returns true if 'Node' can be matched.
///
@@ -798,7 +792,7 @@
AMM_ParentOnly
};
- virtual ~ASTMatchFinder() {}
+ virtual ~ASTMatchFinder() = default;
/// \brief Returns true if the given class is directly or indirectly derived
/// from a base type matching \c base.
@@ -1577,4 +1571,4 @@
} // end namespace ast_matchers
} // end namespace clang
-#endif
+#endif // LLVM_CLANG_ASTMATCHERS_ASTMATCHERSINTERNAL_H
Index: include/clang/StaticAnalyzer/Core/CheckerManager.h
===================================================================
--- include/clang/StaticAnalyzer/Core/CheckerManager.h
+++ include/clang/StaticAnalyzer/Core/CheckerManager.h
@@ -140,7 +140,7 @@
if (ref)
return static_cast<CHECKER *>(ref); // already registered.
- CHECKER *checker = new CHECKER();
+ auto *checker = new CHECKER();
checker->Name = CurrentCheckName;
CheckerDtors.push_back(CheckerDtor(checker, destruct<CHECKER>));
CHECKER::_register(checker, *this);
@@ -155,7 +155,7 @@
if (ref)
return static_cast<CHECKER *>(ref); // already registered.
- CHECKER *checker = new CHECKER(AOpts);
+ auto *checker = new CHECKER(AOpts);
checker->Name = CurrentCheckName;
CheckerDtors.push_back(CheckerDtor(checker, destruct<CHECKER>));
CHECKER::_register(checker, *this);
@@ -239,7 +239,6 @@
Eng);
}
-
/// \brief Run checkers for visiting obj-c messages.
void runCheckersForObjCMessage(ObjCMessageVisitKind visitKind,
ExplodedNodeSet &Dst,
@@ -629,4 +628,4 @@
} // end clang namespace
-#endif
+#endif // LLVM_CLANG_STATICANALYZER_CORE_CHECKERMANAGER_H
Index: include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h
===================================================================
--- include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h
+++ include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h
@@ -27,6 +27,7 @@
#include <vector>
namespace clang {
+
class ConditionalOperator;
class AnalysisDeclContext;
class BinaryOperator;
@@ -86,9 +87,6 @@
PDFileEntry::ConsumerFiles *getFiles(const PathDiagnostic &PD);
};
-private:
- virtual void anchor();
-public:
PathDiagnosticConsumer() : flushed(false) {}
virtual ~PathDiagnosticConsumer();
@@ -112,6 +110,9 @@
protected:
bool flushed;
llvm::FoldingSet<PathDiagnostic> Diags;
+
+private:
+ virtual void anchor();
};
//===----------------------------------------------------------------------===//
@@ -308,6 +309,7 @@
class PathDiagnosticLocationPair {
private:
PathDiagnosticLocation Start, End;
+
public:
PathDiagnosticLocationPair(const PathDiagnosticLocation &start,
const PathDiagnosticLocation &end)
@@ -417,7 +419,6 @@
virtual void dump() const = 0;
};
-
class PathPieces : public std::list<IntrusiveRefCntPtr<PathDiagnosticPiece> > {
void flattenTo(PathPieces &Primary, PathPieces &Current,
bool ShouldFlattenMacros) const;
@@ -435,6 +436,7 @@
class PathDiagnosticSpotPiece : public PathDiagnosticPiece {
private:
PathDiagnosticLocation Pos;
+
public:
PathDiagnosticSpotPiece(const PathDiagnosticLocation &pos,
StringRef s,
@@ -481,7 +483,7 @@
public:
StackHintGeneratorForSymbol(SymbolRef S, StringRef M) : Sym(S), Msg(M) {}
- ~StackHintGeneratorForSymbol() override {}
+ ~StackHintGeneratorForSymbol() override = default;
/// \brief Search the call expression for the symbol Sym and dispatch the
/// 'getMessageForX()' methods to construct a specific message.
@@ -598,8 +600,8 @@
void flattenLocations() override {
callEnter.flatten();
callReturn.flatten();
- for (PathPieces::iterator I = path.begin(),
- E = path.end(); I != E; ++I) (*I)->flattenLocations();
+ for (auto &I : path)
+ I->flattenLocations();
}
static PathDiagnosticCallPiece *construct(const ExplodedNode *N,
@@ -667,7 +669,8 @@
iterator end() { return LPairs.end(); }
void flattenLocations() override {
- for (iterator I=begin(), E=end(); I!=E; ++I) I->flatten();
+ for (auto &I : *this)
+ I.flatten();
}
typedef std::vector<PathDiagnosticLocationPair>::const_iterator
@@ -697,8 +700,8 @@
void flattenLocations() override {
PathDiagnosticSpotPiece::flattenLocations();
- for (PathPieces::iterator I = subPieces.begin(),
- E = subPieces.end(); I != E; ++I) (*I)->flattenLocations();
+ for (auto &I : subPieces)
+ I->flattenLocations();
}
static inline bool classof(const PathDiagnosticPiece *P) {
@@ -734,6 +737,7 @@
const Decl *UniqueingDecl;
PathDiagnostic() = delete;
+
public:
PathDiagnostic(StringRef CheckName, const Decl *DeclWithIssue,
StringRef bugtype, StringRef verboseDesc, StringRef shortDesc,
@@ -824,8 +828,8 @@
void flattenLocations() {
Loc.flatten();
- for (PathPieces::iterator I = pathImpl.begin(), E = pathImpl.end();
- I != E; ++I) (*I)->flattenLocations();
+ for (auto &I : pathImpl)
+ I->flattenLocations();
}
/// Profiles the diagnostic, independent of the path it references.
@@ -841,8 +845,7 @@
void FullProfile(llvm::FoldingSetNodeID &ID) const;
};
-} // end GR namespace
+} // end namespace ento
+} // end namespace clang
-} //end clang namespace
-
-#endif
+#endif // LLVM_CLANG_STATICANALYZER_CORE_BUGREPORTER_PATHDIAGNOSTIC_H
Index: include/clang/AST/ASTVector.h
===================================================================
--- include/clang/AST/ASTVector.h
+++ include/clang/AST/ASTVector.h
@@ -27,8 +27,9 @@
#include <memory>
namespace clang {
- class ASTContext;
+class ASTContext;
+
template<typename T>
class ASTVector {
private:
@@ -381,7 +382,7 @@
NewCapacity = MinSize;
// Allocate the memory from the ASTContext.
- T *NewElts = new (C, llvm::alignOf<T>()) T[NewCapacity];
+ auto *NewElts = new (C, llvm::alignOf<T>()) T[NewCapacity];
// Copy the elements over.
if (Begin != End) {
@@ -401,5 +402,6 @@
Capacity.setPointer(Begin+NewCapacity);
}
-} // end: clang namespace
-#endif
+} // end namespace clang
+
+#endif // LLVM_CLANG_AST_ASTVECTOR_H
Index: include/clang/AST/DeclTemplate.h
===================================================================
--- include/clang/AST/DeclTemplate.h
+++ include/clang/AST/DeclTemplate.h
@@ -1723,8 +1723,7 @@
const TemplateArgumentList *TemplateArgs) {
assert(!SpecializedTemplate.is<SpecializedPartialSpecialization*>() &&
"Already set to a class template partial specialization!");
- SpecializedPartialSpecialization *PS
- = new (getASTContext()) SpecializedPartialSpecialization();
+ auto *PS = new (getASTContext()) SpecializedPartialSpecialization();
PS->PartialSpecialization = PartialSpec;
PS->TemplateArgs = TemplateArgs;
SpecializedTemplate = PS;
@@ -2269,7 +2268,6 @@
return static_cast<TypeAliasDecl*>(TemplatedDecl);
}
-
TypeAliasTemplateDecl *getCanonicalDecl() override {
return cast<TypeAliasTemplateDecl>(
RedeclarableTemplateDecl::getCanonicalDecl());
@@ -2299,7 +2297,6 @@
RedeclarableTemplateDecl::getInstantiatedFromMemberTemplate());
}
-
/// \brief Create a function template node.
static TypeAliasTemplateDecl *Create(ASTContext &C, DeclContext *DC,
SourceLocation L,
@@ -2582,8 +2579,7 @@
const TemplateArgumentList *TemplateArgs) {
assert(!SpecializedTemplate.is<SpecializedPartialSpecialization *>() &&
"Already set to a variable template partial specialization!");
- SpecializedPartialSpecialization *PS =
- new (getASTContext()) SpecializedPartialSpecialization();
+ auto *PS = new (getASTContext()) SpecializedPartialSpecialization();
PS->PartialSpecialization = PartialSpec;
PS->TemplateArgs = TemplateArgs;
SpecializedTemplate = PS;
@@ -2952,6 +2948,6 @@
friend class ASTDeclWriter;
};
-} /* end of namespace clang */
+} // end namespace clang
-#endif
+#endif // LLVM_CLANG_AST_DECLTEMPLATE_H
Index: include/clang/AST/DeclContextInternals.h
===================================================================
--- include/clang/AST/DeclContextInternals.h
+++ include/clang/AST/DeclContextInternals.h
@@ -11,6 +11,7 @@
// of DeclContext.
//
//===----------------------------------------------------------------------===//
+
#ifndef LLVM_CLANG_AST_DECLCONTEXTINTERNALS_H
#define LLVM_CLANG_AST_DECLCONTEXTINTERNALS_H
@@ -86,7 +87,7 @@
if (DeclsTy *Vec = getAsVector())
Data = DeclsAndHasExternalTy(Vec, true);
else {
- DeclsTy *VT = new DeclsTy();
+ auto *VT = new DeclsTy();
if (NamedDecl *OldD = getAsDecl())
VT->push_back(OldD);
Data = DeclsAndHasExternalTy(VT, true);
@@ -193,7 +194,7 @@
// If this is the second decl added to the list, convert this to vector
// form.
if (NamedDecl *OldD = getAsDecl()) {
- DeclsTy *VT = new DeclsTy();
+ auto *VT = new DeclsTy();
VT->push_back(OldD);
Data = DeclsAndHasExternalTy(VT, false);
}
@@ -261,4 +262,4 @@
} // end namespace clang
-#endif
+#endif // LLVM_CLANG_AST_DECLCONTEXTINTERNALS_H
Index: include/clang/Sema/Template.h
===================================================================
--- include/clang/Sema/Template.h
+++ include/clang/Sema/Template.h
@@ -9,6 +9,7 @@
// This file provides types used in the semantic analysis of C++ templates.
//
//===----------------------------------------------------------------------===/
+
#ifndef LLVM_CLANG_SEMA_TEMPLATE_H
#define LLVM_CLANG_SEMA_TEMPLATE_H
@@ -278,7 +279,7 @@
// will overwrite it on construction
LocalInstantiationScope *oldScope = SemaRef.CurrentInstantiationScope;
- LocalInstantiationScope *newScope =
+ auto *newScope =
new LocalInstantiationScope(SemaRef, CombineWithOuterScope);
newScope->Outer = nullptr;
@@ -299,7 +300,7 @@
Stored = I->second.get<Decl *>();
} else {
DeclArgumentPack *OldPack = I->second.get<DeclArgumentPack *>();
- DeclArgumentPack *NewPack = new DeclArgumentPack(*OldPack);
+ auto *NewPack = new DeclArgumentPack(*OldPack);
Stored = NewPack;
newScope->ArgumentPacks.push_back(NewPack);
}
@@ -514,6 +515,6 @@
VarTemplatePartialSpecializationDecl *PartialSpec);
void InstantiateEnumDefinition(EnumDecl *Enum, EnumDecl *Pattern);
};
-}
+} // end namespace clang
#endif // LLVM_CLANG_SEMA_TEMPLATE_H
Index: include/clang/Analysis/Analyses/Consumed.h
===================================================================
--- include/clang/Analysis/Analyses/Consumed.h
+++ include/clang/Analysis/Analyses/Consumed.h
@@ -1,4 +1,4 @@
-//===- Consumed.h ----------------------------------------------*- C++ --*-===//
+//===- Consumed.h -----------------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -210,9 +210,8 @@
ConsumedBlockInfo(unsigned int NumBlocks, PostOrderCFGView *SortedGraph)
: StateMapsArray(NumBlocks), VisitOrder(NumBlocks, 0) {
unsigned int VisitOrderCounter = 0;
- for (PostOrderCFGView::iterator BI = SortedGraph->begin(),
- BE = SortedGraph->end(); BI != BE; ++BI) {
- VisitOrder[(*BI)->getBlockID()] = VisitOrderCounter++;
+ for (const auto &BI : *SortedGraph ) {
+ VisitOrder[BI->getBlockID()] = VisitOrderCounter++;
}
}
@@ -264,6 +263,7 @@
/// exactly once.
void run(AnalysisDeclContext &AC);
};
-}} // end namespace clang::consumed
+} // end namespace consumed
+} // end namespace clang
-#endif
+#endif // LLVM_CLANG_ANALYSIS_ANALYSES_CONSUMED_H
Index: include/clang/Rewrite/Core/Rewriter.h
===================================================================
--- include/clang/Rewrite/Core/Rewriter.h
+++ include/clang/Rewrite/Core/Rewriter.h
@@ -168,8 +168,7 @@
/// getRewriteBufferFor - Return the rewrite buffer for the specified FileID.
/// If no modification has been made to it, return null.
const RewriteBuffer *getRewriteBufferFor(FileID FID) const {
- std::map<FileID, RewriteBuffer>::const_iterator I =
- RewriteBuffers.find(FID);
+ const auto I = RewriteBuffers.find(FID);
return I == RewriteBuffers.end() ? nullptr : &I->second;
}
@@ -192,4 +191,4 @@
} // end namespace clang
-#endif
+#endif // LLVM_CLANG_REWRITE_CORE_REWRITER_H
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits