Skip to content

Commit

Permalink
Consolidate and improve the handling of built-in feature-like macros
Browse files Browse the repository at this point in the history
Summary:
The parsing logic has been separated out from the macro implementation logic, leading to a number of improvements:

* Gracefully handle unexpected/invalid tokens, too few, too many and nested parameters
* Provide consistent behaviour between all built-in feature-like macros
* Simplify the implementation of macro logic
* Fix __is_identifier to correctly return '0' for non-identifiers

Reviewers: doug.gregor, rsmith

Subscribers: rsmith, cfe-commits

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

llvm-svn: 265381
  • Loading branch information
andyg1001 committed Apr 5, 2016
1 parent 535afd8 commit 50b6cef
Show file tree
Hide file tree
Showing 6 changed files with 258 additions and 169 deletions.
1 change: 1 addition & 0 deletions clang/include/clang/Basic/DiagnosticLexKinds.td
Expand Up @@ -401,6 +401,7 @@ def err_pp_expected_rparen : Error<"expected ')' in preprocessor expression">;
def err_pp_expected_eol : Error<
"expected end of line in preprocessor expression">;
def err_pp_expected_after : Error<"missing %1 after %0">;
def err_pp_nested_paren : Error<"nested parentheses not permitted in %0">;
def err_pp_colon_without_question : Error<"':' without preceding '?'">;
def err_pp_division_by_zero : Error<
"division by zero in preprocessor expression">;
Expand Down

0 comments on commit 50b6cef

Please sign in to comment.