I'm working on an external Clang tool that translates one c-based
language construct to another. I have a series of recursive AST
functions that walk and modify elements as necessary. I have an issue
with anonymous structures that reside within structs or unions.
Specifically, I have:
typedef struct test_case_t {
struct {int value;} first[1];
int second;
int third[1];
} test_case_t;
That gets translated to:
struct test_case_t {
struct { // should be struct first
int value;
};
struct first first[1];
int second;
int third[1];
};
typedef struct test_case_t test_case_t;
Note that the nested struct should be "struct first{ ... }".
My question is, using the FieldDecl for "first[1]", how do I derive
the defining struct type and modify the definition to be "struct
first{ ... }"? I'm able to construct a QualType that is "struct
test_case_t::first", but I'm not sure how to modify the existing
struct definition.
Any thoughts?
_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev