summaryrefslogtreecommitdiffstats
path: root/include/clang/Lex
diff options
context:
space:
mode:
authorManuel Klimek <klimek@google.com>2011-04-26 21:50:03 +0000
committerManuel Klimek <klimek@google.com>2011-04-26 21:50:03 +0000
commit7412494982c8b50c90961302c3a718633b2c3ab7 (patch)
treeadaafb2743679b7df8e36cd214a9648c6db08318 /include/clang/Lex
parent37833b00d282cacb7dd1b9889e2a113eed9190ff (diff)
To be able to replay compilations we need to accurately remodel how
includes get resolved, especially when they are found relatively to another include file. We also try to get it working for framework includes, but that part of the code is untested, as I don't have a code base that uses it. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130246 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Lex')
-rw-r--r--include/clang/Lex/DirectoryLookup.h21
-rw-r--r--include/clang/Lex/HeaderMap.h3
-rw-r--r--include/clang/Lex/HeaderSearch.h33
-rw-r--r--include/clang/Lex/PPCallbacks.h24
-rw-r--r--include/clang/Lex/PreprocessingRecord.h3
-rw-r--r--include/clang/Lex/Preprocessor.h3
6 files changed, 61 insertions, 26 deletions
diff --git a/include/clang/Lex/DirectoryLookup.h b/include/clang/Lex/DirectoryLookup.h
index 1ee19266f3..1ee6953a12 100644
--- a/include/clang/Lex/DirectoryLookup.h
+++ b/include/clang/Lex/DirectoryLookup.h
@@ -122,17 +122,26 @@ public:
/// LookupFile - Lookup the specified file in this search path, returning it
/// if it exists or returning null if not.
- /// If RawPath is not NULL and the file is found, RawPath will be set to the
- /// raw path at which the file was found in the file system. For example,
- /// for a search path ".." and a filename "../file.h" this would be
- /// "../../file.h".
+ ///
+ /// \param Filename The file to look up relative to the search paths.
+ ///
+ /// \param HS The header search instance to search with.
+ ///
+ /// \param SearchPath If not NULL, will be set to the search path relative
+ /// to which the file was found.
+ ///
+ /// \param RelativePath If not NULL, will be set to the path relative to
+ /// SearchPath at which the file was found. This only differs from the
+ /// Filename for framework includes.
const FileEntry *LookupFile(llvm::StringRef Filename, HeaderSearch &HS,
- llvm::SmallVectorImpl<char> *RawPath) const;
+ llvm::SmallVectorImpl<char> *SearchPath,
+ llvm::SmallVectorImpl<char> *RelativePath) const;
private:
const FileEntry *DoFrameworkLookup(
llvm::StringRef Filename, HeaderSearch &HS,
- llvm::SmallVectorImpl<char> *RawPath) const;
+ llvm::SmallVectorImpl<char> *SearchPath,
+ llvm::SmallVectorImpl<char> *RelativePath) const;
};
diff --git a/include/clang/Lex/HeaderMap.h b/include/clang/Lex/HeaderMap.h
index 54c7eb47c8..e333840b6a 100644
--- a/include/clang/Lex/HeaderMap.h
+++ b/include/clang/Lex/HeaderMap.h
@@ -52,8 +52,7 @@ public:
/// raw path at which the file was found in the file system. For example,
/// for a search path ".." and a filename "../file.h" this would be
/// "../../file.h".
- const FileEntry *LookupFile(llvm::StringRef Filename, FileManager &FM,
- llvm::SmallVectorImpl<char> *RawPath) const;
+ const FileEntry *LookupFile(llvm::StringRef Filename, FileManager &FM) const;
/// getFileName - Return the filename of the headermap.
const char *getFileName() const;
diff --git a/include/clang/Lex/HeaderSearch.h b/include/clang/Lex/HeaderSearch.h
index 3ba780438f..fec4dad1e7 100644
--- a/include/clang/Lex/HeaderSearch.h
+++ b/include/clang/Lex/HeaderSearch.h
@@ -182,18 +182,32 @@ public:
}
/// LookupFile - Given a "foo" or <foo> reference, look up the indicated file,
- /// return null on failure. isAngled indicates whether the file reference is
- /// a <> reference. If successful, this returns 'UsedDir', the
- /// DirectoryLookup member the file was found in, or null if not applicable.
- /// If CurDir is non-null, the file was found in the specified directory
- /// search location. This is used to implement #include_next. CurFileEnt, if
- /// non-null, indicates where the #including file is, in case a relative
- /// search is needed.
+ /// return null on failure.
+ ///
+ /// \returns If successful, this returns 'UsedDir', the DirectoryLookup member
+ /// the file was found in, or null if not applicable.
+ ///
+ /// \param isAngled indicates whether the file reference is a <> reference.
+ ///
+ /// \param CurDir If non-null, the file was found in the specified directory
+ /// search location. This is used to implement #include_next.
+ ///
+ /// \param CurFileEnt If non-null, indicates where the #including file is, in
+ /// case a relative search is needed.
+ ///
+ /// \param SearchPath If non-null, will be set to the search path relative
+ /// to which the file was found. If the include path is absolute, SearchPath
+ /// will be set to an empty string.
+ ///
+ /// \param RelativePath If non-null, will be set to the path relative to
+ /// SearchPath at which the file was found. This only differs from the
+ /// Filename for framework includes.
const FileEntry *LookupFile(llvm::StringRef Filename, bool isAngled,
const DirectoryLookup *FromDir,
const DirectoryLookup *&CurDir,
const FileEntry *CurFileEnt,
- llvm::SmallVectorImpl<char> *RawPath);
+ llvm::SmallVectorImpl<char> *SearchPath,
+ llvm::SmallVectorImpl<char> *RelativePath);
/// LookupSubframeworkHeader - Look up a subframework for the specified
/// #include file. For example, if #include'ing <HIToolbox/HIToolbox.h> from
@@ -203,7 +217,8 @@ public:
const FileEntry *LookupSubframeworkHeader(
llvm::StringRef Filename,
const FileEntry *RelativeFileEnt,
- llvm::SmallVectorImpl<char> *RawPath);
+ llvm::SmallVectorImpl<char> *SearchPath,
+ llvm::SmallVectorImpl<char> *RelativePath);
/// LookupFrameworkCache - Look up the specified framework name in our
/// framework cache, returning the DirectoryEntry it is in if we know,
diff --git a/include/clang/Lex/PPCallbacks.h b/include/clang/Lex/PPCallbacks.h
index 242986dae5..fd07a29f8e 100644
--- a/include/clang/Lex/PPCallbacks.h
+++ b/include/clang/Lex/PPCallbacks.h
@@ -76,16 +76,25 @@ public:
/// \param EndLoc The location of the last token within the inclusion
/// directive.
///
- /// \param RawPath Contains the raw path at which the file was found in the
- /// file system. For example, for a search path ".." and a filename
- /// "../file.h" this would be "../../file.h".
+ /// \param SearchPath Contains the search path which was used to find the file
+ /// in the file system. If the file was found via an absolute include path,
+ /// SearchPath will be empty. For framework includes, the SearchPath and
+ /// RelativePath will be split up. For example, if an include of "Some/Some.h"
+ /// is found via the framework path
+ /// "path/to/Frameworks/Some.framework/Headers/Some.h", SearchPath will be
+ /// "path/to/Frameworks/Some.framework/Headers" and RelativePath will be
+ /// "Some.h".
+ ///
+ /// \param RelativePath The path relative to SearchPath, at which the include
+ /// file was found. This is equal to FileName except for framework includes.
virtual void InclusionDirective(SourceLocation HashLoc,
const Token &IncludeTok,
llvm::StringRef FileName,
bool IsAngled,
const FileEntry *File,
SourceLocation EndLoc,
- const llvm::SmallVectorImpl<char> &RawPath) {
+ llvm::StringRef SearchPath,
+ llvm::StringRef RelativePath) {
}
/// EndOfMainFile - This callback is invoked when the end of the main file is
@@ -194,11 +203,12 @@ public:
bool IsAngled,
const FileEntry *File,
SourceLocation EndLoc,
- const llvm::SmallVectorImpl<char> &RawPath) {
+ llvm::StringRef SearchPath,
+ llvm::StringRef RelativePath) {
First->InclusionDirective(HashLoc, IncludeTok, FileName, IsAngled, File,
- EndLoc, RawPath);
+ EndLoc, SearchPath, RelativePath);
Second->InclusionDirective(HashLoc, IncludeTok, FileName, IsAngled, File,
- EndLoc, RawPath);
+ EndLoc, SearchPath, RelativePath);
}
virtual void EndOfMainFile() {
diff --git a/include/clang/Lex/PreprocessingRecord.h b/include/clang/Lex/PreprocessingRecord.h
index f5066d4bfd..7be845549d 100644
--- a/include/clang/Lex/PreprocessingRecord.h
+++ b/include/clang/Lex/PreprocessingRecord.h
@@ -342,7 +342,8 @@ namespace clang {
bool IsAngled,
const FileEntry *File,
SourceLocation EndLoc,
- const llvm::SmallVectorImpl<char> &RawPath);
+ llvm::StringRef SearchPath,
+ llvm::StringRef RelativePath);
};
} // end namespace clang
diff --git a/include/clang/Lex/Preprocessor.h b/include/clang/Lex/Preprocessor.h
index 04b3e3224f..af3631de52 100644
--- a/include/clang/Lex/Preprocessor.h
+++ b/include/clang/Lex/Preprocessor.h
@@ -834,7 +834,8 @@ public:
const FileEntry *LookupFile(llvm::StringRef Filename,
bool isAngled, const DirectoryLookup *FromDir,
const DirectoryLookup *&CurDir,
- llvm::SmallVectorImpl<char> *RawPath);
+ llvm::SmallVectorImpl<char> *SearchPath,
+ llvm::SmallVectorImpl<char> *RelativePath);
/// GetCurLookup - The DirectoryLookup structure used to find the current
/// FileEntry, if CurLexer is non-null and if applicable. This allows us to