clang 20.0.0git
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/Basic/Builtins.h"
#include "clang/Basic/DiagnosticOptions.h"
#include "clang/Basic/FileEntry.h"
#include "clang/Basic/LangStandard.h"
#include "clang/Basic/Sarif.h"
#include "clang/Basic/Stack.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/SARIFDiagnosticPrinter.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/Sema/HLSLExternalSemaSource.h"
#include "clang/Sema/MultiplexExternalSemaSource.h"
#include "clang/Serialization/ASTDeserializationListener.h"
#include "clang/Serialization/ASTReader.h"
#include "clang/Serialization/GlobalModuleIndex.h"
#include "llvm/ADT/ScopeExit.h"
#include "llvm/Support/BuryPointer.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 <memory>
#include <system_error>

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.
 
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.
 
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.
 

Function Documentation

◆ addHeaderInclude()

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

Definition at line 312 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

◆ 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 307 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 252 of file FrontendAction.cpp.

References clang::SourceManager::AddLineNote(), clang::SrcMgr::C_User_ModuleMap, clang::CompilerInstance::getLangOpts(), clang::SourceManager::getMainFileID(), clang::CompilerInstance::getPreprocessor(), clang::CompilerInstance::getSourceManager(), clang::Lexer::getSpelling(), and clang::T.

Referenced by clang::FrontendAction::BeginSourceFile(), and loadModuleMapForModuleBuild().