diff options
author | Chris Lattner <sabre@nondot.org> | 2009-01-17 08:27:52 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-01-17 08:27:52 +0000 |
commit | 42e00d19b0dac64732eb5449d52a076282fcbf77 (patch) | |
tree | dd0a813f9434a27631eceae143fe7529ed52b018 /lib/Lex/Pragma.cpp | |
parent | f056d92e182cbe4f62c8d14102544dc38066dabc (diff) |
Change the Lexer ctor used to lex _Pragma directives into a static factory
method. This lets us clean up the interface and make it more obvious that
this method is *really really* _Pragma specific.
Note that _Pragma handling uglifies the Lexer in the critical path. It would
be very interesting to consider making _Pragma remapping be a new special
lexer class of its own.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62425 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex/Pragma.cpp')
-rw-r--r-- | lib/Lex/Pragma.cpp | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/lib/Lex/Pragma.cpp b/lib/Lex/Pragma.cpp index 860301650b..3f5a5a9d19 100644 --- a/lib/Lex/Pragma.cpp +++ b/lib/Lex/Pragma.cpp @@ -157,19 +157,12 @@ void Preprocessor::Handle_Pragma(Token &Tok) { // Plop the string (including the newline and trailing null) into a buffer // where we can lex it. SourceLocation TokLoc = CreateString(&StrVal[0], StrVal.size(), StrLoc); - const char *StrData = SourceMgr.getCharacterData(TokLoc); // Make and enter a lexer object so that we lex and expand the tokens just // like any others. - Lexer *TL = new Lexer(TokLoc, *this, - StrData, StrData+StrVal.size()-1 /* no null */); - - // Ensure that the lexer thinks it is inside a directive, so that end \n will - // return an EOM token. - TL->ParsingPreprocessorDirective = true; - - // This lexer really is for _Pragma. - TL->Is_PragmaLexer = true; + Lexer *TL = Lexer::Create_PragmaLexer(TokLoc, + // do not include the null in the count. + StrVal.size()-1, *this); EnterSourceFileWithLexer(TL, 0); |