clang 20.0.0git
|
An adapter that can be used to translate diagnostics from one or more llvm::SourceMgr instances to a ,. More...
#include "clang/Basic/SourceMgrAdapter.h"
Public Member Functions | |
SourceMgrAdapter (SourceManager &SM, DiagnosticsEngine &Diagnostics, unsigned ErrorDiagID, unsigned WarningDiagID, unsigned NoteDiagID, OptionalFileEntryRef DefaultFile=std::nullopt) | |
Create a new SourceMgr adaptor that maps to the given source manager and diagnostics engine. | |
~SourceMgrAdapter () | |
SourceLocation | mapLocation (const llvm::SourceMgr &LLVMSrcMgr, llvm::SMLoc Loc) |
Map a source location in the given LLVM source manager to its corresponding location in the Clang source manager. | |
SourceRange | mapRange (const llvm::SourceMgr &LLVMSrcMgr, llvm::SMRange Range) |
Map a source range in the given LLVM source manager to its corresponding range in the Clang source manager. | |
void | handleDiag (const llvm::SMDiagnostic &Diag) |
Handle the given diagnostic from an LLVM source manager. | |
llvm::SourceMgr::DiagHandlerTy | getDiagHandler () |
Retrieve the diagnostic handler to use with the underlying SourceMgr. | |
void * | getDiagContext () |
Retrieve the context to use with the diagnostic handler produced by getDiagHandler() . | |
An adapter that can be used to translate diagnostics from one or more llvm::SourceMgr instances to a ,.
Definition at line 30 of file SourceMgrAdapter.h.
SourceMgrAdapter::SourceMgrAdapter | ( | SourceManager & | SM, |
DiagnosticsEngine & | Diagnostics, | ||
unsigned | ErrorDiagID, | ||
unsigned | WarningDiagID, | ||
unsigned | NoteDiagID, | ||
OptionalFileEntryRef | DefaultFile = std::nullopt |
||
) |
Create a new SourceMgr
adaptor that maps to the given source manager and diagnostics engine.
Definition at line 24 of file SourceMgrAdapter.cpp.
SourceMgrAdapter::~SourceMgrAdapter | ( | ) |
Definition at line 33 of file SourceMgrAdapter.cpp.
|
inline |
Retrieve the context to use with the diagnostic handler produced by getDiagHandler()
.
Definition at line 80 of file SourceMgrAdapter.h.
|
inline |
Retrieve the diagnostic handler to use with the underlying SourceMgr.
Definition at line 74 of file SourceMgrAdapter.h.
void SourceMgrAdapter::handleDiag | ( | const llvm::SMDiagnostic & | Diag | ) |
Handle the given diagnostic from an LLVM source manager.
Definition at line 91 of file SourceMgrAdapter.cpp.
References clang::FixItHint::CreateReplacement(), Diag(), clang::SourceLocation::getLocWithOffset(), Loc, mapLocation(), mapRange(), Range, and clang::DiagnosticsEngine::Report().
SourceLocation SourceMgrAdapter::mapLocation | ( | const llvm::SourceMgr & | LLVMSrcMgr, |
llvm::SMLoc | Loc | ||
) |
Map a source location in the given LLVM source manager to its corresponding location in the Clang source manager.
Definition at line 35 of file SourceMgrAdapter.cpp.
References clang::SrcMgr::C_User, clang::SourceManager::createFileID(), clang::SourceManager::getLocForStartOfFile(), clang::SourceLocation::getLocWithOffset(), clang::SourceManager::getOrCreateFileID(), clang::SourceLocation::isValid(), and Loc.
Referenced by handleDiag(), and mapRange().
SourceRange SourceMgrAdapter::mapRange | ( | const llvm::SourceMgr & | LLVMSrcMgr, |
llvm::SMRange | Range | ||
) |
Map a source range in the given LLVM source manager to its corresponding range in the Clang source manager.
Definition at line 81 of file SourceMgrAdapter.cpp.
References clang::SourceRange::isValid(), mapLocation(), and Range.
Referenced by handleDiag().