<div dir="ltr">Hello Justin,<br><br>Some of your resent commits broke the next builder: <br><a href="http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/12710">http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/12710</a><br><br>Please have a look at it?<br><br>Thanks<br><br>Galina<br><br><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Oct 10, 2016 at 9:26 AM, Justin Lebar via cfe-commits <span dir="ltr"><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: jlebar<br>
Date: Mon Oct 10 11:26:08 2016<br>
New Revision: 283766<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=283766&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project?rev=283766&view=rev</a><br>
Log:<br>
[Sema] Use unique_ptr instead of raw pointers in the late-parsed templates map.<br>
<br>
Summary:<br>
This is possible now that MapVector supports move-only values.<br>
<br>
Depends on D25404.<br>
<br>
Reviewers: timshen<br>
<br>
Subscribers: cfe-commits<br>
<br>
Differential Revision: <a href="https://reviews.llvm.org/D25405" rel="noreferrer" target="_blank">https://reviews.llvm.org/<wbr>D25405</a><br>
<br>
Modified:<br>
cfe/trunk/include/clang/Sema/<wbr>ExternalSemaSource.h<br>
cfe/trunk/include/clang/Sema/<wbr>MultiplexExternalSemaSource.h<br>
cfe/trunk/include/clang/Sema/<wbr>Sema.h<br>
cfe/trunk/include/clang/<wbr>Serialization/ASTReader.h<br>
cfe/trunk/lib/Sema/<wbr>MultiplexExternalSemaSource.<wbr>cpp<br>
cfe/trunk/lib/Sema/Sema.cpp<br>
cfe/trunk/lib/Sema/<wbr>SemaTemplate.cpp<br>
cfe/trunk/lib/Sema/<wbr>SemaTemplateInstantiateDecl.<wbr>cpp<br>
cfe/trunk/lib/Serialization/<wbr>ASTReader.cpp<br>
cfe/trunk/lib/Serialization/<wbr>ASTWriter.cpp<br>
<br>
Modified: cfe/trunk/include/clang/Sema/<wbr>ExternalSemaSource.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/ExternalSemaSource.h?rev=283766&r1=283765&r2=283766&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/include/<wbr>clang/Sema/ExternalSemaSource.<wbr>h?rev=283766&r1=283765&r2=<wbr>283766&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/include/clang/Sema/<wbr>ExternalSemaSource.h (original)<br>
+++ cfe/trunk/include/clang/Sema/<wbr>ExternalSemaSource.h Mon Oct 10 11:26:08 2016<br>
@@ -190,7 +190,8 @@ public:<br>
/// external source should take care not to introduce the same map entries<br>
/// repeatedly.<br>
virtual void ReadLateParsedTemplates(<br>
- llvm::MapVector<const FunctionDecl *, LateParsedTemplate *> &LPTMap) {}<br>
+ llvm::MapVector<const FunctionDecl *, std::unique_ptr<<wbr>LateParsedTemplate>><br>
+ &LPTMap) {}<br>
<br>
/// \copydoc Sema::CorrectTypo<br>
/// \note LookupKind must correspond to a valid Sema::LookupNameKind<br>
<br>
Modified: cfe/trunk/include/clang/Sema/<wbr>MultiplexExternalSemaSource.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/MultiplexExternalSemaSource.h?rev=283766&r1=283765&r2=283766&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/include/<wbr>clang/Sema/<wbr>MultiplexExternalSemaSource.h?<wbr>rev=283766&r1=283765&r2=<wbr>283766&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/include/clang/Sema/<wbr>MultiplexExternalSemaSource.h (original)<br>
+++ cfe/trunk/include/clang/Sema/<wbr>MultiplexExternalSemaSource.h Mon Oct 10 11:26:08 2016<br>
@@ -322,8 +322,8 @@ public:<br>
/// external source should take care not to introduce the same map entries<br>
/// repeatedly.<br>
void ReadLateParsedTemplates(<br>
- llvm::MapVector<const FunctionDecl *, LateParsedTemplate *> &LPTMap)<br>
- override;<br>
+ llvm::MapVector<const FunctionDecl *, std::unique_ptr<<wbr>LateParsedTemplate>><br>
+ &LPTMap) override;<br>
<br>
/// \copydoc ExternalSemaSource::<wbr>CorrectTypo<br>
/// \note Returns the first nonempty correction.<br>
<br>
Modified: cfe/trunk/include/clang/Sema/<wbr>Sema.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=283766&r1=283765&r2=283766&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/include/<wbr>clang/Sema/Sema.h?rev=283766&<wbr>r1=283765&r2=283766&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/include/clang/Sema/<wbr>Sema.h (original)<br>
+++ cfe/trunk/include/clang/Sema/<wbr>Sema.h Mon Oct 10 11:26:08 2016<br>
@@ -551,7 +551,8 @@ public:<br>
SmallVector<std::pair<<wbr>CXXMethodDecl*, const FunctionProtoType*>, 2><br>
DelayedDefaultedMemberExceptio<wbr>nSpecs;<br>
<br>
- typedef llvm::MapVector<const FunctionDecl *, LateParsedTemplate *><br>
+ typedef llvm::MapVector<const FunctionDecl *,<br>
+ std::unique_ptr<<wbr>LateParsedTemplate>><br>
LateParsedTemplateMapT;<br>
LateParsedTemplateMapT LateParsedTemplateMap;<br>
<br>
<br>
Modified: cfe/trunk/include/clang/<wbr>Serialization/ASTReader.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Serialization/ASTReader.h?rev=283766&r1=283765&r2=283766&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/include/<wbr>clang/Serialization/ASTReader.<wbr>h?rev=283766&r1=283765&r2=<wbr>283766&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/include/clang/<wbr>Serialization/ASTReader.h (original)<br>
+++ cfe/trunk/include/clang/<wbr>Serialization/ASTReader.h Mon Oct 10 11:26:08 2016<br>
@@ -1877,8 +1877,8 @@ public:<br>
SourceLocation> > &Pending) override;<br>
<br>
void ReadLateParsedTemplates(<br>
- llvm::MapVector<const FunctionDecl *, LateParsedTemplate *> &LPTMap)<br>
- override;<br>
+ llvm::MapVector<const FunctionDecl *, std::unique_ptr<<wbr>LateParsedTemplate>><br>
+ &LPTMap) override;<br>
<br>
/// \brief Load a selector from disk, registering its ID if it exists.<br>
void LoadSelector(Selector Sel);<br>
<br>
Modified: cfe/trunk/lib/Sema/<wbr>MultiplexExternalSemaSource.<wbr>cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/MultiplexExternalSemaSource.cpp?rev=283766&r1=283765&r2=283766&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/lib/Sema/<wbr>MultiplexExternalSemaSource.<wbr>cpp?rev=283766&r1=283765&r2=<wbr>283766&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/lib/Sema/<wbr>MultiplexExternalSemaSource.<wbr>cpp (original)<br>
+++ cfe/trunk/lib/Sema/<wbr>MultiplexExternalSemaSource.<wbr>cpp Mon Oct 10 11:26:08 2016<br>
@@ -285,7 +285,8 @@ void MultiplexExternalSemaSource::<wbr>ReadPe<br>
}<br>
<br>
void MultiplexExternalSemaSource::<wbr>ReadLateParsedTemplates(<br>
- llvm::MapVector<const FunctionDecl *, LateParsedTemplate *> &LPTMap) {<br>
+ llvm::MapVector<const FunctionDecl *, std::unique_ptr<<wbr>LateParsedTemplate>><br>
+ &LPTMap) {<br>
for (size_t i = 0; i < Sources.size(); ++i)<br>
Sources[i]-><wbr>ReadLateParsedTemplates(<wbr>LPTMap);<br>
}<br>
<br>
Modified: cfe/trunk/lib/Sema/Sema.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/Sema.cpp?rev=283766&r1=283765&r2=283766&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/lib/Sema/<wbr>Sema.cpp?rev=283766&r1=283765&<wbr>r2=283766&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/lib/Sema/Sema.cpp (original)<br>
+++ cfe/trunk/lib/Sema/Sema.cpp Mon Oct 10 11:26:08 2016<br>
@@ -259,7 +259,6 @@ void Sema::Initialize() {<br>
}<br>
<br>
Sema::~Sema() {<br>
- llvm::DeleteContainerSeconds(<wbr>LateParsedTemplateMap);<br>
if (VisContext) FreeVisContext();<br>
// Kill all the active scopes.<br>
for (unsigned I = 1, E = FunctionScopes.size(); I != E; ++I)<br>
<br>
Modified: cfe/trunk/lib/Sema/<wbr>SemaTemplate.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplate.cpp?rev=283766&r1=283765&r2=283766&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/lib/Sema/<wbr>SemaTemplate.cpp?rev=283766&<wbr>r1=283765&r2=283766&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/lib/Sema/<wbr>SemaTemplate.cpp (original)<br>
+++ cfe/trunk/lib/Sema/<wbr>SemaTemplate.cpp Mon Oct 10 11:26:08 2016<br>
@@ -8668,12 +8668,12 @@ void Sema::<wbr>MarkAsLateParsedTemplate(Func<br>
if (!FD)<br>
return;<br>
<br>
- LateParsedTemplate *LPT = new LateParsedTemplate;<br>
+ auto LPT = llvm::make_unique<<wbr>LateParsedTemplate>();<br>
<br>
// Take tokens to avoid allocations<br>
LPT->Toks.swap(Toks);<br>
LPT->D = FnD;<br>
- LateParsedTemplateMap.insert(<wbr>std::make_pair(FD, LPT));<br>
+ LateParsedTemplateMap.insert(<wbr>std::make_pair(FD, std::move(LPT)));<br>
<br>
FD->setLateTemplateParsed(<wbr>true);<br>
}<br>
<br>
Modified: cfe/trunk/lib/Sema/<wbr>SemaTemplateInstantiateDecl.<wbr>cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp?rev=283766&r1=283765&r2=283766&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/lib/Sema/<wbr>SemaTemplateInstantiateDecl.<wbr>cpp?rev=283766&r1=283765&r2=<wbr>283766&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/lib/Sema/<wbr>SemaTemplateInstantiateDecl.<wbr>cpp (original)<br>
+++ cfe/trunk/lib/Sema/<wbr>SemaTemplateInstantiateDecl.<wbr>cpp Mon Oct 10 11:26:08 2016<br>
@@ -3622,9 +3622,10 @@ void Sema::<wbr>InstantiateFunctionDefinition<br>
if (PatternDecl->isFromASTFile())<br>
ExternalSource-><wbr>ReadLateParsedTemplates(<wbr>LateParsedTemplateMap);<br>
<br>
- LateParsedTemplate *LPT = LateParsedTemplateMap.lookup(<wbr>PatternDecl);<br>
- assert(LPT && "missing LateParsedTemplate");<br>
- LateTemplateParser(<wbr>OpaqueParser, *LPT);<br>
+ auto LPTIter = LateParsedTemplateMap.find(<wbr>PatternDecl);<br>
+ assert(LPTIter != LateParsedTemplateMap.end() &&<br>
+ "missing LateParsedTemplate");<br>
+ LateTemplateParser(<wbr>OpaqueParser, *LPTIter->second);<br>
Pattern = PatternDecl->getBody(<wbr>PatternDecl);<br>
}<br>
<br>
<br>
Modified: cfe/trunk/lib/Serialization/<wbr>ASTReader.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReader.cpp?rev=283766&r1=283765&r2=283766&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/lib/<wbr>Serialization/ASTReader.cpp?<wbr>rev=283766&r1=283765&r2=<wbr>283766&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/lib/Serialization/<wbr>ASTReader.cpp (original)<br>
+++ cfe/trunk/lib/Serialization/<wbr>ASTReader.cpp Mon Oct 10 11:26:08 2016<br>
@@ -7556,12 +7556,13 @@ void ASTReader::<wbr>ReadPendingInstantiation<br>
}<br>
<br>
void ASTReader::<wbr>ReadLateParsedTemplates(<br>
- llvm::MapVector<const FunctionDecl *, LateParsedTemplate *> &LPTMap) {<br>
+ llvm::MapVector<const FunctionDecl *, std::unique_ptr<<wbr>LateParsedTemplate>><br>
+ &LPTMap) {<br>
for (unsigned Idx = 0, N = LateParsedTemplates.size(); Idx < N;<br>
/* In loop */) {<br>
FunctionDecl *FD = cast<FunctionDecl>(GetDecl(<wbr>LateParsedTemplates[Idx++]));<br>
<br>
- LateParsedTemplate *LT = new LateParsedTemplate;<br>
+ auto LT = llvm::make_unique<<wbr>LateParsedTemplate>();<br>
LT->D = GetDecl(LateParsedTemplates[<wbr>Idx++]);<br>
<br>
ModuleFile *F = getOwningModuleFile(LT->D);<br>
@@ -7572,7 +7573,7 @@ void ASTReader::<wbr>ReadLateParsedTemplates(<br>
for (unsigned T = 0; T < TokN; ++T)<br>
LT->Toks.push_back(ReadToken(*<wbr>F, LateParsedTemplates, Idx));<br>
<br>
- LPTMap.insert(std::make_pair(<wbr>FD, LT));<br>
+ LPTMap.insert(std::make_pair(<wbr>FD, std::move(LT)));<br>
}<br>
<br>
LateParsedTemplates.clear();<br>
<br>
Modified: cfe/trunk/lib/Serialization/<wbr>ASTWriter.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTWriter.cpp?rev=283766&r1=283765&r2=283766&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/lib/<wbr>Serialization/ASTWriter.cpp?<wbr>rev=283766&r1=283765&r2=<wbr>283766&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/lib/Serialization/<wbr>ASTWriter.cpp (original)<br>
+++ cfe/trunk/lib/Serialization/<wbr>ASTWriter.cpp Mon Oct 10 11:26:08 2016<br>
@@ -4009,14 +4009,14 @@ void ASTWriter::<wbr>WriteLateParsedTemplates<br>
return;<br>
<br>
RecordData Record;<br>
- for (auto LPTMapEntry : LPTMap) {<br>
+ for (auto &LPTMapEntry : LPTMap) {<br>
const FunctionDecl *FD = LPTMapEntry.first;<br>
- LateParsedTemplate *LPT = LPTMapEntry.second;<br>
+ LateParsedTemplate &LPT = *LPTMapEntry.second;<br>
AddDeclRef(FD, Record);<br>
- AddDeclRef(LPT->D, Record);<br>
- Record.push_back(LPT->Toks.<wbr>size());<br>
+ AddDeclRef(LPT.D, Record);<br>
+ Record.push_back(LPT.Toks.<wbr>size());<br>
<br>
- for (const auto &Tok : LPT->Toks) {<br>
+ for (const auto &Tok : LPT.Toks) {<br>
AddToken(Tok, Record);<br>
}<br>
}<br>
<br>
<br>
______________________________<wbr>_________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br></div>