181 const llvm::MemoryBuffer *buffer =
nullptr;
189 bool isFixedForm =
false;
195 unsigned mustBePreprocessed : 1;
198 bool isCUDAFortran{
false};
203 : file(file.str()), kind(inKind) {
207 auto pathDotIndex{file.rfind(
".")};
208 std::string pathSuffix{file.substr(pathDotIndex + 1)};
209 isFixedForm = isFixedFormSuffix(pathSuffix);
210 mustBePreprocessed = isToBePreprocessed(pathSuffix);
211 isCUDAFortran = isCUDAFortranSuffix(pathSuffix);
215 : buffer(memBuf), kind(inKind) {}
217 InputKind getKind()
const {
return kind; }
219 bool isEmpty()
const {
return file.empty() && buffer ==
nullptr; }
220 bool isFile()
const {
return (buffer ==
nullptr); }
221 bool getIsFixedForm()
const {
return isFixedForm; }
222 bool getMustBePreprocessed()
const {
return mustBePreprocessed; }
223 bool getIsCUDAFortran()
const {
return isCUDAFortran; }
225 llvm::StringRef getFile()
const {
230 const llvm::MemoryBuffer *getBuffer()
const {
231 assert(buffer &&
"Requested buffer, but it is empty!");
237struct FrontendOptions {
239 : showHelp(false), showVersion(false), instrumentedParse(false),
240 showColors(false), printSupportedCPUs(false),
241 needProvenanceRangeToCharBlockMappings(false) {}
244 unsigned showHelp : 1;
247 unsigned showVersion : 1;
250 unsigned instrumentedParse : 1;
253 unsigned showColors : 1;
256 unsigned printSupportedCPUs : 1;
261 unsigned needProvenanceRangeToCharBlockMappings : 1;
264 struct GetDefinitionVals {
266 unsigned startColumn;
269 GetDefinitionVals getDefVals;
272 std::vector<FrontendInputFile> inputs;
275 std::string outputFile;
278 std::string dependencyOutputFile;
281 std::vector<std::string> dependencyTargets;
284 frontend::ActionKind programAction = ParseSyntaxOnly;
287 FortranForm fortranForm = FortranForm::Unknown;
290 std::vector<Fortran::lower::EnvironmentDefault> envDefaults;
295 std::optional<int> fixedFormColumns = 72;
302 common::LanguageFeatureControl features;
305 Fortran::parser::Encoding encoding{Fortran::parser::Encoding::UTF_8};
308 std::vector<std::string> plugins;
311 std::string actionName;
315 std::vector<std::string> llvmArgs;
319 std::vector<std::string> mlirArgs;
326 static InputKind getInputKindForExtension(llvm::StringRef extension);