Граф коммитов

191 Коммитов

Автор SHA1 Сообщение Дата
Ted Kremenek b93efa3d8f Reenable the default lexer.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59843 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-21 20:51:59 +00:00
Ted Kremenek d5a8f0bde6 When creating the raw tokens for PTHLexer, make sure the token representing the file to include is checked for being an identifier.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59842 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-21 20:51:15 +00:00
Ted Kremenek c840f0cbd9 When creating raw tokens for the PTHLexer specially handle angled strings for #include directives.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59840 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-21 19:41:29 +00:00
Ted Kremenek cd4e2aecde PTHLexer:
- Move out logic for handling the end-of-file to LexEndOfFile (to match the Lexer) class.  The logic now mirrors the Lexer class more, which allows us to pass most of the Preprocessor test cases.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59768 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-21 00:58:35 +00:00
Ted Kremenek 89d7ee9619 PTHLexer:
- Move PTHLexer::GetToken() to be inside PTHLexer.cpp.
- When lexing in raw mode, null out identifiers.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59744 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-20 19:49:00 +00:00
Ted Kremenek dd95d6cca5 Handle another case where we should use PTHLexer as an alternative to the normal Lexer.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59736 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-20 16:46:54 +00:00
Ted Kremenek 31aba425a0 PTHLexer:
- Rename 'CurToken' and 'LastToken' to 'CurTokenIdx' and 'LastTokenIdx'
  respectively.
- Add helper methods GetToken(), AdvanceToken(), AtLastToken() to abstract away
  details of the token stream. This also allows us to easily replace their
  implementation later.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59733 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-20 16:32:22 +00:00
Ted Kremenek 81d24e135c Rename IsNonPragmaNonMacroLexer to IsFileLexer.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59731 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-20 16:19:53 +00:00
Ted Kremenek d6f53dc495 Rewrote PTHLexer::Lex by digging through the sources of Lexer again. Now we can do basic macro expansion using the PTHLexer.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59724 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-20 07:58:05 +00:00
Ted Kremenek 15ba2af0f9 Add ugly "test harness" for PTHLexer that is not enabled by default. The
(temporary hack) to test the PTHLexer is that whenever we would create a Lexer
object we instead raw lex a memory buffer first and then use the PTHLexer. This
logic exists only to driver the PTHLexer and will be removed/changed in the
future. Note that the regular path using normal Lexer objects is what is used by
default.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59723 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-20 07:56:33 +00:00
Ted Kremenek a751217e76 Make FIXME a hard assertion.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59695 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-20 01:52:55 +00:00
Ted Kremenek 68e48e4a81 Preprocessor::getCurrentFileLexer() now returns a PreprocessorLexer* instead of
a Lexer*. This means it will either return the current (normal) file Lexer or a
PTHLexer.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59694 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-20 01:49:44 +00:00
Ted Kremenek 35c10c25dd Just use the SourceLocation of SysHeaderTok when doing a callback to emit #line
information. A diff of the -E output for Cocoa.h shows that there is no change
in output.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59693 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-20 01:45:11 +00:00
Ted Kremenek a275a191fc Assign the result of getCurrentFileLexer() to a PreprocessorLexer* instead of Lexer* (narrower interface).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59691 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-20 01:35:24 +00:00
Ted Kremenek 452e37837a - Default initialize ParsingPreprocessorDirective, ParsingFilename, and
LexingRawMode in the ctor of PreprocessorLexer.

- PTHLexer: Use "LastToken" instead of "NumToken"


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59690 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-20 01:29:45 +00:00
Ted Kremenek 4d35da2e41 Add (untested) implementation of PTHLexer::isNextPPTokenLParen() and PTHLexer::DiscardToEndOfLine().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59687 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-20 01:16:50 +00:00
Ted Kremenek ac80c6e06b Use PreprocessorLexer::getFileID() instead of Lexer::getFileLoc(). This is an intermediate step to having getCurrentLexer() return a PreprocessorLexer* instead of a Lexer*.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59672 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-19 22:55:25 +00:00
Ted Kremenek 1a531570d2 Move more cases of using 'CurLexer' to 'CurPPLexer'.
Use PTHLexer::isNextPPTokenLParen() when using the PTHLexer.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59671 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-19 22:43:49 +00:00
Ted Kremenek 2f1c0243f7 Add stub for PTHLexer::isNextPPTokenLParen().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59670 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-19 22:42:26 +00:00
Ted Kremenek 17ff58a631 When using a PTHLexer, use DiscardToEndOfLine() instead of ReadToEndOfLine().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59668 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-19 22:21:33 +00:00
Ted Kremenek 41938c8493 - Move static function IsNonPragmaNonMacroLexer into Preprocessor.h.
- Add variants of IsNonPragmaNonMacroLexer to accept an IncludeMacroStack entry
  (simplifies some uses).
- Use IsNonPragmaNonMacroLexer in Preprocessor::LookupFile.
- Add 'FileID' to PreprocessorLexer, and have Preprocessor query this fileid
  when looking up the FileEntry for a file

Performance testing of -Eonly on Cocoa.h shows no performance regression because
of this patch.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59666 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-19 21:57:25 +00:00
Oscar Fuentes 148f061354 CMake: Added some source files.
Patch contributed by Jay Foad!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59656 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-19 18:46:39 +00:00
Argyrios Kyrtzidis fad03b2b38 Remove Preprocessor::CacheTokens boolean data member. The same functionality can be provided by using Preprocessor::isBacktrackEnabled().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59631 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-19 14:23:14 +00:00
Chris Lattner 6cf3ed7be7 don't turn identifierinfo's into strings in diagnostics.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59602 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-19 07:33:58 +00:00
Ted Kremenek 2df37b8eae Revert 59574 (caused tests to fail).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59579 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-19 01:54:47 +00:00
Ted Kremenek 0a36264440 - Move static function IsNonPragmaNonMacroLexer into Preprocessor.h.
- Add variants of IsNonPragmaNonMacroLexer to accept an IncludeMacroStack entry
  (simplifies some uses).
- Use IsNonPragmaNonMacroLexer in Preprocessor::LookupFile.

Performance testing of -Eonly on Cocoa.h shows no performance regression because
of this patch.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59574 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-19 00:46:18 +00:00
Ted Kremenek 4b71e3e439 Initialize CurPPLexer in Preprocessor's constructor.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59573 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-19 00:44:06 +00:00
Chris Lattner 204b2fed90 Remove the last of the old-style Preprocessor::Diag methods.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59554 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-18 21:48:13 +00:00
Chris Lattner 56b05c8829 remove one more Preprocessor::Diag method.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59512 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-18 08:02:48 +00:00
Chris Lattner 3692b09faa Convert the lexer and start converting the PP over to using canonical Diag methods.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59511 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-18 07:59:24 +00:00
Chris Lattner 0a14eee528 This reworks some of the Diagnostic interfaces a bit to change how diagnostics
are formed.  In particular, a diagnostic with all its strings and ranges is now
packaged up and sent to DiagnosticClients as a DiagnosticInfo instead of as a 
ton of random stuff.  This has the benefit of simplifying the interface, making
it more extensible, and allowing us to do more checking for things like access
past the end of the various arrays passed in.

In addition to introducing DiagnosticInfo, this also substantially changes how 
Diagnostic::Report works.  Instead of being passed in all of the info required
to issue a diagnostic, Report now takes only the required info (a location and 
ID) and returns a fresh DiagnosticInfo *by value*.  The caller is then free to
stuff strings and ranges into the DiagnosticInfo with the << operator.  When
the dtor runs on the DiagnosticInfo object (which should happen at the end of
the statement), the diagnostic is actually emitted with all of the accumulated
information.  This is a somewhat tricky dance, but it means that the 
accumulated DiagnosticInfo is allowed to keep pointers to other expression 
temporaries without those pointers getting invalidated.

This is just the minimal change to get this stuff working, but this will allow
us to eliminate the zillions of variant "Diag" methods scattered throughout
(e.g.) sema.  For example, instead of calling:

  Diag(BuiltinLoc, diag::err_overload_no_match, typeNames,
       SourceRange(BuiltinLoc, RParenLoc));

We will soon be able to just do:

  Diag(BuiltinLoc, diag::err_overload_no_match)
      << typeNames << SourceRange(BuiltinLoc, RParenLoc));

This scales better to support arbitrary types being passed in (not just 
strings) in a type-safe way.  Go operator overloading?!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59502 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-18 07:04:44 +00:00
Chris Lattner 2383b7f6ae Change the diagnostics interface to take an array of pointers to
strings instead of array of strings.  This reduces string copying
in some not-very-important cases, but paves the way for future 
improvements.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59494 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-18 04:56:44 +00:00
Ted Kremenek 4b391087f9 - Add Lexer::isPragma() accessor for clients of Lexer that aren't friends.
- Add static method to test if the current lexer is a non-macro/non-pragma
  lexer.
- Refactor some code in PPLexerChange to use this static method.
- No performance change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59486 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-18 01:33:13 +00:00
Ted Kremenek 68a91d5736 Replace more uses of 'CurLexer->' with 'CurPPLexer->'. No performance change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59482 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-18 01:12:54 +00:00
Ted Kremenek f6452c5421 Add hooks to use PTHLexer::Lex instead of Lexer::Lex when CurLexer is null.
Performance tests on Cocoa.h (using the regular Lexer) shows no performance
difference.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59479 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-18 01:04:47 +00:00
Ted Kremenek ac6b06df32 Added conditional guard 'if (CurLexer)' when using SetCommentRetentionState().
This is because the PTHLexer will not support this method. Performance testing
on preprocessing Cocoa.h shows that this results in a negligible performance
difference (less than 1%).

I tried making Lexer::SetCommentRetentionState() an out-of-line function (a
precursor to making it a virtual function in PreprocessorLexer) and noticed a 1%
decrease in speed (it is called in a hot part of the Preprocessor).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59477 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-18 00:43:07 +00:00
Ted Kremenek 60e45d4c41 Change a bunch of uses of 'CurLexer->' to 'CurPPLexer->', which should be the
alias for the current PreprocessorLexer. No functionality change. Performance
testing shows this results in no performance degradation when preprocessing
Cocoa.h.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59474 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-18 00:34:22 +00:00
Ted Kremenek 9c1b750c59 - Add 'CurPPLexer' to Preprocessor to keep track of the current
PreprocessorLexer, which will either be a 'Lexer' or 'PTHLexer'.
- Added stub field 'CurPTHLexer' to keep track of the current PTHLexer.
- Modified IncludeStackInfo to track both the current PTHLexer and
  current PreprocessorLexer.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59472 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-18 00:12:49 +00:00
Chris Lattner 51881c56b0 Trivial tidying
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59424 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-16 20:22:05 +00:00
Ted Kremenek caaa7df2c7 Using llvm::OwningPtr<> for CurLexer and CurTokenLexer. This makes both the ownership semantics of these objects explicit within the Preprocessor and also tightens up the code (explicit deletes not needed).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59249 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-13 17:11:24 +00:00
Ted Kremenek ed04c4cdca Use PushIncludeMacroStack/PopMacroStack instead of manually pushing/popping from IncludeMacroStack. This is both cleaner and makes the include stack transparently extensible.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59248 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-13 16:51:03 +00:00
Ted Kremenek d6a2e7d71e Move some diagnostic handling to PreprocessorLexer.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59191 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-12 23:13:54 +00:00
Ted Kremenek 2c71d0f00e Add virtual dtor to PreprocessorLexer.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59188 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-12 22:48:57 +00:00
Ted Kremenek 6db72c092d Remove Lexer::LexIncludeFilename.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59186 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-12 22:44:15 +00:00
Ted Kremenek ab91b7086c Move LexIncludeFilename from Lexer to PreprocessorLexer.
PreprocessorLexer now has a virtual method "IndirectLex" which allows it to call the lex method of its subclasses.  This is not for performance intensive operations.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59185 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-12 22:43:05 +00:00
Ted Kremenek 174da89d2d Use PushIncludeMacroStack() instead of manually manipulating the include stack.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59181 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-12 22:21:57 +00:00
Ted Kremenek 274b20863a Add skeleton for PTH lexer.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59169 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-12 21:37:15 +00:00
Argyrios Kyrtzidis 3604e3895e Introduce annotation tokens, a special kind of token, created and used only by the parser to replace a group of tokens with a single token encoding semantic information.
Will be fully utilized later for C++ nested-name-specifiers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58911 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-08 16:17:04 +00:00
Sanjiv Gupta 73608a89a6 Fixed build warning. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58503 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-31 10:24:31 +00:00
Sanjiv Gupta 31fc07df7f Made the mechanism of defining preprocessor defs for maxint, ptrdiff_t, wchar
etc more generic. For some targets, long may not be equal to pointer size. For
example: PIC16 has int as i16, ptr as i16 but long as i32.

Also fixed a few build warnings in assert() functions in CFRefCount.cpp,
CGDecl.cpp, SemaDeclCXX.cpp and ParseDeclCXX.cpp.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58501 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-31 09:52:39 +00:00
Ted Kremenek 8173dba222 Initialize Suffix and Prefix to 0, even with a bad entry. Removes an uninitialized value warning from gcc.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58305 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-28 00:18:42 +00:00
Chris Lattner 9d72851fec Rename Characteristic_t to CharacteristicKind
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58224 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-27 01:19:25 +00:00
Oscar Fuentes d2f4e5ea6e CMake: Builds and installs clang binary and libs (no docs yet). It
must be under the `tools' subdirectory of the LLVM *source* tree.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58180 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-26 00:56:18 +00:00
Daniel Dunbar a179be34c1 Speed up NumericLiteralParser::GetIntegerValue.
- Implement fast path when value easily fits in a uint64.
 - ~6x faster, translates to 1-2% on Cocoa.h


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57632 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-16 07:32:01 +00:00
Daniel Dunbar d70cb64570 Simplify overflow-on-add check in NumericLiteralParser::GetIntegerValue.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57629 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-16 06:39:30 +00:00
Chris Lattner 9e6293d4df Change FormTokenWithChars to take the token kind to form, since all clients
were setting a kind and then forming it.  This is just a minor API cleanup, 
no functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57404 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-12 04:51:35 +00:00
Chris Lattner 31f0ecae4b When in keep whitespace mode, make sure to return block comments that are
unterminated.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57403 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-12 04:19:49 +00:00
Chris Lattner 2d3818959d Change SkipBlockComment and SkipBCPLComment to return true when in
keep comment mode, instead of returning false.  This matches SkipWhitespace.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57402 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-12 04:15:42 +00:00
Chris Lattner d88dc48e33 Add a new mode to the lexer which enables it to return all characters,
even whitespace, as tokens from the file.  This is enabled with
L->SetKeepWhitespaceMode(true) on a raw lexer.  In this mode, you too
can use clang as a really complex version of 'cat' with code like this:

  Lexer RawLex(SourceLocation::getFileLoc(SM.getMainFileID(), 0),
               PP.getLangOptions(), File.first, File.second);
  
  RawLex.SetKeepWhitespaceMode(true);
  
  Token RawTok;
  RawLex.LexFromRawLexer(RawTok);
  while (RawTok.isNot(tok::eof)) {
    std::cout << PP.getSpelling(RawTok);
    RawLex.LexFromRawLexer(RawTok);
  }

This will emit exactly the input file, with no canonicalization or other
translation.  Realistic clients actually do something with the tokens of
course :)



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57401 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-12 04:05:48 +00:00
Chris Lattner aea3ad0737 Stop the preprocessor from poking the lexer's private parts.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57399 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-12 03:31:33 +00:00
Chris Lattner f744d133e8 Fix a couple more places that poke KeepCommentMode unnecesarily.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57398 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-12 03:27:19 +00:00
Chris Lattner fa95a019da add a new inKeepCommentMode() accessor to abstract the KeepCommentMode
ivar.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57397 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-12 03:22:02 +00:00
Chris Lattner a2c7ad9c73 fix misleading comment.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57396 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-12 01:34:51 +00:00
Chris Lattner 0af574270d Simplify raw mode lexing by treating an unterminate /**/ comment the
same we we do an unterminated string or character literal.  This makes
it so we can guarantee that the lexer never calls into the 
preprocessor (which would be suicide for a raw lexer).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57395 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-12 01:31:51 +00:00
Chris Lattner 8527b71b19 add a comment.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57394 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-12 01:23:27 +00:00
Chris Lattner 590f0cc643 Change how raw lexers are handled: instead of creating them and then
using LexRawToken, create one and use LexFromRawLexer.  This avoids
twiddling the RawLexer flag around and simplifies some code (even 
speeding raw lexing up a tiny bit).

This change also improves the token paster to use a Lexer on the stack
instead of new/deleting it. 



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57393 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-12 01:15:46 +00:00
Chris Lattner 33d34a6f7a silence some release-assert warnings.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57391 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-12 00:28:42 +00:00
Chris Lattner 7a4f004a77 improve a comment.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57389 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-12 00:23:07 +00:00
Chris Lattner eb52b44caf __CONSTANT_CFSTRINGS__ should be defined even in C mode, otherwise the CFSTR
won't expand to the builtin.  This fixes rdar://6248329



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57164 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-06 07:43:09 +00:00
Chris Lattner 12f0926029 move __FLT_EVAL_METHOD__, __FLT_RADIX__, and __DECIMAL_DIG__ into
target indep code.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57139 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-05 21:49:27 +00:00
Chris Lattner e9863cab04 suck the rest of the FP macros out of the targets into the PP
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57137 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-05 21:40:58 +00:00
Chris Lattner 2db78dd977 start moving fp macros over
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57134 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-05 20:40:30 +00:00
Chris Lattner 0e5d4ef315 move a bunch more integer sizing out of target-specific code into
target indep code.  

Note that this changes functionality on PIC16: it defines __INT_MAX__
correctly for it, and it changes sizeof(long) to 16-bits (to match
the size of pointer).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57132 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-05 20:06:37 +00:00
Chris Lattner 9b53316457 eliminate __USER_LABEL_PREFIX__ from the Targets.cpp file, start moving
integer size #defines over to the Preprocessor.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57130 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-05 19:44:25 +00:00
Chris Lattner 2b43ad9588 gcc no longer defines __block to nothing when blocks aren't enabled.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57129 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-05 19:32:52 +00:00
Chris Lattner 62213d9082 rearrange preprocessor macro definitions into language-specific
then target specific.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57128 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-05 19:32:22 +00:00
Chris Lattner 3fdf467893 Implement PR2773, support for __USER_LABEL_PREFIX__
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57127 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-05 19:22:37 +00:00
Daniel Dunbar 4095080aff Add Preprocessor::RemovePragmaHandler.
- No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57065 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-04 19:17:46 +00:00
Chris Lattner c29bbde0a1 Document assumptions that NumericLiteralParser makes with an assertion.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56876 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-30 20:45:40 +00:00
Chris Lattner 048dd943fc define __PASCAL_STRINGS__ whenever -fpascal-strings is enabled.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56824 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-30 00:48:48 +00:00
Chris Lattner 71af229645 __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ is a darwin-specific #define
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56822 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-30 00:46:39 +00:00
Chris Lattner 4411f46050 Fix the root cause of PR2750 instead of the side effect.
NumericLiteral parser is not careful about overrun because
it should never be possible.  It implicitly expects that its
input matched the regex for pp-constant.  Because of this, it
knows it can't be pointing to a prefix of something that
looks like a number.  This is all fine, except that __LINE__
does not prevent implicit concatenation from happening.  Fix
__LINE__ to not do this.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56818 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-29 23:12:31 +00:00
Nico Weber 48002c8957 whitespace and comment changes, to fix grammar and 80 col violations
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56776 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-29 00:25:48 +00:00
Chris Lattner 0b9e736308 clean up a bunch of fixme's I added, by moving
DirectoryLookup::DirType into SourceManager.h


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56692 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-26 21:18:42 +00:00
Chris Lattner 721818304a Fix the rest of rdar://6243860 hopefully. This requires changing FileIDInfo
to whether the fileid is a 'extern c system header' in addition to whether it
is a system header, most of this is spreading plumbing around.  Once we have that,
PPLexerChange bases its "file enter/exit" notifications to PPCallbacks to
base the system header state on FileIDInfo instead of HeaderSearch.  Finally,
in Preprocessor::HandleIncludeDirective, mirror logic in GCC: the system headerness
of a file being entered can be set due to the #includer or the #includee.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56688 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-26 20:12:23 +00:00
Daniel Dunbar 38a67c9dfb Update clang to pretend to be gcc-4.2.
- This really needs to be automated and configurable.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56635 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-26 01:13:13 +00:00
Steve Naroff dca6d6e8b0 Fix <rdar://problem/6240065> clang: __BLOCKS__ should be defined.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56503 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-23 21:28:24 +00:00
Argyrios Kyrtzidis 02e7e7442c Line endings: CRLF -> LF
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55829 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-05 08:53:53 +00:00
Steve Naroff b4eaf9cf5f - Implement __block.
- Replace FIXME in Preprocessor::HandleIdentifier() with a check that avoids diagnosing extension tokens that originate from macro definitions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55639 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-02 18:50:17 +00:00
Steve Naroff c9a4eea592 Pull code from last commit. will put back soon.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55637 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-02 18:04:36 +00:00
Steve Naroff 042f955a20 Implement block pseudo-storage class modifiers (__block, __byref).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55635 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-02 15:20:19 +00:00
Eli Friedman 6f7adbdcd0 Fix for PR2750; don't check for an 'e' in the trash after the token.
Note that this isn't really a complete fix; I think there are other 
potential overrun situations.  I don't really know what the best 
systematic fix is, though.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55622 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-02 05:29:22 +00:00
Argyrios Kyrtzidis ed5c38682c Rename Preprocessor::DisableBacktrack -> Preprocessor::CommitBacktrackedTokens.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55281 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-24 12:29:43 +00:00
Argyrios Kyrtzidis 2174a4ff83 Add a safety check.
Make sure there's no "dangling" backtrack position when Preprocessor is destroyed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55236 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-23 12:12:06 +00:00
Argyrios Kyrtzidis bff73f7f2d Change line endings: CRLF -> LF
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55235 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-23 12:05:53 +00:00
Argyrios Kyrtzidis a9e274c01e Allow nested backtracks.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55204 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-22 21:27:50 +00:00
Chris Lattner 9aa77f137b various updates to match r54873 on mainline.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54874 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-17 07:19:51 +00:00
Daniel Dunbar 662e8b5647 Change Parser & Sema to use interned "super" for comparions.
- Added as private members for each because it is not clear where to
   put the common definition. Perhaps the IdentifierInfos all of these
   "pseudo-keywords" should be collected into one place (this would
   KnownFunctionIDs and Objective-C property IDs, for example).

Remove Token::isNamedIdentifier.
 - There isn't a good reason to use strcmp when we have interned
   strings, and there isn't a good reason to encourage clients to do
   so.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54794 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-14 22:04:54 +00:00
Daniel Dunbar fba5cb12ad Move some ObjC preprocessor definitions into
InitializePredefinedMacros().
 - Also now properly wired to -fobjc-gc, -fnext-runtime.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54661 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-12 00:21:46 +00:00
Chris Lattner de9d55a0db remove obsolete comment.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54652 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-11 22:03:07 +00:00