projects
/
oota-llvm.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Pass a std::uinque_ptr to ParseAssembly to make the ownership explicit. NFC.
[oota-llvm.git]
/
lib
/
IR
/
LeaksContext.h
diff --git
a/lib/IR/LeaksContext.h
b/lib/IR/LeaksContext.h
index 78cd695ecd1b3992f339f7ab969616d0376068ce..3e485abdfd18056f370b0ba5f825570fb3bf6e74 100644
(file)
--- a/
lib/IR/LeaksContext.h
+++ b/
lib/IR/LeaksContext.h
@@
-12,8
+12,12
@@
//
//===----------------------------------------------------------------------===//
//
//===----------------------------------------------------------------------===//
+#ifndef LLVM_LIB_IR_LEAKSCONTEXT_H
+#define LLVM_LIB_IR_LEAKSCONTEXT_H
+
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/IR/Value.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/IR/Value.h"
+#include "llvm/Support/raw_ostream.h"
namespace llvm {
namespace llvm {
@@
-28,12
+32,12
@@
struct PrinterTrait<Value> {
};
template <typename T>
};
template <typename T>
-struct L
LVM_LIBRARY_VISIBILITY L
eakDetectorImpl {
+struct LeakDetectorImpl {
explicit LeakDetectorImpl(const char* const name = "") :
explicit LeakDetectorImpl(const char* const name = "") :
- Cache(
0
), Name(name) { }
+ Cache(
nullptr
), Name(name) { }
void clear() {
void clear() {
- Cache =
0
;
+ Cache =
nullptr
;
Ts.clear();
}
Ts.clear();
}
@@
-57,15
+61,15
@@
struct LLVM_LIBRARY_VISIBILITY LeakDetectorImpl {
void removeGarbage(const T* o) {
if (o == Cache)
void removeGarbage(const T* o) {
if (o == Cache)
- Cache =
0
; // Cache hit
+ Cache =
nullptr
; // Cache hit
else
Ts.erase(o);
}
bool hasGarbage(const std::string& Message) {
else
Ts.erase(o);
}
bool hasGarbage(const std::string& Message) {
- addGarbage(
0
); // Flush the Cache
+ addGarbage(
nullptr
); // Flush the Cache
- assert(
Cache == 0
&& "No value should be cached anymore!");
+ assert(
!Cache
&& "No value should be cached anymore!");
if (!Ts.empty()) {
errs() << "Leaked " << Name << " objects found: " << Message << ":\n";
if (!Ts.empty()) {
errs() << "Leaked " << Name << " objects found: " << Message << ":\n";
@@
-90,3
+94,5
@@
private:
};
}
};
}
+
+#endif