Skip to content

Commit db13269

Browse files
banach-spacememfrob
authored andcommitted
[flang][driver] Move standard macro predefs to a dedicated method (nfc)
This patch just addresses one of the outstanding TODOs. More specifically, it moves all the outstanding standard macro predefinitions from `SetDefaultFortranOpts` to `setDefaultPredefinitions`. This dedicated method for standard macro predefs was introduced in: * https://reviews.llvm.org/D96032
1 parent 8aa0f83 commit db13269

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

flang/lib/Frontend/CompilerInvocation.cpp

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -328,24 +328,23 @@ void CompilerInvocation::SetDefaultFortranOpts() {
328328
std::vector<std::string> searchDirectories{"."s};
329329
fortranOptions.searchDirectories = searchDirectories;
330330
fortranOptions.isFixedForm = false;
331+
}
332+
333+
// TODO: When expanding this method, consider creating a dedicated API for
334+
// this. Also at some point we will need to differentiate between different
335+
// targets and add dedicated predefines for each.
336+
void CompilerInvocation::setDefaultPredefinitions() {
337+
auto &fortranOptions = fortranOpts();
338+
const auto &frontendOptions = frontendOpts();
331339

332340
// Populate the macro list with version numbers and other predefinitions.
333-
// TODO: When expanding this list of standard predefinitions, consider
334-
// creating a dedicated API for this. Also at some point we will need to
335-
// differentiate between different targets.
336-
// TODO: Move to setDefaultPredefinitions
337341
fortranOptions.predefinitions.emplace_back("__flang__", "1");
338342
fortranOptions.predefinitions.emplace_back(
339343
"__flang_major__", FLANG_VERSION_MAJOR_STRING);
340344
fortranOptions.predefinitions.emplace_back(
341345
"__flang_minor__", FLANG_VERSION_MINOR_STRING);
342346
fortranOptions.predefinitions.emplace_back(
343347
"__flang_patchlevel__", FLANG_VERSION_PATCHLEVEL_STRING);
344-
}
345-
346-
void CompilerInvocation::setDefaultPredefinitions() {
347-
auto &fortranOptions = fortranOpts();
348-
const auto &frontendOptions = frontendOpts();
349348

350349
// Add predefinitions based on extensions enabled
351350
if (frontendOptions.features_.IsEnabled(

0 commit comments

Comments
 (0)