[all-commits] [llvm/llvm-project] 2edb89: Lex arguments for __has_cpp_attribute and friends ...

Aaron Ballman via All-commits all-commits at lists.llvm.org
Sun Oct 17 04:58:09 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2edb89c746848c52964537268bf03e7906bf2542
      https://github.com/llvm/llvm-project/commit/2edb89c746848c52964537268bf03e7906bf2542
  Author: Aaron Ballman <aaron at aaronballman.com>
  Date:   2021-10-17 (Sun, 17 Oct 2021)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/lib/Lex/PPMacroExpansion.cpp
    M clang/test/Preprocessor/has_attribute.c
    M clang/test/Preprocessor/has_attribute.cpp
    A clang/test/Preprocessor/has_attribute_errors.cpp
    M clang/test/Preprocessor/has_c_attribute.c

  Log Message:
  -----------
  Lex arguments for __has_cpp_attribute and friends as expanded tokens

The C and C++ standards require the argument to __has_cpp_attribute and
__has_c_attribute to be expanded ([cpp.cond]p5). It would make little sense
to expand the argument to those operators but not expand the argument to
__has_attribute and __has_declspec, so those were both also changed in this
patch.

Note that it might make sense for the other builtins to also expand their
argument, but it wasn't as clear to me whether the behavior would be correct
there, and so they were left for a future revision.




More information about the All-commits mailing list