Rename getClangSubversionPath() -> getClangRepositoryPath() and have it return a StringRef.

llvm-svn: 94213
This commit is contained in:
Ted Kremenek 2010-01-22 20:55:35 +00:00
parent 9ae8d349e6
commit 2377a0e0ea
5 changed files with 15 additions and 9 deletions

View File

@ -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.

View File

@ -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;

View File

@ -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';

View File

@ -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;
}

View File

@ -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.