[PATCH] D142560: Allow getRawCommentForDecl to find comments in macros

Dana Jansens via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 26 11:23:43 PST 2023


danakj added a comment.

Here's the relevant part of the test:

  #define DECLARE_ENUMS(name) \
    /** enumFromMacro IS_DOXYGEN_SINGLE */ \
    enum enumFromMacro { A }; \
    /** namedEnumFromMacro IS_DOXYGEN_SINGLE */ \
    enum name { B };
  
  /// IS_DOXYGEN_NOT_ATTACHED
  DECLARE_ENUMS(namedEnumFromMacro)

>From the error I see:

- The Decl is `enum namedEnumFromMacro`, which has a source location at 74:1, and has a spelling location at 74:15.

  DECLARE_ENUMS(namedEnumFromMacro)
  ^ source      ^ spelling

- We then call Decl::getBeginLoc(), which doesn't move the source location itself, but does move spelling location.

  #define DECLARE_ENUMS(name) \
    /** enumFromMacro IS_DOXYGEN_SINGLE */ \
    enum enumFromMacro { A }; \
    /** namedEnumFromMacro IS_DOXYGEN_SINGLE */ \
    enum name { B };
    ^ spelling
  
  /// IS_DOXYGEN_NOT_ATTACHED
  DECLARE_ENUMS(namedEnumFromMacro)
  ^ source

It seems that Decl::getBeginLoc() does not have the correct spelling location in this test, on AIX. It is staying at the original source location at the macro expansion.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D142560/new/

https://reviews.llvm.org/D142560



More information about the cfe-commits mailing list