Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiler cleanups #21684

Merged
merged 8 commits into from
Feb 25, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions frontend/include/chpl/framework/error-classes-list.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@
// alphabetically within these groups. Groups themselves are ordered by the
// order their compilation stages occur in.

#include "parser-error-classes-list.h"
#include "resolution-error-classes-list.h"
#include "chpl/parsing/parser-error-classes-list.h"
#include "chpl/resolution/resolution-error-classes-list.h"
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ ERROR_CLASS(DisallowedControlFlow,
POSTPARSE_ERROR_CLASS(MultipleManagementStrategies, const uast::New::Management,
const uast::New::Management)
ERROR_CLASS(IllegalUseImport, const uast::AstNode*, const uast::AstNode*)
ERROR_CLASS(UnsupportedAsIdent, const uast::As*, const uast::AstNode*)
mppf marked this conversation as resolved.
Show resolved Hide resolved
POSTPARSE_ERROR_CLASS(PostParseErr, std::string)
POSTPARSE_WARNING_CLASS(PostParseWarn, std::string)
/* end post-parse-checks errors */
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ ERROR_CLASS(TupleDeclUnknownType, const uast::TupleDecl*)
ERROR_CLASS(TupleExpansionNamedArgs, const uast::OpCall*, const uast::FnCall*)
ERROR_CLASS(TupleExpansionNonTuple, const uast::FnCall*, const uast::OpCall*, types::QualifiedType)
ERROR_CLASS(UnknownEnumElem, const uast::AstNode*, chpl::UniqueString, const uast::Enum*)
ERROR_CLASS(UnsupportedAsIdent, const uast::As*, const uast::AstNode*)
ERROR_CLASS(UseImportMultiplyDefined,
chpl::UniqueString,
const uast::AstNode*,
Expand Down
2 changes: 0 additions & 2 deletions frontend/lib/framework/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ target_sources(ChplFrontend-obj
ErrorWriter.cpp
ID.cpp
Location.cpp
parser-error-classes-list.cpp
resolution-error-classes-list.cpp
UniqueString.cpp

)
2 changes: 2 additions & 0 deletions frontend/lib/parsing/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,10 @@ target_sources(ChplFrontend-obj
parser-dependencies.h
parser-help.h
parser-stats.cpp

# these are implementing the public interface
Parser.cpp
parser-error-classes-list.cpp
parsing-queries.cpp
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ namespace chpl {
// error-classes-list.h which invokes this macro (and thus
// DIAGNOSTIC_CLASS_IMPL) for every error type.
#define DIAGNOSTIC_CLASS DIAGNOSTIC_CLASS_IMPL
#include "chpl/framework/parser-error-classes-list.h"
#include "chpl/parsing/parser-error-classes-list.h"
#undef DIAGNOSTIC_CLASS

//
Expand Down Expand Up @@ -394,6 +394,25 @@ void ErrorIllegalUseImport::write(ErrorWriterBase& wr) const {
wr.note(clause, "only identifiers and 'dot' expressions are supported");
}

void ErrorUnsupportedAsIdent::write(ErrorWriterBase& wr) const {
auto as = std::get<const uast::As*>(info);
auto expectedIdentifier = std::get<const uast::AstNode*>(info);
wr.heading(kind_, type_, locationOnly(as),
"this form of 'as' is not yet supported.");
// determine and report which of the original or new name is invalid
std::string whichName;
if (expectedIdentifier == as->symbol()) {
whichName = "original";
} else if (expectedIdentifier == as->rename()) {
whichName = "new";
} else {
CHPL_ASSERT(false && "should not be reachable");
}
wr.message("'as' requires the ", whichName,
" name to be a simple identifier, but instead got the following:");
wr.code(expectedIdentifier, { expectedIdentifier });
}

void ErrorPostParseErr::write(ErrorWriterBase& wr) const {
auto node = std::get<const uast::AstNode*>(info);
auto errorMessage = std::get<std::string>(info);
Expand Down
1 change: 1 addition & 0 deletions frontend/lib/resolution/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ target_sources(ChplFrontend-obj
intents.cpp
maybe-const.cpp
prims.cpp
resolution-error-classes-list.cpp
resolution-queries.cpp
resolution-types.cpp
return-type-inference.cpp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ namespace chpl {
// error type. We do this by defining the DIAGNOSTIC_CLASS macro, and including
// error-classes-list.h which invokes this macro for every error type.
#define DIAGNOSTIC_CLASS DIAGNOSTIC_CLASS_IMPL
#include "chpl/framework/resolution-error-classes-list.h"
#include "chpl/resolution/resolution-error-classes-list.h"
#undef DIAGNOSTIC_CLASS

/**
Expand Down Expand Up @@ -582,25 +582,6 @@ void ErrorUnknownEnumElem::write(ErrorWriterBase& wr) const {
wr.code(enumAst->id());
}

void ErrorUnsupportedAsIdent::write(ErrorWriterBase& wr) const {
auto as = std::get<const uast::As*>(info);
auto expectedIdentifier = std::get<const uast::AstNode*>(info);
wr.heading(kind_, type_, locationOnly(as),
"this form of 'as' is not yet supported.");
// determine and report which of the original or new name is invalid
std::string whichName;
if (expectedIdentifier == as->symbol()) {
whichName = "original";
} else if (expectedIdentifier == as->rename()) {
whichName = "new";
} else {
CHPL_ASSERT(false && "should not be reachable");
}
wr.message("'as' requires the ", whichName,
" name to be a simple identifier, but instead got the following:");
wr.code(expectedIdentifier, { expectedIdentifier });
}

void ErrorUseImportMultiplyDefined::write(ErrorWriterBase& wr) const {
auto symbolName = std::get<UniqueString>(info);
auto firstOccurrence = std::get<1>(info);
Expand Down
4 changes: 2 additions & 2 deletions util/devel/chplspell-dictionary.fileids.json
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@
"frontend/include/chpl/framework/global-strings.h"
],
"389486f6-ac5b-11ed-b67e-4d191cd16eac": [
"frontend/include/chpl/framework/parser-error-classes-list.h"
"frontend/include/chpl/parsing/parser-error-classes-list.h"
],
"712148ae-12c0-11ed-a8be-cd81bce0efc4": [
"frontend/include/chpl/framework/stringify-functions.h"
Expand Down Expand Up @@ -1635,4 +1635,4 @@
"78ea7772-caca-11e9-8464-10ddb1d4c3d5": [
"tools/mason/SpecParser.chpl"
]
}
}