[cfe-commits] r94213 - in /cfe/trunk: include/clang/Basic/Version.h lib/Basic/Version.cpp lib/Driver/Driver.cpp lib/Frontend/PCHReader.cpp lib/Frontend/PCHWriter.cpp
Ted Kremenek
kremenek at apple.com
Fri Jan 22 12:55:35 PST 2010
Author: kremenek
Date: Fri Jan 22 14:55:35 2010
New Revision: 94213
URL: http://llvm.org/viewvc/llvm-project?rev=94213&view=rev
Log:
Rename getClangSubversionPath() -> getClangRepositoryPath() and have it return a StringRef.
Modified:
cfe/trunk/include/clang/Basic/Version.h
cfe/trunk/lib/Basic/Version.cpp
cfe/trunk/lib/Driver/Driver.cpp
cfe/trunk/lib/Frontend/PCHReader.cpp
cfe/trunk/lib/Frontend/PCHWriter.cpp
Modified: cfe/trunk/include/clang/Basic/Version.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Version.h?rev=94213&r1=94212&r2=94213&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/Version.h (original)
+++ cfe/trunk/include/clang/Basic/Version.h Fri Jan 22 14:55:35 2010
@@ -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.
Modified: cfe/trunk/lib/Basic/Version.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Version.cpp?rev=94213&r1=94212&r2=94213&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Version.cpp (original)
+++ cfe/trunk/lib/Basic/Version.cpp Fri Jan 22 14:55:35 2010
@@ -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;
Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=94213&r1=94212&r2=94213&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Fri Jan 22 14:55:35 2010
@@ -286,7 +286,7 @@
OS << CLANG_VENDOR;
#endif
OS << "clang version " CLANG_VERSION_STRING " ("
- << getClangSubversionPath();
+ << getClangRepositoryPath();
if (unsigned Revision = getClangSubversionRevision())
OS << " " << Revision;
OS << ")" << '\n';
Modified: cfe/trunk/lib/Frontend/PCHReader.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PCHReader.cpp?rev=94213&r1=94212&r2=94213&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/PCHReader.cpp (original)
+++ cfe/trunk/lib/Frontend/PCHReader.cpp Fri Jan 22 14:55:35 2010
@@ -1407,9 +1407,9 @@
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;
}
Modified: cfe/trunk/lib/Frontend/PCHWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PCHWriter.cpp?rev=94213&r1=94212&r2=94213&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/PCHWriter.cpp (original)
+++ cfe/trunk/lib/Frontend/PCHWriter.cpp Fri Jan 22 14:55:35 2010
@@ -716,7 +716,7 @@
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.
More information about the cfe-commits
mailing list