================
@@ -7061,8 +7061,15 @@ NamedDecl *Sema::FindInstantiatedDecl(SourceLocation 
Loc, NamedDecl *D,
     // anonymous unions in class templates).
   }
 
-  if (!ParentDependsOnArgs)
+  if (!ParentDependsOnArgs) {
+    if (auto Found =
+            CurrentInstantiationScope
+                ? CurrentInstantiationScope->getInstantiationOfIfExists(D)
+                : nullptr) {
----------------
ojhunt wrote:

We really need an equivalent to `.?` in C++ :D

More seriously though, embedding conditional logic inside conditions is 
difficult to read, so we stick to reasonably linear boolean operations.

I pondered this for a bit an I think agree with @Fznamznon's proposal with an 
early return `if (!Found)`.

As for the use of `auto` - as a general rule if the type is not mentioned 
explicitly on the RHS, you should make it explicit in the variable declaration.

i.e

```cpp
FooType *MyFoo /* ugh capitalization style */ = someRandoFunction();
auto *MyBar = dyn_cast<Bar>(expression);
auto *MyOtherThing = expression->getAsMyOtherThing();
```

https://github.com/llvm/llvm-project/pull/165098
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to