[PATCH] D38303: [Sema] Correct IUnknown to support Unknwnbase.h Header.

Reid Kleckner via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 27 11:30:55 PDT 2017


rnk added inline comments.


================
Comment at: lib/AST/DeclCXX.cpp:1497-1505
+  bool IsInNamespace = false;
+  const auto *DeclContext = getDeclContext();
+  while (!DeclContext->isTranslationUnit()) {
+    if (DeclContext->isNamespace()) {
+      IsInNamespace = true;
+      break;
+    }
----------------
This would be nicer factored out as a static helper because it would let you early return and avoid the variable and break. You could just fold the call into the condition in the `if` below.


https://reviews.llvm.org/D38303





More information about the cfe-commits mailing list