180 const llvm::MemoryBuffer *buffer =
nullptr;
188 bool isFixedForm =
false;
194 unsigned mustBePreprocessed : 1;
197 bool isCUDAFortran{
false};
202 : file(file.str()), kind(inKind) {
206 auto pathDotIndex{file.rfind(
".")};
207 std::string pathSuffix{file.substr(pathDotIndex + 1)};
208 isFixedForm = isFixedFormSuffix(pathSuffix);
209 mustBePreprocessed = isToBePreprocessed(pathSuffix);
210 isCUDAFortran = isCUDAFortranSuffix(pathSuffix);
214 : buffer(memBuf), kind(inKind) {}
216 InputKind getKind()
const {
return kind; }
218 bool isEmpty()
const {
return file.empty() && buffer ==
nullptr; }
219 bool isFile()
const {
return (buffer ==
nullptr); }
220 bool getIsFixedForm()
const {
return isFixedForm; }
221 bool getMustBePreprocessed()
const {
return mustBePreprocessed; }
222 bool getIsCUDAFortran()
const {
return isCUDAFortran; }
224 llvm::StringRef getFile()
const {
229 const llvm::MemoryBuffer *getBuffer()
const {
230 assert(buffer &&
"Requested buffer, but it is empty!");
236struct FrontendOptions {
238 : showHelp(false), showVersion(false), instrumentedParse(false),
239 showColors(false), printSupportedCPUs(false),
240 needProvenanceRangeToCharBlockMappings(false) {}
243 unsigned showHelp : 1;
246 unsigned showVersion : 1;
249 unsigned instrumentedParse : 1;
252 unsigned showColors : 1;
255 unsigned printSupportedCPUs : 1;
260 unsigned needProvenanceRangeToCharBlockMappings : 1;
263 struct GetDefinitionVals {
265 unsigned startColumn;
268 GetDefinitionVals getDefVals;
271 std::vector<FrontendInputFile> inputs;
274 std::string outputFile;
277 frontend::ActionKind programAction = ParseSyntaxOnly;
280 FortranForm fortranForm = FortranForm::Unknown;
283 std::vector<Fortran::lower::EnvironmentDefault> envDefaults;
287 int fixedFormColumns = 72;
294 common::LanguageFeatureControl features;
297 Fortran::parser::Encoding encoding{Fortran::parser::Encoding::UTF_8};
300 std::vector<std::string> plugins;
303 std::string actionName;
307 std::vector<std::string> llvmArgs;
311 std::vector<std::string> mlirArgs;
318 static InputKind getInputKindForExtension(llvm::StringRef extension);