summaryrefslogtreecommitdiffstats
path: root/clang/lib/Basic/Module.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-12-05 22:27:44 +0000
committerDouglas Gregor <dgregor@apple.com>2011-12-05 22:27:44 +0000
commit734410916a6d83c70dffcecae1686a15f8a50d71 (patch)
treee9a9a5bb8f2c3e95032bf5535d942826848225ad /clang/lib/Basic/Module.cpp
parentb8c719ccc6af14b1ba4d19f406a20e0b2b87bf88 (diff)
downloadbcm5719-llvm-734410916a6d83c70dffcecae1686a15f8a50d71.tar.gz
bcm5719-llvm-734410916a6d83c70dffcecae1686a15f8a50d71.zip
Parse inferred submodules in module maps, track their contents in
Module, and (de-)serialize this information. Semantics of inferred submodules to follow. llvm-svn: 145864
Diffstat (limited to 'clang/lib/Basic/Module.cpp')
-rw-r--r--clang/lib/Basic/Module.cpp31
1 files changed, 22 insertions, 9 deletions
diff --git a/clang/lib/Basic/Module.cpp b/clang/lib/Basic/Module.cpp
index c3a8a377c44..97bddfa97ea 100644
--- a/clang/lib/Basic/Module.cpp
+++ b/clang/lib/Basic/Module.cpp
@@ -37,6 +37,14 @@ bool Module::isSubModuleOf(Module *Other) const {
return false;
}
+const Module *Module::getTopLevelModule() const {
+ const Module *Result = this;
+ while (Result->Parent)
+ Result = Result->Parent;
+
+ return Result;
+}
+
std::string Module::getFullModuleName() const {
llvm::SmallVector<StringRef, 2> Names;
@@ -57,14 +65,6 @@ std::string Module::getFullModuleName() const {
return Result;
}
-StringRef Module::getTopLevelModuleName() const {
- const Module *Top = this;
- while (Top->Parent)
- Top = Top->Parent;
-
- return Top->Name;
-}
-
static void printModuleId(llvm::raw_ostream &OS, const ModuleId &Id) {
for (unsigned I = 0, N = Id.size(); I != N; ++I) {
if (I)
@@ -96,7 +96,7 @@ void Module::print(llvm::raw_ostream &OS, unsigned Indent) const {
}
for (llvm::StringMap<Module *>::const_iterator MI = SubModules.begin(),
- MIEnd = SubModules.end();
+ MIEnd = SubModules.end();
MI != MIEnd; ++MI)
MI->getValue()->print(OS, Indent + 2);
@@ -126,6 +126,19 @@ void Module::print(llvm::raw_ostream &OS, unsigned Indent) const {
OS << "\n";
}
+ if (InferSubmodules) {
+ OS.indent(Indent + 2);
+ if (InferExplicitSubmodules)
+ OS << "explicit ";
+ OS << "module * {\n";
+ if (InferExportWildcard) {
+ OS.indent(Indent + 4);
+ OS << "export *\n";
+ }
+ OS.indent(Indent + 2);
+ OS << "}\n";
+ }
+
OS.indent(Indent);
OS << "}\n";
}
OpenPOWER on IntegriCloud