summaryrefslogtreecommitdiffstats
path: root/llvm/lib/System/Path.cpp
diff options
context:
space:
mode:
authorMikhail Glushenkov <foldr@codedgers.com>2010-11-02 22:18:37 +0000
committerMikhail Glushenkov <foldr@codedgers.com>2010-11-02 22:18:37 +0000
commit7282901079e38436010015387e31ed78736833c6 (patch)
treef2128b94d3719e9e16a27ef8bdbbf5966c4a1aae /llvm/lib/System/Path.cpp
parent4fb337560c845e5c44a758bee2ede7610da35e25 (diff)
downloadbcm5719-llvm-7282901079e38436010015387e31ed78736833c6.tar.gz
bcm5719-llvm-7282901079e38436010015387e31ed78736833c6.zip
appendSuffix: don't append a dot when the suffix is empty.
Additionally, move the implementation of appendSuffix to Path.cpp: it is platform-independent. llvm-svn: 118089
Diffstat (limited to 'llvm/lib/System/Path.cpp')
-rw-r--r--llvm/lib/System/Path.cpp15
1 files changed, 15 insertions, 0 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))
OpenPOWER on IntegriCloud