1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-25 14:02:52 +02:00
llvm-mirror/tools
Greg Clayton 9a690524e7 Add the ability to get attribute values as Optional<T>
When getting attributes it is sometimes nicer to use Optional<T> some of the time instead of magic values. I tried to cut over to only using the Optional values but it made many of the call sites very messy, so it makes sense the leave in the calls that can return a default value. Otherwise code that looks like this:

uint64_t CallColumn = Die.getAttributeValueAsAddress(DW_AT_call_line, 0);

Has to be turned into:

uint64_t CallColumn = 0;
if (auto CallColumnValue = Die.getAttributeValueAsAddress(DW_AT_call_line))
    CallColumn = *CallColumnValue;

The first snippet of code looks much better. But in cases where you want an offset that may or may not be there, the following code looks better:

if (auto StmtOffset = Die.getAttributeValueAsSectionOffset(DW_AT_stmt_list)) {
  // Use StmtOffset
}

Differential Revision: https://reviews.llvm.org/D27772

llvm-svn: 289731
2016-12-14 22:38:08 +00:00
..
bugpoint Fix spelling mistakes in Tools/Tests comments. NFC. 2016-11-20 13:31:13 +00:00
bugpoint-passes [CMake] bugpoint-passes depends on intrinsics_gen 2016-11-19 02:20:59 +00:00
dsymutil Add the ability to get attribute values as Optional<T> 2016-12-14 22:38:08 +00:00
gold Apply clang-tidy's 'performance-faster-string-find' check to LLVM. 2016-11-30 10:01:11 +00:00
llc [llc] Fix -stop-after=consthoist initializing the pass. 2016-12-06 23:49:58 +00:00
lli Prune unused libdeps. 2016-12-08 15:28:02 +00:00
llvm-ar Always use / as the path separator. 2016-12-04 07:27:02 +00:00
llvm-as [CMake] llvm-as depends on intrinsics_gen 2016-11-19 02:15:04 +00:00
llvm-as-fuzzer
llvm-bcanalyzer Bitcode: Correctly handle Fixed and VBR arrays in BitstreamCursor::skipRecord(). 2016-12-01 05:47:58 +00:00
llvm-c-test Fix "isn't a prototype" warning 2016-11-16 21:51:39 +00:00
llvm-cat llvm-cat: Allow bitcode files to be created with no modules. 2016-12-13 23:14:55 +00:00
llvm-config [llvm-config] Fixing one check where shared libs implied dylib 2016-12-13 23:08:52 +00:00
llvm-cov Apply clang-tidy's 'performance-faster-string-find' check to LLVM. 2016-11-30 10:01:11 +00:00
llvm-cxxdump Make the Error class constructor protected 2016-11-11 04:28:40 +00:00
llvm-cxxfilt llvm-cxxfilt: support reading from stdin 2016-11-13 20:43:38 +00:00
llvm-diff [CMake] llvm-diff depends on intrinsics_gen 2016-11-19 02:28:18 +00:00
llvm-dis [CMake] llvm-dis depends on intrinsics_gen 2016-11-19 02:31:14 +00:00
llvm-dwarfdump dwarfdump: -summarize-types: print a short summary (unqualified type name, hash, length) of type units rather than dumping contents 2016-10-18 21:09:48 +00:00
llvm-dwp [CMake] llvm-dwp depends on intrinsics_gen 2016-11-19 02:33:42 +00:00
llvm-extract [CMake] llvm-extract depends on intrinsics_gen 2016-11-19 02:33:57 +00:00
llvm-go
llvm-jitlistener
llvm-link [CMake] llvm-link depends on intrinsics_gen 2016-11-19 02:36:28 +00:00
llvm-lto [ThinLTO] Add an API to trigger file-based API for returning objects to the linker 2016-12-14 04:56:42 +00:00
llvm-lto2 LTO: Hash the parts of the LTO configuration that affect code generation. 2016-12-08 05:28:30 +00:00
llvm-mc [llvm] Fix D26214: Move error handling out of MC and to the callers. 2016-12-06 02:49:17 +00:00
llvm-mc-fuzzer Turn cl::values() (for enum) from a vararg function to using C++ variadic template 2016-10-08 19:41:06 +00:00
llvm-mcmarkup
llvm-modextract llvm-modextract: Call keep() on the output stream before exiting. 2016-12-01 23:13:11 +00:00
llvm-nm Object: Set SF_Indirect in ModuleSymbolTable. 2016-12-01 07:00:35 +00:00
llvm-objdump [bpf] change llvm-objdump to print dec instead of hex 2016-12-13 19:07:08 +00:00
llvm-opt-report [llvm-opt-report] Fix unroll-count reporting 2016-10-24 05:07:18 +00:00
llvm-pdbdump revert inadvertedly introduced build break 2016-12-06 00:55:55 +00:00
llvm-profdata [CMake] llvm-profdata depends on intrinsics_gen 2016-11-18 23:04:15 +00:00
llvm-readobj AMDGPU: Emit runtime metadata version 2 as YAML 2016-12-14 17:16:52 +00:00
llvm-rtdyld Apply clang-tidy's 'performance-faster-string-find' check to LLVM. 2016-11-30 10:01:11 +00:00
llvm-shlib Fix llvm-shlib cmake build 2016-11-01 20:19:33 +00:00
llvm-size Fix a bug with llvm-size and the -m option with multiple files not printing the file names. 2016-12-01 19:12:55 +00:00
llvm-split [CMake] llvm-split depends on intrinsics_gen 2016-11-18 23:20:38 +00:00
llvm-stress [CMake] llvm-stress depends on intrinsics_gen 2016-11-19 02:25:54 +00:00
llvm-strings llvm-strings: support the -n option 2016-11-15 00:43:52 +00:00
llvm-symbolizer Turn cl::values() (for enum) from a vararg function to using C++ variadic template 2016-10-08 19:41:06 +00:00
llvm-xray Make the Error class constructor protected 2016-11-11 04:28:40 +00:00
lto [ThinLTO] Add an API to trigger file-based API for returning objects to the linker 2016-12-14 04:56:42 +00:00
msbuild
obj2yaml [ObjectYAML] Support for DWARF debug_aranges 2016-12-09 00:26:44 +00:00
opt Change setDiagnosticsOutputFile to take a unique_ptr from a raw pointer (NFC) 2016-11-19 18:19:41 +00:00
sancov Make the Error class constructor protected 2016-11-11 04:28:40 +00:00
sanstats [CMake] sanstats depends on intrinsics_gen 2016-11-18 23:30:39 +00:00
verify-uselistorder [CMake] verify-uselistorder depends on intrinsics_gen 2016-11-18 23:30:58 +00:00
xcode-toolchain
yaml2obj clang-format to fix post-commit feedback 2016-12-12 23:05:15 +00:00
CMakeLists.txt
LLVMBuild.txt Add llvm-modextract tool. 2016-11-29 21:54:33 +00:00