[cfe-commits] r59867 - in /cfe/trunk/lib/Sema: Sema.cpp Sema.h
Chris Lattner
sabre at nondot.org
Sat Nov 22 00:28:49 PST 2008
Author: lattner
Date: Sat Nov 22 02:28:49 2008
New Revision: 59867
URL: http://llvm.org/viewvc/llvm-project?rev=59867&view=rev
Log:
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.
Modified:
cfe/trunk/lib/Sema/Sema.cpp
cfe/trunk/lib/Sema/Sema.h
Modified: cfe/trunk/lib/Sema/Sema.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/Sema.cpp?rev=59867&r1=59866&r2=59867&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/Sema.cpp (original)
+++ cfe/trunk/lib/Sema/Sema.cpp Sat Nov 22 02:28:49 2008
@@ -79,7 +79,8 @@
}
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 @@
// 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();
}
Modified: cfe/trunk/lib/Sema/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/Sema.h?rev=59867&r1=59866&r2=59867&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/Sema.h (original)
+++ cfe/trunk/lib/Sema/Sema.h Sat Nov 22 02:28:49 2008
@@ -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 @@
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 @@
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);
More information about the cfe-commits
mailing list