aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2010-01-22 20:55:35 +0000
committerTed Kremenek <kremenek@apple.com>2010-01-22 20:55:35 +0000
commit517e676b9e1524e39beeb47718822f2647801d1a (patch)
tree0cca5f69805de64b3c83350e35c89f330cbf6d21
parent9fb48de917e6646725d5bb01b6e2c5ec46ff75a1 (diff)
Rename getClangSubversionPath() -> getClangRepositoryPath() and have it return a StringRef.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94213 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/Basic/Version.h9
-rw-r--r--lib/Basic/Version.cpp5
-rw-r--r--lib/Driver/Driver.cpp2
-rw-r--r--lib/Frontend/PCHReader.cpp6
-rw-r--r--lib/Frontend/PCHWriter.cpp2
5 files changed, 15 insertions, 9 deletions
diff --git a/include/clang/Basic/Version.h b/include/clang/Basic/Version.h
index 120d5a4210..c44c0f0407 100644
--- a/include/clang/Basic/Version.h
+++ b/include/clang/Basic/Version.h
@@ -15,6 +15,8 @@
#ifndef LLVM_CLANG_BASIC_VERSION_H
#define LLVM_CLANG_BASIC_VERSION_H
+#include "llvm/ADT/StringRef.h"
+
/// \brief Clang major version
#define CLANG_VERSION_MAJOR 1
@@ -47,9 +49,10 @@
#endif
namespace clang {
- /// \brief Retrieves the Subversion path that identifies the particular
- /// Clang branch, tag, or trunk from which this Clang was built.
- const char *getClangSubversionPath();
+ /// \brief Retrieves the repository path (e.g., Subversion path) that
+ /// identifies the particular Clang branch, tag, or trunk from which this
+ /// Clang was built.
+ llvm::StringRef getClangRepositoryPath();
/// \brief Retrieves the Subversion revision number from which this Clang
/// was built.
diff --git a/lib/Basic/Version.cpp b/lib/Basic/Version.cpp
index 18a8a88810..0751cfcf5d 100644
--- a/lib/Basic/Version.cpp
+++ b/lib/Basic/Version.cpp
@@ -10,13 +10,16 @@
// This file defines several version-related utility functions for Clang.
//
//===----------------------------------------------------------------------===//
+
+#include "llvm/ADT/StringRef.h"
#include <cstring>
#include <cstdlib>
+
using namespace std;
namespace clang {
-const char *getClangSubversionPath() {
+llvm::StringRef getClangRepositoryPath() {
static const char *Path = 0;
if (Path)
return Path;
diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp
index c2693d8dff..5490ef3d67 100644
--- a/lib/Driver/Driver.cpp
+++ b/lib/Driver/Driver.cpp
@@ -286,7 +286,7 @@ void Driver::PrintVersion(const Compilation &C, llvm::raw_ostream &OS) const {
OS << CLANG_VENDOR;
#endif
OS << "clang version " CLANG_VERSION_STRING " ("
- << getClangSubversionPath();
+ << getClangRepositoryPath();
if (unsigned Revision = getClangSubversionRevision())
OS << " " << Revision;
OS << ")" << '\n';
diff --git a/lib/Frontend/PCHReader.cpp b/lib/Frontend/PCHReader.cpp
index 77fa11e3e3..4114b8b95d 100644
--- a/lib/Frontend/PCHReader.cpp
+++ b/lib/Frontend/PCHReader.cpp
@@ -1407,9 +1407,9 @@ PCHReader::ReadPCHBlock() {
return IgnorePCH;
}
- const char *CurBranch = getClangSubversionPath();
- if (strncmp(CurBranch, BlobStart, BlobLen)) {
- std::string PCHBranch(BlobStart, BlobLen);
+ llvm::StringRef CurBranch = getClangRepositoryPath();
+ llvm::StringRef PCHBranch(BlobStart, BlobLen);
+ if (CurBranch != PCHBranch) {
Diag(diag::warn_pch_different_branch) << PCHBranch << CurBranch;
return IgnorePCH;
}
diff --git a/lib/Frontend/PCHWriter.cpp b/lib/Frontend/PCHWriter.cpp
index 29647f3b95..caaf880df8 100644
--- a/lib/Frontend/PCHWriter.cpp
+++ b/lib/Frontend/PCHWriter.cpp
@@ -716,7 +716,7 @@ void PCHWriter::WriteMetadata(ASTContext &Context, const char *isysroot) {
Record.clear();
Record.push_back(pch::SVN_BRANCH_REVISION);
Record.push_back(getClangSubversionRevision());
- Stream.EmitRecordWithBlob(SvnAbbrevCode, Record, getClangSubversionPath());
+ Stream.EmitRecordWithBlob(SvnAbbrevCode, Record, getClangRepositoryPath());
}
/// \brief Write the LangOptions structure.