aboutsummaryrefslogtreecommitdiff
path: root/include/clang/Basic/Module.h
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2013-03-13 21:13:43 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2013-03-13 21:13:43 +0000
commitc1d22393628a145e54396c0ac66e9625d13a7658 (patch)
tree90980c81a5c5e14533e0f5e5b41fd48bcbb4d0b8 /include/clang/Basic/Module.h
parentad4b8b43e66ebc2838fb314358017079665f058f (diff)
[Modules] Resolve top-headers of modules lazily.
This allows resolving top-header filenames of modules to FileEntries when we need them, not eagerly. Note that that this breaks ABI for libclang functions clang_Module_getTopLevelHeader / clang_Module_getNumTopLevelHeaders but this is fine because they are experimental and not widely used yet. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176975 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Basic/Module.h')
-rw-r--r--include/clang/Basic/Module.h26
1 files changed, 22 insertions, 4 deletions
diff --git a/include/clang/Basic/Module.h b/include/clang/Basic/Module.h
index db636e5cd4..5f081e0f56 100644
--- a/include/clang/Basic/Module.h
+++ b/include/clang/Basic/Module.h
@@ -34,6 +34,7 @@ namespace clang {
class DirectoryEntry;
class FileEntry;
+class FileManager;
class LangOptions;
class TargetInfo;
@@ -67,7 +68,13 @@ private:
/// \brief The AST file if this is a top-level module which has a
/// corresponding serialized AST file, or null otherwise.
const FileEntry *ASTFile;
-
+
+ /// \brief The top-level headers associated with this module.
+ llvm::SmallSetVector<const FileEntry *, 2> TopHeaders;
+
+ /// \brief top-level header filenames that aren't resolved to FileEntries yet.
+ std::vector<std::string> TopHeaderNames;
+
public:
/// \brief The headers that are part of this module.
SmallVector<const FileEntry *, 2> Headers;
@@ -75,9 +82,6 @@ public:
/// \brief The headers that are explicitly excluded from this module.
SmallVector<const FileEntry *, 2> ExcludedHeaders;
- /// \brief The top-level headers associated with this module.
- llvm::SmallSetVector<const FileEntry *, 2> TopHeaders;
-
/// \brief The set of language features required to use this module.
///
/// If any of these features is not present, the \c IsAvailable bit
@@ -292,6 +296,20 @@ public:
return Umbrella && Umbrella.is<const DirectoryEntry *>();
}
+ /// \brief Add a top-level header associated with this module.
+ void addTopHeader(const FileEntry *File) {
+ assert(File);
+ TopHeaders.insert(File);
+ }
+
+ /// \brief Add a top-level header filename associated with this module.
+ void addTopHeaderFilename(StringRef Filename) {
+ TopHeaderNames.push_back(Filename);
+ }
+
+ /// \brief The top-level headers associated with this module.
+ ArrayRef<const FileEntry *> getTopHeaders(FileManager &FileMgr);
+
/// \brief Add the given feature requirement to the list of features
/// required by this module.
///