mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Modules occupy a weird space in the AST now: they can be treated like types (Swift.Int), which is captured by ModuleType. They can be treated like values for disambiguation (Swift.print), which is captured by ModuleExpr. And we jump through hoops in various places to store "either a module or a decl". Start cleaning this up by transforming Module into ModuleDecl, a TypeDecl that's implicitly created to describe a module. Subsequent changes will start folding away the special cases (ModuleExpr -> DeclRefExpr, name lookup results stop having a separate Module case, etc.). Note that the Module -> ModuleDecl typedef is there to limit the changes needed. Much of this patch is actually dealing with the fact that Module used to have Ctx and Name public members that now need to be accessed via getASTContext() and getName(), respectively. Swift SVN r28284
50 lines
1.5 KiB
C++
50 lines
1.5 KiB
C++
//===--- ClangModuleLoader.h - Clang Module Loader Interface --*- 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
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef SWIFT_AST_CLANG_MODULE_LOADER_H
|
|
#define SWIFT_AST_CLANG_MODULE_LOADER_H
|
|
|
|
#include "swift/AST/ModuleLoader.h"
|
|
|
|
namespace clang {
|
|
class ASTContext;
|
|
class Preprocessor;
|
|
} // namespace clang
|
|
|
|
namespace swift {
|
|
|
|
class ClangModuleLoader : public ModuleLoader {
|
|
private:
|
|
virtual void anchor();
|
|
protected:
|
|
using ModuleLoader::ModuleLoader;
|
|
public:
|
|
virtual clang::ASTContext &getClangASTContext() const = 0;
|
|
virtual clang::Preprocessor &getClangPreprocessor() const = 0;
|
|
virtual void printStatistics() const = 0;
|
|
|
|
/// Returns the module that contains imports and declarations from all loaded
|
|
/// Objective-C header files.
|
|
virtual ModuleDecl *getImportedHeaderModule() const = 0;
|
|
|
|
/// Adds a new search path to the Clang CompilerInstance, as if specified with
|
|
/// -I or -F.
|
|
///
|
|
/// \returns true if there was an error adding the search path.
|
|
virtual bool addSearchPath(StringRef newSearchPath, bool isFramework) = 0;
|
|
};
|
|
|
|
} // namespace swift
|
|
|
|
#endif // LLVM_SWIFT_AST_CLANG_MODULE_LOADER_H
|
|
|