This will make it easier for me to do reviews.
Differential Revision: https://reviews.llvm.org/D137291
bool warnAsErr = false;
- /// This flag controls the unparsing and is used to decide whether to print out
- /// the semantically analyzed version of an object or expression or the plain
- /// version that does not include any information from semantic analysis.
+ /// This flag controls the unparsing and is used to decide whether to print
+ /// out the semantically analyzed version of an object or expression or the
+ /// plain version that does not include any information from semantic
+ /// analysis.
bool useAnalyzedObjectsForUnparse = true;
// Fortran Dialect options
}
private:
- template <unsigned N> bool reportFatalErrors(const char (&message)[N]);
+ template <unsigned N>
+ bool reportFatalErrors(const char (&message)[N]);
};
} // namespace Fortran::frontend
// TODO: This is a copy from f18.cpp. It doesn't really belong here and should
// be moved to a more suitable place in future.
struct MeasurementVisitor {
- template <typename A> bool Pre(const A &) { return true; }
- template <typename A> void Post(const A &) {
+ template <typename A>
+ bool Pre(const A &) {
+ return true;
+ }
+ template <typename A>
+ void Post(const A &) {
++objects;
bytes += sizeof(A);
}
/// \param extension The extension to use for the output file (ignored when
/// the user decides to print to stdout via `-o -`)
/// \return Null on error, ostream for the output file otherwise
- std::unique_ptr<llvm::raw_pwrite_stream> createOutputFile(
- llvm::StringRef extension);
+ std::unique_ptr<llvm::raw_pwrite_stream>
+ createOutputFile(llvm::StringRef extension);
};
//===----------------------------------------------------------------------===//
/// maintain some level of consistency/similarity between the drivers.
enum class BackendActionTy {
Backend_EmitAssembly, ///< Emit native assembly files
- Backend_EmitObj, ///< Emit native object files
- Backend_EmitBC, ///< Emit LLVM bitcode files
- Backend_EmitLL, ///< Emit human-readable LLVM assembly
- Backend_EmitMLIR ///< Emit MLIR files
+ Backend_EmitObj, ///< Emit native object files
+ Backend_EmitBC, ///< Emit LLVM bitcode files
+ Backend_EmitLL, ///< Emit human-readable LLVM assembly
+ Backend_EmitMLIR ///< Emit MLIR files
};
/// Abstract base class for actions that generate code (MLIR, LLVM IR, assembly
public:
void HandleDiagnostic(clang::DiagnosticsEngine::Level diagLevel,
- const clang::Diagnostic &info) override;
+ const clang::Diagnostic &info) override;
/// Flush the buffered diagnostics to a given diagnostic engine.
void flushDiagnostics(clang::DiagnosticsEngine &diags) const;
void setPrefix(std::string value) { prefix = std::move(value); }
void HandleDiagnostic(clang::DiagnosticsEngine::Level level,
- const clang::Diagnostic &info) override;
+ const clang::Diagnostic &info) override;
};
} // namespace Fortran::frontend
namespace fir {
class FirOpBuilder;
class RecordType;
-}
+} // namespace fir
namespace fir::runtime {
bool IsSubprogram() const;
bool IsFromModFile() const;
bool HasExplicitInterface() const {
- return common::visit(common::visitors{
- [](const SubprogramDetails &) { return true; },
- [](const SubprogramNameDetails &) { return true; },
- [&](const ProcEntityDetails &x) {
- return attrs_.test(Attr::INTRINSIC) ||
- x.HasExplicitInterface();
- },
- [](const ProcBindingDetails &x) {
- return x.symbol().HasExplicitInterface();
- },
- [](const UseDetails &x) {
- return x.symbol().HasExplicitInterface();
- },
- [](const HostAssocDetails &x) {
- return x.symbol().HasExplicitInterface();
- },
- [](const GenericDetails &x) {
- return x.specific() &&
- x.specific()->HasExplicitInterface();
- },
- [](const auto &) { return false; },
- },
+ return common::visit(
+ common::visitors{
+ [](const SubprogramDetails &) { return true; },
+ [](const SubprogramNameDetails &) { return true; },
+ [&](const ProcEntityDetails &x) {
+ return attrs_.test(Attr::INTRINSIC) || x.HasExplicitInterface();
+ },
+ [](const ProcBindingDetails &x) {
+ return x.symbol().HasExplicitInterface();
+ },
+ [](const UseDetails &x) {
+ return x.symbol().HasExplicitInterface();
+ },
+ [](const HostAssocDetails &x) {
+ return x.symbol().HasExplicitInterface();
+ },
+ [](const GenericDetails &x) {
+ return x.specific() && x.specific()->HasExplicitInterface();
+ },
+ [](const auto &) { return false; },
+ },
details_);
}
}
return intrinsic;
}
- const semantics::ProcInterface &interface {
- proc.interface()
- };
+ const semantics::ProcInterface &interface { proc.interface() };
if (const semantics::Symbol * interfaceSymbol{interface.symbol()}) {
auto interface {
CharacterizeProcedure(*interfaceSymbol, context, seenProcs)
context, std::move(funcRef), &Scalar<T>::IEOR, Scalar<T>{});
} else if (name == "ishft") {
return FoldElementalIntrinsic<T, T, Int4>(context, std::move(funcRef),
- ScalarFunc<T, T, Int4>([&](const Scalar<T> &i,
- const Scalar<Int4> &pos) -> Scalar<T> {
- auto posVal{static_cast<int>(pos.ToInt64())};
- if (posVal < -i.bits) {
- context.messages().Say(
- "SHIFT=%d count for ishft is less than %d"_err_en_US, posVal,
- -i.bits);
- } else if (posVal > i.bits) {
- context.messages().Say(
- "SHIFT=%d count for ishft is greater than %d"_err_en_US, posVal,
- i.bits);
- }
- return i.ISHFT(posVal);
- }));
+ ScalarFunc<T, T, Int4>(
+ [&](const Scalar<T> &i, const Scalar<Int4> &pos) -> Scalar<T> {
+ auto posVal{static_cast<int>(pos.ToInt64())};
+ if (posVal < -i.bits) {
+ context.messages().Say(
+ "SHIFT=%d count for ishft is less than %d"_err_en_US,
+ posVal, -i.bits);
+ } else if (posVal > i.bits) {
+ context.messages().Say(
+ "SHIFT=%d count for ishft is greater than %d"_err_en_US,
+ posVal, i.bits);
+ }
+ return i.ISHFT(posVal);
+ }));
} else if (name == "ishftc") {
if (args.at(2)) { // SIZE= is present
return FoldElementalIntrinsic<T, T, Int4, Int4>(context,
}));
} else if (name == "modulo") {
return FoldElementalIntrinsic<T, T, T>(context, std::move(funcRef),
- ScalarFuncWithContext<T, T, T>(
- [](FoldingContext &context, const Scalar<T> &x,
- const Scalar<T> &y) -> Scalar<T> {
- auto result{x.MODULO(y)};
- if (result.overflow) {
- context.messages().Say(
- "modulo() folding overflowed"_warn_en_US);
- }
- return result.value;
- }));
+ ScalarFuncWithContext<T, T, T>([](FoldingContext &context,
+ const Scalar<T> &x,
+ const Scalar<T> &y) -> Scalar<T> {
+ auto result{x.MODULO(y)};
+ if (result.overflow) {
+ context.messages().Say("modulo() folding overflowed"_warn_en_US);
+ }
+ return result.value;
+ }));
} else if (name == "not") {
return FoldElementalIntrinsic<T, T>(
context, std::move(funcRef), &Scalar<T>::NOT);
}));
} else if (name == "sign") {
return FoldElementalIntrinsic<T, T, T>(context, std::move(funcRef),
- ScalarFunc<T, T, T>(
- [&context](const Scalar<T> &j, const Scalar<T> &k) -> Scalar<T> {
- typename Scalar<T>::ValueWithOverflow result{j.SIGN(k)};
- if (result.overflow) {
- context.messages().Say(
- "sign(integer(kind=%d)) folding overflowed"_warn_en_US,
- KIND);
- }
- return result.value;
- }));
+ ScalarFunc<T, T, T>([&context](const Scalar<T> &j,
+ const Scalar<T> &k) -> Scalar<T> {
+ typename Scalar<T>::ValueWithOverflow result{j.SIGN(k)};
+ if (result.overflow) {
+ context.messages().Say(
+ "sign(integer(kind=%d)) folding overflowed"_warn_en_US, KIND);
+ }
+ return result.value;
+ }));
} else if (name == "size") {
if (auto shape{GetContextFreeShape(context, args[0])}) {
if (auto &dimArg{args[1]}) { // DIM= is present, get one extent
? common::RoundingMode::ToZero
: common::RoundingMode::TiesAwayFromZero};
return FoldElementalIntrinsic<T, T>(context, std::move(funcRef),
- ScalarFunc<T, T>([&name, &context, mode](
- const Scalar<T> &x) -> Scalar<T> {
- ValueWithRealFlags<Scalar<T>> y{x.ToWholeNumber(mode)};
- if (y.flags.test(RealFlag::Overflow)) {
- context.messages().Say(
- "%s intrinsic folding overflow"_warn_en_US, name);
- }
- return y.value;
- }));
+ ScalarFunc<T, T>(
+ [&name, &context, mode](const Scalar<T> &x) -> Scalar<T> {
+ ValueWithRealFlags<Scalar<T>> y{x.ToWholeNumber(mode)};
+ if (y.flags.test(RealFlag::Overflow)) {
+ context.messages().Say(
+ "%s intrinsic folding overflow"_warn_en_US, name);
+ }
+ return y.value;
+ }));
} else if (name == "dim") {
return FoldElementalIntrinsic<T, T, T>(context, std::move(funcRef),
ScalarFunc<T, T, T>(
std::unique_ptr<llvm::raw_fd_ostream> os;
std::error_code error;
- os.reset(new llvm::raw_fd_ostream(outputFilePath, error,
+ os.reset(new llvm::raw_fd_ostream(
+ outputFilePath, error,
(binary ? llvm::sys::fs::OF_None : llvm::sys::fs::OF_TextWithCRLF)));
if (error) {
return llvm::errorCodeToError(error);
}
// Set fortranForm based on options -ffree-form and -ffixed-form.
- if (const auto *arg = args.getLastArg(clang::driver::options::OPT_ffixed_form,
- clang::driver::options::OPT_ffree_form)) {
+ if (const auto *arg =
+ args.getLastArg(clang::driver::options::OPT_ffixed_form,
+ clang::driver::options::OPT_ffree_form)) {
opts.fortranForm =
arg->getOption().matches(clang::driver::options::OPT_ffixed_form)
- ? FortranForm::FixedForm
- : FortranForm::FreeForm;
+ ? FortranForm::FixedForm
+ : FortranForm::FreeForm;
}
// Set fixedFormColumns based on -ffixed-line-length=<value>
opts.features.Enable(
Fortran::common::LanguageFeature::ImplicitNoneTypeAlways,
args.hasFlag(clang::driver::options::OPT_fimplicit_none,
- clang::driver::options::OPT_fno_implicit_none, false));
+ clang::driver::options::OPT_fno_implicit_none, false));
// -f{no-}backslash
opts.features.Enable(Fortran::common::LanguageFeature::BackslashEscapes,
- args.hasFlag(clang::driver::options::OPT_fbackslash,
- clang::driver::options::OPT_fno_backslash, false));
+ args.hasFlag(clang::driver::options::OPT_fbackslash,
+ clang::driver::options::OPT_fno_backslash,
+ false));
// -f{no-}logical-abbreviations
- opts.features.Enable(Fortran::common::LanguageFeature::LogicalAbbreviations,
+ opts.features.Enable(
+ Fortran::common::LanguageFeature::LogicalAbbreviations,
args.hasFlag(clang::driver::options::OPT_flogical_abbreviations,
- clang::driver::options::OPT_fno_logical_abbreviations, false));
+ clang::driver::options::OPT_fno_logical_abbreviations,
+ false));
// -f{no-}xor-operator
- opts.features.Enable(Fortran::common::LanguageFeature::XOROperator,
+ opts.features.Enable(
+ Fortran::common::LanguageFeature::XOROperator,
args.hasFlag(clang::driver::options::OPT_fxor_operator,
- clang::driver::options::OPT_fno_xor_operator, false));
+ clang::driver::options::OPT_fno_xor_operator, false));
// -fno-automatic
if (args.hasArg(clang::driver::options::OPT_fno_automatic)) {
///
/// \param [in] opts The preprocessor options instance
/// \param [out] args The list of input arguments
-static void parsePreprocessorArgs(
- Fortran::frontend::PreprocessorOptions &opts, llvm::opt::ArgList &args) {
+static void parsePreprocessorArgs(Fortran::frontend::PreprocessorOptions &opts,
+ llvm::opt::ArgList &args) {
// Add macros from the command line.
- for (const auto *currentArg : args.filtered(
- clang::driver::options::OPT_D, clang::driver::options::OPT_U)) {
+ for (const auto *currentArg : args.filtered(clang::driver::options::OPT_D,
+ clang::driver::options::OPT_U)) {
if (currentArg->getOption().matches(clang::driver::options::OPT_D)) {
opts.addMacroDef(currentArg->getValue());
} else {
// Prepend the ordered list of -intrinsic-modules-path
// to the default location to search.
for (const auto *currentArg :
- args.filtered(clang::driver::options::OPT_fintrinsic_modules_path))
+ args.filtered(clang::driver::options::OPT_fintrinsic_modules_path))
opts.searchDirectoriesFromIntrModPath.emplace_back(currentArg->getValue());
// -cpp/-nocpp
clang::driver::options::OPT_cpp, clang::driver::options::OPT_nocpp))
opts.macrosFlag =
(currentArg->getOption().matches(clang::driver::options::OPT_cpp))
- ? PPMacrosFlag::Include
- : PPMacrosFlag::Exclude;
+ ? PPMacrosFlag::Include
+ : PPMacrosFlag::Exclude;
opts.noReformat = args.hasArg(clang::driver::options::OPT_fno_reformat);
opts.noLineDirectives = args.hasArg(clang::driver::options::OPT_P);
/// Parses all semantic related arguments and populates the variables
/// options accordingly. Returns false if new errors are generated.
static bool parseSemaArgs(CompilerInvocation &res, llvm::opt::ArgList &args,
- clang::DiagnosticsEngine &diags) {
+ clang::DiagnosticsEngine &diags) {
unsigned numErrorsBefore = diags.getNumErrors();
// -J/module-dir option
if (moduleDirList.size() > 1) {
const unsigned diagID =
diags.getCustomDiagID(clang::DiagnosticsEngine::Error,
- "Only one '-module-dir/-J' option allowed");
+ "Only one '-module-dir/-J' option allowed");
diags.Report(diagID);
}
if (moduleDirList.size() == 1)
/// Parses all diagnostics related arguments and populates the variables
/// options accordingly. Returns false if new errors are generated.
static bool parseDiagArgs(CompilerInvocation &res, llvm::opt::ArgList &args,
- clang::DiagnosticsEngine &diags) {
+ clang::DiagnosticsEngine &diags) {
unsigned numErrorsBefore = diags.getNumErrors();
// -Werror option
} else {
const unsigned diagID =
diags.getCustomDiagID(clang::DiagnosticsEngine::Error,
- "Only `-Werror` is supported currently.");
+ "Only `-Werror` is supported currently.");
diags.Report(diagID);
}
}
/// Parses all Dialect related arguments and populates the variables
/// options accordingly. Returns false if new errors are generated.
static bool parseDialectArgs(CompilerInvocation &res, llvm::opt::ArgList &args,
- clang::DiagnosticsEngine &diags) {
+ clang::DiagnosticsEngine &diags) {
unsigned numErrorsBefore = diags.getNumErrors();
// -fdefault* family
if (!args.hasArg(clang::driver::options::OPT_fdefault_real_8)) {
// -fdefault-double-8 has to be used with -fdefault-real-8
// to be compatible with gfortran
- const unsigned diagID =
- diags.getCustomDiagID(clang::DiagnosticsEngine::Error,
- "Use of `-fdefault-double-8` requires `-fdefault-real-8`");
+ const unsigned diagID = diags.getCustomDiagID(
+ clang::DiagnosticsEngine::Error,
+ "Use of `-fdefault-double-8` requires `-fdefault-real-8`");
diags.Report(diagID);
}
// https://gcc.gnu.org/onlinedocs/gfortran/Fortran-Dialect-Options.html
} else {
const unsigned diagID =
diags.getCustomDiagID(clang::DiagnosticsEngine::Error,
- "Only -std=f2018 is allowed currently.");
+ "Only -std=f2018 is allowed currently.");
diags.Report(diagID);
}
}
// Populate the macro list with version numbers and other predefinitions.
fortranOptions.predefinitions.emplace_back("__flang__", "1");
- fortranOptions.predefinitions.emplace_back(
- "__flang_major__", FLANG_VERSION_MAJOR_STRING);
- fortranOptions.predefinitions.emplace_back(
- "__flang_minor__", FLANG_VERSION_MINOR_STRING);
- fortranOptions.predefinitions.emplace_back(
- "__flang_patchlevel__", FLANG_VERSION_PATCHLEVEL_STRING);
+ fortranOptions.predefinitions.emplace_back("__flang_major__",
+ FLANG_VERSION_MAJOR_STRING);
+ fortranOptions.predefinitions.emplace_back("__flang_minor__",
+ FLANG_VERSION_MINOR_STRING);
+ fortranOptions.predefinitions.emplace_back("__flang_patchlevel__",
+ FLANG_VERSION_PATCHLEVEL_STRING);
// Add predefinitions based on extensions enabled
if (frontendOptions.features.IsEnabled(
bool Fortran::frontend::isFixedFormSuffix(llvm::StringRef suffix) {
// Note: Keep this list in-sync with flang/test/lit.cfg.py
return suffix == "f77" || suffix == "f" || suffix == "F" || suffix == "ff" ||
- suffix == "for" || suffix == "FOR" || suffix == "fpp" || suffix == "FPP";
+ suffix == "for" || suffix == "FOR" || suffix == "fpp" ||
+ suffix == "FPP";
}
bool Fortran::frontend::isFreeFormSuffix(llvm::StringRef suffix) {
// Note: Keep this list in-sync with flang/test/lit.cfg.py
// TODO: Add Cuda Fortan files (i.e. `*.cuf` and `*.CUF`).
return suffix == "f90" || suffix == "F90" || suffix == "ff90" ||
- suffix == "f95" || suffix == "F95" || suffix == "ff95" ||
- suffix == "f03" || suffix == "F03" || suffix == "f08" ||
- suffix == "F08" || suffix == "f18" || suffix == "F18";
+ suffix == "f95" || suffix == "F95" || suffix == "ff95" ||
+ suffix == "f03" || suffix == "F03" || suffix == "f08" ||
+ suffix == "F08" || suffix == "f18" || suffix == "F18";
}
bool Fortran::frontend::isToBePreprocessed(llvm::StringRef suffix) {
return suffix == "F" || suffix == "FOR" || suffix == "fpp" ||
- suffix == "FPP" || suffix == "F90" || suffix == "F95" ||
- suffix == "F03" || suffix == "F08" || suffix == "F18";
+ suffix == "FPP" || suffix == "F90" || suffix == "F95" ||
+ suffix == "F03" || suffix == "F08" || suffix == "F18";
}
InputKind FrontendOptions::getInputKindForExtension(llvm::StringRef extension) {
// We only emit diagnostics in contexts that lack valid source locations.
assert(!info.getLocation().isValid() &&
- "Diagnostics with valid source location are not supported");
+ "Diagnostics with valid source location are not supported");
Fortran::frontend::TextDiagnostic::printDiagnosticLevel(os, level,
diagOpts->ShowColors);
return std::make_unique<InitOnlyAction>();
case PluginAction: {
for (const FrontendPluginRegistry::entry &plugin :
- FrontendPluginRegistry::entries()) {
+ FrontendPluginRegistry::entries()) {
if (plugin.getName() == ci.getFrontendOpts().actionName) {
std::unique_ptr<PluginParseTreeAction> p(plugin.instantiate());
return std::move(p);
bool executeCompilerInvocation(CompilerInstance *flang) {
// Honor -help.
if (flang->getFrontendOpts().showHelp) {
- clang::driver::getDriverOptTable().printHelp(llvm::outs(),
- "flang-new -fc1 [options] file...", "LLVM 'Flang' Compiler",
+ clang::driver::getDriverOptTable().printHelp(
+ llvm::outs(), "flang-new -fc1 [options] file...",
+ "LLVM 'Flang' Compiler",
/*Include=*/clang::driver::options::FC1Option,
/*Exclude=*/llvm::opt::DriverFlag::HelpHidden,
/*ShowAllAliases=*/false);
TODO(loc, "automatic allocation of derived type allocatable with "
"length parameters");
}
- auto ifOp =
- builder
- .genIfOp(loc, {addrType}, mustReallocate,
- /*withElseRegion=*/true)
- .genThen([&]() {
- // If shape or length mismatch, allocate new storage.
- // When rhs is a scalar, keep the previous shape
- auto extents = shape.empty()
- ? mlir::ValueRange(previousExtents)
- : shape;
- auto heap = allocateAndInitNewStorage(
- builder, loc, box, extents, lengthParams,
- ".auto.alloc");
- if (storageHandler)
- storageHandler(getExtValForStorage(heap));
- builder.create<fir::ResultOp>(loc, heap);
- })
- .genElse([&]() {
- if (storageHandler)
- storageHandler(getExtValForStorage(addr));
- builder.create<fir::ResultOp>(loc, addr);
- });
+ auto ifOp = builder
+ .genIfOp(loc, {addrType}, mustReallocate,
+ /*withElseRegion=*/true)
+ .genThen([&]() {
+ // If shape or length mismatch, allocate new
+ // storage. When rhs is a scalar, keep the
+ // previous shape
+ auto extents =
+ shape.empty()
+ ? mlir::ValueRange(previousExtents)
+ : shape;
+ auto heap = allocateAndInitNewStorage(
+ builder, loc, box, extents, lengthParams,
+ ".auto.alloc");
+ if (storageHandler)
+ storageHandler(getExtValForStorage(heap));
+ builder.create<fir::ResultOp>(loc, heap);
+ })
+ .genElse([&]() {
+ if (storageHandler)
+ storageHandler(getExtValForStorage(addr));
+ builder.create<fir::ResultOp>(loc, addr);
+ });
ifOp.end();
auto newAddr = ifOp.getResults()[0];
builder.create<fir::ResultOp>(
auto argNo = newInTys.size();
if (attr.isByVal()) {
if (auto align = attr.getAlignment())
- fixups.emplace_back(
- FixupTy::Codes::ArgumentAsLoad, argNo,
- [=](mlir::func::FuncOp func) {
- auto elemType = fir::dyn_cast_ptrOrBoxEleTy(
- func.getFunctionType().getInput(argNo));
- func.setArgAttr(argNo, "llvm.byval",
- mlir::TypeAttr::get(elemType));
- func.setArgAttr(argNo, "llvm.align",
- rewriter->getIntegerAttr(
- rewriter->getIntegerType(32), align));
- });
+ fixups.emplace_back(FixupTy::Codes::ArgumentAsLoad, argNo,
+ [=](mlir::func::FuncOp func) {
+ auto elemType = fir::dyn_cast_ptrOrBoxEleTy(
+ func.getFunctionType().getInput(argNo));
+ func.setArgAttr(argNo, "llvm.byval",
+ mlir::TypeAttr::get(elemType));
+ func.setArgAttr(
+ argNo, "llvm.align",
+ rewriter->getIntegerAttr(
+ rewriter->getIntegerType(32), align));
+ });
else
fixups.emplace_back(FixupTy::Codes::ArgumentAsLoad, newInTys.size(),
[=](mlir::func::FuncOp func) {
#include "llvm/Frontend/OpenACC/ACC.inc"
private:
-
bool CheckAllowedModifier(llvm::acc::Clause clause);
bool IsComputeConstruct(llvm::acc::Directive directive) const;
bool IsInsideComputeConstruct() const;
return;
}
const auto &name{proc.name()};
- const Symbol *interface {
- interface0 ? FindInterface(*interface0) : nullptr
- };
+ const Symbol *interface { interface0 ? FindInterface(*interface0) : nullptr };
if (!interface) {
messages_.Say(name,
"Procedure component '%s' must have NOPASS attribute or explicit interface"_err_en_US,
namespace Fortran::parser {
struct DataStmtSet;
struct DataStmtValue;
-}
+} // namespace Fortran::parser
namespace Fortran::evaluate {
class ExpressionAnalyzer;
}
const parser::ProcedureDesignator &pd, ActualArguments &&arguments,
bool isSubroutine, bool mightBeStructureConstructor)
-> std::optional<CalleeAndArguments> {
- return common::visit(
- common::visitors{
- [&](const parser::Name &name) {
- return GetCalleeAndArguments(name, std::move(arguments),
- isSubroutine, mightBeStructureConstructor);
- },
- [&](const parser::ProcComponentRef &pcr) {
- return AnalyzeProcedureComponentRef(
- pcr, std::move(arguments), isSubroutine);
- },
- },
+ return common::visit(common::visitors{
+ [&](const parser::Name &name) {
+ return GetCalleeAndArguments(name,
+ std::move(arguments), isSubroutine,
+ mightBeStructureConstructor);
+ },
+ [&](const parser::ProcComponentRef &pcr) {
+ return AnalyzeProcedureComponentRef(
+ pcr, std::move(arguments), isSubroutine);
+ },
+ },
pd.u);
}
// be detected and represented (they're not expressions).
// TODO: C1534: Don't allow a "restricted" specific intrinsic to be passed.
std::optional<ActualArgument> actual;
- common::visit(
- common::visitors{
- [&](const common::Indirection<parser::Expr> &x) {
- actual = AnalyzeExpr(x.value());
- SetArgSourceLocation(actual, x.value().source);
- },
- [&](const parser::AltReturnSpec &label) {
- if (!isSubroutine) {
- context_.Say("alternate return specification may not appear on"
- " function reference"_err_en_US);
- }
- actual = ActualArgument(label.v);
- },
- [&](const parser::ActualArg::PercentRef &) {
- context_.Say("%REF() intrinsic for arguments"_todo_en_US);
- },
- [&](const parser::ActualArg::PercentVal &) {
- context_.Say("%VAL() intrinsic for arguments"_todo_en_US);
- },
- },
+ common::visit(common::visitors{
+ [&](const common::Indirection<parser::Expr> &x) {
+ actual = AnalyzeExpr(x.value());
+ SetArgSourceLocation(actual, x.value().source);
+ },
+ [&](const parser::AltReturnSpec &label) {
+ if (!isSubroutine) {
+ context_.Say(
+ "alternate return specification may not appear on"
+ " function reference"_err_en_US);
+ }
+ actual = ActualArgument(label.v);
+ },
+ [&](const parser::ActualArg::PercentRef &) {
+ context_.Say("%REF() intrinsic for arguments"_todo_en_US);
+ },
+ [&](const parser::ActualArg::PercentVal &) {
+ context_.Say("%VAL() intrinsic for arguments"_todo_en_US);
+ },
+ },
std::get<parser::ActualArg>(arg.t).u);
if (actual) {
if (const auto &argKW{std::get<std::optional<parser::Keyword>>(arg.t)}) {
return;
}
const auto &details{symbol.get<ProcEntityDetails>()};
- const ProcInterface &interface{details.interface()};
+ const ProcInterface &interface { details.interface() };
Attrs attrs{symbol.attrs()};
if (details.passName()) {
attrs.reset(Attr::PASS);
return y && *y == x;
}
-bool SymbolOffsetCompare::operator()(const SymbolRef &x, const SymbolRef &y) const {
+bool SymbolOffsetCompare::operator()(
+ const SymbolRef &x, const SymbolRef &y) const {
const Symbol *xCommon{FindCommonBlockContaining(*x)};
const Symbol *yCommon{FindCommonBlockContaining(*y)};
if (xCommon) {
return common::visit(
common::visitors{
[](const ProcEntityDetails &details) {
- const Symbol *interface {
- details.interface().symbol()
- };
+ const Symbol *interface { details.interface().symbol() };
return interface ? FindInterface(*interface) : nullptr;
},
[](const ProcBindingDetails &details) {
return 1;
}
-static void ExpandResponseFiles(
- llvm::StringSaver &saver, llvm::SmallVectorImpl<const char *> &args) {
+static void ExpandResponseFiles(llvm::StringSaver &saver,
+ llvm::SmallVectorImpl<const char *> &args) {
// We're defaulting to the GNU syntax, since we don't have a CL mode.
llvm::cl::TokenizerCallback tokenizer = &llvm::cl::TokenizeGNUCommandLine;
llvm::cl::ExpansionContext ExpCtx(saver.getAllocator(), tokenizer);
ExpandResponseFiles(saver, args);
// Check if flang-new is in the frontend mode
- auto firstArg = std::find_if(
- args.begin() + 1, args.end(), [](const char *a) { return a != nullptr; });
+ auto firstArg = std::find_if(args.begin() + 1, args.end(),
+ [](const char *a) { return a != nullptr; });
if (firstArg != args.end()) {
if (llvm::StringRef(args[1]).startswith("-cc1")) {
llvm::errs() << "error: unknown integrated tool '" << args[1] << "'. "
// Prepare the driver
clang::driver::Driver theDriver(driverPath,
- llvm::sys::getDefaultTargetTriple(), diags, "flang LLVM compiler");
+ llvm::sys::getDefaultTargetTriple(), diags,
+ "flang LLVM compiler");
theDriver.setTargetAndMode(targetandMode);
std::unique_ptr<clang::driver::Compilation> c(
theDriver.BuildCompilation(args));
//===----------------------------------------------------------------------===//
#include "flang/Optimizer/Support/FIRContext.h"
-#include "flang/Optimizer/Support/KindMapping.h"
+#include "gtest/gtest.h"
#include "mlir/IR/BuiltinAttributes.h"
#include "mlir/IR/BuiltinOps.h"
+#include "flang/Optimizer/Support/KindMapping.h"
#include "llvm/Support/Host.h"
-#include "gtest/gtest.h"
#include <string>
using namespace fir;
EXPECT_LE(minutes, 59);
}
}
-