mirror of
https://github.com/intel/llvm.git
synced 2026-01-30 05:55:35 +08:00
[flang] Warn for the limit on name length
As fortran 2018 C601, the maximum length of a name is 63 characters. Reviewed By: klausler Differential Revision: https://reviews.llvm.org/D125371
This commit is contained in:
@@ -72,5 +72,8 @@ using Label = std::uint64_t;
|
||||
|
||||
// Fortran arrays may have up to 15 dimensions (See Fortran 2018 section 5.4.6).
|
||||
static constexpr int maxRank{15};
|
||||
|
||||
// Fortran names may have up to 63 characters (See Fortran 2018 C601).
|
||||
static constexpr int maxNameLen{63};
|
||||
} // namespace Fortran::common
|
||||
#endif // FORTRAN_COMMON_FORTRAN_H_
|
||||
|
||||
@@ -198,6 +198,12 @@ void CheckHelper::Check(
|
||||
}
|
||||
|
||||
void CheckHelper::Check(const Symbol &symbol) {
|
||||
if (symbol.name().size() > common::maxNameLen) {
|
||||
messages_.Say(symbol.name(),
|
||||
"%s has length %d, which is greater than the maximum name length "
|
||||
"%d"_port_en_US,
|
||||
symbol.name(), symbol.name().size(), common::maxNameLen);
|
||||
}
|
||||
if (context_.HasError(symbol)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user