[PATCH] D12010: Logically Dead Code

Chakshu Grover via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 13 09:11:16 PDT 2015


chakshugrover created this revision.
chakshugrover added a subscriber: llvm-commits.

Removed Logically Dead Code

```
13698	  if (!II) {
13699	    Diag(DeclStart, diag::err_anonymous_property);
13700	    return nullptr;
13701	  }
```
As we have already handled the case for II being NULL. So now further we take the value of II to be non-NULL making this condition here essentially true

```
13770	  } else if (II) {
13771	    PushOnScopeChains(NewPD, S);
13772	  } else
```
and making this code logically dead

```
13772	  } else
13773	    Record->addDecl(NewPD);
```

http://reviews.llvm.org/D12010

Files:
  lib/Sema/SemaDeclCXX.cpp

Index: lib/Sema/SemaDeclCXX.cpp
===================================================================
--- lib/Sema/SemaDeclCXX.cpp
+++ lib/Sema/SemaDeclCXX.cpp
@@ -13767,10 +13767,8 @@
   if (NewPD->isInvalidDecl() && PrevDecl) {
     // Don't introduce NewFD into scope; there's already something
     // with the same name in the same scope.
-  } else if (II) {
+  } else 
     PushOnScopeChains(NewPD, S);
-  } else
-    Record->addDecl(NewPD);
-
+  
   return NewPD;
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D12010.32067.patch
Type: text/x-patch
Size: 472 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150813/fb841e0b/attachment.bin>


More information about the llvm-commits mailing list