|
@@ -27,7 +27,7 @@ namespace AZ::ShaderCompiler
|
|
|
return iter == m_symbols.cend() ? nullptr : &(*iter);
|
|
|
}
|
|
|
|
|
|
- bool SymbolTable::DeleteIdentifier(IdentifierUID name)
|
|
|
+ bool SymbolTable::DeleteIdentifier(const IdentifierUID& name)
|
|
|
{
|
|
|
auto iter = m_symbols.find(name);
|
|
|
bool found = iter != m_symbols.end();
|
|
@@ -40,6 +40,17 @@ namespace AZ::ShaderCompiler
|
|
|
return found;
|
|
|
}
|
|
|
|
|
|
+ void SymbolTable::MigrateOrder(const IdentifierUID& symbol, const IdentifierUID& before)
|
|
|
+ {
|
|
|
+ // For use in PadToAttributeMutator::InsertPaddingVariables::createVariableInSymbolTable
|
|
|
+ auto beforeSymbolIter = std::find(m_order.begin(), m_order.end(), before);
|
|
|
+ if (beforeSymbolIter != m_order.end())
|
|
|
+ {
|
|
|
+ m_order.erase(std::remove(m_order.begin(), m_order.end(), symbol), m_order.end());
|
|
|
+ m_order.insert(beforeSymbolIter, symbol);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
IdAndKind& SymbolTable::AddIdentifier(QualifiedNameView symbol, Kind kind, optional<size_t> lineNumber /*= none*/)
|
|
|
{
|
|
|
IdentifierUID idUID{symbol};
|
|
@@ -56,13 +67,6 @@ namespace AZ::ShaderCompiler
|
|
|
ConcatString("ODR (One Definition Rule) violation. Redeclaration of ",
|
|
|
Kind::ToStr(kind), " ", ExtractLeaf(symbol), " in ", LevelUp(symbol), " ",
|
|
|
GetFirstSeenLineMessage(fetchedIdIt->second), "\n"));
|
|
|
-
|
|
|
- // Since a redeclaration becomes the new identity, we must erase its old appearance in the order list:
|
|
|
- // (motivated by the requirement that if we emit a function body, it can't be at the site of its first declaration.
|
|
|
- // since the definition is the only guaranteed place where the body will not refer to yet-undeclared symbols)
|
|
|
- // As a bonus, it also cleans-up the --dumpsym option which had duplicated output.
|
|
|
- // (reinstates the invariant of unicity of apparition)
|
|
|
- m_order.erase(std::remove(m_order.begin(), m_order.end(), fetchedIdIt->first), m_order.end());
|
|
|
}
|
|
|
}
|
|
|
else
|