Skip to content

Commit

Permalink
[CodeGen] separate functions of ABICodec and ExprEmitter
Browse files Browse the repository at this point in the history
  • Loading branch information
Jinkela committed Jun 11, 2021
1 parent ae79ef5 commit aa330a8
Show file tree
Hide file tree
Showing 13 changed files with 1,392 additions and 1,325 deletions.
12 changes: 6 additions & 6 deletions include/soll/AST/Type.h
Original file line number Diff line number Diff line change
Expand Up @@ -496,8 +496,8 @@ class TupleType : public Type {
}
size_t getStoragePos(size_t ElementIndex) const {
size_t Pos = 0;
for (size_t i = 0; i < ElementIndex; ++i) {
Pos += ElementTypes[i]->getStorageSize() / 32;
for (size_t I = 0; I < ElementIndex; ++I) {
Pos += ElementTypes[I]->getStorageSize() / 32;
}
return Pos;
}
Expand Down Expand Up @@ -549,13 +549,13 @@ class StructType : public TupleType {
}
llvm::Type *getLLVMType() const { return Tp; }
size_t getElementIndex(std::string Name) const {
size_t i = 0;
for (; i < ElementNames.size(); ++i) {
if (ElementNames[i] == Name) {
size_t I = 0;
for (; I < ElementNames.size(); ++I) {
if (ElementNames[I] == Name) {
break;
}
}
return i;
return I;
}
bool hasElement(std::string Name) const {
return getElementIndex(Name) < ElementNames.size();
Expand Down
2 changes: 1 addition & 1 deletion lib/AST/Decl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ FunctionDecl::FunctionDecl(
IsVirtual, std::move(Overrides)),
SM(SM), IsConstructor(IsConstructor), IsFallback(IsFallback),
FunctionModifiers(std::move(Modifiers)), Body(std::move(Body)) {
// TODO

std::vector<std::reference_wrapper<const TypePtr>> PTys;
std::vector<std::reference_wrapper<const TypePtr>> RTys;
auto PNames = std::make_shared<std::vector<std::string>>();
Expand Down
8 changes: 4 additions & 4 deletions lib/AST/Expr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ std::vector<Expr *> CallExpr::getArguments() {
ParamNamesIndex[ParamName] = ParamSize++;
}
Args.resize(ParamSize);
for (size_t i = 0; i < ParamSize; ++i) {
Args[ParamNamesIndex.at(Names->at(i))] = Arguments.at(i).get();
for (size_t I = 0; I < ParamSize; ++I) {
Args[ParamNamesIndex.at(Names->at(I))] = Arguments.at(I).get();
}
} else {
for (auto &Arg : Arguments)
Expand All @@ -95,8 +95,8 @@ std::vector<const Expr *> CallExpr::getArguments() const {
ParamNamesIndex[ParamName] = ParamSize++;
}
Args.resize(ParamSize);
for (size_t i = 0; i < ParamSize; ++i) {
Args[ParamNamesIndex.at(Names->at(i))] = Arguments.at(i).get();
for (size_t I = 0; I < ParamSize; ++I) {
Args[ParamNamesIndex.at(Names->at(I))] = Arguments.at(I).get();
}
} else {
for (auto &Arg : Arguments)
Expand Down
4 changes: 2 additions & 2 deletions lib/AST/StmtVisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@ template <bool Const> void StmtVisitorBase<Const>::visit(AsmIdentifierType &) {

template <bool Const>
void StmtVisitorBase<Const>::visit(AsmIdentifierListType &L) {
for (auto i : L.getIdentifiers())
i->accept(*this);
for (auto I : L.getIdentifiers())
I->accept(*this);
}

} // namespace soll
Expand Down
6 changes: 3 additions & 3 deletions lib/Basic/Diagnostic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,9 +270,9 @@ void Diagnostic::FormatDiagnostic(const char *DiagStr, const char *DiagEnd,
llvm::SmallVector<intptr_t, 2> QualTypeVals;
llvm::SmallVector<char, 64> Tree;

for (unsigned i = 0, e = getNumArgs(); i < e; ++i)
if (getArgKind(i) == DiagnosticsEngine::ArgumentKind::ak_qualtype)
QualTypeVals.push_back(getRawArg(i));
for (unsigned I = 0, e = getNumArgs(); I < e; ++I)
if (getArgKind(I) == DiagnosticsEngine::ArgumentKind::ak_qualtype)
QualTypeVals.push_back(getRawArg(I));

while (DiagStr != DiagEnd) {
if (DiagStr[0] != '%') {
Expand Down
Loading

0 comments on commit aa330a8

Please sign in to comment.