]> granicus.if.org Git - clang/commit
Improved error recovery for _Pragma
authorHubert Tong <hubert.reinterpretcast@gmail.com>
Thu, 30 Jul 2015 21:30:00 +0000 (21:30 +0000)
committerHubert Tong <hubert.reinterpretcast@gmail.com>
Thu, 30 Jul 2015 21:30:00 +0000 (21:30 +0000)
commitb63b4d08e9fb203e82f6e67654f8fff2d7b91e25
tree5b5e5560d890c9e5f96f21c160bdb8dd00d7f999
parent720bfb489186a9efe1b14e43324530cc489bbac7
Improved error recovery for _Pragma

Summary:
Currently, if the argument to _Pragma is not a parenthesised string
literal, the bad token will be consumed, as well as the ')', if present.
If additional bad tokens are passed to the _Pragma, this results in
extra error messages which may distract from the true problem.

The proposed patch causes all tokens to be consumed until the closing
')' or a new line, whichever is reached first.

Reviewers: hfinkel, rsmith

Subscribers: hubert.reinterpretcast, fraggamuffin, rnk, cfe-commits

Differential Revision: http://reviews.llvm.org/D8308

Patch by Rachel Craik!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@243692 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Lex/Pragma.cpp
test/Preprocessor/_Pragma.c