mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-26 23:32:58 +00:00
Move a helper class out of bugpoint to here.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11582 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
a972dadb20
commit
f1e3285f3a
@ -131,6 +131,26 @@ public:
|
|||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// FileRemover - This class is a simple object meant to be stack allocated.
|
||||||
|
/// If an exception is thrown from a region, the object removes the filename
|
||||||
|
/// specified (if deleteIt is true).
|
||||||
|
///
|
||||||
|
class FileRemover {
|
||||||
|
bool DeleteIt;
|
||||||
|
std::string Filename;
|
||||||
|
public:
|
||||||
|
FileRemover(bool deleteIt, const std::string &filename)
|
||||||
|
: DeleteIt(deleteIt), Filename(filename) {}
|
||||||
|
|
||||||
|
~FileRemover() {
|
||||||
|
if (DeleteIt) removeFile(Filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// releaseFile - Take ownership of the file away from the FileRemover so it
|
||||||
|
/// will not be removed when the object is destroyed.
|
||||||
|
void releaseFile() { DeleteIt = false; }
|
||||||
|
};
|
||||||
} // End llvm namespace
|
} // End llvm namespace
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -131,6 +131,26 @@ public:
|
|||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// FileRemover - This class is a simple object meant to be stack allocated.
|
||||||
|
/// If an exception is thrown from a region, the object removes the filename
|
||||||
|
/// specified (if deleteIt is true).
|
||||||
|
///
|
||||||
|
class FileRemover {
|
||||||
|
bool DeleteIt;
|
||||||
|
std::string Filename;
|
||||||
|
public:
|
||||||
|
FileRemover(bool deleteIt, const std::string &filename)
|
||||||
|
: DeleteIt(deleteIt), Filename(filename) {}
|
||||||
|
|
||||||
|
~FileRemover() {
|
||||||
|
if (DeleteIt) removeFile(Filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// releaseFile - Take ownership of the file away from the FileRemover so it
|
||||||
|
/// will not be removed when the object is destroyed.
|
||||||
|
void releaseFile() { DeleteIt = false; }
|
||||||
|
};
|
||||||
} // End llvm namespace
|
} // End llvm namespace
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user