[PATCH] D43647: Generate most of the target properties from a central specification.

Jim Ingham via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 22 16:47:07 PST 2018


jingham added a comment.

The question I'm asking is if I didn't know the name of the function, but I had found the found the string name of the property in the defs file, how would I figure out the name of the setter and getter?  But I see that you use Get##ID so it's always going to be {Get,Set} of the first element in the HANDLE_PROPERTY.  If everybody uses the rule out of Properties.h, then that will always be the case, so if we document it somewhere so people don't have to read all this goo, then I'm fine with that.

Any class can provide properties, including plugins.  Since plugins may come and go (and in some future could be added dynamically) those properties don't really belong in some central repository.  You are always accessing them from the containing class as well, so it makes sense to keep the actual defs file close to the class that uses them.  All the properties end up being settings, and the "settings list" output reflects the containing class, so it's really easy to go from a property name in "settings" to the place where you can find it.

The one thing I worry about is people coming new to the code will see the setting target.default-arch and want to figure out how to get or set it in code.  That's a bit daunting from the defs file.  But I think that's just a matter of some appropriate documentation, not a serious objection.


Repository:
  rL LLVM

https://reviews.llvm.org/D43647





More information about the llvm-commits mailing list