summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/DeclBase.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2013-01-12 01:29:50 +0000
committerDouglas Gregor <dgregor@apple.com>2013-01-12 01:29:50 +0000
commitc147b0bc31cbce36167dc04ca82c050362cf0378 (patch)
tree58d7b59c41c336a20bbd1d0f9cd163241ef19de6 /clang/lib/AST/DeclBase.cpp
parent4a5030c72f6bd0a36e11d48c5c95b98dfee67164 (diff)
downloadbcm5719-llvm-c147b0bc31cbce36167dc04ca82c050362cf0378.tar.gz
bcm5719-llvm-c147b0bc31cbce36167dc04ca82c050362cf0378.zip
Provide Decl::getOwningModule(), which determines the (sub)module in
which a particular declaration resides. Use this information to customize the "definition of 'blah' must be imported from another module" diagnostic with the module the user actually has to import. Additionally, recover by importing that module, so we don't complain about other names in that module. Still TODO: coming up with decent Fix-Its for these cases, and expand this recovery approach for other name lookup failures. llvm-svn: 172290
Diffstat (limited to 'clang/lib/AST/DeclBase.cpp')
-rw-r--r--clang/lib/AST/DeclBase.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/lib/AST/DeclBase.cpp b/clang/lib/AST/DeclBase.cpp
index 5dccaac0205..d8b63611fd1 100644
--- a/clang/lib/AST/DeclBase.cpp
+++ b/clang/lib/AST/DeclBase.cpp
@@ -59,6 +59,11 @@ void *Decl::AllocateDeserializedDecl(const ASTContext &Context,
return Result;
}
+Module *Decl::getOwningModuleSlow() const {
+ assert(isFromASTFile() && "Not from AST file?");
+ return getASTContext().getExternalSource()->getModule(getOwningModuleID());
+}
+
const char *Decl::getDeclKindName() const {
switch (DeclKind) {
default: llvm_unreachable("Declaration not in DeclNodes.inc!");
OpenPOWER on IntegriCloud