Now instead of IdentifierInfo knowing anything about MacroInfo,
only the preprocessor knows. This makes MacroInfo truly private
to the Lex library (and its direct clients) instead of being
accessed in the Basic library.
llvm-svn: 42727
out of the llvm namespace. This makes the clang namespace be a sibling of
llvm instead of being a child.
The good thing about this is that it makes many things unambiguous. The
bad things is that many things in the llvm namespace (notably data structures
like smallvector) now require an llvm:: qualifier. IMO, libsystem and libsupport
should be split out of llvm into their own namespace in the future, which will fix
this issue.
llvm-svn: 39659
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
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
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
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
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
that are lexed are made up of tokens, so the calls are just ugly and redundant.
Hook up the MIOpt for the #if case. PPCExpressions doesn't currently implement
the hook though, so we still don't handle #if !defined(X) with the MIOpt.
llvm-svn: 38649
Now, instead of keeping a pointer to the start of the token in memory, we keep the
start of the token as a SourceLocation node. This means that each LexerToken knows
the full include stack it was created with, and means that the LexerToken isn't
reliant on a "CurLexer" member to be around (lexer tokens would previously go out of
scope when their lexers were deallocated).
This simplifies several things, and forces good cleanup elsewhere. Now the
Preprocessor is the one that knows how to dump tokens/macros and is the one that
knows how to get the spelling of a token (it has all the context).
llvm-svn: 38551