[all-commits] [llvm/llvm-project] 824bf9: [flang] runtime: Read environment variables directly

Diana via All-commits all-commits at lists.llvm.org
Thu Oct 28 00:52:51 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 824bf908194c9267f1f09065ba8e41d7969006ab
      https://github.com/llvm/llvm-project/commit/824bf908194c9267f1f09065ba8e41d7969006ab
  Author: Diana Picus <diana.picus at linaro.org>
  Date:   2021-10-28 (Thu, 28 Oct 2021)

  Changed paths:
    M flang/include/flang/Runtime/command.h
    M flang/runtime/command.cpp
    M flang/runtime/environment.cpp
    M flang/runtime/environment.h
    M flang/runtime/tools.cpp
    M flang/unittests/Runtime/CommandTest.cpp

  Log Message:
  -----------
  [flang] runtime: Read environment variables directly

Add support for reading environment variables directly, via std::getenv.
This needs to allocate a C-style string to pass into std::getenv. If the
memory allocation for that fails, we terminate.

This also changes the interface for EnvVariableLength to receive the
source file and line so we can crash gracefully.

Note that we are now completely ignoring the envp pointer passed into
ProgramStart, since that could go stale if the environment is modified
during execution.

Differential Revision: https://reviews.llvm.org/D111785




More information about the All-commits mailing list