/// @name LLVM Context
/// {
- llvm::LLVMContext &getLLVMContext() {
+ bool hasLLVMContext() const { return LLVMContext != 0; }
+
+ llvm::LLVMContext &getLLVMContext() const {
assert(LLVMContext && "Compiler instance has no LLVM context!");
return *LLVMContext;
}
/// @name Diagnostics Engine
/// {
+ bool hasDiagnostics() const { return Diagnostics != 0; }
+
Diagnostic &getDiagnostics() const {
assert(Diagnostics && "Compiler instance has no diagnostics!");
return *Diagnostics;
/// @name Target Info
/// {
+ bool hasTarget() const { return Target != 0; }
+
TargetInfo &getTarget() const {
assert(Target && "Compiler instance has no target!");
return *Target;
/// @name File Manager
/// {
+ bool hasFileManager() const { return FileMgr != 0; }
+
FileManager &getFileManager() const {
assert(FileMgr && "Compiler instance has no file manager!");
return *FileMgr;
/// @name Source Manager
/// {
+ bool hasSourceManager() const { return SourceMgr != 0; }
+
SourceManager &getSourceManager() const {
assert(SourceMgr && "Compiler instance has no source manager!");
return *SourceMgr;
/// @name Preprocessor
/// {
+ bool hasPreprocessor() const { return PP != 0; }
+
Preprocessor &getPreprocessor() const {
assert(PP && "Compiler instance has no preprocessor!");
return *PP;
/// @name ASTContext
/// {
+ bool hasASTContext() const { return Context != 0; }
+
ASTContext &getASTContext() const {
assert(Context && "Compiler instance has no AST context!");
return *Context;
// client to use for any errors during option handling.
InitializeDiagnosticOptions(Clang.getDiagnosticOpts());
Clang.createDiagnostics(argc, argv);
- if (!&Clang.getDiagnostics())
+ if (!Clang.hasDiagnostics())
return 1;
// Set an error handler, so that any LLVM backend diagnostics go through our
Clang.setTarget(
ConstructCompilerInvocation(Clang.getInvocation(), Clang.getDiagnostics(),
argv[0], IsAST));
- if (!&Clang.getTarget())
+ if (!Clang.hasTarget())
return 1;
// Validate/process some options