Skip to content

Commit 81a05f3

Browse files
authored
Merge pull request #15083 from ethereum/rename_yulstring_to_yulname
replace YulString with YulName typedef
2 parents 01a3bb5 + 96fdcc3 commit 81a05f3

File tree

148 files changed

+879
-871
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

148 files changed

+879
-871
lines changed

libsolc/libsolc.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#include <libsolc/libsolc.h>
2525
#include <libsolidity/interface/StandardCompiler.h>
2626
#include <libsolidity/interface/Version.h>
27-
#include <libyul/YulString.h>
27+
#include <libyul/YulName.h>
2828

2929
#include <cstdlib>
3030
#include <list>

libsolidity/analysis/ReferencesResolver.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ void ReferencesResolver::resolveInheritDoc(StructuredDocumentation const& _docum
488488
}
489489
}
490490

491-
void ReferencesResolver::validateYulIdentifierName(yul::YulString _name, SourceLocation const& _location)
491+
void ReferencesResolver::validateYulIdentifierName(yul::YulName _name, SourceLocation const& _location)
492492
{
493493
if (util::contains(_name.str(), '.'))
494494
m_errorReporter.declarationError(

libsolidity/analysis/ReferencesResolver.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ class ReferencesResolver: private ASTConstVisitor, private yul::ASTWalker
9494
void resolveInheritDoc(StructuredDocumentation const& _documentation, StructurallyDocumentedAnnotation& _annotation);
9595

9696
/// Checks if the name contains a '.'.
97-
void validateYulIdentifierName(yul::YulString _name, langutil::SourceLocation const& _location);
97+
void validateYulIdentifierName(yul::YulName _name, langutil::SourceLocation const& _location);
9898

9999
langutil::ErrorReporter& m_errorReporter;
100100
NameAndTypeResolver& m_resolver;

libsolidity/codegen/CompilerContext.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
#include <libyul/backends/evm/EVMMetrics.h>
3939
#include <libyul/optimiser/Suite.h>
4040
#include <libyul/Object.h>
41-
#include <libyul/YulString.h>
41+
#include <libyul/YulName.h>
4242
#include <libyul/Utilities.h>
4343

4444
#include <libsolutil/Whiskers.h>
@@ -388,11 +388,11 @@ void CompilerContext::appendInlineAssembly(
388388
{
389389
unsigned startStackHeight = stackHeight();
390390

391-
std::set<yul::YulString> externallyUsedIdentifiers;
391+
std::set<yul::YulName> externallyUsedIdentifiers;
392392
for (auto const& fun: _externallyUsedFunctions)
393-
externallyUsedIdentifiers.insert(yul::YulString(fun));
393+
externallyUsedIdentifiers.insert(yul::YulName(fun));
394394
for (auto const& var: _localVariables)
395-
externallyUsedIdentifiers.insert(yul::YulString(var));
395+
externallyUsedIdentifiers.insert(yul::YulName(var));
396396

397397
yul::ExternalIdentifierAccess identifierAccess;
398398
identifierAccess.resolve = [&](
@@ -532,7 +532,7 @@ void CompilerContext::appendInlineAssembly(
532532
}
533533

534534

535-
void CompilerContext::optimizeYul(yul::Object& _object, yul::EVMDialect const& _dialect, OptimiserSettings const& _optimiserSettings, std::set<yul::YulString> const& _externalIdentifiers)
535+
void CompilerContext::optimizeYul(yul::Object& _object, yul::EVMDialect const& _dialect, OptimiserSettings const& _optimiserSettings, std::set<yul::YulName> const& _externalIdentifiers)
536536
{
537537
#ifdef SOL_OUTPUT_ASM
538538
cout << yul::AsmPrinter(*dialect)(*_object.code) << endl;

libsolidity/codegen/CompilerContext.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ class CompilerContext
277277
/// Otherwise returns "revert(0, 0)".
278278
std::string revertReasonIfDebug(std::string const& _message = "");
279279

280-
void optimizeYul(yul::Object& _object, yul::EVMDialect const& _dialect, OptimiserSettings const& _optimiserSetting, std::set<yul::YulString> const& _externalIdentifiers = {});
280+
void optimizeYul(yul::Object& _object, yul::EVMDialect const& _dialect, OptimiserSettings const& _optimiserSetting, std::set<yul::YulName> const& _externalIdentifiers = {});
281281

282282
/// Appends arbitrary data to the end of the bytecode.
283283
void appendToAuxiliaryData(bytes const& _data) { m_asm->appendToAuxiliaryData(_data); }

libsolidity/codegen/ContractCompiler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
#include <libyul/optimiser/Suite.h>
3939
#include <libyul/Object.h>
4040
#include <libyul/optimiser/ASTCopier.h>
41-
#include <libyul/YulString.h>
41+
#include <libyul/YulName.h>
4242

4343
#include <libevmasm/Instruction.h>
4444
#include <libevmasm/Assembly.h>

libsolidity/codegen/ir/IRGeneratorForStatements.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ struct CopyTranslate: public yul::ASTCopier
7878
return ASTCopier::operator()(_identifier);
7979
}
8080

81-
yul::YulString translateIdentifier(yul::YulString _name) override
81+
yul::YulName translateIdentifier(yul::YulName _name) override
8282
{
8383
// Strictly, the dialect used by inline assembly (m_dialect) could be different
8484
// from the Yul dialect we are compiling to. So we are assuming here that the builtin
@@ -87,7 +87,7 @@ struct CopyTranslate: public yul::ASTCopier
8787
if (m_dialect.builtin(_name))
8888
return _name;
8989
else
90-
return yul::YulString{"usr$" + _name.str()};
90+
return yul::YulName{"usr$" + _name.str()};
9191
}
9292

9393
yul::Identifier translate(yul::Identifier const& _identifier) override
@@ -206,7 +206,7 @@ struct CopyTranslate: public yul::ASTCopier
206206
if (isDigit(value.front()))
207207
return yul::Literal{_identifier.debugData, yul::LiteralKind::Number, yul::valueOfNumberLiteral(value), {}};
208208
else
209-
return yul::Identifier{_identifier.debugData, yul::YulString{value}};
209+
return yul::Identifier{_identifier.debugData, yul::YulName{value}};
210210
}
211211

212212

libsolidity/experimental/codegen/IRGeneratorForStatements.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,12 @@ struct CopyTranslate: public yul::ASTCopier
7070
return ASTCopier::operator()(_identifier);
7171
}
7272

73-
yul::YulString translateIdentifier(yul::YulString _name) override
73+
yul::YulName translateIdentifier(yul::YulName _name) override
7474
{
7575
if (m_dialect.builtin(_name))
7676
return _name;
7777
else
78-
return yul::YulString{"usr$" + _name.str()};
78+
return yul::YulName{"usr$" + _name.str()};
7979
}
8080

8181
yul::Identifier translate(yul::Identifier const& _identifier) override
@@ -102,7 +102,7 @@ struct CopyTranslate: public yul::ASTCopier
102102
solAssert(type);
103103
solAssert(m_context.env->typeEquals(*type, m_context.analysis.typeSystem().type(PrimitiveType::Word, {})));
104104
std::string value = IRNames::localVariable(*varDecl);
105-
return yul::Identifier{_identifier.debugData, yul::YulString{value}};
105+
return yul::Identifier{_identifier.debugData, yul::YulName{value}};
106106
}
107107

108108
IRGenerationContext const& m_context;

libsolidity/interface/CompilerStack.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666

6767
#include <libstdlib/stdlib.h>
6868

69-
#include <libyul/YulString.h>
69+
#include <libyul/YulName.h>
7070
#include <libyul/AsmPrinter.h>
7171
#include <libyul/AsmJsonConverter.h>
7272
#include <libyul/YulStack.h>

libyul/AST.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#pragma once
2525

2626
#include <libyul/ASTForward.h>
27-
#include <libyul/YulString.h>
27+
#include <libyul/YulName.h>
2828

2929
#include <liblangutil/DebugData.h>
3030

@@ -36,9 +36,9 @@
3636
namespace solidity::yul
3737
{
3838

39-
using Type = YulString;
39+
using Type = YulName;
4040

41-
struct TypedName { langutil::DebugData::ConstPtr debugData; YulString name; Type type; };
41+
struct TypedName { langutil::DebugData::ConstPtr debugData; YulName name; Type type; };
4242
using TypedNameList = std::vector<TypedName>;
4343

4444
/// Literal number or string (up to 32 bytes)
@@ -70,7 +70,7 @@ class LiteralValue {
7070
};
7171
struct Literal { langutil::DebugData::ConstPtr debugData; LiteralKind kind; LiteralValue value; Type type; };
7272
/// External / internal identifier or label reference
73-
struct Identifier { langutil::DebugData::ConstPtr debugData; YulString name; };
73+
struct Identifier { langutil::DebugData::ConstPtr debugData; YulName name; };
7474
/// Assignment ("x := mload(20:u256)", expects push-1-expression on the right hand
7575
/// side and requires x to occupy exactly one stack slot.
7676
///
@@ -86,7 +86,7 @@ struct VariableDeclaration { langutil::DebugData::ConstPtr debugData; TypedNameL
8686
/// Block that creates a scope (frees declared stack variables)
8787
struct Block { langutil::DebugData::ConstPtr debugData; std::vector<Statement> statements; };
8888
/// Function definition ("function f(a, b) -> (d, e) { ... }")
89-
struct FunctionDefinition { langutil::DebugData::ConstPtr debugData; YulString name; TypedNameList parameters; TypedNameList returnVariables; Block body; };
89+
struct FunctionDefinition { langutil::DebugData::ConstPtr debugData; YulName name; TypedNameList parameters; TypedNameList returnVariables; Block body; };
9090
/// Conditional execution without "else" part.
9191
struct If { langutil::DebugData::ConstPtr debugData; std::unique_ptr<Expression> condition; Block body; };
9292
/// Switch case or default case

0 commit comments

Comments
 (0)