summaryrefslogtreecommitdiffstats
path: root/lib/Lex
diff options
context:
space:
mode:
authorrdivacky <rdivacky@FreeBSD.org>2009-10-23 14:22:18 +0000
committerrdivacky <rdivacky@FreeBSD.org>2009-10-23 14:22:18 +0000
commit5563df30b9c8d1fe87a54baae0d6bd86642563f4 (patch)
tree3fdd91eae574e32453a4baf462961c742df2691a /lib/Lex
parente5557c18e5d41b4b62f2af8a24af20eba40b0225 (diff)
downloadFreeBSD-src-5563df30b9c8d1fe87a54baae0d6bd86642563f4.zip
FreeBSD-src-5563df30b9c8d1fe87a54baae0d6bd86642563f4.tar.gz
Update clang to r84949.
Diffstat (limited to 'lib/Lex')
-rw-r--r--lib/Lex/PPDirectives.cpp2
-rw-r--r--lib/Lex/PTHLexer.cpp20
-rw-r--r--lib/Lex/Preprocessor.cpp4
-rw-r--r--lib/Lex/TokenConcatenation.cpp2
4 files changed, 11 insertions, 17 deletions
diff --git a/lib/Lex/PPDirectives.cpp b/lib/Lex/PPDirectives.cpp
index 196a77f..e264efa 100644
--- a/lib/Lex/PPDirectives.cpp
+++ b/lib/Lex/PPDirectives.cpp
@@ -1071,7 +1071,7 @@ void Preprocessor::HandleIncludeDirective(Token &IncludeTok,
// we allow macros that expand to nothing after the filename, because this
// falls into the category of "#include pp-tokens new-line" specified in
// C99 6.10.2p4.
- CheckEndOfDirective(IncludeTok.getIdentifierInfo()->getName(), true);
+ CheckEndOfDirective(IncludeTok.getIdentifierInfo()->getNameStart(), true);
// Check that we don't have infinite #include recursion.
if (IncludeMacroStack.size() == MaxAllowedIncludeStackDepth-1) {
diff --git a/lib/Lex/PTHLexer.cpp b/lib/Lex/PTHLexer.cpp
index 36ace8b..f17a5d9 100644
--- a/lib/Lex/PTHLexer.cpp
+++ b/lib/Lex/PTHLexer.cpp
@@ -20,8 +20,9 @@
#include "clang/Lex/PTHManager.h"
#include "clang/Lex/Token.h"
#include "clang/Lex/Preprocessor.h"
-#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/OwningPtr.h"
+#include "llvm/ADT/StringExtras.h"
+#include "llvm/ADT/StringMap.h"
#include "llvm/Support/MemoryBuffer.h"
#include <sys/stat.h>
using namespace clang;
@@ -95,14 +96,6 @@ LexNextToken:
//===--------------------------------------==//
// Process the token.
//===--------------------------------------==//
-#if 0
- SourceManager& SM = PP->getSourceManager();
- llvm::errs() << SM.getFileEntryForID(FileID)->getName()
- << ':' << SM.getLogicalLineNumber(Tok.getLocation())
- << ':' << SM.getLogicalColumnNumber(Tok.getLocation())
- << '\n';
-#endif
-
if (TKind == tok::eof) {
// Save the end-of-file token.
EofToken = Tok;
@@ -308,7 +301,7 @@ public:
typedef std::pair<unsigned char, const char*> internal_key_type;
static unsigned ComputeHash(internal_key_type x) {
- return BernsteinHash(x.second);
+ return llvm::HashString(x.second);
}
static std::pair<unsigned, unsigned>
@@ -363,7 +356,7 @@ public:
}
static unsigned ComputeHash(const internal_key_type& a) {
- return BernsteinHash(a.first, a.second);
+ return llvm::HashString(llvm::StringRef(a.first, a.second));
}
// This hopefully will just get inlined and removed by the optimizer.
@@ -562,7 +555,7 @@ IdentifierInfo* PTHManager::LazilyCreateIdentifierInfo(unsigned PersistentID) {
// Store the new IdentifierInfo in the cache.
PerIDCache[PersistentID] = II;
- assert(II->getName() && II->getName()[0] != '\0');
+ assert(II->getNameStart() && II->getNameStart()[0] != '\0');
return II;
}
@@ -679,7 +672,8 @@ public:
CacheTy::iterator I = Cache.find(path);
// If we don't get a hit in the PTH file just forward to 'stat'.
- if (I == Cache.end()) return ::stat(path, buf);
+ if (I == Cache.end())
+ return StatSysCallCache::stat(path, buf);
const PTHStatData& Data = *I;
diff --git a/lib/Lex/Preprocessor.cpp b/lib/Lex/Preprocessor.cpp
index bfa090a..7f3afc6 100644
--- a/lib/Lex/Preprocessor.cpp
+++ b/lib/Lex/Preprocessor.cpp
@@ -122,7 +122,7 @@ Preprocessor::~Preprocessor() {
void Preprocessor::setPTHManager(PTHManager* pm) {
PTH.reset(pm);
- FileMgr.setStatCache(PTH->createStatCache());
+ FileMgr.addStatCache(PTH->createStatCache());
}
void Preprocessor::DumpToken(const Token &Tok, bool DumpFlags) const {
@@ -234,7 +234,7 @@ unsigned Preprocessor::getSpelling(const Token &Tok,
// If this token is an identifier, just return the string from the identifier
// table, which is very quick.
if (const IdentifierInfo *II = Tok.getIdentifierInfo()) {
- Buffer = II->getName();
+ Buffer = II->getNameStart();
return II->getLength();
}
diff --git a/lib/Lex/TokenConcatenation.cpp b/lib/Lex/TokenConcatenation.cpp
index ade7f85..0795164 100644
--- a/lib/Lex/TokenConcatenation.cpp
+++ b/lib/Lex/TokenConcatenation.cpp
@@ -95,7 +95,7 @@ TokenConcatenation::TokenConcatenation(Preprocessor &pp) : PP(pp) {
static char GetFirstChar(Preprocessor &PP, const Token &Tok) {
if (IdentifierInfo *II = Tok.getIdentifierInfo()) {
// Avoid spelling identifiers, the most common form of token.
- return II->getName()[0];
+ return II->getNameStart()[0];
} else if (!Tok.needsCleaning()) {
if (Tok.isLiteral() && Tok.getLiteralData()) {
return *Tok.getLiteralData();
OpenPOWER on IntegriCloud