Decorated entry variable name. (#250)

This commit is contained in:
charles-r-earp 2020-11-18 00:13:30 -08:00 committed by GitHub
parent a841cc845f
commit f564a67100
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,7 +4,7 @@ use crate::spirv_type::SpirvType;
use crate::symbols::{parse_attrs, Entry, SpirvAttribute}; use crate::symbols::{parse_attrs, Entry, SpirvAttribute};
use rspirv::dr::Operand; use rspirv::dr::Operand;
use rspirv::spirv::{Decoration, ExecutionModel, FunctionControl, StorageClass, Word}; use rspirv::spirv::{Decoration, ExecutionModel, FunctionControl, StorageClass, Word};
use rustc_hir::Param; use rustc_hir::{Param, PatKind};
use rustc_middle::ty::{Instance, Ty}; use rustc_middle::ty::{Instance, Ty};
use rustc_target::abi::call::{FnAbi, PassMode}; use rustc_target::abi::call::{FnAbi, PassMode};
use std::collections::HashMap; use std::collections::HashMap;
@ -148,6 +148,9 @@ impl<'tcx> CodegenCx<'tcx> {
); );
// Note: this *declares* the variable too. // Note: this *declares* the variable too.
let variable = self.emit_global().variable(arg, None, storage_class, None); let variable = self.emit_global().variable(arg, None, storage_class, None);
if let PatKind::Binding(_, _, ident, _) = &hir_param.pat.kind {
self.emit_global().name(variable, ident.to_string());
}
for attr in parse_attrs(self, hir_param.attrs) { for attr in parse_attrs(self, hir_param.attrs) {
match attr { match attr {
SpirvAttribute::Builtin(builtin) => { SpirvAttribute::Builtin(builtin) => {