Commit Graph

14 Commits

Author SHA1 Message Date
David Majnemer d3c3e78ac1 Lex: Fix an invalid access into a SmallString
We would crash because we used operator[] to access past the end of a
SmallString.  This occured because our token had length zero.

Instead, form the pointer using .data() and arithmetic.  This is safe
because this forms a one-past-the-end pointer and it is only used to
compare with another one-past-the-end pointer.

This fixes PR21379.

llvm-svn: 220614
2014-10-25 11:40:40 +00:00
David Majnemer 21db51ab91 Simplify test case added in r194059
llvm-svn: 194061
2013-11-05 10:05:58 +00:00
David Majnemer 76faf1f525 Lex: Require that '#' be followed by a macro parameter name when preceded by '##'
After lexing a '##', we would look ahead and check to see if it was
followed by '__VA_ARGS__'.  After doing so, we would then go ahead and
lex the token.

However we would fail in the case where the '##' was followed by a '#'
followed by an identifier because we would have lexed the '#' separately
from the identifier, bypassing our parameter validation logic.

Instead, lex the tokens coming after the '##' later.

This fixes PR17804.

llvm-svn: 194059
2013-11-05 09:30:17 +00:00
Chris Lattner 848fa212e8 revert r133003 and fix the bug properly: the issue was that ## in a token
lexer is not a paste operator, it is a normal token.  This fixes a conformance
issue shown here:
http://p99.gforge.inria.fr/c99-conformance/c99-conformance-clang-2.9.html

and it defines away the crash from before.

llvm-svn: 133005
2011-06-14 18:19:37 +00:00
Chris Lattner 07efdfdafa Fix a crash on the testcase in PR9981 / rdar://9486765.
llvm-svn: 133003
2011-06-14 18:12:03 +00:00
Daniel Dunbar 8fbe78f6fc Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'.
- This is designed to make it obvious that %clang_cc1 is a "test variable"
   which is substituted. It is '%clang_cc1' instead of '%clang -cc1' because it
   can be useful to redefine what gets run as 'clang -cc1' (for example, to set
   a default target).

llvm-svn: 91446
2009-12-15 20:14:24 +00:00
Chris Lattner 378d72cc40 update test for r72519
llvm-svn: 72520
2009-05-28 05:41:32 +00:00
Eli Friedman 54eb224c3b Make the bad paste diagnostic print the entire pasted token.
llvm-svn: 72497
2009-05-27 22:00:37 +00:00
Chris Lattner 1c1a00cf51 move token paste poisoning diagnostics to after the instantiation loc
for a token is set, this makes the diagnostic "expanded from stack" work
for this diagnostic.  Add a testcase for PR3918.

llvm-svn: 69544
2009-04-19 20:29:42 +00:00
Chris Lattner 0e71dbf9f0 merge pragma poison tests into one file with -verify mode.
llvm-svn: 69538
2009-04-19 20:15:59 +00:00
Chris Lattner ab9d51cfc4 merge two tests
llvm-svn: 69537
2009-04-19 20:10:12 +00:00
Chris Lattner 1377dc4c79 convert to -verify mode.
llvm-svn: 69532
2009-04-19 18:54:13 +00:00
Daniel Dunbar a45cf5b6b0 Rename clang to clang-cc.
Tests and drivers updated, still need to shuffle dirs.

llvm-svn: 67602
2009-03-24 02:24:46 +00:00
Chris Lattner 01ecf835c2 Implement basic token pasting (## operator). This implements
test/Preprocessor/macro_paste_simple.c and macro_paste_bad.c.  There are
several known bugs still.

llvm-svn: 38733
2006-07-19 05:42:48 +00:00