[all-commits] [llvm/llvm-project] 7e0cc4: [SystemZ][z/OS] Save strings for CC_PRINT env vars

perry-ca via All-commits all-commits at lists.llvm.org
Fri Mar 26 13:39:07 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 7e0cc45ced230b4ef3a9d8eaedfbe92e75f21916
      https://github.com/llvm/llvm-project/commit/7e0cc45ced230b4ef3a9d8eaedfbe92e75f21916
  Author: Sean Perry <perry at ca.ibm.com>
  Date:   2021-03-26 (Fri, 26 Mar 2021)

  Changed paths:
    M clang/include/clang/Driver/Driver.h
    M clang/lib/Driver/Compilation.cpp
    M clang/lib/Driver/Driver.cpp
    M clang/lib/Driver/ToolChains/Clang.cpp
    M clang/tools/driver/driver.cpp

  Log Message:
  -----------
  [SystemZ][z/OS] Save strings for CC_PRINT env vars

The contents of the string returned by getenv() is not guaranteed across calls to getenv(). The code to handle the CC_PRINT etc env vars calls getenv() and saves the results in just a char *. The string returned by getenv() needs to be copied and saved. Switching the type of the strings from char * to std::string will do this and manage the alloated memory.

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




More information about the All-commits mailing list