<p dir="ltr"><br>
On Feb 4, 2015 8:41 PM, "Duncan P. N. Exon Smith" <<a href="mailto:dexonsmith@apple.com">dexonsmith@apple.com</a>> wrote:<br>
><br>
><br>
> > On 2015 Feb 4, at 16:54, Sean Silva <<a href="mailto:chisophugis@gmail.com">chisophugis@gmail.com</a>> wrote:<br>
> ><br>
> ><br>
> ><br>
> > On Wed, Feb 4, 2015 at 4:53 PM, Sean Silva <<a href="mailto:chisophugis@gmail.com">chisophugis@gmail.com</a>> wrote:<br>
> > 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").<br>
> ><br>
> > (in case it wasn't clear, I mean the the "Foo.def #undef's all of its macros" comment to be in the #include'er, not the .def file itself).<br>
> ><br>
><br>
> IMO, adding a comment almost defeats the purpose.  It would be better<br>
> to incrementally update the cases that don't #undef their macros so<br>
> the pattern was more recognizable.</p>
<p dir="ltr">I tend to agree</p>
<p dir="ltr">> > -- Sean Silva<br>
> ><br>
> ><br>
> > -- Sean Silva<br>
> ><br>
> > On Wed, Feb 4, 2015 at 2:07 PM, David Blaikie <<a href="mailto:dblaikie@gmail.com">dblaikie@gmail.com</a>> wrote:<br>
> ><br>
> ><br>
> > On Wed, Feb 4, 2015 at 2:06 PM, Duncan P. N. Exon Smith <<a href="mailto:dexonsmith@apple.com">dexonsmith@apple.com</a>> wrote:<br>
> ><br>
> > > On 2015-Feb-04, at 14:02, David Blaikie <<a href="mailto:dblaikie@gmail.com">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">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">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">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>
> > 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>
> ><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>
> ><br>
> ><br>
> ><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">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
> ><br>
> ><br>
> ><br>
><br>
</p>