Skip to content

Commit cc54ee8

Browse files
committed
[clang][HLSL] Fix crash issue due to Twine usage
- Dangling pointer (from std::string) is created and trigger crash on some Linux distributions under different build types.
1 parent 0385a18 commit cc54ee8

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

clang/lib/Sema/SemaHLSL.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -940,8 +940,7 @@ void SemaHLSL::checkSemanticAnnotation(
940940
DiagnoseAttrStageMismatch(SemanticAttr, ST, {llvm::Triple::Compute});
941941

942942
if (SemanticAttr->getSemanticIndex() != 0) {
943-
Twine PrettyName =
944-
std::string("'") + SemanticAttr->getSemanticName() + "'";
943+
Twine PrettyName = "'" + SemanticAttr->getSemanticName() + "'";
945944
Diag(SemanticAttr->getLoc(),
946945
diag::err_hlsl_semantic_indexing_not_supported)
947946
<< PrettyName.str();

0 commit comments

Comments
 (0)