[PATCH] D158616: To allow RAV to visit initializer when bitfield and initializer both given

Nouman Amir via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 23 07:16:55 PDT 2023


NoumanAmir657 created this revision.
NoumanAmir657 added reviewers: nicholas, Eugene.Zelenko.
Herald added a project: All.
NoumanAmir657 requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

The RAV does not visit the initializer when the bitfield is given because it uses if-else statement. Code was changed to two seperate ifs so that it can visit both of them if both are present.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D158616

Files:
  clang/include/clang/AST/RecursiveASTVisitor.h


Index: clang/include/clang/AST/RecursiveASTVisitor.h
===================================================================
--- clang/include/clang/AST/RecursiveASTVisitor.h
+++ clang/include/clang/AST/RecursiveASTVisitor.h
@@ -2124,7 +2124,7 @@
   TRY_TO(TraverseDeclaratorHelper(D));
   if (D->isBitField())
     TRY_TO(TraverseStmt(D->getBitWidth()));
-  else if (D->hasInClassInitializer())
+  if (D->hasInClassInitializer())
     TRY_TO(TraverseStmt(D->getInClassInitializer()));
 })
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D158616.552698.patch
Type: text/x-patch
Size: 488 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230823/d3a9da82/attachment.bin>


More information about the cfe-commits mailing list