Fix dangling reference
authorAndreas Simbuerger <simbuerg@fim.uni-passau.de>
Thu, 26 Jun 2014 11:09:13 +0000 (11:09 +0000)
committerAndreas Simbuerger <simbuerg@fim.uni-passau.de>
Thu, 26 Jun 2014 11:09:13 +0000 (11:09 +0000)
llvm-svn: 211773

polly/include/polly/ScopDetectionDiagnostic.h
polly/lib/Analysis/ScopDetectionDiagnostic.cpp

index f7f826b..90cd7f2 100644 (file)
@@ -126,6 +126,9 @@ class RejectReason {
 private:
   const RejectReasonKind Kind;
 
+protected:
+  static const DebugLoc Unknown;
+
 public:
   RejectReasonKind getKind() const { return Kind; }
 
index 8fde51a..584f4a4 100644 (file)
@@ -118,10 +118,11 @@ void emitValidRemarks(const llvm::Function &F, const Region *R) {
 
 //===----------------------------------------------------------------------===//
 // RejectReason.
+const DebugLoc RejectReason::Unknown = DebugLoc();
 
 const llvm::DebugLoc &RejectReason::getDebugLoc() const {
   // Allocate an empty DebugLoc and return it a reference to it.
-  return *(std::make_shared<DebugLoc>().get());
+  return Unknown;
 }
 
 //===----------------------------------------------------------------------===//