Add getter macros for attributes (#1931)
testcase