[PATCH] D22770: [Sema, NFC] Reset HasFallthroughStmt when clearing FunctionScopeInfo

Erik Pilkington via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 25 11:24:19 PDT 2016


erik.pilkington created this revision.
erik.pilkington added a reviewer: rsmith.
erik.pilkington added a subscriber: cfe-commits.

The FunctionScopeInfo stack in Sema uses an optimization where the memory for the top-level functions is reused. The function FunctionScopeInfo::Clear() is used to reset this memory to the original, marking all the flags as false. The flag HasFallthroughStmt was omitted from this, meaning that once it set, it remained so for the rest of the TU. This meant we ran DiagnoseSwitchLabelsFallthrough() for every top level function in a TU where one function used `[[fallthrough]]`.

Thanks!

https://reviews.llvm.org/D22770

Files:
  lib/Sema/ScopeInfo.cpp

Index: lib/Sema/ScopeInfo.cpp
===================================================================
--- lib/Sema/ScopeInfo.cpp
+++ lib/Sema/ScopeInfo.cpp
@@ -29,6 +29,7 @@
   HasIndirectGoto = false;
   HasDroppedStmt = false;
   HasOMPDeclareReductionCombiner = false;
+  HasFallthroughStmt = false;
   ObjCShouldCallSuper = false;
   ObjCIsDesignatedInit = false;
   ObjCWarnForNoDesignatedInitChain = false;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D22770.65380.patch
Type: text/x-patch
Size: 409 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160725/b390797a/attachment.bin>


More information about the cfe-commits mailing list