summaryrefslogtreecommitdiffstats
path: root/clang/Lex
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix a bug steve noticed where we warned that __attribute is an extension,Chris Lattner2007-06-081-1/+11
| | | | | | but where we didn't warn about __attribute__. llvm-svn: 39607
* Emit better diagnostics for out of range digits:Chris Lattner2007-06-081-0/+8
| | | | | | | | | | | | | | | | | | | | diag.c:1:9: error: invalid digit '8' in octal constant int x = 000080; ^ diag.c:2:9: error: invalid digit 'A' in decimal constant int z = 1000080ABC; ^ instead of: diag.c:1:9: error: invalid suffix '80' on integer constant int x = 000080; ^ diag.c:2:9: error: invalid suffix 'ABC' on integer constant int z = 1000080ABC; ^ llvm-svn: 39605
* Submitted by: Bill WendlingBill Wendling2007-06-021-11/+11
| | | | | | Removed #include <iostream>. llvm-svn: 39554
* Bug #:Bill Wendling2007-05-232-2/+0
| | | | | | | | | Submitted by: Bill Wendling Reviewed by: Chris Lattner - Removed unneeded <iostream> header. llvm-svn: 39484
* Implement Sema::ParseNumericConstant for integer constants in terms of APIntChris Lattner2007-05-211-38/+0
| | | | | | and correctly in terms of C99 6.4.4.1p5. llvm-svn: 39473
* implement octal escape sequences.Chris Lattner2007-05-201-3/+22
| | | | llvm-svn: 39463
* Implement hex escape sequences in string and character literals, e.g. L"\x12345"Chris Lattner2007-05-201-11/+34
| | | | llvm-svn: 39462
* Add support for inserting up to 10 strings in a diagnostic, with %0, %1, %2,Chris Lattner2007-05-161-1/+5
| | | | | | etc. llvm-svn: 39447
* Remove the clang::SourceBuffer class, switch to the llvm::MemoryBuffer class.Chris Lattner2007-04-293-9/+8
| | | | llvm-svn: 39426
* fixme done!Chris Lattner2007-04-111-1/+0
| | | | llvm-svn: 39407
* Warn when performing 'usual' conversions that require a sign change. ThisChris Lattner2007-04-111-3/+13
| | | | | | | | | | | | | | implements test/Preprocessor/expr_usual_conversions.c, which produces this output: expr_usual_conversions.c:5:10: warning: left side of operator converted from negative value to unsigned: -42 to 18446744073709551574 #if (-42 + 0U) / -2 ^ expr_usual_conversions.c:5:16: warning: right side of operator converted from negative value to unsigned: -2 to 18446744073709551614 #if (-42 + 0U) / -2 ^ llvm-svn: 39406
* Overflow detection for multiply and divide. Fix a bug handling 'usualChris Lattner2007-04-111-1/+6
| | | | | | arithmetic conversions'. llvm-svn: 39405
* Catch overflow of negate. This allows us to emit:Chris Lattner2007-04-111-1/+14
| | | | | | | | | | | | | | | | | t.c:2:17: warning: integer overflow in preprocessor expression #if -(INTMAX_MAX+1) ^ t.c:2:5: warning: integer overflow in preprocessor expression #if -(INTMAX_MAX+1) ^ GCC has some seriously confused source locations in this case: t.c:2:19: warning: integer overflow in preprocessor expression t.c:2:20: warning: integer overflow in preprocessor expression column 19/20 are off the end of the line. llvm-svn: 39404
* Overflow detection for +/-Chris Lattner2007-04-111-0/+10
| | | | llvm-svn: 39403
* Evaluate result into an explicit destination. No functionality change.Chris Lattner2007-04-101-29/+39
| | | | llvm-svn: 39402
* Track overflow of shift amounts, allowing diagnostics like:Chris Lattner2007-04-101-8/+26
| | | | | | | | | | | | | | | | | t.c:6:7: warning: integer overflow in preprocessor expression #if 1 << 63 ^ t.c:8:7: warning: integer overflow in preprocessor expression #if 4 << 62 ^ t.c:10:7: warning: integer overflow in preprocessor expression #if 4 << 66 ^ but no diagnostic on: #if 1U << 63 llvm-svn: 39400
* 'true' in a CPP expression evaluates to 1 when in C++ mode. This implementsChris Lattner2007-04-101-2/+3
| | | | | | test/Preprocessor/cxx_true.cpp llvm-svn: 39399
* Include the filename being looked up in an error message. This gives us stuffChris Lattner2007-04-102-3/+6
| | | | | | | | | | | | | | | | | like this: t3.c:5:10: error: 'vers2.h' file not found #include xstr(INCFILE(2).h) ^ instead of: t3.c:5:10: error: file not found #include xstr(INCFILE(2).h) ^ which is useful if the #include name is generated through macro expansion. llvm-svn: 39398
* Diagnostics relating to computation of values should only be produced if anChris Lattner2007-04-101-21/+50
| | | | | | | | | | | expression is live. For example: #if 0 ? 124/0 : 42 should cause no error. This implements test/Preprocessor/expr_liveness.c llvm-svn: 39397
* Add support for character constants in PP expressions, like:Chris Lattner2007-04-051-0/+41
| | | | | | #if 'a' llvm-svn: 39393
* Implement support for performing semantic analysis of character literals.Chris Lattner2007-04-051-106/+192
| | | | llvm-svn: 39390
* Correctly represent and propagate signedness information in preprocessorChris Lattner2007-04-051-36/+85
| | | | | | | | | | | | | | | | constant expressions. This allows us to emit this diagnostic: t.c:5:5: warning: integer constant is so large that it is unsigned #if 12345678901234567890 ^ And makes constant evaluation fully correct, but we do not yet detect and warn about integer overflow. This patch requires cvs up'ing the main llvm tree to get the APSInt class, but no libraries need to be rebuilt there. llvm-svn: 39388
* minor cleanups. The major missing piece is tracking:Chris Lattner2007-04-041-4/+4
| | | | | | | * signedness of values * overflow of intermediate computations. llvm-svn: 39387
* Ah, this is already correctly rejected!Chris Lattner2007-04-041-6/+1
| | | | llvm-svn: 39386
* Switch PPExpression parsing to be in terms of APInt's whose widths are properlyChris Lattner2007-04-041-35/+55
| | | | | | | | | | | | | sized to the target's intmax_t. This also allows us to emit diagnostic like: t.c:11:5: warning: integer constant is too large for its type #if 18446744073709551616 // 2^64 ^ t.c:15:5: warning: integer constant is too large for its type #if 18446744073709551617 // 2^64-1 ^ llvm-svn: 39385
* Minor enhancements to GetIntegerValue(APInt):Chris Lattner2007-04-041-8/+21
| | | | | | | * Detect overflow correctly. When it occurs, return the truncated value. * Add fixme for radix analysis. llvm-svn: 39382
* Add some really simplistic code for turning a ppnumber into an APInt. MuchChris Lattner2007-04-041-23/+49
| | | | | | improvement is needed! llvm-svn: 39381
* Specify an initial size for StringMap.Chris Lattner2007-04-031-1/+1
| | | | llvm-svn: 39378
* Bug #:Steve Naroff2007-03-231-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | Submitted by: Reviewed by: Type Checking...round 2. This checkin "breaks" parsing carbon.h. I imagine that this will be true for the next week or so. Nevertheless, this round of changes includes the following: - Hacked various Expr classes to pass the appropriate TypeRef. Still have a few more classes to touch. - Implement type checking for ParseArraySubscriptExpr and ParseMemberReferenceExpr. - Added a debug hook to derive the class name for Stmt/Expr nodes. Currently a linear search...could easily optimize if important. - Changed the name of TaggedType->TagType. Now we have TagType and TagDecl (which are easier to remember). - Fixed a bug in StringLiteral conversion I did a couple weeks ago. hadError was not initialized (oops). - changed Sema::Diag to return true. This streamlines the type checking code considerably. - Added many diagnositics. This should be it! llvm-svn: 39361
* Bug #:Steve Naroff2007-03-131-0/+231
| | | | | | | | | | | Submitted by: Reviewed by: Move string literal parsing from Sema=>LiteralSupport. This consolidates all the quirky parsing code within the Lexer subsystem (yeah!). This simplifies Sema and (more importantly) allows future parsers (i.e. subclasses of Action) to benefit from this code. llvm-svn: 39354
* Bug #:Steve Naroff2007-03-132-17/+36
| | | | | | | | | Submitted by: Reviewed by: Misc. cleanup/polish of NumericLiteralParser and it's two clients, the C preprocessor and AST builder... llvm-svn: 39353
* Bug #:Steve Naroff2007-03-122-11/+45
| | | | | | | | | | Submitted by: Reviewed by: -Converted the preprocessor to use NumericLiteralParser. -Several minor changes to LiteralSupport interface/implementation. -Added an error diagnostic for floating point usage in pp expr's. llvm-svn: 39352
* Bug #:Steve Naroff2007-03-091-0/+244
| | | | | | | | | | | | | Submitted by: Reviewed by: Moved numeric literal support from SemaExpr.cpp to LiteralSupport.[h,cpp] in Lex. This will allow it to be used by both Sema and Preprocessor (and should be the last major refactoring of this sub-system).. Over time, it will be reused by anyone implementing an actions module (i.e. any subclass of llvm::clang::Action. Minor changes to IntegerLiteral in Expr.h. More to come... llvm-svn: 39351
* switch to using iterators instead of stringmap visitors.Chris Lattner2007-02-112-33/+15
| | | | llvm-svn: 39336
* CStringMap -> StringMap.Chris Lattner2007-02-082-2/+2
| | | | llvm-svn: 39334
* adjust to CStringMap interface change.Chris Lattner2007-02-083-12/+16
| | | | llvm-svn: 39333
* Add support for target-independent builtin functions (like __builtin_abs),Chris Lattner2007-01-281-0/+1
| | | | | | | | | | | | | | | | | | whose decl objects are lazily created the first time they are referenced. Builtin functions are described by the clang/AST/Builtins.def file, which makes it easy to add new ones. This is missing two important pieces: 1. Support for the rest of the gcc builtins. 2. Support for target-specific builtins (e.g. __builtin_ia32_emms). Just adding this builtins reduces the number of implicit function definitions by 6, reducing the # diagnostics from 550 to 544 when parsing carbon.h. I need to add all the i386-specific ones to eliminate several hundred more. ugh. llvm-svn: 39327
* Add support for -fno-operator-names, patch by Bill.Chris Lattner2006-12-041-1/+1
| | | | llvm-svn: 39245
* Produce a nice error message for '#define and' in C++. Patch by Bill!Chris Lattner2006-11-211-4/+14
| | | | llvm-svn: 39218
* eliminate string compares when checking for the 'defined' token.Chris Lattner2006-11-212-3/+2
| | | | llvm-svn: 39216
* Add support for C++ operator keywords. Patch by Bill Wendling.Chris Lattner2006-11-212-2/+20
| | | | llvm-svn: 39214
* Change KeepComments/KeepMacroComments modes to be facets of the preprocessorChris Lattner2006-11-212-10/+14
| | | | | | state, not aspects of the language standard being parsed. llvm-svn: 39209
* simplify the Preprocessor ctor.Chris Lattner2006-11-211-4/+3
| | | | llvm-svn: 39208
* Formalize preprocessor callbacks together into a PPCallbacks structure, insteadChris Lattner2006-11-212-17/+17
| | | | | | | of having a loose collection of function pointers. This also allows clients to maintain state, and reduces the size of the Preprocessor.h interface. llvm-svn: 39203
* Fix a bugChris Lattner2006-11-051-2/+2
| | | | llvm-svn: 39128
* silence some warnings when asserts are disabled.Chris Lattner2006-11-051-0/+1
| | | | llvm-svn: 39127
* implement FIXME: replace use of alloca with use of SmallVector.Chris Lattner2006-11-031-11/+13
| | | | llvm-svn: 39102
* Export the ASTBuilder class from the AST module.Chris Lattner2006-11-031-0/+1
| | | | llvm-svn: 39095
* Add altivec version of block comment skipping code.Chris Lattner2006-10-302-1/+18
| | | | llvm-svn: 39093
* Refactor the paths used for checking and getting the spelling of #includeChris Lattner2006-10-303-50/+81
| | | | | | | | | filenames (and also '#pragma GCC dependency' of course). Now, assuming no cleaning is needed, we can go all the way from lexing the filename to doing filename lookups with no mallocs. This speeds up user PP time from 0.077 to 0.075s for Cocoa.h (2.6%). llvm-svn: 39092
OpenPOWER on IntegriCloud