summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugene Zelenko <eugene.zelenko@gmail.com>2017-11-10 00:59:22 +0000
committerEugene Zelenko <eugene.zelenko@gmail.com>2017-11-10 00:59:22 +0000
commit7b99e597a0a356b8375c925c82119d6f2cfe4576 (patch)
treee32153aa12974afdb1fb7d68e5accf3462a11eb5
parent2a7c3a534ff414593969c37ab37e01123f1ba663 (diff)
[AST] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@317854 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/AST/ASTUnresolvedSet.h25
-rw-r--r--include/clang/AST/ASTVector.h53
-rw-r--r--include/clang/AST/AttrIterator.h37
-rw-r--r--include/clang/AST/BaseSubobject.h24
-rw-r--r--include/clang/AST/CommentVisitor.h12
-rw-r--r--include/clang/AST/DeclFriend.h77
-rw-r--r--include/clang/AST/DeclGroup.h35
-rw-r--r--include/clang/AST/DeclVisitor.h19
-rw-r--r--include/clang/AST/DependentDiagnostic.h30
-rw-r--r--include/clang/AST/RecordLayout.h48
-rw-r--r--include/clang/AST/Redeclarable.h68
-rw-r--r--include/clang/AST/StmtGraphTraits.h27
-rw-r--r--include/clang/AST/StmtVisitor.h17
-rw-r--r--lib/AST/DeclFriend.cpp20
-rw-r--r--lib/AST/DeclGroup.cpp6
-rw-r--r--lib/AST/RecordLayout.cpp9
16 files changed, 288 insertions, 219 deletions
diff --git a/include/clang/AST/ASTUnresolvedSet.h b/include/clang/AST/ASTUnresolvedSet.h
index 9078a0e802..3693aeccfe 100644
--- a/include/clang/AST/ASTUnresolvedSet.h
+++ b/include/clang/AST/ASTUnresolvedSet.h
@@ -1,4 +1,4 @@
-//===-- ASTUnresolvedSet.h - Unresolved sets of declarations ---*- C++ -*-===//
+//===- ASTUnresolvedSet.h - Unresolved sets of declarations -----*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -16,14 +16,22 @@
#define LLVM_CLANG_AST_ASTUNRESOLVEDSET_H
#include "clang/AST/ASTVector.h"
+#include "clang/AST/DeclAccessPair.h"
#include "clang/AST/UnresolvedSet.h"
+#include "clang/Basic/Specifiers.h"
+#include <cassert>
+#include <cstdint>
namespace clang {
+class NamedDecl;
+
/// \brief An UnresolvedSet-like class which uses the ASTContext's allocator.
class ASTUnresolvedSet {
+ friend class LazyASTUnresolvedSet;
+
struct DeclsTy : ASTVector<DeclAccessPair> {
- DeclsTy() {}
+ DeclsTy() = default;
DeclsTy(ASTContext &C, unsigned N) : ASTVector<DeclAccessPair>(C, N) {}
bool isLazy() const { return getTag(); }
@@ -32,14 +40,12 @@ class ASTUnresolvedSet {
DeclsTy Decls;
- friend class LazyASTUnresolvedSet;
-
public:
- ASTUnresolvedSet() {}
+ ASTUnresolvedSet() = default;
ASTUnresolvedSet(ASTContext &C, unsigned N) : Decls(C, N) {}
- typedef UnresolvedSetIterator iterator;
- typedef UnresolvedSetIterator const_iterator;
+ using iterator = UnresolvedSetIterator;
+ using const_iterator = UnresolvedSetIterator;
iterator begin() { return iterator(Decls.begin()); }
iterator end() { return iterator(Decls.end()); }
@@ -98,13 +104,14 @@ public:
}
void reserve(ASTContext &C, unsigned N) { Impl.reserve(C, N); }
+
void addLazyDecl(ASTContext &C, uintptr_t ID, AccessSpecifier AS) {
assert(Impl.empty() || Impl.Decls.isLazy());
Impl.Decls.setLazy(true);
- Impl.addDecl(C, reinterpret_cast<NamedDecl*>(ID << 2), AS);
+ Impl.addDecl(C, reinterpret_cast<NamedDecl *>(ID << 2), AS);
}
};
} // namespace clang
-#endif
+#endif // LLVM_CLANG_AST_ASTUNRESOLVEDSET_H
diff --git a/include/clang/AST/ASTVector.h b/include/clang/AST/ASTVector.h
index 717a9e9dff..80cd6b7007 100644
--- a/include/clang/AST/ASTVector.h
+++ b/include/clang/AST/ASTVector.h
@@ -1,4 +1,4 @@
-//===- ASTVector.h - Vector that uses ASTContext for allocation --*- C++ -*-=//
+//===- ASTVector.h - Vector that uses ASTContext for allocation ---*- C++ -*-=//
//
// The LLVM Compiler Infrastructure
//
@@ -18,22 +18,26 @@
#ifndef LLVM_CLANG_AST_ASTVECTOR_H
#define LLVM_CLANG_AST_ASTVECTOR_H
-#include "clang/AST/AttrIterator.h"
#include "llvm/ADT/PointerIntPair.h"
-#include "llvm/Support/type_traits.h"
#include <algorithm>
+#include <cassert>
#include <cstddef>
#include <cstring>
+#include <iterator>
#include <memory>
+#include <type_traits>
+#include <utility>
namespace clang {
- class ASTContext;
+
+class ASTContext;
template<typename T>
class ASTVector {
private:
- T *Begin, *End;
- llvm::PointerIntPair<T*, 1, bool> Capacity;
+ T *Begin = nullptr;
+ T *End = nullptr;
+ llvm::PointerIntPair<T *, 1, bool> Capacity;
void setEnd(T *P) { this->End = P; }
@@ -45,7 +49,7 @@ protected:
public:
// Default ctor - Initialize to empty.
- ASTVector() : Begin(nullptr), End(nullptr), Capacity(nullptr, false) {}
+ ASTVector() : Capacity(nullptr, false) {}
ASTVector(ASTVector &&O) : Begin(O.Begin), End(O.End), Capacity(O.Capacity) {
O.Begin = O.End = nullptr;
@@ -53,14 +57,15 @@ public:
O.Capacity.setInt(false);
}
- ASTVector(const ASTContext &C, unsigned N)
- : Begin(nullptr), End(nullptr), Capacity(nullptr, false) {
+ ASTVector(const ASTContext &C, unsigned N) : Capacity(nullptr, false) {
reserve(C, N);
}
ASTVector &operator=(ASTVector &&RHS) {
ASTVector O(std::move(RHS));
+
using std::swap;
+
swap(Begin, O.Begin);
swap(End, O.End);
swap(Capacity, O.Capacity);
@@ -74,19 +79,19 @@ public:
}
}
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
- typedef T value_type;
- typedef T* iterator;
- typedef const T* const_iterator;
+ using size_type = size_t;
+ using difference_type = ptrdiff_t;
+ using value_type = T;
+ using iterator = T *;
+ using const_iterator = const T *;
- typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
- typedef std::reverse_iterator<iterator> reverse_iterator;
+ using const_reverse_iterator = std::reverse_iterator<const_iterator>;
+ using reverse_iterator = std::reverse_iterator<iterator>;
- typedef T& reference;
- typedef const T& const_reference;
- typedef T* pointer;
- typedef const T* const_pointer;
+ using reference = T &;
+ using const_reference = const T &;
+ using pointer = T *;
+ using const_pointer = const T *;
// forward iterator creation methods.
iterator begin() { return Begin; }
@@ -175,7 +180,6 @@ public:
size_t capacity() const { return this->capacity_ptr() - Begin; }
/// append - Add the specified range to the end of the SmallVector.
- ///
template<typename in_iter>
void append(const ASTContext &C, in_iter in_start, in_iter in_end) {
size_type NumInputs = std::distance(in_start, in_end);
@@ -195,7 +199,6 @@ public:
}
/// append - Add the specified range to the end of the SmallVector.
- ///
void append(const ASTContext &C, size_type NumInputs, const T &Elt) {
// Grow allocated space if needed.
if (NumInputs > size_type(this->capacity_ptr()-this->end()))
@@ -368,6 +371,7 @@ protected:
const_iterator capacity_ptr() const {
return (iterator) Capacity.getPointer();
}
+
iterator capacity_ptr() { return (iterator)Capacity.getPointer(); }
};
@@ -401,5 +405,6 @@ void ASTVector<T>::grow(const ASTContext &C, size_t MinSize) {
Capacity.setPointer(Begin+NewCapacity);
}
-} // end: clang namespace
-#endif
+} // namespace clang
+
+#endif // LLVM_CLANG_AST_ASTVECTOR_H
diff --git a/include/clang/AST/AttrIterator.h b/include/clang/AST/AttrIterator.h
index fb9b049e5d..56807b4590 100644
--- a/include/clang/AST/AttrIterator.h
+++ b/include/clang/AST/AttrIterator.h
@@ -1,4 +1,4 @@
-//===--- AttrIterator.h - Classes for attribute iteration -------*- C++ -*-===//
+//===- AttrIterator.h - Classes for attribute iteration ---------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -15,16 +15,23 @@
#define LLVM_CLANG_AST_ATTRITERATOR_H
#include "clang/Basic/LLVM.h"
+#include "llvm/ADT/SmallVector.h"
+#include "llvm/Support/Casting.h"
+#include <cassert>
+#include <cstddef>
#include <iterator>
namespace clang {
- class ASTContext;
- class Attr;
-}
+
+class ASTContext;
+class Attr;
+
+} // namespace clang
// Defined in ASTContext.h
void *operator new(size_t Bytes, const clang::ASTContext &C,
size_t Alignment = 8);
+
// FIXME: Being forced to not have a default argument here due to redeclaration
// rules on default arguments sucks
void *operator new[](size_t Bytes, const clang::ASTContext &C,
@@ -39,13 +46,13 @@ void operator delete[](void *Ptr, const clang::ASTContext &C, size_t);
namespace clang {
/// AttrVec - A vector of Attr, which is how they are stored on the AST.
-typedef SmallVector<Attr *, 4> AttrVec;
+using AttrVec = SmallVector<Attr *, 4>;
/// specific_attr_iterator - Iterates over a subrange of an AttrVec, only
/// providing attributes that are of a specific type.
template <typename SpecificAttr, typename Container = AttrVec>
class specific_attr_iterator {
- typedef typename Container::const_iterator Iterator;
+ using Iterator = typename Container::const_iterator;
/// Current - The current, underlying iterator.
/// In order to ensure we don't dereference an invalid iterator unless
@@ -67,14 +74,14 @@ class specific_attr_iterator {
}
public:
- typedef SpecificAttr* value_type;
- typedef SpecificAttr* reference;
- typedef SpecificAttr* pointer;
- typedef std::forward_iterator_tag iterator_category;
- typedef std::ptrdiff_t difference_type;
+ using value_type = SpecificAttr *;
+ using reference = SpecificAttr *;
+ using pointer = SpecificAttr *;
+ using iterator_category = std::forward_iterator_tag;
+ using difference_type = std::ptrdiff_t;
- specific_attr_iterator() : Current() { }
- explicit specific_attr_iterator(Iterator i) : Current(i) { }
+ specific_attr_iterator() = default;
+ explicit specific_attr_iterator(Iterator i) : Current(i) {}
reference operator*() const {
AdvanceToNext();
@@ -136,6 +143,6 @@ inline SpecificAttr *getSpecificAttr(const Container& container) {
return nullptr;
}
-} // end namespace clang
+} // namespace clang
-#endif
+#endif // LLVM_CLANG_AST_ATTRITERATOR_H
diff --git a/include/clang/AST/BaseSubobject.h b/include/clang/AST/BaseSubobject.h
index 66af023c82..fdb7e718fe 100644
--- a/include/clang/AST/BaseSubobject.h
+++ b/include/clang/AST/BaseSubobject.h
@@ -1,4 +1,4 @@
-//===--- BaseSubobject.h - BaseSubobject class ----------------------------===//
+//===- BaseSubobject.h - BaseSubobject class --------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -15,12 +15,15 @@
#define LLVM_CLANG_AST_BASESUBOBJECT_H
#include "clang/AST/CharUnits.h"
-#include "clang/AST/DeclCXX.h"
-#include "llvm/ADT/DenseMap.h"
-#include "llvm/Support/DataTypes.h"
+#include "llvm/ADT/DenseMapInfo.h"
#include "llvm/Support/type_traits.h"
+#include <cstdint>
+#include <utility>
namespace clang {
+
+class CXXRecordDecl;
+
// BaseSubobject - Uniquely identifies a direct or indirect base class.
// Stores both the base class decl and the offset from the most derived class to
// the base class. Used for vtable and VTT generation.
@@ -32,9 +35,9 @@ class BaseSubobject {
CharUnits BaseOffset;
public:
- BaseSubobject() { }
+ BaseSubobject() = default;
BaseSubobject(const CXXRecordDecl *Base, CharUnits BaseOffset)
- : Base(Base), BaseOffset(BaseOffset) { }
+ : Base(Base), BaseOffset(BaseOffset) {}
/// getBase - Returns the base class declaration.
const CXXRecordDecl *getBase() const { return Base; }
@@ -47,7 +50,7 @@ public:
}
};
-} // end namespace clang
+} // namespace clang
namespace llvm {
@@ -65,7 +68,8 @@ template<> struct DenseMapInfo<clang::BaseSubobject> {
}
static unsigned getHashValue(const clang::BaseSubobject &Base) {
- typedef std::pair<const clang::CXXRecordDecl *, clang::CharUnits> PairTy;
+ using PairTy = std::pair<const clang::CXXRecordDecl *, clang::CharUnits>;
+
return DenseMapInfo<PairTy>::getHashValue(PairTy(Base.getBase(),
Base.getBaseOffset()));
}
@@ -81,6 +85,6 @@ template <> struct isPodLike<clang::BaseSubobject> {
static const bool value = true;
};
-}
+} // namespace llvm
-#endif
+#endif // LLVM_CLANG_AST_BASESUBOBJECT_H
diff --git a/include/clang/AST/CommentVisitor.h b/include/clang/AST/CommentVisitor.h
index 21641bfeb8..d1cc2d0a4e 100644
--- a/include/clang/AST/CommentVisitor.h
+++ b/include/clang/AST/CommentVisitor.h
@@ -1,4 +1,4 @@
-//===--- CommentVisitor.h - Visitor for Comment subclasses ------*- C++ -*-===//
+//===- CommentVisitor.h - Visitor for Comment subclasses --------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -16,8 +16,8 @@
namespace clang {
namespace comments {
-template <typename T> struct make_ptr { typedef T *type; };
-template <typename T> struct make_const_ptr { typedef const T *type; };
+template <typename T> struct make_ptr { using type = T *; };
+template <typename T> struct make_const_ptr { using type = const T *; };
template<template <typename> class Ptr, typename ImplClass, typename RetTy=void>
class CommentVisitorBase {
@@ -64,7 +64,7 @@ template<typename ImplClass, typename RetTy=void>
class ConstCommentVisitor :
public CommentVisitorBase<make_const_ptr, ImplClass, RetTy> {};
-} // end namespace comments
-} // end namespace clang
+} // namespace comments
+} // namespace clang
-#endif
+#endif // LLVM_CLANG_AST_COMMENTVISITOR_H
diff --git a/include/clang/AST/DeclFriend.h b/include/clang/AST/DeclFriend.h
index 172c46a44a..5d1c6b86fe 100644
--- a/include/clang/AST/DeclFriend.h
+++ b/include/clang/AST/DeclFriend.h
@@ -1,4 +1,4 @@
-//===-- DeclFriend.h - Classes for C++ friend declarations -*- C++ -*------===//
+//===- DeclFriend.h - Classes for C++ friend declarations -------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -15,16 +15,30 @@
#ifndef LLVM_CLANG_AST_DECLFRIEND_H
#define LLVM_CLANG_AST_DECLFRIEND_H
+#include "clang/AST/Decl.h"
+#include "clang/AST/DeclBase.h"
#include "clang/AST/DeclCXX.h"
#include "clang/AST/DeclTemplate.h"
+#include "clang/AST/ExternalASTSource.h"
#include "clang/AST/TypeLoc.h"
+#include "clang/Basic/LLVM.h"
+#include "clang/Basic/SourceLocation.h"
+#include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/None.h"
+#include "llvm/ADT/PointerUnion.h"
+#include "llvm/Support/Casting.h"
#include "llvm/Support/Compiler.h"
+#include "llvm/Support/TrailingObjects.h"
+#include <cassert>
+#include <iterator>
namespace clang {
+class ASTContext;
+
/// FriendDecl - Represents the declaration of a friend entity,
/// which can be a function, a type, or a templated function or type.
-// For example:
+/// For example:
///
/// @code
/// template <typename T> class A {
@@ -41,10 +55,14 @@ class FriendDecl final
: public Decl,
private llvm::TrailingObjects<FriendDecl, TemplateParameterList *> {
virtual void anchor();
+
public:
- typedef llvm::PointerUnion<NamedDecl*,TypeSourceInfo*> FriendUnion;
+ using FriendUnion = llvm::PointerUnion<NamedDecl *, TypeSourceInfo *>;
private:
+ friend class CXXRecordDecl;
+ friend class CXXRecordDecl::friend_iterator;
+
// The declaration that's a friend of this class.
FriendUnion Friend;
@@ -64,35 +82,33 @@ private:
// template <class T> friend class A<T>::B;
unsigned NumTPLists : 31;
- friend class CXXRecordDecl::friend_iterator;
- friend class CXXRecordDecl;
-
FriendDecl(DeclContext *DC, SourceLocation L, FriendUnion Friend,
SourceLocation FriendL,
- ArrayRef<TemplateParameterList*> FriendTypeTPLists)
- : Decl(Decl::Friend, DC, L),
- Friend(Friend),
- NextFriend(),
- FriendLoc(FriendL),
- UnsupportedFriend(false),
- NumTPLists(FriendTypeTPLists.size()) {
+ ArrayRef<TemplateParameterList *> FriendTypeTPLists)
+ : Decl(Decl::Friend, DC, L), Friend(Friend), FriendLoc(FriendL),
+ UnsupportedFriend(false), NumTPLists(FriendTypeTPLists.size()) {
for (unsigned i = 0; i < NumTPLists; ++i)
getTrailingObjects<TemplateParameterList *>()[i] = FriendTypeTPLists[i];
}
FriendDecl(EmptyShell Empty, unsigned NumFriendTypeTPLists)
- : Decl(Decl::Friend, Empty), NextFriend(),
- UnsupportedFriend(false),
- NumTPLists(NumFriendTypeTPLists) { }
+ : Decl(Decl::Friend, Empty), UnsupportedFriend(false),
+ NumTPLists(NumFriendTypeTPLists) {}
FriendDecl *getNextFriend() {
if (!NextFriend.isOffset())
return cast_or_null<FriendDecl>(NextFriend.get(nullptr));
return getNextFriendSlowCase();
}
+
FriendDecl *getNextFriendSlowCase();
public:
+ friend class ASTDeclReader;
+ friend class ASTDeclWriter;
+ friend class ASTNodeImporter;
+ friend TrailingObjects;
+
static FriendDecl *Create(ASTContext &C, DeclContext *DC,
SourceLocation L, FriendUnion Friend_,
SourceLocation FriendL,
@@ -108,9 +124,11 @@ public:
TypeSourceInfo *getFriendType() const {
return Friend.dyn_cast<TypeSourceInfo*>();
}
+
unsigned getFriendTypeNumTemplateParameterLists() const {
return NumTPLists;
}
+
TemplateParameterList *getFriendTypeTemplateParameterList(unsigned N) const {
assert(N < NumTPLists);
return getTrailingObjects<TemplateParameterList *>()[N];
@@ -119,7 +137,7 @@ public:
/// If this friend declaration doesn't name a type, return the inner
/// declaration.
NamedDecl *getFriendDecl() const {
- return Friend.dyn_cast<NamedDecl*>();
+ return Friend.dyn_cast<NamedDecl *>();
}
/// Retrieves the location of the 'friend' keyword.
@@ -164,27 +182,24 @@ public:
// Implement isa/cast/dyncast/etc.
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
static bool classofKind(Kind K) { return K == Decl::Friend; }
-
- friend class ASTDeclReader;
- friend class ASTDeclWriter;
- friend class ASTNodeImporter;
- friend TrailingObjects;
};
/// An iterator over the friend declarations of a class.
class CXXRecordDecl::friend_iterator {
+ friend class CXXRecordDecl;
+
FriendDecl *Ptr;
- friend class CXXRecordDecl;
explicit friend_iterator(FriendDecl *Ptr) : Ptr(Ptr) {}
+
public:
- friend_iterator() {}
+ friend_iterator() = default;
- typedef FriendDecl *value_type;
- typedef FriendDecl *reference;
- typedef FriendDecl *pointer;
- typedef int difference_type;
- typedef std::forward_iterator_tag iterator_category;
+ using value_type = FriendDecl *;
+ using reference = FriendDecl *;
+ using pointer = FriendDecl *;
+ using difference_type = int;
+ using iterator_category = std::forward_iterator_tag;
reference operator*() const { return Ptr; }
@@ -240,6 +255,6 @@ inline void CXXRecordDecl::pushFriendDecl(FriendDecl *FD) {
data().FirstFriend = FD;
}
-}
+} // namespace clang
-#endif
+#endif // LLVM_CLANG_AST_DECLFRIEND_H
diff --git a/include/clang/AST/DeclGroup.h b/include/clang/AST/DeclGroup.h
index 628d7886aa..6d5aaadf52 100644
--- a/include/clang/AST/DeclGroup.h
+++ b/include/clang/AST/DeclGroup.h
@@ -1,4 +1,4 @@
-//===--- DeclGroup.h - Classes for representing groups of Decls -*- C++ -*-===//
+//===- DeclGroup.h - Classes for representing groups of Decls ---*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -14,26 +14,26 @@
#ifndef LLVM_CLANG_AST_DECLGROUP_H
#define LLVM_CLANG_AST_DECLGROUP_H
-#include "llvm/Support/DataTypes.h"
#include "llvm/Support/TrailingObjects.h"
#include <cassert>
+#include <cstdint>
namespace clang {
class ASTContext;
class Decl;
-class DeclGroup;
-class DeclGroupIterator;
class DeclGroup final : private llvm::TrailingObjects<DeclGroup, Decl *> {
// FIXME: Include a TypeSpecifier object.
- unsigned NumDecls;
+ unsigned NumDecls = 0;
private:
- DeclGroup() : NumDecls(0) {}
+ DeclGroup() = default;
DeclGroup(unsigned numdecls, Decl** decls);
public:
+ friend TrailingObjects;
+
static DeclGroup *Create(ASTContext &C, Decl **Decls, unsigned NumDecls);
unsigned size() const { return NumDecls; }
@@ -47,23 +47,21 @@ public:
assert (i < NumDecls && "Out-of-bounds access.");
return getTrailingObjects<Decl *>()[i];
}
-
- friend TrailingObjects;
};
class DeclGroupRef {
// Note this is not a PointerIntPair because we need the address of the
// non-group case to be valid as a Decl** for iteration.
enum Kind { SingleDeclKind=0x0, DeclGroupKind=0x1, Mask=0x1 };
- Decl* D;
+
+ Decl* D = nullptr;
Kind getKind() const {
return (Kind) (reinterpret_cast<uintptr_t>(D) & Mask);
}
public:
- DeclGroupRef() : D(nullptr) {}
-
+ DeclGroupRef() = default;
explicit DeclGroupRef(Decl* d) : D(d) {}
explicit DeclGroupRef(DeclGroup* dg)
: D((Decl*) (reinterpret_cast<uintptr_t>(dg) | DeclGroupKind)) {}
@@ -76,8 +74,8 @@ public:
return DeclGroupRef(DeclGroup::Create(C, Decls, NumDecls));
}
- typedef Decl** iterator;
- typedef Decl* const * const_iterator;
+ using iterator = Decl **;
+ using const_iterator = Decl * const *;
bool isNull() const { return D == nullptr; }
bool isSingleDecl() const { return getKind() == SingleDeclKind; }
@@ -133,9 +131,10 @@ public:
}
};
-} // end clang namespace
+} // namespace clang
namespace llvm {
+
// DeclGroupRef is "like a pointer", implement PointerLikeTypeTraits.
template <typename T>
struct PointerLikeTypeTraits;
@@ -144,10 +143,14 @@ namespace llvm {
static inline void *getAsVoidPointer(clang::DeclGroupRef P) {
return P.getAsOpaquePtr();
}
+
static inline clang::DeclGroupRef getFromVoidPointer(void *P) {
return clang::DeclGroupRef::getFromOpaquePtr(P);
}
+
enum { NumLowBitsAvailable = 0 };
};
-}
-#endif
+
+} // namespace llvm
+
+#endif // LLVM_CLANG_AST_DECLGROUP_H
diff --git a/include/clang/AST/DeclVisitor.h b/include/clang/AST/DeclVisitor.h
index 4eaae35778..3ff274bd6a 100644
--- a/include/clang/AST/DeclVisitor.h
+++ b/include/clang/AST/DeclVisitor.h
@@ -1,4 +1,4 @@
-//===--- DeclVisitor.h - Visitor for Decl subclasses ------------*- C++ -*-===//
+//===- DeclVisitor.h - Visitor for Decl subclasses --------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -10,27 +10,30 @@
// This file defines the DeclVisitor interface.
//
//===----------------------------------------------------------------------===//
+
#ifndef LLVM_CLANG_AST_DECLVISITOR_H
#define LLVM_CLANG_AST_DECLVISITOR_H
#include "clang/AST/Decl.h"
+#include "clang/AST/DeclBase.h"
#include "clang/AST/DeclCXX.h"
#include "clang/AST/DeclFriend.h"
#include "clang/AST/DeclObjC.h"
#include "clang/AST/DeclOpenMP.h"
#include "clang/AST/DeclTemplate.h"
+#include "llvm/Support/ErrorHandling.h"
namespace clang {
+
namespace declvisitor {
-template <typename T> struct make_ptr { typedef T *type; };
-template <typename T> struct make_const_ptr { typedef const T *type; };
+template <typename T> struct make_ptr { using type = T *; };
+template <typename T> struct make_const_ptr { using type = const T *; };
/// \brief A simple visitor class that helps create declaration visitors.
template<template <typename> class Ptr, typename ImplClass, typename RetTy=void>
class Base {
public:
-
#define PTR(CLASS) typename Ptr<CLASS>::type
#define DISPATCH(NAME, CLASS) \
return static_cast<ImplClass*>(this)->Visit##NAME(static_cast<PTR(CLASS)>(D))
@@ -57,23 +60,23 @@ public:
#undef DISPATCH
};
-} // end namespace declvisitor
+} // namespace declvisitor
/// \brief A simple visitor class that helps create declaration visitors.
///
/// This class does not preserve constness of Decl pointers (see also
/// ConstDeclVisitor).
-template<typename ImplClass, typename RetTy=void>
+template<typename ImplClass, typename RetTy = void>
class DeclVisitor
: public declvisitor::Base<declvisitor::make_ptr, ImplClass, RetTy> {};
/// \brief A simple visitor class that helps create declaration visitors.
///
/// This class preserves constness of Decl pointers (see also DeclVisitor).
-template<typename ImplClass, typename RetTy=void>
+template<typename ImplClass, typename RetTy = void>
class ConstDeclVisitor
: public declvisitor::Base<declvisitor::make_const_ptr, ImplClass, RetTy> {};
-} // end namespace clang
+} // namespace clang
#endif // LLVM_CLANG_AST_DECLVISITOR_H
diff --git a/include/clang/AST/DependentDiagnostic.h b/include/clang/AST/DependentDiagnostic.h
index 8e038c83c9..a514326c6c 100644
--- a/include/clang/AST/DependentDiagnostic.h
+++ b/include/clang/AST/DependentDiagnostic.h
@@ -1,4 +1,4 @@
-//===-- DependentDiagnostic.h - Dependently-generated diagnostics -*- C++ -*-=//
+//==- DependentDiagnostic.h - Dependently-generated diagnostics --*- C++ -*-==//
//
// The LLVM Compiler Infrastructure
//
@@ -23,6 +23,9 @@
#include "clang/AST/Type.h"
#include "clang/Basic/PartialDiagnostic.h"
#include "clang/Basic/SourceLocation.h"
+#include "clang/Basic/Specifiers.h"
+#include <cassert>
+#include <iterator>
namespace clang {
@@ -94,6 +97,9 @@ public:
}
private:
+ friend class DeclContext::ddiag_iterator;
+ friend class DependentStoredDeclsMap;
+
DependentDiagnostic(const PartialDiagnostic &PDiag,
PartialDiagnostic::Storage *Storage)
: Diag(PDiag, Storage) {}
@@ -102,8 +108,6 @@ private:
DeclContext *Parent,
const PartialDiagnostic &PDiag);
- friend class DependentStoredDeclsMap;
- friend class DeclContext::ddiag_iterator;
DependentDiagnostic *NextDiagnostic;
PartialDiagnostic Diag;
@@ -118,19 +122,17 @@ private:
} AccessData;
};
-///
-
/// An iterator over the dependent diagnostics in a dependent context.
class DeclContext::ddiag_iterator {
public:
- ddiag_iterator() : Ptr(nullptr) {}
+ ddiag_iterator() = default;
explicit ddiag_iterator(DependentDiagnostic *Ptr) : Ptr(Ptr) {}
- typedef DependentDiagnostic *value_type;
- typedef DependentDiagnostic *reference;
- typedef DependentDiagnostic *pointer;
- typedef int difference_type;
- typedef std::forward_iterator_tag iterator_category;
+ using value_type = DependentDiagnostic *;
+ using reference = DependentDiagnostic *;
+ using pointer = DependentDiagnostic *;
+ using difference_type = int;
+ using iterator_category = std::forward_iterator_tag;
reference operator*() const { return Ptr; }
@@ -168,7 +170,7 @@ public:
}
private:
- DependentDiagnostic *Ptr;
+ DependentDiagnostic *Ptr = nullptr;
};
inline DeclContext::ddiag_range DeclContext::ddiags() const {
@@ -184,6 +186,6 @@ inline DeclContext::ddiag_range DeclContext::ddiags() const {
return ddiag_range(ddiag_iterator(Map->FirstDiagnostic), ddiag_iterator());
}
-}
+} // namespace clang
-#endif
+#endif // LLVM_CLANG_AST_DEPENDENTDIAGNOSTIC_H
diff --git a/include/clang/AST/RecordLayout.h b/include/clang/AST/RecordLayout.h
index 7a39c3b253..696d44efa0 100644
--- a/include/clang/AST/RecordLayout.h
+++ b/include/clang/AST/RecordLayout.h
@@ -1,4 +1,4 @@
-//===--- RecordLayout.h - Layout information for a struct/union -*- C++ -*-===//
+//===- RecordLayout.h - Layout information for a struct/union ---*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -14,15 +14,20 @@
#ifndef LLVM_CLANG_AST_RECORDLAYOUT_H
#define LLVM_CLANG_AST_RECORDLAYOUT_H
+#include "clang/AST/ASTVector.h"
#include "clang/AST/CharUnits.h"
#include "clang/AST/DeclCXX.h"
+#include "clang/Basic/LLVM.h"
+#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMap.h"
+#include "llvm/ADT/PointerIntPair.h"
+#include <cassert>
+#include <cstdint>
namespace clang {
- class ASTContext;
- class FieldDecl;
- class RecordDecl;
- class CXXRecordDecl;
+
+class ASTContext;
+class CXXRecordDecl;
/// ASTRecordLayout -
/// This class contains layout information for one RecordDecl,
@@ -42,21 +47,21 @@ public:
/// Whether this virtual base requires a vtordisp field in the
/// Microsoft ABI. These fields are required for certain operations
/// in constructors and destructors.
- bool HasVtorDisp;
+ bool HasVtorDisp = false;
public:
- bool hasVtorDisp() const { return HasVtorDisp; }
-
- VBaseInfo() : HasVtorDisp(false) {}
+ VBaseInfo() = default;
+ VBaseInfo(CharUnits VBaseOffset, bool hasVtorDisp)
+ : VBaseOffset(VBaseOffset), HasVtorDisp(hasVtorDisp) {}
- VBaseInfo(CharUnits VBaseOffset, bool hasVtorDisp) :
- VBaseOffset(VBaseOffset), HasVtorDisp(hasVtorDisp) {}
+ bool hasVtorDisp() const { return HasVtorDisp; }
};
- typedef llvm::DenseMap<const CXXRecordDecl *, VBaseInfo>
- VBaseOffsetsMapTy;
+ using VBaseOffsetsMapTy = llvm::DenseMap<const CXXRecordDecl *, VBaseInfo>;
private:
+ friend class ASTContext;
+
/// Size - Size of record in characters.
CharUnits Size;
@@ -117,7 +122,7 @@ private:
const CXXRecordDecl *BaseSharingVBPtr;
/// FIXME: This should really use a SmallPtrMap, once we have one in LLVM :)
- typedef llvm::DenseMap<const CXXRecordDecl *, CharUnits> BaseOffsetsMapTy;
+ using BaseOffsetsMapTy = llvm::DenseMap<const CXXRecordDecl *, CharUnits>;
/// BaseOffsets - Contains a map from base classes to their offset.
BaseOffsetsMapTy BaseOffsets;
@@ -128,16 +133,15 @@ private:
/// CXXInfo - If the record layout is for a C++ record, this will have
/// C++ specific information about the record.
- CXXRecordLayoutInfo *CXXInfo;
-
- friend class ASTContext;
+ CXXRecordLayoutInfo *CXXInfo = nullptr;
ASTRecordLayout(const ASTContext &Ctx, CharUnits size, CharUnits alignment,
CharUnits requiredAlignment, CharUnits datasize,
ArrayRef<uint64_t> fieldoffsets);
+ using BaseOffsetsMapTy = CXXRecordLayoutInfo::BaseOffsetsMapTy;
+
// Constructor for C++ records.
- typedef CXXRecordLayoutInfo::BaseOffsetsMapTy BaseOffsetsMapTy;
ASTRecordLayout(const ASTContext &Ctx,
CharUnits size, CharUnits alignment,
CharUnits requiredAlignment,
@@ -159,9 +163,9 @@ private:
void Destroy(ASTContext &Ctx);
- ASTRecordLayout(const ASTRecordLayout &) = delete;
- void operator=(const ASTRecordLayout &) = delete;
public:
+ ASTRecordLayout(const ASTRecordLayout &) = delete;
+ ASTRecordLayout &operator=(const ASTRecordLayout &) = delete;
/// getAlignment - Get the record alignment in characters.
CharUnits getAlignment() const { return Alignment; }
@@ -305,6 +309,6 @@ public:
}
};
-} // end namespace clang
+} // namespace clang
-#endif
+#endif // LLVM_CLANG_AST_RECORDLAYOUT_H
diff --git a/include/clang/AST/Redeclarable.h b/include/clang/AST/Redeclarable.h
index 89a9d3c4cc..86b0f356e7 100644
--- a/include/clang/AST/Redeclarable.h
+++ b/include/clang/AST/Redeclarable.h
@@ -1,4 +1,4 @@
-//===-- Redeclarable.h - Base for Decls that can be redeclared -*- C++ -*-====//
+//===- Redeclarable.h - Base for Decls that can be redeclared --*- C++ -*-====//
//
// The LLVM Compiler Infrastructure
//
@@ -15,11 +15,18 @@
#define LLVM_CLANG_AST_REDECLARABLE_H
#include "clang/AST/ExternalASTSource.h"
+#include "llvm/ADT/DenseMapInfo.h"
+#include "llvm/ADT/PointerUnion.h"
+#include "llvm/ADT/iterator_range.h"
#include "llvm/Support/Casting.h"
+#include <cassert>
+#include <cstddef>
#include <iterator>
namespace clang {
+
class ASTContext;
+class Decl;
// Some notes on redeclarables:
//
@@ -82,21 +89,21 @@ protected:
class DeclLink {
/// A pointer to a known latest declaration, either statically known or
/// generationally updated as decls are added by an external source.
- typedef LazyGenerationalUpdatePtr<const Decl*, Decl*,
- &ExternalASTSource::CompleteRedeclChain>
- KnownLatest;
+ using KnownLatest =
+ LazyGenerationalUpdatePtr<const Decl *, Decl *,
+ &ExternalASTSource::CompleteRedeclChain>;
/// We store a pointer to the ASTContext in the UninitializedLatest
/// pointer, but to avoid circular type dependencies when we steal the low
/// bits of this pointer, we use a raw void* here.
- typedef const void *UninitializedLatest;
+ using UninitializedLatest = const void *;
- typedef Decl *Previous;
+ using Previous = Decl *;
/// A pointer to either an uninitialized latest declaration (where either
/// we've not yet set the previous decl or there isn't one), or to a known
/// previous declaration.
- typedef llvm::PointerUnion<Previous, UninitializedLatest> NotKnownLatest;
+ using NotKnownLatest = llvm::PointerUnion<Previous, UninitializedLatest>;
mutable llvm::PointerUnion<NotKnownLatest, KnownLatest> Next;
@@ -106,8 +113,7 @@ protected:
DeclLink(LatestTag, const ASTContext &Ctx)
: Next(NotKnownLatest(reinterpret_cast<UninitializedLatest>(&Ctx))) {}
- DeclLink(PreviousTag, decl_type *D)
- : Next(NotKnownLatest(Previous(D))) {}
+ DeclLink(PreviousTag, decl_type *D) : Next(NotKnownLatest(Previous(D))) {}
bool NextIsPrevious() const {
return Next.is<NotKnownLatest>() &&
@@ -182,6 +188,7 @@ protected:
///
/// If there is only one declaration, it is <pointer to self, true>
DeclLink RedeclLink;
+
decl_type *First;
decl_type *getNextRedeclaration() const {
@@ -189,8 +196,12 @@ protected:
}
public:
- Redeclarable(const ASTContext &Ctx)
- : RedeclLink(LatestDeclLink(Ctx)), First(static_cast<decl_type *>(this)) {}
+ friend class ASTDeclReader;
+ friend class ASTDeclWriter;
+
+ Redeclarable(const ASTContext &Ctx)
+ : RedeclLink(LatestDeclLink(Ctx)),
+ First(static_cast<decl_type *>(this)) {}
/// \brief Return the previous declaration of this declaration or NULL if this
/// is the first declaration.
@@ -232,20 +243,19 @@ public:
/// \brief Iterates through all the redeclarations of the same decl.
class redecl_iterator {
/// Current - The current declaration.
- decl_type *Current;
+ decl_type *Current = nullptr;
decl_type *Starter;
- bool PassedFirst;
+ bool PassedFirst = false;
public:
- typedef decl_type* value_type;
- typedef decl_type* reference;
- typedef decl_type* pointer;
- typedef std::forward_iterator_tag iterator_category;
- typedef std::ptrdiff_t difference_type;
+ using value_type = decl_type *;
+ using reference = decl_type *;
+ using pointer = decl_type *;
+ using iterator_category = std::forward_iterator_tag;
+ using difference_type = std::ptrdiff_t;
- redecl_iterator() : Current(nullptr) { }
- explicit redecl_iterator(decl_type *C)
- : Current(C), Starter(C), PassedFirst(false) { }
+ redecl_iterator() = default;
+ explicit redecl_iterator(decl_type *C) : Current(C), Starter(C) {}
reference operator*() const { return Current; }
pointer operator->() const { return Current; }
@@ -282,7 +292,7 @@ public:
}
};
- typedef llvm::iterator_range<redecl_iterator> redecl_range;
+ using redecl_range = llvm::iterator_range<redecl_iterator>;
/// \brief Returns an iterator range for all the redeclarations of the same
/// decl. It will iterate at least once (when this decl is the only one).
@@ -294,9 +304,6 @@ public:
redecl_iterator redecls_begin() const { return redecls().begin(); }
redecl_iterator redecls_end() const { return redecls().end(); }
-
- friend class ASTDeclReader;
- friend class ASTDeclWriter;
};
/// \brief Get the primary declaration for a declaration from an AST file. That
@@ -309,7 +316,7 @@ Decl *getPrimaryMergedDecl(Decl *D);
template<typename decl_type>
class Mergeable {
public:
- Mergeable() {}
+ Mergeable() = default;
/// \brief Return the first declaration of this declaration or itself if this
/// is the only declaration.
@@ -344,7 +351,7 @@ public:
/// remember to call getCanonicalDecl() everywhere.
template <typename decl_type> class CanonicalDeclPtr {
public:
- CanonicalDeclPtr() : Ptr(nullptr) {}
+ CanonicalDeclPtr() = default;
CanonicalDeclPtr(decl_type *Ptr)
: Ptr(Ptr ? Ptr->getCanonicalDecl() : nullptr) {}
CanonicalDeclPtr(const CanonicalDeclPtr &) = default;
@@ -362,11 +369,13 @@ public:
private:
friend struct llvm::DenseMapInfo<CanonicalDeclPtr<decl_type>>;
- decl_type *Ptr;
+ decl_type *Ptr = nullptr;
};
+
} // namespace clang
namespace llvm {
+
template <typename decl_type>
struct DenseMapInfo<clang::CanonicalDeclPtr<decl_type>> {
using CanonicalDeclPtr = clang::CanonicalDeclPtr<decl_type>;
@@ -395,6 +404,7 @@ struct DenseMapInfo<clang::CanonicalDeclPtr<decl_type>> {
return BaseInfo::isEqual(LHS, RHS);
}
};
+
} // namespace llvm
-#endif
+#endif // LLVM_CLANG_AST_REDECLARABLE_H
diff --git a/include/clang/AST/StmtGraphTraits.h b/include/clang/AST/StmtGraphTraits.h
index 92eb64430f..02c77b242c 100644
--- a/include/clang/AST/StmtGraphTraits.h
+++ b/include/clang/AST/StmtGraphTraits.h
@@ -1,4 +1,4 @@
-//===--- StmtGraphTraits.h - Graph Traits for the class Stmt ----*- C++ -*-===//
+//===- StmtGraphTraits.h - Graph Traits for the class Stmt ------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -21,13 +21,10 @@
namespace llvm {
-//template <typename T> struct GraphTraits;
-
-
-template <> struct GraphTraits<clang::Stmt*> {
- typedef clang::Stmt * NodeRef;
- typedef clang::Stmt::child_iterator ChildIteratorType;
- typedef llvm::df_iterator<clang::Stmt*> nodes_iterator;
+template <> struct GraphTraits<clang::Stmt *> {
+ using NodeRef = clang::Stmt *;
+ using ChildIteratorType = clang::Stmt::child_iterator;
+ using nodes_iterator = llvm::df_iterator<clang::Stmt *>;
static NodeRef getEntryNode(clang::Stmt *S) { return S; }
@@ -50,11 +47,10 @@ template <> struct GraphTraits<clang::Stmt*> {
}
};
-
-template <> struct GraphTraits<const clang::Stmt*> {
- typedef const clang::Stmt * NodeRef;
- typedef clang::Stmt::const_child_iterator ChildIteratorType;
- typedef llvm::df_iterator<const clang::Stmt*> nodes_iterator;
+template <> struct GraphTraits<const clang::Stmt *> {
+ using NodeRef = const clang::Stmt *;
+ using ChildIteratorType = clang::Stmt::const_child_iterator;
+ using nodes_iterator = llvm::df_iterator<const clang::Stmt *>;
static NodeRef getEntryNode(const clang::Stmt *S) { return S; }
@@ -77,7 +73,6 @@ template <> struct GraphTraits<const clang::Stmt*> {
}
};
+} // namespace llvm
-} // end namespace llvm
-
-#endif
+#endif // LLVM_CLANG_AST_STMTGRAPHTRAITS_H
diff --git a/include/clang/AST/StmtVisitor.h b/include/clang/AST/StmtVisitor.h
index 470788e8bb..5efd47f9af 100644
--- a/include/clang/AST/StmtVisitor.h
+++ b/include/clang/AST/StmtVisitor.h
@@ -1,4 +1,4 @@
-//===--- StmtVisitor.h - Visitor for Stmt subclasses ------------*- C++ -*-===//
+//===- StmtVisitor.h - Visitor for Stmt subclasses --------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -17,14 +17,19 @@
#include "clang/AST/ExprCXX.h"
#include "clang/AST/ExprObjC.h"
#include "clang/AST/ExprOpenMP.h"
+#include "clang/AST/Stmt.h"
#include "clang/AST/StmtCXX.h"
#include "clang/AST/StmtObjC.h"
#include "clang/AST/StmtOpenMP.h"
+#include "clang/Basic/LLVM.h"
+#include "llvm/Support/Casting.h"
+#include "llvm/Support/ErrorHandling.h"
+#include <utility>
namespace clang {
-template <typename T> struct make_ptr { typedef T *type; };
-template <typename T> struct make_const_ptr { typedef const T *type; };
+template <typename T> struct make_ptr { using type = T *; };
+template <typename T> struct make_const_ptr { using type = const T *; };
/// StmtVisitorBase - This class implements a simple visitor for Stmt
/// subclasses. Since Expr derives from Stmt, this also includes support for
@@ -33,14 +38,12 @@ template<template <typename> class Ptr, typename ImplClass, typename RetTy=void,
class... ParamTys>
class StmtVisitorBase {
public:
-
#define PTR(CLASS) typename Ptr<CLASS>::type
#define DISPATCH(NAME, CLASS) \
return static_cast<ImplClass*>(this)->Visit ## NAME( \
static_cast<PTR(CLASS)>(S), std::forward<ParamTys>(P)...)
RetTy Visit(PTR(Stmt) S, ParamTys... P) {
-
// If we have a binary expr, dispatch to the subcode of the binop. A smart
// optimizer (e.g. LLVM) will fold this comparison into the switch stmt
// below.
@@ -224,6 +227,6 @@ template<class ImplClass, typename RetTy = void>
class ConstOMPClauseVisitor :
public OMPClauseVisitorBase <ImplClass, make_const_ptr, RetTy> {};
-} // end namespace clang
+} // namespace clang
-#endif
+#endif // LLVM_CLANG_AST_STMTVISITOR_H
diff --git a/lib/AST/DeclFriend.cpp b/lib/AST/DeclFriend.cpp
index 121403b07e..461bf36858 100644
--- a/lib/AST/DeclFriend.cpp
+++ b/lib/AST/DeclFriend.cpp
@@ -1,4 +1,4 @@
-//===--- DeclFriend.cpp - C++ Friend Declaration AST Node Implementation --===//
+//===- DeclFriend.cpp - C++ Friend Declaration AST Node Implementation ----===//
//
// The LLVM Compiler Infrastructure
//
@@ -12,12 +12,20 @@
//
//===----------------------------------------------------------------------===//
-#include "clang/AST/ASTContext.h"
#include "clang/AST/DeclFriend.h"
+#include "clang/AST/Decl.h"
+#include "clang/AST/DeclBase.h"
+#include "clang/AST/DeclCXX.h"
+#include "clang/AST/ASTContext.h"
#include "clang/AST/DeclTemplate.h"
+#include "clang/Basic/LLVM.h"
+#include "llvm/Support/Casting.h"
+#include <cassert>
+#include <cstddef>
+
using namespace clang;
-void FriendDecl::anchor() { }
+void FriendDecl::anchor() {}
FriendDecl *FriendDecl::getNextFriendSlowCase() {
return cast_or_null<FriendDecl>(
@@ -28,9 +36,9 @@ FriendDecl *FriendDecl::Create(ASTContext &C, DeclContext *DC,
SourceLocation L,
FriendUnion Friend,
SourceLocation FriendL,
- ArrayRef<TemplateParameterList*> FriendTypeTPLists) {
+ ArrayRef<TemplateParameterList *> FriendTypeTPLists) {
#ifndef NDEBUG
- if (Friend.is<NamedDecl*>()) {
+ if (Friend.is<NamedDecl *>()) {
NamedDecl *D = Friend.get<NamedDecl*>();
assert(isa<FunctionDecl>(D) ||
isa<CXXRecordDecl>(D) ||
@@ -42,7 +50,7 @@ FriendDecl *FriendDecl::Create(ASTContext &C, DeclContext *DC,
assert(D->getFriendObjectKind() ||
(cast<CXXRecordDecl>(DC)->getTemplateSpecializationKind()));
// These template parameters are for friend types only.
- assert(FriendTypeTPLists.size() == 0);
+ assert(FriendTypeTPLists.empty());
}
#endif
diff --git a/lib/AST/DeclGroup.cpp b/lib/AST/DeclGroup.cpp
index 2f95e1f1c3..f74ef9bbb8 100644
--- a/lib/AST/DeclGroup.cpp
+++ b/lib/AST/DeclGroup.cpp
@@ -1,4 +1,4 @@
-//===--- DeclGroup.cpp - Classes for representing groups of Decls -*- C++ -*-==//
+//===- DeclGroup.cpp - Classes for representing groups of Decls -----------===//
//
// The LLVM Compiler Infrastructure
//
@@ -13,7 +13,9 @@
#include "clang/AST/DeclGroup.h"
#include "clang/AST/ASTContext.h"
-#include "clang/AST/Decl.h"
+#include <cassert>
+#include <memory>
+
using namespace clang;
DeclGroup* DeclGroup::Create(ASTContext &C, Decl **Decls, unsigned NumDecls) {
diff --git a/lib/AST/RecordLayout.cpp b/lib/AST/RecordLayout.cpp
index 299fd111bf..37fe029f53 100644
--- a/lib/AST/RecordLayout.cpp
+++ b/lib/AST/RecordLayout.cpp
@@ -1,4 +1,4 @@
-//===-- RecordLayout.cpp - Layout information for a struct/union -*- C++ -*-==//
+//===- RecordLayout.cpp - Layout information for a struct/union -----------===//
//
// The LLVM Compiler Infrastructure
//
@@ -11,9 +11,11 @@
//
//===----------------------------------------------------------------------===//
-#include "clang/AST/ASTContext.h"
#include "clang/AST/RecordLayout.h"
+#include "clang/AST/ASTContext.h"
+#include "clang/Basic/TargetCXXABI.h"
#include "clang/Basic/TargetInfo.h"
+#include <cassert>
using namespace clang;
@@ -32,7 +34,7 @@ ASTRecordLayout::ASTRecordLayout(const ASTContext &Ctx, CharUnits size,
CharUnits datasize,
ArrayRef<uint64_t> fieldoffsets)
: Size(size), DataSize(datasize), Alignment(alignment),
- RequiredAlignment(requiredAlignment), CXXInfo(nullptr) {
+ RequiredAlignment(requiredAlignment) {
FieldOffsets.append(Ctx, fieldoffsets.begin(), fieldoffsets.end());
}
@@ -73,7 +75,6 @@ ASTRecordLayout::ASTRecordLayout(const ASTContext &Ctx,
CXXInfo->EndsWithZeroSizedObject = EndsWithZeroSizedObject;
CXXInfo->LeadsWithZeroSizedBase = LeadsWithZeroSizedBase;
-
#ifndef NDEBUG
if (const CXXRecordDecl *PrimaryBase = getPrimaryBase()) {
if (isPrimaryBaseVirtual()) {