summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex/PPLexerChange.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-09-26 20:12:23 +0000
committerChris Lattner <sabre@nondot.org>2008-09-26 20:12:23 +0000
commitc88a23e8d7a85b002789794ca83eb9da81eae7de (patch)
treef86c320616e57db7cc0d6b1f51bffc2d81a5f9db /clang/lib/Lex/PPLexerChange.cpp
parent71efd8159eb41cb53f21385b56c7f6ec73456956 (diff)
downloadbcm5719-llvm-c88a23e8d7a85b002789794ca83eb9da81eae7de.tar.gz
bcm5719-llvm-c88a23e8d7a85b002789794ca83eb9da81eae7de.zip
Fix the rest of rdar://6243860 hopefully. This requires changing FileIDInfo
to whether the fileid is a 'extern c system header' in addition to whether it is a system header, most of this is spreading plumbing around. Once we have that, PPLexerChange bases its "file enter/exit" notifications to PPCallbacks to base the system header state on FileIDInfo instead of HeaderSearch. Finally, in Preprocessor::HandleIncludeDirective, mirror logic in GCC: the system headerness of a file being entered can be set due to the #includer or the #includee. llvm-svn: 56688
Diffstat (limited to 'clang/lib/Lex/PPLexerChange.cpp')
-rw-r--r--clang/lib/Lex/PPLexerChange.cpp22
1 files changed, 9 insertions, 13 deletions
diff --git a/clang/lib/Lex/PPLexerChange.cpp b/clang/lib/Lex/PPLexerChange.cpp
index d1c44cfcdfc..1522bf5e8ca 100644
--- a/clang/lib/Lex/PPLexerChange.cpp
+++ b/clang/lib/Lex/PPLexerChange.cpp
@@ -78,7 +78,7 @@ void Preprocessor::EnterSourceFile(unsigned FileID,
Lexer *TheLexer = new Lexer(SourceLocation::getFileLoc(FileID, 0), *this);
EnterSourceFileWithLexer(TheLexer, CurDir);
}
-
+
/// EnterSourceFile - Add a source file to the top of the include stack and
/// start lexing tokens from it instead of the current buffer.
void Preprocessor::EnterSourceFileWithLexer(Lexer *TheLexer,
@@ -95,12 +95,10 @@ 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 = DirectoryLookup::NormalHeaderDir;
-
- // Get the file entry for the current file.
- if (const FileEntry *FE =
- SourceMgr.getFileEntryForLoc(CurLexer->getFileLoc()))
- FileType = HeaderInfo.getFileDirFlavor(FE);
+ DirectoryLookup::DirType FileType =
+ // FIXME:
+ (DirectoryLookup::DirType)
+ SourceMgr.getDirCharacteristic(CurLexer->getFileLoc());
Callbacks->FileChanged(CurLexer->getFileLoc(),
PPCallbacks::EnterFile, FileType);
@@ -182,13 +180,11 @@ 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 = DirectoryLookup::NormalHeaderDir;
+ DirectoryLookup::DirType FileType =
+ // FIXME:
+ (DirectoryLookup::DirType)
+ SourceMgr.getDirCharacteristic(CurLexer->getFileLoc());
- // Get the file entry for the current file.
- if (const FileEntry *FE =
- SourceMgr.getFileEntryForLoc(CurLexer->getFileLoc()))
- FileType = HeaderInfo.getFileDirFlavor(FE);
-
Callbacks->FileChanged(CurLexer->getSourceLocation(CurLexer->BufferPtr),
PPCallbacks::ExitFile, FileType);
}
OpenPOWER on IntegriCloud