summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-11-22 08:28:49 +0000
committerChris Lattner <sabre@nondot.org>2008-11-22 08:28:49 +0000
commitbc495d775f0984b2f726618f2ed6bd609e55438e (patch)
treeae76f7008b009febd400a6d3d524e3bfc589c519 /clang
parent060068a0eff706d6afb1ace880e85aa1127cde91 (diff)
downloadbcm5719-llvm-bc495d775f0984b2f726618f2ed6bd609e55438e.tar.gz
bcm5719-llvm-bc495d775f0984b2f726618f2ed6bd609e55438e.zip
move the Diag method for Sema to be inline. This shrinks the release-asserts
clang executable (when built with gcc 4.2 on the mac) from 14519740 to 14495028 bytes. This shrinks individual object files as well: SemaChecking from 23580->22248, SemaDeclObjc from 61368->57376, SemaExpr from 115628->110516, as well as several others. llvm-svn: 59867
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/Sema/Sema.cpp8
-rw-r--r--clang/lib/Sema/Sema.h11
2 files changed, 11 insertions, 8 deletions
diff --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp
index 7c498440c6e..2edf08ec425 100644
--- a/clang/lib/Sema/Sema.cpp
+++ b/clang/lib/Sema/Sema.cpp
@@ -79,7 +79,8 @@ void Sema::ActOnTranslationUnitScope(SourceLocation Loc, Scope *S) {
}
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
@@ -157,11 +158,6 @@ void Sema::ActOnEndOfTranslationUnit() {
// 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();
}
diff --git a/clang/lib/Sema/Sema.h b/clang/lib/Sema/Sema.h
index 6d9e5820666..410c25486b1 100644
--- a/clang/lib/Sema/Sema.h
+++ b/clang/lib/Sema/Sema.h
@@ -19,6 +19,7 @@
#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"
@@ -104,6 +105,8 @@ public:
Preprocessor &PP;
ASTContext &Context;
ASTConsumer &Consumer;
+ Diagnostic &Diags;
+ SourceManager &SourceMgr;
/// CurContext - This is the current declaration context of parsing.
DeclContext *CurContext;
@@ -224,9 +227,13 @@ public:
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);
OpenPOWER on IntegriCloud