[AST] For USR generation, ignore symbols coming from the builtin module.

Swift SVN r17858
This commit is contained in:
Argyrios Kyrtzidis
2014-05-11 00:00:57 +00:00
parent 761c627b38
commit 918f373d97
3 changed files with 10 additions and 0 deletions

View File

@@ -394,6 +394,9 @@ public:
/// \returns true if this module is the "swift" standard library module. /// \returns true if this module is the "swift" standard library module.
bool isStdlibModule() const; bool isStdlibModule() const;
/// \returns true if this module is the "builtin" module.
bool isBuiltinModule() const;
/// \returns true if this module is a system module; note that the StdLib is /// \returns true if this module is a system module; note that the StdLib is
/// considered a system module. /// considered a system module.
bool isSystemModule() const; bool isSystemModule() const;

View File

@@ -1070,6 +1070,10 @@ bool Module::isStdlibModule() const {
return !getParent() && Name == Ctx.StdlibModuleName; return !getParent() && Name == Ctx.StdlibModuleName;
} }
bool Module::isBuiltinModule() const {
return this == Ctx.TheBuiltinModule;
}
bool Module::isSystemModule() const { bool Module::isSystemModule() const {
if (isStdlibModule()) if (isStdlibModule())
return true; return true;

View File

@@ -11,6 +11,7 @@
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include "swift/AST/ASTContext.h" #include "swift/AST/ASTContext.h"
#include "swift/AST/Module.h"
#include "swift/AST/USRGeneration.h" #include "swift/AST/USRGeneration.h"
#include "swift/AST/Mangle.h" #include "swift/AST/Mangle.h"
#include "llvm/ADT/SmallString.h" #include "llvm/ADT/SmallString.h"
@@ -33,6 +34,8 @@ bool ide::printDeclUSR(const ValueDecl *D, raw_ostream &OS) {
if (isa<VarDecl>(D) && !D->hasName()) if (isa<VarDecl>(D) && !D->hasName())
return true; // Ignore. return true; // Ignore.
if (D->getModuleContext()->isBuiltinModule())
return true; // Ignore.
ValueDecl *VD = const_cast<ValueDecl *>(D); ValueDecl *VD = const_cast<ValueDecl *>(D);