| commit | e74afe6284404838186a3e56efaeeb4aef874117 | [log] [tgz] |
|---|---|---|
| author | David Stone <davidfromonline@gmail.com> | Wed Dec 24 13:25:00 2025 -0700 |
| committer | Copybara-Service <copybara-worker@google.com> | Wed Dec 24 12:32:06 2025 -0800 |
| tree | 28d2b472cb044fcb20ff7a84ca01557380033bd1 | |
| parent | e703714b7f837b8af806c2fc6cfe51392c9c0452 [diff] |
[clang][NFC] Use constructor instead of factory function in `CFGStmtMap` (#172530) `CFGStmtMap::Build` accepts pointers and returns a pointer to dynamically allocated memory. In the one location where the type is actually constructed, the pointers are guaranteed to be non-null. By accepting references to statically enforce this, we can remove the only way for the construction to fail. By making this change, we also allow our user to decide how they want to own the memory (either directly or indirectly). The user does not actually need dynamic allocation here, so we replace the `std::unique_ptr` with `std::optional`. This simplifies the code by requiring fewer checks, makes comments on what happens redundant because the code can obviously do only one thing, avoids potential bugs, and improves performance by allocating less. GitOrigin-RevId: 1eea63811aa00ed2cc402c783ca67e1ac2a74121
Welcome to Clang.
This is a compiler front-end for the C family of languages (C, C++ and Objective-C) which is built as part of the LLVM compiler infrastructure project.
Unlike many other compiler frontends, Clang is useful for a number of things beyond just compiling code: we intend for Clang to be host to a number of different source-level tools. One example of this is the Clang Static Analyzer.
If you're interested in more (including how to build Clang) it is best to read the relevant websites. Here are some pointers:
Information on Clang: http://clang.llvm.org/
Building and using Clang: http://clang.llvm.org/get_started.html
Clang Static Analyzer: http://clang-analyzer.llvm.org/
Information on the LLVM project: http://llvm.org/
If you have questions or comments about Clang, a great place to discuss them is on the Clang forums:
If you find a bug in Clang, please file it in the LLVM bug tracker: