]> granicus.if.org Git - clang/commitdiff
Fix bug I introduced with assinging a temporary to a StringRef.
authorTed Kremenek <kremenek@apple.com>
Fri, 12 Feb 2010 23:31:14 +0000 (23:31 +0000)
committerTed Kremenek <kremenek@apple.com>
Fri, 12 Feb 2010 23:31:14 +0000 (23:31 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96041 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Basic/Version.cpp
lib/Frontend/PCHReader.cpp

index 0c81fdd0756eb67ea608ba02b9dc2dda93e4e08e..434ddf3f57d97111dff4fdb6147f40162b2d6949 100644 (file)
@@ -55,7 +55,7 @@ std::string getClangFullRepositoryVersion() {
   std::string buf;
   llvm::raw_string_ostream OS(buf);
   OS << getClangRepositoryPath();
-  llvm::StringRef Revision = getClangRevision();
+  const std::string &Revision = getClangRevision();
   if (!Revision.empty())
     OS << ' ' << Revision;
   return buf;
index f6f4a78c13e453fdc5175ac7ec4cdf52b8bca8a8..a878df7840053cb75b5137851fe2f521b551312d 100644 (file)
@@ -1414,9 +1414,9 @@ PCHReader::ReadPCHBlock() {
       break;
         
     case pch::VERSION_CONTROL_BRANCH_REVISION: {
-      llvm::StringRef CurBranch = getClangFullRepositoryVersion();
+      const std::string &CurBranch = getClangFullRepositoryVersion();
       llvm::StringRef PCHBranch(BlobStart, BlobLen);
-      if (CurBranch != PCHBranch) {
+      if (llvm::StringRef(CurBranch) != PCHBranch) {
         Diag(diag::warn_pch_different_branch) << PCHBranch << CurBranch;
         return IgnorePCH;
       }