summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-12-02 01:47:07 +0000
committerDouglas Gregor <dgregor@apple.com>2011-12-02 01:47:07 +0000
commit2b82c2a59ecac139e6d1339cec3da1665d1fe592 (patch)
treeaee07692f6900a130b53f2bb7b32dd597d34e277 /clang/lib/Sema
parent4e3a11ba57b71f9a4356048708c8389020eb1afa (diff)
downloadbcm5719-llvm-2b82c2a59ecac139e6d1339cec3da1665d1fe592.tar.gz
bcm5719-llvm-2b82c2a59ecac139e6d1339cec3da1665d1fe592.zip
Implementing parsing and resolution of module export declarations
within module maps, which will (eventually) be used to re-export a module from another module. There are still some pieces missing, however. llvm-svn: 145665
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r--clang/lib/Sema/Sema.cpp28
1 files changed, 27 insertions, 1 deletions
diff --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp
index fe393dd2fee..2b7be7eaca4 100644
--- a/clang/lib/Sema/Sema.cpp
+++ b/clang/lib/Sema/Sema.cpp
@@ -33,11 +33,11 @@
#include "clang/AST/Expr.h"
#include "clang/AST/ExprCXX.h"
#include "clang/AST/StmtCXX.h"
+#include "clang/Lex/HeaderSearch.h"
#include "clang/Lex/Preprocessor.h"
#include "clang/Basic/FileManager.h"
#include "clang/Basic/PartialDiagnostic.h"
#include "clang/Basic/TargetInfo.h"
-
using namespace clang;
using namespace sema;
@@ -484,6 +484,32 @@ void Sema::ActOnEndOfTranslationUnit() {
}
if (TUKind == TU_Module) {
+ // If we are building a module, resolve all of the exported declarations
+ // now.
+ if (Module *CurrentModule = PP.getCurrentModule()) {
+ ModuleMap &ModMap = PP.getHeaderSearchInfo().getModuleMap();
+
+ llvm::SmallVector<Module *, 2> Stack;
+ Stack.push_back(CurrentModule);
+ while (!Stack.empty()) {
+ Module *Mod = Stack.back();
+ Stack.pop_back();
+
+ // Resolve the exported declarations.
+ // FIXME: Actually complain, once we figure out how to teach the
+ // diagnostic client to deal with complains in the module map at this
+ // point.
+ ModMap.resolveExports(Mod, /*Complain=*/false);
+
+ // Queue the submodules, so their exports will also be resolved.
+ for (llvm::StringMap<Module *>::iterator Sub = Mod->SubModules.begin(),
+ SubEnd = Mod->SubModules.end();
+ Sub != SubEnd; ++Sub) {
+ Stack.push_back(Sub->getValue());
+ }
+ }
+ }
+
// Modules don't need any of the checking below.
TUScope = 0;
return;
OpenPOWER on IntegriCloud