================ @@ -1219,8 +1222,24 @@ VersionTuple Triple::getEnvironmentVersion() const { StringRef Triple::getEnvironmentVersionString() const { StringRef EnvironmentName = getEnvironmentName(); + + // none is a valid environment type - it basically amounts to a freestanding + // environment. + if (EnvironmentName == "none") + return ""; + StringRef EnvironmentTypeName = getEnvironmentTypeName(getEnvironment()); EnvironmentName.consume_front(EnvironmentTypeName); + + if (EnvironmentName.contains("-")) { + // -obj is the suffix + if (getObjectFormat() != Triple::UnknownObjectFormat) { + StringRef ObjectFormatTypeName = + getObjectFormatTypeName(getObjectFormat()); + StringRef Suffix = (Twine("-") + ObjectFormatTypeName).str(); ---------------- MaskRay wrote:
This creates a temporary `std::string` and binds it on a StringRef. The temporary `std::string` is then destroyed, leading to a dangling reference, which Clang helpfully warns -Wdangling-gsl https://github.com/llvm/llvm-project/pull/78655 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits