Files
swift-mirror/include/swift/ClangImporter/ClangModule.h
Chris Lattner 55200e5274 Now that Module has its own kind field, drop the various module
discriminators from DeclContext.  This is cleaner and should
enable us to drop the alignment of DeclContext (coming next Jordan!)



Swift SVN r8059
2013-09-09 22:43:11 +00:00

69 lines
2.0 KiB
C++

//===--- ClangModule.h - An imported Clang module ---------------*- C++ -*-===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See http://swift.org/LICENSE.txt for license information
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
//
// This file implements support for loading Clang modules into Swift.
//
//===----------------------------------------------------------------------===//
#ifndef SWIFT_CLANGIMPORTER_CLANGMODULE_H
#define SWIFT_CLANGIMPORTER_CLANGMODULE_H
#include "swift/AST/Module.h"
namespace clang {
class Module;
}
namespace swift {
class ASTContext;
class ClangImporter;
class Component;
class ModuleLoader;
/// \brief Represents a Clang module that has been imported into Swift.
class ClangModule : public LoadedModule {
friend class ClangImporter;
clang::Module *clangModule;
llvm::PointerIntPair<Module *, 1, bool> adapterModule;
Module *getAdapterModule() const;
public:
ClangModule(ASTContext &ctx, std::string DebugModuleName,
ModuleLoader &owner, Component *comp,
clang::Module *clangModule);
/// \brief Retrieve the underlying Clang module.
// FIXME: Remove this.
clang::Module *getClangModule() const { return clangModule; }
/// Returns true if this is a top-level Clang module (not a submodule).
bool isTopLevel() const;
/// Returns the name of the enclosing top-level module without importing it.
///
/// If this module is itself a top-level module, returns this module's name.
StringRef getTopLevelModuleName() const;
static bool classof(const Module *M) {
return M->getKind() == ModuleKind::ClangModule;
}
static bool classof(const DeclContext *DC) {
return isa<Module>(DC) && classof(cast<Module>(DC));
}
};
}
#endif