Skip to content

-Wdangling-reference reported in llvm/utils/TableGen/GlobalISelCombinerEmitter.cpp #125538

@firewave

Description

@firewave
/home/user/CLionProjects/llvm-project/llvm/utils/TableGen/GlobalISelCombinerEmitter.cpp: In member function ‘bool {anonymous}::CombineRuleBuilder::emitCXXMatchApply(llvm::CodeExpansions&, llvm::gi::RuleMatcher&, llvm::ArrayRef<llvm::gi::CXXPattern*>)’:
/home/user/CLionProjects/llvm-project/llvm/utils/TableGen/GlobalISelCombinerEmitter.cpp:1910:15: warning: possibly dangling reference to a temporary [-Wdangling-reference]
 1910 |   const auto &Code = CXXPredicateCode::getCustomActionCode(CodeStr);
      |               ^~~~
/home/user/CLionProjects/llvm-project/llvm/utils/TableGen/GlobalISelCombinerEmitter.cpp:1910:59: note: the temporary was destroyed at the end of the full expression ‘llvm::gi::CXXPredicateCode::getCustomActionCode(std::__cxx11::basic_string<char>(CodeStr))’
 1910 |   const auto &Code = CXXPredicateCode::getCustomActionCode(CodeStr);
      |                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~

I am using gcc (GCC) 14.2.1 20240910 on Manjaro Linux.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions