aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-01-17 06:22:33 +0000
committerChris Lattner <sabre@nondot.org>2009-01-17 06:22:33 +0000
commit2b2453a7d8fe732561795431f39ceb2b2a832d84 (patch)
treead3d68197002f997b30e6617e41e290eff963b03 /include
parent05816591ec488a933dfecc9ff9f3cbf3c32767c2 (diff)
this massive patch introduces a simple new abstraction: it makes
"FileID" a concept that is now enforced by the compiler's type checker instead of yet-another-random-unsigned floating around. This is an important distinction from the "FileID" currently tracked by SourceLocation. *That* FileID may refer to the start of a file or to a chunk within it. The new FileID *only* refers to the file (and its #include stack and eventually #line data), it cannot refer to a chunk. FileID is a completely opaque datatype to all clients, only SourceManager is allowed to poke and prod it. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62407 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/clang/Basic/SourceLocation.h60
-rw-r--r--include/clang/Basic/SourceManager.h82
-rw-r--r--include/clang/Lex/PTHLexer.h10
-rw-r--r--include/clang/Lex/PTHManager.h14
-rw-r--r--include/clang/Lex/Preprocessor.h6
-rw-r--r--include/clang/Lex/PreprocessorLexer.h22
-rw-r--r--include/clang/Lex/ScratchBuffer.h5
-rw-r--r--include/clang/Rewrite/HTMLRewrite.h20
-rw-r--r--include/clang/Rewrite/Rewriter.h13
-rw-r--r--include/clang/Rewrite/TokenRewriter.h2
10 files changed, 151 insertions, 83 deletions
diff --git a/include/clang/Basic/SourceLocation.h b/include/clang/Basic/SourceLocation.h
index ba359bddae..227313b7bf 100644
--- a/include/clang/Basic/SourceLocation.h
+++ b/include/clang/Basic/SourceLocation.h
@@ -18,13 +18,46 @@
#include "llvm/Bitcode/SerializationFwd.h"
namespace llvm {
-class MemoryBuffer;
+ class MemoryBuffer;
+ template <typename T> struct DenseMapInfo;
}
namespace clang {
class SourceManager;
class FileEntry;
+
+/// FileID - This is an opaque identifier used by SourceManager which refers to
+/// a source file (MemoryBuffer) along with its #include path and #line data.
+///
+class FileID {
+ /// ID - Opaque identifier, 0 is "invalid".
+ unsigned ID;
+public:
+ FileID() : ID(0) {}
+
+ bool isInvalid() const { return ID == 0; }
+
+ bool operator==(const FileID &RHS) const { return ID == RHS.ID; }
+ bool operator<(const FileID &RHS) const { return ID < RHS.ID; }
+ bool operator<=(const FileID &RHS) const { return ID <= RHS.ID; }
+ bool operator!=(const FileID &RHS) const { return !(*this == RHS); }
+ bool operator>(const FileID &RHS) const { return RHS < *this; }
+ bool operator>=(const FileID &RHS) const { return RHS <= *this; }
+
+ static FileID getSentinel() { return Create(~0U); }
+ unsigned getHashValue() const { return ID; }
+
+private:
+ friend class SourceManager;
+ static FileID Create(unsigned V) {
+ FileID F;
+ F.ID = V;
+ return F;
+ }
+ unsigned getOpaqueValue() const { return ID; }
+};
+
/// SourceLocation - This is a carefully crafted 32-bit identifier that encodes
/// a full include stack, line and column number information for a position in
@@ -269,4 +302,29 @@ public:
} // end namespace clang
+namespace llvm {
+ /// Define DenseMapInfo so that FileID's can be used as keys in DenseMap and
+ /// DenseSets.
+ template <>
+ struct DenseMapInfo<clang::FileID> {
+ static inline clang::FileID getEmptyKey() {
+ return clang::FileID();
+ }
+ static inline clang::FileID getTombstoneKey() {
+ return clang::FileID::getSentinel();
+ }
+
+ static unsigned getHashValue(clang::FileID S) {
+ return S.getHashValue();
+ }
+
+ static bool isEqual(clang::FileID LHS, clang::FileID RHS) {
+ return LHS == RHS;
+ }
+
+ static bool isPod() { return true; }
+ };
+
+} // end namespace llvm
+
#endif
diff --git a/include/clang/Basic/SourceManager.h b/include/clang/Basic/SourceManager.h
index 4db38017cc..4f46bad8db 100644
--- a/include/clang/Basic/SourceManager.h
+++ b/include/clang/Basic/SourceManager.h
@@ -256,47 +256,47 @@ class SourceManager {
/// LastLineNo - These ivars serve as a cache used in the getLineNumber
/// method which is used to speedup getLineNumber calls to nearby locations.
- mutable unsigned LastLineNoFileIDQuery;
+ mutable FileID LastLineNoFileIDQuery;
mutable SrcMgr::ContentCache *LastLineNoContentCache;
mutable unsigned LastLineNoFilePos;
mutable unsigned LastLineNoResult;
/// MainFileID - The file ID for the main source file of the translation unit.
- unsigned MainFileID;
+ FileID MainFileID;
// SourceManager doesn't support copy construction.
explicit SourceManager(const SourceManager&);
void operator=(const SourceManager&);
public:
- SourceManager() : LastLineNoFileIDQuery(~0U), MainFileID(0) {}
+ SourceManager() {}
~SourceManager() {}
void clearIDTables() {
- MainFileID = 0;
+ MainFileID = FileID();
FileIDs.clear();
MacroIDs.clear();
- LastLineNoFileIDQuery = ~0U;
+ LastLineNoFileIDQuery = FileID();
LastLineNoContentCache = 0;
}
/// getMainFileID - Returns the FileID of the main source file.
- unsigned getMainFileID() const { return MainFileID; }
+ FileID getMainFileID() const { return MainFileID; }
/// createFileID - Create a new FileID that represents the specified file
/// being #included from the specified IncludePosition. This returns 0 on
/// error and translates NULL into standard input.
- unsigned createFileID(const FileEntry *SourceFile, SourceLocation IncludePos,
+ FileID createFileID(const FileEntry *SourceFile, SourceLocation IncludePos,
SrcMgr::CharacteristicKind FileCharacter) {
const SrcMgr::ContentCache *IR = getContentCache(SourceFile);
- if (IR == 0) return 0; // Error opening file?
+ if (IR == 0) return FileID(); // Error opening file?
return createFileID(IR, IncludePos, FileCharacter);
}
/// createMainFileID - Create the FileID for the main source file.
- unsigned createMainFileID(const FileEntry *SourceFile,
+ FileID createMainFileID(const FileEntry *SourceFile,
SourceLocation IncludePos) {
- assert (MainFileID == 0 && "MainFileID already set!");
+ assert(MainFileID.isInvalid() && "MainFileID already set!");
MainFileID = createFileID(SourceFile, IncludePos, SrcMgr::C_User);
return MainFileID;
}
@@ -304,7 +304,7 @@ public:
/// createFileIDForMemBuffer - Create a new FileID that represents the
/// specified memory buffer. This does no caching of the buffer and takes
/// ownership of the MemoryBuffer, so only pass a MemoryBuffer to this once.
- unsigned createFileIDForMemBuffer(const llvm::MemoryBuffer *Buffer) {
+ FileID createFileIDForMemBuffer(const llvm::MemoryBuffer *Buffer) {
return createFileID(createMemBufferContentCache(Buffer), SourceLocation(),
SrcMgr::C_User);
}
@@ -312,12 +312,19 @@ public:
/// createMainFileIDForMembuffer - Create the FileID for a memory buffer
/// that will represent the FileID for the main source. One example
/// of when this would be used is when the main source is read from STDIN.
- unsigned createMainFileIDForMemBuffer(const llvm::MemoryBuffer *Buffer) {
- assert (MainFileID == 0 && "MainFileID already set!");
+ FileID createMainFileIDForMemBuffer(const llvm::MemoryBuffer *Buffer) {
+ assert(MainFileID.isInvalid() && "MainFileID already set!");
MainFileID = createFileIDForMemBuffer(Buffer);
return MainFileID;
}
+ /// getLocForStartOfFile - Return the source location corresponding to the
+ /// first byte of the specified file.
+ SourceLocation getLocForStartOfFile(FileID FID) const {
+ return SourceLocation::getFileLoc(FID.ID, 0);
+ }
+
+
/// getInstantiationLoc - Return a new SourceLocation that encodes the fact
/// that a token at Loc should actually be referenced from InstantiationLoc.
SourceLocation getInstantiationLoc(SourceLocation Loc,
@@ -325,13 +332,19 @@ public:
/// getBuffer - Return the buffer for the specified FileID.
///
- const llvm::MemoryBuffer *getBuffer(unsigned FileID) const {
- return getContentCache(FileID)->getBuffer();
+ const llvm::MemoryBuffer *getBuffer(FileID FID) const {
+ return getContentCache(FID)->getBuffer();
+ }
+
+ const llvm::MemoryBuffer *getBuffer(SourceLocation Loc) const {
+ return getContentCacheForLoc(Loc)->getBuffer();
}
+
/// getBufferData - Return a pointer to the start and end of the character
/// data for the specified FileID.
- std::pair<const char*, const char*> getBufferData(unsigned FileID) const;
+ std::pair<const char*, const char*> getBufferData(SourceLocation Loc) const;
+ std::pair<const char*, const char*> getBufferData(FileID FID) const;
/// getIncludeLoc - Return the location of the #include for the specified
/// SourceLocation. If this is a macro expansion, this transparently figures
@@ -414,8 +427,8 @@ public:
}
/// getFileEntryForID - Returns the FileEntry record for the provided FileID.
- const FileEntry* getFileEntryForID(unsigned id) const {
- return getContentCache(id)->Entry;
+ const FileEntry *getFileEntryForID(FileID FID) const {
+ return getContentCache(FID)->Entry;
}
/// getCanonicalFileID - Return the canonical FileID for a SourceLocation.
@@ -423,14 +436,14 @@ public:
/// into multiple chunks. This method returns the unique FileID without
/// chunk information for a given SourceLocation. Use this method when
/// you want to compare FileIDs across SourceLocations.
- unsigned getCanonicalFileID(SourceLocation SpellingLoc) const {
+ FileID getCanonicalFileID(SourceLocation SpellingLoc) const {
return getDecomposedFileLoc(SpellingLoc).first;
}
/// getDecomposedFileLoc - Decompose the specified file location into a raw
/// FileID + Offset pair. The first element is the FileID, the second is the
/// offset from the start of the buffer of the location.
- std::pair<unsigned, unsigned> getDecomposedFileLoc(SourceLocation Loc) const {
+ std::pair<FileID, unsigned> getDecomposedFileLoc(SourceLocation Loc) const {
assert(Loc.isFileID() && "Isn't a File SourceLocation");
// TODO: Add a flag "is first chunk" to SLOC.
@@ -444,7 +457,7 @@ public:
assert(Loc.getFileID() >= ChunkNo && "Unexpected offset");
- return std::make_pair(Loc.getFileID()-ChunkNo, Offset);
+ return std::make_pair(FileID::Create(Loc.getFileID()-ChunkNo), Offset);
}
/// getFullFilePos - This (efficient) method returns the offset from the start
@@ -474,8 +487,8 @@ public:
SrcMgr::CharacteristicKind getFileCharacteristic(SourceLocation Loc) const {
return getFIDInfo(getSpellingLoc(Loc).getFileID())->getFileCharacteristic();
}
- SrcMgr::CharacteristicKind getFileCharacteristic(unsigned FileID) const {
- return getFIDInfo(FileID)->getFileCharacteristic();
+ SrcMgr::CharacteristicKind getFileCharacteristic(FileID FID) const {
+ return getFIDInfo(FID)->getFileCharacteristic();
}
// Iterators over FileInfos.
@@ -500,26 +513,29 @@ private:
/// createFileID - Create a new fileID for the specified ContentCache and
/// include position. This works regardless of whether the ContentCache
/// corresponds to a file or some other input source.
- unsigned createFileID(const SrcMgr::ContentCache* File,
- SourceLocation IncludePos,
- SrcMgr::CharacteristicKind DirCharacter);
+ FileID createFileID(const SrcMgr::ContentCache* File,
+ SourceLocation IncludePos,
+ SrcMgr::CharacteristicKind DirCharacter);
/// getContentCache - Create or return a cached ContentCache for the specified
/// file. This returns null on failure.
- const SrcMgr::ContentCache* getContentCache(const FileEntry* SourceFile);
+ const SrcMgr::ContentCache* getContentCache(const FileEntry *SourceFile);
/// createMemBufferContentCache - Create a new ContentCache for the specified
/// memory buffer.
const SrcMgr::ContentCache*
- createMemBufferContentCache(const llvm::MemoryBuffer* Buf);
+ createMemBufferContentCache(const llvm::MemoryBuffer *Buf);
- const SrcMgr::FileIDInfo* getFIDInfo(unsigned FileID) const {
- assert(FileID-1 < FileIDs.size() && "Invalid FileID!");
- return &FileIDs[FileID-1];
+ const SrcMgr::FileIDInfo *getFIDInfo(unsigned FID) const {
+ assert(FID-1 < FileIDs.size() && "Invalid FileID!");
+ return &FileIDs[FID-1];
+ }
+ const SrcMgr::FileIDInfo *getFIDInfo(FileID FID) const {
+ return getFIDInfo(FID.ID);
}
- const SrcMgr::ContentCache *getContentCache(unsigned FileID) const {
- return getContentCache(getFIDInfo(FileID));
+ const SrcMgr::ContentCache *getContentCache(FileID FID) const {
+ return getContentCache(getFIDInfo(FID.ID));
}
/// Return the ContentCache structure for the specified FileID.
diff --git a/include/clang/Lex/PTHLexer.h b/include/clang/Lex/PTHLexer.h
index f19d67958f..e58c5e3f2b 100644
--- a/include/clang/Lex/PTHLexer.h
+++ b/include/clang/Lex/PTHLexer.h
@@ -23,9 +23,7 @@ class PTHManager;
class PTHSpellingSearch;
class PTHLexer : public PreprocessorLexer {
-private:
- /// FileID - The SourceManager FileID for the original source file.
- unsigned FileID;
+ SourceLocation FileStartLoc;
/// TokBuf - Buffer from PTH file containing raw token data.
const char* TokBuf;
@@ -66,10 +64,8 @@ protected:
friend class PTHManager;
/// Create a PTHLexer for the specified token stream.
- PTHLexer(Preprocessor& pp, SourceLocation fileloc, const char* D,
- const char* ppcond,
- PTHSpellingSearch& mySpellingSrch,
- PTHManager& PM);
+ PTHLexer(Preprocessor& pp, FileID FID, const char *D, const char* ppcond,
+ PTHSpellingSearch& mySpellingSrch, PTHManager &PM);
public:
~PTHLexer() {}
diff --git a/include/clang/Lex/PTHManager.h b/include/clang/Lex/PTHManager.h
index 634c088b8f..c4ecfd6ed1 100644
--- a/include/clang/Lex/PTHManager.h
+++ b/include/clang/Lex/PTHManager.h
@@ -62,7 +62,7 @@ class PTHManager : public IdentifierInfoLookup {
const llvm::MemoryBuffer* Buf;
/// A map from FileIDs to SpellingSearch objects.
- llvm::DenseMap<unsigned,PTHSpellingSearch*> SpellingMap;
+ llvm::DenseMap<FileID, PTHSpellingSearch*> SpellingMap;
/// Alloc - Allocator used for IdentifierInfo objects.
llvm::BumpPtrAllocator Alloc;
@@ -117,20 +117,22 @@ public:
/// Unlike the version in IdentifierTable, this returns a pointer instead
/// of a reference. If the pointer is NULL then the IdentifierInfo cannot
/// be found.
- IdentifierInfo* get(const char *NameStart, const char *NameEnd);
+ IdentifierInfo *get(const char *NameStart, const char *NameEnd);
/// Create - This method creates PTHManager objects. The 'file' argument
/// is the name of the PTH file. This method returns NULL upon failure.
- static PTHManager* Create(const std::string& file);
+ static PTHManager *Create(const std::string& file);
- void setPreprocessor(Preprocessor* pp) { PP = pp; }
+ void setPreprocessor(Preprocessor *pp) { PP = pp; }
/// CreateLexer - Return a PTHLexer that "lexes" the cached tokens for the
/// specified file. This method returns NULL if no cached tokens exist.
/// It is the responsibility of the caller to 'delete' the returned object.
- PTHLexer* CreateLexer(unsigned FileID, const FileEntry* FE);
+ PTHLexer *CreateLexer(FileID FID, const FileEntry *FE);
- unsigned getSpelling(unsigned FileID, unsigned fpos, const char *& Buffer);
+ unsigned getSpelling(SourceLocation Loc, const char *&Buffer);
+private:
+ unsigned getSpelling(FileID FID, unsigned fpos, const char *& Buffer);
};
} // end namespace clang
diff --git a/include/clang/Lex/Preprocessor.h b/include/clang/Lex/Preprocessor.h
index b85c725490..e453fd04d6 100644
--- a/include/clang/Lex/Preprocessor.h
+++ b/include/clang/Lex/Preprocessor.h
@@ -284,7 +284,7 @@ public:
/// EnterSourceFile - Add a source file to the top of the include stack and
/// start lexing tokens from it instead of the current buffer. If isMainFile
/// is true, this is the main file for the translation unit.
- void EnterSourceFile(unsigned CurFileID, const DirectoryLookup *Dir);
+ void EnterSourceFile(FileID CurFileID, const DirectoryLookup *Dir);
/// EnterMacro - Add a Macro to the top of the include stack and start lexing
/// tokens from it instead of the current buffer. Args specifies the
@@ -456,10 +456,8 @@ public:
char getSpelledCharacterAt(SourceLocation SL) const {
if (PTH) {
SL = SourceMgr.getSpellingLoc(SL);
- unsigned FID = SourceMgr.getCanonicalFileID(SL);
- unsigned FPos = SourceMgr.getFullFilePos(SL);
const char *Data;
- if (PTH->getSpelling(FID, FPos, Data))
+ if (PTH->getSpelling(SL, Data))
return *Data;
}
diff --git a/include/clang/Lex/PreprocessorLexer.h b/include/clang/Lex/PreprocessorLexer.h
index a889a55b52..3cf0f92b30 100644
--- a/include/clang/Lex/PreprocessorLexer.h
+++ b/include/clang/Lex/PreprocessorLexer.h
@@ -27,8 +27,8 @@ class PreprocessorLexer {
protected:
Preprocessor *PP; // Preprocessor object controlling lexing.
- /// The SourceManager fileID corresponding to the file being lexed.
- const unsigned FileID;
+ /// The SourceManager FileID corresponding to the file being lexed.
+ const FileID FID;
//===--------------------------------------------------------------------===//
// Context-specific lexing flags set by the preprocessor.
@@ -67,15 +67,17 @@ protected:
void operator=(const PreprocessorLexer&); // DO NOT IMPLEMENT
friend class Preprocessor;
- PreprocessorLexer(Preprocessor* pp, SourceLocation L);
-
+ PreprocessorLexer(Preprocessor *pp, FileID fid)
+ : PP(pp), FID(fid), ParsingPreprocessorDirective(false),
+ ParsingFilename(false), LexingRawMode(false) {}
+
PreprocessorLexer()
- : PP(0), FileID(0),
+ : PP(0),
ParsingPreprocessorDirective(false),
ParsingFilename(false),
LexingRawMode(false) {}
- virtual ~PreprocessorLexer();
+ virtual ~PreprocessorLexer() {}
virtual void IndirectLex(Token& Result) = 0;
@@ -143,11 +145,15 @@ public:
/// getPP - Return the preprocessor object for this lexer.
Preprocessor *getPP() const { return PP; }
- unsigned getFileID() const {
+ FileID getFileID() const {
assert(PP &&
"PreprocessorLexer::getFileID() should only be used with a Preprocessor");
- return FileID;
+ return FID;
}
+
+ /// getFileEntry - Return the FileEntry corresponding to this FileID. Like
+ /// getFileID(), this only works for lexers with attached preprocessors.
+ const FileEntry *getFileEntry() const;
};
} // end namespace clang
diff --git a/include/clang/Lex/ScratchBuffer.h b/include/clang/Lex/ScratchBuffer.h
index c1d134de11..eec6a251a5 100644
--- a/include/clang/Lex/ScratchBuffer.h
+++ b/include/clang/Lex/ScratchBuffer.h
@@ -14,9 +14,10 @@
#ifndef LLVM_CLANG_SCRATCHBUFFER_H
#define LLVM_CLANG_SCRATCHBUFFER_H
+#include "clang/Basic/SourceLocation.h"
+
namespace clang {
class SourceManager;
- class SourceLocation;
/// ScratchBuffer - This class exposes a simple interface for the dynamic
/// construction of tokens. This is used for builtin macros (e.g. __LINE__) as
@@ -24,7 +25,7 @@ namespace clang {
class ScratchBuffer {
SourceManager &SourceMgr;
char *CurBuffer;
- unsigned FileID;
+ SourceLocation BufferStartLoc;
unsigned BytesUsed;
public:
ScratchBuffer(SourceManager &SM);
diff --git a/include/clang/Rewrite/HTMLRewrite.h b/include/clang/Rewrite/HTMLRewrite.h
index bbb7f3490b..2f5696606e 100644
--- a/include/clang/Rewrite/HTMLRewrite.h
+++ b/include/clang/Rewrite/HTMLRewrite.h
@@ -51,7 +51,7 @@ namespace html {
/// EscapeText - HTMLize a specified file so that special characters are
/// are translated so that they are not interpreted as HTML tags.
- void EscapeText(Rewriter& R, unsigned FileID,
+ void EscapeText(Rewriter& R, FileID FID,
bool EscapeSpaces = false, bool ReplacesTabs = true);
/// EscapeText - HTMLized the provided string so that special characters
@@ -61,29 +61,21 @@ namespace html {
std::string EscapeText(const std::string& s,
bool EscapeSpaces = false, bool ReplaceTabs = true);
- void AddLineNumbers(Rewriter& R, unsigned FileID);
+ void AddLineNumbers(Rewriter& R, FileID FID);
- void AddHeaderFooterInternalBuiltinCSS(Rewriter& R, unsigned FileID,
+ void AddHeaderFooterInternalBuiltinCSS(Rewriter& R, FileID FID,
const char *title = NULL);
/// SyntaxHighlight - Relex the specified FileID and annotate the HTML with
/// information about keywords, comments, etc.
- void SyntaxHighlight(Rewriter &R, unsigned FileID, Preprocessor &PP);
+ void SyntaxHighlight(Rewriter &R, FileID FID, Preprocessor &PP);
/// HighlightMacros - This uses the macro table state from the end of the
/// file, to reexpand macros and insert (into the HTML) information about the
/// macro expansions. This won't be perfectly perfect, but it will be
/// reasonably close.
- void HighlightMacros(Rewriter &R, unsigned FileID, Preprocessor &PP);
-
-
- void HighlightMacros(Rewriter &R, unsigned FileID, PreprocessorFactory &PPF);
-
-
-
-
-
-
+ void HighlightMacros(Rewriter &R, FileID FID, Preprocessor &PP);
+ void HighlightMacros(Rewriter &R, FileID FID, PreprocessorFactory &PPF);
} // end html namespace
} // end clang namespace
diff --git a/include/clang/Rewrite/Rewriter.h b/include/clang/Rewrite/Rewriter.h
index 59ed5d826b..b05770b2aa 100644
--- a/include/clang/Rewrite/Rewriter.h
+++ b/include/clang/Rewrite/Rewriter.h
@@ -118,7 +118,7 @@ private: // Methods only usable by Rewriter.
class Rewriter {
SourceManager *SourceMgr;
- std::map<unsigned, RewriteBuffer> RewriteBuffers;
+ std::map<FileID, RewriteBuffer> RewriteBuffers;
public:
explicit Rewriter(SourceManager &SM) : SourceMgr(&SM) {}
explicit Rewriter() : SourceMgr(0) {}
@@ -205,9 +205,9 @@ public:
/// getRewriteBufferFor - Return the rewrite buffer for the specified FileID.
/// If no modification has been made to it, return null.
- const RewriteBuffer *getRewriteBufferFor(unsigned FileID) const {
- std::map<unsigned, RewriteBuffer>::const_iterator I =
- RewriteBuffers.find(FileID);
+ const RewriteBuffer *getRewriteBufferFor(FileID FID) const {
+ std::map<FileID, RewriteBuffer>::const_iterator I =
+ RewriteBuffers.find(FID);
return I == RewriteBuffers.end() ? 0 : &I->second;
}
@@ -215,11 +215,10 @@ public:
/// buffer, and allows you to write on it directly. This is useful if you
/// want efficient low-level access to apis for scribbling on one specific
/// FileID's buffer.
- RewriteBuffer &getEditBuffer(unsigned FileID);
+ RewriteBuffer &getEditBuffer(FileID FID);
private:
- unsigned getLocationOffsetAndFileID(SourceLocation Loc,
- unsigned &FileID) const;
+ unsigned getLocationOffsetAndFileID(SourceLocation Loc, FileID &FID) const;
};
} // end namespace clang
diff --git a/include/clang/Rewrite/TokenRewriter.h b/include/clang/Rewrite/TokenRewriter.h
index 1703ea7885..c8fd0f532c 100644
--- a/include/clang/Rewrite/TokenRewriter.h
+++ b/include/clang/Rewrite/TokenRewriter.h
@@ -48,7 +48,7 @@ namespace clang {
public:
/// TokenRewriter - This creates a TokenRewriter for the file with the
/// specified FileID.
- TokenRewriter(unsigned FileID, SourceManager &SM, const LangOptions &LO);
+ TokenRewriter(FileID FID, SourceManager &SM, const LangOptions &LO);
~TokenRewriter();
typedef std::list<Token>::const_iterator token_iterator;