Skip to content

Commit 65473f5

Browse files
committed
Use Identifier instead of StringRef to avoid dangling pointer
1 parent 3196ea9 commit 65473f5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/ClangImporter/ImportName.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1856,7 +1856,7 @@ ImportedName NameImporter::importNameImpl(const clang::NamedDecl *D,
18561856
case clang::OverloadedOperatorKind::OO_GreaterEqual:
18571857
case clang::OverloadedOperatorKind::OO_AmpAmp:
18581858
case clang::OverloadedOperatorKind::OO_PipePipe:
1859-
baseName = isa<clang::CXXMethodDecl>(functionDecl) ? StringRef{"__operator" + std::string{getOperatorName(op)}} : clang::getOperatorSpelling(op);
1859+
baseName = isa<clang::CXXMethodDecl>(functionDecl) ? swiftCtx.getIdentifier("__operator" + std::string{getOperatorName(op)}).str() : swiftCtx.getIdentifier(clang::getOperatorSpelling(op)).str();
18601860
isFunction = true;
18611861
addEmptyArgNamesForClangFunction(functionDecl, argumentNames);
18621862
break;

0 commit comments

Comments
 (0)