diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-10-20 22:00:55 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-10-20 22:00:55 +0000 |
commit | ecdcb883cbc6bb4a2445dc6f02d58d9bdb54a0ed (patch) | |
tree | 9a88c438fa389bc46038d92d1a78c94ca43e831c /lib/Lex/PPMacroExpansion.cpp | |
parent | 93f5e6a5d7690f90bc8a94e6b40d6c7d19719e0c (diff) |
Extend the preprocessing record and libclang with support for
inclusion directives, keeping track of every #include, #import,
etc. in the translation unit. We keep track of the source location and
kind of the inclusion, how the file name was spelled, and the
underlying file to which the inclusion resolved.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116952 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex/PPMacroExpansion.cpp')
-rw-r--r-- | lib/Lex/PPMacroExpansion.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/Lex/PPMacroExpansion.cpp b/lib/Lex/PPMacroExpansion.cpp index 19a6ca8521..68fc56f7b7 100644 --- a/lib/Lex/PPMacroExpansion.cpp +++ b/lib/Lex/PPMacroExpansion.cpp @@ -570,7 +570,8 @@ static bool EvaluateHasIncludeCommon(bool &Result, Token &Tok, // Reserve a buffer to get the spelling. llvm::SmallString<128> FilenameBuffer; llvm::StringRef Filename; - + SourceLocation EndLoc; + switch (Tok.getKind()) { case tok::eom: // If the token kind is EOM, the error has already been diagnosed. @@ -589,7 +590,7 @@ static bool EvaluateHasIncludeCommon(bool &Result, Token &Tok, // This could be a <foo/bar.h> file coming from a macro expansion. In this // case, glue the tokens together into FilenameBuffer and interpret those. FilenameBuffer.push_back('<'); - if (PP.ConcatenateIncludeName(FilenameBuffer)) + if (PP.ConcatenateIncludeName(FilenameBuffer, EndLoc)) return false; // Found <eom> but no ">"? Diagnostic already emitted. Filename = FilenameBuffer.str(); break; |