Sarcasm / irony-mode

A C/C++ minor mode for Emacs powered by libclang
GNU General Public License v3.0
901 stars 98 forks source link

Irony auto-complete for structure with macro inside #572

Open wanghaiqiangk opened 3 years ago

wanghaiqiangk commented 3 years ago

The definition of struct sigaction is

struct sigaction
  {
    /* Signal handler.  */
#ifdef __USE_POSIX199309
    union
      {
    /* Used if SA_SIGINFO is not set.  */
    __sighandler_t sa_handler;
    /* Used if SA_SIGINFO is set.  */
    void (*sa_sigaction) (int, siginfo_t *, void *);
      }
    __sigaction_handler;
# define sa_handler __sigaction_handler.sa_handler
# define sa_sigaction   __sigaction_handler.sa_sigaction
#else
    __sighandler_t sa_handler;
#endif

    /* Additional set of signals to be blocked.  */
    __sigset_t sa_mask;

    /* Special flags.  */
    int sa_flags;

    /* Restore handler.  */
    void (*sa_restorer) (void);
  };

Without special requirement or using obsolescent compiler, the compiler usually chooses the #else so that sa_handler is one of members.

But irony doesn't show any candidates for sa_handler, my irony gives image

There are duplicated items for the same candidate. That's because I'm using both irony and rtags. Both of them don't show sa_handler. But since they use clang as backend. I suspect it is a problem of clang, isn't it? There is another possible reason that I can come up with, that is there may be an option about compiler definition which should be given to irony but omitted.

Can anyone help? Thank ahead.