Anastasia added inline comments.

Comment at: lib/Serialization/ASTWriter.cpp:4283
+  // Sort to allow reproducible .pch files -
+  std::map<TypeID, std::set<std::string>> sortedOpenCLTypeExtMap;
   for (const auto &I : SemaRef.OpenCLTypeExtMap) {
riccibruno wrote:
> lebedev.ri wrote:
> > Anastasia wrote:
> > > lebedev.ri wrote:
> > > > Would it be better to just change the actual type of 
> > > > `SemaRef.OpenCLTypeExtMap`?
> > > >
> > > What data structure would you suggest to use instead? I think sorting 
> > > during serialization or de-serialization of AST isn't too bad because 
> > > it's not a common use case.
> > Just `std::map<>`?
> Why is this a problem ? I thought that pch files where not supposed to be 
> distributed. If we come to the conclusion that pch files must be 
> reproducible, then I believe that this is by far not the only example.
Ok, I would normally prefer to use `DenseMap` for the general case because 
since the number of elements in `OpenCLTypeExtMap` is very small we can take 
advantage of non-heap allocation. But at the same time probably a couple of 
elements won't make any difference for `std::map` either and we can keep the 
code base more maintainable. So I don't mind either way.

  rC Clang


cfe-commits mailing list

Reply via email to