CompilerOptions

The compiler options the translation unit was compiled with.

Declaration

Syntax

CompilerOptions(string compiler_options_str, ttype type)

Arguments

Argument

Description

compiler_options_str

the options, as one string.

type

the string type of the result.

Return values

The value of the expression.

Description

compiler_options() is an LFortran extension that lets a program report how it was built. The value is fixed when the ASR is produced, so the node is a constant; it is a node of its own rather than a StringConstant so that unparsed ASR still shows the call rather than the expanded text.

Examples

(CompilerOptions
  :compiler_options_str "-O3 --fast-math"
  :type (String
    :kind 1
    :len (IntegerConstant
      :n 15
      :type (Integer
        :kind 4
      )
      :intboz_type :Decimal
    )
    :len_kind :ExpressionLength
    :physical_type :DescriptorString
  )
)

It comes from this complete ASR text document:

(TranslationUnit
  :symtab (SymbolTable
    :id 0
    :symbols {
      "main" (Program
        :symtab (SymbolTable
          :id 1
          :symbols {
            "s" (Variable
              :parent_symtab 1
              :name "s"
              :dependencies []
              :intent :Local
              :symbolic_value nil
              :value nil
              :storage :Default
              :type (Allocatable
                :type (String
                  :kind 1
                  :len nil
                  :len_kind :DeferredLength
                  :physical_type :DescriptorString
                )
              )
              :type_declaration nil
              :abi :Source
              :access :Public
              :presence :Required
              :value_attr false
              :target_attr false
              :contiguous_attr false
              :bindc_name nil
              :is_volatile false
              :is_protected false
              :pass_attr :NotMethod
              :self_argument nil
              :codims []
            )
          }
        )
        :name "main"
        :dependencies []
        :body [
          (Assignment
            :target (Var
              :v (SymbolRef 1 "s")
            )
            :value (CompilerOptions
              :compiler_options_str "-O3 --fast-math"
              :type (String
                :kind 1
                :len (IntegerConstant
                  :n 15
                  :type (Integer
                    :kind 4
                  )
                  :intboz_type :Decimal
                )
                :len_kind :ExpressionLength
                :physical_type :DescriptorString
              )
            )
            :overloaded nil
            :realloc_lhs false
            :move_allocation false
          )
        ]
      )
    }
  )
  :items []
)

See Also

StringConstant, String