[flang-commits] [flang] 0feff71 - [flang][driver] Move standard macro predefs to a dedicated method (nfc)

Andrzej Warzynski via flang-commits flang-commits at lists.llvm.org
Thu Feb 11 03:45:37 PST 2021


Author: Andrzej Warzynski
Date: 2021-02-11T11:42:57Z
New Revision: 0feff71eabd39fc93f3d9ec30ed16e26da6cf883

URL: https://github.com/llvm/llvm-project/commit/0feff71eabd39fc93f3d9ec30ed16e26da6cf883
DIFF: https://github.com/llvm/llvm-project/commit/0feff71eabd39fc93f3d9ec30ed16e26da6cf883.diff

LOG: [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

Added: 
    

Modified: 
    flang/lib/Frontend/CompilerInvocation.cpp

Removed: 
    


################################################################################
diff  --git a/flang/lib/Frontend/CompilerInvocation.cpp b/flang/lib/Frontend/CompilerInvocation.cpp
index 078cb9513dfa..23cbc21cedfd 100644
--- a/flang/lib/Frontend/CompilerInvocation.cpp
+++ b/flang/lib/Frontend/CompilerInvocation.cpp
@@ -328,12 +328,16 @@ void CompilerInvocation::SetDefaultFortranOpts() {
   std::vector<std::string> searchDirectories{"."s};
   fortranOptions.searchDirectories = searchDirectories;
   fortranOptions.isFixedForm = false;
+}
+
+// TODO: When expanding this method, consider creating a dedicated API for
+// this. Also at some point we will need to 
diff erentiate between 
diff erent
+// targets and add dedicated predefines for each.
+void CompilerInvocation::setDefaultPredefinitions() {
+  auto &fortranOptions = fortranOpts();
+  const auto &frontendOptions = frontendOpts();
 
   // Populate the macro list with version numbers and other predefinitions.
-  // TODO: When expanding this list of standard predefinitions, consider
-  // creating a dedicated API for this. Also at some point we will need to
-  // 
diff erentiate between 
diff erent targets.
-  // TODO: Move to setDefaultPredefinitions
   fortranOptions.predefinitions.emplace_back("__flang__", "1");
   fortranOptions.predefinitions.emplace_back(
       "__flang_major__", FLANG_VERSION_MAJOR_STRING);
@@ -341,11 +345,6 @@ void CompilerInvocation::SetDefaultFortranOpts() {
       "__flang_minor__", FLANG_VERSION_MINOR_STRING);
   fortranOptions.predefinitions.emplace_back(
       "__flang_patchlevel__", FLANG_VERSION_PATCHLEVEL_STRING);
-}
-
-void CompilerInvocation::setDefaultPredefinitions() {
-  auto &fortranOptions = fortranOpts();
-  const auto &frontendOptions = frontendOpts();
 
   // Add predefinitions based on extensions enabled
   if (frontendOptions.features_.IsEnabled(


        


More information about the flang-commits mailing list