summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChuanqi Xu <yedeng.yd@linux.alibaba.com>2024-02-27 15:46:39 +0800
committerChuanqi Xu <yedeng.yd@linux.alibaba.com>2024-04-25 16:44:00 +0800
commit672fde1eb906c33e01ecb4d44c4cf787e9230f79 (patch)
tree06773297e1e94acb30fcb7b44dfcdee6360c6df8
parent0d257f1bc5a54b0ccde725462f846e14a3fe1891 (diff)
-rw-r--r--clang/include/clang/AST/DeclTemplate.h4
-rw-r--r--clang/lib/AST/DeclTemplate.cpp26
-rw-r--r--clang/lib/Serialization/ASTReaderDecl.cpp21
-rw-r--r--clang/lib/Serialization/ASTWriter.cpp6
-rw-r--r--clang/lib/Serialization/ASTWriterDecl.cpp29
5 files changed, 43 insertions, 43 deletions
diff --git a/clang/include/clang/AST/DeclTemplate.h b/clang/include/clang/AST/DeclTemplate.h
index 24578cfdaa7c..fb32639b8635 100644
--- a/clang/include/clang/AST/DeclTemplate.h
+++ b/clang/include/clang/AST/DeclTemplate.h
@@ -739,8 +739,8 @@ class RedeclarableTemplateDecl : public TemplateDecl,
bool IsPartial = false;
LazySpecializationInfo(GlobalDeclID ID, unsigned Hash = ~0U,
bool Partial = false)
- : DeclID(ID), ODRHash(Hash), IsPartial(Partial) { }
- LazySpecializationInfo() { }
+ : DeclID(ID), ODRHash(Hash), IsPartial(Partial) {}
+ LazySpecializationInfo() {}
bool operator<(const LazySpecializationInfo &Other) const {
return DeclID < Other.DeclID;
}
diff --git a/clang/lib/AST/DeclTemplate.cpp b/clang/lib/AST/DeclTemplate.cpp
index 1afd7b4550c9..11c5bc7b4c93 100644
--- a/clang/lib/AST/DeclTemplate.cpp
+++ b/clang/lib/AST/DeclTemplate.cpp
@@ -16,12 +16,12 @@
#include "clang/AST/DeclCXX.h"
#include "clang/AST/DeclarationName.h"
#include "clang/AST/Expr.h"
+#include "clang/AST/ExprCXX.h"
#include "clang/AST/ExternalASTSource.h"
+#include "clang/AST/ODRHash.h"
#include "clang/AST/TemplateBase.h"
#include "clang/AST/TemplateName.h"
#include "clang/AST/Type.h"
-#include "clang/AST/ODRHash.h"
-#include "clang/AST/ExprCXX.h"
#include "clang/AST/TypeLoc.h"
#include "clang/Basic/Builtins.h"
#include "clang/Basic/LLVM.h"
@@ -334,7 +334,7 @@ RedeclarableTemplateDecl::CommonBase *RedeclarableTemplateDecl::getCommonPtr() c
}
void RedeclarableTemplateDecl::loadLazySpecializationsImpl(
- bool OnlyPartial/*=false*/) const {
+ bool OnlyPartial /*=false*/) const {
// Grab the most recent declaration to ensure we've loaded any lazy
// redeclarations of this template.
CommonBase *CommonBasePtr = getMostRecentDecl()->getCommonPtr();
@@ -344,16 +344,16 @@ void RedeclarableTemplateDecl::loadLazySpecializationsImpl(
unsigned N = Specs[0].DeclID.get();
for (unsigned I = 0; I != N; ++I) {
// Skip over already loaded specializations.
- if (!Specs[I+1].ODRHash)
+ if (!Specs[I + 1].ODRHash)
continue;
- if (!OnlyPartial || Specs[I+1].IsPartial)
- (void)loadLazySpecializationImpl(Specs[I+1]);
+ if (!OnlyPartial || Specs[I + 1].IsPartial)
+ (void)loadLazySpecializationImpl(Specs[I + 1]);
}
}
}
Decl *RedeclarableTemplateDecl::loadLazySpecializationImpl(
- LazySpecializationInfo &LazySpecInfo) const {
+ LazySpecializationInfo &LazySpecInfo) const {
GlobalDeclID ID = LazySpecInfo.DeclID;
assert(ID.isValid() && "Loading already loaded specialization!");
// Note that we loaded the specialization.
@@ -362,15 +362,13 @@ Decl *RedeclarableTemplateDecl::loadLazySpecializationImpl(
return getASTContext().getExternalSource()->GetExternalDecl(ID);
}
-void
-RedeclarableTemplateDecl::loadLazySpecializationsImpl(ArrayRef<TemplateArgument>
- Args,
- TemplateParameterList *TPL) const {
+void RedeclarableTemplateDecl::loadLazySpecializationsImpl(
+ ArrayRef<TemplateArgument> Args, TemplateParameterList *TPL) const {
CommonBase *CommonBasePtr = getMostRecentDecl()->getCommonPtr();
if (auto *Specs = CommonBasePtr->LazySpecializations) {
unsigned Hash = TemplateArgumentList::ComputeODRHash(Args);
unsigned N = Specs[0].DeclID.get();
- for (uint32_t I = 0; I != N; ++I)
+ for (unsigned I = 0; I != N; ++I)
if (Specs[I+1].ODRHash && Specs[I+1].ODRHash == Hash)
(void)loadLazySpecializationImpl(Specs[I+1]);
}
@@ -549,7 +547,7 @@ ClassTemplateDecl *ClassTemplateDecl::CreateDeserialized(ASTContext &C,
}
void ClassTemplateDecl::LoadLazySpecializations(
- bool OnlyPartial/*=false*/) const {
+ bool OnlyPartial /*=false*/) const {
loadLazySpecializationsImpl(OnlyPartial);
}
@@ -1275,7 +1273,7 @@ VarTemplateDecl *VarTemplateDecl::CreateDeserialized(ASTContext &C,
}
void VarTemplateDecl::LoadLazySpecializations(
- bool OnlyPartial/*=false*/) const {
+ bool OnlyPartial /*=false*/) const {
loadLazySpecializationsImpl(OnlyPartial);
}
diff --git a/clang/lib/Serialization/ASTReaderDecl.cpp b/clang/lib/Serialization/ASTReaderDecl.cpp
index 32d81a7db63d..9e8987be7b07 100644
--- a/clang/lib/Serialization/ASTReaderDecl.cpp
+++ b/clang/lib/Serialization/ASTReaderDecl.cpp
@@ -88,8 +88,8 @@ namespace clang {
const SourceLocation ThisDeclLoc;
using RecordData = ASTReader::RecordData;
- using LazySpecializationInfo
- = RedeclarableTemplateDecl::LazySpecializationInfo;
+ using LazySpecializationInfo =
+ RedeclarableTemplateDecl::LazySpecializationInfo;
TypeID DeferredTypeID = 0;
unsigned AnonymousDeclNumber = 0;
@@ -270,9 +270,9 @@ namespace clang {
: Reader(Reader), Record(Record), Loc(Loc), ThisDeclID(thisDeclID),
ThisDeclLoc(ThisDeclLoc) {}
- template <typename T> static
- void AddLazySpecializations(T *D,
- SmallVectorImpl<LazySpecializationInfo>& IDs) {
+ template <typename T>
+ static void
+ AddLazySpecializations(T *D, SmallVectorImpl<LazySpecializationInfo> &IDs) {
if (IDs.empty())
return;
@@ -321,7 +321,7 @@ namespace clang {
void ReadFunctionDefinition(FunctionDecl *FD);
void Visit(Decl *D);
- void UpdateDecl(Decl *D, llvm::SmallVectorImpl<LazySpecializationInfo>&);
+ void UpdateDecl(Decl *D, llvm::SmallVectorImpl<LazySpecializationInfo> &);
static void setNextObjCCategory(ObjCCategoryDecl *Cat,
ObjCCategoryDecl *Next) {
@@ -4213,8 +4213,8 @@ void ASTReader::loadDeclUpdateRecords(PendingUpdateRecord &Record) {
ProcessingUpdatesRAIIObj ProcessingUpdates(*this);
DeclUpdateOffsetsMap::iterator UpdI = DeclUpdateOffsets.find(ID);
- using LazySpecializationInfo
- = RedeclarableTemplateDecl::LazySpecializationInfo;
+ using LazySpecializationInfo =
+ RedeclarableTemplateDecl::LazySpecializationInfo;
llvm::SmallVector<LazySpecializationInfo, 8> PendingLazySpecializationIDs;
if (UpdI != DeclUpdateOffsets.end()) {
@@ -4480,8 +4480,9 @@ static void forAllLaterRedecls(DeclT *D, Fn F) {
}
}
-void ASTDeclReader::UpdateDecl(Decl *D,
- SmallVectorImpl<LazySpecializationInfo> &PendingLazySpecializationIDs) {
+void ASTDeclReader::UpdateDecl(
+ Decl *D,
+ SmallVectorImpl<LazySpecializationInfo> &PendingLazySpecializationIDs) {
while (Record.getIdx() < Record.size()) {
switch ((DeclUpdateKind)Record.readInt()) {
case UPD_CXX_ADDED_IMPLICIT_MEMBER: {
diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp
index 95c62a20e1b7..774454e42dc5 100644
--- a/clang/lib/Serialization/ASTWriter.cpp
+++ b/clang/lib/Serialization/ASTWriter.cpp
@@ -5585,9 +5585,9 @@ void ASTWriter::WriteDeclUpdatesBlocks(RecordDataImpl &OffsetsRecord) {
Args = FD->getTemplateSpecializationArgs()->asArray();
assert(Args.size());
Record.push_back(TemplateArgumentList::ComputeODRHash(Args));
- bool IsPartialSpecialization
- = isa<ClassTemplatePartialSpecializationDecl>(Spec) ||
- isa<VarTemplatePartialSpecializationDecl>(Spec);
+ bool IsPartialSpecialization =
+ isa<ClassTemplatePartialSpecializationDecl>(Spec) ||
+ isa<VarTemplatePartialSpecializationDecl>(Spec);
Record.push_back(IsPartialSpecialization);
break;
}
diff --git a/clang/lib/Serialization/ASTWriterDecl.cpp b/clang/lib/Serialization/ASTWriterDecl.cpp
index 5698f6daf854..e6be14b433eb 100644
--- a/clang/lib/Serialization/ASTWriterDecl.cpp
+++ b/clang/lib/Serialization/ASTWriterDecl.cpp
@@ -180,8 +180,9 @@ namespace clang {
/// Collect the first declaration from each module file that provides a
/// declaration of D.
- void CollectFirstDeclFromEachModule(const Decl *D, bool IncludeLocal,
- llvm::MapVector<ModuleFile*, const Decl*> &Firsts) {
+ void CollectFirstDeclFromEachModule(
+ const Decl *D, bool IncludeLocal,
+ llvm::MapVector<ModuleFile *, const Decl *> &Firsts) {
// FIXME: We can skip entries that we know are implied by others.
for (const Decl *R = D->getMostRecentDecl(); R; R = R->getPreviousDecl()) {
@@ -196,7 +197,7 @@ namespace clang {
/// provides a declaration of D. The intent is to provide a sufficient
/// set such that reloading this set will load all current redeclarations.
void AddFirstDeclFromEachModule(const Decl *D, bool IncludeLocal) {
- llvm::MapVector<ModuleFile*, const Decl*> Firsts;
+ llvm::MapVector<ModuleFile *, const Decl *> Firsts;
CollectFirstDeclFromEachModule(D, IncludeLocal, Firsts);
for (const auto &F : Firsts)
@@ -210,9 +211,9 @@ namespace clang {
void AddFirstSpecializationDeclFromEachModule(const Decl *D,
bool IncludeLocal) {
assert(isa<ClassTemplateSpecializationDecl>(D) ||
- isa<VarTemplateSpecializationDecl>(D) || isa<FunctionDecl>(D) &&
- "Must not be called with other decls");
- llvm::MapVector<ModuleFile*, const Decl*> Firsts;
+ isa<VarTemplateSpecializationDecl>(D) ||
+ isa<FunctionDecl>(D) && "Must not be called with other decls");
+ llvm::MapVector<ModuleFile *, const Decl *> Firsts;
CollectFirstDeclFromEachModule(D, IncludeLocal, Firsts);
for (const auto &F : Firsts) {
@@ -226,9 +227,9 @@ namespace clang {
Args = FD->getTemplateSpecializationArgs()->asArray();
assert(Args.size());
Record.push_back(TemplateArgumentList::ComputeODRHash(Args));
- bool IsPartialSpecialization
- = isa<ClassTemplatePartialSpecializationDecl>(D) ||
- isa<VarTemplatePartialSpecializationDecl>(D);
+ bool IsPartialSpecialization =
+ isa<ClassTemplatePartialSpecializationDecl>(D) ||
+ isa<VarTemplatePartialSpecializationDecl>(D);
Record.push_back(IsPartialSpecialization);
}
}
@@ -263,8 +264,8 @@ namespace clang {
assert(!Common->LazySpecializations);
}
- using LazySpecializationInfo
- = RedeclarableTemplateDecl::LazySpecializationInfo;
+ using LazySpecializationInfo =
+ RedeclarableTemplateDecl::LazySpecializationInfo;
ArrayRef<LazySpecializationInfo> LazySpecializations;
if (auto *LS = Common->LazySpecializations)
LazySpecializations = llvm::ArrayRef(LS + 1, LS[0].DeclID.get());
@@ -283,7 +284,7 @@ namespace clang {
for (auto *D : Specs) {
assert(D->isCanonicalDecl() && "non-canonical decl in set");
- AddFirstSpecializationDeclFromEachModule(D, /*IncludeLocal*/true);
+ AddFirstSpecializationDeclFromEachModule(D, /*IncludeLocal*/ true);
}
for (auto &SpecInfo : LazySpecializations) {
Record.push_back(SpecInfo.DeclID.get());
@@ -294,8 +295,8 @@ namespace clang {
// Update the size entry we added earlier. We linerized the
// LazySpecializationInfo members and we need to adjust the size as we
// will read them always together.
- assert ((Record.size() - I - 1) % 3 == 0
- && "Must be divisible by LazySpecializationInfo count!");
+ assert((Record.size() - I - 1) % 3 == 0 &&
+ "Must be divisible by LazySpecializationInfo count!");
Record[I] = (Record.size() - I - 1) / 3;
}