Hi! I made those changes in order to improve the speed of the
construction of the Preprocessor object. Can someone test this to see if
there are problems with this patch?
Edward-san
Index: lib/Lex/Preprocessor.cpp
===================================================================
--- lib/Lex/Preprocessor.cpp (revision 172708)
+++ lib/Lex/Preprocessor.cpp (working copy)
@@ -60,53 +60,41 @@
IdentifierInfoLookup *IILookup, bool OwnsHeaders,
bool DelayInitialization, bool IncrProcessing)
: PPOpts(PPOpts), Diags(&diags), LangOpts(opts), Target(target),
- FileMgr(Headers.getFileMgr()), SourceMgr(SM), HeaderInfo(Headers),
+ FileMgr(Headers.getFileMgr()), SourceMgr(SM),
+ ScratchBuf(new ScratchBuffer(SourceMgr)), HeaderInfo(Headers),
TheModuleLoader(TheModuleLoader), ExternalSource(0),
- Identifiers(opts, IILookup), IncrementalProcessing(IncrProcessing),
- CodeComplete(0), CodeCompletionFile(0), CodeCompletionOffset(0),
- CodeCompletionReached(0), SkipMainFilePreamble(0, true), CurPPLexer(0),
- CurDirLookup(0), CurLexerKind(CLK_Lexer), Callbacks(0), Listener(0),
- MacroArgCache(0), Record(0), MIChainHead(0), MICache(0) {
- OwnsHeaderSearch = OwnsHeaders;
-
- ScratchBuf = new ScratchBuffer(SourceMgr);
- CounterValue = 0; // __COUNTER__ starts at 0.
-
- // Clear stats.
- NumDirectives = NumDefined = NumUndefined = NumPragma = 0;
- NumIf = NumElse = NumEndif = 0;
- NumEnteredSourceFiles = 0;
- NumMacroExpanded = NumFnMacroExpanded = NumBuiltinMacroExpanded = 0;
- NumFastMacroExpanded = NumTokenPaste = NumFastTokenPaste = 0;
- MaxIncludeStackDepth = 0;
- NumSkipped = 0;
-
- // Default to discarding comments.
- KeepComments = false;
- KeepMacroComments = false;
- SuppressIncludeNotFoundError = false;
-
- // Macro expansion is enabled.
- DisableMacroExpansion = false;
- MacroExpansionInDirectivesOverride = false;
- InMacroArgs = false;
- InMacroArgPreExpansion = false;
- NumCachedTokenLexers = 0;
- PragmasEnabled = true;
- ParsingIfOrElifDirective = false;
+ Ident__VA_ARGS__(getIdentifierInfo("__VA_ARGS__")), CounterValue(0),
+ KeepComments(false), KeepMacroComments(false),
+ SuppressIncludeNotFoundError(false), InMacroArgs(false),
+ OwnsHeaderSearch(OwnsHeaders), DisableMacroExpansion(false),
+ MacroExpansionInDirectivesOverride(false),
+ ReadMacrosFromExternalSource(false), PragmasEnabled(true),
+ ParsingIfOrElifDirective(false), InMacroArgPreExpansion(false),
+ Identifiers(opts, IILookup),
+ PragmaHandlers(new PragmaNamespace(StringRef())),
+ IncrementalProcessing(IncrProcessing), CodeComplete(0),
+ CodeCompletionFile(0), CodeCompletionOffset(0), CodeCompletionReached(0),
+ SkipMainFilePreamble(0, true), CurPPLexer(0), CurDirLookup(0),
+ CurLexerKind(CLK_Lexer), Callbacks(0), Listener(0), MacroArgCache(0),
+ NumDirectives(0), NumDefined(0), NumUndefined(0), NumPragma(0),
+ NumIf(0), NumElse(0), NumEndif(0),
+ NumEnteredSourceFiles(0), MaxIncludeStackDepth(0),
+ NumMacroExpanded(0), NumFnMacroExpanded(0), NumBuiltinMacroExpanded(0),
+ NumFastMacroExpanded(0), NumTokenPaste(0), NumFastTokenPaste(0),
+ NumSkipped(0), NumCachedTokenLexers(0), Record(0), CachedLexPos(0),
+ MIChainHead(0), MICache(0),
+ Ident__exception_code(0), Ident___exception_code(0),
+ Ident_GetExceptionCode(0), Ident__exception_info(0),
+ Ident___exception_info(0), Ident_GetExceptionInfo(0),
+ Ident__abnormal_termination(0), Ident___abnormal_termination(0),
+ Ident_AbnormalTermination(0) {
- CachedLexPos = 0;
-
- // We haven't read anything from the external source.
- ReadMacrosFromExternalSource = false;
-
// "Poison" __VA_ARGS__, which can only appear in the expansion of a macro.
// This gets unpoisoned where it is allowed.
- (Ident__VA_ARGS__ = getIdentifierInfo("__VA_ARGS__"))->setIsPoisoned();
+ Ident__VA_ARGS__->setIsPoisoned();
SetPoisonReason(Ident__VA_ARGS__,diag::ext_pp_bad_vaargs_use);
// Initialize the pragma handlers.
- PragmaHandlers = new PragmaNamespace(StringRef());
RegisterBuiltinPragmas();
// Initialize builtin macros like __LINE__ and friends.
@@ -122,10 +110,6 @@
Ident__abnormal_termination = getIdentifierInfo("_abnormal_termination");
Ident___abnormal_termination = getIdentifierInfo("__abnormal_termination");
Ident_AbnormalTermination = getIdentifierInfo("AbnormalTermination");
- } else {
- Ident__exception_info = Ident__exception_code = Ident__abnormal_termination = 0;
- Ident___exception_info = Ident___exception_code = Ident___abnormal_termination = 0;
- Ident_GetExceptionInfo = Ident_GetExceptionCode = Ident_AbnormalTermination = 0;
}
if (!DelayInitialization) {
_______________________________________________
cfe-commits mailing list
cfe-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits