Use std::string instead of StringRef to prevent use-after-free.
authorDaniel Jasper <djasper@google.com>
Thu, 5 Mar 2015 23:17:32 +0000 (23:17 +0000)
committerDaniel Jasper <djasper@google.com>
Thu, 5 Mar 2015 23:17:32 +0000 (23:17 +0000)
Discovered by asan.

llvm-svn: 231421

clang-tools-extra/clang-tidy/readability/NamespaceCommentCheck.cpp

index 61c7b36..7264f49 100644 (file)
@@ -83,7 +83,7 @@ void NamespaceCommentCheck::check(const MatchFinder::MatchResult &Result) {
   bool NeedLineBreak = NextTokenIsOnSameLine && Tok.isNot(tok::eof);
 
   SourceRange OldCommentRange(AfterRBrace, AfterRBrace);
-  StringRef Message = "%0 not terminated with a closing comment";
+  std::string Message = "%0 not terminated with a closing comment";
 
   // Try to find existing namespace closing comment on the same line.
   if (Tok.is(tok::comment) && NextTokenIsOnSameLine) {