Skip to content
Snippets Groups Projects
Select Git revision
  • main default
  • fix-outdated-documentation
2 results

documentation

  • Clone with SSH
  • Clone with HTTPS
  • user avatar
    Pete Lawrence authored
    As I worked through changes to another PR
    (https://github.com/llvm/llvm-project/pull/74912), I couldn't help but
    rewrite a few methods for readability, maintainability, and possibly
    some behavior correctness too.
    
    1. Exiting early instead of nested `if`-statements, which:
    	- Reduces indentation levels for all subsequent lines
    	- Treats missing pre-conditions similar to an error
    - Clearly indicates that the full length of the method is the "happy
    path".
    2. Explicitly return empty Value Object shared pointers for those error
    (like) situations, which
    - Reduces the time it takes a maintainer to figure out what the method
    actually returns based on those conditions.
    
    3. Converting a mix of `if` and `if`-`else`-statements around an enum
    into one `switch` statement, which:
    	- Consolidates the former branching logic
    	- Lets the compiler warn you of a (future) missing enum case
    - This one may actually change behavior slightly, because what was an
    early test for one enum case, now happens later on in the `switch`.
    
    4. Consolidating near-identical, "copy-pasta" logic into one place,
    which:
    	- Separates the common code to the diverging paths.
    	- Highlights the differences between the code paths.
    
    
    
    rdar://119833526
    d6575198
    History
    Name Last commit Last update