[PATCH] D33381: Avoid constructing GlobalExtensions only to find out it is empty.

Mehdi AMINI via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 19 08:56:28 PDT 2017


mehdi_amini accepted this revision.
mehdi_amini added a comment.
This revision is now accepted and ready to land.

LGTM with an inline comment



================
Comment at: lib/Transforms/IPO/PassManagerBuilder.cpp:172
+/// Avoid constructing the GlobalExtensions only to find out if it is empty
+static bool GlobalExtensionsNotEmpty() {
+  return GlobalExtensions.isConstructed() && !GlobalExtensions->empty();
----------------
It took me some time to understand the comment here, because the function looks like a simple predicate.

I'd write something like:

``` 
/// Check if GlobalExtensions is constructed and not empty. 
/// Since GlobalExtensions is a managed static, just calling `empty()`
/// would trigger the construction of the object.
```




https://reviews.llvm.org/D33381





More information about the llvm-commits mailing list