mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 11:13:28 +01:00
Don't crash sancov if file is unreadable.
Summary: Caller can provides the list of .so files where some files are unreadable (e.g linux-vdso.so.1). It's more convenient to handler this in sancov with warning then making all callers to check files. Reviewers: aizatsky Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D18103 llvm-svn: 263307
This commit is contained in:
parent
d6d4e21338
commit
73bb34202a
@ -98,10 +98,9 @@ static cl::opt<bool> ClUseDefaultBlacklist(
|
|||||||
"use_default_blacklist", cl::init(true), cl::Hidden,
|
"use_default_blacklist", cl::init(true), cl::Hidden,
|
||||||
cl::desc("Controls if default blacklist should be used."));
|
cl::desc("Controls if default blacklist should be used."));
|
||||||
|
|
||||||
static const char *const DefaultBlacklistStr =
|
static const char *const DefaultBlacklistStr = "fun:__sanitizer_.*\n"
|
||||||
"fun:__sanitizer_.*\n"
|
"src:/usr/include/.*\n"
|
||||||
"src:/usr/include/.*\n"
|
"src:.*/libc\\+\\+/.*\n";
|
||||||
"src:.*/libc\\+\\+/.*\n";
|
|
||||||
|
|
||||||
// --------- FORMAT SPECIFICATION ---------
|
// --------- FORMAT SPECIFICATION ---------
|
||||||
|
|
||||||
@ -491,8 +490,12 @@ static std::string escapeHtml(const std::string &S) {
|
|||||||
static ErrorOr<bool> isCoverageFile(std::string FileName) {
|
static ErrorOr<bool> isCoverageFile(std::string FileName) {
|
||||||
ErrorOr<std::unique_ptr<MemoryBuffer>> BufOrErr =
|
ErrorOr<std::unique_ptr<MemoryBuffer>> BufOrErr =
|
||||||
MemoryBuffer::getFile(FileName);
|
MemoryBuffer::getFile(FileName);
|
||||||
if (!BufOrErr)
|
if (!BufOrErr) {
|
||||||
|
errs() << "Warning: " << BufOrErr.getError().message() << "("
|
||||||
|
<< BufOrErr.getError().value()
|
||||||
|
<< "), filename: " << llvm::sys::path::filename(FileName) << "\n";
|
||||||
return BufOrErr.getError();
|
return BufOrErr.getError();
|
||||||
|
}
|
||||||
std::unique_ptr<MemoryBuffer> Buf = std::move(BufOrErr.get());
|
std::unique_ptr<MemoryBuffer> Buf = std::move(BufOrErr.get());
|
||||||
if (Buf->getBufferSize() < 8) {
|
if (Buf->getBufferSize() < 8) {
|
||||||
return false;
|
return false;
|
||||||
@ -940,7 +943,8 @@ public:
|
|||||||
// Partition input values into coverage/object files.
|
// Partition input values into coverage/object files.
|
||||||
for (const auto &FileName : FileNames) {
|
for (const auto &FileName : FileNames) {
|
||||||
auto ErrorOrIsCoverage = isCoverageFile(FileName);
|
auto ErrorOrIsCoverage = isCoverageFile(FileName);
|
||||||
FailIfError(ErrorOrIsCoverage);
|
if (!ErrorOrIsCoverage)
|
||||||
|
continue;
|
||||||
if (ErrorOrIsCoverage.get()) {
|
if (ErrorOrIsCoverage.get()) {
|
||||||
CovFiles.insert(FileName);
|
CovFiles.insert(FileName);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user