clang  6.0.0svn
Functions
FrontendAction.cpp File Reference
#include "clang/Frontend/FrontendAction.h"
#include "clang/AST/ASTConsumer.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/DeclGroup.h"
#include "clang/Frontend/ASTUnit.h"
#include "clang/Frontend/CompilerInstance.h"
#include "clang/Frontend/FrontendDiagnostic.h"
#include "clang/Frontend/FrontendPluginRegistry.h"
#include "clang/Frontend/LayoutOverrideSource.h"
#include "clang/Frontend/MultiplexConsumer.h"
#include "clang/Frontend/Utils.h"
#include "clang/Lex/HeaderSearch.h"
#include "clang/Lex/LiteralSupport.h"
#include "clang/Lex/Preprocessor.h"
#include "clang/Lex/PreprocessorOptions.h"
#include "clang/Parse/ParseAST.h"
#include "clang/Serialization/ASTDeserializationListener.h"
#include "clang/Serialization/ASTReader.h"
#include "clang/Serialization/GlobalModuleIndex.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/Timer.h"
#include "llvm/Support/raw_ostream.h"
#include <system_error>
Include dependency graph for FrontendAction.cpp:

Go to the source code of this file.

Functions

static SourceLocation ReadOriginalFileName (CompilerInstance &CI, std::string &InputFile, bool IsModuleMap=false)
 For preprocessed files, if the first line is the linemarker and specifies the original source file name, use that name as the input file name. More...
 
static SmallVectorImpl< char > & operator+= (SmallVectorImpl< char > &Includes, StringRef RHS)
 
static void addHeaderInclude (StringRef HeaderName, SmallVectorImpl< char > &Includes, const LangOptions &LangOpts, bool IsExternC)
 
static std::error_code collectModuleHeaderIncludes (const LangOptions &LangOpts, FileManager &FileMgr, DiagnosticsEngine &Diag, ModuleMap &ModMap, clang::Module *Module, SmallVectorImpl< char > &Includes)
 Collect the set of header includes needed to construct the given module and update the TopHeaders file set of the module. More...
 
static bool loadModuleMapForModuleBuild (CompilerInstance &CI, bool IsSystem, bool IsPreprocessed, std::string &PresumedModuleMapFile, unsigned &Offset)
 
static ModuleprepareToBuildModule (CompilerInstance &CI, StringRef ModuleMapFilename)
 
static std::unique_ptr< llvm::MemoryBuffer > getInputBufferForModule (CompilerInstance &CI, Module *M)
 Compute the input buffer that should be used to build the specified module. More...
 

Function Documentation

◆ addHeaderInclude()

static void addHeaderInclude ( StringRef  HeaderName,
SmallVectorImpl< char > &  Includes,
const LangOptions LangOpts,
bool  IsExternC 
)
static

Definition at line 267 of file FrontendAction.cpp.

Referenced by collectModuleHeaderIncludes(), and getInputBufferForModule().

◆ collectModuleHeaderIncludes()

static std::error_code collectModuleHeaderIncludes ( const LangOptions LangOpts,
FileManager FileMgr,
DiagnosticsEngine Diag,
ModuleMap ModMap,
clang::Module Module,
SmallVectorImpl< char > &  Includes 
)
static

Collect the set of header includes needed to construct the given module and update the TopHeaders file set of the module.

Parameters
ModuleThe module we're collecting includes from.
IncludesWill be augmented with the set of #includes or #imports needed to load all of the named headers.

Definition at line 292 of file FrontendAction.cpp.

References addHeaderInclude(), clang::Module::addTopHeader(), End, clang::FileManager::getFile(), clang::Module::getUmbrellaDir(), clang::Module::getUmbrellaHeader(), clang::FileManager::getVirtualFileSystem(), clang::Module::Headers, clang::Module::HK_Normal, clang::Module::HK_Private, clang::Module::isAvailable(), clang::Module::IsExternC, clang::ModuleMap::isHeaderUnavailableInModule(), clang::Module::MissingHeaders, clang::Module::Parent, clang::DiagnosticsEngine::Report(), and clang::ModuleMap::resolveHeaderDirectives().

Referenced by getInputBufferForModule().

◆ getInputBufferForModule()

static std::unique_ptr<llvm::MemoryBuffer> getInputBufferForModule ( CompilerInstance CI,
Module M 
)
static

◆ loadModuleMapForModuleBuild()

static bool loadModuleMapForModuleBuild ( CompilerInstance CI,
bool  IsSystem,
bool  IsPreprocessed,
std::string &  PresumedModuleMapFile,
unsigned &  Offset 
)
static

◆ operator+=()

static SmallVectorImpl<char>& operator+= ( SmallVectorImpl< char > &  Includes,
StringRef  RHS 
)
static

Definition at line 262 of file FrontendAction.cpp.

◆ prepareToBuildModule()

static Module* prepareToBuildModule ( CompilerInstance CI,
StringRef  ModuleMapFilename 
)
static

◆ ReadOriginalFileName()

static SourceLocation ReadOriginalFileName ( CompilerInstance CI,
std::string &  InputFile,
bool  IsModuleMap = false 
)
static

For preprocessed files, if the first line is the linemarker and specifies the original source file name, use that name as the input file name.

Returns the location of the first token after the line marker directive.

Parameters
CIThe compiler instance.
InputFilePopulated with the filename from the line marker.
IsModuleMapIf true, add a line note corresponding to this line directive. (We need to do this because the directive will not be visited by the preprocessor.)

Definition at line 206 of file FrontendAction.cpp.

References clang::Token::getKind(), clang::CompilerInstance::getLangOpts(), clang::Token::getLocation(), clang::SourceManager::getMainFileID(), clang::CompilerInstance::getSourceManager(), clang::Token::isAtStartOfLine(), and clang::T.

Referenced by loadModuleMapForModuleBuild().