[PATCH] D47615: [DebugInfo] Adding DISubprogram::setFlags identical to DIType::setFlags

Roman Tereshin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 1 10:30:47 PDT 2018


rtereshin added a comment.

In https://reviews.llvm.org/D47615#1119208, @aprantl wrote:

> I didn't realize the DIBuilder was using the same workflow in `createTypeWithFlags()`. What do you think about making this method private and only having DIBuilder call it in a controlled setting (and add a DIBuilder createSubprogramWithFlags() method)?


That would require making DIBuilder a friend to DIType and DISubprogram. And looks like none of the DI* classes have DIBuilder as a friend at the moment, not sure I want to start the tradition.

Alternatively, we could:

1. toughen the assertion to `isTemporary` instead of just `!isUniqued` and mirror the methods for DISubprogram, or
2. remove setFlags methods entirely and replace them with cloneWithFlags on DIType / DISubprogram directly, having DIBuilder just call it and replaceWithDistinct later, or
3. same as 2, but have cloneWithFlags returning already distinct node and remove createTypeWithFlags from DIBuilder (which is private anyway by the virtue of being a static function) and add DIBuilder::createArtificialSubprogram (similar to DIBuilder::createArtificialType)


Repository:
  rL LLVM

https://reviews.llvm.org/D47615





More information about the llvm-commits mailing list