mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-04-01 12:43:47 +00:00
[clang-tools-extra] Migrate llvm::make_unique to std::make_unique
Now that we've moved to C++14, we no longer need the llvm::make_unique implementation from STLExtras.h. This patch is a mechanical replacement of (hopefully) all the llvm::make_unique instances across the monorepo. Differential revision: https://reviews.llvm.org/D66259 llvm-svn: 368944
This commit is contained in:
parent
2b3d49b610
commit
1c705d9c53
@ -109,7 +109,7 @@ getLexerStartingFromLoc(SourceLocation Loc, const SourceManager &SM,
|
||||
|
||||
const char *TokBegin = File.data() + LocInfo.second;
|
||||
// Lex from the start of the given location.
|
||||
return llvm::make_unique<Lexer>(SM.getLocForStartOfFile(LocInfo.first),
|
||||
return std::make_unique<Lexer>(SM.getLocForStartOfFile(LocInfo.first),
|
||||
LangOpts, File.begin(), TokBegin, File.end());
|
||||
}
|
||||
|
||||
|
@ -329,7 +329,7 @@ template <> llvm::Expected<CommentInfo *> getCommentInfo(EnumInfo *I) {
|
||||
}
|
||||
|
||||
template <> llvm::Expected<CommentInfo *> getCommentInfo(CommentInfo *I) {
|
||||
I->Children.emplace_back(llvm::make_unique<CommentInfo>());
|
||||
I->Children.emplace_back(std::make_unique<CommentInfo>());
|
||||
return I->Children.back().get();
|
||||
}
|
||||
|
||||
@ -690,7 +690,7 @@ llvm::Error ClangDocBitcodeReader::readBlockInfoBlock() {
|
||||
template <typename T>
|
||||
llvm::Expected<std::unique_ptr<Info>>
|
||||
ClangDocBitcodeReader::createInfo(unsigned ID) {
|
||||
std::unique_ptr<Info> I = llvm::make_unique<T>();
|
||||
std::unique_ptr<Info> I = std::make_unique<T>();
|
||||
if (auto Err = readBlock(ID, static_cast<T *>(I.get())))
|
||||
return std::move(Err);
|
||||
return std::unique_ptr<Info>{std::move(I)};
|
||||
|
@ -43,7 +43,7 @@ clang::FrontendAction *MapperActionFactory::create() {
|
||||
std::unique_ptr<clang::ASTConsumer>
|
||||
CreateASTConsumer(clang::CompilerInstance &Compiler,
|
||||
llvm::StringRef InFile) override {
|
||||
return llvm::make_unique<MapASTVisitor>(&Compiler.getASTContext(), CDCtx);
|
||||
return std::make_unique<MapASTVisitor>(&Compiler.getASTContext(), CDCtx);
|
||||
}
|
||||
|
||||
private:
|
||||
@ -54,7 +54,7 @@ clang::FrontendAction *MapperActionFactory::create() {
|
||||
|
||||
std::unique_ptr<tooling::FrontendActionFactory>
|
||||
newMapperActionFactory(ClangDocContext CDCtx) {
|
||||
return llvm::make_unique<MapperActionFactory>(CDCtx);
|
||||
return std::make_unique<MapperActionFactory>(CDCtx);
|
||||
}
|
||||
|
||||
} // namespace doc
|
||||
|
@ -79,7 +79,7 @@ struct TextNode : public HTMLNode {
|
||||
struct TagNode : public HTMLNode {
|
||||
TagNode(HTMLTag Tag) : HTMLNode(NodeType::NODE_TAG), Tag(Tag) {}
|
||||
TagNode(HTMLTag Tag, const Twine &Text) : TagNode(Tag) {
|
||||
Children.emplace_back(llvm::make_unique<TextNode>(Text.str()));
|
||||
Children.emplace_back(std::make_unique<TextNode>(Text.str()));
|
||||
}
|
||||
|
||||
HTMLTag Tag; // Name of HTML Tag (p, div, h1)
|
||||
@ -254,7 +254,7 @@ static std::vector<std::unique_ptr<TagNode>>
|
||||
genStylesheetsHTML(StringRef InfoPath, const ClangDocContext &CDCtx) {
|
||||
std::vector<std::unique_ptr<TagNode>> Out;
|
||||
for (const auto &FilePath : CDCtx.UserStylesheets) {
|
||||
auto LinkNode = llvm::make_unique<TagNode>(HTMLTag::TAG_LINK);
|
||||
auto LinkNode = std::make_unique<TagNode>(HTMLTag::TAG_LINK);
|
||||
LinkNode->Attributes.try_emplace("rel", "stylesheet");
|
||||
SmallString<128> StylesheetPath = computeRelativePath("", InfoPath);
|
||||
llvm::sys::path::append(StylesheetPath,
|
||||
@ -271,7 +271,7 @@ static std::vector<std::unique_ptr<TagNode>>
|
||||
genJsScriptsHTML(StringRef InfoPath, const ClangDocContext &CDCtx) {
|
||||
std::vector<std::unique_ptr<TagNode>> Out;
|
||||
for (const auto &FilePath : CDCtx.JsScripts) {
|
||||
auto ScriptNode = llvm::make_unique<TagNode>(HTMLTag::TAG_SCRIPT);
|
||||
auto ScriptNode = std::make_unique<TagNode>(HTMLTag::TAG_SCRIPT);
|
||||
SmallString<128> ScriptPath = computeRelativePath("", InfoPath);
|
||||
llvm::sys::path::append(ScriptPath, llvm::sys::path::filename(FilePath));
|
||||
// Paths in HTML must be in posix-style
|
||||
@ -283,7 +283,7 @@ genJsScriptsHTML(StringRef InfoPath, const ClangDocContext &CDCtx) {
|
||||
}
|
||||
|
||||
static std::unique_ptr<TagNode> genLink(const Twine &Text, const Twine &Link) {
|
||||
auto LinkNode = llvm::make_unique<TagNode>(HTMLTag::TAG_A, Text);
|
||||
auto LinkNode = std::make_unique<TagNode>(HTMLTag::TAG_A, Text);
|
||||
LinkNode->Attributes.try_emplace("href", Link.str());
|
||||
return LinkNode;
|
||||
}
|
||||
@ -293,7 +293,7 @@ genReference(const Reference &Type, StringRef CurrentDirectory,
|
||||
llvm::Optional<StringRef> JumpToSection = None) {
|
||||
if (Type.Path.empty() && !Type.IsInGlobalNamespace) {
|
||||
if (!JumpToSection)
|
||||
return llvm::make_unique<TextNode>(Type.Name);
|
||||
return std::make_unique<TextNode>(Type.Name);
|
||||
else
|
||||
return genLink(Type.Name, "#" + JumpToSection.getValue());
|
||||
}
|
||||
@ -313,7 +313,7 @@ genReferenceList(const llvm::SmallVectorImpl<Reference> &Refs,
|
||||
std::vector<std::unique_ptr<HTMLNode>> Out;
|
||||
for (const auto &R : Refs) {
|
||||
if (&R != Refs.begin())
|
||||
Out.emplace_back(llvm::make_unique<TextNode>(", "));
|
||||
Out.emplace_back(std::make_unique<TextNode>(", "));
|
||||
Out.emplace_back(genReference(R, CurrentDirectory));
|
||||
}
|
||||
return Out;
|
||||
@ -332,9 +332,9 @@ genEnumsBlock(const std::vector<EnumInfo> &Enums,
|
||||
return {};
|
||||
|
||||
std::vector<std::unique_ptr<TagNode>> Out;
|
||||
Out.emplace_back(llvm::make_unique<TagNode>(HTMLTag::TAG_H2, "Enums"));
|
||||
Out.emplace_back(std::make_unique<TagNode>(HTMLTag::TAG_H2, "Enums"));
|
||||
Out.back()->Attributes.try_emplace("id", "Enums");
|
||||
Out.emplace_back(llvm::make_unique<TagNode>(HTMLTag::TAG_DIV));
|
||||
Out.emplace_back(std::make_unique<TagNode>(HTMLTag::TAG_DIV));
|
||||
auto &DivBody = Out.back();
|
||||
for (const auto &E : Enums) {
|
||||
std::vector<std::unique_ptr<TagNode>> Nodes = genHTML(E, CDCtx);
|
||||
@ -348,9 +348,9 @@ genEnumMembersBlock(const llvm::SmallVector<SmallString<16>, 4> &Members) {
|
||||
if (Members.empty())
|
||||
return nullptr;
|
||||
|
||||
auto List = llvm::make_unique<TagNode>(HTMLTag::TAG_UL);
|
||||
auto List = std::make_unique<TagNode>(HTMLTag::TAG_UL);
|
||||
for (const auto &M : Members)
|
||||
List->Children.emplace_back(llvm::make_unique<TagNode>(HTMLTag::TAG_LI, M));
|
||||
List->Children.emplace_back(std::make_unique<TagNode>(HTMLTag::TAG_LI, M));
|
||||
return List;
|
||||
}
|
||||
|
||||
@ -361,9 +361,9 @@ genFunctionsBlock(const std::vector<FunctionInfo> &Functions,
|
||||
return {};
|
||||
|
||||
std::vector<std::unique_ptr<TagNode>> Out;
|
||||
Out.emplace_back(llvm::make_unique<TagNode>(HTMLTag::TAG_H2, "Functions"));
|
||||
Out.emplace_back(std::make_unique<TagNode>(HTMLTag::TAG_H2, "Functions"));
|
||||
Out.back()->Attributes.try_emplace("id", "Functions");
|
||||
Out.emplace_back(llvm::make_unique<TagNode>(HTMLTag::TAG_DIV));
|
||||
Out.emplace_back(std::make_unique<TagNode>(HTMLTag::TAG_DIV));
|
||||
auto &DivBody = Out.back();
|
||||
for (const auto &F : Functions) {
|
||||
std::vector<std::unique_ptr<TagNode>> Nodes =
|
||||
@ -380,18 +380,18 @@ genRecordMembersBlock(const llvm::SmallVector<MemberTypeInfo, 4> &Members,
|
||||
return {};
|
||||
|
||||
std::vector<std::unique_ptr<TagNode>> Out;
|
||||
Out.emplace_back(llvm::make_unique<TagNode>(HTMLTag::TAG_H2, "Members"));
|
||||
Out.emplace_back(std::make_unique<TagNode>(HTMLTag::TAG_H2, "Members"));
|
||||
Out.back()->Attributes.try_emplace("id", "Members");
|
||||
Out.emplace_back(llvm::make_unique<TagNode>(HTMLTag::TAG_UL));
|
||||
Out.emplace_back(std::make_unique<TagNode>(HTMLTag::TAG_UL));
|
||||
auto &ULBody = Out.back();
|
||||
for (const auto &M : Members) {
|
||||
std::string Access = getAccess(M.Access);
|
||||
if (Access != "")
|
||||
Access = Access + " ";
|
||||
auto LIBody = llvm::make_unique<TagNode>(HTMLTag::TAG_LI);
|
||||
LIBody->Children.emplace_back(llvm::make_unique<TextNode>(Access));
|
||||
auto LIBody = std::make_unique<TagNode>(HTMLTag::TAG_LI);
|
||||
LIBody->Children.emplace_back(std::make_unique<TextNode>(Access));
|
||||
LIBody->Children.emplace_back(genReference(M.Type, ParentInfoDir));
|
||||
LIBody->Children.emplace_back(llvm::make_unique<TextNode>(" " + M.Name));
|
||||
LIBody->Children.emplace_back(std::make_unique<TextNode>(" " + M.Name));
|
||||
ULBody->Children.emplace_back(std::move(LIBody));
|
||||
}
|
||||
return Out;
|
||||
@ -404,12 +404,12 @@ genReferencesBlock(const std::vector<Reference> &References,
|
||||
return {};
|
||||
|
||||
std::vector<std::unique_ptr<TagNode>> Out;
|
||||
Out.emplace_back(llvm::make_unique<TagNode>(HTMLTag::TAG_H2, Title));
|
||||
Out.emplace_back(std::make_unique<TagNode>(HTMLTag::TAG_H2, Title));
|
||||
Out.back()->Attributes.try_emplace("id", Title);
|
||||
Out.emplace_back(llvm::make_unique<TagNode>(HTMLTag::TAG_UL));
|
||||
Out.emplace_back(std::make_unique<TagNode>(HTMLTag::TAG_UL));
|
||||
auto &ULBody = Out.back();
|
||||
for (const auto &R : References) {
|
||||
auto LiNode = llvm::make_unique<TagNode>(HTMLTag::TAG_LI);
|
||||
auto LiNode = std::make_unique<TagNode>(HTMLTag::TAG_LI);
|
||||
LiNode->Children.emplace_back(genReference(R, ParentPath));
|
||||
ULBody->Children.emplace_back(std::move(LiNode));
|
||||
}
|
||||
@ -420,22 +420,22 @@ static std::unique_ptr<TagNode>
|
||||
writeFileDefinition(const Location &L,
|
||||
llvm::Optional<StringRef> RepositoryUrl = None) {
|
||||
if (!L.IsFileInRootDir || !RepositoryUrl)
|
||||
return llvm::make_unique<TagNode>(
|
||||
return std::make_unique<TagNode>(
|
||||
HTMLTag::TAG_P, "Defined at line " + std::to_string(L.LineNumber) +
|
||||
" of file " + L.Filename);
|
||||
SmallString<128> FileURL(RepositoryUrl.getValue());
|
||||
llvm::sys::path::append(FileURL, llvm::sys::path::Style::posix, L.Filename);
|
||||
auto Node = llvm::make_unique<TagNode>(HTMLTag::TAG_P);
|
||||
Node->Children.emplace_back(llvm::make_unique<TextNode>("Defined at line "));
|
||||
auto Node = std::make_unique<TagNode>(HTMLTag::TAG_P);
|
||||
Node->Children.emplace_back(std::make_unique<TextNode>("Defined at line "));
|
||||
auto LocNumberNode =
|
||||
llvm::make_unique<TagNode>(HTMLTag::TAG_A, std::to_string(L.LineNumber));
|
||||
std::make_unique<TagNode>(HTMLTag::TAG_A, std::to_string(L.LineNumber));
|
||||
// The links to a specific line in the source code use the github /
|
||||
// googlesource notation so it won't work for all hosting pages.
|
||||
LocNumberNode->Attributes.try_emplace(
|
||||
"href", (FileURL + "#" + std::to_string(L.LineNumber)).str());
|
||||
Node->Children.emplace_back(std::move(LocNumberNode));
|
||||
Node->Children.emplace_back(llvm::make_unique<TextNode>(" of file "));
|
||||
auto LocFileNode = llvm::make_unique<TagNode>(
|
||||
Node->Children.emplace_back(std::make_unique<TextNode>(" of file "));
|
||||
auto LocFileNode = std::make_unique<TagNode>(
|
||||
HTMLTag::TAG_A, llvm::sys::path::filename(FileURL));
|
||||
LocFileNode->Attributes.try_emplace("href", FileURL);
|
||||
Node->Children.emplace_back(std::move(LocFileNode));
|
||||
@ -446,10 +446,10 @@ static std::vector<std::unique_ptr<TagNode>>
|
||||
genCommonFileNodes(StringRef Title, StringRef InfoPath,
|
||||
const ClangDocContext &CDCtx) {
|
||||
std::vector<std::unique_ptr<TagNode>> Out;
|
||||
auto MetaNode = llvm::make_unique<TagNode>(HTMLTag::TAG_META);
|
||||
auto MetaNode = std::make_unique<TagNode>(HTMLTag::TAG_META);
|
||||
MetaNode->Attributes.try_emplace("charset", "utf-8");
|
||||
Out.emplace_back(std::move(MetaNode));
|
||||
Out.emplace_back(llvm::make_unique<TagNode>(HTMLTag::TAG_TITLE, Title));
|
||||
Out.emplace_back(std::make_unique<TagNode>(HTMLTag::TAG_TITLE, Title));
|
||||
std::vector<std::unique_ptr<TagNode>> StylesheetsNodes =
|
||||
genStylesheetsHTML(InfoPath, CDCtx);
|
||||
AppendVector(std::move(StylesheetsNodes), Out);
|
||||
@ -457,7 +457,7 @@ genCommonFileNodes(StringRef Title, StringRef InfoPath,
|
||||
genJsScriptsHTML(InfoPath, CDCtx);
|
||||
AppendVector(std::move(JsNodes), Out);
|
||||
// An empty <div> is generated but the index will be then rendered here
|
||||
auto IndexNode = llvm::make_unique<TagNode>(HTMLTag::TAG_DIV);
|
||||
auto IndexNode = std::make_unique<TagNode>(HTMLTag::TAG_DIV);
|
||||
IndexNode->Attributes.try_emplace("id", "index");
|
||||
IndexNode->Attributes.try_emplace("path", InfoPath);
|
||||
Out.emplace_back(std::move(IndexNode));
|
||||
@ -478,7 +478,7 @@ static std::vector<std::unique_ptr<TagNode>> genHTML(const Index &Index,
|
||||
StringRef InfoPath) {
|
||||
std::vector<std::unique_ptr<TagNode>> Out;
|
||||
if (!Index.Name.empty()) {
|
||||
Out.emplace_back(llvm::make_unique<TagNode>(HTMLTag::TAG_SPAN));
|
||||
Out.emplace_back(std::make_unique<TagNode>(HTMLTag::TAG_SPAN));
|
||||
auto &SpanBody = Out.back();
|
||||
if (!Index.JumpToSection)
|
||||
SpanBody->Children.emplace_back(genReference(Index, InfoPath));
|
||||
@ -488,10 +488,10 @@ static std::vector<std::unique_ptr<TagNode>> genHTML(const Index &Index,
|
||||
}
|
||||
if (Index.Children.empty())
|
||||
return Out;
|
||||
Out.emplace_back(llvm::make_unique<TagNode>(HTMLTag::TAG_UL));
|
||||
Out.emplace_back(std::make_unique<TagNode>(HTMLTag::TAG_UL));
|
||||
const auto &UlBody = Out.back();
|
||||
for (const auto &C : Index.Children) {
|
||||
auto LiBody = llvm::make_unique<TagNode>(HTMLTag::TAG_LI);
|
||||
auto LiBody = std::make_unique<TagNode>(HTMLTag::TAG_LI);
|
||||
std::vector<std::unique_ptr<TagNode>> Nodes = genHTML(C, InfoPath);
|
||||
AppendVector(std::move(Nodes), LiBody->Children);
|
||||
UlBody->Children.emplace_back(std::move(LiBody));
|
||||
@ -501,7 +501,7 @@ static std::vector<std::unique_ptr<TagNode>> genHTML(const Index &Index,
|
||||
|
||||
static std::unique_ptr<HTMLNode> genHTML(const CommentInfo &I) {
|
||||
if (I.Kind == "FullComment") {
|
||||
auto FullComment = llvm::make_unique<TagNode>(HTMLTag::TAG_DIV);
|
||||
auto FullComment = std::make_unique<TagNode>(HTMLTag::TAG_DIV);
|
||||
for (const auto &Child : I.Children) {
|
||||
std::unique_ptr<HTMLNode> Node = genHTML(*Child);
|
||||
if (Node)
|
||||
@ -509,7 +509,7 @@ static std::unique_ptr<HTMLNode> genHTML(const CommentInfo &I) {
|
||||
}
|
||||
return std::move(FullComment);
|
||||
} else if (I.Kind == "ParagraphComment") {
|
||||
auto ParagraphComment = llvm::make_unique<TagNode>(HTMLTag::TAG_P);
|
||||
auto ParagraphComment = std::make_unique<TagNode>(HTMLTag::TAG_P);
|
||||
for (const auto &Child : I.Children) {
|
||||
std::unique_ptr<HTMLNode> Node = genHTML(*Child);
|
||||
if (Node)
|
||||
@ -521,13 +521,13 @@ static std::unique_ptr<HTMLNode> genHTML(const CommentInfo &I) {
|
||||
} else if (I.Kind == "TextComment") {
|
||||
if (I.Text == "")
|
||||
return nullptr;
|
||||
return llvm::make_unique<TextNode>(I.Text);
|
||||
return std::make_unique<TextNode>(I.Text);
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static std::unique_ptr<TagNode> genHTML(const std::vector<CommentInfo> &C) {
|
||||
auto CommentBlock = llvm::make_unique<TagNode>(HTMLTag::TAG_DIV);
|
||||
auto CommentBlock = std::make_unique<TagNode>(HTMLTag::TAG_DIV);
|
||||
for (const auto &Child : C) {
|
||||
if (std::unique_ptr<HTMLNode> Node = genHTML(Child))
|
||||
CommentBlock->Children.emplace_back(std::move(Node));
|
||||
@ -545,7 +545,7 @@ genHTML(const EnumInfo &I, const ClangDocContext &CDCtx) {
|
||||
EnumType = "enum ";
|
||||
|
||||
Out.emplace_back(
|
||||
llvm::make_unique<TagNode>(HTMLTag::TAG_H3, EnumType + I.Name));
|
||||
std::make_unique<TagNode>(HTMLTag::TAG_H3, EnumType + I.Name));
|
||||
Out.back()->Attributes.try_emplace("id",
|
||||
llvm::toHex(llvm::toStringRef(I.USR)));
|
||||
|
||||
@ -572,35 +572,35 @@ static std::vector<std::unique_ptr<TagNode>>
|
||||
genHTML(const FunctionInfo &I, const ClangDocContext &CDCtx,
|
||||
StringRef ParentInfoDir) {
|
||||
std::vector<std::unique_ptr<TagNode>> Out;
|
||||
Out.emplace_back(llvm::make_unique<TagNode>(HTMLTag::TAG_H3, I.Name));
|
||||
Out.emplace_back(std::make_unique<TagNode>(HTMLTag::TAG_H3, I.Name));
|
||||
// USR is used as id for functions instead of name to disambiguate function
|
||||
// overloads.
|
||||
Out.back()->Attributes.try_emplace("id",
|
||||
llvm::toHex(llvm::toStringRef(I.USR)));
|
||||
|
||||
Out.emplace_back(llvm::make_unique<TagNode>(HTMLTag::TAG_P));
|
||||
Out.emplace_back(std::make_unique<TagNode>(HTMLTag::TAG_P));
|
||||
auto &FunctionHeader = Out.back();
|
||||
|
||||
std::string Access = getAccess(I.Access);
|
||||
if (Access != "")
|
||||
FunctionHeader->Children.emplace_back(
|
||||
llvm::make_unique<TextNode>(Access + " "));
|
||||
std::make_unique<TextNode>(Access + " "));
|
||||
if (I.ReturnType.Type.Name != "") {
|
||||
FunctionHeader->Children.emplace_back(
|
||||
genReference(I.ReturnType.Type, ParentInfoDir));
|
||||
FunctionHeader->Children.emplace_back(llvm::make_unique<TextNode>(" "));
|
||||
FunctionHeader->Children.emplace_back(std::make_unique<TextNode>(" "));
|
||||
}
|
||||
FunctionHeader->Children.emplace_back(
|
||||
llvm::make_unique<TextNode>(I.Name + "("));
|
||||
std::make_unique<TextNode>(I.Name + "("));
|
||||
|
||||
for (const auto &P : I.Params) {
|
||||
if (&P != I.Params.begin())
|
||||
FunctionHeader->Children.emplace_back(llvm::make_unique<TextNode>(", "));
|
||||
FunctionHeader->Children.emplace_back(std::make_unique<TextNode>(", "));
|
||||
FunctionHeader->Children.emplace_back(genReference(P.Type, ParentInfoDir));
|
||||
FunctionHeader->Children.emplace_back(
|
||||
llvm::make_unique<TextNode>(" " + P.Name));
|
||||
std::make_unique<TextNode>(" " + P.Name));
|
||||
}
|
||||
FunctionHeader->Children.emplace_back(llvm::make_unique<TextNode>(")"));
|
||||
FunctionHeader->Children.emplace_back(std::make_unique<TextNode>(")"));
|
||||
|
||||
if (I.DefLoc) {
|
||||
if (!CDCtx.RepositoryUrl)
|
||||
@ -626,7 +626,7 @@ genHTML(const NamespaceInfo &I, Index &InfoIndex, const ClangDocContext &CDCtx,
|
||||
else
|
||||
InfoTitle = ("namespace " + I.Name).str();
|
||||
|
||||
Out.emplace_back(llvm::make_unique<TagNode>(HTMLTag::TAG_H1, InfoTitle));
|
||||
Out.emplace_back(std::make_unique<TagNode>(HTMLTag::TAG_H1, InfoTitle));
|
||||
|
||||
std::string Description;
|
||||
if (!I.Description.empty())
|
||||
@ -664,7 +664,7 @@ genHTML(const RecordInfo &I, Index &InfoIndex, const ClangDocContext &CDCtx,
|
||||
std::string &InfoTitle) {
|
||||
std::vector<std::unique_ptr<TagNode>> Out;
|
||||
InfoTitle = (getTagType(I.TagType) + " " + I.Name).str();
|
||||
Out.emplace_back(llvm::make_unique<TagNode>(HTMLTag::TAG_H1, InfoTitle));
|
||||
Out.emplace_back(std::make_unique<TagNode>(HTMLTag::TAG_H1, InfoTitle));
|
||||
|
||||
if (I.DefLoc) {
|
||||
if (!CDCtx.RepositoryUrl)
|
||||
@ -683,16 +683,16 @@ genHTML(const RecordInfo &I, Index &InfoIndex, const ClangDocContext &CDCtx,
|
||||
std::vector<std::unique_ptr<HTMLNode>> VParents =
|
||||
genReferenceList(I.VirtualParents, I.Path);
|
||||
if (!Parents.empty() || !VParents.empty()) {
|
||||
Out.emplace_back(llvm::make_unique<TagNode>(HTMLTag::TAG_P));
|
||||
Out.emplace_back(std::make_unique<TagNode>(HTMLTag::TAG_P));
|
||||
auto &PBody = Out.back();
|
||||
PBody->Children.emplace_back(llvm::make_unique<TextNode>("Inherits from "));
|
||||
PBody->Children.emplace_back(std::make_unique<TextNode>("Inherits from "));
|
||||
if (Parents.empty())
|
||||
AppendVector(std::move(VParents), PBody->Children);
|
||||
else if (VParents.empty())
|
||||
AppendVector(std::move(Parents), PBody->Children);
|
||||
else {
|
||||
AppendVector(std::move(Parents), PBody->Children);
|
||||
PBody->Children.emplace_back(llvm::make_unique<TextNode>(", "));
|
||||
PBody->Children.emplace_back(std::make_unique<TextNode>(", "));
|
||||
AppendVector(std::move(VParents), PBody->Children);
|
||||
}
|
||||
}
|
||||
@ -740,7 +740,7 @@ llvm::Error HTMLGenerator::generateDocForInfo(Info *I, llvm::raw_ostream &OS,
|
||||
const ClangDocContext &CDCtx) {
|
||||
HTMLFile F;
|
||||
std::string InfoTitle;
|
||||
auto MainContentNode = llvm::make_unique<TagNode>(HTMLTag::TAG_DIV);
|
||||
auto MainContentNode = std::make_unique<TagNode>(HTMLTag::TAG_DIV);
|
||||
Index InfoIndex;
|
||||
switch (I->IT) {
|
||||
case InfoType::IT_namespace: {
|
||||
|
@ -36,7 +36,7 @@ reduce(std::vector<std::unique_ptr<Info>> &Values) {
|
||||
if (Values.empty())
|
||||
return llvm::make_error<llvm::StringError>(" No values to reduce.\n",
|
||||
llvm::inconvertibleErrorCode());
|
||||
std::unique_ptr<Info> Merged = llvm::make_unique<T>(Values[0]->USR);
|
||||
std::unique_ptr<Info> Merged = std::make_unique<T>(Values[0]->USR);
|
||||
T *Tmp = static_cast<T *>(Merged.get());
|
||||
for (auto &I : Values)
|
||||
Tmp->merge(std::move(*static_cast<T *>(I.get())));
|
||||
|
@ -90,7 +90,7 @@ void ClangDocCommentVisitor::parseComment(const comments::Comment *C) {
|
||||
ConstCommentVisitor<ClangDocCommentVisitor>::visit(C);
|
||||
for (comments::Comment *Child :
|
||||
llvm::make_range(C->child_begin(), C->child_end())) {
|
||||
CurrentCI.Children.emplace_back(llvm::make_unique<CommentInfo>());
|
||||
CurrentCI.Children.emplace_back(std::make_unique<CommentInfo>());
|
||||
ClangDocCommentVisitor Visitor(*CurrentCI.Children.back());
|
||||
Visitor.parseComment(Child);
|
||||
}
|
||||
@ -379,7 +379,7 @@ static void populateFunctionInfo(FunctionInfo &I, const FunctionDecl *D,
|
||||
std::pair<std::unique_ptr<Info>, std::unique_ptr<Info>>
|
||||
emitInfo(const NamespaceDecl *D, const FullComment *FC, int LineNumber,
|
||||
llvm::StringRef File, bool IsFileInRootDir, bool PublicOnly) {
|
||||
auto I = llvm::make_unique<NamespaceInfo>();
|
||||
auto I = std::make_unique<NamespaceInfo>();
|
||||
bool IsInAnonymousNamespace = false;
|
||||
populateInfo(*I, D, FC, IsInAnonymousNamespace);
|
||||
if (PublicOnly && ((IsInAnonymousNamespace || D->isAnonymousNamespace()) ||
|
||||
@ -392,7 +392,7 @@ emitInfo(const NamespaceDecl *D, const FullComment *FC, int LineNumber,
|
||||
if (I->Namespace.empty() && I->USR == SymbolID())
|
||||
return {std::unique_ptr<Info>{std::move(I)}, nullptr};
|
||||
|
||||
auto ParentI = llvm::make_unique<NamespaceInfo>();
|
||||
auto ParentI = std::make_unique<NamespaceInfo>();
|
||||
ParentI->USR = I->Namespace.empty() ? SymbolID() : I->Namespace[0].USR;
|
||||
ParentI->ChildNamespaces.emplace_back(I->USR, I->Name, InfoType::IT_namespace,
|
||||
getInfoRelativePath(I->Namespace));
|
||||
@ -405,7 +405,7 @@ emitInfo(const NamespaceDecl *D, const FullComment *FC, int LineNumber,
|
||||
std::pair<std::unique_ptr<Info>, std::unique_ptr<Info>>
|
||||
emitInfo(const RecordDecl *D, const FullComment *FC, int LineNumber,
|
||||
llvm::StringRef File, bool IsFileInRootDir, bool PublicOnly) {
|
||||
auto I = llvm::make_unique<RecordInfo>();
|
||||
auto I = std::make_unique<RecordInfo>();
|
||||
bool IsInAnonymousNamespace = false;
|
||||
populateSymbolInfo(*I, D, FC, LineNumber, File, IsFileInRootDir,
|
||||
IsInAnonymousNamespace);
|
||||
@ -425,7 +425,7 @@ emitInfo(const RecordDecl *D, const FullComment *FC, int LineNumber,
|
||||
I->Path = getInfoRelativePath(I->Namespace);
|
||||
|
||||
if (I->Namespace.empty()) {
|
||||
auto ParentI = llvm::make_unique<NamespaceInfo>();
|
||||
auto ParentI = std::make_unique<NamespaceInfo>();
|
||||
ParentI->USR = SymbolID();
|
||||
ParentI->ChildRecords.emplace_back(I->USR, I->Name, InfoType::IT_record,
|
||||
getInfoRelativePath(I->Namespace));
|
||||
@ -436,7 +436,7 @@ emitInfo(const RecordDecl *D, const FullComment *FC, int LineNumber,
|
||||
|
||||
switch (I->Namespace[0].RefType) {
|
||||
case InfoType::IT_namespace: {
|
||||
auto ParentI = llvm::make_unique<NamespaceInfo>();
|
||||
auto ParentI = std::make_unique<NamespaceInfo>();
|
||||
ParentI->USR = I->Namespace[0].USR;
|
||||
ParentI->ChildRecords.emplace_back(I->USR, I->Name, InfoType::IT_record,
|
||||
getInfoRelativePath(I->Namespace));
|
||||
@ -444,7 +444,7 @@ emitInfo(const RecordDecl *D, const FullComment *FC, int LineNumber,
|
||||
std::unique_ptr<Info>{std::move(ParentI)}};
|
||||
}
|
||||
case InfoType::IT_record: {
|
||||
auto ParentI = llvm::make_unique<RecordInfo>();
|
||||
auto ParentI = std::make_unique<RecordInfo>();
|
||||
ParentI->USR = I->Namespace[0].USR;
|
||||
ParentI->ChildRecords.emplace_back(I->USR, I->Name, InfoType::IT_record,
|
||||
getInfoRelativePath(I->Namespace));
|
||||
@ -470,7 +470,7 @@ emitInfo(const FunctionDecl *D, const FullComment *FC, int LineNumber,
|
||||
Func.Access = clang::AccessSpecifier::AS_none;
|
||||
|
||||
// Wrap in enclosing scope
|
||||
auto ParentI = llvm::make_unique<NamespaceInfo>();
|
||||
auto ParentI = std::make_unique<NamespaceInfo>();
|
||||
if (!Func.Namespace.empty())
|
||||
ParentI->USR = Func.Namespace[0].USR;
|
||||
else
|
||||
@ -508,7 +508,7 @@ emitInfo(const CXXMethodDecl *D, const FullComment *FC, int LineNumber,
|
||||
Func.Access = D->getAccess();
|
||||
|
||||
// Wrap in enclosing scope
|
||||
auto ParentI = llvm::make_unique<RecordInfo>();
|
||||
auto ParentI = std::make_unique<RecordInfo>();
|
||||
ParentI->USR = ParentUSR;
|
||||
if (Func.Namespace.empty())
|
||||
ParentI->Path = getInfoRelativePath(ParentI->Namespace);
|
||||
@ -533,7 +533,7 @@ emitInfo(const EnumDecl *D, const FullComment *FC, int LineNumber,
|
||||
|
||||
// Put in global namespace
|
||||
if (Enum.Namespace.empty()) {
|
||||
auto ParentI = llvm::make_unique<NamespaceInfo>();
|
||||
auto ParentI = std::make_unique<NamespaceInfo>();
|
||||
ParentI->USR = SymbolID();
|
||||
ParentI->ChildEnums.emplace_back(std::move(Enum));
|
||||
ParentI->Path = getInfoRelativePath(ParentI->Namespace);
|
||||
@ -545,7 +545,7 @@ emitInfo(const EnumDecl *D, const FullComment *FC, int LineNumber,
|
||||
// Wrap in enclosing scope
|
||||
switch (Enum.Namespace[0].RefType) {
|
||||
case InfoType::IT_namespace: {
|
||||
auto ParentI = llvm::make_unique<NamespaceInfo>();
|
||||
auto ParentI = std::make_unique<NamespaceInfo>();
|
||||
ParentI->USR = Enum.Namespace[0].USR;
|
||||
ParentI->ChildEnums.emplace_back(std::move(Enum));
|
||||
// Info is wrapped in its parent scope so it's returned in the second
|
||||
@ -553,7 +553,7 @@ emitInfo(const EnumDecl *D, const FullComment *FC, int LineNumber,
|
||||
return {nullptr, std::unique_ptr<Info>{std::move(ParentI)}};
|
||||
}
|
||||
case InfoType::IT_record: {
|
||||
auto ParentI = llvm::make_unique<RecordInfo>();
|
||||
auto ParentI = std::make_unique<RecordInfo>();
|
||||
ParentI->USR = Enum.Namespace[0].USR;
|
||||
ParentI->ChildEnums.emplace_back(std::move(Enum));
|
||||
// Info is wrapped in its parent scope so it's returned in the second
|
||||
|
@ -134,7 +134,7 @@ FuzzySymbolIndex::createFromYAML(StringRef FilePath) {
|
||||
auto Buffer = llvm::MemoryBuffer::getFile(FilePath);
|
||||
if (!Buffer)
|
||||
return llvm::errorCodeToError(Buffer.getError());
|
||||
return llvm::make_unique<MemSymbolIndex>(
|
||||
return std::make_unique<MemSymbolIndex>(
|
||||
find_all_symbols::ReadSymbolInfosFromYAML(Buffer.get()->getBuffer()));
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ public:
|
||||
CreateASTConsumer(clang::CompilerInstance &Compiler,
|
||||
StringRef InFile) override {
|
||||
SemaSource.setFilePath(InFile);
|
||||
return llvm::make_unique<clang::ASTConsumer>();
|
||||
return std::make_unique<clang::ASTConsumer>();
|
||||
}
|
||||
|
||||
void ExecuteAction() override {
|
||||
@ -104,7 +104,7 @@ bool IncludeFixerActionFactory::runInvocation(
|
||||
|
||||
// Run the parser, gather missing includes.
|
||||
auto ScopedToolAction =
|
||||
llvm::make_unique<Action>(SymbolIndexMgr, MinimizeIncludePaths);
|
||||
std::make_unique<Action>(SymbolIndexMgr, MinimizeIncludePaths);
|
||||
Compiler.ExecuteAction(*ScopedToolAction);
|
||||
|
||||
Contexts.push_back(ScopedToolAction->getIncludeFixerContext(
|
||||
|
@ -27,7 +27,7 @@ std::unique_ptr<ASTConsumer>
|
||||
FindAllSymbolsAction::CreateASTConsumer(CompilerInstance &Compiler,
|
||||
StringRef InFile) {
|
||||
Compiler.getPreprocessor().addCommentHandler(&Handler);
|
||||
Compiler.getPreprocessor().addPPCallbacks(llvm::make_unique<FindAllMacros>(
|
||||
Compiler.getPreprocessor().addPPCallbacks(std::make_unique<FindAllMacros>(
|
||||
Reporter, &Compiler.getSourceManager(), &Collector));
|
||||
return MatchFinder.newASTConsumer();
|
||||
}
|
||||
|
@ -145,7 +145,7 @@ int main(int argc, const char **argv) {
|
||||
clang::find_all_symbols::YamlReporter Reporter;
|
||||
|
||||
auto Factory =
|
||||
llvm::make_unique<clang::find_all_symbols::FindAllSymbolsActionFactory>(
|
||||
std::make_unique<clang::find_all_symbols::FindAllSymbolsActionFactory>(
|
||||
&Reporter, clang::find_all_symbols::getSTLPostfixHeaderMap());
|
||||
return Tool.run(Factory.get());
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ public:
|
||||
CI.setExternalSemaSource(SemaSource);
|
||||
SemaSource->setFilePath(InFile);
|
||||
SemaSource->setCompilerInstance(&CI);
|
||||
return llvm::make_unique<ASTConsumerManagerWrapper>(SymbolIndexMgr);
|
||||
return std::make_unique<ASTConsumerManagerWrapper>(SymbolIndexMgr);
|
||||
}
|
||||
|
||||
void ExecuteAction() override {} // Do nothing.
|
||||
|
@ -161,7 +161,7 @@ std::unique_ptr<include_fixer::SymbolIndexManager>
|
||||
createSymbolIndexManager(StringRef FilePath) {
|
||||
using find_all_symbols::SymbolInfo;
|
||||
|
||||
auto SymbolIndexMgr = llvm::make_unique<include_fixer::SymbolIndexManager>();
|
||||
auto SymbolIndexMgr = std::make_unique<include_fixer::SymbolIndexManager>();
|
||||
switch (DatabaseFormat) {
|
||||
case fixed: {
|
||||
// Parse input and fill the database with it.
|
||||
@ -185,7 +185,7 @@ createSymbolIndexManager(StringRef FilePath) {
|
||||
/*Used=*/0)});
|
||||
}
|
||||
SymbolIndexMgr->addSymbolIndex([=]() {
|
||||
return llvm::make_unique<include_fixer::InMemorySymbolIndex>(Symbols);
|
||||
return std::make_unique<include_fixer::InMemorySymbolIndex>(Symbols);
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ CallGraphNode *HelperDeclRefGraph::getOrInsertNode(Decl *F) {
|
||||
if (Node)
|
||||
return Node.get();
|
||||
|
||||
Node = llvm::make_unique<CallGraphNode>(F);
|
||||
Node = std::make_unique<CallGraphNode>(F);
|
||||
return Node.get();
|
||||
}
|
||||
|
||||
|
@ -476,7 +476,7 @@ getUsedDecls(const HelperDeclRefGraph *RG,
|
||||
std::unique_ptr<ASTConsumer>
|
||||
ClangMoveAction::CreateASTConsumer(CompilerInstance &Compiler,
|
||||
StringRef /*InFile*/) {
|
||||
Compiler.getPreprocessor().addPPCallbacks(llvm::make_unique<FindAllIncludes>(
|
||||
Compiler.getPreprocessor().addPPCallbacks(std::make_unique<FindAllIncludes>(
|
||||
&Compiler.getSourceManager(), &MoveTool));
|
||||
return MatchFinder.newASTConsumer();
|
||||
}
|
||||
@ -610,7 +610,7 @@ void ClangMoveTool::registerMatchers(ast_matchers::MatchFinder *Finder) {
|
||||
// Matchers for old files, including old.h/old.cc
|
||||
//============================================================================
|
||||
// Create a MatchCallback for class declarations.
|
||||
MatchCallbacks.push_back(llvm::make_unique<ClassDeclarationMatch>(this));
|
||||
MatchCallbacks.push_back(std::make_unique<ClassDeclarationMatch>(this));
|
||||
// Match moved class declarations.
|
||||
auto MovedClass = cxxRecordDecl(InOldFiles, *HasAnySymbolNames,
|
||||
isDefinition(), TopLevelDecl)
|
||||
@ -629,19 +629,19 @@ void ClangMoveTool::registerMatchers(ast_matchers::MatchFinder *Finder) {
|
||||
.bind("class_static_var_decl"),
|
||||
MatchCallbacks.back().get());
|
||||
|
||||
MatchCallbacks.push_back(llvm::make_unique<FunctionDeclarationMatch>(this));
|
||||
MatchCallbacks.push_back(std::make_unique<FunctionDeclarationMatch>(this));
|
||||
Finder->addMatcher(functionDecl(InOldFiles, *HasAnySymbolNames, TopLevelDecl)
|
||||
.bind("function"),
|
||||
MatchCallbacks.back().get());
|
||||
|
||||
MatchCallbacks.push_back(llvm::make_unique<VarDeclarationMatch>(this));
|
||||
MatchCallbacks.push_back(std::make_unique<VarDeclarationMatch>(this));
|
||||
Finder->addMatcher(
|
||||
varDecl(InOldFiles, *HasAnySymbolNames, TopLevelDecl).bind("var"),
|
||||
MatchCallbacks.back().get());
|
||||
|
||||
// Match enum definition in old.h. Enum helpers (which are defined in old.cc)
|
||||
// will not be moved for now no matter whether they are used or not.
|
||||
MatchCallbacks.push_back(llvm::make_unique<EnumDeclarationMatch>(this));
|
||||
MatchCallbacks.push_back(std::make_unique<EnumDeclarationMatch>(this));
|
||||
Finder->addMatcher(
|
||||
enumDecl(InOldHeader, *HasAnySymbolNames, isDefinition(), TopLevelDecl)
|
||||
.bind("enum"),
|
||||
@ -650,7 +650,7 @@ void ClangMoveTool::registerMatchers(ast_matchers::MatchFinder *Finder) {
|
||||
// Match type alias in old.h, this includes "typedef" and "using" type alias
|
||||
// declarations. Type alias helpers (which are defined in old.cc) will not be
|
||||
// moved for now no matter whether they are used or not.
|
||||
MatchCallbacks.push_back(llvm::make_unique<TypeAliasMatch>(this));
|
||||
MatchCallbacks.push_back(std::make_unique<TypeAliasMatch>(this));
|
||||
Finder->addMatcher(namedDecl(anyOf(typedefDecl().bind("typedef"),
|
||||
typeAliasDecl().bind("type_alias")),
|
||||
InOldHeader, *HasAnySymbolNames, TopLevelDecl),
|
||||
|
@ -302,7 +302,7 @@ public:
|
||||
} // end anonymous namespace
|
||||
|
||||
std::unique_ptr<ASTConsumer> ReorderFieldsAction::newASTConsumer() {
|
||||
return llvm::make_unique<ReorderingConsumer>(RecordName, DesiredFieldsOrder,
|
||||
return std::make_unique<ReorderingConsumer>(RecordName, DesiredFieldsOrder,
|
||||
Replacements);
|
||||
}
|
||||
|
||||
|
@ -390,7 +390,7 @@ ClangTidyASTConsumerFactory::CreateASTConsumer(
|
||||
|
||||
std::unique_ptr<ClangTidyProfiling> Profiling;
|
||||
if (Context.getEnableProfiling()) {
|
||||
Profiling = llvm::make_unique<ClangTidyProfiling>(
|
||||
Profiling = std::make_unique<ClangTidyProfiling>(
|
||||
Context.getProfileStorageParams());
|
||||
FinderOptions.CheckProfiling.emplace(Profiling->Records);
|
||||
}
|
||||
@ -402,7 +402,7 @@ ClangTidyASTConsumerFactory::CreateASTConsumer(
|
||||
Preprocessor *ModuleExpanderPP = PP;
|
||||
|
||||
if (Context.getLangOpts().Modules && OverlayFS != nullptr) {
|
||||
auto ModuleExpander = llvm::make_unique<ExpandModularHeadersPPCallbacks>(
|
||||
auto ModuleExpander = std::make_unique<ExpandModularHeadersPPCallbacks>(
|
||||
&Compiler, OverlayFS);
|
||||
ModuleExpanderPP = ModuleExpander->getPreprocessor();
|
||||
PP->addPPCallbacks(std::move(ModuleExpander));
|
||||
@ -434,7 +434,7 @@ ClangTidyASTConsumerFactory::CreateASTConsumer(
|
||||
Consumers.push_back(std::move(AnalysisConsumer));
|
||||
}
|
||||
#endif // CLANG_ENABLE_STATIC_ANALYZER
|
||||
return llvm::make_unique<ClangTidyASTConsumer>(
|
||||
return std::make_unique<ClangTidyASTConsumer>(
|
||||
std::move(Consumers), std::move(Profiling), std::move(Finder),
|
||||
std::move(Checks));
|
||||
}
|
||||
@ -469,7 +469,7 @@ std::vector<std::string>
|
||||
getCheckNames(const ClangTidyOptions &Options,
|
||||
bool AllowEnablingAnalyzerAlphaCheckers) {
|
||||
clang::tidy::ClangTidyContext Context(
|
||||
llvm::make_unique<DefaultOptionsProvider>(ClangTidyGlobalOptions(),
|
||||
std::make_unique<DefaultOptionsProvider>(ClangTidyGlobalOptions(),
|
||||
Options),
|
||||
AllowEnablingAnalyzerAlphaCheckers);
|
||||
ClangTidyASTConsumerFactory Factory(Context);
|
||||
@ -480,7 +480,7 @@ ClangTidyOptions::OptionMap
|
||||
getCheckOptions(const ClangTidyOptions &Options,
|
||||
bool AllowEnablingAnalyzerAlphaCheckers) {
|
||||
clang::tidy::ClangTidyContext Context(
|
||||
llvm::make_unique<DefaultOptionsProvider>(ClangTidyGlobalOptions(),
|
||||
std::make_unique<DefaultOptionsProvider>(ClangTidyGlobalOptions(),
|
||||
Options),
|
||||
AllowEnablingAnalyzerAlphaCheckers);
|
||||
ClangTidyASTConsumerFactory Factory(Context);
|
||||
|
@ -213,9 +213,9 @@ void ClangTidyContext::setSourceManager(SourceManager *SourceMgr) {
|
||||
void ClangTidyContext::setCurrentFile(StringRef File) {
|
||||
CurrentFile = File;
|
||||
CurrentOptions = getOptionsForFile(CurrentFile);
|
||||
CheckFilter = llvm::make_unique<CachedGlobList>(*getOptions().Checks);
|
||||
CheckFilter = std::make_unique<CachedGlobList>(*getOptions().Checks);
|
||||
WarningAsErrorFilter =
|
||||
llvm::make_unique<CachedGlobList>(*getOptions().WarningsAsErrors);
|
||||
std::make_unique<CachedGlobList>(*getOptions().WarningsAsErrors);
|
||||
}
|
||||
|
||||
void ClangTidyContext::setASTContext(ASTContext *Context) {
|
||||
@ -604,7 +604,7 @@ void ClangTidyDiagnosticConsumer::checkFilters(SourceLocation Location,
|
||||
llvm::Regex *ClangTidyDiagnosticConsumer::getHeaderFilter() {
|
||||
if (!HeaderFilter)
|
||||
HeaderFilter =
|
||||
llvm::make_unique<llvm::Regex>(*Context.getOptions().HeaderFilterRegex);
|
||||
std::make_unique<llvm::Regex>(*Context.getOptions().HeaderFilterRegex);
|
||||
return HeaderFilter.get();
|
||||
}
|
||||
|
||||
|
@ -199,7 +199,7 @@ public:
|
||||
/// FileOptionsProvider::ConfigFileHandlers ConfigHandlers;
|
||||
/// ConfigHandlers.emplace_back(".my-tidy-config", parseMyConfigFormat);
|
||||
/// ConfigHandlers.emplace_back(".clang-tidy", parseConfiguration);
|
||||
/// return llvm::make_unique<FileOptionsProvider>(
|
||||
/// return std::make_unique<FileOptionsProvider>(
|
||||
/// GlobalOptions, DefaultOptions, OverrideOptions, ConfigHandlers);
|
||||
/// \endcode
|
||||
///
|
||||
|
@ -54,7 +54,7 @@ private:
|
||||
ExpandModularHeadersPPCallbacks::ExpandModularHeadersPPCallbacks(
|
||||
CompilerInstance *CI,
|
||||
IntrusiveRefCntPtr<llvm::vfs::OverlayFileSystem> OverlayFS)
|
||||
: Recorder(llvm::make_unique<FileRecorder>()), Compiler(*CI),
|
||||
: Recorder(std::make_unique<FileRecorder>()), Compiler(*CI),
|
||||
InMemoryFs(new llvm::vfs::InMemoryFileSystem),
|
||||
Sources(Compiler.getSourceManager()),
|
||||
// Forward the new diagnostics to the original DiagnosticConsumer.
|
||||
@ -72,13 +72,13 @@ ExpandModularHeadersPPCallbacks::ExpandModularHeadersPPCallbacks(
|
||||
auto HSO = std::make_shared<HeaderSearchOptions>();
|
||||
*HSO = Compiler.getHeaderSearchOpts();
|
||||
|
||||
HeaderInfo = llvm::make_unique<HeaderSearch>(HSO, Sources, Diags, LangOpts,
|
||||
HeaderInfo = std::make_unique<HeaderSearch>(HSO, Sources, Diags, LangOpts,
|
||||
&Compiler.getTarget());
|
||||
|
||||
auto PO = std::make_shared<PreprocessorOptions>();
|
||||
*PO = Compiler.getPreprocessorOpts();
|
||||
|
||||
PP = llvm::make_unique<clang::Preprocessor>(PO, Diags, LangOpts, Sources,
|
||||
PP = std::make_unique<clang::Preprocessor>(PO, Diags, LangOpts, Sources,
|
||||
*HeaderInfo, ModuleLoader,
|
||||
/*IILookup=*/nullptr,
|
||||
/*OwnsHeaderSearch=*/false);
|
||||
|
@ -115,7 +115,7 @@ void StringFindStartswithCheck::check(const MatchFinder::MatchResult &Result) {
|
||||
|
||||
void StringFindStartswithCheck::registerPPCallbacks(
|
||||
const SourceManager &SM, Preprocessor *PP, Preprocessor *ModuleExpanderPP) {
|
||||
IncludeInserter = llvm::make_unique<utils::IncludeInserter>(SM, getLangOpts(),
|
||||
IncludeInserter = std::make_unique<utils::IncludeInserter>(SM, getLangOpts(),
|
||||
IncludeStyle);
|
||||
PP->addPPCallbacks(IncludeInserter->CreatePPCallbacks());
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ void LambdaFunctionNameCheck::registerMatchers(MatchFinder *Finder) {
|
||||
|
||||
void LambdaFunctionNameCheck::registerPPCallbacks(
|
||||
const SourceManager &SM, Preprocessor *PP, Preprocessor *ModuleExpanderPP) {
|
||||
PP->addPPCallbacks(llvm::make_unique<MacroExpansionsWithFileAndLine>(
|
||||
PP->addPPCallbacks(std::make_unique<MacroExpansionsWithFileAndLine>(
|
||||
&SuppressMacroExpansions));
|
||||
}
|
||||
|
||||
|
@ -250,7 +250,7 @@ void MacroParenthesesPPCallbacks::argument(const Token &MacroNameTok,
|
||||
|
||||
void MacroParenthesesCheck::registerPPCallbacks(
|
||||
const SourceManager &SM, Preprocessor *PP, Preprocessor *ModuleExpanderPP) {
|
||||
PP->addPPCallbacks(llvm::make_unique<MacroParenthesesPPCallbacks>(PP, this));
|
||||
PP->addPPCallbacks(std::make_unique<MacroParenthesesPPCallbacks>(PP, this));
|
||||
}
|
||||
|
||||
} // namespace bugprone
|
||||
|
@ -173,7 +173,7 @@ bool MacroRepeatedPPCallbacks::hasSideEffects(
|
||||
|
||||
void MacroRepeatedSideEffectsCheck::registerPPCallbacks(
|
||||
const SourceManager &SM, Preprocessor *PP, Preprocessor *ModuleExpanderPP) {
|
||||
PP->addPPCallbacks(::llvm::make_unique<MacroRepeatedPPCallbacks>(*this, *PP));
|
||||
PP->addPPCallbacks(::std::make_unique<MacroRepeatedPPCallbacks>(*this, *PP));
|
||||
}
|
||||
|
||||
} // namespace bugprone
|
||||
|
@ -102,8 +102,8 @@ bool UseAfterMoveFinder::find(Stmt *FunctionBody, const Expr *MovingCall,
|
||||
return false;
|
||||
|
||||
Sequence =
|
||||
llvm::make_unique<ExprSequence>(TheCFG.get(), FunctionBody, Context);
|
||||
BlockMap = llvm::make_unique<StmtToBlockMap>(TheCFG.get(), Context);
|
||||
std::make_unique<ExprSequence>(TheCFG.get(), FunctionBody, Context);
|
||||
BlockMap = std::make_unique<StmtToBlockMap>(TheCFG.get(), Context);
|
||||
Visited.clear();
|
||||
|
||||
const CFGBlock *Block = BlockMap->blockContainingStmt(MovingCall);
|
||||
|
@ -51,7 +51,7 @@ void SetLongJmpCheck::registerPPCallbacks(const SourceManager &SM,
|
||||
|
||||
// Per [headers]p5, setjmp must be exposed as a macro instead of a function,
|
||||
// despite the allowance in C for setjmp to also be an extern function.
|
||||
PP->addPPCallbacks(llvm::make_unique<SetJmpMacroCallbacks>(*this));
|
||||
PP->addPPCallbacks(std::make_unique<SetJmpMacroCallbacks>(*this));
|
||||
}
|
||||
|
||||
void SetLongJmpCheck::registerMatchers(MatchFinder *Finder) {
|
||||
|
@ -74,7 +74,7 @@ void MacroUsageCheck::registerPPCallbacks(const SourceManager &SM,
|
||||
if (!getLangOpts().CPlusPlus11)
|
||||
return;
|
||||
|
||||
PP->addPPCallbacks(llvm::make_unique<MacroUsageCallbacks>(
|
||||
PP->addPPCallbacks(std::make_unique<MacroUsageCallbacks>(
|
||||
this, SM, AllowedRegexp, CheckCapsOnly, IgnoreCommandLineMacros));
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@ void ProBoundsConstantArrayIndexCheck::registerPPCallbacks(
|
||||
if (!getLangOpts().CPlusPlus)
|
||||
return;
|
||||
|
||||
Inserter = llvm::make_unique<utils::IncludeInserter>(SM, getLangOpts(),
|
||||
Inserter = std::make_unique<utils::IncludeInserter>(SM, getLangOpts(),
|
||||
IncludeStyle);
|
||||
PP->addPPCallbacks(Inserter->CreatePPCallbacks());
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ void RestrictedIncludesPPCallbacks::EndOfMainFile() {
|
||||
void RestrictSystemIncludesCheck::registerPPCallbacks(
|
||||
const SourceManager &SM, Preprocessor *PP, Preprocessor *ModuleExpanderPP) {
|
||||
PP->addPPCallbacks(
|
||||
llvm::make_unique<RestrictedIncludesPPCallbacks>(*this, SM));
|
||||
std::make_unique<RestrictedIncludesPPCallbacks>(*this, SM));
|
||||
}
|
||||
|
||||
void RestrictSystemIncludesCheck::storeOptions(
|
||||
|
@ -79,7 +79,7 @@ private:
|
||||
void AvoidUnderscoreInGoogletestNameCheck::registerPPCallbacks(
|
||||
const SourceManager &SM, Preprocessor *PP, Preprocessor *ModuleExpanderPP) {
|
||||
PP->addPPCallbacks(
|
||||
llvm::make_unique<AvoidUnderscoreInGoogletestNameCallback>(PP, this));
|
||||
std::make_unique<AvoidUnderscoreInGoogletestNameCallback>(PP, this));
|
||||
}
|
||||
|
||||
} // namespace readability
|
||||
|
@ -68,7 +68,7 @@ void IntegerTypesCheck::registerMatchers(MatchFinder *Finder) {
|
||||
callee(functionDecl(hasAttr(attr::Format)))))))
|
||||
.bind("tl"),
|
||||
this);
|
||||
IdentTable = llvm::make_unique<IdentifierTable>(getLangOpts());
|
||||
IdentTable = std::make_unique<IdentifierTable>(getLangOpts());
|
||||
}
|
||||
|
||||
void IntegerTypesCheck::check(const MatchFinder::MatchResult &Result) {
|
||||
|
@ -52,7 +52,7 @@ private:
|
||||
|
||||
TodoCommentCheck::TodoCommentCheck(StringRef Name, ClangTidyContext *Context)
|
||||
: ClangTidyCheck(Name, Context),
|
||||
Handler(llvm::make_unique<TodoCommentHandler>(
|
||||
Handler(std::make_unique<TodoCommentHandler>(
|
||||
*this, Context->getOptions().User)) {}
|
||||
|
||||
void TodoCommentCheck::registerPPCallbacks(const SourceManager &SM,
|
||||
|
@ -125,7 +125,7 @@ void UpgradeGoogletestCaseCheck::registerPPCallbacks(const SourceManager &,
|
||||
return;
|
||||
|
||||
PP->addPPCallbacks(
|
||||
llvm::make_unique<UpgradeGoogletestCasePPCallback>(this, PP));
|
||||
std::make_unique<UpgradeGoogletestCasePPCallback>(this, PP));
|
||||
}
|
||||
|
||||
void UpgradeGoogletestCaseCheck::registerMatchers(MatchFinder *Finder) {
|
||||
|
@ -53,7 +53,7 @@ private:
|
||||
void IncludeOrderCheck::registerPPCallbacks(const SourceManager &SM,
|
||||
Preprocessor *PP,
|
||||
Preprocessor *ModuleExpanderPP) {
|
||||
PP->addPPCallbacks(::llvm::make_unique<IncludeOrderPPCallbacks>(*this, SM));
|
||||
PP->addPPCallbacks(::std::make_unique<IncludeOrderPPCallbacks>(*this, SM));
|
||||
}
|
||||
|
||||
static int getPriority(StringRef Filename, bool IsAngled, bool IsMainModule) {
|
||||
|
@ -135,7 +135,7 @@ void UnusedParametersCheck::warnOnUnusedParameter(
|
||||
auto MyDiag = diag(Param->getLocation(), "parameter %0 is unused") << Param;
|
||||
|
||||
if (!Indexer) {
|
||||
Indexer = llvm::make_unique<IndexerVisitor>(*Result.Context);
|
||||
Indexer = std::make_unique<IndexerVisitor>(*Result.Context);
|
||||
}
|
||||
|
||||
// Cannot remove parameter for non-local functions.
|
||||
|
@ -44,7 +44,7 @@ void DeprecatedHeadersCheck::registerPPCallbacks(
|
||||
const SourceManager &SM, Preprocessor *PP, Preprocessor *ModuleExpanderPP) {
|
||||
if (getLangOpts().CPlusPlus) {
|
||||
PP->addPPCallbacks(
|
||||
::llvm::make_unique<IncludeModernizePPCallbacks>(*this, getLangOpts()));
|
||||
::std::make_unique<IncludeModernizePPCallbacks>(*this, getLangOpts()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@ void MakeSmartPtrCheck::registerPPCallbacks(const SourceManager &SM,
|
||||
Preprocessor *PP,
|
||||
Preprocessor *ModuleExpanderPP) {
|
||||
if (isLanguageVersionSupported(getLangOpts())) {
|
||||
Inserter = llvm::make_unique<utils::IncludeInserter>(SM, getLangOpts(),
|
||||
Inserter = std::make_unique<utils::IncludeInserter>(SM, getLangOpts(),
|
||||
IncludeStyle);
|
||||
PP->addPPCallbacks(Inserter->CreatePPCallbacks());
|
||||
}
|
||||
@ -128,7 +128,7 @@ void MakeSmartPtrCheck::check(const MatchFinder::MatchResult &Result) {
|
||||
// Be conservative for cases where we construct an array without any
|
||||
// initalization.
|
||||
// For example,
|
||||
// P.reset(new int[5]) // check fix: P = make_unique<int []>(5)
|
||||
// P.reset(new int[5]) // check fix: P = std::make_unique<int []>(5)
|
||||
//
|
||||
// The fix of the check has side effect, it introduces default initialization
|
||||
// which maybe unexpected and cause performance regression.
|
||||
|
@ -171,7 +171,7 @@ void PassByValueCheck::registerPPCallbacks(const SourceManager &SM,
|
||||
// currently does not provide any benefit to other languages, despite being
|
||||
// benign.
|
||||
if (getLangOpts().CPlusPlus) {
|
||||
Inserter = llvm::make_unique<utils::IncludeInserter>(SM, getLangOpts(),
|
||||
Inserter = std::make_unique<utils::IncludeInserter>(SM, getLangOpts(),
|
||||
IncludeStyle);
|
||||
PP->addPPCallbacks(Inserter->CreatePPCallbacks());
|
||||
}
|
||||
|
@ -140,7 +140,7 @@ void ReplaceAutoPtrCheck::registerPPCallbacks(const SourceManager &SM,
|
||||
// benign.
|
||||
if (!getLangOpts().CPlusPlus)
|
||||
return;
|
||||
Inserter = llvm::make_unique<utils::IncludeInserter>(SM, getLangOpts(),
|
||||
Inserter = std::make_unique<utils::IncludeInserter>(SM, getLangOpts(),
|
||||
IncludeStyle);
|
||||
PP->addPPCallbacks(Inserter->CreatePPCallbacks());
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ void ReplaceRandomShuffleCheck::registerMatchers(MatchFinder *Finder) {
|
||||
|
||||
void ReplaceRandomShuffleCheck::registerPPCallbacks(
|
||||
const SourceManager &SM, Preprocessor *PP, Preprocessor *ModuleExpanderPP) {
|
||||
IncludeInserter = llvm::make_unique<utils::IncludeInserter>(SM, getLangOpts(),
|
||||
IncludeInserter = std::make_unique<utils::IncludeInserter>(SM, getLangOpts(),
|
||||
IncludeStyle);
|
||||
PP->addPPCallbacks(IncludeInserter->CreatePPCallbacks());
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ void MoveConstructorInitCheck::check(const MatchFinder::MatchResult &Result) {
|
||||
|
||||
void MoveConstructorInitCheck::registerPPCallbacks(
|
||||
const SourceManager &SM, Preprocessor *PP, Preprocessor *ModuleExpanderPP) {
|
||||
Inserter = llvm::make_unique<utils::IncludeInserter>(SM, getLangOpts(),
|
||||
Inserter = std::make_unique<utils::IncludeInserter>(SM, getLangOpts(),
|
||||
IncludeStyle);
|
||||
PP->addPPCallbacks(Inserter->CreatePPCallbacks());
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ TypePromotionInMathFnCheck::TypePromotionInMathFnCheck(
|
||||
|
||||
void TypePromotionInMathFnCheck::registerPPCallbacks(
|
||||
const SourceManager &SM, Preprocessor *PP, Preprocessor *ModuleExpanderPP) {
|
||||
IncludeInserter = llvm::make_unique<utils::IncludeInserter>(SM, getLangOpts(),
|
||||
IncludeInserter = std::make_unique<utils::IncludeInserter>(SM, getLangOpts(),
|
||||
IncludeStyle);
|
||||
PP->addPPCallbacks(IncludeInserter->CreatePPCallbacks());
|
||||
}
|
||||
|
@ -169,7 +169,7 @@ void UnnecessaryValueParamCheck::check(const MatchFinder::MatchResult &Result) {
|
||||
|
||||
void UnnecessaryValueParamCheck::registerPPCallbacks(
|
||||
const SourceManager &SM, Preprocessor *PP, Preprocessor *ModuleExpanderPP) {
|
||||
Inserter = llvm::make_unique<utils::IncludeInserter>(SM, getLangOpts(),
|
||||
Inserter = std::make_unique<utils::IncludeInserter>(SM, getLangOpts(),
|
||||
IncludeStyle);
|
||||
PP->addPPCallbacks(Inserter->CreatePPCallbacks());
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ public:
|
||||
auto ExternalDiagEngine = &Compiler.getDiagnostics();
|
||||
auto DiagConsumer =
|
||||
new ClangTidyDiagnosticConsumer(*Context, ExternalDiagEngine);
|
||||
auto DiagEngine = llvm::make_unique<DiagnosticsEngine>(
|
||||
auto DiagEngine = std::make_unique<DiagnosticsEngine>(
|
||||
new DiagnosticIDs, new DiagnosticOptions, DiagConsumer);
|
||||
Context->setDiagnosticsEngine(DiagEngine.get());
|
||||
|
||||
@ -51,7 +51,7 @@ public:
|
||||
std::vector<std::unique_ptr<ASTConsumer>> Vec;
|
||||
Vec.push_back(Factory.CreateASTConsumer(Compiler, File));
|
||||
|
||||
return llvm::make_unique<WrapConsumer>(
|
||||
return std::make_unique<WrapConsumer>(
|
||||
std::move(Context), std::move(DiagEngine), std::move(Vec));
|
||||
}
|
||||
|
||||
@ -67,9 +67,9 @@ public:
|
||||
if (Arg.startswith("-checks="))
|
||||
OverrideOptions.Checks = Arg.substr(strlen("-checks="));
|
||||
|
||||
auto Options = llvm::make_unique<FileOptionsProvider>(
|
||||
auto Options = std::make_unique<FileOptionsProvider>(
|
||||
GlobalOptions, DefaultOptions, OverrideOptions);
|
||||
Context = llvm::make_unique<ClangTidyContext>(std::move(Options));
|
||||
Context = std::make_unique<ClangTidyContext>(std::move(Options));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -243,7 +243,7 @@ void IdentifierNamingCheck::registerMatchers(MatchFinder *Finder) {
|
||||
void IdentifierNamingCheck::registerPPCallbacks(
|
||||
const SourceManager &SM, Preprocessor *PP, Preprocessor *ModuleExpanderPP) {
|
||||
ModuleExpanderPP->addPPCallbacks(
|
||||
llvm::make_unique<IdentifierNamingCheckPPCallbacks>(ModuleExpanderPP,
|
||||
std::make_unique<IdentifierNamingCheckPPCallbacks>(ModuleExpanderPP,
|
||||
this));
|
||||
}
|
||||
|
||||
|
@ -99,7 +99,7 @@ private:
|
||||
void RedundantPreprocessorCheck::registerPPCallbacks(
|
||||
const SourceManager &SM, Preprocessor *PP, Preprocessor *ModuleExpanderPP) {
|
||||
PP->addPPCallbacks(
|
||||
::llvm::make_unique<RedundantPreprocessorCallbacks>(*this, *PP));
|
||||
::std::make_unique<RedundantPreprocessorCallbacks>(*this, *PP));
|
||||
}
|
||||
|
||||
} // namespace readability
|
||||
|
@ -289,7 +289,7 @@ static std::unique_ptr<ClangTidyOptionsProvider> createOptionsProvider(
|
||||
if (!Config.empty()) {
|
||||
if (llvm::ErrorOr<ClangTidyOptions> ParsedConfig =
|
||||
parseConfiguration(Config)) {
|
||||
return llvm::make_unique<ConfigOptionsProvider>(
|
||||
return std::make_unique<ConfigOptionsProvider>(
|
||||
GlobalOptions,
|
||||
ClangTidyOptions::getDefaults().mergeWith(DefaultOptions),
|
||||
*ParsedConfig, OverrideOptions);
|
||||
@ -299,7 +299,7 @@ static std::unique_ptr<ClangTidyOptionsProvider> createOptionsProvider(
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
return llvm::make_unique<FileOptionsProvider>(GlobalOptions, DefaultOptions,
|
||||
return std::make_unique<FileOptionsProvider>(GlobalOptions, DefaultOptions,
|
||||
OverrideOptions, std::move(FS));
|
||||
}
|
||||
|
||||
|
@ -269,7 +269,7 @@ private:
|
||||
void HeaderGuardCheck::registerPPCallbacks(const SourceManager &SM,
|
||||
Preprocessor *PP,
|
||||
Preprocessor *ModuleExpanderPP) {
|
||||
PP->addPPCallbacks(llvm::make_unique<HeaderGuardPPCallbacks>(PP, this));
|
||||
PP->addPPCallbacks(std::make_unique<HeaderGuardPPCallbacks>(PP, this));
|
||||
}
|
||||
|
||||
bool HeaderGuardCheck::shouldSuggestEndifComment(StringRef FileName) {
|
||||
|
@ -42,7 +42,7 @@ IncludeInserter::IncludeInserter(const SourceManager &SourceMgr,
|
||||
IncludeInserter::~IncludeInserter() {}
|
||||
|
||||
std::unique_ptr<PPCallbacks> IncludeInserter::CreatePPCallbacks() {
|
||||
return llvm::make_unique<IncludeInserterCallback>(this);
|
||||
return std::make_unique<IncludeInserterCallback>(this);
|
||||
}
|
||||
|
||||
llvm::Optional<FixItHint>
|
||||
@ -58,7 +58,7 @@ IncludeInserter::CreateIncludeInsertion(FileID FileID, StringRef Header,
|
||||
// file.
|
||||
IncludeSorterByFile.insert(std::make_pair(
|
||||
FileID,
|
||||
llvm::make_unique<IncludeSorter>(
|
||||
std::make_unique<IncludeSorter>(
|
||||
&SourceMgr, &LangOpts, FileID,
|
||||
SourceMgr.getFilename(SourceMgr.getLocForStartOfFile(FileID)),
|
||||
Style)));
|
||||
@ -72,7 +72,7 @@ void IncludeInserter::AddInclude(StringRef FileName, bool IsAngled,
|
||||
FileID FileID = SourceMgr.getFileID(HashLocation);
|
||||
if (IncludeSorterByFile.find(FileID) == IncludeSorterByFile.end()) {
|
||||
IncludeSorterByFile.insert(std::make_pair(
|
||||
FileID, llvm::make_unique<IncludeSorter>(
|
||||
FileID, std::make_unique<IncludeSorter>(
|
||||
&SourceMgr, &LangOpts, FileID,
|
||||
SourceMgr.getFilename(HashLocation), Style)));
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ namespace utils {
|
||||
/// public:
|
||||
/// void registerPPCallbacks(const SourceManager &SM, Preprocessor *PP,
|
||||
/// Preprocessor *ModuleExpanderPP) override {
|
||||
/// Inserter = llvm::make_unique<IncludeInserter>(
|
||||
/// Inserter = std::make_unique<IncludeInserter>(
|
||||
/// SM, getLangOpts(), utils::IncludeSorter::IS_Google);
|
||||
/// PP->addPPCallbacks(Inserter->CreatePPCallbacks());
|
||||
/// }
|
||||
|
@ -53,7 +53,7 @@ void TransformerClangTidyCheck::registerPPCallbacks(
|
||||
if (Rule && llvm::any_of(Rule->Cases, [](const RewriteRule::Case &C) {
|
||||
return !C.AddedIncludes.empty();
|
||||
})) {
|
||||
Inserter = llvm::make_unique<IncludeInserter>(
|
||||
Inserter = std::make_unique<IncludeInserter>(
|
||||
SM, getLangOpts(), utils::IncludeSorter::IS_LLVM);
|
||||
PP->addPPCallbacks(Inserter->CreatePPCallbacks());
|
||||
}
|
||||
|
@ -426,7 +426,7 @@ void ClangdLSPServer::onInitialize(const InitializeParams &Params,
|
||||
if (const auto &Dir = Params.initializationOptions.compilationDatabasePath)
|
||||
CompileCommandsDir = Dir;
|
||||
if (UseDirBasedCDB) {
|
||||
BaseCDB = llvm::make_unique<DirectoryBasedGlobalCompilationDatabase>(
|
||||
BaseCDB = std::make_unique<DirectoryBasedGlobalCompilationDatabase>(
|
||||
CompileCommandsDir);
|
||||
BaseCDB = getQueryDriverDatabase(
|
||||
llvm::makeArrayRef(ClangdServerOpts.QueryDriverGlobs),
|
||||
|
@ -127,13 +127,13 @@ ClangdServer::ClangdServer(const GlobalCompilationDatabase &CDB,
|
||||
// critical paths.
|
||||
WorkScheduler(
|
||||
CDB, Opts.AsyncThreadsCount, Opts.StorePreamblesInMemory,
|
||||
llvm::make_unique<UpdateIndexCallbacks>(
|
||||
std::make_unique<UpdateIndexCallbacks>(
|
||||
DynamicIdx.get(), DiagConsumer, Opts.SemanticHighlighting),
|
||||
Opts.UpdateDebounce, Opts.RetentionPolicy) {
|
||||
// Adds an index to the stack, at higher priority than existing indexes.
|
||||
auto AddIndex = [&](SymbolIndex *Idx) {
|
||||
if (this->Index != nullptr) {
|
||||
MergedIdx.push_back(llvm::make_unique<MergedIndex>(Idx, this->Index));
|
||||
MergedIdx.push_back(std::make_unique<MergedIndex>(Idx, this->Index));
|
||||
this->Index = MergedIdx.back().get();
|
||||
} else {
|
||||
this->Index = Idx;
|
||||
@ -142,7 +142,7 @@ ClangdServer::ClangdServer(const GlobalCompilationDatabase &CDB,
|
||||
if (Opts.StaticIndex)
|
||||
AddIndex(Opts.StaticIndex);
|
||||
if (Opts.BackgroundIndex) {
|
||||
BackgroundIdx = llvm::make_unique<BackgroundIndex>(
|
||||
BackgroundIdx = std::make_unique<BackgroundIndex>(
|
||||
Context::current().clone(), FSProvider, CDB,
|
||||
BackgroundIndexStorage::createDiskBackedStorageFactory(
|
||||
[&CDB](llvm::StringRef File) { return CDB.getProjectInfo(File); }),
|
||||
|
@ -96,7 +96,7 @@ public:
|
||||
protected:
|
||||
std::unique_ptr<ASTConsumer>
|
||||
CreateASTConsumer(CompilerInstance &CI, llvm::StringRef InFile) override {
|
||||
return llvm::make_unique<DeclTrackingASTConsumer>(/*ref*/ TopLevelDecls);
|
||||
return std::make_unique<DeclTrackingASTConsumer>(/*ref*/ TopLevelDecls);
|
||||
}
|
||||
|
||||
private:
|
||||
@ -160,9 +160,9 @@ public:
|
||||
|
||||
std::unique_ptr<PPCallbacks> createPPCallbacks() override {
|
||||
assert(SourceMgr && "SourceMgr must be set at this point");
|
||||
return llvm::make_unique<PPChainedCallbacks>(
|
||||
return std::make_unique<PPChainedCallbacks>(
|
||||
collectIncludeStructureCallback(*SourceMgr, &Includes),
|
||||
llvm::make_unique<CollectMainFileMacros>(*SourceMgr, &MainFileMacros));
|
||||
std::make_unique<CollectMainFileMacros>(*SourceMgr, &MainFileMacros));
|
||||
}
|
||||
|
||||
CommentHandler *getCommentHandler() override {
|
||||
@ -311,7 +311,7 @@ ParsedAST::build(std::unique_ptr<CompilerInvocation> CI,
|
||||
if (!Clang)
|
||||
return None;
|
||||
|
||||
auto Action = llvm::make_unique<ClangdFrontendAction>();
|
||||
auto Action = std::make_unique<ClangdFrontendAction>();
|
||||
const FrontendInputFile &MainInput = Clang->getFrontendOpts().Inputs[0];
|
||||
if (!Action->BeginSourceFile(*Clang, MainInput)) {
|
||||
log("BeginSourceFile() failed when building AST for {0}",
|
||||
@ -335,7 +335,7 @@ ParsedAST::build(std::unique_ptr<CompilerInvocation> CI,
|
||||
tidy::ClangTidyCheckFactories CTFactories;
|
||||
for (const auto &E : tidy::ClangTidyModuleRegistry::entries())
|
||||
E.instantiate()->addCheckFactories(CTFactories);
|
||||
CTContext.emplace(llvm::make_unique<tidy::DefaultOptionsProvider>(
|
||||
CTContext.emplace(std::make_unique<tidy::DefaultOptionsProvider>(
|
||||
tidy::ClangTidyGlobalOptions(), Opts.ClangTidyOpts));
|
||||
CTContext->setDiagnosticsEngine(&Clang->getDiagnostics());
|
||||
CTContext->setASTContext(&Clang->getASTContext());
|
||||
@ -616,7 +616,7 @@ buildPreamble(PathRef FileName, CompilerInvocation &CI,
|
||||
|
||||
llvm::SmallString<32> AbsFileName(FileName);
|
||||
Inputs.FS->makeAbsolute(AbsFileName);
|
||||
auto StatCache = llvm::make_unique<PreambleFileStatusCache>(AbsFileName);
|
||||
auto StatCache = std::make_unique<PreambleFileStatusCache>(AbsFileName);
|
||||
auto BuiltPreamble = PrecompiledPreamble::Build(
|
||||
CI, ContentsBuffer.get(), Bounds, *PreambleDiagsEngine,
|
||||
StatCache->getProducingFS(Inputs.FS),
|
||||
@ -659,7 +659,7 @@ buildAST(PathRef FileName, std::unique_ptr<CompilerInvocation> Invocation,
|
||||
}
|
||||
|
||||
return ParsedAST::build(
|
||||
llvm::make_unique<CompilerInvocation>(*Invocation), Preamble,
|
||||
std::make_unique<CompilerInvocation>(*Invocation), Preamble,
|
||||
llvm::MemoryBuffer::getMemBufferCopy(Inputs.Contents, FileName),
|
||||
std::move(VFS), Inputs.Index, Inputs.Opts);
|
||||
}
|
||||
|
@ -1252,7 +1252,7 @@ public:
|
||||
// - completion results based on the AST.
|
||||
// - partial identifier and context. We need these for the index query.
|
||||
CodeCompleteResult Output;
|
||||
auto RecorderOwner = llvm::make_unique<CompletionRecorder>(Opts, [&]() {
|
||||
auto RecorderOwner = std::make_unique<CompletionRecorder>(Opts, [&]() {
|
||||
assert(Recorder && "Recorder is not set");
|
||||
CCContextKind = Recorder->CCContext.getKind();
|
||||
auto Style = getFormatStyleForFile(
|
||||
@ -1756,7 +1756,7 @@ SignatureHelp signatureHelp(PathRef FileName,
|
||||
Options.IncludeBriefComments = false;
|
||||
IncludeStructure PreambleInclusions; // Unused for signatureHelp
|
||||
semaCodeComplete(
|
||||
llvm::make_unique<SignatureHelpCollector>(Options, Index, Result),
|
||||
std::make_unique<SignatureHelpCollector>(Options, Index, Result),
|
||||
Options,
|
||||
{FileName, Command, Preamble, Contents, *Offset, std::move(VFS)});
|
||||
return Result;
|
||||
|
@ -88,7 +88,7 @@ prepareCompilerInstance(std::unique_ptr<clang::CompilerInvocation> CI,
|
||||
CI->getFrontendOpts().Inputs[0].getFile(), Buffer.get());
|
||||
}
|
||||
|
||||
auto Clang = llvm::make_unique<CompilerInstance>(
|
||||
auto Clang = std::make_unique<CompilerInstance>(
|
||||
std::make_shared<PCHContainerOperations>());
|
||||
Clang->setInvocation(std::move(CI));
|
||||
Clang->createDiagnostics(&DiagsClient, false);
|
||||
|
@ -122,7 +122,7 @@ public:
|
||||
typename std::decay<Type>::type Value) const & {
|
||||
return Context(std::make_shared<Data>(Data{
|
||||
/*Parent=*/DataPtr, &Key,
|
||||
llvm::make_unique<TypedAnyStorage<typename std::decay<Type>::type>>(
|
||||
std::make_unique<TypedAnyStorage<typename std::decay<Type>::type>>(
|
||||
std::move(Value))}));
|
||||
}
|
||||
|
||||
@ -132,7 +132,7 @@ public:
|
||||
typename std::decay<Type>::type Value) && /* takes ownership */ {
|
||||
return Context(std::make_shared<Data>(Data{
|
||||
/*Parent=*/std::move(DataPtr), &Key,
|
||||
llvm::make_unique<TypedAnyStorage<typename std::decay<Type>::type>>(
|
||||
std::make_unique<TypedAnyStorage<typename std::decay<Type>::type>>(
|
||||
std::move(Value))}));
|
||||
}
|
||||
|
||||
|
@ -112,7 +112,7 @@ llvm::SmallVector<llvm::StringRef, 1> getRankedIncludes(const Symbol &Sym) {
|
||||
std::unique_ptr<PPCallbacks>
|
||||
collectIncludeStructureCallback(const SourceManager &SM,
|
||||
IncludeStructure *Out) {
|
||||
return llvm::make_unique<RecordHeaders>(SM, Out);
|
||||
return std::make_unique<RecordHeaders>(SM, Out);
|
||||
}
|
||||
|
||||
void IncludeStructure::recordInclude(llvm::StringRef IncludingName,
|
||||
|
@ -294,7 +294,7 @@ std::unique_ptr<Transport> newJSONTransport(std::FILE *In,
|
||||
llvm::raw_ostream *InMirror,
|
||||
bool Pretty,
|
||||
JSONStreamStyle Style) {
|
||||
return llvm::make_unique<JSONTransport>(In, Out, InMirror, Pretty, Style);
|
||||
return std::make_unique<JSONTransport>(In, Out, InMirror, Pretty, Style);
|
||||
}
|
||||
|
||||
} // namespace clangd
|
||||
|
@ -277,7 +277,7 @@ getQueryDriverDatabase(llvm::ArrayRef<std::string> QueryDriverGlobs,
|
||||
assert(Base && "Null base to SystemIncludeExtractor");
|
||||
if (QueryDriverGlobs.empty())
|
||||
return Base;
|
||||
return llvm::make_unique<QueryDriverDatabase>(QueryDriverGlobs,
|
||||
return std::make_unique<QueryDriverDatabase>(QueryDriverGlobs,
|
||||
std::move(Base));
|
||||
}
|
||||
|
||||
|
@ -469,7 +469,7 @@ void ASTWorker::update(ParseInputs Inputs, WantDiagnostics WantDiags) {
|
||||
if (!AST) {
|
||||
llvm::Optional<ParsedAST> NewAST =
|
||||
buildAST(FileName, std::move(Invocation), Inputs, NewPreamble);
|
||||
AST = NewAST ? llvm::make_unique<ParsedAST>(std::move(*NewAST)) : nullptr;
|
||||
AST = NewAST ? std::make_unique<ParsedAST>(std::move(*NewAST)) : nullptr;
|
||||
if (!(*AST)) { // buildAST fails.
|
||||
TUStatus::BuildDetails Details;
|
||||
Details.BuildFailed = true;
|
||||
@ -519,10 +519,10 @@ void ASTWorker::runWithAST(
|
||||
llvm::Optional<ParsedAST> NewAST =
|
||||
Invocation
|
||||
? buildAST(FileName,
|
||||
llvm::make_unique<CompilerInvocation>(*Invocation),
|
||||
std::make_unique<CompilerInvocation>(*Invocation),
|
||||
*CurrentInputs, getPossiblyStalePreamble())
|
||||
: None;
|
||||
AST = NewAST ? llvm::make_unique<ParsedAST>(std::move(*NewAST)) : nullptr;
|
||||
AST = NewAST ? std::make_unique<ParsedAST>(std::move(*NewAST)) : nullptr;
|
||||
}
|
||||
// Make sure we put the AST back into the LRU cache.
|
||||
auto _ = llvm::make_scope_exit(
|
||||
@ -832,9 +832,9 @@ TUScheduler::TUScheduler(const GlobalCompilationDatabase &CDB,
|
||||
ASTRetentionPolicy RetentionPolicy)
|
||||
: CDB(CDB), StorePreamblesInMemory(StorePreamblesInMemory),
|
||||
Callbacks(Callbacks ? move(Callbacks)
|
||||
: llvm::make_unique<ParsingCallbacks>()),
|
||||
: std::make_unique<ParsingCallbacks>()),
|
||||
Barrier(AsyncThreadsCount),
|
||||
IdleASTs(llvm::make_unique<ASTCache>(RetentionPolicy.MaxRetainedASTs)),
|
||||
IdleASTs(std::make_unique<ASTCache>(RetentionPolicy.MaxRetainedASTs)),
|
||||
UpdateDebounce(UpdateDebounce) {
|
||||
if (0 < AsyncThreadsCount) {
|
||||
PreambleTasks.emplace();
|
||||
|
@ -52,7 +52,7 @@ public:
|
||||
// and this also allows us to look up the parent Span's information.
|
||||
Context beginSpan(llvm::StringRef Name, llvm::json::Object *Args) override {
|
||||
return Context::current().derive(
|
||||
SpanKey, llvm::make_unique<JSONSpan>(this, Name, Args));
|
||||
SpanKey, std::make_unique<JSONSpan>(this, Name, Args));
|
||||
}
|
||||
|
||||
// Trace viewer requires each thread to properly stack events.
|
||||
@ -200,7 +200,7 @@ Session::~Session() { T = nullptr; }
|
||||
|
||||
std::unique_ptr<EventTracer> createJSONTracer(llvm::raw_ostream &OS,
|
||||
bool Pretty) {
|
||||
return llvm::make_unique<JSONTracer>(OS, Pretty);
|
||||
return std::make_unique<JSONTracer>(OS, Pretty);
|
||||
}
|
||||
|
||||
void log(const llvm::Twine &Message) {
|
||||
|
@ -61,7 +61,7 @@ public:
|
||||
llvm::Expected<std::unique_ptr<URIScheme>>
|
||||
findSchemeByName(llvm::StringRef Scheme) {
|
||||
if (Scheme == "file")
|
||||
return llvm::make_unique<FileSystemScheme>();
|
||||
return std::make_unique<FileSystemScheme>();
|
||||
|
||||
for (auto I = URISchemeRegistry::begin(), E = URISchemeRegistry::end();
|
||||
I != E; ++I) {
|
||||
|
@ -144,7 +144,7 @@ BackgroundIndex::BackgroundIndex(
|
||||
Context BackgroundContext, const FileSystemProvider &FSProvider,
|
||||
const GlobalCompilationDatabase &CDB,
|
||||
BackgroundIndexStorage::Factory IndexStorageFactory, size_t ThreadPoolSize)
|
||||
: SwapIndex(llvm::make_unique<MemIndex>()), FSProvider(FSProvider),
|
||||
: SwapIndex(std::make_unique<MemIndex>()), FSProvider(FSProvider),
|
||||
CDB(CDB), BackgroundContext(std::move(BackgroundContext)),
|
||||
Rebuilder(this, &IndexedSymbols, ThreadPoolSize),
|
||||
IndexStorageFactory(std::move(IndexStorageFactory)),
|
||||
@ -300,10 +300,10 @@ void BackgroundIndex::update(
|
||||
Refs.insert(RefToIDs[R], *R);
|
||||
for (const auto *Rel : FileIt.second.Relations)
|
||||
Relations.insert(*Rel);
|
||||
auto SS = llvm::make_unique<SymbolSlab>(std::move(Syms).build());
|
||||
auto RS = llvm::make_unique<RefSlab>(std::move(Refs).build());
|
||||
auto RelS = llvm::make_unique<RelationSlab>(std::move(Relations).build());
|
||||
auto IG = llvm::make_unique<IncludeGraph>(
|
||||
auto SS = std::make_unique<SymbolSlab>(std::move(Syms).build());
|
||||
auto RS = std::make_unique<RefSlab>(std::move(Refs).build());
|
||||
auto RelS = std::make_unique<RelationSlab>(std::move(Relations).build());
|
||||
auto IG = std::make_unique<IncludeGraph>(
|
||||
getSubGraph(URI::create(Path), Index.Sources.getValue()));
|
||||
|
||||
// We need to store shards before updating the index, since the latter
|
||||
@ -466,14 +466,14 @@ BackgroundIndex::loadProject(std::vector<std::string> MainFiles) {
|
||||
continue;
|
||||
auto SS =
|
||||
LS.Shard->Symbols
|
||||
? llvm::make_unique<SymbolSlab>(std::move(*LS.Shard->Symbols))
|
||||
? std::make_unique<SymbolSlab>(std::move(*LS.Shard->Symbols))
|
||||
: nullptr;
|
||||
auto RS = LS.Shard->Refs
|
||||
? llvm::make_unique<RefSlab>(std::move(*LS.Shard->Refs))
|
||||
? std::make_unique<RefSlab>(std::move(*LS.Shard->Refs))
|
||||
: nullptr;
|
||||
auto RelS =
|
||||
LS.Shard->Relations
|
||||
? llvm::make_unique<RelationSlab>(std::move(*LS.Shard->Relations))
|
||||
? std::make_unique<RelationSlab>(std::move(*LS.Shard->Relations))
|
||||
: nullptr;
|
||||
ShardVersion &SV = ShardVersions[LS.AbsolutePath];
|
||||
SV.Digest = LS.Digest;
|
||||
|
@ -91,7 +91,7 @@ public:
|
||||
if (!Buffer)
|
||||
return nullptr;
|
||||
if (auto I = readIndexFile(Buffer->get()->getBuffer()))
|
||||
return llvm::make_unique<IndexFileIn>(std::move(*I));
|
||||
return std::make_unique<IndexFileIn>(std::move(*I));
|
||||
else
|
||||
elog("Error while reading shard {0}: {1}", ShardIdentifier,
|
||||
I.takeError());
|
||||
@ -128,7 +128,7 @@ class DiskBackedIndexStorageManager {
|
||||
public:
|
||||
DiskBackedIndexStorageManager(
|
||||
std::function<llvm::Optional<ProjectInfo>(PathRef)> GetProjectInfo)
|
||||
: IndexStorageMapMu(llvm::make_unique<std::mutex>()),
|
||||
: IndexStorageMapMu(std::make_unique<std::mutex>()),
|
||||
GetProjectInfo(std::move(GetProjectInfo)) {
|
||||
llvm::SmallString<128> HomeDir;
|
||||
llvm::sys::path::home_directory(HomeDir);
|
||||
@ -151,9 +151,9 @@ private:
|
||||
std::unique_ptr<BackgroundIndexStorage> create(PathRef CDBDirectory) {
|
||||
if (CDBDirectory.empty()) {
|
||||
elog("Tried to create storage for empty directory!");
|
||||
return llvm::make_unique<NullStorage>();
|
||||
return std::make_unique<NullStorage>();
|
||||
}
|
||||
return llvm::make_unique<DiskBackedIndexStorage>(CDBDirectory);
|
||||
return std::make_unique<DiskBackedIndexStorage>(CDBDirectory);
|
||||
}
|
||||
|
||||
Path HomeDir;
|
||||
|
@ -83,7 +83,7 @@ collectIWYUHeaderMaps(CanonicalIncludes *Includes) {
|
||||
private:
|
||||
CanonicalIncludes *const Includes;
|
||||
};
|
||||
return llvm::make_unique<PragmaCommentHandler>(Includes);
|
||||
return std::make_unique<PragmaCommentHandler>(Includes);
|
||||
}
|
||||
|
||||
void addSystemHeadersMapping(CanonicalIncludes *Includes,
|
||||
|
@ -216,14 +216,14 @@ FileSymbols::buildIndex(IndexType Type, DuplicateHandling DuplicateHandle) {
|
||||
// Index must keep the slabs and contiguous ranges alive.
|
||||
switch (Type) {
|
||||
case IndexType::Light:
|
||||
return llvm::make_unique<MemIndex>(
|
||||
return std::make_unique<MemIndex>(
|
||||
llvm::make_pointee_range(AllSymbols), std::move(AllRefs),
|
||||
std::move(AllRelations),
|
||||
std::make_tuple(std::move(SymbolSlabs), std::move(RefSlabs),
|
||||
std::move(RefsStorage), std::move(SymsStorage)),
|
||||
StorageSize);
|
||||
case IndexType::Heavy:
|
||||
return llvm::make_unique<dex::Dex>(
|
||||
return std::make_unique<dex::Dex>(
|
||||
llvm::make_pointee_range(AllSymbols), std::move(AllRefs),
|
||||
std::move(AllRelations),
|
||||
std::make_tuple(std::move(SymbolSlabs), std::move(RefSlabs),
|
||||
@ -235,17 +235,17 @@ FileSymbols::buildIndex(IndexType Type, DuplicateHandling DuplicateHandle) {
|
||||
|
||||
FileIndex::FileIndex(bool UseDex)
|
||||
: MergedIndex(&MainFileIndex, &PreambleIndex), UseDex(UseDex),
|
||||
PreambleIndex(llvm::make_unique<MemIndex>()),
|
||||
MainFileIndex(llvm::make_unique<MemIndex>()) {}
|
||||
PreambleIndex(std::make_unique<MemIndex>()),
|
||||
MainFileIndex(std::make_unique<MemIndex>()) {}
|
||||
|
||||
void FileIndex::updatePreamble(PathRef Path, ASTContext &AST,
|
||||
std::shared_ptr<Preprocessor> PP,
|
||||
const CanonicalIncludes &Includes) {
|
||||
auto Slabs = indexHeaderSymbols(AST, std::move(PP), Includes);
|
||||
PreambleSymbols.update(
|
||||
Path, llvm::make_unique<SymbolSlab>(std::move(std::get<0>(Slabs))),
|
||||
llvm::make_unique<RefSlab>(),
|
||||
llvm::make_unique<RelationSlab>(std::move(std::get<2>(Slabs))),
|
||||
Path, std::make_unique<SymbolSlab>(std::move(std::get<0>(Slabs))),
|
||||
std::make_unique<RefSlab>(),
|
||||
std::make_unique<RelationSlab>(std::move(std::get<2>(Slabs))),
|
||||
/*CountReferences=*/false);
|
||||
PreambleIndex.reset(
|
||||
PreambleSymbols.buildIndex(UseDex ? IndexType::Heavy : IndexType::Light,
|
||||
@ -255,9 +255,9 @@ void FileIndex::updatePreamble(PathRef Path, ASTContext &AST,
|
||||
void FileIndex::updateMain(PathRef Path, ParsedAST &AST) {
|
||||
auto Contents = indexMainDecls(AST);
|
||||
MainFileSymbols.update(
|
||||
Path, llvm::make_unique<SymbolSlab>(std::move(std::get<0>(Contents))),
|
||||
llvm::make_unique<RefSlab>(std::move(std::get<1>(Contents))),
|
||||
llvm::make_unique<RelationSlab>(std::move(std::get<2>(Contents))),
|
||||
Path, std::make_unique<SymbolSlab>(std::move(std::get<0>(Contents))),
|
||||
std::make_unique<RefSlab>(std::move(std::get<1>(Contents))),
|
||||
std::make_unique<RelationSlab>(std::move(std::get<2>(Contents))),
|
||||
/*CountReferences=*/true);
|
||||
MainFileIndex.reset(
|
||||
MainFileSymbols.buildIndex(IndexType::Light, DuplicateHandling::Merge));
|
||||
|
@ -136,7 +136,7 @@ public:
|
||||
addSystemHeadersMapping(Includes.get(), CI.getLangOpts());
|
||||
if (IncludeGraphCallback != nullptr)
|
||||
CI.getPreprocessor().addPPCallbacks(
|
||||
llvm::make_unique<IncludeGraphCollector>(CI.getSourceManager(), IG));
|
||||
std::make_unique<IncludeGraphCollector>(CI.getSourceManager(), IG));
|
||||
return WrapperFrontendAction::CreateASTConsumer(CI, InFile);
|
||||
}
|
||||
|
||||
@ -199,9 +199,9 @@ std::unique_ptr<FrontendAction> createStaticIndexingAction(
|
||||
Opts.RefFilter = RefKind::All;
|
||||
Opts.RefsInHeaders = true;
|
||||
}
|
||||
auto Includes = llvm::make_unique<CanonicalIncludes>();
|
||||
auto Includes = std::make_unique<CanonicalIncludes>();
|
||||
Opts.Includes = Includes.get();
|
||||
return llvm::make_unique<IndexAction>(
|
||||
return std::make_unique<IndexAction>(
|
||||
std::make_shared<SymbolCollector>(std::move(Opts)), std::move(Includes),
|
||||
IndexOpts, SymbolsCallback, RefsCallback, RelationsCallback,
|
||||
IncludeGraphCallback);
|
||||
|
@ -21,7 +21,7 @@ std::unique_ptr<SymbolIndex> MemIndex::build(SymbolSlab Slab, RefSlab Refs,
|
||||
// Store Slab size before it is moved.
|
||||
const auto BackingDataSize = Slab.bytes() + Refs.bytes();
|
||||
auto Data = std::make_pair(std::move(Slab), std::move(Refs));
|
||||
return llvm::make_unique<MemIndex>(Data.first, Data.second, Relations,
|
||||
return std::make_unique<MemIndex>(Data.first, Data.second, Relations,
|
||||
std::move(Data), BackingDataSize);
|
||||
}
|
||||
|
||||
|
@ -206,7 +206,7 @@ void SymbolCollector::initialize(ASTContext &Ctx) {
|
||||
ASTCtx = &Ctx;
|
||||
CompletionAllocator = std::make_shared<GlobalCodeCompletionAllocator>();
|
||||
CompletionTUInfo =
|
||||
llvm::make_unique<CodeCompletionTUInfo>(CompletionAllocator);
|
||||
std::make_unique<CodeCompletionTUInfo>(CompletionAllocator);
|
||||
}
|
||||
|
||||
bool SymbolCollector::shouldCollectSymbol(const NamedDecl &ND,
|
||||
|
@ -29,7 +29,7 @@ std::unique_ptr<SymbolIndex> Dex::build(SymbolSlab Symbols, RefSlab Refs,
|
||||
// There is no need to include "Rels" in Data because the relations are self-
|
||||
// contained, without references into a backing store.
|
||||
auto Data = std::make_pair(std::move(Symbols), std::move(Refs));
|
||||
return llvm::make_unique<Dex>(Data.first, Data.second, Rels, std::move(Data),
|
||||
return std::make_unique<Dex>(Data.first, Data.second, Rels, std::move(Data),
|
||||
Size);
|
||||
}
|
||||
|
||||
|
@ -380,7 +380,7 @@ Corpus::intersect(std::vector<std::unique_ptr<Iterator>> Children) const {
|
||||
case 1:
|
||||
return std::move(RealChildren.front());
|
||||
default:
|
||||
return llvm::make_unique<AndIterator>(std::move(RealChildren));
|
||||
return std::make_unique<AndIterator>(std::move(RealChildren));
|
||||
}
|
||||
}
|
||||
|
||||
@ -410,16 +410,16 @@ Corpus::unionOf(std::vector<std::unique_ptr<Iterator>> Children) const {
|
||||
case 1:
|
||||
return std::move(RealChildren.front());
|
||||
default:
|
||||
return llvm::make_unique<OrIterator>(std::move(RealChildren));
|
||||
return std::make_unique<OrIterator>(std::move(RealChildren));
|
||||
}
|
||||
}
|
||||
|
||||
std::unique_ptr<Iterator> Corpus::all() const {
|
||||
return llvm::make_unique<TrueIterator>(Size);
|
||||
return std::make_unique<TrueIterator>(Size);
|
||||
}
|
||||
|
||||
std::unique_ptr<Iterator> Corpus::none() const {
|
||||
return llvm::make_unique<FalseIterator>();
|
||||
return std::make_unique<FalseIterator>();
|
||||
}
|
||||
|
||||
std::unique_ptr<Iterator> Corpus::boost(std::unique_ptr<Iterator> Child,
|
||||
@ -428,14 +428,14 @@ std::unique_ptr<Iterator> Corpus::boost(std::unique_ptr<Iterator> Child,
|
||||
return Child;
|
||||
if (Child->kind() == Iterator::Kind::False)
|
||||
return Child;
|
||||
return llvm::make_unique<BoostIterator>(std::move(Child), Factor);
|
||||
return std::make_unique<BoostIterator>(std::move(Child), Factor);
|
||||
}
|
||||
|
||||
std::unique_ptr<Iterator> Corpus::limit(std::unique_ptr<Iterator> Child,
|
||||
size_t Limit) const {
|
||||
if (Child->kind() == Iterator::Kind::False)
|
||||
return Child;
|
||||
return llvm::make_unique<LimitIterator>(std::move(Child), Limit);
|
||||
return std::make_unique<LimitIterator>(std::move(Child), Limit);
|
||||
}
|
||||
|
||||
} // namespace dex
|
||||
|
@ -220,7 +220,7 @@ PostingList::PostingList(llvm::ArrayRef<DocID> Documents)
|
||||
: Chunks(encodeStream(Documents)) {}
|
||||
|
||||
std::unique_ptr<Iterator> PostingList::iterator(const Token *Tok) const {
|
||||
return llvm::make_unique<ChunkIterator>(Tok, Chunks);
|
||||
return std::make_unique<ChunkIterator>(Tok, Chunks);
|
||||
}
|
||||
|
||||
} // namespace dex
|
||||
|
@ -257,11 +257,11 @@ struct {
|
||||
const char *Description;
|
||||
std::function<std::unique_ptr<Command>()> Implementation;
|
||||
} CommandInfo[] = {
|
||||
{"find", "Search for symbols with fuzzyFind", llvm::make_unique<FuzzyFind>},
|
||||
{"find", "Search for symbols with fuzzyFind", std::make_unique<FuzzyFind>},
|
||||
{"lookup", "Dump symbol details by ID or qualified name",
|
||||
llvm::make_unique<Lookup>},
|
||||
std::make_unique<Lookup>},
|
||||
{"refs", "Find references by ID or qualified name",
|
||||
llvm::make_unique<Refs>},
|
||||
std::make_unique<Refs>},
|
||||
};
|
||||
|
||||
std::unique_ptr<SymbolIndex> openIndex(llvm::StringRef Index) {
|
||||
|
@ -120,7 +120,7 @@ int main(int argc, const char **argv) {
|
||||
// Collect symbols found in each translation unit, merging as we go.
|
||||
clang::clangd::IndexFileIn Data;
|
||||
auto Err = Executor->get()->execute(
|
||||
llvm::make_unique<clang::clangd::IndexActionFactory>(Data),
|
||||
std::make_unique<clang::clangd::IndexActionFactory>(Data),
|
||||
clang::tooling::getStripPluginsAdjuster());
|
||||
if (Err) {
|
||||
llvm::errs() << llvm::toString(std::move(Err)) << "\n";
|
||||
|
@ -453,7 +453,7 @@ bool ExtractVariable::prepare(const Selection &Inputs) {
|
||||
const SourceManager &SM = Inputs.AST.getSourceManager();
|
||||
if (const SelectionTree::Node *N =
|
||||
computeExtractedExpr(Inputs.ASTSelection.commonAncestor()))
|
||||
Target = llvm::make_unique<ExtractionContext>(N, SM, Ctx);
|
||||
Target = std::make_unique<ExtractionContext>(N, SM, Ctx);
|
||||
return Target && Target->isExtractable();
|
||||
}
|
||||
|
||||
|
@ -585,7 +585,7 @@ clangd accepts flags on the commandline, and in the CLANGD_FLAGS environment var
|
||||
if (EnableIndex && !IndexFile.empty()) {
|
||||
// Load the index asynchronously. Meanwhile SwapIndex returns no results.
|
||||
SwapIndex *Placeholder;
|
||||
StaticIdx.reset(Placeholder = new SwapIndex(llvm::make_unique<MemIndex>()));
|
||||
StaticIdx.reset(Placeholder = new SwapIndex(std::make_unique<MemIndex>()));
|
||||
AsyncIndexLoad = runAsync<void>([Placeholder] {
|
||||
if (auto Idx = loadIndex(IndexFile, /*UseDex=*/true))
|
||||
Placeholder->reset(std::move(Idx));
|
||||
@ -641,7 +641,7 @@ clangd accepts flags on the commandline, and in the CLANGD_FLAGS environment var
|
||||
if (EnableClangTidy) {
|
||||
auto OverrideClangTidyOptions = tidy::ClangTidyOptions::getDefaults();
|
||||
OverrideClangTidyOptions.Checks = ClangTidyChecks;
|
||||
ClangTidyOptProvider = llvm::make_unique<tidy::FileOptionsProvider>(
|
||||
ClangTidyOptProvider = std::make_unique<tidy::FileOptionsProvider>(
|
||||
tidy::ClangTidyGlobalOptions(),
|
||||
/* Default */ tidy::ClangTidyOptions::getDefaults(),
|
||||
/* Override */ OverrideClangTidyOptions, FSProvider.getFileSystem());
|
||||
|
@ -74,7 +74,7 @@ public:
|
||||
return nullptr;
|
||||
}
|
||||
CacheHits++;
|
||||
return llvm::make_unique<IndexFileIn>(std::move(*IndexFile));
|
||||
return std::make_unique<IndexFileIn>(std::move(*IndexFile));
|
||||
}
|
||||
|
||||
mutable llvm::StringSet<> AccessedPaths;
|
||||
@ -575,7 +575,7 @@ TEST_F(BackgroundIndexTest, CmdLineHash) {
|
||||
class BackgroundIndexRebuilderTest : public testing::Test {
|
||||
protected:
|
||||
BackgroundIndexRebuilderTest()
|
||||
: Target(llvm::make_unique<MemIndex>()),
|
||||
: Target(std::make_unique<MemIndex>()),
|
||||
Rebuilder(&Target, &Source, /*Threads=*/10) {
|
||||
// Prepare FileSymbols with TestSymbol in it, for checkRebuild.
|
||||
TestSymbol.ID = SymbolID("foo");
|
||||
@ -588,7 +588,7 @@ protected:
|
||||
TestSymbol.Name = VersionStorage.back();
|
||||
SymbolSlab::Builder SB;
|
||||
SB.insert(TestSymbol);
|
||||
Source.update("", llvm::make_unique<SymbolSlab>(std::move(SB).build()),
|
||||
Source.update("", std::make_unique<SymbolSlab>(std::move(SB).build()),
|
||||
nullptr, nullptr, false);
|
||||
// Now maybe update the index.
|
||||
Action();
|
||||
|
@ -26,7 +26,7 @@ TEST(ContextTests, Simple) {
|
||||
TEST(ContextTests, MoveOps) {
|
||||
Key<std::unique_ptr<int>> Param;
|
||||
|
||||
Context Ctx = Context::empty().derive(Param, llvm::make_unique<int>(10));
|
||||
Context Ctx = Context::empty().derive(Param, std::make_unique<int>(10));
|
||||
EXPECT_EQ(**Ctx.get(Param), 10);
|
||||
|
||||
Context NewCtx = std::move(Ctx);
|
||||
|
@ -67,7 +67,7 @@ std::unique_ptr<SymbolSlab> numSlab(int Begin, int End) {
|
||||
SymbolSlab::Builder Slab;
|
||||
for (int i = Begin; i <= End; i++)
|
||||
Slab.insert(symbol(std::to_string(i)));
|
||||
return llvm::make_unique<SymbolSlab>(std::move(Slab).build());
|
||||
return std::make_unique<SymbolSlab>(std::move(Slab).build());
|
||||
}
|
||||
|
||||
std::unique_ptr<RefSlab> refSlab(const SymbolID &ID, const char *Path) {
|
||||
@ -76,7 +76,7 @@ std::unique_ptr<RefSlab> refSlab(const SymbolID &ID, const char *Path) {
|
||||
R.Location.FileURI = Path;
|
||||
R.Kind = RefKind::Reference;
|
||||
Slab.insert(ID, R);
|
||||
return llvm::make_unique<RefSlab>(std::move(Slab).build());
|
||||
return std::make_unique<RefSlab>(std::move(Slab).build());
|
||||
}
|
||||
|
||||
TEST(FileSymbolsTest, UpdateAndGet) {
|
||||
@ -106,7 +106,7 @@ TEST(FileSymbolsTest, MergeOverlap) {
|
||||
auto OneSymboSlab = [](Symbol Sym) {
|
||||
SymbolSlab::Builder S;
|
||||
S.insert(Sym);
|
||||
return llvm::make_unique<SymbolSlab>(std::move(S).build());
|
||||
return std::make_unique<SymbolSlab>(std::move(S).build());
|
||||
};
|
||||
auto X1 = symbol("x");
|
||||
X1.CanonicalDeclaration.FileURI = "file:///x1";
|
||||
|
@ -82,7 +82,7 @@ class OverlayCDBTest : public ::testing::Test {
|
||||
};
|
||||
|
||||
protected:
|
||||
OverlayCDBTest() : Base(llvm::make_unique<BaseCDB>()) {}
|
||||
OverlayCDBTest() : Base(std::make_unique<BaseCDB>()) {}
|
||||
std::unique_ptr<GlobalCompilationDatabase> Base;
|
||||
};
|
||||
|
||||
|
@ -119,11 +119,11 @@ TEST(SwapIndexTest, OldIndexRecycled) {
|
||||
auto Token = std::make_shared<int>();
|
||||
std::weak_ptr<int> WeakToken = Token;
|
||||
|
||||
SwapIndex S(llvm::make_unique<MemIndex>(SymbolSlab(), RefSlab(),
|
||||
SwapIndex S(std::make_unique<MemIndex>(SymbolSlab(), RefSlab(),
|
||||
RelationSlab(), std::move(Token),
|
||||
/*BackingDataSize=*/0));
|
||||
EXPECT_FALSE(WeakToken.expired()); // Current MemIndex keeps it alive.
|
||||
S.reset(llvm::make_unique<MemIndex>()); // Now the MemIndex is destroyed.
|
||||
S.reset(std::make_unique<MemIndex>()); // Now the MemIndex is destroyed.
|
||||
EXPECT_TRUE(WeakToken.expired()); // So the token is too.
|
||||
}
|
||||
|
||||
|
@ -258,7 +258,7 @@ public:
|
||||
llvm::IntrusiveRefCntPtr<FileManager> Files(
|
||||
new FileManager(FileSystemOptions(), InMemoryFileSystem));
|
||||
|
||||
auto Factory = llvm::make_unique<SymbolIndexActionFactory>(
|
||||
auto Factory = std::make_unique<SymbolIndexActionFactory>(
|
||||
CollectorOpts, PragmaHandler.get());
|
||||
|
||||
std::vector<std::string> Args = {"symbol_collector", "-fsyntax-only",
|
||||
|
@ -73,7 +73,7 @@ protected:
|
||||
});
|
||||
}
|
||||
};
|
||||
return llvm::make_unique<CaptureDiags>();
|
||||
return std::make_unique<CaptureDiags>();
|
||||
}
|
||||
|
||||
/// Schedule an update and call \p CB with the diagnostics it produces, if
|
||||
|
@ -83,7 +83,7 @@ SymbolSlab TestTU::headerSymbols() const {
|
||||
|
||||
std::unique_ptr<SymbolIndex> TestTU::index() const {
|
||||
auto AST = build();
|
||||
auto Idx = llvm::make_unique<FileIndex>(/*UseDex=*/true);
|
||||
auto Idx = std::make_unique<FileIndex>(/*UseDex=*/true);
|
||||
Idx->updatePreamble(Filename, AST.getASTContext(), AST.getPreprocessorPtr(),
|
||||
AST.getCanonicalIncludes());
|
||||
Idx->updateMain(Filename, AST);
|
||||
|
@ -209,7 +209,7 @@ namespace clang {
|
||||
namespace clangd {
|
||||
|
||||
std::unique_ptr<Transport> newXPCTransport() {
|
||||
return llvm::make_unique<XPCTransport>();
|
||||
return std::make_unique<XPCTransport>();
|
||||
}
|
||||
|
||||
} // namespace clangd
|
||||
|
@ -105,7 +105,7 @@ class CoverageCheckerConsumer : public ASTConsumer {
|
||||
public:
|
||||
CoverageCheckerConsumer(CoverageChecker &Checker, Preprocessor &PP) {
|
||||
// PP takes ownership.
|
||||
PP.addPPCallbacks(llvm::make_unique<CoverageCheckerCallbacks>(Checker));
|
||||
PP.addPPCallbacks(std::make_unique<CoverageCheckerCallbacks>(Checker));
|
||||
}
|
||||
};
|
||||
|
||||
@ -116,7 +116,7 @@ public:
|
||||
protected:
|
||||
std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
|
||||
StringRef InFile) override {
|
||||
return llvm::make_unique<CoverageCheckerConsumer>(Checker,
|
||||
return std::make_unique<CoverageCheckerConsumer>(Checker,
|
||||
CI.getPreprocessor());
|
||||
}
|
||||
|
||||
@ -154,7 +154,7 @@ std::unique_ptr<CoverageChecker> CoverageChecker::createCoverageChecker(
|
||||
StringRef ModuleMapPath, std::vector<std::string> &IncludePaths,
|
||||
ArrayRef<std::string> CommandLine, clang::ModuleMap *ModuleMap) {
|
||||
|
||||
return llvm::make_unique<CoverageChecker>(ModuleMapPath, IncludePaths,
|
||||
return std::make_unique<CoverageChecker>(ModuleMapPath, IncludePaths,
|
||||
CommandLine, ModuleMap);
|
||||
}
|
||||
|
||||
|
@ -703,7 +703,7 @@ public:
|
||||
protected:
|
||||
std::unique_ptr<clang::ASTConsumer>
|
||||
CreateASTConsumer(CompilerInstance &CI, StringRef InFile) override {
|
||||
return llvm::make_unique<CollectEntitiesConsumer>(
|
||||
return std::make_unique<CollectEntitiesConsumer>(
|
||||
Entities, PPTracker, CI.getPreprocessor(), InFile, HadErrors);
|
||||
}
|
||||
|
||||
@ -793,7 +793,7 @@ public:
|
||||
protected:
|
||||
std::unique_ptr<clang::ASTConsumer>
|
||||
CreateASTConsumer(CompilerInstance &CI, StringRef InFile) override {
|
||||
return llvm::make_unique<CompileCheckConsumer>();
|
||||
return std::make_unique<CompileCheckConsumer>();
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -814,7 +814,7 @@ public:
|
||||
HeadersInThisCompile.clear();
|
||||
assert((HeaderStack.size() == 0) && "Header stack should be empty.");
|
||||
pushHeaderHandle(addHeader(rootHeaderFile));
|
||||
PP.addPPCallbacks(llvm::make_unique<PreprocessorCallbacks>(*this, PP,
|
||||
PP.addPPCallbacks(std::make_unique<PreprocessorCallbacks>(*this, PP,
|
||||
rootHeaderFile));
|
||||
}
|
||||
// Handle exiting a preprocessing session.
|
||||
|
@ -85,8 +85,8 @@ protected:
|
||||
StringRef InFile) override {
|
||||
Preprocessor &PP = CI.getPreprocessor();
|
||||
PP.addPPCallbacks(
|
||||
llvm::make_unique<PPCallbacksTracker>(Filters, CallbackCalls, PP));
|
||||
return llvm::make_unique<ASTConsumer>();
|
||||
std::make_unique<PPCallbacksTracker>(Filters, CallbackCalls, PP));
|
||||
return std::make_unique<ASTConsumer>();
|
||||
}
|
||||
|
||||
void EndSourceFileAction() override {
|
||||
|
@ -164,100 +164,100 @@ TEST(SerializeTest, emitInfoWithCommentBitcode) {
|
||||
CommentInfo Top;
|
||||
Top.Kind = "FullComment";
|
||||
|
||||
Top.Children.emplace_back(llvm::make_unique<CommentInfo>());
|
||||
Top.Children.emplace_back(std::make_unique<CommentInfo>());
|
||||
CommentInfo *BlankLine = Top.Children.back().get();
|
||||
BlankLine->Kind = "ParagraphComment";
|
||||
BlankLine->Children.emplace_back(llvm::make_unique<CommentInfo>());
|
||||
BlankLine->Children.emplace_back(std::make_unique<CommentInfo>());
|
||||
BlankLine->Children.back()->Kind = "TextComment";
|
||||
|
||||
Top.Children.emplace_back(llvm::make_unique<CommentInfo>());
|
||||
Top.Children.emplace_back(std::make_unique<CommentInfo>());
|
||||
CommentInfo *Brief = Top.Children.back().get();
|
||||
Brief->Kind = "ParagraphComment";
|
||||
Brief->Children.emplace_back(llvm::make_unique<CommentInfo>());
|
||||
Brief->Children.emplace_back(std::make_unique<CommentInfo>());
|
||||
Brief->Children.back()->Kind = "TextComment";
|
||||
Brief->Children.back()->Name = "ParagraphComment";
|
||||
Brief->Children.back()->Text = " Brief description.";
|
||||
|
||||
Top.Children.emplace_back(llvm::make_unique<CommentInfo>());
|
||||
Top.Children.emplace_back(std::make_unique<CommentInfo>());
|
||||
CommentInfo *Extended = Top.Children.back().get();
|
||||
Extended->Kind = "ParagraphComment";
|
||||
Extended->Children.emplace_back(llvm::make_unique<CommentInfo>());
|
||||
Extended->Children.emplace_back(std::make_unique<CommentInfo>());
|
||||
Extended->Children.back()->Kind = "TextComment";
|
||||
Extended->Children.back()->Text = " Extended description that";
|
||||
Extended->Children.emplace_back(llvm::make_unique<CommentInfo>());
|
||||
Extended->Children.emplace_back(std::make_unique<CommentInfo>());
|
||||
Extended->Children.back()->Kind = "TextComment";
|
||||
Extended->Children.back()->Text = " continues onto the next line.";
|
||||
|
||||
Top.Children.emplace_back(llvm::make_unique<CommentInfo>());
|
||||
Top.Children.emplace_back(std::make_unique<CommentInfo>());
|
||||
CommentInfo *HTML = Top.Children.back().get();
|
||||
HTML->Kind = "ParagraphComment";
|
||||
HTML->Children.emplace_back(llvm::make_unique<CommentInfo>());
|
||||
HTML->Children.emplace_back(std::make_unique<CommentInfo>());
|
||||
HTML->Children.back()->Kind = "TextComment";
|
||||
HTML->Children.emplace_back(llvm::make_unique<CommentInfo>());
|
||||
HTML->Children.emplace_back(std::make_unique<CommentInfo>());
|
||||
HTML->Children.back()->Kind = "HTMLStartTagComment";
|
||||
HTML->Children.back()->Name = "ul";
|
||||
HTML->Children.back()->AttrKeys.emplace_back("class");
|
||||
HTML->Children.back()->AttrValues.emplace_back("test");
|
||||
HTML->Children.emplace_back(llvm::make_unique<CommentInfo>());
|
||||
HTML->Children.emplace_back(std::make_unique<CommentInfo>());
|
||||
HTML->Children.back()->Kind = "HTMLStartTagComment";
|
||||
HTML->Children.back()->Name = "li";
|
||||
HTML->Children.emplace_back(llvm::make_unique<CommentInfo>());
|
||||
HTML->Children.emplace_back(std::make_unique<CommentInfo>());
|
||||
HTML->Children.back()->Kind = "TextComment";
|
||||
HTML->Children.back()->Text = " Testing.";
|
||||
HTML->Children.emplace_back(llvm::make_unique<CommentInfo>());
|
||||
HTML->Children.emplace_back(std::make_unique<CommentInfo>());
|
||||
HTML->Children.back()->Kind = "HTMLEndTagComment";
|
||||
HTML->Children.back()->Name = "ul";
|
||||
HTML->Children.back()->SelfClosing = true;
|
||||
|
||||
Top.Children.emplace_back(llvm::make_unique<CommentInfo>());
|
||||
Top.Children.emplace_back(std::make_unique<CommentInfo>());
|
||||
CommentInfo *Verbatim = Top.Children.back().get();
|
||||
Verbatim->Kind = "VerbatimBlockComment";
|
||||
Verbatim->Name = "verbatim";
|
||||
Verbatim->CloseName = "endverbatim";
|
||||
Verbatim->Children.emplace_back(llvm::make_unique<CommentInfo>());
|
||||
Verbatim->Children.emplace_back(std::make_unique<CommentInfo>());
|
||||
Verbatim->Children.back()->Kind = "VerbatimBlockLineComment";
|
||||
Verbatim->Children.back()->Text = " The description continues.";
|
||||
|
||||
Top.Children.emplace_back(llvm::make_unique<CommentInfo>());
|
||||
Top.Children.emplace_back(std::make_unique<CommentInfo>());
|
||||
CommentInfo *ParamOut = Top.Children.back().get();
|
||||
ParamOut->Kind = "ParamCommandComment";
|
||||
ParamOut->Direction = "[out]";
|
||||
ParamOut->ParamName = "I";
|
||||
ParamOut->Explicit = true;
|
||||
ParamOut->Children.emplace_back(llvm::make_unique<CommentInfo>());
|
||||
ParamOut->Children.emplace_back(std::make_unique<CommentInfo>());
|
||||
ParamOut->Children.back()->Kind = "ParagraphComment";
|
||||
ParamOut->Children.back()->Children.emplace_back(
|
||||
llvm::make_unique<CommentInfo>());
|
||||
std::make_unique<CommentInfo>());
|
||||
ParamOut->Children.back()->Children.back()->Kind = "TextComment";
|
||||
ParamOut->Children.back()->Children.emplace_back(
|
||||
llvm::make_unique<CommentInfo>());
|
||||
std::make_unique<CommentInfo>());
|
||||
ParamOut->Children.back()->Children.back()->Kind = "TextComment";
|
||||
ParamOut->Children.back()->Children.back()->Text = " is a parameter.";
|
||||
|
||||
Top.Children.emplace_back(llvm::make_unique<CommentInfo>());
|
||||
Top.Children.emplace_back(std::make_unique<CommentInfo>());
|
||||
CommentInfo *ParamIn = Top.Children.back().get();
|
||||
ParamIn->Kind = "ParamCommandComment";
|
||||
ParamIn->Direction = "[in]";
|
||||
ParamIn->ParamName = "J";
|
||||
ParamIn->Children.emplace_back(llvm::make_unique<CommentInfo>());
|
||||
ParamIn->Children.emplace_back(std::make_unique<CommentInfo>());
|
||||
ParamIn->Children.back()->Kind = "ParagraphComment";
|
||||
ParamIn->Children.back()->Children.emplace_back(
|
||||
llvm::make_unique<CommentInfo>());
|
||||
std::make_unique<CommentInfo>());
|
||||
ParamIn->Children.back()->Children.back()->Kind = "TextComment";
|
||||
ParamIn->Children.back()->Children.back()->Text = " is a parameter.";
|
||||
ParamIn->Children.back()->Children.emplace_back(
|
||||
llvm::make_unique<CommentInfo>());
|
||||
std::make_unique<CommentInfo>());
|
||||
ParamIn->Children.back()->Children.back()->Kind = "TextComment";
|
||||
|
||||
Top.Children.emplace_back(llvm::make_unique<CommentInfo>());
|
||||
Top.Children.emplace_back(std::make_unique<CommentInfo>());
|
||||
CommentInfo *Return = Top.Children.back().get();
|
||||
Return->Kind = "BlockCommandComment";
|
||||
Return->Name = "return";
|
||||
Return->Explicit = true;
|
||||
Return->Children.emplace_back(llvm::make_unique<CommentInfo>());
|
||||
Return->Children.emplace_back(std::make_unique<CommentInfo>());
|
||||
Return->Children.back()->Kind = "ParagraphComment";
|
||||
Return->Children.back()->Children.emplace_back(
|
||||
llvm::make_unique<CommentInfo>());
|
||||
std::make_unique<CommentInfo>());
|
||||
Return->Children.back()->Children.back()->Kind = "TextComment";
|
||||
Return->Children.back()->Children.back()->Text = "void";
|
||||
|
||||
|
@ -17,21 +17,21 @@ namespace doc {
|
||||
|
||||
TEST(GeneratorTest, emitIndex) {
|
||||
Index Idx;
|
||||
auto InfoA = llvm::make_unique<Info>();
|
||||
auto InfoA = std::make_unique<Info>();
|
||||
InfoA->Name = "A";
|
||||
InfoA->USR = serialize::hashUSR("1");
|
||||
Generator::addInfoToIndex(Idx, InfoA.get());
|
||||
auto InfoC = llvm::make_unique<Info>();
|
||||
auto InfoC = std::make_unique<Info>();
|
||||
InfoC->Name = "C";
|
||||
InfoC->USR = serialize::hashUSR("3");
|
||||
Reference RefB = Reference("B");
|
||||
RefB.USR = serialize::hashUSR("2");
|
||||
InfoC->Namespace = {std::move(RefB)};
|
||||
Generator::addInfoToIndex(Idx, InfoC.get());
|
||||
auto InfoD = llvm::make_unique<Info>();
|
||||
auto InfoD = std::make_unique<Info>();
|
||||
InfoD->Name = "D";
|
||||
InfoD->USR = serialize::hashUSR("4");
|
||||
auto InfoF = llvm::make_unique<Info>();
|
||||
auto InfoF = std::make_unique<Info>();
|
||||
InfoF->Name = "F";
|
||||
InfoF->USR = serialize::hashUSR("6");
|
||||
Reference RefD = Reference("D");
|
||||
@ -40,7 +40,7 @@ TEST(GeneratorTest, emitIndex) {
|
||||
RefE.USR = serialize::hashUSR("5");
|
||||
InfoF->Namespace = {std::move(RefE), std::move(RefD)};
|
||||
Generator::addInfoToIndex(Idx, InfoF.get());
|
||||
auto InfoG = llvm::make_unique<Info>(InfoType::IT_namespace);
|
||||
auto InfoG = std::make_unique<Info>(InfoType::IT_namespace);
|
||||
Generator::addInfoToIndex(Idx, InfoG.get());
|
||||
|
||||
Index ExpectedIdx;
|
||||
|
@ -335,34 +335,34 @@ TEST(HTMLGeneratorTest, emitCommentHTML) {
|
||||
CommentInfo Top;
|
||||
Top.Kind = "FullComment";
|
||||
|
||||
Top.Children.emplace_back(llvm::make_unique<CommentInfo>());
|
||||
Top.Children.emplace_back(std::make_unique<CommentInfo>());
|
||||
CommentInfo *BlankLine = Top.Children.back().get();
|
||||
BlankLine->Kind = "ParagraphComment";
|
||||
BlankLine->Children.emplace_back(llvm::make_unique<CommentInfo>());
|
||||
BlankLine->Children.emplace_back(std::make_unique<CommentInfo>());
|
||||
BlankLine->Children.back()->Kind = "TextComment";
|
||||
|
||||
Top.Children.emplace_back(llvm::make_unique<CommentInfo>());
|
||||
Top.Children.emplace_back(std::make_unique<CommentInfo>());
|
||||
CommentInfo *Brief = Top.Children.back().get();
|
||||
Brief->Kind = "ParagraphComment";
|
||||
Brief->Children.emplace_back(llvm::make_unique<CommentInfo>());
|
||||
Brief->Children.emplace_back(std::make_unique<CommentInfo>());
|
||||
Brief->Children.back()->Kind = "TextComment";
|
||||
Brief->Children.back()->Name = "ParagraphComment";
|
||||
Brief->Children.back()->Text = " Brief description.";
|
||||
|
||||
Top.Children.emplace_back(llvm::make_unique<CommentInfo>());
|
||||
Top.Children.emplace_back(std::make_unique<CommentInfo>());
|
||||
CommentInfo *Extended = Top.Children.back().get();
|
||||
Extended->Kind = "ParagraphComment";
|
||||
Extended->Children.emplace_back(llvm::make_unique<CommentInfo>());
|
||||
Extended->Children.emplace_back(std::make_unique<CommentInfo>());
|
||||
Extended->Children.back()->Kind = "TextComment";
|
||||
Extended->Children.back()->Text = " Extended description that";
|
||||
Extended->Children.emplace_back(llvm::make_unique<CommentInfo>());
|
||||
Extended->Children.emplace_back(std::make_unique<CommentInfo>());
|
||||
Extended->Children.back()->Kind = "TextComment";
|
||||
Extended->Children.back()->Text = " continues onto the next line.";
|
||||
|
||||
Top.Children.emplace_back(llvm::make_unique<CommentInfo>());
|
||||
Top.Children.emplace_back(std::make_unique<CommentInfo>());
|
||||
CommentInfo *Entities = Top.Children.back().get();
|
||||
Entities->Kind = "ParagraphComment";
|
||||
Entities->Children.emplace_back(llvm::make_unique<CommentInfo>());
|
||||
Entities->Children.emplace_back(std::make_unique<CommentInfo>());
|
||||
Entities->Children.back()->Kind = "TextComment";
|
||||
Entities->Children.back()->Name = "ParagraphComment";
|
||||
Entities->Children.back()->Text =
|
||||
|
@ -217,100 +217,100 @@ TEST(MDGeneratorTest, emitCommentMD) {
|
||||
CommentInfo Top;
|
||||
Top.Kind = "FullComment";
|
||||
|
||||
Top.Children.emplace_back(llvm::make_unique<CommentInfo>());
|
||||
Top.Children.emplace_back(std::make_unique<CommentInfo>());
|
||||
CommentInfo *BlankLine = Top.Children.back().get();
|
||||
BlankLine->Kind = "ParagraphComment";
|
||||
BlankLine->Children.emplace_back(llvm::make_unique<CommentInfo>());
|
||||
BlankLine->Children.emplace_back(std::make_unique<CommentInfo>());
|
||||
BlankLine->Children.back()->Kind = "TextComment";
|
||||
|
||||
Top.Children.emplace_back(llvm::make_unique<CommentInfo>());
|
||||
Top.Children.emplace_back(std::make_unique<CommentInfo>());
|
||||
CommentInfo *Brief = Top.Children.back().get();
|
||||
Brief->Kind = "ParagraphComment";
|
||||
Brief->Children.emplace_back(llvm::make_unique<CommentInfo>());
|
||||
Brief->Children.emplace_back(std::make_unique<CommentInfo>());
|
||||
Brief->Children.back()->Kind = "TextComment";
|
||||
Brief->Children.back()->Name = "ParagraphComment";
|
||||
Brief->Children.back()->Text = " Brief description.";
|
||||
|
||||
Top.Children.emplace_back(llvm::make_unique<CommentInfo>());
|
||||
Top.Children.emplace_back(std::make_unique<CommentInfo>());
|
||||
CommentInfo *Extended = Top.Children.back().get();
|
||||
Extended->Kind = "ParagraphComment";
|
||||
Extended->Children.emplace_back(llvm::make_unique<CommentInfo>());
|
||||
Extended->Children.emplace_back(std::make_unique<CommentInfo>());
|
||||
Extended->Children.back()->Kind = "TextComment";
|
||||
Extended->Children.back()->Text = " Extended description that";
|
||||
Extended->Children.emplace_back(llvm::make_unique<CommentInfo>());
|
||||
Extended->Children.emplace_back(std::make_unique<CommentInfo>());
|
||||
Extended->Children.back()->Kind = "TextComment";
|
||||
Extended->Children.back()->Text = " continues onto the next line.";
|
||||
|
||||
Top.Children.emplace_back(llvm::make_unique<CommentInfo>());
|
||||
Top.Children.emplace_back(std::make_unique<CommentInfo>());
|
||||
CommentInfo *HTML = Top.Children.back().get();
|
||||
HTML->Kind = "ParagraphComment";
|
||||
HTML->Children.emplace_back(llvm::make_unique<CommentInfo>());
|
||||
HTML->Children.emplace_back(std::make_unique<CommentInfo>());
|
||||
HTML->Children.back()->Kind = "TextComment";
|
||||
HTML->Children.emplace_back(llvm::make_unique<CommentInfo>());
|
||||
HTML->Children.emplace_back(std::make_unique<CommentInfo>());
|
||||
HTML->Children.back()->Kind = "HTMLStartTagComment";
|
||||
HTML->Children.back()->Name = "ul";
|
||||
HTML->Children.back()->AttrKeys.emplace_back("class");
|
||||
HTML->Children.back()->AttrValues.emplace_back("test");
|
||||
HTML->Children.emplace_back(llvm::make_unique<CommentInfo>());
|
||||
HTML->Children.emplace_back(std::make_unique<CommentInfo>());
|
||||
HTML->Children.back()->Kind = "HTMLStartTagComment";
|
||||
HTML->Children.back()->Name = "li";
|
||||
HTML->Children.emplace_back(llvm::make_unique<CommentInfo>());
|
||||
HTML->Children.emplace_back(std::make_unique<CommentInfo>());
|
||||
HTML->Children.back()->Kind = "TextComment";
|
||||
HTML->Children.back()->Text = " Testing.";
|
||||
HTML->Children.emplace_back(llvm::make_unique<CommentInfo>());
|
||||
HTML->Children.emplace_back(std::make_unique<CommentInfo>());
|
||||
HTML->Children.back()->Kind = "HTMLEndTagComment";
|
||||
HTML->Children.back()->Name = "ul";
|
||||
HTML->Children.back()->SelfClosing = true;
|
||||
|
||||
Top.Children.emplace_back(llvm::make_unique<CommentInfo>());
|
||||
Top.Children.emplace_back(std::make_unique<CommentInfo>());
|
||||
CommentInfo *Verbatim = Top.Children.back().get();
|
||||
Verbatim->Kind = "VerbatimBlockComment";
|
||||
Verbatim->Name = "verbatim";
|
||||
Verbatim->CloseName = "endverbatim";
|
||||
Verbatim->Children.emplace_back(llvm::make_unique<CommentInfo>());
|
||||
Verbatim->Children.emplace_back(std::make_unique<CommentInfo>());
|
||||
Verbatim->Children.back()->Kind = "VerbatimBlockLineComment";
|
||||
Verbatim->Children.back()->Text = " The description continues.";
|
||||
|
||||
Top.Children.emplace_back(llvm::make_unique<CommentInfo>());
|
||||
Top.Children.emplace_back(std::make_unique<CommentInfo>());
|
||||
CommentInfo *ParamOut = Top.Children.back().get();
|
||||
ParamOut->Kind = "ParamCommandComment";
|
||||
ParamOut->Direction = "[out]";
|
||||
ParamOut->ParamName = "I";
|
||||
ParamOut->Explicit = true;
|
||||
ParamOut->Children.emplace_back(llvm::make_unique<CommentInfo>());
|
||||
ParamOut->Children.emplace_back(std::make_unique<CommentInfo>());
|
||||
ParamOut->Children.back()->Kind = "ParagraphComment";
|
||||
ParamOut->Children.back()->Children.emplace_back(
|
||||
llvm::make_unique<CommentInfo>());
|
||||
std::make_unique<CommentInfo>());
|
||||
ParamOut->Children.back()->Children.back()->Kind = "TextComment";
|
||||
ParamOut->Children.back()->Children.emplace_back(
|
||||
llvm::make_unique<CommentInfo>());
|
||||
std::make_unique<CommentInfo>());
|
||||
ParamOut->Children.back()->Children.back()->Kind = "TextComment";
|
||||
ParamOut->Children.back()->Children.back()->Text = " is a parameter.";
|
||||
|
||||
Top.Children.emplace_back(llvm::make_unique<CommentInfo>());
|
||||
Top.Children.emplace_back(std::make_unique<CommentInfo>());
|
||||
CommentInfo *ParamIn = Top.Children.back().get();
|
||||
ParamIn->Kind = "ParamCommandComment";
|
||||
ParamIn->Direction = "[in]";
|
||||
ParamIn->ParamName = "J";
|
||||
ParamIn->Children.emplace_back(llvm::make_unique<CommentInfo>());
|
||||
ParamIn->Children.emplace_back(std::make_unique<CommentInfo>());
|
||||
ParamIn->Children.back()->Kind = "ParagraphComment";
|
||||
ParamIn->Children.back()->Children.emplace_back(
|
||||
llvm::make_unique<CommentInfo>());
|
||||
std::make_unique<CommentInfo>());
|
||||
ParamIn->Children.back()->Children.back()->Kind = "TextComment";
|
||||
ParamIn->Children.back()->Children.back()->Text = " is a parameter.";
|
||||
ParamIn->Children.back()->Children.emplace_back(
|
||||
llvm::make_unique<CommentInfo>());
|
||||
std::make_unique<CommentInfo>());
|
||||
ParamIn->Children.back()->Children.back()->Kind = "TextComment";
|
||||
|
||||
Top.Children.emplace_back(llvm::make_unique<CommentInfo>());
|
||||
Top.Children.emplace_back(std::make_unique<CommentInfo>());
|
||||
CommentInfo *Return = Top.Children.back().get();
|
||||
Return->Kind = "BlockCommandComment";
|
||||
Return->Name = "return";
|
||||
Return->Explicit = true;
|
||||
Return->Children.emplace_back(llvm::make_unique<CommentInfo>());
|
||||
Return->Children.emplace_back(std::make_unique<CommentInfo>());
|
||||
Return->Children.back()->Kind = "ParagraphComment";
|
||||
Return->Children.back()->Children.emplace_back(
|
||||
llvm::make_unique<CommentInfo>());
|
||||
std::make_unique<CommentInfo>());
|
||||
Return->Children.back()->Children.back()->Kind = "TextComment";
|
||||
Return->Children.back()->Children.back()->Text = "void";
|
||||
|
||||
|
@ -43,10 +43,10 @@ TEST(MergeTest, mergeNamespaceInfos) {
|
||||
Two.ChildEnums.back().Name = "TwoEnum";
|
||||
|
||||
std::vector<std::unique_ptr<Info>> Infos;
|
||||
Infos.emplace_back(llvm::make_unique<NamespaceInfo>(std::move(One)));
|
||||
Infos.emplace_back(llvm::make_unique<NamespaceInfo>(std::move(Two)));
|
||||
Infos.emplace_back(std::make_unique<NamespaceInfo>(std::move(One)));
|
||||
Infos.emplace_back(std::make_unique<NamespaceInfo>(std::move(Two)));
|
||||
|
||||
auto Expected = llvm::make_unique<NamespaceInfo>();
|
||||
auto Expected = std::make_unique<NamespaceInfo>();
|
||||
Expected->Name = "Namespace";
|
||||
Expected->Namespace.emplace_back(EmptySID, "A", InfoType::IT_namespace);
|
||||
|
||||
@ -112,10 +112,10 @@ TEST(MergeTest, mergeRecordInfos) {
|
||||
Two.ChildEnums.back().Name = "TwoEnum";
|
||||
|
||||
std::vector<std::unique_ptr<Info>> Infos;
|
||||
Infos.emplace_back(llvm::make_unique<RecordInfo>(std::move(One)));
|
||||
Infos.emplace_back(llvm::make_unique<RecordInfo>(std::move(Two)));
|
||||
Infos.emplace_back(std::make_unique<RecordInfo>(std::move(One)));
|
||||
Infos.emplace_back(std::make_unique<RecordInfo>(std::move(Two)));
|
||||
|
||||
auto Expected = llvm::make_unique<RecordInfo>();
|
||||
auto Expected = std::make_unique<RecordInfo>();
|
||||
Expected->Name = "r";
|
||||
Expected->Namespace.emplace_back(EmptySID, "A", InfoType::IT_namespace);
|
||||
|
||||
@ -160,9 +160,9 @@ TEST(MergeTest, mergeFunctionInfos) {
|
||||
One.Description.emplace_back();
|
||||
auto OneFullComment = &One.Description.back();
|
||||
OneFullComment->Kind = "FullComment";
|
||||
auto OneParagraphComment = llvm::make_unique<CommentInfo>();
|
||||
auto OneParagraphComment = std::make_unique<CommentInfo>();
|
||||
OneParagraphComment->Kind = "ParagraphComment";
|
||||
auto OneTextComment = llvm::make_unique<CommentInfo>();
|
||||
auto OneTextComment = std::make_unique<CommentInfo>();
|
||||
OneTextComment->Kind = "TextComment";
|
||||
OneTextComment->Text = "This is a text comment.";
|
||||
OneParagraphComment->Children.push_back(std::move(OneTextComment));
|
||||
@ -180,19 +180,19 @@ TEST(MergeTest, mergeFunctionInfos) {
|
||||
Two.Description.emplace_back();
|
||||
auto TwoFullComment = &Two.Description.back();
|
||||
TwoFullComment->Kind = "FullComment";
|
||||
auto TwoParagraphComment = llvm::make_unique<CommentInfo>();
|
||||
auto TwoParagraphComment = std::make_unique<CommentInfo>();
|
||||
TwoParagraphComment->Kind = "ParagraphComment";
|
||||
auto TwoTextComment = llvm::make_unique<CommentInfo>();
|
||||
auto TwoTextComment = std::make_unique<CommentInfo>();
|
||||
TwoTextComment->Kind = "TextComment";
|
||||
TwoTextComment->Text = "This is a text comment.";
|
||||
TwoParagraphComment->Children.push_back(std::move(TwoTextComment));
|
||||
TwoFullComment->Children.push_back(std::move(TwoParagraphComment));
|
||||
|
||||
std::vector<std::unique_ptr<Info>> Infos;
|
||||
Infos.emplace_back(llvm::make_unique<FunctionInfo>(std::move(One)));
|
||||
Infos.emplace_back(llvm::make_unique<FunctionInfo>(std::move(Two)));
|
||||
Infos.emplace_back(std::make_unique<FunctionInfo>(std::move(One)));
|
||||
Infos.emplace_back(std::make_unique<FunctionInfo>(std::move(Two)));
|
||||
|
||||
auto Expected = llvm::make_unique<FunctionInfo>();
|
||||
auto Expected = std::make_unique<FunctionInfo>();
|
||||
Expected->Name = "f";
|
||||
Expected->Namespace.emplace_back(EmptySID, "A", InfoType::IT_namespace);
|
||||
|
||||
@ -207,9 +207,9 @@ TEST(MergeTest, mergeFunctionInfos) {
|
||||
Expected->Description.emplace_back();
|
||||
auto ExpectedFullComment = &Expected->Description.back();
|
||||
ExpectedFullComment->Kind = "FullComment";
|
||||
auto ExpectedParagraphComment = llvm::make_unique<CommentInfo>();
|
||||
auto ExpectedParagraphComment = std::make_unique<CommentInfo>();
|
||||
ExpectedParagraphComment->Kind = "ParagraphComment";
|
||||
auto ExpectedTextComment = llvm::make_unique<CommentInfo>();
|
||||
auto ExpectedTextComment = std::make_unique<CommentInfo>();
|
||||
ExpectedTextComment->Kind = "TextComment";
|
||||
ExpectedTextComment->Text = "This is a text comment.";
|
||||
ExpectedParagraphComment->Children.push_back(std::move(ExpectedTextComment));
|
||||
@ -241,10 +241,10 @@ TEST(MergeTest, mergeEnumInfos) {
|
||||
Two.Members.emplace_back("Y");
|
||||
|
||||
std::vector<std::unique_ptr<Info>> Infos;
|
||||
Infos.emplace_back(llvm::make_unique<EnumInfo>(std::move(One)));
|
||||
Infos.emplace_back(llvm::make_unique<EnumInfo>(std::move(Two)));
|
||||
Infos.emplace_back(std::make_unique<EnumInfo>(std::move(One)));
|
||||
Infos.emplace_back(std::make_unique<EnumInfo>(std::move(Two)));
|
||||
|
||||
auto Expected = llvm::make_unique<EnumInfo>();
|
||||
auto Expected = std::make_unique<EnumInfo>();
|
||||
Expected->Name = "e";
|
||||
Expected->Namespace.emplace_back(EmptySID, "A", InfoType::IT_namespace);
|
||||
|
||||
|
@ -246,100 +246,100 @@ TEST(YAMLGeneratorTest, emitCommentYAML) {
|
||||
CommentInfo Top;
|
||||
Top.Kind = "FullComment";
|
||||
|
||||
Top.Children.emplace_back(llvm::make_unique<CommentInfo>());
|
||||
Top.Children.emplace_back(std::make_unique<CommentInfo>());
|
||||
CommentInfo *BlankLine = Top.Children.back().get();
|
||||
BlankLine->Kind = "ParagraphComment";
|
||||
BlankLine->Children.emplace_back(llvm::make_unique<CommentInfo>());
|
||||
BlankLine->Children.emplace_back(std::make_unique<CommentInfo>());
|
||||
BlankLine->Children.back()->Kind = "TextComment";
|
||||
|
||||
Top.Children.emplace_back(llvm::make_unique<CommentInfo>());
|
||||
Top.Children.emplace_back(std::make_unique<CommentInfo>());
|
||||
CommentInfo *Brief = Top.Children.back().get();
|
||||
Brief->Kind = "ParagraphComment";
|
||||
Brief->Children.emplace_back(llvm::make_unique<CommentInfo>());
|
||||
Brief->Children.emplace_back(std::make_unique<CommentInfo>());
|
||||
Brief->Children.back()->Kind = "TextComment";
|
||||
Brief->Children.back()->Name = "ParagraphComment";
|
||||
Brief->Children.back()->Text = " Brief description.";
|
||||
|
||||
Top.Children.emplace_back(llvm::make_unique<CommentInfo>());
|
||||
Top.Children.emplace_back(std::make_unique<CommentInfo>());
|
||||
CommentInfo *Extended = Top.Children.back().get();
|
||||
Extended->Kind = "ParagraphComment";
|
||||
Extended->Children.emplace_back(llvm::make_unique<CommentInfo>());
|
||||
Extended->Children.emplace_back(std::make_unique<CommentInfo>());
|
||||
Extended->Children.back()->Kind = "TextComment";
|
||||
Extended->Children.back()->Text = " Extended description that";
|
||||
Extended->Children.emplace_back(llvm::make_unique<CommentInfo>());
|
||||
Extended->Children.emplace_back(std::make_unique<CommentInfo>());
|
||||
Extended->Children.back()->Kind = "TextComment";
|
||||
Extended->Children.back()->Text = " continues onto the next line.";
|
||||
|
||||
Top.Children.emplace_back(llvm::make_unique<CommentInfo>());
|
||||
Top.Children.emplace_back(std::make_unique<CommentInfo>());
|
||||
CommentInfo *HTML = Top.Children.back().get();
|
||||
HTML->Kind = "ParagraphComment";
|
||||
HTML->Children.emplace_back(llvm::make_unique<CommentInfo>());
|
||||
HTML->Children.emplace_back(std::make_unique<CommentInfo>());
|
||||
HTML->Children.back()->Kind = "TextComment";
|
||||
HTML->Children.emplace_back(llvm::make_unique<CommentInfo>());
|
||||
HTML->Children.emplace_back(std::make_unique<CommentInfo>());
|
||||
HTML->Children.back()->Kind = "HTMLStartTagComment";
|
||||
HTML->Children.back()->Name = "ul";
|
||||
HTML->Children.back()->AttrKeys.emplace_back("class");
|
||||
HTML->Children.back()->AttrValues.emplace_back("test");
|
||||
HTML->Children.emplace_back(llvm::make_unique<CommentInfo>());
|
||||
HTML->Children.emplace_back(std::make_unique<CommentInfo>());
|
||||
HTML->Children.back()->Kind = "HTMLStartTagComment";
|
||||
HTML->Children.back()->Name = "li";
|
||||
HTML->Children.emplace_back(llvm::make_unique<CommentInfo>());
|
||||
HTML->Children.emplace_back(std::make_unique<CommentInfo>());
|
||||
HTML->Children.back()->Kind = "TextComment";
|
||||
HTML->Children.back()->Text = " Testing.";
|
||||
HTML->Children.emplace_back(llvm::make_unique<CommentInfo>());
|
||||
HTML->Children.emplace_back(std::make_unique<CommentInfo>());
|
||||
HTML->Children.back()->Kind = "HTMLEndTagComment";
|
||||
HTML->Children.back()->Name = "ul";
|
||||
HTML->Children.back()->SelfClosing = true;
|
||||
|
||||
Top.Children.emplace_back(llvm::make_unique<CommentInfo>());
|
||||
Top.Children.emplace_back(std::make_unique<CommentInfo>());
|
||||
CommentInfo *Verbatim = Top.Children.back().get();
|
||||
Verbatim->Kind = "VerbatimBlockComment";
|
||||
Verbatim->Name = "verbatim";
|
||||
Verbatim->CloseName = "endverbatim";
|
||||
Verbatim->Children.emplace_back(llvm::make_unique<CommentInfo>());
|
||||
Verbatim->Children.emplace_back(std::make_unique<CommentInfo>());
|
||||
Verbatim->Children.back()->Kind = "VerbatimBlockLineComment";
|
||||
Verbatim->Children.back()->Text = " The description continues.";
|
||||
|
||||
Top.Children.emplace_back(llvm::make_unique<CommentInfo>());
|
||||
Top.Children.emplace_back(std::make_unique<CommentInfo>());
|
||||
CommentInfo *ParamOut = Top.Children.back().get();
|
||||
ParamOut->Kind = "ParamCommandComment";
|
||||
ParamOut->Direction = "[out]";
|
||||
ParamOut->ParamName = "I";
|
||||
ParamOut->Explicit = true;
|
||||
ParamOut->Children.emplace_back(llvm::make_unique<CommentInfo>());
|
||||
ParamOut->Children.emplace_back(std::make_unique<CommentInfo>());
|
||||
ParamOut->Children.back()->Kind = "ParagraphComment";
|
||||
ParamOut->Children.back()->Children.emplace_back(
|
||||
llvm::make_unique<CommentInfo>());
|
||||
std::make_unique<CommentInfo>());
|
||||
ParamOut->Children.back()->Children.back()->Kind = "TextComment";
|
||||
ParamOut->Children.back()->Children.emplace_back(
|
||||
llvm::make_unique<CommentInfo>());
|
||||
std::make_unique<CommentInfo>());
|
||||
ParamOut->Children.back()->Children.back()->Kind = "TextComment";
|
||||
ParamOut->Children.back()->Children.back()->Text = " is a parameter.";
|
||||
|
||||
Top.Children.emplace_back(llvm::make_unique<CommentInfo>());
|
||||
Top.Children.emplace_back(std::make_unique<CommentInfo>());
|
||||
CommentInfo *ParamIn = Top.Children.back().get();
|
||||
ParamIn->Kind = "ParamCommandComment";
|
||||
ParamIn->Direction = "[in]";
|
||||
ParamIn->ParamName = "J";
|
||||
ParamIn->Children.emplace_back(llvm::make_unique<CommentInfo>());
|
||||
ParamIn->Children.emplace_back(std::make_unique<CommentInfo>());
|
||||
ParamIn->Children.back()->Kind = "ParagraphComment";
|
||||
ParamIn->Children.back()->Children.emplace_back(
|
||||
llvm::make_unique<CommentInfo>());
|
||||
std::make_unique<CommentInfo>());
|
||||
ParamIn->Children.back()->Children.back()->Kind = "TextComment";
|
||||
ParamIn->Children.back()->Children.back()->Text = " is a parameter.";
|
||||
ParamIn->Children.back()->Children.emplace_back(
|
||||
llvm::make_unique<CommentInfo>());
|
||||
std::make_unique<CommentInfo>());
|
||||
ParamIn->Children.back()->Children.back()->Kind = "TextComment";
|
||||
|
||||
Top.Children.emplace_back(llvm::make_unique<CommentInfo>());
|
||||
Top.Children.emplace_back(std::make_unique<CommentInfo>());
|
||||
CommentInfo *Return = Top.Children.back().get();
|
||||
Return->Kind = "BlockCommandComment";
|
||||
Return->Name = "return";
|
||||
Return->Explicit = true;
|
||||
Return->Children.emplace_back(llvm::make_unique<CommentInfo>());
|
||||
Return->Children.emplace_back(std::make_unique<CommentInfo>());
|
||||
Return->Children.back()->Kind = "ParagraphComment";
|
||||
Return->Children.back()->Children.emplace_back(
|
||||
llvm::make_unique<CommentInfo>());
|
||||
std::make_unique<CommentInfo>());
|
||||
Return->Children.back()->Children.back()->Kind = "TextComment";
|
||||
Return->Children.back()->Children.back()->Text = "void";
|
||||
|
||||
|
@ -92,9 +92,9 @@ static std::string runIncludeFixer(
|
||||
{SymbolInfo("foo2", SymbolInfo::SymbolKind::Class, "\"foo2.h\"", {}),
|
||||
SymbolInfo::Signals{}},
|
||||
};
|
||||
auto SymbolIndexMgr = llvm::make_unique<SymbolIndexManager>();
|
||||
auto SymbolIndexMgr = std::make_unique<SymbolIndexManager>();
|
||||
SymbolIndexMgr->addSymbolIndex(
|
||||
[=]() { return llvm::make_unique<InMemorySymbolIndex>(Symbols); });
|
||||
[=]() { return std::make_unique<InMemorySymbolIndex>(Symbols); });
|
||||
|
||||
std::vector<IncludeFixerContext> FixerContexts;
|
||||
IncludeFixerActionFactory Factory(*SymbolIndexMgr, FixerContexts, "llvm");
|
||||
|
@ -227,7 +227,7 @@ runClangMoveOnCode(const move::MoveDefinitionSpec &Spec,
|
||||
ClangMoveContext MoveContext = {Spec, FileToReplacements, WorkingDir, "LLVM",
|
||||
Reporter != nullptr};
|
||||
|
||||
auto Factory = llvm::make_unique<clang::move::ClangMoveActionFactory>(
|
||||
auto Factory = std::make_unique<clang::move::ClangMoveActionFactory>(
|
||||
&MoveContext, Reporter);
|
||||
|
||||
// std::string IncludeArg = Twine("-I" + WorkingDir;
|
||||
|
@ -40,7 +40,7 @@ template <typename Check> struct CheckFactory<Check> {
|
||||
static void
|
||||
createChecks(ClangTidyContext *Context,
|
||||
SmallVectorImpl<std::unique_ptr<ClangTidyCheck>> &Result) {
|
||||
Result.emplace_back(llvm::make_unique<Check>(
|
||||
Result.emplace_back(std::make_unique<Check>(
|
||||
"test-check-" + std::to_string(Result.size()), Context));
|
||||
}
|
||||
};
|
||||
@ -88,7 +88,7 @@ runCheckOnCode(StringRef Code, std::vector<ClangTidyError> *Errors = nullptr,
|
||||
std::map<StringRef, StringRef>()) {
|
||||
ClangTidyOptions Options = ExtraOptions;
|
||||
Options.Checks = "*";
|
||||
ClangTidyContext Context(llvm::make_unique<DefaultOptionsProvider>(
|
||||
ClangTidyContext Context(std::make_unique<DefaultOptionsProvider>(
|
||||
ClangTidyGlobalOptions(), Options));
|
||||
ClangTidyDiagnosticConsumer DiagConsumer(Context);
|
||||
DiagnosticsEngine DE(new DiagnosticIDs(), new DiagnosticOptions,
|
||||
|
@ -33,7 +33,7 @@ public:
|
||||
|
||||
void registerPPCallbacks(const SourceManager &SM, Preprocessor *PP,
|
||||
Preprocessor *ModuleExpanderPP) override {
|
||||
Inserter = llvm::make_unique<utils::IncludeInserter>(
|
||||
Inserter = std::make_unique<utils::IncludeInserter>(
|
||||
SM, getLangOpts(), utils::IncludeSorter::IS_Google);
|
||||
PP->addPPCallbacks(Inserter->CreatePPCallbacks());
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user