}
Sema::Sema(Preprocessor &pp, ASTContext &ctxt, ASTConsumer &consumer)
- : PP(pp), Context(ctxt), Consumer(consumer), CurContext(0),PreDeclaratorDC(0),
+ : PP(pp), Context(ctxt), Consumer(consumer), Diags(PP.getDiagnostics()),
+ SourceMgr(PP.getSourceManager()), CurContext(0), PreDeclaratorDC(0),
CurBlock(0), PackContext(0), IdResolver(pp.getLangOptions()) {
// Get IdentifierInfo objects for known functions for which we
// Helper functions.
//===----------------------------------------------------------------------===//
-DiagnosticBuilder Sema::Diag(SourceLocation Loc, unsigned DiagID) {
- return PP.getDiagnostics().Report(FullSourceLoc(Loc, PP.getSourceManager()),
- DiagID);
-}
-
const LangOptions &Sema::getLangOptions() const {
return PP.getLangOptions();
}
#include "CXXFieldCollector.h"
#include "SemaOverload.h"
#include "clang/Parse/Action.h"
+#include "clang/Basic/Diagnostic.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/SmallPtrSet.h"
Preprocessor &PP;
ASTContext &Context;
ASTConsumer &Consumer;
+ Diagnostic &Diags;
+ SourceManager &SourceMgr;
/// CurContext - This is the current declaration context of parsing.
DeclContext *CurContext;
Sema(Preprocessor &pp, ASTContext &ctxt, ASTConsumer &consumer);
const LangOptions &getLangOptions() const;
-
+ Diagnostic &getDiagnostics() const { return Diags; }
+ SourceManager &getSourceManager() const { return SourceMgr; }
+
/// The primitive diagnostic helpers.
- DiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID);
+ DiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID) {
+ return Diags.Report(FullSourceLoc(Loc, SourceMgr), DiagID);
+ }
virtual void DeleteExpr(ExprTy *E);
virtual void DeleteStmt(StmtTy *S);