Split mergeAvailabilityAttr out of handleAvailabilityAttr. This is important
for having a uniform logic for adding attributes to a decl. This in turn
is needed to fix the FIXME:

  // FIXME: This needs to happen before we merge declarations. Then,
  // let attribute merging cope with attribute conflicts.
  ProcessDeclAttributes(S, NewFD, D,
                        /*NonInheritable=*/false, /*Inheritable=*/true);

The idea is that mergeAvailabilityAttr will become a method. Once attributes
are processed before merging, it will be called from handleAvailabilityAttr to
handle multiple attributes in one decl:

void f(int) __attribute__((availability(ios,deprecated=3.0),
                           availability(ios,introduced=2.0)));

and from SemaDecl.cpp to handle multiple decls:

void f(int) __attribute__((availability(ios,deprecated=3.0)));
void f(int) __attribute__((availability(ios,introduced=2.0)));

As a bonus, use the new structure to diagnose incompatible availability
attributes added to different decls (see included testcases).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156269 91177308-0d34-0410-b5e6-96231b3b80d8
4 files changed