diff options
author | David Blaikie <dblaikie@gmail.com> | 2012-12-19 00:45:41 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2012-12-19 00:45:41 +0000 |
commit | 3bc93e3124ad5e7191c4a12dc981c8ee53578193 (patch) | |
tree | 473bface3adcd2064712462246a506969b0284d8 /lib/Serialization/ASTWriter.cpp | |
parent | 8a68da12c71efeeaca0ed24c39288a2117d07f9d (diff) |
Change DeclContextLookup(Const)Result to (Mutable)ArrayRef<NamedDecl*>, as per review discussion in r170365
This does limit these typedefs to being sequences, but no current usage
requires them to be contiguous (we could expand this to a more general
iterator pair range concept at some point).
Also, it'd be nice if SmallVector were constructible directly from an ArrayRef
but this is a bit tricky since ArrayRef depends on SmallVectorBaseImpl for the
inverse conversion. (& generalizing over all range-like things, while nice,
would require some nontrivial SFINAE I haven't thought about yet)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170482 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Serialization/ASTWriter.cpp')
-rw-r--r-- | lib/Serialization/ASTWriter.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/Serialization/ASTWriter.cpp b/lib/Serialization/ASTWriter.cpp index 1b39f551bf..58f7fe7051 100644 --- a/lib/Serialization/ASTWriter.cpp +++ b/lib/Serialization/ASTWriter.cpp @@ -2947,7 +2947,7 @@ public: clang::io::Emit16(Out, KeyLen); // 2 bytes for num of decls and 4 for each DeclID. - unsigned DataLen = 2 + 4 * (Lookup.second - Lookup.first); + unsigned DataLen = 2 + 4 * Lookup.size(); clang::io::Emit16(Out, DataLen); return std::make_pair(KeyLen, DataLen); @@ -2987,9 +2987,10 @@ public: void EmitData(raw_ostream& Out, key_type_ref, data_type Lookup, unsigned DataLen) { uint64_t Start = Out.tell(); (void)Start; - clang::io::Emit16(Out, Lookup.second - Lookup.first); - for (; Lookup.first != Lookup.second; ++Lookup.first) - clang::io::Emit32(Out, Writer.GetDeclRef(*Lookup.first)); + clang::io::Emit16(Out, Lookup.size()); + for (DeclContext::lookup_iterator I = Lookup.begin(), E = Lookup.end(); + I != E; ++I) + clang::io::Emit32(Out, Writer.GetDeclRef(*I)); assert(Out.tell() - Start == DataLen && "Data length is wrong"); } @@ -3038,7 +3039,7 @@ uint64_t ASTWriter::WriteDeclContextVisibleBlock(ASTContext &Context, D != DEnd; ++D) { DeclarationName Name = D->first; DeclContext::lookup_result Result = D->second.getLookupResult(); - if (Result.first != Result.second) { + if (!Result.empty()) { if (Name.getNameKind() == DeclarationName::CXXConversionFunctionName) { // Hash all conversion function names to the same name. The actual // type information in conversion function name is not used in the @@ -3047,7 +3048,7 @@ uint64_t ASTWriter::WriteDeclContextVisibleBlock(ASTContext &Context, // functions under a single key. if (!ConversionName) ConversionName = Name; - ConversionDecls.append(Result.first, Result.second); + ConversionDecls.append(Result.begin(), Result.end()); continue; } @@ -3106,7 +3107,7 @@ void ASTWriter::WriteDeclContextVisibleUpdate(const DeclContext *DC) { DeclContext::lookup_result Result = D->second.getLookupResult(); // For any name that appears in this table, the results are complete, i.e. // they overwrite results from previous PCHs. Merging is always a mess. - if (Result.first != Result.second) + if (!Result.empty()) Generator.insert(Name, Result, Trait); } |