Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
  • This project
    • Loading...
  • Sign in / Register
S
swiftshader
  • Project
    • Overview
    • Details
    • Activity
    • Cycle Analytics
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Charts
  • Issues 0
    • Issues 0
    • List
    • Board
    • Labels
    • Milestones
  • Merge Requests 0
    • Merge Requests 0
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Charts
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Chen Yisong
  • swiftshader
  • Repository

Switch branch/tag
  • swiftshader
  • src
  • Vulkan
  • VkDescriptorSet.cpp
Find file
BlameHistoryPermalink
  • Nicolas Capens's avatar
    Format switch statements consistently · 112faf44
    Nicolas Capens authored Dec 13, 2019
    Each non-fallthrough case should end with a break (or return). If a
    scope is needed because local variables are defined, it should end
    before this break.
    
    This avoids bugs such as:
    
    switch(i)
    {
    case 0:
        if(c)
        {
            // lots
            // of
            // code
    
            // Easy to misread as always breaking instead of conditionally
            // falling through due to not spotting the if(c).
            break;
        }
    
    case 1:
        // ...
    }
    
    The new scope should also be indented. It makes it easier to spot where
    each case ends and where the switch ends. This is achieved by setting
    IndentCaseBlocks to true.
    
    Lastly, the case labels themselves should not be indented. Like goto
    labels they mark where in the code to jump to, and the code itself is
    already indented within the switch block.
    
    Bug: b/144825072
    Change-Id: I9a130d1d234795f53b5872e411f1315f56a0e908
    Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/39551
    Commit-Queue: Nicolas Capens <nicolascapens@google.com>
    Tested-by: 's avatarNicolas Capens <nicolascapens@google.com>
    Kokoro-Result: kokoro <noreply+kokoro@google.com>
    Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com>
    112faf44
VkDescriptorSet.cpp 2.88 KB
EditWeb IDE
×

Replace VkDescriptorSet.cpp

Attach a file by drag & drop or click to upload


Cancel
A new branch will be created in your fork and a new merge request will be started.