[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 08:48:28 PDT 2018


rtereshin added a comment.

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

> We generally try to discourage modifying MDNodes after creation since this is an inherently dangerous thing to do since you never know who might be holding on to a pointer to an MDNode. Do you have really good reason to alter the flags on an existing node, or could you also just set the flags correctly at creation time? Even if the answer is yes I wonder if it wouldn't be better to clone a new distinct node with the modified flag.


I'm cloning an existing node to a temporary node, modifying the flags, and converting it to a distinct node.

Do you want me to put all of it in a single method instead of providing a method for modifying the flags?
If so, do we need to change DIType the same way? Currently it has public setFlags method, which is apparently only used by DIBuilder's methods that clone - set flags - convert to a distinct node.


Repository:
  rL LLVM

https://reviews.llvm.org/D47615





More information about the llvm-commits mailing list