forked from OSchip/llvm-project
72315d02c4
This is extended to all `std::` functions that take a reference to a value and return a reference (or pointer) to that same value: `move`, `forward`, `move_if_noexcept`, `as_const`, `addressof`, and the libstdc++-specific function `__addressof`. We still require these functions to be declared before they can be used, but don't instantiate their definitions unless their addresses are taken. Instead, code generation, constant evaluation, and static analysis are given direct knowledge of their effect. This change aims to reduce various costs associated with these functions -- per-instantiation memory costs, compile time and memory costs due to creating out-of-line copies and inlining them, code size at -O0, and so on -- so that they are not substantially more expensive than a cast. Most of these improvements are very small, but I measured a 3% decrease in -O0 object file size for a simple C++ source file using the standard library after this change. We now automatically infer the `const` and `nothrow` attributes on these now-builtin functions, in particular meaning that we get a warning for an unused call to one of these functions. In C++20 onwards, we disallow taking the addresses of these functions, per the C++20 "addressable function" rule. In earlier language modes, a compatibility warning is produced but the address can still be taken. The same infrastructure is extended to the existing MSVC builtin `__GetExceptionInfo`, which is now only recognized in namespace `std` like it always should have been. This is a re-commit of |
||
---|---|---|
.. | ||
CommandGuide | ||
DataFlowAnalysisIntroImages | ||
analyzer | ||
tools | ||
APINotes.rst | ||
AddressSanitizer.rst | ||
AutomaticReferenceCounting.rst | ||
Block-ABI-Apple.rst | ||
BlockLanguageSpec.rst | ||
CMakeLists.txt | ||
ClangCheck.rst | ||
ClangCommandLineReference.rst | ||
ClangFormat.rst | ||
ClangFormatStyleOptions.rst | ||
ClangFormattedStatus.rst | ||
ClangLinkerWrapper.rst | ||
ClangNvlinkWrapper.rst | ||
ClangOffloadBundler.rst | ||
ClangOffloadWrapper.rst | ||
ClangPlugins.rst | ||
ClangStaticAnalyzer.rst | ||
ClangTools.rst | ||
ClangTransformerTutorial.rst | ||
ConstantInterpreter.rst | ||
ControlFlowIntegrity.rst | ||
ControlFlowIntegrityDesign.rst | ||
CrossCompilation.rst | ||
DataFlowAnalysisIntro.md | ||
DataFlowSanitizer.rst | ||
DataFlowSanitizerDesign.rst | ||
DriverArchitecture.png | ||
DriverInternals.rst | ||
ExternalClangExamples.rst | ||
FAQ.rst | ||
HLSLSupport.rst | ||
HardwareAssistedAddressSanitizerDesign.rst | ||
HowToSetupToolingForLLVM.rst | ||
InternalsManual.rst | ||
IntroductionToTheClangAST.rst | ||
ItaniumMangleAbiTags.rst | ||
JSONCompilationDatabase.rst | ||
LTOVisibility.rst | ||
LanguageExtensions.rst | ||
LeakSanitizer.rst | ||
LibASTImporter.rst | ||
LibASTMatchers.rst | ||
LibASTMatchersReference.html | ||
LibASTMatchersTutorial.rst | ||
LibFormat.rst | ||
LibTooling.rst | ||
MSVCCompatibility.rst | ||
MatrixTypes.rst | ||
MemorySanitizer.rst | ||
MisExpect.rst | ||
Modules.rst | ||
ObjectiveCLiterals.rst | ||
OffloadingDesign.rst | ||
OpenCLSupport.rst | ||
OpenMPSupport.rst | ||
PCHInternals.rst | ||
PCHLayout.graffle | ||
PCHLayout.png | ||
RAVFrontendAction.rst | ||
README.txt | ||
RefactoringEngine.rst | ||
ReleaseNotes.rst | ||
SYCLSupport.rst | ||
SafeStack.rst | ||
SanitizerCoverage.rst | ||
SanitizerSpecialCaseList.rst | ||
SanitizerStats.rst | ||
ShadowCallStack.rst | ||
SourceBasedCodeCoverage.rst | ||
ThinLTO.rst | ||
ThreadSafetyAnalysis.rst | ||
ThreadSanitizer.rst | ||
Toolchain.rst | ||
Tooling.rst | ||
UndefinedBehaviorSanitizer.rst | ||
UsersManual.rst | ||
conf.py | ||
doxygen-mainpage.dox | ||
doxygen.cfg.in | ||
index.rst | ||
make.bat |
README.txt
See llvm/docs/README.txt