diff options
| author | Petr Hosek <phosek@chromium.org> | 2019-02-12 01:36:08 +0000 |
|---|---|---|
| committer | Petr Hosek <phosek@chromium.org> | 2019-02-12 01:36:08 +0000 |
| commit | 26eec703f7a2324a5ec90eb1476f15ce1e402a0c (patch) | |
| tree | 2fb34d3da6a8fdd4e826d4896e034c4b83d3353f | |
| parent | 5300d8411604c9471f2da506942046f7aa2a8c42 (diff) | |
| download | bcm5719-llvm-26eec703f7a2324a5ec90eb1476f15ce1e402a0c.tar.gz bcm5719-llvm-26eec703f7a2324a5ec90eb1476f15ce1e402a0c.zip | |
[sanitizer] Don't compile GetPathAssumingFileIsRelativeToExec on Fuchsia
This avoids the unused function warning during compilation.
Differential Revision: https://reviews.llvm.org/D58082
llvm-svn: 353787
| -rw-r--r-- | compiler-rt/lib/sanitizer_common/sanitizer_suppressions.cc | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_suppressions.cc b/compiler-rt/lib/sanitizer_common/sanitizer_suppressions.cc index 5d9cf4e09a0..1e236d9eb88 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_suppressions.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_suppressions.cc @@ -30,6 +30,7 @@ SuppressionContext::SuppressionContext(const char *suppression_types[], internal_memset(has_suppression_type_, 0, suppression_types_num_); } +#if !SANITIZER_FUCHSIA static bool GetPathAssumingFileIsRelativeToExec(const char *file_path, /*out*/char *new_file_path, uptr new_file_path_size) { @@ -46,20 +47,30 @@ static bool GetPathAssumingFileIsRelativeToExec(const char *file_path, return false; } +static const char *FindFile(const char *file_path, + /*out*/char *new_file_path, + uptr new_file_path_size) { + // If we cannot find the file, check if its location is relative to + // the location of the executable. + if (!FileExists(file_path) && !IsAbsolutePath(file_path) && + GetPathAssumingFileIsRelativeToExec(file_path, new_file_path, + new_file_path_size)) { + return new_file_path; + } + return file_path; +} +#else +static const char *FindFile(const char *file_path, char *, uptr) { + return file_path; +} +#endif + void SuppressionContext::ParseFromFile(const char *filename) { if (filename[0] == '\0') return; -#if !SANITIZER_FUCHSIA - // If we cannot find the file, check if its location is relative to - // the location of the executable. InternalScopedString new_file_path(kMaxPathLength); - if (!FileExists(filename) && !IsAbsolutePath(filename) && - GetPathAssumingFileIsRelativeToExec(filename, new_file_path.data(), - new_file_path.size())) { - filename = new_file_path.data(); - } -#endif // !SANITIZER_FUCHSIA + filename = FindFile(filename, new_file_path.data(), new_file_path.size()); // Read the file. VPrintf(1, "%s: reading suppressions file at %s\n", |

