diff options
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Basic/SourceManager.cpp | 6 | ||||
-rw-r--r-- | clang/lib/Driver/InitHeaderSearch.cpp | 16 | ||||
-rw-r--r-- | clang/lib/Lex/PPDirectives.cpp | 7 | ||||
-rw-r--r-- | clang/lib/Lex/PPLexerChange.cpp | 12 | ||||
-rw-r--r-- | clang/lib/Lex/Pragma.cpp | 3 |
5 files changed, 17 insertions, 27 deletions
diff --git a/clang/lib/Basic/SourceManager.cpp b/clang/lib/Basic/SourceManager.cpp index 66a85146a10..1a072fccaa0 100644 --- a/clang/lib/Basic/SourceManager.cpp +++ b/clang/lib/Basic/SourceManager.cpp @@ -76,14 +76,14 @@ SourceManager::createMemBufferContentCache(const MemoryBuffer *Buffer) { /// corresponds to a file or some other input source. unsigned SourceManager::createFileID(const ContentCache *File, SourceLocation IncludePos, - unsigned DirCharacter) { + SrcMgr::Characteristic_t FileCharacter) { // If FileEnt is really large (e.g. it's a large .i file), we may not be able // to fit an arbitrary position in the file in the FilePos field. To handle // this, we create one FileID for each chunk of the file that fits in a // FilePos field. unsigned FileSize = File->Buffer->getBufferSize(); if (FileSize+1 < (1 << SourceLocation::FilePosBits)) { - FileIDs.push_back(FileIDInfo::get(IncludePos, 0, File, DirCharacter)); + FileIDs.push_back(FileIDInfo::get(IncludePos, 0, File, FileCharacter)); assert(FileIDs.size() < (1 << SourceLocation::FileIDBits) && "Ran out of file ID's!"); return FileIDs.size(); @@ -95,7 +95,7 @@ unsigned SourceManager::createFileID(const ContentCache *File, unsigned ChunkNo = 0; while (1) { FileIDs.push_back(FileIDInfo::get(IncludePos, ChunkNo++, File, - DirCharacter)); + FileCharacter)); if (FileSize+1 < (1 << SourceLocation::FilePosBits)) break; FileSize -= (1 << SourceLocation::FilePosBits); diff --git a/clang/lib/Driver/InitHeaderSearch.cpp b/clang/lib/Driver/InitHeaderSearch.cpp index 5c23808b3ba..3ebca8e175b 100644 --- a/clang/lib/Driver/InitHeaderSearch.cpp +++ b/clang/lib/Driver/InitHeaderSearch.cpp @@ -43,13 +43,13 @@ void InitHeaderSearch::AddPath(const std::string &Path, IncludeDirGroup Group, MappedPath.append(Path.begin(), Path.end()); // Compute the DirectoryLookup type. - DirectoryLookup::DirType Type; + SrcMgr::Characteristic_t Type; if (Group == Quoted || Group == Angled) - Type = DirectoryLookup::NormalHeaderDir; + Type = SrcMgr::C_User; else if (isCXXAware) - Type = DirectoryLookup::SystemHeaderDir; + Type = SrcMgr::C_System; else - Type = DirectoryLookup::ExternCSystemHeaderDir; + Type = SrcMgr::C_ExternCSystem; // If the directory exists, add it. @@ -267,10 +267,7 @@ static void RemoveDuplicates(std::vector<DirectoryLookup> &SearchList, // // Since dupes of system dirs are rare, just rescan to find the original // that we're nuking instead of using a DenseMap. - if (SearchList[i].getDirCharacteristic() == - DirectoryLookup::SystemHeaderDir || - SearchList[i].getDirCharacteristic() == - DirectoryLookup::ExternCSystemHeaderDir) { + if (SearchList[i].getDirCharacteristic() != SrcMgr::C_User) { // Find the dir that this is the same of. unsigned FirstDir; for (FirstDir = 0; ; ++FirstDir) { @@ -281,8 +278,7 @@ static void RemoveDuplicates(std::vector<DirectoryLookup> &SearchList, // If the first dir in the search path is a non-system dir, zap it // instead of the system one. - if (SearchList[FirstDir].getDirCharacteristic() == - DirectoryLookup::NormalHeaderDir) + if (SearchList[FirstDir].getDirCharacteristic() == SrcMgr::C_User) DirToRemove = FirstDir; } diff --git a/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp index 504bc45dca4..a3aaabd298d 100644 --- a/clang/lib/Lex/PPDirectives.cpp +++ b/clang/lib/Lex/PPDirectives.cpp @@ -675,10 +675,9 @@ void Preprocessor::HandleIncludeDirective(Token &IncludeTok, // The #included file will be considered to be a system header if either it is // in a system include directory, or if the #includer is a system include // header. - unsigned FileCharacter = - // FIXME: Casts - std::max((unsigned)HeaderInfo.getFileDirFlavor(File), - SourceMgr.getDirCharacteristic(getCurrentFileLexer()->getFileLoc())); + SrcMgr::Characteristic_t FileCharacter = + std::max(HeaderInfo.getFileDirFlavor(File), + SourceMgr.getFileCharacteristic(getCurrentFileLexer()->getFileLoc())); // Look up the file, create a File ID for it. unsigned FileID = SourceMgr.createFileID(File, FilenameTok.getLocation(), diff --git a/clang/lib/Lex/PPLexerChange.cpp b/clang/lib/Lex/PPLexerChange.cpp index 1522bf5e8ca..ccaddf52ed5 100644 --- a/clang/lib/Lex/PPLexerChange.cpp +++ b/clang/lib/Lex/PPLexerChange.cpp @@ -95,10 +95,8 @@ void Preprocessor::EnterSourceFileWithLexer(Lexer *TheLexer, // Notify the client, if desired, that we are in a new source file. if (Callbacks && !CurLexer->Is_PragmaLexer) { - DirectoryLookup::DirType FileType = - // FIXME: - (DirectoryLookup::DirType) - SourceMgr.getDirCharacteristic(CurLexer->getFileLoc()); + SrcMgr::Characteristic_t FileType = + SourceMgr.getFileCharacteristic(CurLexer->getFileLoc()); Callbacks->FileChanged(CurLexer->getFileLoc(), PPCallbacks::EnterFile, FileType); @@ -180,10 +178,8 @@ bool Preprocessor::HandleEndOfFile(Token &Result, bool isEndOfMacro) { // Notify the client, if desired, that we are in a new source file. if (Callbacks && !isEndOfMacro && CurLexer) { - DirectoryLookup::DirType FileType = - // FIXME: - (DirectoryLookup::DirType) - SourceMgr.getDirCharacteristic(CurLexer->getFileLoc()); + SrcMgr::Characteristic_t FileType = + SourceMgr.getFileCharacteristic(CurLexer->getFileLoc()); Callbacks->FileChanged(CurLexer->getSourceLocation(CurLexer->BufferPtr), PPCallbacks::ExitFile, FileType); diff --git a/clang/lib/Lex/Pragma.cpp b/clang/lib/Lex/Pragma.cpp index e6955d762fa..b6f5ac49360 100644 --- a/clang/lib/Lex/Pragma.cpp +++ b/clang/lib/Lex/Pragma.cpp @@ -239,8 +239,7 @@ void Preprocessor::HandlePragmaSystemHeader(Token &SysHeaderTok) { // Notify the client, if desired, that we are in a new source file. if (Callbacks) Callbacks->FileChanged(TheLexer->getSourceLocation(TheLexer->BufferPtr), - PPCallbacks::SystemHeaderPragma, - DirectoryLookup::SystemHeaderDir); + PPCallbacks::SystemHeaderPragma, SrcMgr::C_System); } /// HandlePragmaDependency - Handle #pragma GCC dependency "foo" blah. |