use llvm::make_unique for consistency. (#1283)
Use llvm::make_unique instead of std::make_unique. This fixes some compiler errors on linux and makes the code more consistent with the rest of the code base.
This commit is contained in:
Родитель
5fa044e4a8
Коммит
11bc335540
|
@ -74,7 +74,7 @@ bool DxilAddPixelHitInstrumentation::runOnModule(Module &M)
|
|||
// about the shader having selected components that don't include x or y.
|
||||
// If not present, we add it.
|
||||
if ( SV_Position == InputElements.end() ) {
|
||||
auto SVPosition = std::make_unique<DxilSignatureElement>(DXIL::SigPointKind::PSIn);
|
||||
auto SVPosition = llvm::make_unique<DxilSignatureElement>(DXIL::SigPointKind::PSIn);
|
||||
SVPosition->Initialize("Position", hlsl::CompType::getF32(), hlsl::DXIL::InterpolationMode::Linear, 1, 4, SVPositionIndex == -1 ? 0 : SVPositionIndex, 0);
|
||||
SVPosition->AppendSemanticIndex(0);
|
||||
SVPosition->SetSigPointKind(DXIL::SigPointKind::PSIn);
|
||||
|
|
|
@ -263,7 +263,7 @@ DxilDebugInstrumentation::SystemValueIndices DxilDebugInstrumentation::addRequir
|
|||
// about the shader having selected components that don't include x or y.
|
||||
// If not present, we add it.
|
||||
if (Existing_SV_Position == InputElements.end()) {
|
||||
auto Added_SV_Position = std::make_unique<DxilSignatureElement>(DXIL::SigPointKind::PSIn);
|
||||
auto Added_SV_Position = llvm::make_unique<DxilSignatureElement>(DXIL::SigPointKind::PSIn);
|
||||
Added_SV_Position->Initialize("Position", hlsl::CompType::getF32(), hlsl::DXIL::InterpolationMode::Linear, 1, 4);
|
||||
Added_SV_Position->AppendSemanticIndex(0);
|
||||
Added_SV_Position->SetSigPointKind(DXIL::SigPointKind::PSIn);
|
||||
|
@ -285,7 +285,7 @@ DxilDebugInstrumentation::SystemValueIndices DxilDebugInstrumentation::addRequir
|
|||
return Element->GetSemantic()->GetKind() == hlsl::DXIL::SemanticKind::VertexID; });
|
||||
|
||||
if (Existing_SV_VertexId == InputElements.end()) {
|
||||
auto Added_SV_VertexId = std::make_unique<DxilSignatureElement>(DXIL::SigPointKind::VSIn);
|
||||
auto Added_SV_VertexId = llvm::make_unique<DxilSignatureElement>(DXIL::SigPointKind::VSIn);
|
||||
Added_SV_VertexId->Initialize("VertexId", hlsl::CompType::getF32(), hlsl::DXIL::InterpolationMode::Undefined, 1, 1);
|
||||
Added_SV_VertexId->AppendSemanticIndex(0);
|
||||
Added_SV_VertexId->SetSigPointKind(DXIL::SigPointKind::VSIn);
|
||||
|
@ -305,7 +305,7 @@ DxilDebugInstrumentation::SystemValueIndices DxilDebugInstrumentation::addRequir
|
|||
return Element->GetSemantic()->GetKind() == hlsl::DXIL::SemanticKind::InstanceID; });
|
||||
|
||||
if (Existing_SV_InstanceId == InputElements.end()) {
|
||||
auto Added_SV_InstanceId = std::make_unique<DxilSignatureElement>(DXIL::SigPointKind::VSIn);
|
||||
auto Added_SV_InstanceId = llvm::make_unique<DxilSignatureElement>(DXIL::SigPointKind::VSIn);
|
||||
Added_SV_InstanceId->Initialize("InstanceId", hlsl::CompType::getF32(), hlsl::DXIL::InterpolationMode::Undefined, 1, 1);
|
||||
Added_SV_InstanceId->AppendSemanticIndex(0);
|
||||
Added_SV_InstanceId->SetSigPointKind(DXIL::SigPointKind::VSIn);
|
||||
|
|
|
@ -123,7 +123,7 @@ void InitDxilModuleFromHLModule(HLModule &H, DxilModule &M, DxilEntrySignature *
|
|||
|
||||
// Resources
|
||||
for (auto && C : H.GetCBuffers()) {
|
||||
auto b = make_unique<DxilCBuffer>();
|
||||
auto b = llvm::make_unique<DxilCBuffer>();
|
||||
InitResourceBase(C.get(), b.get());
|
||||
b->SetSize(C->GetSize());
|
||||
if (HasDebugInfo)
|
||||
|
@ -133,7 +133,7 @@ void InitDxilModuleFromHLModule(HLModule &H, DxilModule &M, DxilEntrySignature *
|
|||
M.AddCBuffer(std::move(b));
|
||||
}
|
||||
for (auto && C : H.GetUAVs()) {
|
||||
auto b = make_unique<DxilResource>();
|
||||
auto b = llvm::make_unique<DxilResource>();
|
||||
InitResource(C.get(), b.get());
|
||||
if (HasDebugInfo)
|
||||
LLVMUsed.emplace_back(cast<GlobalVariable>(b->GetGlobalSymbol()));
|
||||
|
@ -142,7 +142,7 @@ void InitDxilModuleFromHLModule(HLModule &H, DxilModule &M, DxilEntrySignature *
|
|||
M.AddUAV(std::move(b));
|
||||
}
|
||||
for (auto && C : H.GetSRVs()) {
|
||||
auto b = make_unique<DxilResource>();
|
||||
auto b = llvm::make_unique<DxilResource>();
|
||||
InitResource(C.get(), b.get());
|
||||
if (HasDebugInfo)
|
||||
LLVMUsed.emplace_back(cast<GlobalVariable>(b->GetGlobalSymbol()));
|
||||
|
@ -151,7 +151,7 @@ void InitDxilModuleFromHLModule(HLModule &H, DxilModule &M, DxilEntrySignature *
|
|||
M.AddSRV(std::move(b));
|
||||
}
|
||||
for (auto && C : H.GetSamplers()) {
|
||||
auto b = make_unique<DxilSampler>();
|
||||
auto b = llvm::make_unique<DxilSampler>();
|
||||
InitResourceBase(C.get(), b.get());
|
||||
b->SetSamplerKind(C->GetSamplerKind());
|
||||
if (HasDebugInfo)
|
||||
|
@ -593,9 +593,9 @@ void DxilGenerationPass::TranslateDxilResourceUses(
|
|||
// Must be instruction for multi dim array.
|
||||
std::unique_ptr<IRBuilder<> > Builder;
|
||||
if (GetElementPtrInst *GEPInst = dyn_cast<GetElementPtrInst>(GEP)) {
|
||||
Builder = std::make_unique<IRBuilder<> >(GEPInst);
|
||||
Builder = llvm::make_unique<IRBuilder<> >(GEPInst);
|
||||
} else {
|
||||
Builder = std::make_unique<IRBuilder<> >(GV->getContext());
|
||||
Builder = llvm::make_unique<IRBuilder<> >(GV->getContext());
|
||||
}
|
||||
for (; GEPIt != E; ++GEPIt) {
|
||||
if (GEPIt->isArrayTy()) {
|
||||
|
|
|
@ -595,7 +595,7 @@ DxilLinkJob::Link(std::pair<DxilFunctionLinkInfo *, DxilLib *> &entryLinkPair,
|
|||
// Add signature.
|
||||
DxilEntrySignature &entrySig = entryDM.GetDxilEntrySignature(entryFunc);
|
||||
std::unique_ptr<DxilEntrySignature> newSig =
|
||||
std::make_unique<DxilEntrySignature>(entrySig);
|
||||
llvm::make_unique<DxilEntrySignature>(entrySig);
|
||||
DM.ResetEntrySignature(newSig.release());
|
||||
}
|
||||
|
||||
|
@ -768,7 +768,7 @@ bool DxilLinkerImpl::RegisterLib(StringRef name,
|
|||
|
||||
pM->setModuleIdentifier(name);
|
||||
std::unique_ptr<DxilLib> pLib =
|
||||
std::make_unique<DxilLib>(std::move(pM));
|
||||
llvm::make_unique<DxilLib>(std::move(pM));
|
||||
m_LibMap[name] = std::move(pLib);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -59,10 +59,10 @@ namespace hlsl {
|
|||
DxilModule::DxilModule(Module *pModule)
|
||||
: m_Ctx(pModule->getContext())
|
||||
, m_pModule(pModule)
|
||||
, m_pOP(std::make_unique<OP>(pModule->getContext(), pModule))
|
||||
, m_pTypeSystem(std::make_unique<DxilTypeSystem>(pModule))
|
||||
, m_pViewIdState(std::make_unique<DxilViewIdState>(this))
|
||||
, m_pMDHelper(std::make_unique<DxilMDHelper>(pModule, std::make_unique<DxilExtraPropertyHelper>(pModule)))
|
||||
, m_pOP(llvm::make_unique<OP>(pModule->getContext(), pModule))
|
||||
, m_pTypeSystem(llvm::make_unique<DxilTypeSystem>(pModule))
|
||||
, m_pViewIdState(llvm::make_unique<DxilViewIdState>(this))
|
||||
, m_pMDHelper(llvm::make_unique<DxilMDHelper>(pModule, llvm::make_unique<DxilExtraPropertyHelper>(pModule)))
|
||||
, m_pDebugInfoFinder(nullptr)
|
||||
, m_pEntryFunc(nullptr)
|
||||
, m_EntryName("")
|
||||
|
@ -1684,7 +1684,7 @@ void DxilModule::StripDebugRelatedCode() {
|
|||
}
|
||||
DebugInfoFinder &DxilModule::GetOrCreateDebugInfoFinder() {
|
||||
if (m_pDebugInfoFinder == nullptr) {
|
||||
m_pDebugInfoFinder = std::make_unique<llvm::DebugInfoFinder>();
|
||||
m_pDebugInfoFinder = llvm::make_unique<llvm::DebugInfoFinder>();
|
||||
m_pDebugInfoFinder->processModule(*m_pModule);
|
||||
}
|
||||
return *m_pDebugInfoFinder;
|
||||
|
@ -1763,7 +1763,7 @@ namespace llvm {
|
|||
hlsl::DxilModule &Module::GetOrCreateDxilModule(bool skipInit) {
|
||||
std::unique_ptr<hlsl::DxilModule> M;
|
||||
if (!HasDxilModule()) {
|
||||
M = std::make_unique<hlsl::DxilModule>(this);
|
||||
M = llvm::make_unique<hlsl::DxilModule>(this);
|
||||
if (!skipInit) {
|
||||
M->LoadDxilMetadata();
|
||||
}
|
||||
|
|
|
@ -6192,7 +6192,7 @@ void SROA_Parameter_HLSL::createFlattenedFunction(Function *F) {
|
|||
// ShaderProps.
|
||||
if (m_pHLModule->HasDxilFunctionProps(F)) {
|
||||
DxilFunctionProps &funcProps = m_pHLModule->GetDxilFunctionProps(F);
|
||||
std::unique_ptr<DxilFunctionProps> flatFuncProps = std::make_unique<DxilFunctionProps>();
|
||||
std::unique_ptr<DxilFunctionProps> flatFuncProps = llvm::make_unique<DxilFunctionProps>();
|
||||
flatFuncProps->shaderKind = funcProps.shaderKind;
|
||||
flatFuncProps->ShaderProps = funcProps.ShaderProps;
|
||||
m_pHLModule->AddDxilFunctionProps(flatF, flatFuncProps);
|
||||
|
|
|
@ -706,7 +706,7 @@ HLSLRootSignatureAction::HLSLRootSignatureAction(StringRef rootSigMacro,
|
|||
unsigned major, unsigned minor)
|
||||
: HLSLRootSignatureMacro(rootSigMacro), rootSigMajor(major),
|
||||
rootSigMinor(minor) {
|
||||
rootSigHandle = std::make_unique<hlsl::RootSignatureHandle>();
|
||||
rootSigHandle = llvm::make_unique<hlsl::RootSignatureHandle>();
|
||||
}
|
||||
|
||||
void HLSLRootSignatureAction::ExecuteAction() {
|
||||
|
|
|
@ -374,7 +374,7 @@ public:
|
|||
llvm::LLVMContext llvmContext; // LLVMContext should outlive CompilerInstance
|
||||
CompilerInstance compiler;
|
||||
std::unique_ptr<TextDiagnosticPrinter> diagPrinter =
|
||||
std::make_unique<TextDiagnosticPrinter>(w, &compiler.getDiagnosticOpts());
|
||||
llvm::make_unique<TextDiagnosticPrinter>(w, &compiler.getDiagnosticOpts());
|
||||
SetupCompilerForCompile(compiler, &m_langExtensionsHelper, utf8SourceName, diagPrinter.get(), defines, opts, pArguments, argCount);
|
||||
msfPtr->SetupForCompilerInstance(compiler);
|
||||
|
||||
|
@ -673,7 +673,7 @@ public:
|
|||
raw_stream_ostream outStream(pOutputStream.p);
|
||||
CompilerInstance compiler;
|
||||
std::unique_ptr<TextDiagnosticPrinter> diagPrinter =
|
||||
std::make_unique<TextDiagnosticPrinter>(w, &compiler.getDiagnosticOpts());
|
||||
llvm::make_unique<TextDiagnosticPrinter>(w, &compiler.getDiagnosticOpts());
|
||||
SetupCompilerForCompile(compiler, &m_langExtensionsHelper, utf8SourceName, diagPrinter.get(), defines, opts, pArguments, argCount);
|
||||
msfPtr->SetupForCompilerInstance(compiler);
|
||||
|
||||
|
|
|
@ -339,7 +339,7 @@ HRESULT DoRewriteUnused(_In_ DxcLangExtensionsHelper *pHelper,
|
|||
// Setup a compiler instance.
|
||||
CompilerInstance compiler;
|
||||
std::unique_ptr<TextDiagnosticPrinter> diagPrinter =
|
||||
std::make_unique<TextDiagnosticPrinter>(w, &compiler.getDiagnosticOpts());
|
||||
llvm::make_unique<TextDiagnosticPrinter>(w, &compiler.getDiagnosticOpts());
|
||||
SetupCompilerForRewrite(compiler, pHelper, pFileName, diagPrinter.get(), pRemap, pDefines);
|
||||
|
||||
// Parse the source file.
|
||||
|
@ -500,7 +500,7 @@ HRESULT DoSimpleReWrite(_In_ DxcLangExtensionsHelper *pHelper,
|
|||
// Setup a compiler instance.
|
||||
CompilerInstance compiler;
|
||||
std::unique_ptr<TextDiagnosticPrinter> diagPrinter =
|
||||
std::make_unique<TextDiagnosticPrinter>(w, &compiler.getDiagnosticOpts());
|
||||
llvm::make_unique<TextDiagnosticPrinter>(w, &compiler.getDiagnosticOpts());
|
||||
SetupCompilerForRewrite(compiler, pHelper, pFileName, diagPrinter.get(), pRemap, pDefines);
|
||||
|
||||
// Parse the source file.
|
||||
|
|
Загрузка…
Ссылка в новой задаче