llvm/lib/ExecutionEngine/Orc/Layer.cpp:53:12: warning: returning address of local temporary object [-Wreturn-stack-address]
In
StringRef IRMaterializationUnit::getName() const { [...] return TSM.withModuleDo( [](const Module &M) { return M.getModuleIdentifier(); });
getModuleIdentifier() returns a const std::string &, but the implicit return type
of the lambda is std::string by value, and thus the returned StringRef refers
to a temporary std::string.
Detect by annotating llvm::StringRef with [[gsl::Pointer]].