<div dir="ltr">I've definitely seen that pattern around. Not sure if we follow it consistently though. One downside is that (like the present case), it trigger's people's macro hygiene response when they don't see it (maybe could be ameliorated with a comment like "Foo.def #undef's all of its macros").<div><br></div><div>-- Sean Silva<br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Feb 4, 2015 at 2:07 PM, David Blaikie <span dir="ltr"><<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Wed, Feb 4, 2015 at 2:06 PM, Duncan P. N. Exon Smith <span dir="ltr"><<a href="mailto:dexonsmith@apple.com" target="_blank">dexonsmith@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span><br>
> On 2015-Feb-04, at 14:02, David Blaikie <<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>> wrote:<br>
><br>
><br>
><br>
> On Wed, Feb 4, 2015 at 1:46 PM, Duncan P. N. Exon Smith <<a href="mailto:dexonsmith@apple.com" target="_blank">dexonsmith@apple.com</a>> wrote:<br>
> Author: dexonsmith<br>
> Date: Wed Feb  4 15:46:12 2015<br>
> New Revision: 228200<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=228200&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=228200&view=rev</a><br>
> Log:<br>
> IR: Define MDNode uniquing sets automatically, NFC<br>
><br>
> Modified:<br>
>     llvm/trunk/lib/IR/LLVMContextImpl.h<br>
><br>
> Modified: llvm/trunk/lib/IR/LLVMContextImpl.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/LLVMContextImpl.h?rev=228200&r1=228199&r2=228200&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/LLVMContextImpl.h?rev=228200&r1=228199&r2=228200&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/IR/LLVMContextImpl.h (original)<br>
> +++ llvm/trunk/lib/IR/LLVMContextImpl.h Wed Feb  4 15:46:12 2015<br>
> @@ -357,9 +357,8 @@ public:<br>
>    DenseMap<Value *, ValueAsMetadata *> ValuesAsMetadata;<br>
>    DenseMap<Metadata *, MetadataAsValue *> MetadataAsValues;<br>
><br>
> -  DenseSet<MDTuple *, MDTupleInfo> MDTuples;<br>
> -  DenseSet<MDLocation *, MDLocationInfo> MDLocations;<br>
> -  DenseSet<GenericDebugNode *, GenericDebugNodeInfo> GenericDebugNodes;<br>
> +#define HANDLE_MDNODE_LEAF(CLASS) DenseSet<CLASS *, CLASS##Info> CLASS##s;<br>
><br>
> I /think/ (but could well be wrong) that the usual style for def file inclusions is to undef the relevant macro immediately after the inclusion, so it doesn't leak into other things, etc.<br>
><br>
> +#include "llvm/IR/Metadata.def"<br>
<br>
</span>Metadata.def ends with:<br>
<br>
#undef HANDLE_METADATA<br>
#undef HANDLE_METADATA_LEAF<br>
#undef HANDLE_METADATA_BRANCH<br>
#undef HANDLE_MDNODE_LEAF<br>
#undef HANDLE_MDNODE_BRANCH<br></blockquote></div></div><div><br>Ah, dandy. (maybe that's the common idiom - if not, might be nice to update existing .def files to be so smart - I'll keep it in mind next time I come across a #include .def)<br> </div></div><br></div></div>
<br>_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
<br></blockquote></div><br></div></div></div>