diff options
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/System/Path.cpp | 15 | ||||
-rw-r--r-- | llvm/lib/System/Unix/Path.inc | 12 | ||||
-rw-r--r-- | llvm/lib/System/Win32/Path.inc | 12 |
3 files changed, 15 insertions, 24 deletions
diff --git a/llvm/lib/System/Path.cpp b/llvm/lib/System/Path.cpp index 8fc4153acb1..5d8de656612 100644 --- a/llvm/lib/System/Path.cpp +++ b/llvm/lib/System/Path.cpp @@ -196,6 +196,21 @@ StringRef Path::GetDLLSuffix() { } bool +Path::appendSuffix(StringRef suffix) { + if (!suffix.empty()) { + std::string save(path); + path.append("."); + path.append(suffix); + if (!isValid()) { + path = save; + return false; + } + } + + return true; +} + +bool Path::isBitcodeFile() const { std::string actualMagic; if (!getMagicNumber(actualMagic, 4)) diff --git a/llvm/lib/System/Unix/Path.inc b/llvm/lib/System/Unix/Path.inc index 15588689f92..b1d2ad24465 100644 --- a/llvm/lib/System/Unix/Path.inc +++ b/llvm/lib/System/Unix/Path.inc @@ -638,18 +638,6 @@ Path::eraseComponent() { } bool -Path::appendSuffix(StringRef suffix) { - std::string save(path); - path.append("."); - path.append(suffix); - if (!isValid()) { - path = save; - return false; - } - return true; -} - -bool Path::eraseSuffix() { std::string save = path; size_t dotpos = path.rfind('.',path.size()); diff --git a/llvm/lib/System/Win32/Path.inc b/llvm/lib/System/Win32/Path.inc index ea6d4639ba7..2ead80127b3 100644 --- a/llvm/lib/System/Win32/Path.inc +++ b/llvm/lib/System/Win32/Path.inc @@ -552,18 +552,6 @@ Path::eraseComponent() { } bool -Path::appendSuffix(StringRef suffix) { - std::string save(path); - path.append("."); - path.append(suffix); - if (!isValid()) { - path = save; - return false; - } - return true; -} - -bool Path::eraseSuffix() { size_t dotpos = path.rfind('.',path.size()); size_t slashpos = path.rfind('/',path.size()); |