From 7442d6faa2719e4e7d33a7021c406c5a4facd74d Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sun, 16 Apr 2017 16:02:28 +0000 Subject: Vendor import of clang trunk r300422: https://llvm.org/svn/llvm-project/cfe/trunk@300422 --- CMakeLists.txt | 48 +- bindings/python/clang/cindex.py | 1 + cmake/caches/Apple-stage2-ThinLTO.cmake | 6 + cmake/caches/Fuchsia-stage2.cmake | 66 + cmake/caches/Fuchsia.cmake | 50 + cmake/modules/CMakeLists.txt | 14 + cmake/modules/ClangConfig.cmake.in | 6 +- cmake/modules/FindZ3.cmake | 28 + docs/AttributeReference.rst | 3118 +---- docs/ClangCommandLineReference.rst | 2591 ++++ docs/ClangFormatStyleOptions.rst | 812 +- docs/ControlFlowIntegrityDesign.rst | 92 +- docs/DiagnosticsReference.rst | 630 +- docs/ExternalClangExamples.rst | 13 + docs/LTOVisibility.rst | 17 +- docs/LanguageExtensions.rst | 38 +- docs/LibASTMatchersReference.html | 64 +- docs/Modules.rst | 11 + docs/ReleaseNotes.rst | 251 +- docs/SanitizerCoverage.rst | 27 +- docs/SourceBasedCodeCoverage.rst | 3 + docs/UndefinedBehaviorSanitizer.rst | 24 +- docs/UsersManual.rst | 37 +- docs/analyzer/DebugChecks.rst | 8 +- docs/analyzer/conf.py | 6 +- docs/conf.py | 6 +- docs/doxygen.cfg.in | 6 +- docs/index.rst | 1 + docs/tools/dump_format_style.py | 3 +- examples/clang-interpreter/CMakeLists.txt | 1 + include/clang-c/Index.h | 23 +- include/clang/AST/ASTContext.h | 223 +- include/clang/AST/ASTVector.h | 1 + include/clang/AST/BuiltinTypes.def | 3 - include/clang/AST/Decl.h | 44 +- include/clang/AST/DeclBase.h | 14 +- include/clang/AST/DeclCXX.h | 146 +- include/clang/AST/DeclContextInternals.h | 2 +- include/clang/AST/DeclObjC.h | 72 +- include/clang/AST/DeclTemplate.h | 136 +- include/clang/AST/DeclarationName.h | 43 +- include/clang/AST/Expr.h | 176 +- include/clang/AST/ExprCXX.h | 95 +- include/clang/AST/ExternalASTMerger.h | 51 + include/clang/AST/ExternalASTSource.h | 11 +- include/clang/AST/ODRHash.h | 84 + include/clang/AST/OpenMPClause.h | 100 +- include/clang/AST/RecursiveASTVisitor.h | 31 + include/clang/AST/Stmt.h | 25 +- include/clang/AST/StmtCXX.h | 108 +- include/clang/AST/StmtIterator.h | 16 + include/clang/AST/StmtOpenMP.h | 75 +- include/clang/AST/TemplateBase.h | 12 +- include/clang/AST/Type.h | 208 +- include/clang/AST/TypeLoc.h | 47 +- include/clang/AST/TypeNodes.def | 4 +- include/clang/AST/TypeOrdering.h | 2 +- include/clang/ASTMatchers/ASTMatchers.h | 77 +- include/clang/ASTMatchers/Dynamic/VariantValue.h | 8 +- include/clang/Analysis/CallGraph.h | 2 +- include/clang/Analysis/CloneDetection.h | 350 +- include/clang/Basic/AddressSpaces.h | 24 +- include/clang/Basic/Attr.td | 68 +- include/clang/Basic/AttrDocs.td | 193 +- include/clang/Basic/Builtins.def | 13 +- include/clang/Basic/BuiltinsAMDGPU.def | 18 + include/clang/Basic/BuiltinsNVPTX.def | 24 - include/clang/Basic/BuiltinsWebAssembly.def | 6 +- include/clang/Basic/BuiltinsX86.def | 72 +- include/clang/Basic/DeclNodes.td | 1 + include/clang/Basic/Diagnostic.h | 126 +- include/clang/Basic/DiagnosticASTKinds.td | 3 +- include/clang/Basic/DiagnosticCommonKinds.td | 12 +- include/clang/Basic/DiagnosticDriverKinds.td | 14 +- include/clang/Basic/DiagnosticGroups.td | 16 +- include/clang/Basic/DiagnosticIDs.h | 24 + include/clang/Basic/DiagnosticParseKinds.td | 31 +- include/clang/Basic/DiagnosticSemaKinds.td | 247 +- .../clang/Basic/DiagnosticSerializationKinds.td | 56 + include/clang/Basic/IdentifierTable.h | 7 +- include/clang/Basic/LangOptions.def | 9 +- include/clang/Basic/LangOptions.h | 52 +- include/clang/Basic/MemoryBufferCache.h | 80 + include/clang/Basic/Module.h | 14 +- include/clang/Basic/ObjCRuntime.h | 14 + include/clang/Basic/OpenCLImageTypes.def | 2 +- include/clang/Basic/OpenMPKinds.h | 5 + include/clang/Basic/Sanitizers.def | 5 + include/clang/Basic/SourceLocation.h | 3 +- include/clang/Basic/Specifiers.h | 5 +- include/clang/Basic/StmtNodes.td | 3 +- include/clang/Basic/TargetInfo.h | 24 +- include/clang/Basic/TokenKinds.def | 3 + include/clang/Basic/TypeTraits.h | 1 + include/clang/Basic/VirtualFileSystem.h | 2 +- include/clang/Basic/XRayLists.h | 54 + include/clang/Basic/arm_neon.td | 2 +- include/clang/CodeGen/BackendUtil.h | 5 + include/clang/CodeGen/CodeGenABITypes.h | 2 +- include/clang/CodeGen/CodeGenAction.h | 35 +- include/clang/CodeGen/ConstantInitBuilder.h | 561 + include/clang/CodeGen/ConstantInitFuture.h | 111 + include/clang/CodeGen/ModuleBuilder.h | 4 + include/clang/Config/config.h.cmake | 3 + include/clang/Driver/CC1Options.td | 23 + include/clang/Driver/CLCompatOptions.td | 2 +- include/clang/Driver/ClangOptionDocs.td | 36 + include/clang/Driver/Driver.h | 20 +- include/clang/Driver/Job.h | 10 + include/clang/Driver/Options.h | 7 +- include/clang/Driver/Options.td | 453 +- include/clang/Driver/SanitizerArgs.h | 2 +- include/clang/Driver/Tool.h | 2 +- include/clang/Driver/ToolChain.h | 15 +- include/clang/Driver/XRayArgs.h | 38 + include/clang/Format/Format.h | 750 +- include/clang/Frontend/ASTConsumers.h | 2 +- include/clang/Frontend/ASTUnit.h | 4 + include/clang/Frontend/CodeGenOptions.def | 14 +- include/clang/Frontend/CodeGenOptions.h | 30 +- include/clang/Frontend/CompilerInstance.h | 16 +- include/clang/Frontend/FrontendActions.h | 2 + include/clang/Frontend/FrontendOptions.h | 11 +- include/clang/Frontend/LangStandard.h | 6 +- include/clang/Frontend/LangStandards.def | 8 +- include/clang/Frontend/PCHContainerOperations.h | 3 +- include/clang/Index/IndexSymbol.h | 9 +- include/clang/Index/IndexingAction.h | 10 + include/clang/Index/USRGeneration.h | 3 + include/clang/Lex/HeaderSearchOptions.h | 6 +- include/clang/Lex/Preprocessor.h | 22 + include/clang/Parse/Parser.h | 83 +- include/clang/Parse/RAIIObjectsForParser.h | 467 + include/clang/Sema/AttributeList.h | 1 + include/clang/Sema/DeclSpec.h | 63 +- include/clang/Sema/IdentifierResolver.h | 16 +- include/clang/Sema/Initialization.h | 40 +- include/clang/Sema/Lookup.h | 2 +- include/clang/Sema/MultiplexExternalSemaSource.h | 2 + include/clang/Sema/Overload.h | 1 + include/clang/Sema/Ownership.h | 1 + include/clang/Sema/ScopeInfo.h | 81 +- include/clang/Sema/Sema.h | 369 +- include/clang/Sema/Template.h | 34 +- include/clang/Serialization/ASTBitCodes.h | 53 +- .../Serialization/ASTDeserializationListener.h | 4 + include/clang/Serialization/ASTReader.h | 98 +- include/clang/Serialization/ASTWriter.h | 36 +- include/clang/Serialization/Module.h | 114 +- include/clang/Serialization/ModuleManager.h | 34 +- include/clang/StaticAnalyzer/Checkers/Checkers.td | 10 +- include/clang/StaticAnalyzer/Core/Analyses.def | 1 + include/clang/StaticAnalyzer/Core/Checker.h | 6 +- include/clang/StaticAnalyzer/Core/CheckerManager.h | 10 +- .../Core/PathSensitive/BasicValueFactory.h | 10 +- .../StaticAnalyzer/Core/PathSensitive/CallEvent.h | 16 +- .../Core/PathSensitive/ConstraintManager.h | 5 + .../StaticAnalyzer/Core/PathSensitive/ExprEngine.h | 21 +- .../StaticAnalyzer/Core/PathSensitive/MemRegion.h | 283 +- .../Core/PathSensitive/ProgramState.h | 9 +- .../Core/PathSensitive/SValBuilder.h | 5 + .../StaticAnalyzer/Core/PathSensitive/SVals.h | 59 +- .../Core/PathSensitive/SimpleConstraintManager.h | 92 + .../StaticAnalyzer/Core/PathSensitive/Store.h | 31 +- .../StaticAnalyzer/Core/PathSensitive/SubEngine.h | 10 +- .../StaticAnalyzer/Core/PathSensitive/SymExpr.h | 10 +- .../Core/PathSensitive/SymbolManager.h | 64 +- include/clang/Tooling/Refactoring/AtomicChange.h | 135 + lib/AST/ASTContext.cpp | 207 +- lib/AST/ASTDumper.cpp | 48 +- lib/AST/ASTImporter.cpp | 363 +- lib/AST/CMakeLists.txt | 2 + lib/AST/CXXInheritance.cpp | 4 +- lib/AST/Decl.cpp | 54 +- lib/AST/DeclBase.cpp | 1 + lib/AST/DeclCXX.cpp | 84 +- lib/AST/DeclObjC.cpp | 4 +- lib/AST/DeclPrinter.cpp | 25 +- lib/AST/DeclTemplate.cpp | 37 +- lib/AST/DeclarationName.cpp | 105 +- lib/AST/Expr.cpp | 29 +- lib/AST/ExprCXX.cpp | 10 +- lib/AST/ExprClassification.cpp | 4 +- lib/AST/ExprConstant.cpp | 337 +- lib/AST/ExternalASTMerger.cpp | 185 + lib/AST/ExternalASTSource.cpp | 5 + lib/AST/ItaniumMangle.cpp | 38 +- lib/AST/Mangle.cpp | 8 +- lib/AST/MicrosoftMangle.cpp | 57 +- lib/AST/NSAPI.cpp | 1 - lib/AST/ODRHash.cpp | 361 + lib/AST/OpenMPClause.cpp | 12 +- lib/AST/Stmt.cpp | 2 +- lib/AST/StmtCXX.cpp | 27 + lib/AST/StmtOpenMP.cpp | 40 + lib/AST/StmtPrinter.cpp | 7 + lib/AST/StmtProfile.cpp | 237 +- lib/AST/TemplateBase.cpp | 4 - lib/AST/Type.cpp | 140 +- lib/AST/TypeLoc.cpp | 1 - lib/AST/TypePrinter.cpp | 40 +- lib/ASTMatchers/Dynamic/Registry.cpp | 7 + lib/Analysis/BodyFarm.cpp | 4 +- lib/Analysis/CFG.cpp | 2 +- lib/Analysis/CallGraph.cpp | 1 + lib/Analysis/CloneDetection.cpp | 887 +- lib/Analysis/OSLog.cpp | 3 +- lib/Analysis/ReachableCode.cpp | 19 +- lib/Analysis/ThreadSafetyTIL.cpp | 4 +- lib/Basic/CMakeLists.txt | 2 + lib/Basic/Diagnostic.cpp | 171 +- lib/Basic/DiagnosticIDs.cpp | 5 +- lib/Basic/FileManager.cpp | 7 +- lib/Basic/IdentifierTable.cpp | 21 +- lib/Basic/LangOptions.cpp | 2 + lib/Basic/MemoryBufferCache.cpp | 48 + lib/Basic/Module.cpp | 2 +- lib/Basic/OpenMPKinds.cpp | 73 + lib/Basic/SourceManager.cpp | 13 +- lib/Basic/TargetInfo.cpp | 5 +- lib/Basic/Targets.cpp | 861 +- lib/Basic/Version.cpp | 2 +- lib/Basic/VirtualFileSystem.cpp | 24 +- lib/Basic/XRayLists.cpp | 53 + lib/CodeGen/ABIInfo.h | 1 + lib/CodeGen/BackendUtil.cpp | 416 +- lib/CodeGen/CGAtomic.cpp | 2 +- lib/CodeGen/CGBlocks.cpp | 419 +- lib/CodeGen/CGBuiltin.cpp | 261 +- lib/CodeGen/CGCUDABuiltin.cpp | 123 - lib/CodeGen/CGCUDANV.cpp | 2 +- lib/CodeGen/CGCXX.cpp | 2 +- lib/CodeGen/CGCXXABI.h | 27 +- lib/CodeGen/CGCall.cpp | 588 +- lib/CodeGen/CGCall.h | 52 +- lib/CodeGen/CGClass.cpp | 66 +- lib/CodeGen/CGCleanup.cpp | 43 +- lib/CodeGen/CGCoroutine.cpp | 277 +- lib/CodeGen/CGDebugInfo.cpp | 252 +- lib/CodeGen/CGDebugInfo.h | 67 +- lib/CodeGen/CGDecl.cpp | 81 +- lib/CodeGen/CGDeclCXX.cpp | 2 +- lib/CodeGen/CGException.cpp | 17 +- lib/CodeGen/CGExpr.cpp | 273 +- lib/CodeGen/CGExprAgg.cpp | 9 +- lib/CodeGen/CGExprCXX.cpp | 50 +- lib/CodeGen/CGExprComplex.cpp | 16 +- lib/CodeGen/CGExprScalar.cpp | 217 +- lib/CodeGen/CGGPUBuiltin.cpp | 122 + lib/CodeGen/CGObjC.cpp | 119 +- lib/CodeGen/CGObjCGNU.cpp | 4 +- lib/CodeGen/CGObjCMac.cpp | 26 +- lib/CodeGen/CGOpenCLRuntime.cpp | 3 - lib/CodeGen/CGOpenMPRuntime.cpp | 306 +- lib/CodeGen/CGOpenMPRuntime.h | 53 +- lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp | 1710 ++- lib/CodeGen/CGOpenMPRuntimeNVPTX.h | 128 +- lib/CodeGen/CGStmt.cpp | 10 +- lib/CodeGen/CGStmtOpenMP.cpp | 298 +- lib/CodeGen/CGVTables.cpp | 20 +- lib/CodeGen/CMakeLists.txt | 4 +- lib/CodeGen/CodeGenAction.cpp | 293 +- lib/CodeGen/CodeGenFunction.cpp | 81 +- lib/CodeGen/CodeGenFunction.h | 173 +- lib/CodeGen/CodeGenModule.cpp | 199 +- lib/CodeGen/CodeGenModule.h | 63 +- lib/CodeGen/CodeGenPGO.cpp | 34 +- lib/CodeGen/CodeGenPGO.h | 3 +- lib/CodeGen/CodeGenTypes.cpp | 4 +- lib/CodeGen/CodeGenTypes.h | 7 +- lib/CodeGen/ConstantBuilder.h | 444 - lib/CodeGen/ConstantInitBuilder.cpp | 280 + lib/CodeGen/CoverageMappingGen.cpp | 10 +- lib/CodeGen/EHScopeStack.h | 2 +- lib/CodeGen/ItaniumCXXABI.cpp | 86 +- lib/CodeGen/MacroPPCallbacks.cpp | 207 + lib/CodeGen/MacroPPCallbacks.h | 117 + lib/CodeGen/MicrosoftCXXABI.cpp | 82 +- lib/CodeGen/ModuleBuilder.cpp | 8 + lib/CodeGen/ObjectFilePCHContainerOperations.cpp | 9 +- lib/CodeGen/TargetInfo.cpp | 121 +- lib/Driver/CMakeLists.txt | 43 +- lib/Driver/CrossWindowsToolChain.cpp | 125 - lib/Driver/Driver.cpp | 185 +- lib/Driver/DriverOptions.cpp | 4 +- lib/Driver/Job.cpp | 26 +- lib/Driver/MSVCToolChain.cpp | 892 -- lib/Driver/MinGWToolChain.cpp | 257 - lib/Driver/Multilib.cpp | 2 +- lib/Driver/SanitizerArgs.cpp | 13 +- lib/Driver/ToolChain.cpp | 27 +- lib/Driver/ToolChains.cpp | 5342 -------- lib/Driver/ToolChains.h | 1388 --- lib/Driver/ToolChains/AMDGPU.cpp | 45 + lib/Driver/ToolChains/AMDGPU.h | 54 + lib/Driver/ToolChains/AVR.cpp | 44 + lib/Driver/ToolChains/AVR.h | 49 + lib/Driver/ToolChains/Arch/AArch64.cpp | 199 + lib/Driver/ToolChains/Arch/AArch64.h | 35 + lib/Driver/ToolChains/Arch/ARM.cpp | 547 + lib/Driver/ToolChains/Arch/ARM.h | 60 + lib/Driver/ToolChains/Arch/Mips.cpp | 403 + lib/Driver/ToolChains/Arch/Mips.h | 62 + lib/Driver/ToolChains/Arch/PPC.cpp | 131 + lib/Driver/ToolChains/Arch/PPC.h | 45 + lib/Driver/ToolChains/Arch/Sparc.cpp | 100 + lib/Driver/ToolChains/Arch/Sparc.h | 42 + lib/Driver/ToolChains/Arch/SystemZ.cpp | 41 + lib/Driver/ToolChains/Arch/SystemZ.h | 32 + lib/Driver/ToolChains/Arch/X86.cpp | 173 + lib/Driver/ToolChains/Arch/X86.h | 37 + lib/Driver/ToolChains/Bitrig.cpp | 190 + lib/Driver/ToolChains/Bitrig.h | 79 + lib/Driver/ToolChains/Clang.cpp | 5160 ++++++++ lib/Driver/ToolChains/Clang.h | 149 + lib/Driver/ToolChains/CloudABI.cpp | 145 + lib/Driver/ToolChains/CloudABI.h | 69 + lib/Driver/ToolChains/CommonArgs.cpp | 973 ++ lib/Driver/ToolChains/CommonArgs.h | 96 + lib/Driver/ToolChains/Contiki.cpp | 28 + lib/Driver/ToolChains/Contiki.h | 38 + lib/Driver/ToolChains/CrossWindows.cpp | 309 + lib/Driver/ToolChains/CrossWindows.h | 88 + lib/Driver/ToolChains/Cuda.cpp | 488 + lib/Driver/ToolChains/Cuda.h | 177 + lib/Driver/ToolChains/Darwin.cpp | 1910 +++ lib/Driver/ToolChains/Darwin.h | 488 + lib/Driver/ToolChains/DragonFly.cpp | 197 + lib/Driver/ToolChains/DragonFly.h | 68 + lib/Driver/ToolChains/FreeBSD.cpp | 395 + lib/Driver/ToolChains/FreeBSD.h | 86 + lib/Driver/ToolChains/Fuchsia.cpp | 229 + lib/Driver/ToolChains/Fuchsia.h | 79 + lib/Driver/ToolChains/Gnu.cpp | 2426 ++++ lib/Driver/ToolChains/Gnu.h | 351 + lib/Driver/ToolChains/Haiku.cpp | 33 + lib/Driver/ToolChains/Haiku.h | 40 + lib/Driver/ToolChains/Hexagon.cpp | 457 + lib/Driver/ToolChains/Hexagon.h | 99 + lib/Driver/ToolChains/Lanai.h | 39 + lib/Driver/ToolChains/Linux.cpp | 901 ++ lib/Driver/ToolChains/Linux.h | 57 + lib/Driver/ToolChains/MSVC.cpp | 1421 +++ lib/Driver/ToolChains/MSVC.h | 141 + lib/Driver/ToolChains/MSVCSetupApi.h | 514 + lib/Driver/ToolChains/MinGW.cpp | 471 + lib/Driver/ToolChains/MinGW.h | 102 + lib/Driver/ToolChains/Minix.cpp | 109 + lib/Driver/ToolChains/Minix.h | 66 + lib/Driver/ToolChains/MipsLinux.cpp | 128 + lib/Driver/ToolChains/MipsLinux.h | 62 + lib/Driver/ToolChains/Myriad.cpp | 286 + lib/Driver/ToolChains/Myriad.h | 102 + lib/Driver/ToolChains/NaCl.cpp | 363 + lib/Driver/ToolChains/NaCl.h | 87 + lib/Driver/ToolChains/NetBSD.cpp | 412 + lib/Driver/ToolChains/NetBSD.h | 79 + lib/Driver/ToolChains/OpenBSD.cpp | 234 + lib/Driver/ToolChains/OpenBSD.h | 76 + lib/Driver/ToolChains/PS4CPU.cpp | 419 + lib/Driver/ToolChains/PS4CPU.h | 93 + lib/Driver/ToolChains/Solaris.cpp | 193 + lib/Driver/ToolChains/Solaris.h | 75 + lib/Driver/ToolChains/TCE.cpp | 47 + lib/Driver/ToolChains/TCE.h | 47 + lib/Driver/ToolChains/WebAssembly.cpp | 163 + lib/Driver/ToolChains/WebAssembly.h | 77 + lib/Driver/ToolChains/XCore.cpp | 149 + lib/Driver/ToolChains/XCore.h | 82 + lib/Driver/Tools.cpp | 12226 ------------------- lib/Driver/Tools.h | 1010 -- lib/Driver/XRayArgs.cpp | 114 + lib/Format/BreakableToken.cpp | 736 +- lib/Format/BreakableToken.h | 362 +- lib/Format/CMakeLists.txt | 2 +- lib/Format/Comments.cpp | 36 - lib/Format/Comments.h | 33 - lib/Format/ContinuationIndenter.cpp | 262 +- lib/Format/ContinuationIndenter.h | 19 +- lib/Format/Format.cpp | 147 +- lib/Format/FormatToken.h | 22 + lib/Format/FormatTokenLexer.cpp | 38 +- lib/Format/FormatTokenLexer.h | 1 + lib/Format/NamespaceEndCommentsFixer.cpp | 175 + lib/Format/NamespaceEndCommentsFixer.h | 37 + lib/Format/TokenAnnotator.cpp | 223 +- lib/Format/TokenAnnotator.h | 4 +- lib/Format/UnwrappedLineFormatter.cpp | 46 +- lib/Format/UnwrappedLineFormatter.h | 8 +- lib/Format/UnwrappedLineParser.cpp | 286 +- lib/Format/UnwrappedLineParser.h | 35 +- lib/Format/WhitespaceManager.cpp | 274 +- lib/Format/WhitespaceManager.h | 44 +- lib/Frontend/ASTConsumers.cpp | 39 +- lib/Frontend/ASTUnit.cpp | 32 +- lib/Frontend/CompilerInstance.cpp | 57 +- lib/Frontend/CompilerInvocation.cpp | 289 +- lib/Frontend/FrontendAction.cpp | 89 +- lib/Frontend/FrontendActions.cpp | 10 +- lib/Frontend/InitPreprocessor.cpp | 17 +- lib/Frontend/Rewrite/RewriteMacros.cpp | 2 +- lib/Frontend/Rewrite/RewriteModernObjC.cpp | 6 +- lib/Frontend/Rewrite/RewriteObjC.cpp | 6 +- lib/FrontendTool/ExecuteCompilerInvocation.cpp | 2 +- lib/Headers/CMakeLists.txt | 1 + lib/Headers/altivec.h | 44 +- lib/Headers/avx2intrin.h | 2 +- lib/Headers/avx512bwintrin.h | 104 +- lib/Headers/avx512dqintrin.h | 95 +- lib/Headers/avx512fintrin.h | 189 +- lib/Headers/avx512vldqintrin.h | 42 +- lib/Headers/avx512vlintrin.h | 45 +- lib/Headers/avxintrin.h | 296 +- lib/Headers/clzerointrin.h | 50 + lib/Headers/emmintrin.h | 38 +- lib/Headers/f16cintrin.h | 10 +- lib/Headers/htmxlintrin.h | 14 +- lib/Headers/intrin.h | 50 - lib/Headers/mmintrin.h | 2 +- lib/Headers/module.modulemap | 1 + lib/Headers/opencl-c.h | 884 +- lib/Headers/pmmintrin.h | 12 +- lib/Headers/prfchwintrin.h | 24 + lib/Headers/smmintrin.h | 2013 ++- lib/Headers/stdarg.h | 3 +- lib/Headers/tgmath.h | 16 +- lib/Headers/x86intrin.h | 4 + lib/Headers/xmmintrin.h | 14 +- lib/Headers/xopintrin.h | 4 +- lib/Index/CMakeLists.txt | 1 + lib/Index/CommentToXML.cpp | 6 +- lib/Index/IndexBody.cpp | 16 +- lib/Index/IndexDecl.cpp | 155 +- lib/Index/IndexSymbol.cpp | 70 +- lib/Index/IndexTypeSourceInfo.cpp | 32 +- lib/Index/IndexingAction.cpp | 17 + lib/Index/IndexingContext.cpp | 93 +- lib/Index/IndexingContext.h | 3 +- lib/Index/USRGeneration.cpp | 20 +- lib/Lex/HeaderSearch.cpp | 6 +- lib/Lex/Lexer.cpp | 20 +- lib/Lex/ModuleMap.cpp | 31 +- lib/Lex/PPCaching.cpp | 30 + lib/Lex/PPDirectives.cpp | 11 +- lib/Lex/PPMacroExpansion.cpp | 1 + lib/Lex/Pragma.cpp | 11 + lib/Lex/Preprocessor.cpp | 10 +- lib/Parse/ParseCXXInlineMethods.cpp | 8 +- lib/Parse/ParseDecl.cpp | 348 +- lib/Parse/ParseDeclCXX.cpp | 193 +- lib/Parse/ParseExpr.cpp | 83 +- lib/Parse/ParseExprCXX.cpp | 91 +- lib/Parse/ParseInit.cpp | 2 +- lib/Parse/ParseObjc.cpp | 101 +- lib/Parse/ParseOpenMP.cpp | 11 +- lib/Parse/ParsePragma.cpp | 153 +- lib/Parse/ParseStmt.cpp | 25 +- lib/Parse/ParseStmtAsm.cpp | 19 +- lib/Parse/ParseTemplate.cpp | 33 +- lib/Parse/Parser.cpp | 52 +- lib/Parse/RAIIObjectsForParser.h | 447 - lib/Sema/AnalysisBasedWarnings.cpp | 17 +- lib/Sema/CoroutineStmtBuilder.h | 70 + lib/Sema/MultiplexExternalSemaSource.cpp | 9 + lib/Sema/ScopeInfo.cpp | 19 +- lib/Sema/Sema.cpp | 33 +- lib/Sema/SemaAttr.cpp | 17 +- lib/Sema/SemaCUDA.cpp | 14 +- lib/Sema/SemaCXXScopeSpec.cpp | 35 +- lib/Sema/SemaCast.cpp | 40 +- lib/Sema/SemaChecking.cpp | 210 +- lib/Sema/SemaCodeComplete.cpp | 163 +- lib/Sema/SemaCoroutine.cpp | 843 +- lib/Sema/SemaDecl.cpp | 680 +- lib/Sema/SemaDeclAttr.cpp | 308 +- lib/Sema/SemaDeclCXX.cpp | 1057 +- lib/Sema/SemaDeclObjC.cpp | 16 +- lib/Sema/SemaExceptionSpec.cpp | 1 + lib/Sema/SemaExpr.cpp | 450 +- lib/Sema/SemaExprCXX.cpp | 345 +- lib/Sema/SemaExprMember.cpp | 47 +- lib/Sema/SemaExprObjC.cpp | 136 +- lib/Sema/SemaInit.cpp | 357 +- lib/Sema/SemaLambda.cpp | 73 +- lib/Sema/SemaLookup.cpp | 87 +- lib/Sema/SemaObjCProperty.cpp | 37 +- lib/Sema/SemaOpenMP.cpp | 562 +- lib/Sema/SemaOverload.cpp | 177 +- lib/Sema/SemaPseudoObject.cpp | 33 +- lib/Sema/SemaStmt.cpp | 48 +- lib/Sema/SemaStmtAsm.cpp | 5 +- lib/Sema/SemaStmtAttr.cpp | 27 + lib/Sema/SemaTemplate.cpp | 807 +- lib/Sema/SemaTemplateDeduction.cpp | 384 +- lib/Sema/SemaTemplateInstantiate.cpp | 262 +- lib/Sema/SemaTemplateInstantiateDecl.cpp | 208 +- lib/Sema/SemaTemplateVariadic.cpp | 1 + lib/Sema/SemaType.cpp | 248 +- lib/Sema/TreeTransform.h | 552 +- lib/Serialization/ASTCommon.cpp | 4 +- lib/Serialization/ASTReader.cpp | 1362 ++- lib/Serialization/ASTReaderDecl.cpp | 197 +- lib/Serialization/ASTReaderStmt.cpp | 20 +- lib/Serialization/ASTWriter.cpp | 386 +- lib/Serialization/ASTWriterDecl.cpp | 20 +- lib/Serialization/ASTWriterStmt.cpp | 16 +- lib/Serialization/GeneratePCH.cpp | 7 +- lib/Serialization/GlobalModuleIndex.cpp | 76 +- lib/Serialization/Module.cpp | 22 - lib/Serialization/ModuleManager.cpp | 255 +- .../Checkers/AnalysisOrderChecker.cpp | 49 +- .../Checkers/BlockInCriticalSectionChecker.cpp | 70 +- lib/StaticAnalyzer/Checkers/CMakeLists.txt | 1 + lib/StaticAnalyzer/Checkers/CStringChecker.cpp | 10 +- .../Checkers/CStringSyntaxChecker.cpp | 32 +- .../Checkers/CXXSelfAssignmentChecker.cpp | 4 +- .../Checkers/CallAndMessageChecker.cpp | 76 +- .../Checkers/CastToStructChecker.cpp | 4 + .../Checkers/CheckerDocumentation.cpp | 14 +- lib/StaticAnalyzer/Checkers/CloneChecker.cpp | 100 +- lib/StaticAnalyzer/Checkers/ConversionChecker.cpp | 42 +- .../Checkers/ExprInspectionChecker.cpp | 7 +- .../Checkers/GenericTaintChecker.cpp | 85 +- .../Checkers/IteratorPastEndChecker.cpp | 2 - .../Checkers/MPI-Checker/MPIChecker.cpp | 4 +- .../Checkers/MacOSKeychainAPIChecker.cpp | 172 +- lib/StaticAnalyzer/Checkers/MallocChecker.cpp | 49 +- .../Checkers/MisusedMovedObjectChecker.cpp | 481 + .../Checkers/NonNullParamChecker.cpp | 2 +- lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp | 4 +- .../Checkers/ObjCPropertyChecker.cpp | 3 +- lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp | 12 +- lib/StaticAnalyzer/Checkers/UndefResultChecker.cpp | 26 + lib/StaticAnalyzer/Checkers/ValistChecker.cpp | 85 +- lib/StaticAnalyzer/Core/AnalyzerOptions.cpp | 2 +- lib/StaticAnalyzer/Core/BugReporterVisitors.cpp | 8 +- lib/StaticAnalyzer/Core/CMakeLists.txt | 17 + lib/StaticAnalyzer/Core/CallEvent.cpp | 81 +- lib/StaticAnalyzer/Core/CheckerManager.cpp | 12 +- lib/StaticAnalyzer/Core/ConstraintManager.cpp | 4 +- lib/StaticAnalyzer/Core/DynamicTypeMap.cpp | 2 +- lib/StaticAnalyzer/Core/ExprEngine.cpp | 156 +- lib/StaticAnalyzer/Core/ExprEngineC.cpp | 9 +- lib/StaticAnalyzer/Core/ExprEngineCXX.cpp | 9 +- lib/StaticAnalyzer/Core/ExprEngineObjC.cpp | 4 +- lib/StaticAnalyzer/Core/MemRegion.cpp | 62 +- lib/StaticAnalyzer/Core/ProgramState.cpp | 15 +- lib/StaticAnalyzer/Core/RangeConstraintManager.cpp | 102 +- .../Core/RangedConstraintManager.cpp | 204 + lib/StaticAnalyzer/Core/RangedConstraintManager.h | 102 + lib/StaticAnalyzer/Core/RegionStore.cpp | 10 +- .../Core/SimpleConstraintManager.cpp | 230 +- lib/StaticAnalyzer/Core/SimpleConstraintManager.h | 115 - lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp | 102 +- lib/StaticAnalyzer/Core/Store.cpp | 35 +- lib/StaticAnalyzer/Core/Z3ConstraintManager.cpp | 1618 +++ lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp | 4 +- lib/Tooling/CMakeLists.txt | 1 + lib/Tooling/Refactoring.cpp | 15 +- lib/Tooling/Refactoring/AtomicChange.cpp | 178 + lib/Tooling/Refactoring/CMakeLists.txt | 12 + lib/Tooling/Tooling.cpp | 2 +- test/ARCMT/lit.local.cfg | 2 +- test/ASTMerge/asm/Inputs/asm-function.cpp | 10 + test/ASTMerge/asm/test.cpp | 1 + .../Inputs/class-template-partial-spec1.cpp | 118 + .../Inputs/class-template-partial-spec2.cpp | 79 + test/ASTMerge/class-template-partial-spec/test.cpp | 25 + test/ASTMerge/exprs-cpp/Inputs/exprs3.cpp | 4 + test/ASTMerge/exprs-cpp/test.cpp | 2 + test/ASTMerge/struct/Inputs/struct1.c | 16 + test/ASTMerge/struct/Inputs/struct2.c | 16 + test/ASTMerge/struct/test.c | 7 +- test/Analysis/CFContainers-invalid.c | 2 +- test/Analysis/CFContainers.mm | 2 +- test/Analysis/CFDateGC.m | 2 +- test/Analysis/CFNumber.c | 2 +- test/Analysis/CFRetainRelease_NSAssertionHandler.m | 2 +- test/Analysis/CGColorSpace.c | 2 +- test/Analysis/CheckNSError.m | 2 +- test/Analysis/DeallocMissingRelease.m | 6 +- test/Analysis/DeallocUseAfterFreeErrors.m | 2 +- test/Analysis/DynamicTypePropagation.m | 2 +- .../Malloc+MismatchedDeallocator+NewDelete.cpp | 4 +- .../Malloc+MismatchedDeallocator_intersections.cpp | 2 +- test/Analysis/Malloc+NewDelete_intersections.cpp | 4 +- test/Analysis/MemRegion.cpp | 2 +- .../Analysis/MismatchedDeallocator-checker-test.mm | 2 +- test/Analysis/MismatchedDeallocator-path-notes.cpp | 4 +- test/Analysis/MissingDealloc.m | 4 +- test/Analysis/MisusedMovedObject.cpp | 619 + test/Analysis/NSContainers.m | 2 +- test/Analysis/NSPanel.m | 2 +- test/Analysis/NSString.m | 8 +- test/Analysis/NSWindow.m | 2 +- ...wDelete+MismatchedDeallocator_intersections.cpp | 4 +- test/Analysis/NewDelete-checker-test.cpp | 6 +- test/Analysis/NewDelete-custom.cpp | 4 +- test/Analysis/NewDelete-intersections.mm | 4 +- test/Analysis/NewDelete-path-notes.cpp | 4 +- test/Analysis/NewDelete-variadic.cpp | 2 +- test/Analysis/NewDeleteLeaks-PR18394.cpp | 2 +- test/Analysis/NewDeleteLeaks-PR19102.cpp | 2 +- test/Analysis/NoReturn.m | 2 +- test/Analysis/OSAtomic_mac.cpp | 2 +- test/Analysis/ObjCProperties.m | 2 +- test/Analysis/ObjCPropertiesSyntaxChecks.m | 9 +- test/Analysis/ObjCRetSigs.m | 2 +- test/Analysis/PR12905.c | 2 +- test/Analysis/PR24184.cpp | 4 +- test/Analysis/PR2599.m | 2 +- test/Analysis/PR2978.m | 2 +- test/Analysis/PR3991.m | 2 +- test/Analysis/PR7218.c | 2 +- test/Analysis/additive-folding-range-constraints.c | 2 +- test/Analysis/additive-folding.cpp | 11 +- test/Analysis/analyzeOneFunction.m | 2 +- test/Analysis/analyzer-checker-config.c | 14 +- test/Analysis/analyzer-config.c | 2 +- test/Analysis/analyzer-config.cpp | 2 +- test/Analysis/analyzer-display-progress.cpp | 2 +- test/Analysis/analyzer-display-progress.m | 2 +- test/Analysis/analyzer-enabled-checkers.c | 2 +- test/Analysis/analyzer-stats.c | 2 +- test/Analysis/analyzer_test.py | 28 + test/Analysis/array-struct-region.c | 2 +- test/Analysis/array-struct-region.cpp | 8 +- test/Analysis/array-struct.c | 2 +- test/Analysis/atomics.c | 2 +- test/Analysis/auto-obj-dtors-cfg-output.cpp | 2 +- test/Analysis/base-init.cpp | 2 +- test/Analysis/bitwise-ops.c | 2 +- test/Analysis/block-in-critical-section.cpp | 78 +- test/Analysis/blocks-no-inline.c | 4 +- test/Analysis/blocks.m | 4 +- test/Analysis/blocks.mm | 4 +- test/Analysis/bool-assignment.c | 9 +- test/Analysis/bstring.c | 8 +- test/Analysis/bstring.cpp | 2 +- test/Analysis/bug_hash_test.cpp | 2 +- test/Analysis/bug_hash_test.m | 2 +- test/Analysis/builtin-functions.cpp | 2 +- test/Analysis/call-invalidation.cpp | 2 +- test/Analysis/cast-to-struct.cpp | 16 +- test/Analysis/castexpr-callback.c | 2 +- test/Analysis/casts.c | 9 +- test/Analysis/casts.cpp | 2 +- test/Analysis/casts.m | 2 +- test/Analysis/cfg.cpp | 2 +- test/Analysis/cfref_PR2519.c | 2 +- test/Analysis/cfref_rdar6080742.c | 2 +- test/Analysis/check-deserialization.cpp | 4 +- test/Analysis/checker-plugins.c | 2 +- test/Analysis/chroot.c | 2 +- test/Analysis/comparison-implicit-casts.cpp | 4 +- test/Analysis/complex-init-list.cpp | 2 +- test/Analysis/complex.c | 2 +- test/Analysis/concrete-address.c | 2 +- test/Analysis/conditional-operator.cpp | 2 +- test/Analysis/conditional-path-notes.c | 4 +- test/Analysis/const-method-call.cpp | 2 +- test/Analysis/constant-folding.c | 2 +- test/Analysis/conversion.c | 70 +- test/Analysis/copypaste/asm.cpp | 2 +- test/Analysis/copypaste/attributes.cpp | 2 +- test/Analysis/copypaste/blocks.cpp | 2 +- test/Analysis/copypaste/call.cpp | 2 +- test/Analysis/copypaste/catch.cpp | 2 +- test/Analysis/copypaste/delete.cpp | 2 +- test/Analysis/copypaste/dependent-exist.cpp | 2 +- test/Analysis/copypaste/expr-types.cpp | 2 +- test/Analysis/copypaste/fold.cpp | 2 +- test/Analysis/copypaste/function-try-block.cpp | 2 +- test/Analysis/copypaste/functions.cpp | 2 +- test/Analysis/copypaste/generic.c | 2 +- test/Analysis/copypaste/labels.cpp | 2 +- test/Analysis/copypaste/lambda.cpp | 2 +- test/Analysis/copypaste/macro-complexity.cpp | 2 +- test/Analysis/copypaste/macros.cpp | 2 +- test/Analysis/copypaste/objc-methods.m | 2 +- .../plist-diagnostics-notes-as-events.cpp | 2 +- test/Analysis/copypaste/plist-diagnostics.cpp | 2 +- test/Analysis/copypaste/sub-sequences.cpp | 2 +- test/Analysis/copypaste/suspicious-clones.cpp | 2 +- test/Analysis/copypaste/text-diagnostics.cpp | 2 +- test/Analysis/coverage.c | 2 +- test/Analysis/crash-trace.c | 2 +- test/Analysis/cstring-syntax-cxx.cpp | 2 +- test/Analysis/cstring-syntax.c | 4 +- test/Analysis/ctor.mm | 2 +- test/Analysis/cxx-crashes.cpp | 2 +- test/Analysis/cxx-for-range.cpp | 2 +- test/Analysis/cxx-method-names.cpp | 2 +- test/Analysis/cxx11-crashes.cpp | 2 +- test/Analysis/dead-stores.c | 4 +- test/Analysis/dead-stores.cpp | 4 +- test/Analysis/dead-stores.m | 2 +- test/Analysis/debug-CallGraph.c | 29 +- test/Analysis/default-analyze.m | 2 +- test/Analysis/default-diagnostic-visitors.c | 2 +- test/Analysis/delayed-template-parsing-crash.cpp | 2 +- test/Analysis/delegates.m | 2 +- test/Analysis/derived-to-base.cpp | 4 +- test/Analysis/designated-initializer.c | 2 +- .../diagnostics/deref-track-symbolic-region.c | 4 +- .../diagnostics/deref-track-symbolic-region.cpp | 2 +- .../diagnostics/diag-cross-file-boundaries.c | 4 +- test/Analysis/diagnostics/explicit-suppression.cpp | 5 +- .../diagnostics/false-positive-suppression.c | 2 +- .../diagnostics/implicit-cxx-std-suppression.cpp | 4 +- test/Analysis/diagnostics/macros.cpp | 2 +- test/Analysis/diagnostics/macros.m | 2 +- test/Analysis/diagnostics/no-prune-paths.c | 4 +- .../plist-diagnostics-include-check.cpp | 2 +- .../diagnostics/report-issues-within-main-file.cpp | 2 +- .../diagnostics/shortest-path-suppression.c | 2 +- test/Analysis/diagnostics/text-diagnostics.c | 2 +- test/Analysis/diagnostics/undef-value-caller.c | 2 +- test/Analysis/diagnostics/undef-value-param.c | 4 +- test/Analysis/diagnostics/undef-value-param.m | 14 +- test/Analysis/disable-all-checks.c | 10 +- test/Analysis/dispatch-once.m | 4 +- test/Analysis/div-zero.cpp | 2 +- test/Analysis/division-by-zero.c | 2 +- test/Analysis/domtest.c | 2 +- test/Analysis/dtor-cxx11.cpp | 2 +- test/Analysis/dtor.cpp | 2 +- test/Analysis/dtors-in-dtor-cfg-output.cpp | 2 +- test/Analysis/dynamic-cast.cpp | 2 +- test/Analysis/dynamic_type_check.m | 2 +- test/Analysis/edges-new.mm | 4 +- test/Analysis/elementtype.c | 2 +- test/Analysis/engine/replay-without-inlining.c | 2 +- test/Analysis/enum.cpp | 2 +- test/Analysis/exceptions.mm | 2 +- test/Analysis/exercise-ps.c | 2 +- test/Analysis/explain-svals.c | 25 + test/Analysis/explain-svals.cpp | 2 +- test/Analysis/explain-svals.m | 2 +- test/Analysis/expr-inspection.c | 4 +- test/Analysis/fields.c | 2 +- test/Analysis/free.c | 4 +- test/Analysis/func.c | 2 +- test/Analysis/generics.m | 4 +- test/Analysis/global-region-invalidation.c | 2 +- test/Analysis/global_region_invalidation.mm | 2 +- test/Analysis/gmalloc.c | 59 + test/Analysis/gtest.cpp | 6 +- test/Analysis/html-diags-multifile.c | 2 +- test/Analysis/html-diags.c | 4 +- test/Analysis/identical-expressions.cpp | 2 +- test/Analysis/index-type.c | 4 +- test/Analysis/initializer.cpp | 2 +- test/Analysis/initializers-cfg-output.cpp | 2 +- test/Analysis/inline-not-supported.c | 2 +- test/Analysis/inline-plist.c | 20 +- test/Analysis/inline-unique-reports.c | 2 +- test/Analysis/inline.c | 2 +- test/Analysis/inline.cpp | 2 +- test/Analysis/inline2.c | 2 +- test/Analysis/inline3.c | 2 +- test/Analysis/inline4.c | 2 +- test/Analysis/inlining/DynDispatchBifurcate.m | 2 +- test/Analysis/inlining/InlineObjCClassMethod.m | 79 +- test/Analysis/inlining/InlineObjCInstanceMethod.m | 2 +- test/Analysis/inlining/ObjCDynTypePopagation.m | 2 +- .../ObjCImproperDynamictallyDetectableCast.m | 2 +- test/Analysis/inlining/RetainCountExamples.m | 2 +- test/Analysis/inlining/analysis-order.c | 2 +- .../assume-super-init-does-not-return-nil.m | 2 +- test/Analysis/inlining/containers.cpp | 4 +- test/Analysis/inlining/dyn-dispatch-bifurcate.cpp | 2 +- .../inlining/eager-reclamation-path-notes.c | 4 +- .../inlining/eager-reclamation-path-notes.cpp | 4 +- .../Analysis/inlining/false-positive-suppression.c | 6 +- .../inlining/false-positive-suppression.cpp | 4 +- .../Analysis/inlining/false-positive-suppression.m | 8 +- test/Analysis/inlining/inline-defensive-checks.c | 2 +- test/Analysis/inlining/inline-defensive-checks.cpp | 2 +- test/Analysis/inlining/inline-defensive-checks.m | 2 +- test/Analysis/inlining/path-notes.c | 4 +- test/Analysis/inlining/path-notes.cpp | 4 +- test/Analysis/inlining/path-notes.m | 4 +- test/Analysis/inlining/retain-count-self-init.m | 2 +- test/Analysis/inlining/stl.cpp | 4 +- .../inlining/test-always-inline-size-option.c | 2 +- test/Analysis/inlining/test_objc_inlining_option.m | 2 +- test/Analysis/iterator-past-end.cpp | 4 +- test/Analysis/ivars.m | 2 +- test/Analysis/keychainAPI-diagnostic-visitor.m | 2 +- test/Analysis/keychainAPI.m | 62 +- test/Analysis/kmalloc-linux.c | 2 +- test/Analysis/lambda-notes.cpp | 2 +- test/Analysis/lambdas-generalized-capture.cpp | 2 +- test/Analysis/lambdas.cpp | 6 +- test/Analysis/lambdas.mm | 2 +- test/Analysis/lifetime-extension.cpp | 2 +- test/Analysis/lit.local.cfg | 13 +- test/Analysis/live-variables.cpp | 2 +- test/Analysis/live-variables.m | 2 +- test/Analysis/localization-aggressive.m | 2 +- test/Analysis/localization.m | 2 +- test/Analysis/logical-ops.c | 2 +- test/Analysis/loop-widening.c | 2 +- test/Analysis/lvalue.cpp | 2 +- test/Analysis/malloc-annotations.c | 2 +- test/Analysis/malloc-custom.c | 2 +- test/Analysis/malloc-interprocedural.c | 2 +- test/Analysis/malloc-overflow.c | 2 +- test/Analysis/malloc-overflow.cpp | 2 +- test/Analysis/malloc-overflow2.c | 2 +- test/Analysis/malloc-plist.c | 2 +- test/Analysis/malloc-protoype.c | 2 +- test/Analysis/malloc-sizeof.c | 2 +- test/Analysis/malloc-sizeof.cpp | 2 +- test/Analysis/malloc-three-arg.c | 2 +- test/Analysis/malloc.c | 2 +- test/Analysis/malloc.cpp | 4 +- test/Analysis/malloc.m | 4 +- test/Analysis/malloc.mm | 2 +- test/Analysis/max-nodes-suppress-on-sink.c | 2 +- test/Analysis/member-expr.cpp | 2 +- test/Analysis/method-call-intra-p.cpp | 2 +- test/Analysis/method-call-path-notes.cpp | 4 +- test/Analysis/method-call.cpp | 2 +- test/Analysis/misc-ps-64.m | 2 +- test/Analysis/misc-ps-arm.m | 2 +- test/Analysis/misc-ps-cxx0x.cpp | 2 +- test/Analysis/misc-ps-eager-assume.m | 2 +- test/Analysis/misc-ps-ranges.m | 2 +- test/Analysis/misc-ps-region-store-i386.m | 2 +- test/Analysis/misc-ps-region-store-x86_64.m | 2 +- test/Analysis/misc-ps-region-store.cpp | 4 +- test/Analysis/misc-ps-region-store.m | 8 +- test/Analysis/misc-ps-region-store.mm | 4 +- test/Analysis/misc-ps.c | 2 +- test/Analysis/misc-ps.m | 8 +- test/Analysis/model-file.cpp | 2 +- test/Analysis/mpichecker.cpp | 2 +- test/Analysis/mpicheckernotes.cpp | 2 +- test/Analysis/new-with-exceptions.cpp | 4 +- test/Analysis/new.cpp | 2 +- ...iver-undefined-larger-than-voidptr-ret-region.m | 2 +- ...il-receiver-undefined-larger-than-voidptr-ret.m | 6 +- test/Analysis/no-exit-cfg.c | 2 +- test/Analysis/no-outofbounds.c | 2 +- test/Analysis/no-unreachable-dtors.cpp | 2 +- test/Analysis/non-diagnosable-assumptions.c | 2 +- test/Analysis/nonnull.m | 2 +- test/Analysis/null-deref-path-notes.m | 4 +- test/Analysis/null-deref-ps-region.c | 2 +- test/Analysis/null-deref-ps.c | 6 +- test/Analysis/nullability-no-arc.mm | 2 +- test/Analysis/nullability.c | 2 +- test/Analysis/nullability.mm | 4 +- test/Analysis/nullability_nullonly.mm | 4 +- test/Analysis/nullptr.cpp | 4 +- test/Analysis/number-object-conversion.c | 4 +- test/Analysis/number-object-conversion.cpp | 4 +- test/Analysis/number-object-conversion.m | 8 +- test/Analysis/objc-arc.m | 2 +- test/Analysis/objc-bool.m | 2 +- test/Analysis/objc-boxing.m | 2 +- test/Analysis/objc-for.m | 2 +- test/Analysis/objc-message.m | 2 +- test/Analysis/objc-method-coverage.m | 2 +- test/Analysis/objc-properties.m | 2 +- test/Analysis/objc-radar17039661.m | 4 +- test/Analysis/objc-string.mm | 2 +- test/Analysis/objc-subscript.m | 2 +- ...direct-ivar-assignment-in-annotated-functions.m | 2 +- test/Analysis/objc_invalidation.m | 4 +- test/Analysis/openmp-unsupported.c | 7 + test/Analysis/operator-calls.cpp | 2 +- test/Analysis/out-of-bounds-new.cpp | 2 +- test/Analysis/out-of-bounds.c | 2 +- test/Analysis/outofbound-notwork.c | 2 +- test/Analysis/outofbound.c | 2 +- test/Analysis/override-werror.c | 2 +- test/Analysis/padding_c.c | 2 +- test/Analysis/padding_cpp.cpp | 2 +- test/Analysis/padding_message.cpp | 2 +- test/Analysis/plist-html-macros.c | 4 +- test/Analysis/plist-macros.cpp | 4 +- test/Analysis/plist-output-alternate.m | 2 +- test/Analysis/plist-output.m | 206 +- test/Analysis/pointer-to-member.cpp | 2 +- test/Analysis/pr22954.c | 2 +- test/Analysis/pr4209.m | 2 +- test/Analysis/pr_2542_rdar_6793404.m | 2 +- test/Analysis/pr_4164.c | 2 +- test/Analysis/properties.m | 20 +- test/Analysis/properties.mm | 4 +- test/Analysis/pthreadlock.c | 2 +- test/Analysis/ptr-arith.c | 45 +- test/Analysis/ptr-arith.cpp | 2 +- test/Analysis/qt_malloc.cpp | 2 +- test/Analysis/range_casts.c | 2 +- test/Analysis/rdar-6442306-1.m | 2 +- test/Analysis/rdar-6540084.m | 2 +- test/Analysis/rdar-6541136-region.c | 2 +- test/Analysis/rdar-6562655.m | 2 +- ...dar-6600344-nil-receiver-undefined-struct-ret.m | 2 +- test/Analysis/rdar-7168531.m | 2 +- test/Analysis/redefined_system.c | 2 +- test/Analysis/refcnt_naming.m | 2 +- test/Analysis/reference.cpp | 16 +- test/Analysis/reference.mm | 2 +- test/Analysis/region-1.m | 2 +- test/Analysis/region-store.c | 2 +- test/Analysis/region-store.cpp | 2 +- test/Analysis/reinterpret-cast.cpp | 2 +- test/Analysis/retain-release-arc.m | 4 +- test/Analysis/retain-release-cache-out.m | 2 +- test/Analysis/retain-release-cf-audited.m | 4 +- test/Analysis/retain-release-gc-only.m | 2 +- test/Analysis/retain-release-inline.m | 2 +- test/Analysis/retain-release-path-notes-gc.m | 4 +- test/Analysis/retain-release-path-notes.m | 4 +- test/Analysis/retain-release-region-store.m | 2 +- test/Analysis/retain-release.m | 4 +- test/Analysis/retain-release.mm | 2 +- test/Analysis/return-ptr-range.cpp | 2 +- test/Analysis/security-syntax-checks-no-emit.c | 2 +- test/Analysis/security-syntax-checks.m | 16 +- test/Analysis/self-assign.cpp | 2 +- test/Analysis/self-init.m | 4 +- test/Analysis/shallow-mode.m | 2 +- test/Analysis/simple-stream-checks.c | 4 +- test/Analysis/sizeofpointer.c | 2 +- test/Analysis/stack-addr-ps.c | 2 +- test/Analysis/stack-addr-ps.cpp | 2 +- test/Analysis/stack-block-returned.cpp | 2 +- test/Analysis/stackaddrleak.c | 4 +- test/Analysis/static_local.m | 2 +- test/Analysis/stats.c | 2 +- test/Analysis/std-c-library-functions.c | 10 +- test/Analysis/std-c-library-functions.cpp | 2 +- test/Analysis/stream.c | 2 +- test/Analysis/string-fail.c | 4 +- test/Analysis/string.c | 8 +- test/Analysis/superclass.m | 2 +- test/Analysis/svalbuilder-logic.c | 2 +- test/Analysis/switch-case.c | 2 +- test/Analysis/symbol-reaper.c | 2 +- test/Analysis/taint-diagnostic-visitor.c | 13 + test/Analysis/taint-generic.c | 39 +- test/Analysis/taint-tester.c | 2 +- test/Analysis/taint-tester.cpp | 2 +- test/Analysis/taint-tester.m | 2 +- test/Analysis/temp-obj-dtors-cfg-output.cpp | 4 +- test/Analysis/templates.cpp | 4 +- test/Analysis/temporaries-callback-order.cpp | 36 + test/Analysis/temporaries.cpp | 43 +- test/Analysis/test-after-div-zero.c | 4 +- test/Analysis/test-include-cpp.cpp | 2 +- test/Analysis/test-include.c | 2 +- .../test-objc-non-nil-return-value-checker.m | 2 +- test/Analysis/test-variably-modified-types.c | 2 +- test/Analysis/traversal-algorithm.mm | 2 +- test/Analysis/traversal-begin-end-function.c | 2 +- test/Analysis/traversal-path-unification.c | 4 +- test/Analysis/ubigraph-viz.cpp | 2 +- test/Analysis/undef-buffers.c | 2 +- test/Analysis/uninit-const.c | 62 +- test/Analysis/uninit-const.cpp | 26 +- test/Analysis/uninit-msg-expr.m | 4 +- test/Analysis/uninit-ps-rdar6145427.m | 2 +- test/Analysis/uninit-vals-ps-region.m | 2 +- test/Analysis/uninit-vals-ps.c | 10 +- test/Analysis/uninit-vals-union.c | 2 +- test/Analysis/uninit-vals.cpp | 6 +- test/Analysis/uninit-vals.m | 2 +- test/Analysis/unions-region.m | 2 +- test/Analysis/unions.cpp | 2 +- test/Analysis/unix-api.c | 2 +- test/Analysis/unix-api.cpp | 2 +- test/Analysis/unix-fns.c | 4 +- test/Analysis/unreachable-code-path.c | 2 +- test/Analysis/unsupported-types.c | 31 + test/Analysis/unused-ivars.m | 2 +- test/Analysis/valist-as-lazycompound.c | 21 + test/Analysis/valist-uninitialized-no-undef.c | 40 + test/Analysis/valist-uninitialized.c | 96 +- test/Analysis/valist-unterminated.c | 72 +- test/Analysis/variadic-method-types.m | 2 +- test/Analysis/vfork.c | 4 +- test/Analysis/virtualcall.cpp | 6 +- test/Analysis/vla.c | 2 +- test/Analysis/weak-functions.c | 2 +- test/CMakeLists.txt | 14 +- .../basic.lookup.qual/class.qual/p2.cpp | 93 +- test/CXX/class.derived/class.abstract/p16.cpp | 8 +- test/CXX/class.derived/class.member.lookup/p10.cpp | 114 + test/CXX/class.derived/class.member.lookup/p6.cpp | 10 +- test/CXX/class.derived/class.member.lookup/p7.cpp | 10 +- .../temp.constr.decl/class-template-decl.cpp | 65 + .../dcl.dcl/dcl.attr/dcl.attr.deprecated/p1.cpp | 37 +- .../dcl.spec/dcl.type/dcl.spec.auto/p3-1y.cpp | 10 +- .../dcl.spec/dcl.type/dcl.spec.auto/p3-1z.cpp | 8 + .../dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p3.cpp | 14 +- .../dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p4.cpp | 2 +- .../dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p5.cpp | 2 +- .../dcl.spec/dcl.type/dcl.spec.auto/p7-1y.cpp | 2 +- .../dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p7.cpp | 35 +- .../dcl.spec/dcl.type/dcl.type.class.deduct/p1.cpp | 18 + test/CXX/dcl.decl/dcl.init/dcl.init.list/p3.cpp | 45 +- test/CXX/drs/dr10xx.cpp | 24 + test/CXX/drs/dr12xx.cpp | 20 +- test/CXX/drs/dr13xx.cpp | 99 + test/CXX/drs/dr16xx.cpp | 118 + test/CXX/drs/dr1xx.cpp | 6 +- test/CXX/drs/dr21xx.cpp | 24 + test/CXX/drs/dr2xx.cpp | 8 +- test/CXX/drs/dr3xx.cpp | 13 +- test/CXX/drs/dr4xx.cpp | 4 +- test/CXX/drs/dr5xx.cpp | 18 +- test/CXX/expr/expr.post/expr.type.conv/p1.cpp | 10 + test/CXX/expr/expr.prim/expr.prim.lambda/p12.cpp | 2 +- test/CXX/expr/expr.prim/expr.prim.lambda/p13.cpp | 2 +- test/CXX/expr/expr.prim/expr.prim.lambda/p16.cpp | 2 +- test/CXX/expr/expr.prim/expr.prim.lambda/p18.cpp | 2 +- test/CXX/expr/expr.prim/expr.prim.lambda/p19.cpp | 2 +- test/CXX/over/over.match/over.match.best/p1.cpp | 24 +- .../over.match.class.deduct/p2.cpp | 25 + .../over.match.class.deduct/p3.cpp | 41 + test/CXX/special/class.dtor/p10-0x.cpp | 2 +- .../temp/temp.decls/temp.variadic/sizeofpack.cpp | 2 +- test/CXX/temp/temp.deduct.guide/p1.cpp | 108 + test/CXX/temp/temp.deduct.guide/p2.cpp | 15 + test/CXX/temp/temp.deduct.guide/p3.cpp | 72 + .../temp.deduct/temp.deduct.call/p3-0x.cpp | 53 +- test/CXX/temp/temp.res/p3.cpp | 38 + test/CXX/temp/temp.res/temp.local/p1.cpp | 57 +- .../temp.spec/cxx1y-variable-template-no-body.cpp | 2 +- test/CodeCompletion/auto_type.c | 5 + test/CodeCompletion/keywords.cpp | 79 + test/CodeCompletion/member-access.cpp | 14 + test/CodeCompletion/ordinary-name-cxx11.cpp | 9 + test/CodeCompletion/pragma-macro-token-caching.c | 18 + test/CodeGen/2006-05-19-SingleEltReturn.c | 11 +- test/CodeGen/Inputs/debug-info-macro.h | 12 + .../CodeGen/Inputs/pgo-sample-thinlto-summary.prof | 4 + test/CodeGen/aarch64-neon-intrinsics.c | 2 +- test/CodeGen/address-space.c | 13 +- test/CodeGen/alloc-align-attr.c | 101 + test/CodeGen/alloc-size.c | 2 +- test/CodeGen/altivec.c | 2 +- test/CodeGen/avr-inline-asm-constraints.c | 124 + .../avr-unsupported-inline-asm-constraints.c | 8 + test/CodeGen/avr/attributes/interrupt.c | 6 + test/CodeGen/avr/attributes/signal.c | 6 + test/CodeGen/avr/target-cpu-defines/atmega328p.c | 7 + test/CodeGen/avr/target-cpu-defines/attiny104.c | 7 + test/CodeGen/avr/target-cpu-defines/common.c | 6 + test/CodeGen/avx-builtins.c | 28 +- test/CodeGen/avx2-builtins.c | 36 +- test/CodeGen/avx512-reduceMinMaxIntrin.c | 10 +- test/CodeGen/avx512bw-builtins.c | 56 +- test/CodeGen/avx512dq-builtins.c | 105 +- test/CodeGen/avx512f-builtins.c | 295 +- test/CodeGen/avx512pf-builtins.c | 32 +- test/CodeGen/avx512vl-builtins.c | 62 +- test/CodeGen/avx512vlbw-builtins.c | 12 +- test/CodeGen/avx512vldq-builtins.c | 67 +- test/CodeGen/blocks.c | 34 + test/CodeGen/builtin-clflushopt.c | 2 +- test/CodeGen/builtin-clzero.c | 9 + test/CodeGen/builtins-mips-msa-error.c | 14 +- test/CodeGen/builtins-mips-msa.c | 7 + test/CodeGen/builtins-ppc-altivec.c | 42 +- test/CodeGen/builtins-ppc-crypto-disabled.c | 6 +- test/CodeGen/builtins-ppc-crypto.c | 4 +- test/CodeGen/builtins-ppc-error.c | 4 +- test/CodeGen/builtins-ppc-htm.c | 2 +- test/CodeGen/builtins-ppc-p8vector.c | 6 +- test/CodeGen/builtins-ppc-p9vector.c | 4 +- test/CodeGen/builtins-ppc-quadword.c | 6 +- test/CodeGen/builtins-ppc-vsx.c | 4 +- test/CodeGen/builtins-wasm.c | 8 +- test/CodeGen/builtins-x86.c | 5 +- test/CodeGen/catch-undef-behavior.c | 21 +- test/CodeGen/cfi-check-fail.c | 5 + test/CodeGen/cleanup-destslot-simple.c | 8 +- test/CodeGen/compound-assign-overflow.c | 4 +- test/CodeGen/debug-info-macro.c | 57 + test/CodeGen/default-address-space.c | 58 + test/CodeGen/fentry.c | 11 + test/CodeGen/ffp-contract-fast-option.cpp | 29 + test/CodeGen/ffp-contract-option.c | 6 +- test/CodeGen/fp-contract-fast-pragma.cpp | 69 + test/CodeGen/fp-contract-on-pragma.cpp | 76 + test/CodeGen/function-sections.c | 8 +- test/CodeGen/libcall-declarations.c | 15 +- test/CodeGen/lifetime-asan.c | 8 +- test/CodeGen/lifetime2.c | 52 +- test/CodeGen/mmx-builtins.c | 87 + test/CodeGen/ms-declspecs.c | 2 +- test/CodeGen/ms-inline-asm-EVEN.c | 16 + test/CodeGen/ms-inline-asm.c | 21 + test/CodeGen/ms-intrinsics.c | 39 +- test/CodeGen/ms-x86-intrinsics.c | 65 +- test/CodeGen/object-size.c | 110 +- test/CodeGen/object-size.cpp | 14 +- test/CodeGen/opt-record-MIR.c | 33 + test/CodeGen/pass-object-size.c | 57 +- test/CodeGen/pgo-sample-thinlto-summary.c | 42 + test/CodeGen/ppc64-align-struct.c | 2 +- test/CodeGen/ppc64-complex-parms.c | 2 +- test/CodeGen/ppc64-vector.c | 2 +- test/CodeGen/ppc64le-aggregates.c | 2 +- test/CodeGen/pr3997.c | 13 + test/CodeGen/sanitize-init-order.cpp | 4 +- test/CodeGen/sanitize-recover.c | 15 +- .../sanitize-thread-no-checking-at-run-time.m | 15 +- test/CodeGen/sse-builtins.c | 2 +- test/CodeGen/sse2-builtins.c | 4 +- test/CodeGen/sse41-builtins.c | 2 +- test/CodeGen/temporary-lifetime-exceptions.cpp | 12 +- test/CodeGen/temporary-lifetime.cpp | 48 +- test/CodeGen/thin_link_bitcode.c | 9 + test/CodeGen/thinlto-emit-llvm.c | 10 + test/CodeGen/thinlto-multi-module.ll | 22 + test/CodeGen/transparent-union.c | 11 + test/CodeGen/ubsan-promoted-arith.cpp | 131 + test/CodeGen/ubsan-shift.c | 47 + test/CodeGen/unaligned-decl.c | 22 + test/CodeGen/unaligned-expr.c | 217 + test/CodeGen/unaligned-field.c | 17 + test/CodeGen/unsigned-promotion.c | 113 - test/CodeGen/xop-builtins-cmp.c | 405 + test/CodeGen/xop-builtins.c | 10 +- test/CodeGen/xray-always-instrument.cpp | 15 + test/CodeGen/xray-attributes-supported-arm.cpp | 13 - test/CodeGen/xray-attributes-supported.cpp | 6 + test/CodeGen/xray-instruction-threshold.cpp | 14 + test/CodeGen/xray-log-args.cpp | 13 + test/CodeGen/zvector.c | 4502 ++++--- test/CodeGenCUDA/fp-contract.cu | 4 +- test/CodeGenCUDA/propagate-metadata.cu | 62 + test/CodeGenCXX/atomic-dllexport.cpp | 9 + test/CodeGenCXX/cfi-ms-rtti.cpp | 4 +- test/CodeGenCXX/constructors.cpp | 56 +- test/CodeGenCXX/cxx11-initializer-aggregate.cpp | 15 +- test/CodeGenCXX/debug-info-class-optzns.cpp | 26 + .../debug-info-inheriting-constructor.cpp | 25 + test/CodeGenCXX/debug-info-ms-dtor-thunks.cpp | 14 + .../debug-info-template-deduction-guide.cpp | 17 + test/CodeGenCXX/debug-info-use-after-free.cpp | 3 + test/CodeGenCXX/destructors.cpp | 14 +- test/CodeGenCXX/dllexport.cpp | 6 +- test/CodeGenCXX/dllimport.cpp | 29 +- test/CodeGenCXX/dynamic-cast-hint.cpp | 6 +- test/CodeGenCXX/exceptions-cxx-new.cpp | 4 +- test/CodeGenCXX/exceptions-seh.cpp | 6 +- test/CodeGenCXX/explicit-instantiation.cpp | 17 + test/CodeGenCXX/float128-declarations.cpp | 4 + test/CodeGenCXX/global-init.cpp | 2 +- test/CodeGenCXX/implicit-exception-spec.cpp | 22 + test/CodeGenCXX/inheriting-constructor.cpp | 16 +- test/CodeGenCXX/initializer-list-ctor-order.cpp | 29 + test/CodeGenCXX/linetable-cleanup.cpp | 4 +- test/CodeGenCXX/lpad-linetable.cpp | 2 +- test/CodeGenCXX/mangle-unnamed.cpp | 4 +- test/CodeGenCXX/mangle.cpp | 12 + test/CodeGenCXX/microsoft-abi-dynamic-cast.cpp | 2 +- test/CodeGenCXX/microsoft-abi-eh-cleanups.cpp | 6 +- test/CodeGenCXX/microsoft-abi-sret-and-byval.cpp | 10 + test/CodeGenCXX/microsoft-abi-structors.cpp | 10 +- test/CodeGenCXX/microsoft-abi-throw.cpp | 2 +- .../microsoft-abi-virtual-inheritance.cpp | 6 +- test/CodeGenCXX/modules-ts.cppm | 5 +- test/CodeGenCXX/new-array-init.cpp | 7 + test/CodeGenCXX/no-lto-unit.cpp | 13 + test/CodeGenCXX/nrvo.cpp | 4 +- test/CodeGenCXX/optnone-class-members.cpp | 2 +- test/CodeGenCXX/optnone-def-decl.cpp | 2 +- test/CodeGenCXX/reference-init.cpp | 13 +- test/CodeGenCXX/regcall.cpp | 4 +- test/CodeGenCXX/static-init.cpp | 8 +- test/CodeGenCXX/stmtexpr.cpp | 82 + test/CodeGenCXX/template-instantiation.cpp | 39 +- test/CodeGenCXX/type-metadata-thinlto.cpp | 11 + test/CodeGenCXX/type-metadata.cpp | 16 +- test/CodeGenCXX/ubsan-bitfields.cpp | 34 + test/CodeGenCXX/ubsan-global-alignment.cpp | 29 + test/CodeGenCXX/ubsan-suppress-checks.cpp | 221 + test/CodeGenCXX/ubsan-type-checks.cpp | 36 + test/CodeGenCXX/unaligned.cpp | 6 + test/CodeGenCXX/volatile-1.cpp | 34 +- test/CodeGenCXX/volatile.cpp | 4 +- test/CodeGenCoroutines/coro-alloc.cpp | 60 +- test/CodeGenCoroutines/coro-await.cpp | 230 + test/CodeGenCoroutines/coro-builtins.c | 2 +- test/CodeGenCoroutines/coro-cleanup.cpp | 74 + test/CodeGenCoroutines/coro-eh-cleanup.cpp | 74 + test/CodeGenCoroutines/coro-return.cpp | 59 + test/CodeGenObjC/arc-blocks.m | 57 +- test/CodeGenObjC/arc-linetable-autorelease.m | 5 +- test/CodeGenObjC/arc-precise-lifetime.m | 68 +- test/CodeGenObjC/arc-ternary-op.m | 12 +- test/CodeGenObjC/arc.m | 126 +- test/CodeGenObjC/availability-cf-link-guard.m | 45 + test/CodeGenObjC/availability-check.m | 31 + test/CodeGenObjC/empty-collection-literals.m | 51 + test/CodeGenObjC/exceptions.m | 4 +- test/CodeGenObjC/ivar-type-encoding.m | 35 + test/CodeGenObjC/ubsan-bool.m | 57 +- test/CodeGenObjC/ubsan-nonnull-and-nullability.m | 31 + test/CodeGenObjC/ubsan-nonnull.m | 48 + test/CodeGenObjC/ubsan-nullability.m | 182 + test/CodeGenObjCXX/arc-attrs-abi.mm | 38 + test/CodeGenObjCXX/arc-blocks.mm | 2 +- test/CodeGenObjCXX/arc-move.mm | 8 +- test/CodeGenObjCXX/arc-references.mm | 10 +- test/CodeGenObjCXX/arc.mm | 6 +- test/CodeGenObjCXX/encode.mm | 2 +- test/CodeGenObjCXX/lambda-expressions.mm | 13 + test/CodeGenObjCXX/lambda-to-block.mm | 18 + test/CodeGenObjCXX/literals.mm | 10 +- test/CodeGenObjCXX/objc-weak.mm | 69 + test/CodeGenObjCXX/objfw-exceptions.mm | 17 + .../address-space-constant-initializers.cl | 2 + test/CodeGenOpenCL/address-spaces.cl | 31 +- test/CodeGenOpenCL/amdgcn-large-globals.cl | 12 + test/CodeGenOpenCL/amdgpu-alignment.cl | 522 + test/CodeGenOpenCL/amdgpu-attrs.cl | 12 + .../amdgpu-debug-info-pointer-address-space.cl | 125 + .../amdgpu-debug-info-variable-expression.cl | 131 + test/CodeGenOpenCL/amdgpu-env-amdgiz.cl | 9 + test/CodeGenOpenCL/amdgpu-nullptr.cl | 194 +- test/CodeGenOpenCL/blocks.cl | 17 + test/CodeGenOpenCL/builtins-amdgcn-gfx9.cl | 11 + test/CodeGenOpenCL/builtins-amdgcn-vi.cl | 8 + test/CodeGenOpenCL/builtins-amdgcn.cl | 95 + test/CodeGenOpenCL/cl20-device-side-enqueue.cl | 58 +- test/CodeGenOpenCL/denorms-are-zero.cl | 10 +- test/CodeGenOpenCL/gfx9-fp32-denorms.cl | 13 + test/CodeGenOpenCL/kernel-arg-info.cl | 13 +- test/CodeGenOpenCL/overload.cl | 46 + test/CodeGenOpenCL/preserve_vec3.cl | 24 + test/CodeGenOpenCL/relaxed-fpmath.cl | 29 +- test/CodeGenOpenCL/sampler.cl | 4 + test/CodeGenOpenCL/vla.cl | 12 +- test/CoverageMapping/implicit-def-in-macro.m | 2 +- test/CoverageMapping/macro-expressions.cpp | 2 +- test/CoverageMapping/objc.m | 2 +- test/CoverageMapping/unused_names.c | 13 +- .../lib/linux/aarch64/.keep | 0 .../lib/linux/arm/.keep | 0 .../lib/linux/i386/.keep | 0 .../lib/linux/x86_64/.keep | 0 test/Driver/XRay/xray-instrument-cpu.c | 2 +- test/Driver/aarch64-cpus.c | 52 +- test/Driver/arch-specific-libdir-rpath.c | 85 + test/Driver/arch-specific-libdir.c | 53 + test/Driver/arm-abi.c | 4 + test/Driver/arm-cortex-cpus.c | 6 + test/Driver/arm-execute-only.c | 4 + test/Driver/arm-no-neg-immediates.c | 8 + test/Driver/cl-link-at-file.c | 1 - test/Driver/cl-link.c | 9 +- test/Driver/cl-options.c | 15 + test/Driver/clang_f_opts.c | 12 + test/Driver/crash-report-crashfile.m | 33 +- test/Driver/cuda-no-stack-protector.cu | 23 + test/Driver/darwin-ld-pthread.c | 4 + test/Driver/darwin-simulator-macro.c | 12 + test/Driver/debug-options.c | 31 +- test/Driver/embed-bitcode.c | 11 +- test/Driver/fast-math.c | 21 +- test/Driver/frame-pointer-elim.c | 4 +- test/Driver/frame-pointer.c | 7 + test/Driver/fsanitize.c | 35 +- test/Driver/fuchsia.c | 5 + test/Driver/hexagon-toolchain-elf.c | 8 + test/Driver/immediate-options.c | 5 + test/Driver/include-default-header.cl | 6 + test/Driver/linux-ld.c | 8 + test/Driver/lto-unit.c | 7 + test/Driver/mglobal-merge.c | 4 +- test/Driver/mingw.cpp | 12 - test/Driver/mips-as.c | 79 +- test/Driver/msc-version.c | 2 +- test/Driver/no-arc-exception-silence.m | 2 + test/Driver/openbsd.c | 11 + test/Driver/pic.c | 4 + test/Driver/ppc-features.cpp | 55 +- test/Driver/r600-mcpu.cl | 4 + test/Driver/reloc-model.c | 4 + test/Driver/response-file.c | 9 +- test/Driver/sanitizer-ld.c | 2 + test/Driver/unknown-std.S | 2 + test/Driver/unknown-std.c | 34 + test/Driver/unknown-std.cl | 16 + test/Driver/unknown-std.cpp | 26 + test/Driver/unsupported-faltivec.c | 10 + test/Driver/windows-cross.c | 10 +- test/Driver/x86-target-features.c | 35 + test/FixIt/fixit.cpp | 11 + test/FixIt/no-fixit.cpp | 12 + test/Format/inplace.cpp | 264 + test/Format/style-on-command-line.cpp | 23 +- test/Frontend/aarch64-target-cpu.c | 2 +- test/Frontend/gnu-mcount.c | 7 +- test/Frontend/iframework.c | 1 + test/Frontend/objc-bool-is-bool.m | 6 +- test/Frontend/optimization-remark-with-hotness.c | 8 +- test/Frontend/optimization-remark.c | 6 +- test/Frontend/preprocessed-input.i | 10 + test/Headers/Inputs/usr/include/math.h | 1 + test/Headers/Inputs/usr/include/tgmath.h | 4 + test/Headers/altivec-header.c | 8 +- test/Headers/altivec-intrin.c | 2 +- test/Headers/htm-header.c | 19 + test/Headers/opencl-c-header.cl | 43 +- test/Headers/stdarg-gnuc_va_list.c | 10 + test/Headers/tgmath-darwin.c | 12 + test/Import/forward-declared-struct/Inputs/S1.c | 1 + test/Import/forward-declared-struct/Inputs/S2.c | 3 + test/Import/forward-declared-struct/test.c | 5 + test/Import/member-in-struct/Inputs/S.c | 3 + test/Import/member-in-struct/test.c | 5 + .../multiple-forward-declarations/Inputs/S1.c | 1 + .../multiple-forward-declarations/Inputs/S2.c | 1 + test/Import/multiple-forward-declarations/test.c | 4 + test/Import/overloaded-function/Inputs/F1.c | 1 + test/Import/overloaded-function/Inputs/F2.c | 4 + test/Import/overloaded-function/test.c | 7 + test/Import/struct-in-namespace/Inputs/N1.cpp | 11 + test/Import/struct-in-namespace/Inputs/N2.cpp | 5 + test/Import/struct-in-namespace/Inputs/N3.cpp | 5 + test/Import/struct-in-namespace/test.cpp | 7 + test/Import/template-specialization/Inputs/T.cpp | 14 + test/Import/template-specialization/test.cpp | 7 + test/Index/Core/Inputs/sys/system-head.h | 36 + test/Index/Core/index-pch.c | 13 + test/Index/Core/index-source.cpp | 48 +- test/Index/Core/index-source.m | 264 +- test/Index/Core/index-subkinds.m | 6 +- test/Index/Core/index-system.mm | 3 + test/Index/Core/index-with-module.m | 8 +- test/Index/annotate-nested-name-specifier.cpp | 40 +- test/Index/comment-cplus-decls.cpp | 16 +- test/Index/complete-block-properties.m | 10 +- test/Index/complete-cached-globals.cpp | 25 + test/Index/complete-objc-message.m | 51 + test/Index/complete-preamble.h | 5 + test/Index/crash-recovery-code-complete.c | 1 + test/Index/crash-recovery-modules.m | 3 +- test/Index/crash-recovery-reparse.c | 1 + test/Index/crash-recovery.c | 1 + test/Index/file-refs.cpp | 4 +- test/Index/get-cursor.m | 33 + test/Index/index-decls.m | 2 +- test/Index/opencl-types.cl | 24 + test/Index/overriding-ftemplate-comments.cpp | 2 +- test/Index/overriding-method-comments.mm | 2 +- test/Index/pch-from-libclang.c | 27 + test/Index/print-type.cpp | 140 +- test/Index/recursive-cxx-member-calls.cpp | 4 +- test/Layout/ms-x86-basic-layout.cpp | 4 +- test/Lexer/asm-preproc-no-unicode.s | 8 + test/Lexer/case-insensitive-include-pr31836.sh | 9 + test/Lexer/cxx-features.cpp | 12 +- test/Misc/ast-dump-attr.cpp | 47 + test/Misc/ast-dump-decl.cpp | 8 +- test/Misc/ast-dump-decl.m | 4 +- test/Misc/ast-dump-templates.cpp | 10 +- test/Misc/ast-print-out-of-line-func.cpp | 54 + test/Misc/backend-stack-frame-diagnostics.cpp | 2 +- test/Misc/diag-template-diffing.cpp | 8 +- test/Modules/ExtDebugInfo.cpp | 2 +- .../Frameworks/Sub.framework/Headers/B.h | 1 + .../Frameworks/Sub.framework/Headers/Sub.h | 2 + .../Sub.framework/PrivateHeaders/BPriv.h | 1 + .../Sub.framework/PrivateHeaders/SubPriv.h | 1 + test/Modules/Inputs/Main.framework/Headers/A.h | 1 + test/Modules/Inputs/Main.framework/Headers/Main.h | 2 + .../Inputs/Main.framework/Modules/module.modulemap | 12 + .../Modules/module.private.modulemap | 11 + .../Inputs/Main.framework/PrivateHeaders/APriv.h | 1 + .../Main.framework/PrivateHeaders/MainPriv.h | 1 + test/Modules/Inputs/anon-redecl/a.h | 2 + test/Modules/Inputs/anon-redecl/b.h | 2 + test/Modules/Inputs/anon-redecl/c1.h | 2 + test/Modules/Inputs/anon-redecl/c2.h | 2 + test/Modules/Inputs/anon-redecl/module.modulemap | 6 + test/Modules/Inputs/category_right_sub.h | 5 + test/Modules/Inputs/codegen-flags/foo.h | 4 + test/Modules/Inputs/codegen-flags/foo.modulemap | 1 + test/Modules/Inputs/codegen-flags/use.cpp | 5 + test/Modules/Inputs/codegen-nodep/foo.h | 11 + test/Modules/Inputs/codegen-nodep/foo.modulemap | 1 + test/Modules/Inputs/codegen-opt/bar.h | 2 + test/Modules/Inputs/codegen-opt/bar.modulemap | 1 + test/Modules/Inputs/codegen-opt/foo.h | 10 + test/Modules/Inputs/codegen-opt/foo.modulemap | 1 + test/Modules/Inputs/codegen-opt/use.cpp | 2 + test/Modules/Inputs/codegen/foo.h | 32 + test/Modules/Inputs/codegen/foo.modulemap | 1 + test/Modules/Inputs/codegen/use.cpp | 8 + test/Modules/Inputs/cxx17/decls.h | 3 + test/Modules/Inputs/cxx17/module.modulemap | 1 + test/Modules/Inputs/diag_pragma.h | 10 + test/Modules/Inputs/gnumode-non-benign/module.h | 5 + .../Inputs/gnumode-non-benign/module.modulemap | 1 + test/Modules/Inputs/hidden-names/hidden.h | 3 + test/Modules/Inputs/hidden-names/module.modulemap | 4 + test/Modules/Inputs/hidden-names/visible.h | 2 + .../Inputs/implicit-built-Werror-using-W/convert.h | 8 + .../implicit-built-Werror-using-W/module.modulemap | 3 + .../Modules/Inputs/invalid-module-id/NC-Prefix.pch | 3 + .../invalid-module-id/NC.framework/Headers/NC.h | 1 + .../NC.framework/Headers/NU-Visibility.h | 1 + .../NC.framework/Headers/NUGeometry.h | 1 + .../NC.framework/Modules/module.modulemap | 6 + .../NC.framework/Modules/module.private.modulemap | 5 + .../NC.framework/PrivateHeaders/NUAssert.h | 1 + .../NC.framework/PrivateHeaders/NULog.h | 1 + test/Modules/Inputs/merge-function-defs/a.h | 4 + test/Modules/Inputs/merge-function-defs/b.h | 0 test/Modules/Inputs/merge-function-defs/map | 4 + test/Modules/Inputs/merge-name-for-linkage/b.h | 4 + test/Modules/Inputs/merge-name-for-linkage/c1.h | 1 + test/Modules/Inputs/merge-name-for-linkage/c2.h | 2 + .../Inputs/merge-name-for-linkage/module.modulemap | 1 + test/Modules/Inputs/merge-using-decls/b.h | 6 + test/Modules/Inputs/module.map | 5 + test/Modules/Inputs/outofdate-rebuild/AppKit.h | 3 + test/Modules/Inputs/outofdate-rebuild/Cocoa.h | 5 + test/Modules/Inputs/outofdate-rebuild/CoreText.h | 1 + test/Modules/Inputs/outofdate-rebuild/CoreVideo.h | 3 + test/Modules/Inputs/outofdate-rebuild/Foundation.h | 3 + .../Inputs/outofdate-rebuild/module.modulemap | 19 + test/Modules/Inputs/overloadable-attrs/a.h | 28 + .../Inputs/overloadable-attrs/module.modulemap | 3 + test/Modules/Inputs/pragma_pack_set.h | 3 + test/Modules/Inputs/system-out-of-date/X.h | 2 + test/Modules/Inputs/system-out-of-date/Y.h | 1 + test/Modules/Inputs/system-out-of-date/Z.h | 2 + test/Modules/Inputs/system-out-of-date/module.map | 12 + test/Modules/Inputs/warning-mismatch/Mismatch.h | 1 + test/Modules/Inputs/warning-mismatch/System.h | 2 + .../Inputs/warning-mismatch/module.modulemap | 7 + test/Modules/anon-redecl.cpp | 15 + test/Modules/builtins.m | 1 + test/Modules/codegen-flags.test | 25 + test/Modules/codegen-nodep.test | 13 + test/Modules/codegen-opt.test | 65 + test/Modules/codegen.test | 49 + test/Modules/cxx-templates.cpp | 10 +- test/Modules/cxx17.cpp | 11 + test/Modules/dependency-dump-dependent-module.m | 2 + test/Modules/dependency-dump.m | 2 + test/Modules/diag-pragma.cpp | 47 + test/Modules/diagnostic-options-out-of-date.m | 10 + test/Modules/find-privateheaders.m | 2 + test/Modules/gnumode-non-benign.cpp | 11 + test/Modules/hidden-names.cpp | 13 + test/Modules/implicit-built-Werror-using-W.cpp | 42 + .../Modules/implicit-private-with-different-name.m | 2 +- test/Modules/invalid-pch-module-id.m | 13 + test/Modules/localsubmodulevis.m | 8 + test/Modules/merge-function-defs.cpp | 11 + test/Modules/merge-name-for-linkage.cpp | 1 + test/Modules/merge-using-decls.cpp | 13 + test/Modules/module-impl-with-link.c | 2 +- test/Modules/module_file_info.m | 11 +- test/Modules/module_map_cwd.c | 9 + test/Modules/modules-cache-path-canonicalization.m | 30 + test/Modules/objc-categories.m | 6 + test/Modules/odr_hash.cpp | 953 ++ test/Modules/outofdate-rebuild.m | 15 + test/Modules/overloadable-attrs.cpp | 22 + test/Modules/pragma-pack.cpp | 25 + test/Modules/rebuild.m | 8 +- test/Modules/system-out-of-date-test.m | 17 + test/Modules/system_version.m | 31 - test/Modules/warning-mismatch.m | 13 + test/OpenMP/cancel_messages.cpp | 8 + test/OpenMP/cancellation_point_messages.cpp | 8 + test/OpenMP/declare_reduction_messages.cpp | 14 +- test/OpenMP/distribute_collapse_messages.cpp | 26 +- test/OpenMP/distribute_firstprivate_codegen.cpp | 382 + test/OpenMP/distribute_lastprivate_codegen.cpp | 2 - test/OpenMP/linking.c | 16 +- test/OpenMP/nvptx_target_codegen.cpp | 32 +- test/OpenMP/nvptx_target_parallel_codegen.cpp | 136 + .../nvptx_target_parallel_num_threads_codegen.cpp | 126 + .../nvptx_target_parallel_proc_bind_codegen.cpp | 106 + .../nvptx_target_parallel_reduction_codegen.cpp | 830 ++ test/OpenMP/nvptx_target_printf_codegen.c | 116 + test/OpenMP/nvptx_target_teams_codegen.cpp | 222 + test/OpenMP/nvptx_teams_reduction_codegen.cpp | 1143 ++ test/OpenMP/openmp_check.cpp | 28 +- test/OpenMP/ordered_messages.cpp | 11 + test/OpenMP/target_parallel_codegen.cpp | 802 ++ .../target_parallel_codegen_registration.cpp | 437 + ...target_parallel_codegen_registration_naming.cpp | 66 + test/OpenMP/target_parallel_default_messages.cpp | 3 + .../target_parallel_for_collapse_messages.cpp | 26 +- .../target_parallel_for_ordered_messages.cpp | 26 +- test/OpenMP/target_parallel_if_codegen.cpp | 413 + .../OpenMP/target_parallel_num_threads_codegen.cpp | 344 + test/OpenMP/target_teams_codegen.cpp | 802 ++ test/OpenMP/target_teams_codegen_registration.cpp | 437 + .../target_teams_codegen_registration_naming.cpp | 66 + test/OpenMP/target_teams_num_teams_codegen.cpp | 344 + test/OpenMP/target_teams_thread_limit_codegen.cpp | 357 + test/OpenMP/threadprivate_codegen.cpp | 2 +- test/OpenMP/vla_crash.c | 22 + test/PCH/cxx-dependent-sized-ext-vector.cpp | 18 + test/PCH/cxx-traits.cpp | 1 + test/PCH/cxx-traits.h | 1 + test/PCH/emit-dependencies.c | 9 + test/PCH/macro-undef.cpp | 6 +- test/PCH/ocl_types.h | 3 - test/PCH/pragma-pack.c | 90 + test/Parser/altivec-csk-bool.c | 4 +- test/Parser/altivec.c | 6 +- test/Parser/attr-external-source-symbol-cxx11.cpp | 5 + test/Parser/attr-external-source-symbol.m | 84 + test/Parser/backtrack-off-by-one.cpp | 9 +- test/Parser/cxx-altivec.cpp | 6 +- test/Parser/cxx-template-decl.cpp | 10 + test/Parser/cxx0x-ambig.cpp | 2 +- test/Parser/cxx0x-attributes.cpp | 10 +- test/Parser/cxx11-stmt-attributes.cpp | 1 + .../cxx1z-class-template-argument-deduction.cpp | 194 + test/Parser/declspec-recovery.c | 8 + test/Parser/declspec-supported.c | 10 + test/Parser/eof.cpp | 2 +- test/Parser/objc-available.m | 5 + test/Parser/objc-cxx-keyword-identifiers.mm | 62 + test/Parser/opencl-atomics-cl20.cl | 2 +- test/Parser/pragma-fp.cpp | 64 + test/Parser/vector-cast-define.cl | 10 + test/Parser/vsx.c | 4 +- test/Preprocessor/aarch64-target-features.c | 4 +- test/Preprocessor/arm-acle-6.4.c | 15 + test/Preprocessor/arm-acle-6.5.c | 3 + test/Preprocessor/arm-target-features.c | 32 + test/Preprocessor/init.c | 292 +- test/Preprocessor/predefined-arch-macros.c | 149 +- test/Preprocessor/x86_target_features.c | 4 + test/Profile/Inputs/cxx-class.proftext | 11 + test/Profile/c-generate.c | 3 +- test/Profile/c-ternary.c | 15 + test/Profile/cxx-class.cpp | 36 +- test/Profile/cxx-structors.cpp | 39 +- test/Profile/cxx-virtual-destructor-calls.cpp | 9 - test/Rewriter/lit.local.cfg | 2 +- test/Sema/address-unaligned.c | 16 + test/Sema/address_spaces.c | 2 +- test/Sema/alias-redefinition.c | 3 +- test/Sema/alloc-align-attr.c | 19 + test/Sema/altivec-init.c | 6 +- test/Sema/arm-interrupt-attr.c | 16 + test/Sema/ast-print.c | 9 + test/Sema/attr-deprecated.c | 23 +- test/Sema/attr-external-source-symbol.c | 19 + test/Sema/attr-ifunc.c | 4 + test/Sema/auto-type.c | 2 +- test/Sema/avr-interrupt-attr.c | 8 + test/Sema/avr-signal-attr.c | 8 + test/Sema/builtins-ppc.c | 4 +- test/Sema/builtins-x86.c | 14 + test/Sema/callingconv-cast.c | 13 + test/Sema/const-eval.c | 11 +- test/Sema/declspec-naked.c | 11 + test/Sema/designated-initializers.c | 17 + test/Sema/enable_if.c | 4 +- test/Sema/enum-attr.c | 130 + test/Sema/expr-address-of.c | 3 +- .../invalid-assignment-constant-address-space.c | 8 - test/Sema/knr-def-call.c | 14 +- test/Sema/ms-inline-asm.c | 2 +- test/Sema/nonnull.c | 7 + test/Sema/pr30306.cpp | 15 + test/Sema/template-specialization.cpp | 21 - test/Sema/transparent-union.c | 24 + test/Sema/unaligned-qualifier.c | 4 + test/Sema/vector-ops.c | 114 +- test/Sema/warn-strict-prototypes.c | 9 +- test/Sema/warn-unreachable.c | 47 + test/Sema/xray-log-args-oob.c | 9 + test/Sema/xray-log-args-oob.cpp | 9 + test/SemaCXX/Inputs/std-coroutine.h | 37 + test/SemaCXX/MicrosoftExtensions.cpp | 27 +- test/SemaCXX/P30636.cpp | 20 + test/SemaCXX/PR9572.cpp | 43 +- test/SemaCXX/alloc-align-attr.cpp | 40 + test/SemaCXX/altivec.cpp | 2 +- test/SemaCXX/anonymous-struct.cpp | 3 + test/SemaCXX/array-bounds.cpp | 18 +- test/SemaCXX/attr-deprecated.cpp | 12 +- test/SemaCXX/attr-flag-enum-reject.cpp | 4 - test/SemaCXX/attr-noreturn.cpp | 6 +- .../attr-require-constant-initialization.cpp | 44 +- test/SemaCXX/auto-cxx0x.cpp | 9 + test/SemaCXX/calling-conv-compat.cpp | 44 +- test/SemaCXX/constant-expression-cxx11.cpp | 31 +- test/SemaCXX/constant-expression-cxx1y.cpp | 5 + test/SemaCXX/coreturn.cpp | 32 +- .../coroutine-unhandled_exception-warning.cpp | 24 + test/SemaCXX/coroutines.cpp | 422 +- test/SemaCXX/cxx-altivec.cpp | 2 +- test/SemaCXX/cxx0x-class.cpp | 8 + test/SemaCXX/cxx0x-initializer-aggregates.cpp | 2 +- test/SemaCXX/cxx0x-initializer-constructor.cpp | 3 +- test/SemaCXX/cxx0x-initializer-references.cpp | 16 +- test/SemaCXX/cxx0x-initializer-scalars.cpp | 10 +- .../SemaCXX/cxx1y-contextual-conversion-tweaks.cpp | 2 +- test/SemaCXX/cxx1y-deduced-return-type.cpp | 29 +- test/SemaCXX/cxx1y-generic-lambdas.cpp | 2 +- test/SemaCXX/cxx1y-variable-templates_in_class.cpp | 6 +- .../SemaCXX/cxx1y-variable-templates_top_level.cpp | 6 +- .../cxx1z-class-template-argument-deduction.cpp | 215 + test/SemaCXX/cxx1z-constexpr-lambdas.cpp | 119 +- test/SemaCXX/default-assignment-operator.cpp | 87 +- test/SemaCXX/default-constructor-initializers.cpp | 81 +- .../SemaCXX/designated-initializers-base-class.cpp | 12 + test/SemaCXX/dllimport.cpp | 106 +- test/SemaCXX/enable_if.cpp | 35 +- test/SemaCXX/enum-attr.cpp | 108 + test/SemaCXX/enum-scoped.cpp | 2 +- test/SemaCXX/format-strings.cpp | 20 +- test/SemaCXX/friend3.cpp | 27 + test/SemaCXX/i-c-e-cxx.cpp | 47 +- test/SemaCXX/implicit-exception-spec.cpp | 58 + test/SemaCXX/implicit-member-functions.cpp | 3 +- test/SemaCXX/implicit-virtual-member-functions.cpp | 74 +- test/SemaCXX/libstdcxx_pair_swap_hack.cpp | 2 +- test/SemaCXX/make_integer_seq.cpp | 2 +- test/SemaCXX/nested-name-spec.cpp | 4 +- test/SemaCXX/new-delete.cpp | 71 +- test/SemaCXX/no-wchar.cpp | 8 +- test/SemaCXX/printf-cstr.cpp | 47 +- test/SemaCXX/pseudo-destructors.cpp | 23 + test/SemaCXX/ptrtomember.cpp | 4 + test/SemaCXX/suppress.cpp | 25 + .../SemaCXX/template-multiple-attr-propagation.cpp | 29 + test/SemaCXX/template-specialization.cpp | 21 + test/SemaCXX/type-convert-construct.cpp | 10 +- test/SemaCXX/type-traits.cpp | 130 +- test/SemaCXX/uninitialized.cpp | 2 +- test/SemaCXX/virtual-base-used.cpp | 189 +- .../virtual-member-functions-key-function.cpp | 43 +- test/SemaCXX/warn-bitfield-enum-conversion.cpp | 59 + test/SemaCXX/warn-bool-conversion.cpp | 67 +- .../warn-inconsistent-missing-destructor-override | 33 + test/SemaCXX/warn-shadow.cpp | 107 +- test/SemaCXX/warn-thread-safety-parsing.cpp | 30 +- test/SemaCXX/warn-unused-lambda-capture.cpp | 188 + test/SemaCXX/warn-unused-value.cpp | 6 + test/SemaCXX/zero-length-arrays.cpp | 11 +- test/SemaObjC/arc-peformselector.m | 12 + test/SemaObjC/arc-repeated-weak.mm | 21 +- test/SemaObjC/arc-unavailable-for-weakref.m | 1 + test/SemaObjC/arc.m | 32 +- test/SemaObjC/attr-deprecated.m | 12 +- test/SemaObjC/category-attribute.m | 23 + test/SemaObjC/class-message-protocol-lookup.m | 27 + test/SemaObjC/default-synthesize-3.m | 4 +- test/SemaObjC/objc-class-property.m | 9 + test/SemaObjC/property-typecheck-1.m | 5 + test/SemaObjC/special-dep-unavail-warning.m | 4 +- test/SemaObjC/unsafe-perform-selector.m | 127 + test/SemaObjC/warn-deprecated-implementations.m | 11 +- test/SemaObjCXX/arc-bridged-cast.mm | 16 + test/SemaObjCXX/arc-ptr-comparison.mm | 24 + test/SemaObjCXX/arc-system-header.mm | 2 +- test/SemaObjCXX/arc-templates.mm | 4 +- test/SemaObjCXX/arc-unavailable-for-weakref.mm | 1 + test/SemaObjCXX/blocks.mm | 13 +- test/SemaObjCXX/ivar-construct.mm | 2 +- test/SemaObjCXX/objc-weak-type-traits.mm | 210 + test/SemaObjCXX/objc-weak.mm | 28 + test/SemaObjCXX/overload.mm | 27 + test/SemaOpenCL/access-qualifier.cl | 4 + .../SemaOpenCL/address-spaces-conversions-cl2.0.cl | 37 + test/SemaOpenCL/as_type.cl | 9 +- test/SemaOpenCL/atomic-init.cl | 12 + test/SemaOpenCL/builtins-amdgcn-error-f16.cl | 6 +- test/SemaOpenCL/builtins-amdgcn-error-gfx9.cl | 9 + test/SemaOpenCL/builtins-amdgcn-error.cl | 50 +- test/SemaOpenCL/cl20-device-side-enqueue.cl | 21 +- .../invalid-assignment-constant-address-space.cl | 7 + test/SemaOpenCL/invalid-block.cl | 47 +- test/SemaOpenCL/invalid-logical-ops-1.1.cl | 57 - test/SemaOpenCL/invalid-logical-ops-1.2.cl | 58 - test/SemaOpenCL/logical-ops.cl | 117 + test/SemaOpenCL/sampler_t.cl | 5 +- test/SemaOpenCL/types.cl | 6 + test/SemaOpenCL/vector_swizzle_length.cl | 10 + test/SemaTemplate/alias-templates.cpp | 11 + test/SemaTemplate/deduction.cpp | 58 + test/SemaTemplate/default-expr-arguments-3.cpp | 2 +- test/SemaTemplate/explicit-instantiation.cpp | 4 +- test/SemaTemplate/injected-class-name.cpp | 5 +- test/SemaTemplate/instantiate-c99.cpp | 19 + test/SemaTemplate/instantiate-enum.cpp | 5 +- test/SemaTemplate/instantiate-member-class.cpp | 4 +- test/SemaTemplate/member-access-ambig.cpp | 2 +- test/SemaTemplate/ms-sizeof-missing-typename.cpp | 2 +- test/SemaTemplate/temp_arg.cpp | 2 +- test/SemaTemplate/temp_arg_nontype.cpp | 8 + test/SemaTemplate/temp_arg_template.cpp | 41 +- test/SemaTemplate/temp_arg_template_cxx1z.cpp | 33 +- test/SemaTemplate/temp_explicit.cpp | 25 +- test/SemaTemplate/template-id-expr.cpp | 13 +- test/SemaTemplate/typename-specifier-3.cpp | 3 +- test/SemaTemplate/typename-specifier.cpp | 2 +- test/SemaTemplate/undefined-template.cpp | 8 + .../value-dependent-null-pointer-constant.cpp | 15 +- test/SemaTemplate/virtual-member-functions.cpp | 54 +- test/Tooling/lit.local.cfg | 2 +- test/lit.cfg | 27 +- test/lit.site.cfg.in | 11 +- tools/c-index-test/CMakeLists.txt | 3 + tools/c-index-test/c-index-test.c | 16 +- tools/c-index-test/core_main.cpp | 85 +- tools/clang-check/ClangCheck.cpp | 1 + tools/clang-format-vs/.gitignore | 1 - tools/clang-format-vs/CMakeLists.txt | 7 +- tools/clang-format-vs/ClangFormat.sln | 4 +- .../clang-format-vs/ClangFormat/ClangFormat.csproj | 56 +- .../ClangFormat/ClangFormatPackage.cs | 192 +- .../ClangFormat/RunningDocTableEventsDispatcher.cs | 79 + tools/clang-format-vs/ClangFormat/Vsix.cs | 96 + tools/clang-format-vs/ClangFormat/license.txt | 39 + tools/clang-format-vs/ClangFormat/packages.config | 1 - .../source.extension.vsixmanifest.in | 49 +- tools/clang-format/ClangFormat.cpp | 38 +- tools/clang-format/clang-format-test.el | 126 + tools/clang-format/clang-format.el | 25 +- tools/clang-import-test/clang-import-test.cpp | 64 +- .../clang-offload-bundler/ClangOffloadBundler.cpp | 7 +- tools/driver/CMakeLists.txt | 2 +- tools/driver/cc1as_main.cpp | 10 +- tools/driver/driver.cpp | 5 +- tools/libclang/CIndex.cpp | 18 +- tools/libclang/CIndexCodeCompletion.cpp | 9 +- tools/libclang/CXCursor.cpp | 1 + tools/libclang/CXIndexDataConsumer.cpp | 1 + tools/libclang/CXType.cpp | 14 +- tools/libclang/libclang.exports | 1 + tools/scan-build-py/bin/analyze-build | 4 +- tools/scan-build-py/bin/analyze-build.bat | 1 - tools/scan-build-py/bin/analyze-c++ | 4 +- tools/scan-build-py/bin/analyze-c++.bat | 1 - tools/scan-build-py/bin/analyze-cc | 4 +- tools/scan-build-py/bin/analyze-cc.bat | 1 - tools/scan-build-py/bin/intercept-build | 4 +- tools/scan-build-py/bin/intercept-build.bat | 1 - tools/scan-build-py/bin/intercept-c++ | 4 +- tools/scan-build-py/bin/intercept-c++.bat | 1 - tools/scan-build-py/bin/intercept-cc | 4 +- tools/scan-build-py/bin/intercept-cc.bat | 1 - tools/scan-build-py/bin/scan-build | 4 +- tools/scan-build-py/bin/scan-build.bat | 1 - tools/scan-build-py/libear/__init__.py | 4 +- tools/scan-build-py/libscanbuild/__init__.py | 185 +- tools/scan-build-py/libscanbuild/analyze.py | 766 +- tools/scan-build-py/libscanbuild/arguments.py | 431 + tools/scan-build-py/libscanbuild/clang.py | 17 +- tools/scan-build-py/libscanbuild/intercept.py | 212 +- tools/scan-build-py/libscanbuild/report.py | 85 +- tools/scan-build-py/libscanbuild/runner.py | 302 - tools/scan-build-py/tests/unit/__init__.py | 2 - tools/scan-build-py/tests/unit/test_analyze.py | 328 + tools/scan-build-py/tests/unit/test_intercept.py | 12 +- tools/scan-build-py/tests/unit/test_report.py | 15 +- tools/scan-build-py/tests/unit/test_runner.py | 322 - tools/scan-build/CMakeLists.txt | 3 + tools/scan-view/share/Reporter.py | 3 + tools/scan-view/share/startfile.py | 3 + unittests/ASTMatchers/ASTMatchersNodeTest.cpp | 59 +- unittests/ASTMatchers/ASTMatchersTest.h | 35 +- unittests/Analysis/CFGTest.cpp | 14 +- unittests/Analysis/CMakeLists.txt | 5 +- unittests/Analysis/CloneDetectionTest.cpp | 110 + unittests/Basic/CMakeLists.txt | 1 + unittests/Basic/FileManagerTest.cpp | 52 +- unittests/Basic/MemoryBufferCacheTest.cpp | 94 + unittests/Basic/SourceManagerTest.cpp | 10 +- unittests/Basic/VirtualFileSystemTest.cpp | 102 + unittests/Driver/CMakeLists.txt | 1 + unittests/Format/CMakeLists.txt | 4 +- unittests/Format/FormatTest.cpp | 1805 +-- unittests/Format/FormatTestComments.cpp | 2373 ++++ unittests/Format/FormatTestJS.cpp | 208 +- unittests/Format/FormatTestJava.cpp | 19 + unittests/Format/FormatTestObjC.cpp | 16 +- unittests/Format/FormatTestProto.cpp | 10 + unittests/Format/FormatTestSelective.cpp | 10 +- unittests/Format/NamespaceEndCommentsFixerTest.cpp | 602 + unittests/Lex/LexerTest.cpp | 5 +- unittests/Lex/PPCallbacksTest.cpp | 7 +- unittests/Lex/PPConditionalDirectiveRecordTest.cpp | 4 +- unittests/Tooling/CMakeLists.txt | 3 +- unittests/Tooling/RefactoringTest.cpp | 210 +- utils/TableGen/CMakeLists.txt | 1 + utils/TableGen/ClangAttrEmitter.cpp | 86 +- utils/TableGen/ClangOptionDocEmitter.cpp | 391 + utils/TableGen/TableGen.cpp | 10 +- utils/TableGen/TableGenBackends.h | 1 + www/analyzer/alpha_checks.html | 24 + www/cxx_dr_status.html | 24 +- www/cxx_status.html | 27 +- 1811 files changed, 98682 insertions(+), 44421 deletions(-) create mode 100644 cmake/caches/Apple-stage2-ThinLTO.cmake create mode 100644 cmake/caches/Fuchsia-stage2.cmake create mode 100644 cmake/caches/Fuchsia.cmake create mode 100644 cmake/modules/FindZ3.cmake create mode 100644 docs/ClangCommandLineReference.rst create mode 100644 include/clang/AST/ExternalASTMerger.h create mode 100644 include/clang/AST/ODRHash.h create mode 100644 include/clang/Basic/MemoryBufferCache.h create mode 100644 include/clang/Basic/XRayLists.h create mode 100644 include/clang/CodeGen/ConstantInitBuilder.h create mode 100644 include/clang/CodeGen/ConstantInitFuture.h create mode 100644 include/clang/Driver/ClangOptionDocs.td create mode 100644 include/clang/Driver/XRayArgs.h create mode 100644 include/clang/Parse/RAIIObjectsForParser.h create mode 100644 include/clang/StaticAnalyzer/Core/PathSensitive/SimpleConstraintManager.h create mode 100644 include/clang/Tooling/Refactoring/AtomicChange.h create mode 100644 lib/AST/ExternalASTMerger.cpp create mode 100644 lib/AST/ODRHash.cpp create mode 100644 lib/Basic/MemoryBufferCache.cpp create mode 100644 lib/Basic/XRayLists.cpp delete mode 100644 lib/CodeGen/CGCUDABuiltin.cpp create mode 100644 lib/CodeGen/CGGPUBuiltin.cpp delete mode 100644 lib/CodeGen/ConstantBuilder.h create mode 100644 lib/CodeGen/ConstantInitBuilder.cpp create mode 100644 lib/CodeGen/MacroPPCallbacks.cpp create mode 100644 lib/CodeGen/MacroPPCallbacks.h delete mode 100644 lib/Driver/CrossWindowsToolChain.cpp delete mode 100644 lib/Driver/MSVCToolChain.cpp delete mode 100644 lib/Driver/MinGWToolChain.cpp delete mode 100644 lib/Driver/ToolChains.cpp delete mode 100644 lib/Driver/ToolChains.h create mode 100644 lib/Driver/ToolChains/AMDGPU.cpp create mode 100644 lib/Driver/ToolChains/AMDGPU.h create mode 100644 lib/Driver/ToolChains/AVR.cpp create mode 100644 lib/Driver/ToolChains/AVR.h create mode 100644 lib/Driver/ToolChains/Arch/AArch64.cpp create mode 100644 lib/Driver/ToolChains/Arch/AArch64.h create mode 100644 lib/Driver/ToolChains/Arch/ARM.cpp create mode 100644 lib/Driver/ToolChains/Arch/ARM.h create mode 100644 lib/Driver/ToolChains/Arch/Mips.cpp create mode 100644 lib/Driver/ToolChains/Arch/Mips.h create mode 100644 lib/Driver/ToolChains/Arch/PPC.cpp create mode 100644 lib/Driver/ToolChains/Arch/PPC.h create mode 100644 lib/Driver/ToolChains/Arch/Sparc.cpp create mode 100644 lib/Driver/ToolChains/Arch/Sparc.h create mode 100644 lib/Driver/ToolChains/Arch/SystemZ.cpp create mode 100644 lib/Driver/ToolChains/Arch/SystemZ.h create mode 100644 lib/Driver/ToolChains/Arch/X86.cpp create mode 100644 lib/Driver/ToolChains/Arch/X86.h create mode 100644 lib/Driver/ToolChains/Bitrig.cpp create mode 100644 lib/Driver/ToolChains/Bitrig.h create mode 100644 lib/Driver/ToolChains/Clang.cpp create mode 100644 lib/Driver/ToolChains/Clang.h create mode 100644 lib/Driver/ToolChains/CloudABI.cpp create mode 100644 lib/Driver/ToolChains/CloudABI.h create mode 100644 lib/Driver/ToolChains/CommonArgs.cpp create mode 100644 lib/Driver/ToolChains/CommonArgs.h create mode 100644 lib/Driver/ToolChains/Contiki.cpp create mode 100644 lib/Driver/ToolChains/Contiki.h create mode 100644 lib/Driver/ToolChains/CrossWindows.cpp create mode 100644 lib/Driver/ToolChains/CrossWindows.h create mode 100644 lib/Driver/ToolChains/Cuda.cpp create mode 100644 lib/Driver/ToolChains/Cuda.h create mode 100644 lib/Driver/ToolChains/Darwin.cpp create mode 100644 lib/Driver/ToolChains/Darwin.h create mode 100644 lib/Driver/ToolChains/DragonFly.cpp create mode 100644 lib/Driver/ToolChains/DragonFly.h create mode 100644 lib/Driver/ToolChains/FreeBSD.cpp create mode 100644 lib/Driver/ToolChains/FreeBSD.h create mode 100644 lib/Driver/ToolChains/Fuchsia.cpp create mode 100644 lib/Driver/ToolChains/Fuchsia.h create mode 100644 lib/Driver/ToolChains/Gnu.cpp create mode 100644 lib/Driver/ToolChains/Gnu.h create mode 100644 lib/Driver/ToolChains/Haiku.cpp create mode 100644 lib/Driver/ToolChains/Haiku.h create mode 100644 lib/Driver/ToolChains/Hexagon.cpp create mode 100644 lib/Driver/ToolChains/Hexagon.h create mode 100644 lib/Driver/ToolChains/Lanai.h create mode 100644 lib/Driver/ToolChains/Linux.cpp create mode 100644 lib/Driver/ToolChains/Linux.h create mode 100644 lib/Driver/ToolChains/MSVC.cpp create mode 100644 lib/Driver/ToolChains/MSVC.h create mode 100644 lib/Driver/ToolChains/MSVCSetupApi.h create mode 100644 lib/Driver/ToolChains/MinGW.cpp create mode 100644 lib/Driver/ToolChains/MinGW.h create mode 100644 lib/Driver/ToolChains/Minix.cpp create mode 100644 lib/Driver/ToolChains/Minix.h create mode 100644 lib/Driver/ToolChains/MipsLinux.cpp create mode 100644 lib/Driver/ToolChains/MipsLinux.h create mode 100644 lib/Driver/ToolChains/Myriad.cpp create mode 100644 lib/Driver/ToolChains/Myriad.h create mode 100644 lib/Driver/ToolChains/NaCl.cpp create mode 100644 lib/Driver/ToolChains/NaCl.h create mode 100644 lib/Driver/ToolChains/NetBSD.cpp create mode 100644 lib/Driver/ToolChains/NetBSD.h create mode 100644 lib/Driver/ToolChains/OpenBSD.cpp create mode 100644 lib/Driver/ToolChains/OpenBSD.h create mode 100644 lib/Driver/ToolChains/PS4CPU.cpp create mode 100644 lib/Driver/ToolChains/PS4CPU.h create mode 100644 lib/Driver/ToolChains/Solaris.cpp create mode 100644 lib/Driver/ToolChains/Solaris.h create mode 100644 lib/Driver/ToolChains/TCE.cpp create mode 100644 lib/Driver/ToolChains/TCE.h create mode 100644 lib/Driver/ToolChains/WebAssembly.cpp create mode 100644 lib/Driver/ToolChains/WebAssembly.h create mode 100644 lib/Driver/ToolChains/XCore.cpp create mode 100644 lib/Driver/ToolChains/XCore.h delete mode 100644 lib/Driver/Tools.cpp delete mode 100644 lib/Driver/Tools.h create mode 100644 lib/Driver/XRayArgs.cpp delete mode 100644 lib/Format/Comments.cpp delete mode 100644 lib/Format/Comments.h create mode 100644 lib/Format/NamespaceEndCommentsFixer.cpp create mode 100644 lib/Format/NamespaceEndCommentsFixer.h create mode 100644 lib/Headers/clzerointrin.h delete mode 100644 lib/Parse/RAIIObjectsForParser.h create mode 100644 lib/Sema/CoroutineStmtBuilder.h create mode 100644 lib/StaticAnalyzer/Checkers/MisusedMovedObjectChecker.cpp create mode 100644 lib/StaticAnalyzer/Core/RangedConstraintManager.cpp create mode 100644 lib/StaticAnalyzer/Core/RangedConstraintManager.h delete mode 100644 lib/StaticAnalyzer/Core/SimpleConstraintManager.h create mode 100644 lib/StaticAnalyzer/Core/Z3ConstraintManager.cpp create mode 100644 lib/Tooling/Refactoring/AtomicChange.cpp create mode 100644 lib/Tooling/Refactoring/CMakeLists.txt create mode 100644 test/ASTMerge/class-template-partial-spec/Inputs/class-template-partial-spec1.cpp create mode 100644 test/ASTMerge/class-template-partial-spec/Inputs/class-template-partial-spec2.cpp create mode 100644 test/ASTMerge/class-template-partial-spec/test.cpp create mode 100644 test/Analysis/MisusedMovedObject.cpp create mode 100644 test/Analysis/analyzer_test.py create mode 100644 test/Analysis/explain-svals.c create mode 100644 test/Analysis/gmalloc.c create mode 100644 test/Analysis/openmp-unsupported.c create mode 100644 test/Analysis/taint-diagnostic-visitor.c create mode 100644 test/Analysis/temporaries-callback-order.cpp create mode 100644 test/Analysis/unsupported-types.c create mode 100644 test/Analysis/valist-as-lazycompound.c create mode 100644 test/Analysis/valist-uninitialized-no-undef.c create mode 100644 test/CXX/class.derived/class.member.lookup/p10.cpp create mode 100644 test/CXX/concepts-ts/temp/temp.constr/temp.constr.decl/class-template-decl.cpp create mode 100644 test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p3-1z.cpp create mode 100644 test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.type.class.deduct/p1.cpp create mode 100644 test/CXX/drs/dr21xx.cpp create mode 100644 test/CXX/expr/expr.post/expr.type.conv/p1.cpp create mode 100644 test/CXX/over/over.match/over.match.funcs/over.match.class.deduct/p2.cpp create mode 100644 test/CXX/over/over.match/over.match.funcs/over.match.class.deduct/p3.cpp create mode 100644 test/CXX/temp/temp.deduct.guide/p1.cpp create mode 100644 test/CXX/temp/temp.deduct.guide/p2.cpp create mode 100644 test/CXX/temp/temp.deduct.guide/p3.cpp create mode 100644 test/CXX/temp/temp.res/p3.cpp create mode 100644 test/CodeCompletion/auto_type.c create mode 100644 test/CodeCompletion/keywords.cpp create mode 100644 test/CodeCompletion/pragma-macro-token-caching.c create mode 100644 test/CodeGen/Inputs/debug-info-macro.h create mode 100644 test/CodeGen/Inputs/pgo-sample-thinlto-summary.prof create mode 100644 test/CodeGen/alloc-align-attr.c create mode 100644 test/CodeGen/avr-inline-asm-constraints.c create mode 100644 test/CodeGen/avr-unsupported-inline-asm-constraints.c create mode 100644 test/CodeGen/avr/attributes/interrupt.c create mode 100644 test/CodeGen/avr/attributes/signal.c create mode 100644 test/CodeGen/avr/target-cpu-defines/atmega328p.c create mode 100644 test/CodeGen/avr/target-cpu-defines/attiny104.c create mode 100644 test/CodeGen/avr/target-cpu-defines/common.c create mode 100644 test/CodeGen/builtin-clzero.c create mode 100644 test/CodeGen/debug-info-macro.c create mode 100644 test/CodeGen/default-address-space.c create mode 100644 test/CodeGen/fentry.c create mode 100644 test/CodeGen/ffp-contract-fast-option.cpp create mode 100644 test/CodeGen/fp-contract-fast-pragma.cpp create mode 100644 test/CodeGen/fp-contract-on-pragma.cpp create mode 100644 test/CodeGen/ms-inline-asm-EVEN.c create mode 100644 test/CodeGen/opt-record-MIR.c create mode 100644 test/CodeGen/pgo-sample-thinlto-summary.c create mode 100644 test/CodeGen/pr3997.c create mode 100644 test/CodeGen/thin_link_bitcode.c create mode 100644 test/CodeGen/thinlto-emit-llvm.c create mode 100644 test/CodeGen/thinlto-multi-module.ll create mode 100644 test/CodeGen/ubsan-promoted-arith.cpp create mode 100644 test/CodeGen/ubsan-shift.c create mode 100644 test/CodeGen/unaligned-decl.c create mode 100644 test/CodeGen/unaligned-expr.c create mode 100644 test/CodeGen/unaligned-field.c create mode 100644 test/CodeGen/xop-builtins-cmp.c create mode 100644 test/CodeGen/xray-always-instrument.cpp delete mode 100644 test/CodeGen/xray-attributes-supported-arm.cpp create mode 100644 test/CodeGen/xray-instruction-threshold.cpp create mode 100644 test/CodeGen/xray-log-args.cpp create mode 100644 test/CodeGenCUDA/propagate-metadata.cu create mode 100644 test/CodeGenCXX/atomic-dllexport.cpp create mode 100644 test/CodeGenCXX/debug-info-class-optzns.cpp create mode 100644 test/CodeGenCXX/debug-info-inheriting-constructor.cpp create mode 100644 test/CodeGenCXX/debug-info-ms-dtor-thunks.cpp create mode 100644 test/CodeGenCXX/debug-info-template-deduction-guide.cpp create mode 100644 test/CodeGenCXX/implicit-exception-spec.cpp create mode 100644 test/CodeGenCXX/initializer-list-ctor-order.cpp create mode 100644 test/CodeGenCXX/no-lto-unit.cpp create mode 100644 test/CodeGenCXX/type-metadata-thinlto.cpp create mode 100644 test/CodeGenCXX/ubsan-bitfields.cpp create mode 100644 test/CodeGenCXX/ubsan-global-alignment.cpp create mode 100644 test/CodeGenCXX/ubsan-suppress-checks.cpp create mode 100644 test/CodeGenCXX/ubsan-type-checks.cpp create mode 100644 test/CodeGenCXX/unaligned.cpp create mode 100644 test/CodeGenCoroutines/coro-await.cpp create mode 100644 test/CodeGenCoroutines/coro-cleanup.cpp create mode 100644 test/CodeGenCoroutines/coro-eh-cleanup.cpp create mode 100644 test/CodeGenCoroutines/coro-return.cpp create mode 100644 test/CodeGenObjC/availability-cf-link-guard.m create mode 100644 test/CodeGenObjC/availability-check.m create mode 100644 test/CodeGenObjC/empty-collection-literals.m create mode 100644 test/CodeGenObjC/ivar-type-encoding.m create mode 100644 test/CodeGenObjC/ubsan-nonnull-and-nullability.m create mode 100644 test/CodeGenObjC/ubsan-nonnull.m create mode 100644 test/CodeGenObjC/ubsan-nullability.m create mode 100644 test/CodeGenObjCXX/arc-attrs-abi.mm create mode 100644 test/CodeGenObjCXX/lambda-to-block.mm create mode 100644 test/CodeGenObjCXX/objc-weak.mm create mode 100644 test/CodeGenObjCXX/objfw-exceptions.mm create mode 100644 test/CodeGenOpenCL/amdgcn-large-globals.cl create mode 100644 test/CodeGenOpenCL/amdgpu-alignment.cl create mode 100644 test/CodeGenOpenCL/amdgpu-debug-info-pointer-address-space.cl create mode 100644 test/CodeGenOpenCL/amdgpu-debug-info-variable-expression.cl create mode 100644 test/CodeGenOpenCL/amdgpu-env-amdgiz.cl create mode 100644 test/CodeGenOpenCL/blocks.cl create mode 100644 test/CodeGenOpenCL/builtins-amdgcn-gfx9.cl create mode 100644 test/CodeGenOpenCL/gfx9-fp32-denorms.cl create mode 100644 test/CodeGenOpenCL/overload.cl create mode 100644 test/CodeGenOpenCL/preserve_vec3.cl create mode 100644 test/Driver/Inputs/resource_dir_with_arch_subdir/lib/linux/aarch64/.keep create mode 100644 test/Driver/Inputs/resource_dir_with_arch_subdir/lib/linux/arm/.keep create mode 100644 test/Driver/Inputs/resource_dir_with_arch_subdir/lib/linux/i386/.keep create mode 100644 test/Driver/Inputs/resource_dir_with_arch_subdir/lib/linux/x86_64/.keep create mode 100644 test/Driver/arch-specific-libdir-rpath.c create mode 100644 test/Driver/arch-specific-libdir.c create mode 100644 test/Driver/arm-no-neg-immediates.c create mode 100644 test/Driver/cuda-no-stack-protector.cu create mode 100644 test/Driver/darwin-ld-pthread.c create mode 100644 test/Driver/darwin-simulator-macro.c create mode 100644 test/Driver/include-default-header.cl create mode 100644 test/Driver/lto-unit.c create mode 100644 test/Driver/no-arc-exception-silence.m create mode 100644 test/Driver/reloc-model.c create mode 100644 test/Driver/unknown-std.S create mode 100644 test/Driver/unknown-std.c create mode 100644 test/Driver/unknown-std.cl create mode 100644 test/Driver/unknown-std.cpp create mode 100644 test/Driver/unsupported-faltivec.c create mode 100644 test/Format/inplace.cpp create mode 100644 test/Frontend/preprocessed-input.i create mode 100644 test/Headers/Inputs/usr/include/math.h create mode 100644 test/Headers/Inputs/usr/include/tgmath.h create mode 100644 test/Headers/htm-header.c create mode 100644 test/Headers/stdarg-gnuc_va_list.c create mode 100644 test/Headers/tgmath-darwin.c create mode 100644 test/Import/forward-declared-struct/Inputs/S1.c create mode 100644 test/Import/forward-declared-struct/Inputs/S2.c create mode 100644 test/Import/forward-declared-struct/test.c create mode 100644 test/Import/member-in-struct/Inputs/S.c create mode 100644 test/Import/member-in-struct/test.c create mode 100644 test/Import/multiple-forward-declarations/Inputs/S1.c create mode 100644 test/Import/multiple-forward-declarations/Inputs/S2.c create mode 100644 test/Import/multiple-forward-declarations/test.c create mode 100644 test/Import/overloaded-function/Inputs/F1.c create mode 100644 test/Import/overloaded-function/Inputs/F2.c create mode 100644 test/Import/overloaded-function/test.c create mode 100644 test/Import/struct-in-namespace/Inputs/N1.cpp create mode 100644 test/Import/struct-in-namespace/Inputs/N2.cpp create mode 100644 test/Import/struct-in-namespace/Inputs/N3.cpp create mode 100644 test/Import/struct-in-namespace/test.cpp create mode 100644 test/Import/template-specialization/Inputs/T.cpp create mode 100644 test/Import/template-specialization/test.cpp create mode 100644 test/Index/Core/Inputs/sys/system-head.h create mode 100644 test/Index/Core/index-pch.c create mode 100644 test/Index/Core/index-system.mm create mode 100644 test/Index/complete-cached-globals.cpp create mode 100644 test/Index/opencl-types.cl create mode 100644 test/Index/pch-from-libclang.c create mode 100644 test/Lexer/asm-preproc-no-unicode.s create mode 100755 test/Lexer/case-insensitive-include-pr31836.sh create mode 100644 test/Misc/ast-print-out-of-line-func.cpp create mode 100644 test/Modules/Inputs/Main.framework/Frameworks/Sub.framework/Headers/B.h create mode 100644 test/Modules/Inputs/Main.framework/Frameworks/Sub.framework/Headers/Sub.h create mode 100644 test/Modules/Inputs/Main.framework/Frameworks/Sub.framework/PrivateHeaders/BPriv.h create mode 100644 test/Modules/Inputs/Main.framework/Frameworks/Sub.framework/PrivateHeaders/SubPriv.h create mode 100644 test/Modules/Inputs/Main.framework/Headers/A.h create mode 100644 test/Modules/Inputs/Main.framework/Headers/Main.h create mode 100644 test/Modules/Inputs/Main.framework/Modules/module.modulemap create mode 100644 test/Modules/Inputs/Main.framework/Modules/module.private.modulemap create mode 100644 test/Modules/Inputs/Main.framework/PrivateHeaders/APriv.h create mode 100644 test/Modules/Inputs/Main.framework/PrivateHeaders/MainPriv.h create mode 100644 test/Modules/Inputs/anon-redecl/a.h create mode 100644 test/Modules/Inputs/anon-redecl/b.h create mode 100644 test/Modules/Inputs/anon-redecl/c1.h create mode 100644 test/Modules/Inputs/anon-redecl/c2.h create mode 100644 test/Modules/Inputs/anon-redecl/module.modulemap create mode 100644 test/Modules/Inputs/codegen-flags/foo.h create mode 100644 test/Modules/Inputs/codegen-flags/foo.modulemap create mode 100644 test/Modules/Inputs/codegen-flags/use.cpp create mode 100644 test/Modules/Inputs/codegen-nodep/foo.h create mode 100644 test/Modules/Inputs/codegen-nodep/foo.modulemap create mode 100644 test/Modules/Inputs/codegen-opt/bar.h create mode 100644 test/Modules/Inputs/codegen-opt/bar.modulemap create mode 100644 test/Modules/Inputs/codegen-opt/foo.h create mode 100644 test/Modules/Inputs/codegen-opt/foo.modulemap create mode 100644 test/Modules/Inputs/codegen-opt/use.cpp create mode 100644 test/Modules/Inputs/codegen/foo.h create mode 100644 test/Modules/Inputs/codegen/foo.modulemap create mode 100644 test/Modules/Inputs/codegen/use.cpp create mode 100644 test/Modules/Inputs/cxx17/decls.h create mode 100644 test/Modules/Inputs/cxx17/module.modulemap create mode 100644 test/Modules/Inputs/gnumode-non-benign/module.h create mode 100644 test/Modules/Inputs/gnumode-non-benign/module.modulemap create mode 100644 test/Modules/Inputs/hidden-names/hidden.h create mode 100644 test/Modules/Inputs/hidden-names/module.modulemap create mode 100644 test/Modules/Inputs/hidden-names/visible.h create mode 100644 test/Modules/Inputs/implicit-built-Werror-using-W/convert.h create mode 100644 test/Modules/Inputs/implicit-built-Werror-using-W/module.modulemap create mode 100644 test/Modules/Inputs/invalid-module-id/NC-Prefix.pch create mode 100644 test/Modules/Inputs/invalid-module-id/NC.framework/Headers/NC.h create mode 100644 test/Modules/Inputs/invalid-module-id/NC.framework/Headers/NU-Visibility.h create mode 100644 test/Modules/Inputs/invalid-module-id/NC.framework/Headers/NUGeometry.h create mode 100644 test/Modules/Inputs/invalid-module-id/NC.framework/Modules/module.modulemap create mode 100644 test/Modules/Inputs/invalid-module-id/NC.framework/Modules/module.private.modulemap create mode 100644 test/Modules/Inputs/invalid-module-id/NC.framework/PrivateHeaders/NUAssert.h create mode 100644 test/Modules/Inputs/invalid-module-id/NC.framework/PrivateHeaders/NULog.h create mode 100644 test/Modules/Inputs/merge-function-defs/a.h create mode 100644 test/Modules/Inputs/merge-function-defs/b.h create mode 100644 test/Modules/Inputs/merge-function-defs/map create mode 100644 test/Modules/Inputs/merge-name-for-linkage/c1.h create mode 100644 test/Modules/Inputs/merge-name-for-linkage/c2.h create mode 100644 test/Modules/Inputs/outofdate-rebuild/AppKit.h create mode 100644 test/Modules/Inputs/outofdate-rebuild/Cocoa.h create mode 100644 test/Modules/Inputs/outofdate-rebuild/CoreText.h create mode 100644 test/Modules/Inputs/outofdate-rebuild/CoreVideo.h create mode 100644 test/Modules/Inputs/outofdate-rebuild/Foundation.h create mode 100644 test/Modules/Inputs/outofdate-rebuild/module.modulemap create mode 100644 test/Modules/Inputs/overloadable-attrs/a.h create mode 100644 test/Modules/Inputs/overloadable-attrs/module.modulemap create mode 100644 test/Modules/Inputs/pragma_pack_set.h create mode 100644 test/Modules/Inputs/system-out-of-date/X.h create mode 100644 test/Modules/Inputs/system-out-of-date/Y.h create mode 100644 test/Modules/Inputs/system-out-of-date/Z.h create mode 100644 test/Modules/Inputs/system-out-of-date/module.map create mode 100644 test/Modules/Inputs/warning-mismatch/Mismatch.h create mode 100644 test/Modules/Inputs/warning-mismatch/System.h create mode 100644 test/Modules/Inputs/warning-mismatch/module.modulemap create mode 100644 test/Modules/anon-redecl.cpp create mode 100644 test/Modules/codegen-flags.test create mode 100644 test/Modules/codegen-nodep.test create mode 100644 test/Modules/codegen-opt.test create mode 100644 test/Modules/codegen.test create mode 100644 test/Modules/cxx17.cpp create mode 100644 test/Modules/diag-pragma.cpp create mode 100644 test/Modules/find-privateheaders.m create mode 100644 test/Modules/gnumode-non-benign.cpp create mode 100644 test/Modules/hidden-names.cpp create mode 100644 test/Modules/implicit-built-Werror-using-W.cpp create mode 100644 test/Modules/invalid-pch-module-id.m create mode 100644 test/Modules/localsubmodulevis.m create mode 100644 test/Modules/merge-function-defs.cpp create mode 100644 test/Modules/module_map_cwd.c create mode 100644 test/Modules/modules-cache-path-canonicalization.m create mode 100644 test/Modules/odr_hash.cpp create mode 100644 test/Modules/outofdate-rebuild.m create mode 100644 test/Modules/overloadable-attrs.cpp create mode 100644 test/Modules/pragma-pack.cpp create mode 100644 test/Modules/system-out-of-date-test.m delete mode 100644 test/Modules/system_version.m create mode 100644 test/Modules/warning-mismatch.m create mode 100644 test/OpenMP/distribute_firstprivate_codegen.cpp create mode 100644 test/OpenMP/nvptx_target_parallel_codegen.cpp create mode 100644 test/OpenMP/nvptx_target_parallel_num_threads_codegen.cpp create mode 100644 test/OpenMP/nvptx_target_parallel_proc_bind_codegen.cpp create mode 100644 test/OpenMP/nvptx_target_parallel_reduction_codegen.cpp create mode 100644 test/OpenMP/nvptx_target_printf_codegen.c create mode 100644 test/OpenMP/nvptx_target_teams_codegen.cpp create mode 100644 test/OpenMP/nvptx_teams_reduction_codegen.cpp create mode 100644 test/OpenMP/target_parallel_codegen.cpp create mode 100644 test/OpenMP/target_parallel_codegen_registration.cpp create mode 100644 test/OpenMP/target_parallel_codegen_registration_naming.cpp create mode 100644 test/OpenMP/target_parallel_if_codegen.cpp create mode 100644 test/OpenMP/target_parallel_num_threads_codegen.cpp create mode 100644 test/OpenMP/target_teams_codegen.cpp create mode 100644 test/OpenMP/target_teams_codegen_registration.cpp create mode 100644 test/OpenMP/target_teams_codegen_registration_naming.cpp create mode 100644 test/OpenMP/target_teams_num_teams_codegen.cpp create mode 100644 test/OpenMP/target_teams_thread_limit_codegen.cpp create mode 100644 test/OpenMP/vla_crash.c create mode 100644 test/PCH/cxx-dependent-sized-ext-vector.cpp create mode 100644 test/PCH/emit-dependencies.c create mode 100644 test/PCH/pragma-pack.c create mode 100644 test/Parser/attr-external-source-symbol-cxx11.cpp create mode 100644 test/Parser/attr-external-source-symbol.m create mode 100644 test/Parser/cxx1z-class-template-argument-deduction.cpp create mode 100644 test/Parser/declspec-recovery.c create mode 100644 test/Parser/declspec-supported.c create mode 100644 test/Parser/objc-cxx-keyword-identifiers.mm create mode 100644 test/Parser/pragma-fp.cpp create mode 100644 test/Parser/vector-cast-define.cl create mode 100644 test/Profile/c-ternary.c create mode 100644 test/Sema/address-unaligned.c create mode 100644 test/Sema/alloc-align-attr.c create mode 100644 test/Sema/attr-external-source-symbol.c create mode 100644 test/Sema/avr-interrupt-attr.c create mode 100644 test/Sema/avr-signal-attr.c create mode 100644 test/Sema/declspec-naked.c create mode 100644 test/Sema/enum-attr.c delete mode 100644 test/Sema/invalid-assignment-constant-address-space.c create mode 100644 test/Sema/pr30306.cpp delete mode 100644 test/Sema/template-specialization.cpp create mode 100644 test/Sema/unaligned-qualifier.c create mode 100644 test/Sema/xray-log-args-oob.c create mode 100644 test/Sema/xray-log-args-oob.cpp create mode 100644 test/SemaCXX/Inputs/std-coroutine.h create mode 100644 test/SemaCXX/P30636.cpp create mode 100644 test/SemaCXX/alloc-align-attr.cpp delete mode 100644 test/SemaCXX/attr-flag-enum-reject.cpp create mode 100644 test/SemaCXX/coroutine-unhandled_exception-warning.cpp create mode 100644 test/SemaCXX/cxx1z-class-template-argument-deduction.cpp create mode 100644 test/SemaCXX/designated-initializers-base-class.cpp create mode 100644 test/SemaCXX/enum-attr.cpp create mode 100644 test/SemaCXX/friend3.cpp create mode 100644 test/SemaCXX/suppress.cpp create mode 100644 test/SemaCXX/template-multiple-attr-propagation.cpp create mode 100644 test/SemaCXX/template-specialization.cpp create mode 100644 test/SemaCXX/warn-bitfield-enum-conversion.cpp create mode 100644 test/SemaCXX/warn-inconsistent-missing-destructor-override create mode 100644 test/SemaCXX/warn-unused-lambda-capture.cpp create mode 100644 test/SemaObjC/category-attribute.m create mode 100644 test/SemaObjC/unsafe-perform-selector.m create mode 100644 test/SemaObjCXX/arc-ptr-comparison.mm create mode 100644 test/SemaObjCXX/objc-weak-type-traits.mm create mode 100644 test/SemaObjCXX/objc-weak.mm create mode 100644 test/SemaOpenCL/atomic-init.cl create mode 100644 test/SemaOpenCL/builtins-amdgcn-error-gfx9.cl create mode 100644 test/SemaOpenCL/invalid-assignment-constant-address-space.cl delete mode 100644 test/SemaOpenCL/invalid-logical-ops-1.1.cl delete mode 100644 test/SemaOpenCL/invalid-logical-ops-1.2.cl create mode 100644 test/SemaOpenCL/logical-ops.cl create mode 100644 test/SemaOpenCL/types.cl create mode 100644 test/SemaOpenCL/vector_swizzle_length.cl create mode 100644 tools/clang-format-vs/ClangFormat/RunningDocTableEventsDispatcher.cs create mode 100644 tools/clang-format-vs/ClangFormat/Vsix.cs create mode 100644 tools/clang-format-vs/ClangFormat/license.txt create mode 100644 tools/clang-format/clang-format-test.el delete mode 100644 tools/scan-build-py/bin/analyze-build.bat delete mode 100644 tools/scan-build-py/bin/analyze-c++.bat delete mode 100644 tools/scan-build-py/bin/analyze-cc.bat delete mode 100644 tools/scan-build-py/bin/intercept-build.bat delete mode 100644 tools/scan-build-py/bin/intercept-c++.bat delete mode 100644 tools/scan-build-py/bin/intercept-cc.bat delete mode 100644 tools/scan-build-py/bin/scan-build.bat create mode 100644 tools/scan-build-py/libscanbuild/arguments.py delete mode 100644 tools/scan-build-py/libscanbuild/runner.py delete mode 100644 tools/scan-build-py/tests/unit/test_runner.py create mode 100644 unittests/Analysis/CloneDetectionTest.cpp create mode 100644 unittests/Basic/MemoryBufferCacheTest.cpp create mode 100644 unittests/Format/FormatTestComments.cpp create mode 100644 unittests/Format/NamespaceEndCommentsFixerTest.cpp create mode 100644 utils/TableGen/ClangOptionDocEmitter.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index ff1ff210b56d..ca696b1ce79f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -82,6 +82,7 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR ) set(LLVM_SHLIB_OUTPUT_INTDIR ${LLVM_LIBRARY_OUTPUT_INTDIR}) endif() + option(LLVM_ENABLE_WARNINGS "Enable compiler warnings." ON) option(LLVM_INSTALL_TOOLCHAIN_ONLY "Only include toolchain files in the 'install' target." OFF) @@ -185,6 +186,8 @@ if (LIBXML2_FOUND) set(CLANG_HAVE_LIBXML 1) endif() +find_package(Z3 4.5) + include(CheckIncludeFile) check_include_file(sys/resource.h CLANG_HAVE_RLIMITS) @@ -329,10 +332,6 @@ if (APPLE) endif() endif() -configure_file( - ${CLANG_SOURCE_DIR}/include/clang/Config/config.h.cmake - ${CLANG_BINARY_DIR}/include/clang/Config/config.h) - include(CMakeParseArguments) include(AddClang) @@ -368,21 +367,21 @@ option(CLANG_BUILD_TOOLS "Build the Clang tools. If OFF, just generate build targets." ON) option(CLANG_ENABLE_ARCMT "Build ARCMT." ON) -if (CLANG_ENABLE_ARCMT) - set(ENABLE_CLANG_ARCMT "1") -else() - set(ENABLE_CLANG_ARCMT "0") -endif() - option(CLANG_ENABLE_STATIC_ANALYZER "Build static analyzer." ON) -if (CLANG_ENABLE_STATIC_ANALYZER) - set(ENABLE_CLANG_STATIC_ANALYZER "1") -else() - set(ENABLE_CLANG_STATIC_ANALYZER "0") + +option(CLANG_ANALYZER_BUILD_Z3 + "Build the static analyzer with the Z3 constraint manager." OFF) + +if(NOT CLANG_ENABLE_STATIC_ANALYZER AND (CLANG_ENABLE_ARCMT OR CLANG_ANALYZER_BUILD_Z3)) + message(FATAL_ERROR "Cannot disable static analyzer while enabling ARCMT or Z3") endif() -if (NOT CLANG_ENABLE_STATIC_ANALYZER AND CLANG_ENABLE_ARCMT) - message(FATAL_ERROR "Cannot disable static analyzer while enabling ARCMT") +if(CLANG_ANALYZER_BUILD_Z3) + if(Z3_FOUND) + set(CLANG_ANALYZER_WITH_Z3 1) + else() + message(FATAL_ERROR "Cannot find Z3 header file or shared library") + endif() endif() if(CLANG_ENABLE_ARCMT) @@ -419,11 +418,6 @@ add_subdirectory(tools) add_subdirectory(runtime) option(CLANG_BUILD_EXAMPLES "Build CLANG example programs by default." OFF) -if (CLANG_BUILD_EXAMPLES) - set(ENABLE_CLANG_EXAMPLES "1") -else() - set(ENABLE_CLANG_EXAMPLES "0") -endif() add_subdirectory(examples) if(APPLE) @@ -519,6 +513,10 @@ if (CLANG_ENABLE_BOOTSTRAP) set(STAMP_DIR ${CMAKE_CURRENT_BINARY_DIR}/${NEXT_CLANG_STAGE}-stamps/) set(BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/${NEXT_CLANG_STAGE}-bins/) + if(BOOTSTRAP_LLVM_ENABLE_LLD) + add_dependencies(clang-bootstrap-deps lld) + endif() + # If the next stage is LTO we need to depend on LTO and possibly lld or LLVMgold if(BOOTSTRAP_LLVM_ENABLE_LTO OR LLVM_ENABLE_LTO AND NOT LLVM_BUILD_INSTRUMENTED) if(APPLE) @@ -535,9 +533,7 @@ if (CLANG_ENABLE_BOOTSTRAP) -DDYLD_LIBRARY_PATH=${LLVM_LIBRARY_OUTPUT_INTDIR}) elseif(NOT WIN32) add_dependencies(clang-bootstrap-deps llvm-ar llvm-ranlib) - if(BOOTSTRAP_LLVM_ENABLE_LLD) - add_dependencies(clang-bootstrap-deps lld) - elseif(LLVM_BINUTILS_INCDIR) + if(NOT BOOTSTRAP_LLVM_ENABLE_LLD AND LLVM_BINUTILS_INCDIR) add_dependencies(clang-bootstrap-deps LLVMgold) endif() set(LTO_AR -DCMAKE_AR=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-ar) @@ -700,3 +696,7 @@ endif() if (LLVM_ADD_NATIVE_VISUALIZERS_TO_SOLUTION) add_subdirectory(utils/ClangVisualizers) endif() + +configure_file( + ${CLANG_SOURCE_DIR}/include/clang/Config/config.h.cmake + ${CLANG_BINARY_DIR}/include/clang/Config/config.h) diff --git a/bindings/python/clang/cindex.py b/bindings/python/clang/cindex.py index cf867bbf7d0b..48fc8b13a209 100644 --- a/bindings/python/clang/cindex.py +++ b/bindings/python/clang/cindex.py @@ -1887,6 +1887,7 @@ TypeKind.OBJCID = TypeKind(27) TypeKind.OBJCCLASS = TypeKind(28) TypeKind.OBJCSEL = TypeKind(29) TypeKind.FLOAT128 = TypeKind(30) +TypeKind.HALF = TypeKind(31) TypeKind.COMPLEX = TypeKind(100) TypeKind.POINTER = TypeKind(101) TypeKind.BLOCKPOINTER = TypeKind(102) diff --git a/cmake/caches/Apple-stage2-ThinLTO.cmake b/cmake/caches/Apple-stage2-ThinLTO.cmake new file mode 100644 index 000000000000..54e54e306e7a --- /dev/null +++ b/cmake/caches/Apple-stage2-ThinLTO.cmake @@ -0,0 +1,6 @@ +# This file sets up a CMakeCache for Apple-style stage2 ThinLTO bootstrap. It is +# specified by the stage1 build. + + +set(LLVM_ENABLE_LTO THIN CACHE BOOL "") +include(${CMAKE_CURRENT_LIST_DIR}/Apple-stage2.cmake) diff --git a/cmake/caches/Fuchsia-stage2.cmake b/cmake/caches/Fuchsia-stage2.cmake new file mode 100644 index 000000000000..2e1e9a155e14 --- /dev/null +++ b/cmake/caches/Fuchsia-stage2.cmake @@ -0,0 +1,66 @@ +# This file sets up a CMakeCache for the second stage of a Fuchsia toolchain +# build. + +set(LLVM_TARGETS_TO_BUILD X86;AArch64 CACHE STRING "") + +set(PACKAGE_VENDOR Fuchsia CACHE STRING "") + +set(LLVM_INCLUDE_EXAMPLES OFF CACHE BOOL "") +set(LLVM_INCLUDE_DOCS OFF CACHE BOOL "") +set(LLVM_TOOL_CLANG_TOOLS_EXTRA_BUILD OFF CACHE BOOL "") +set(LLVM_ENABLE_ZLIB ON CACHE BOOL "") +set(LLVM_ENABLE_BACKTRACES OFF CACHE BOOL "") +set(LLVM_EXTERNALIZE_DEBUGINFO ON CACHE BOOL "") +set(CLANG_PLUGIN_SUPPORT OFF CACHE BOOL "") + +set(LLVM_ENABLE_LTO ON CACHE BOOL "") +if(NOT APPLE) + set(LLVM_ENABLE_LLD ON CACHE BOOL "") + set(CLANG_DEFAULT_LINKER lld CACHE STRING "") +endif() + +if(APPLE) + set(LLDB_CODESIGN_IDENTITY "" CACHE STRING "") +endif() + +set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "") +set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -gline-tables-only -DNDEBUG" CACHE STRING "") +set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -gline-tables-only -DNDEBUG" CACHE STRING "") + +set(LLVM_BUILTIN_TARGETS "x86_64-fuchsia-none;aarch64-fuchsia-none" CACHE STRING "") +set(BUILTINS_x86_64-fuchsia-none_CMAKE_SYSROOT ${FUCHSIA_SYSROOT} CACHE STRING "") +set(BUILTINS_x86_64-fuchsia-none_CMAKE_SYSTEM_NAME Fuchsia CACHE STRING "") +set(BUILTINS_aarch64-fuchsia-none_CMAKE_SYSROOT ${FUCHSIA_SYSROOT} CACHE STRING "") +set(BUILTINS_aarch64-fuchsia-none_CMAKE_SYSTEM_NAME Fuchsia CACHE STRING "") + +# Setup toolchain. +set(LLVM_INSTALL_TOOLCHAIN_ONLY ON CACHE BOOL "") +set(LLVM_TOOLCHAIN_TOOLS + llvm-ar + llvm-cov + llvm-cxxfilt + llvm-dwarfdump + llvm-dsymutil + llvm-lib + llvm-nm + llvm-objdump + llvm-profdata + llvm-ranlib + llvm-readobj + llvm-size + llvm-symbolizer + CACHE STRING "") + +set(LLVM_DISTRIBUTION_COMPONENTS + clang + lld + lldb + liblldb + LTO + clang-format + clang-headers + builtins-x86_64-fuchsia-none + builtins-aarch64-fuchsia-none + runtimes + ${LLVM_TOOLCHAIN_TOOLS} + CACHE STRING "") diff --git a/cmake/caches/Fuchsia.cmake b/cmake/caches/Fuchsia.cmake new file mode 100644 index 000000000000..c8a8cf6d58b7 --- /dev/null +++ b/cmake/caches/Fuchsia.cmake @@ -0,0 +1,50 @@ +# This file sets up a CMakeCache for a Fuchsia toolchain build. + +set(LLVM_TARGETS_TO_BUILD Native CACHE STRING "") + +set(PACKAGE_VENDOR Fuchsia CACHE STRING "") + +set(LLVM_INCLUDE_EXAMPLES OFF CACHE BOOL "") +set(LLVM_INCLUDE_TESTS OFF CACHE BOOL "") +set(LLVM_INCLUDE_DOCS OFF CACHE BOOL "") +set(CLANG_INCLUDE_TESTS OFF CACHE BOOL "") +set(LLVM_ENABLE_ZLIB OFF CACHE BOOL "") +set(LLVM_ENABLE_BACKTRACES OFF CACHE BOOL "") +set(CLANG_PLUGIN_SUPPORT OFF CACHE BOOL "") + +set(CMAKE_BUILD_TYPE Release CACHE STRING "") + +set(BOOTSTRAP_LLVM_ENABLE_LTO ON CACHE BOOL "") +if(NOT APPLE) + set(BOOTSTRAP_LLVM_ENABLE_LLD ON CACHE BOOL "") +endif() + +if(APPLE) + set(COMPILER_RT_ENABLE_IOS OFF CACHE BOOL "") + set(COMPILER_RT_ENABLE_TVOS OFF CACHE BOOL "") + set(COMPILER_RT_ENABLE_WATCHOS OFF CACHE BOOL "") +endif() + +set(CLANG_BOOTSTRAP_TARGETS + check-all + check-llvm + check-clang + llvm-config + test-suite + test-depends + llvm-test-depends + clang-test-depends + distribution + install-distribution + clang CACHE STRING "") + +if(FUCHSIA_SYSROOT) + set(EXTRA_ARGS -DFUCHSIA_SYSROOT=${FUCHSIA_SYSROOT}) +endif() + +# Setup the bootstrap build. +set(CLANG_ENABLE_BOOTSTRAP ON CACHE BOOL "") +set(CLANG_BOOTSTRAP_CMAKE_ARGS + ${EXTRA_ARGS} + -C ${CMAKE_CURRENT_LIST_DIR}/Fuchsia-stage2.cmake + CACHE STRING "") diff --git a/cmake/modules/CMakeLists.txt b/cmake/modules/CMakeLists.txt index b784c0d215ea..be6d1d7257bc 100644 --- a/cmake/modules/CMakeLists.txt +++ b/cmake/modules/CMakeLists.txt @@ -4,17 +4,27 @@ set(CLANG_INSTALL_PACKAGE_DIR lib${LLVM_LIBDIR_SUFFIX}/cmake/clang) set(clang_cmake_builddir "${CMAKE_BINARY_DIR}/${CLANG_INSTALL_PACKAGE_DIR}") +# Keep this in sync with llvm/cmake/CMakeLists.txt! +set(LLVM_INSTALL_PACKAGE_DIR lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm) +set(llvm_cmake_builddir "${LLVM_BINARY_DIR}/${LLVM_INSTALL_PACKAGE_DIR}") + get_property(CLANG_EXPORTS GLOBAL PROPERTY CLANG_EXPORTS) export(TARGETS ${CLANG_EXPORTS} FILE ${clang_cmake_builddir}/ClangTargets.cmake) # Generate ClangConfig.cmake for the build tree. set(CLANG_CONFIG_CMAKE_DIR "${clang_cmake_builddir}") +set(CLANG_CONFIG_LLVM_CMAKE_DIR "${llvm_cmake_builddir}") set(CLANG_CONFIG_EXPORTS_FILE "${clang_cmake_builddir}/ClangTargets.cmake") +set(CLANG_CONFIG_INCLUDE_DIRS + "${CLANG_SOURCE_DIR}/include" + "${CLANG_BINARY_DIR}/include" + ) configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/ClangConfig.cmake.in ${clang_cmake_builddir}/ClangConfig.cmake @ONLY) set(CLANG_CONFIG_CMAKE_DIR) +set(CLANG_CONFIG_LLVM_CMAKE_DIR) set(CLANG_CONFIG_EXPORTS_FILE) # Generate ClangConfig.cmake for the install tree. @@ -29,7 +39,11 @@ foreach(p ${_count}) get_filename_component(CLANG_INSTALL_PREFIX \"\${CLANG_INSTALL_PREFIX}\" PATH)") endforeach(p) set(CLANG_CONFIG_CMAKE_DIR "\${CLANG_INSTALL_PREFIX}/${CLANG_INSTALL_PACKAGE_DIR}") +set(CLANG_CONFIG_LLVM_CMAKE_DIR "\${CLANG_INSTALL_PREFIX}/${LLVM_INSTALL_PACKAGE_DIR}") set(CLANG_CONFIG_EXPORTS_FILE "\${CLANG_CMAKE_DIR}/ClangTargets.cmake") +set(CLANG_CONFIG_INCLUDE_DIRS + "\${CLANG_INSTALL_PREFIX}/include" + ) configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/ClangConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/ClangConfig.cmake diff --git a/cmake/modules/ClangConfig.cmake.in b/cmake/modules/ClangConfig.cmake.in index a946944dd991..03bca691c2b6 100644 --- a/cmake/modules/ClangConfig.cmake.in +++ b/cmake/modules/ClangConfig.cmake.in @@ -1,11 +1,13 @@ # This file allows users to call find_package(Clang) and pick up our targets. -find_package(LLVM REQUIRED CONFIG) - @CLANG_CONFIG_CODE@ +find_package(LLVM REQUIRED CONFIG + HINTS "@CLANG_CONFIG_LLVM_CMAKE_DIR@") + set(CLANG_EXPORTED_TARGETS "@CLANG_EXPORTS@") set(CLANG_CMAKE_DIR "@CLANG_CONFIG_CMAKE_DIR@") +set(CLANG_INCLUDE_DIRS "@CLANG_CONFIG_INCLUDE_DIRS@") # Provide all our library targets to users. include("@CLANG_CONFIG_EXPORTS_FILE@") diff --git a/cmake/modules/FindZ3.cmake b/cmake/modules/FindZ3.cmake new file mode 100644 index 000000000000..779ef928da1b --- /dev/null +++ b/cmake/modules/FindZ3.cmake @@ -0,0 +1,28 @@ +find_path(Z3_INCLUDE_DIR NAMES z3.h + PATH_SUFFIXES libz3 z3 + ) + +find_library(Z3_LIBRARIES NAMES z3 libz3 + ) + +find_program(Z3_EXECUTABLE z3) + +if(Z3_INCLUDE_DIR AND Z3_EXECUTABLE) + execute_process (COMMAND ${Z3_EXECUTABLE} -version + OUTPUT_VARIABLE libz3_version_str + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + + string(REGEX REPLACE "^Z3 version ([0-9.]+)" "\\1" + Z3_VERSION_STRING "${libz3_version_str}") + unset(libz3_version_str) +endif() + +# handle the QUIETLY and REQUIRED arguments and set Z3_FOUND to TRUE if +# all listed variables are TRUE +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(Z3 + REQUIRED_VARS Z3_LIBRARIES Z3_INCLUDE_DIR + VERSION_VAR Z3_VERSION_STRING) + +mark_as_advanced(Z3_INCLUDE_DIR Z3_LIBRARIES) diff --git a/docs/AttributeReference.rst b/docs/AttributeReference.rst index db4812afdaa0..a763ddeaeb10 100644 --- a/docs/AttributeReference.rst +++ b/docs/AttributeReference.rst @@ -1,3119 +1,13 @@ .. ------------------------------------------------------------------- NOTE: This file is automatically generated by running clang-tblgen - -gen-attr-docs. Do not edit this file by hand!! + -gen-attr-docs. Do not edit this file by hand!! The contents for + this file are automatically generated by a server-side process. + + Please do not commit this file. The file exists for local testing + purposes only. ------------------------------------------------------------------- =================== Attributes in Clang -=================== -.. contents:: - :local: - -Introduction -============ - -This page lists the attributes currently supported by Clang. - -Function Attributes -=================== - - -interrupt ---------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","","","", "" - -Clang supports the GNU style ``__attribute__((interrupt("TYPE")))`` attribute on -ARM targets. This attribute may be attached to a function definition and -instructs the backend to generate appropriate function entry/exit code so that -it can be used directly as an interrupt service routine. - -The parameter passed to the interrupt attribute is optional, but if -provided it must be a string literal with one of the following values: "IRQ", -"FIQ", "SWI", "ABORT", "UNDEF". - -The semantics are as follows: - -- If the function is AAPCS, Clang instructs the backend to realign the stack to - 8 bytes on entry. This is a general requirement of the AAPCS at public - interfaces, but may not hold when an exception is taken. Doing this allows - other AAPCS functions to be called. -- If the CPU is M-class this is all that needs to be done since the architecture - itself is designed in such a way that functions obeying the normal AAPCS ABI - constraints are valid exception handlers. -- If the CPU is not M-class, the prologue and epilogue are modified to save all - non-banked registers that are used, so that upon return the user-mode state - will not be corrupted. Note that to avoid unnecessary overhead, only - general-purpose (integer) registers are saved in this way. If VFP operations - are needed, that state must be saved manually. - - Specifically, interrupt kinds other than "FIQ" will save all core registers - except "lr" and "sp". "FIQ" interrupts will save r0-r7. -- If the CPU is not M-class, the return instruction is changed to one of the - canonical sequences permitted by the architecture for exception return. Where - possible the function itself will make the necessary "lr" adjustments so that - the "preferred return address" is selected. - - Unfortunately the compiler is unable to make this guarantee for an "UNDEF" - handler, where the offset from "lr" to the preferred return address depends on - the execution state of the code which generated the exception. In this case - a sequence equivalent to "movs pc, lr" will be used. - - -abi_tag (gnu::abi_tag) ----------------------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","X","","", "" - -The ``abi_tag`` attribute can be applied to a function, variable, class or -inline namespace declaration to modify the mangled name of the entity. It gives -the ability to distinguish between different versions of the same entity but -with different ABI versions supported. For example, a newer version of a class -could have a different set of data members and thus have a different size. Using -the ``abi_tag`` attribute, it is possible to have different mangled names for -a global variable of the class type. Therefor, the old code could keep using -the old manged name and the new code will use the new mangled name with tags. - - -acquire_capability (acquire_shared_capability, clang::acquire_capability, clang::acquire_shared_capability) ------------------------------------------------------------------------------------------------------------ -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","X","","", "" - -Marks a function as acquiring a capability. - - -alloc_size (gnu::alloc_size) ----------------------------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","X","","", "" - -The ``alloc_size`` attribute can be placed on functions that return pointers in -order to hint to the compiler how many bytes of memory will be available at the -returned poiner. ``alloc_size`` takes one or two arguments. - -- ``alloc_size(N)`` implies that argument number N equals the number of - available bytes at the returned pointer. -- ``alloc_size(N, M)`` implies that the product of argument number N and - argument number M equals the number of available bytes at the returned - pointer. - -Argument numbers are 1-based. - -An example of how to use ``alloc_size`` - -.. code-block:: c - - void *my_malloc(int a) __attribute__((alloc_size(1))); - void *my_calloc(int a, int b) __attribute__((alloc_size(1, 2))); - - int main() { - void *const p = my_malloc(100); - assert(__builtin_object_size(p, 0) == 100); - void *const a = my_calloc(20, 5); - assert(__builtin_object_size(a, 0) == 100); - } - -.. Note:: This attribute works differently in clang than it does in GCC. - Specifically, clang will only trace ``const`` pointers (as above); we give up - on pointers that are not marked as ``const``. In the vast majority of cases, - this is unimportant, because LLVM has support for the ``alloc_size`` - attribute. However, this may cause mildly unintuitive behavior when used with - other attributes, such as ``enable_if``. - - -interrupt ---------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","","","", "" - -Clang supports the GNU style ``__attribute__((interrupt))`` attribute on -x86/x86-64 targets.The compiler generates function entry and exit sequences -suitable for use in an interrupt handler when this attribute is present. -The 'IRET' instruction, instead of the 'RET' instruction, is used to return -from interrupt or exception handlers. All registers, except for the EFLAGS -register which is restored by the 'IRET' instruction, are preserved by the -compiler. - -Any interruptible-without-stack-switch code must be compiled with --mno-red-zone since interrupt handlers can and will, because of the -hardware design, touch the red zone. - -1. interrupt handler must be declared with a mandatory pointer argument: - - .. code-block:: c - - struct interrupt_frame - { - uword_t ip; - uword_t cs; - uword_t flags; - uword_t sp; - uword_t ss; - }; - - __attribute__ ((interrupt)) - void f (struct interrupt_frame *frame) { - ... - } - -2. exception handler: - - The exception handler is very similar to the interrupt handler with - a different mandatory function signature: - - .. code-block:: c - - __attribute__ ((interrupt)) - void f (struct interrupt_frame *frame, uword_t error_code) { - ... - } - - and compiler pops 'ERROR_CODE' off stack before the 'IRET' instruction. - - The exception handler should only be used for exceptions which push an - error code and all other exceptions must use the interrupt handler. - The system will crash if the wrong handler is used. - - -assert_capability (assert_shared_capability, clang::assert_capability, clang::assert_shared_capability) -------------------------------------------------------------------------------------------------------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","X","","", "" - -Marks a function that dynamically tests whether a capability is held, and halts -the program if it is not held. - - -assume_aligned (gnu::assume_aligned) ------------------------------------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","X","","", "" - -Use ``__attribute__((assume_aligned([,]))`` on a function -declaration to specify that the return value of the function (which must be a -pointer type) has the specified offset, in bytes, from an address with the -specified alignment. The offset is taken to be zero if omitted. - -.. code-block:: c++ - - // The returned pointer value has 32-byte alignment. - void *a() __attribute__((assume_aligned (32))); - - // The returned pointer value is 4 bytes greater than an address having - // 32-byte alignment. - void *b() __attribute__((assume_aligned (32, 4))); - -Note that this attribute provides information to the compiler regarding a -condition that the code already ensures is true. It does not cause the compiler -to enforce the provided alignment assumption. - - -availability ------------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","","","", "" - -The ``availability`` attribute can be placed on declarations to describe the -lifecycle of that declaration relative to operating system versions. Consider -the function declaration for a hypothetical function ``f``: - -.. code-block:: c++ - - void f(void) __attribute__((availability(macos,introduced=10.4,deprecated=10.6,obsoleted=10.7))); - -The availability attribute states that ``f`` was introduced in Mac OS X 10.4, -deprecated in Mac OS X 10.6, and obsoleted in Mac OS X 10.7. This information -is used by Clang to determine when it is safe to use ``f``: for example, if -Clang is instructed to compile code for Mac OS X 10.5, a call to ``f()`` -succeeds. If Clang is instructed to compile code for Mac OS X 10.6, the call -succeeds but Clang emits a warning specifying that the function is deprecated. -Finally, if Clang is instructed to compile code for Mac OS X 10.7, the call -fails because ``f()`` is no longer available. - -The availability attribute is a comma-separated list starting with the -platform name and then including clauses specifying important milestones in the -declaration's lifetime (in any order) along with additional information. Those -clauses can be: - -introduced=\ *version* - The first version in which this declaration was introduced. - -deprecated=\ *version* - The first version in which this declaration was deprecated, meaning that - users should migrate away from this API. - -obsoleted=\ *version* - The first version in which this declaration was obsoleted, meaning that it - was removed completely and can no longer be used. - -unavailable - This declaration is never available on this platform. - -message=\ *string-literal* - Additional message text that Clang will provide when emitting a warning or - error about use of a deprecated or obsoleted declaration. Useful to direct - users to replacement APIs. - -replacement=\ *string-literal* - Additional message text that Clang will use to provide Fix-It when emitting - a warning about use of a deprecated declaration. The Fix-It will replace - the deprecated declaration with the new declaration specified. - -Multiple availability attributes can be placed on a declaration, which may -correspond to different platforms. Only the availability attribute with the -platform corresponding to the target platform will be used; any others will be -ignored. If no availability attribute specifies availability for the current -target platform, the availability attributes are ignored. Supported platforms -are: - -``ios`` - Apple's iOS operating system. The minimum deployment target is specified by - the ``-mios-version-min=*version*`` or ``-miphoneos-version-min=*version*`` - command-line arguments. - -``macos`` - Apple's Mac OS X operating system. The minimum deployment target is - specified by the ``-mmacosx-version-min=*version*`` command-line argument. - ``macosx`` is supported for backward-compatibility reasons, but it is - deprecated. - -``tvos`` - Apple's tvOS operating system. The minimum deployment target is specified by - the ``-mtvos-version-min=*version*`` command-line argument. - -``watchos`` - Apple's watchOS operating system. The minimum deployment target is specified by - the ``-mwatchos-version-min=*version*`` command-line argument. - -A declaration can typically be used even when deploying back to a platform -version prior to when the declaration was introduced. When this happens, the -declaration is `weakly linked -`_, -as if the ``weak_import`` attribute were added to the declaration. A -weakly-linked declaration may or may not be present a run-time, and a program -can determine whether the declaration is present by checking whether the -address of that declaration is non-NULL. - -The flag ``strict`` disallows using API when deploying back to a -platform version prior to when the declaration was introduced. An -attempt to use such API before its introduction causes a hard error. -Weakly-linking is almost always a better API choice, since it allows -users to query availability at runtime. - -If there are multiple declarations of the same entity, the availability -attributes must either match on a per-platform basis or later -declarations must not have availability attributes for that -platform. For example: - -.. code-block:: c - - void g(void) __attribute__((availability(macos,introduced=10.4))); - void g(void) __attribute__((availability(macos,introduced=10.4))); // okay, matches - void g(void) __attribute__((availability(ios,introduced=4.0))); // okay, adds a new platform - void g(void); // okay, inherits both macos and ios availability from above. - void g(void) __attribute__((availability(macos,introduced=10.5))); // error: mismatch - -When one method overrides another, the overriding method can be more widely available than the overridden method, e.g.,: - -.. code-block:: objc - - @interface A - - (id)method __attribute__((availability(macos,introduced=10.4))); - - (id)method2 __attribute__((availability(macos,introduced=10.4))); - @end - - @interface B : A - - (id)method __attribute__((availability(macos,introduced=10.3))); // okay: method moved into base class later - - (id)method __attribute__((availability(macos,introduced=10.5))); // error: this method was available via the base class in 10.4 - @end - - -_Noreturn ---------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "","","","X", "" - -A function declared as ``_Noreturn`` shall not return to its caller. The -compiler will generate a diagnostic for a function declared as ``_Noreturn`` -that appears to be capable of returning to its caller. - - -noreturn --------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "","X","","", "" - -A function declared as ``[[noreturn]]`` shall not return to its caller. The -compiler will generate a diagnostic for a function declared as ``[[noreturn]]`` -that appears to be capable of returning to its caller. - - -carries_dependency ------------------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","X","","", "" - -The ``carries_dependency`` attribute specifies dependency propagation into and -out of functions. - -When specified on a function or Objective-C method, the ``carries_dependency`` -attribute means that the return value carries a dependency out of the function, -so that the implementation need not constrain ordering upon return from that -function. Implementations of the function and its caller may choose to preserve -dependencies instead of emitting memory ordering instructions such as fences. - -Note, this attribute does not change the meaning of the program, but may result -in generation of more efficient code. - - -convergent (clang::convergent) ------------------------------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","X","","", "" - -The ``convergent`` attribute can be placed on a function declaration. It is -translated into the LLVM ``convergent`` attribute, which indicates that the call -instructions of a function with this attribute cannot be made control-dependent -on any additional values. - -In languages designed for SPMD/SIMT programming model, e.g. OpenCL or CUDA, -the call instructions of a function with this attribute must be executed by -all work items or threads in a work group or sub group. - -This attribute is different from ``noduplicate`` because it allows duplicating -function calls if it can be proved that the duplicated function calls are -not made control-dependent on any additional values, e.g., unrolling a loop -executed by all work items. - -Sample usage: -.. code-block:: c - - void convfunc(void) __attribute__((convergent)); - // Setting it as a C++11 attribute is also valid in a C++ program. - // void convfunc(void) [[clang::convergent]]; - - -deprecated (gnu::deprecated) ----------------------------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","X","X","", "" - -The ``deprecated`` attribute can be applied to a function, a variable, or a -type. This is useful when identifying functions, variables, or types that are -expected to be removed in a future version of a program. - -Consider the function declaration for a hypothetical function ``f``: - -.. code-block:: c++ - - void f(void) __attribute__((deprecated("message", "replacement"))); - -When spelled as `__attribute__((deprecated))`, the deprecated attribute can have -two optional string arguments. The first one is the message to display when -emitting the warning; the second one enables the compiler to provide a Fix-It -to replace the deprecated name with a new name. Otherwise, when spelled as -`[[gnu::deprecated]] or [[deprecated]]`, the attribute can have one optional -string argument which is the message to display when emitting the warning. - - -diagnose_if ------------ -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","","","", "" - -The ``diagnose_if`` attribute can be placed on function declarations to emit -warnings or errors at compile-time if calls to the attributed function meet -certain user-defined criteria. For example: - -.. code-block:: c - - void abs(int a) - __attribute__((diagnose_if(a >= 0, "Redundant abs call", "warning"))); - void must_abs(int a) - __attribute__((diagnose_if(a >= 0, "Redundant abs call", "error"))); - - int val = abs(1); // warning: Redundant abs call - int val2 = must_abs(1); // error: Redundant abs call - int val3 = abs(val); - int val4 = must_abs(val); // Because run-time checks are not emitted for - // diagnose_if attributes, this executes without - // issue. - - -``diagnose_if`` is closely related to ``enable_if``, with a few key differences: - -* Overload resolution is not aware of ``diagnose_if`` attributes: they're - considered only after we select the best candidate from a given candidate set. -* Function declarations that differ only in their ``diagnose_if`` attributes are - considered to be redeclarations of the same function (not overloads). -* If the condition provided to ``diagnose_if`` cannot be evaluated, no - diagnostic will be emitted. - -Otherwise, ``diagnose_if`` is essentially the logical negation of ``enable_if``. - -As a result of bullet number two, ``diagnose_if`` attributes will stack on the -same function. For example: - -.. code-block:: c - - int foo() __attribute__((diagnose_if(1, "diag1", "warning"))); - int foo() __attribute__((diagnose_if(1, "diag2", "warning"))); - - int bar = foo(); // warning: diag1 - // warning: diag2 - int (*fooptr)(void) = foo; // warning: diag1 - // warning: diag2 - - constexpr int supportsAPILevel(int N) { return N < 5; } - int baz(int a) - __attribute__((diagnose_if(!supportsAPILevel(10), - "Upgrade to API level 10 to use baz", "error"))); - int baz(int a) - __attribute__((diagnose_if(!a, "0 is not recommended.", "warning"))); - - int (*bazptr)(int) = baz; // error: Upgrade to API level 10 to use baz - int v = baz(0); // error: Upgrade to API level 10 to use baz - -Query for this feature with ``__has_attribute(diagnose_if)``. - - -disable_tail_calls (clang::disable_tail_calls) ----------------------------------------------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","X","","", "" - -The ``disable_tail_calls`` attribute instructs the backend to not perform tail call optimization inside the marked function. - -For example: - - .. code-block:: c - - int callee(int); - - int foo(int a) __attribute__((disable_tail_calls)) { - return callee(a); // This call is not tail-call optimized. - } - -Marking virtual functions as ``disable_tail_calls`` is legal. - - .. code-block:: c++ - - int callee(int); - - class Base { - public: - [[clang::disable_tail_calls]] virtual int foo1() { - return callee(); // This call is not tail-call optimized. - } - }; - - class Derived1 : public Base { - public: - int foo1() override { - return callee(); // This call is tail-call optimized. - } - }; - - -enable_if ---------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","","","", "" - -.. Note:: Some features of this attribute are experimental. The meaning of - multiple enable_if attributes on a single declaration is subject to change in - a future version of clang. Also, the ABI is not standardized and the name - mangling may change in future versions. To avoid that, use asm labels. - -The ``enable_if`` attribute can be placed on function declarations to control -which overload is selected based on the values of the function's arguments. -When combined with the ``overloadable`` attribute, this feature is also -available in C. - -.. code-block:: c++ - - int isdigit(int c); - int isdigit(int c) __attribute__((enable_if(c <= -1 || c > 255, "chosen when 'c' is out of range"))) __attribute__((unavailable("'c' must have the value of an unsigned char or EOF"))); - - void foo(char c) { - isdigit(c); - isdigit(10); - isdigit(-10); // results in a compile-time error. - } - -The enable_if attribute takes two arguments, the first is an expression written -in terms of the function parameters, the second is a string explaining why this -overload candidate could not be selected to be displayed in diagnostics. The -expression is part of the function signature for the purposes of determining -whether it is a redeclaration (following the rules used when determining -whether a C++ template specialization is ODR-equivalent), but is not part of -the type. - -The enable_if expression is evaluated as if it were the body of a -bool-returning constexpr function declared with the arguments of the function -it is being applied to, then called with the parameters at the call site. If the -result is false or could not be determined through constant expression -evaluation, then this overload will not be chosen and the provided string may -be used in a diagnostic if the compile fails as a result. - -Because the enable_if expression is an unevaluated context, there are no global -state changes, nor the ability to pass information from the enable_if -expression to the function body. For example, suppose we want calls to -strnlen(strbuf, maxlen) to resolve to strnlen_chk(strbuf, maxlen, size of -strbuf) only if the size of strbuf can be determined: - -.. code-block:: c++ - - __attribute__((always_inline)) - static inline size_t strnlen(const char *s, size_t maxlen) - __attribute__((overloadable)) - __attribute__((enable_if(__builtin_object_size(s, 0) != -1))), - "chosen when the buffer size is known but 'maxlen' is not"))) - { - return strnlen_chk(s, maxlen, __builtin_object_size(s, 0)); - } - -Multiple enable_if attributes may be applied to a single declaration. In this -case, the enable_if expressions are evaluated from left to right in the -following manner. First, the candidates whose enable_if expressions evaluate to -false or cannot be evaluated are discarded. If the remaining candidates do not -share ODR-equivalent enable_if expressions, the overload resolution is -ambiguous. Otherwise, enable_if overload resolution continues with the next -enable_if attribute on the candidates that have not been discarded and have -remaining enable_if attributes. In this way, we pick the most specific -overload out of a number of viable overloads using enable_if. - -.. code-block:: c++ - - void f() __attribute__((enable_if(true, ""))); // #1 - void f() __attribute__((enable_if(true, ""))) __attribute__((enable_if(true, ""))); // #2 - - void g(int i, int j) __attribute__((enable_if(i, ""))); // #1 - void g(int i, int j) __attribute__((enable_if(j, ""))) __attribute__((enable_if(true))); // #2 - -In this example, a call to f() is always resolved to #2, as the first enable_if -expression is ODR-equivalent for both declarations, but #1 does not have another -enable_if expression to continue evaluating, so the next round of evaluation has -only a single candidate. In a call to g(1, 1), the call is ambiguous even though -#2 has more enable_if attributes, because the first enable_if expressions are -not ODR-equivalent. - -Query for this feature with ``__has_attribute(enable_if)``. - -Note that functions with one or more ``enable_if`` attributes may not have -their address taken, unless all of the conditions specified by said -``enable_if`` are constants that evaluate to ``true``. For example: - -.. code-block:: c - - const int TrueConstant = 1; - const int FalseConstant = 0; - int f(int a) __attribute__((enable_if(a > 0, ""))); - int g(int a) __attribute__((enable_if(a == 0 || a != 0, ""))); - int h(int a) __attribute__((enable_if(1, ""))); - int i(int a) __attribute__((enable_if(TrueConstant, ""))); - int j(int a) __attribute__((enable_if(FalseConstant, ""))); - - void fn() { - int (*ptr)(int); - ptr = &f; // error: 'a > 0' is not always true - ptr = &g; // error: 'a == 0 || a != 0' is not a truthy constant - ptr = &h; // OK: 1 is a truthy constant - ptr = &i; // OK: 'TrueConstant' is a truthy constant - ptr = &j; // error: 'FalseConstant' is a constant, but not truthy - } - -Because ``enable_if`` evaluation happens during overload resolution, -``enable_if`` may give unintuitive results when used with templates, depending -on when overloads are resolved. In the example below, clang will emit a -diagnostic about no viable overloads for ``foo`` in ``bar``, but not in ``baz``: - -.. code-block:: c++ - - double foo(int i) __attribute__((enable_if(i > 0, ""))); - void *foo(int i) __attribute__((enable_if(i <= 0, ""))); - template - auto bar() { return foo(I); } - - template - auto baz() { return foo(T::number); } - - struct WithNumber { constexpr static int number = 1; }; - void callThem() { - bar(); - baz(); - } - -This is because, in ``bar``, ``foo`` is resolved prior to template -instantiation, so the value for ``I`` isn't known (thus, both ``enable_if`` -conditions for ``foo`` fail). However, in ``baz``, ``foo`` is resolved during -template instantiation, so the value for ``T::number`` is known. - - -flatten (gnu::flatten) ----------------------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","X","","", "" - -The ``flatten`` attribute causes calls within the attributed function to -be inlined unless it is impossible to do so, for example if the body of the -callee is unavailable or if the callee has the ``noinline`` attribute. - - -format (gnu::format) --------------------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","X","","", "" - -Clang supports the ``format`` attribute, which indicates that the function -accepts a ``printf`` or ``scanf``-like format string and corresponding -arguments or a ``va_list`` that contains these arguments. - -Please see `GCC documentation about format attribute -`_ to find details -about attribute syntax. - -Clang implements two kinds of checks with this attribute. - -#. Clang checks that the function with the ``format`` attribute is called with - a format string that uses format specifiers that are allowed, and that - arguments match the format string. This is the ``-Wformat`` warning, it is - on by default. - -#. Clang checks that the format string argument is a literal string. This is - the ``-Wformat-nonliteral`` warning, it is off by default. - - Clang implements this mostly the same way as GCC, but there is a difference - for functions that accept a ``va_list`` argument (for example, ``vprintf``). - GCC does not emit ``-Wformat-nonliteral`` warning for calls to such - functions. Clang does not warn if the format string comes from a function - parameter, where the function is annotated with a compatible attribute, - otherwise it warns. For example: - - .. code-block:: c - - __attribute__((__format__ (__scanf__, 1, 3))) - void foo(const char* s, char *buf, ...) { - va_list ap; - va_start(ap, buf); - - vprintf(s, ap); // warning: format string is not a string literal - } - - In this case we warn because ``s`` contains a format string for a - ``scanf``-like function, but it is passed to a ``printf``-like function. - - If the attribute is removed, clang still warns, because the format string is - not a string literal. - - Another example: - - .. code-block:: c - - __attribute__((__format__ (__printf__, 1, 3))) - void foo(const char* s, char *buf, ...) { - va_list ap; - va_start(ap, buf); - - vprintf(s, ap); // warning - } - - In this case Clang does not warn because the format string ``s`` and - the corresponding arguments are annotated. If the arguments are - incorrect, the caller of ``foo`` will receive a warning. - - -ifunc (gnu::ifunc) ------------------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","X","","", "" - -``__attribute__((ifunc("resolver")))`` is used to mark that the address of a declaration should be resolved at runtime by calling a resolver function. - -The symbol name of the resolver function is given in quotes. A function with this name (after mangling) must be defined in the current translation unit; it may be ``static``. The resolver function should take no arguments and return a pointer. - -The ``ifunc`` attribute may only be used on a function declaration. A function declaration with an ``ifunc`` attribute is considered to be a definition of the declared entity. The entity must not have weak linkage; for example, in C++, it cannot be applied to a declaration if a definition at that location would be considered inline. - -Not all targets support this attribute. ELF targets support this attribute when using binutils v2.20.1 or higher and glibc v2.11.1 or higher. Non-ELF targets currently do not support this attribute. - - -internal_linkage (clang::internal_linkage) ------------------------------------------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","X","","", "" - -The ``internal_linkage`` attribute changes the linkage type of the declaration to internal. -This is similar to C-style ``static``, but can be used on classes and class methods. When applied to a class definition, -this attribute affects all methods and static data members of that class. -This can be used to contain the ABI of a C++ library by excluding unwanted class methods from the export tables. - - -interrupt ---------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","","","", "" - -Clang supports the GNU style ``__attribute__((interrupt("ARGUMENT")))`` attribute on -MIPS targets. This attribute may be attached to a function definition and instructs -the backend to generate appropriate function entry/exit code so that it can be used -directly as an interrupt service routine. - -By default, the compiler will produce a function prologue and epilogue suitable for -an interrupt service routine that handles an External Interrupt Controller (eic) -generated interrupt. This behaviour can be explicitly requested with the "eic" -argument. - -Otherwise, for use with vectored interrupt mode, the argument passed should be -of the form "vector=LEVEL" where LEVEL is one of the following values: -"sw0", "sw1", "hw0", "hw1", "hw2", "hw3", "hw4", "hw5". The compiler will -then set the interrupt mask to the corresponding level which will mask all -interrupts up to and including the argument. - -The semantics are as follows: - -- The prologue is modified so that the Exception Program Counter (EPC) and - Status coprocessor registers are saved to the stack. The interrupt mask is - set so that the function can only be interrupted by a higher priority - interrupt. The epilogue will restore the previous values of EPC and Status. - -- The prologue and epilogue are modified to save and restore all non-kernel - registers as necessary. - -- The FPU is disabled in the prologue, as the floating pointer registers are not - spilled to the stack. - -- The function return sequence is changed to use an exception return instruction. - -- The parameter sets the interrupt mask for the function corresponding to the - interrupt level specified. If no mask is specified the interrupt mask - defaults to "eic". - - -noalias -------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "","","X","", "" - -The ``noalias`` attribute indicates that the only memory accesses inside -function are loads and stores from objects pointed to by its pointer-typed -arguments, with arbitrary offsets. - - -noduplicate (clang::noduplicate) --------------------------------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","X","","", "" - -The ``noduplicate`` attribute can be placed on function declarations to control -whether function calls to this function can be duplicated or not as a result of -optimizations. This is required for the implementation of functions with -certain special requirements, like the OpenCL "barrier" function, that might -need to be run concurrently by all the threads that are executing in lockstep -on the hardware. For example this attribute applied on the function -"nodupfunc" in the code below avoids that: - -.. code-block:: c - - void nodupfunc() __attribute__((noduplicate)); - // Setting it as a C++11 attribute is also valid - // void nodupfunc() [[clang::noduplicate]]; - void foo(); - void bar(); - - nodupfunc(); - if (a > n) { - foo(); - } else { - bar(); - } - -gets possibly modified by some optimizations into code similar to this: - -.. code-block:: c - - if (a > n) { - nodupfunc(); - foo(); - } else { - nodupfunc(); - bar(); - } - -where the call to "nodupfunc" is duplicated and sunk into the two branches -of the condition. - - -no_sanitize (clang::no_sanitize) --------------------------------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","X","","", "" - -Use the ``no_sanitize`` attribute on a function declaration to specify -that a particular instrumentation or set of instrumentations should not be -applied to that function. The attribute takes a list of string literals, -which have the same meaning as values accepted by the ``-fno-sanitize=`` -flag. For example, ``__attribute__((no_sanitize("address", "thread")))`` -specifies that AddressSanitizer and ThreadSanitizer should not be applied -to the function. - -See :ref:`Controlling Code Generation ` for a -full list of supported sanitizer flags. - - -no_sanitize_address (no_address_safety_analysis, gnu::no_address_safety_analysis, gnu::no_sanitize_address) ------------------------------------------------------------------------------------------------------------ -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","X","","", "" - -.. _langext-address_sanitizer: - -Use ``__attribute__((no_sanitize_address))`` on a function declaration to -specify that address safety instrumentation (e.g. AddressSanitizer) should -not be applied to that function. - - -no_sanitize_thread ------------------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","X","","", "" - -.. _langext-thread_sanitizer: - -Use ``__attribute__((no_sanitize_thread))`` on a function declaration to -specify that checks for data races on plain (non-atomic) memory accesses should -not be inserted by ThreadSanitizer. The function is still instrumented by the -tool to avoid false positives and provide meaningful stack traces. - - -no_sanitize_memory ------------------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","X","","", "" - -.. _langext-memory_sanitizer: - -Use ``__attribute__((no_sanitize_memory))`` on a function declaration to -specify that checks for uninitialized memory should not be inserted -(e.g. by MemorySanitizer). The function may still be instrumented by the tool -to avoid false positives in other places. - - -no_split_stack (gnu::no_split_stack) ------------------------------------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","X","","", "" - -The ``no_split_stack`` attribute disables the emission of the split stack -preamble for a particular function. It has no effect if ``-fsplit-stack`` -is not specified. - - -not_tail_called (clang::not_tail_called) ----------------------------------------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","X","","", "" - -The ``not_tail_called`` attribute prevents tail-call optimization on statically bound calls. It has no effect on indirect calls. Virtual functions, objective-c methods, and functions marked as ``always_inline`` cannot be marked as ``not_tail_called``. - -For example, it prevents tail-call optimization in the following case: - - .. code-block:: c - - int __attribute__((not_tail_called)) foo1(int); - - int foo2(int a) { - return foo1(a); // No tail-call optimization on direct calls. - } - -However, it doesn't prevent tail-call optimization in this case: - - .. code-block:: c - - int __attribute__((not_tail_called)) foo1(int); - - int foo2(int a) { - int (*fn)(int) = &foo1; - - // not_tail_called has no effect on an indirect call even if the call can be - // resolved at compile time. - return (*fn)(a); - } - -Marking virtual functions as ``not_tail_called`` is an error: - - .. code-block:: c++ - - class Base { - public: - // not_tail_called on a virtual function is an error. - [[clang::not_tail_called]] virtual int foo1(); - - virtual int foo2(); - - // Non-virtual functions can be marked ``not_tail_called``. - [[clang::not_tail_called]] int foo3(); - }; - - class Derived1 : public Base { - public: - int foo1() override; - - // not_tail_called on a virtual function is an error. - [[clang::not_tail_called]] int foo2() override; - }; - - -#pragma omp declare simd ------------------------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "","","","", "X" - -The `declare simd` construct can be applied to a function to enable the creation -of one or more versions that can process multiple arguments using SIMD -instructions from a single invocation in a SIMD loop. The `declare simd` -directive is a declarative directive. There may be multiple `declare simd` -directives for a function. The use of a `declare simd` construct on a function -enables the creation of SIMD versions of the associated function that can be -used to process multiple arguments from a single invocation from a SIMD loop -concurrently. -The syntax of the `declare simd` construct is as follows: - - .. code-block:: c - - #pragma omp declare simd [clause[[,] clause] ...] new-line - [#pragma omp declare simd [clause[[,] clause] ...] new-line] - [...] - function definition or declaration - -where clause is one of the following: - - .. code-block:: c - - simdlen(length) - linear(argument-list[:constant-linear-step]) - aligned(argument-list[:alignment]) - uniform(argument-list) - inbranch - notinbranch - - -#pragma omp declare target --------------------------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "","","","", "X" - -The `declare target` directive specifies that variables and functions are mapped -to a device for OpenMP offload mechanism. - -The syntax of the declare target directive is as follows: - - .. code-block:: c - - #pragma omp declare target new-line - declarations-definition-seq - #pragma omp end declare target new-line - - -objc_boxable ------------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","","","", "" - -Structs and unions marked with the ``objc_boxable`` attribute can be used -with the Objective-C boxed expression syntax, ``@(...)``. - -**Usage**: ``__attribute__((objc_boxable))``. This attribute -can only be placed on a declaration of a trivially-copyable struct or union: - -.. code-block:: objc - - struct __attribute__((objc_boxable)) some_struct { - int i; - }; - union __attribute__((objc_boxable)) some_union { - int i; - float f; - }; - typedef struct __attribute__((objc_boxable)) _some_struct some_struct; - - // ... - - some_struct ss; - NSValue *boxed = @(ss); - - -objc_method_family ------------------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","","","", "" - -Many methods in Objective-C have conventional meanings determined by their -selectors. It is sometimes useful to be able to mark a method as having a -particular conventional meaning despite not having the right selector, or as -not having the conventional meaning that its selector would suggest. For these -use cases, we provide an attribute to specifically describe the "method family" -that a method belongs to. - -**Usage**: ``__attribute__((objc_method_family(X)))``, where ``X`` is one of -``none``, ``alloc``, ``copy``, ``init``, ``mutableCopy``, or ``new``. This -attribute can only be placed at the end of a method declaration: - -.. code-block:: objc - - - (NSString *)initMyStringValue __attribute__((objc_method_family(none))); - -Users who do not wish to change the conventional meaning of a method, and who -merely want to document its non-standard retain and release semantics, should -use the retaining behavior attributes (``ns_returns_retained``, -``ns_returns_not_retained``, etc). - -Query for this feature with ``__has_attribute(objc_method_family)``. - - -objc_requires_super -------------------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","","","", "" - -Some Objective-C classes allow a subclass to override a particular method in a -parent class but expect that the overriding method also calls the overridden -method in the parent class. For these cases, we provide an attribute to -designate that a method requires a "call to ``super``" in the overriding -method in the subclass. - -**Usage**: ``__attribute__((objc_requires_super))``. This attribute can only -be placed at the end of a method declaration: - -.. code-block:: objc - - - (void)foo __attribute__((objc_requires_super)); - -This attribute can only be applied the method declarations within a class, and -not a protocol. Currently this attribute does not enforce any placement of -where the call occurs in the overriding method (such as in the case of -``-dealloc`` where the call must appear at the end). It checks only that it -exists. - -Note that on both OS X and iOS that the Foundation framework provides a -convenience macro ``NS_REQUIRES_SUPER`` that provides syntactic sugar for this -attribute: - -.. code-block:: objc - - - (void)foo NS_REQUIRES_SUPER; - -This macro is conditionally defined depending on the compiler's support for -this attribute. If the compiler does not support the attribute the macro -expands to nothing. - -Operationally, when a method has this annotation the compiler will warn if the -implementation of an override in a subclass does not call super. For example: - -.. code-block:: objc - - warning: method possibly missing a [super AnnotMeth] call - - (void) AnnotMeth{}; - ^ - - -objc_runtime_name ------------------ -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","","","", "" - -By default, the Objective-C interface or protocol identifier is used -in the metadata name for that object. The `objc_runtime_name` -attribute allows annotated interfaces or protocols to use the -specified string argument in the object's metadata name instead of the -default name. - -**Usage**: ``__attribute__((objc_runtime_name("MyLocalName")))``. This attribute -can only be placed before an @protocol or @interface declaration: - -.. code-block:: objc - - __attribute__((objc_runtime_name("MyLocalName"))) - @interface Message - @end - - -objc_runtime_visible --------------------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","","","", "" - -This attribute specifies that the Objective-C class to which it applies is visible to the Objective-C runtime but not to the linker. Classes annotated with this attribute cannot be subclassed and cannot have categories defined for them. - - -optnone (clang::optnone) ------------------------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","X","","", "" - -The ``optnone`` attribute suppresses essentially all optimizations -on a function or method, regardless of the optimization level applied to -the compilation unit as a whole. This is particularly useful when you -need to debug a particular function, but it is infeasible to build the -entire application without optimization. Avoiding optimization on the -specified function can improve the quality of the debugging information -for that function. - -This attribute is incompatible with the ``always_inline`` and ``minsize`` -attributes. - - -overloadable ------------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","","","", "" - -Clang provides support for C++ function overloading in C. Function overloading -in C is introduced using the ``overloadable`` attribute. For example, one -might provide several overloaded versions of a ``tgsin`` function that invokes -the appropriate standard function computing the sine of a value with ``float``, -``double``, or ``long double`` precision: - -.. code-block:: c - - #include - float __attribute__((overloadable)) tgsin(float x) { return sinf(x); } - double __attribute__((overloadable)) tgsin(double x) { return sin(x); } - long double __attribute__((overloadable)) tgsin(long double x) { return sinl(x); } - -Given these declarations, one can call ``tgsin`` with a ``float`` value to -receive a ``float`` result, with a ``double`` to receive a ``double`` result, -etc. Function overloading in C follows the rules of C++ function overloading -to pick the best overload given the call arguments, with a few C-specific -semantics: - -* Conversion from ``float`` or ``double`` to ``long double`` is ranked as a - floating-point promotion (per C99) rather than as a floating-point conversion - (as in C++). - -* A conversion from a pointer of type ``T*`` to a pointer of type ``U*`` is - considered a pointer conversion (with conversion rank) if ``T`` and ``U`` are - compatible types. - -* A conversion from type ``T`` to a value of type ``U`` is permitted if ``T`` - and ``U`` are compatible types. This conversion is given "conversion" rank. - -* If no viable candidates are otherwise available, we allow a conversion from a - pointer of type ``T*`` to a pointer of type ``U*``, where ``T`` and ``U`` are - incompatible. This conversion is ranked below all other types of conversions. - Please note: ``U`` lacking qualifiers that are present on ``T`` is sufficient - for ``T`` and ``U`` to be incompatible. - -The declaration of ``overloadable`` functions is restricted to function -declarations and definitions. Most importantly, if any function with a given -name is given the ``overloadable`` attribute, then all function declarations -and definitions with that name (and in that scope) must have the -``overloadable`` attribute. This rule even applies to redeclarations of -functions whose original declaration had the ``overloadable`` attribute, e.g., - -.. code-block:: c - - int f(int) __attribute__((overloadable)); - float f(float); // error: declaration of "f" must have the "overloadable" attribute - - int g(int) __attribute__((overloadable)); - int g(int) { } // error: redeclaration of "g" must also have the "overloadable" attribute - -Functions marked ``overloadable`` must have prototypes. Therefore, the -following code is ill-formed: - -.. code-block:: c - - int h() __attribute__((overloadable)); // error: h does not have a prototype - -However, ``overloadable`` functions are allowed to use a ellipsis even if there -are no named parameters (as is permitted in C++). This feature is particularly -useful when combined with the ``unavailable`` attribute: - -.. code-block:: c++ - - void honeypot(...) __attribute__((overloadable, unavailable)); // calling me is an error - -Functions declared with the ``overloadable`` attribute have their names mangled -according to the same rules as C++ function names. For example, the three -``tgsin`` functions in our motivating example get the mangled names -``_Z5tgsinf``, ``_Z5tgsind``, and ``_Z5tgsine``, respectively. There are two -caveats to this use of name mangling: - -* Future versions of Clang may change the name mangling of functions overloaded - in C, so you should not depend on an specific mangling. To be completely - safe, we strongly urge the use of ``static inline`` with ``overloadable`` - functions. - -* The ``overloadable`` attribute has almost no meaning when used in C++, - because names will already be mangled and functions are already overloadable. - However, when an ``overloadable`` function occurs within an ``extern "C"`` - linkage specification, it's name *will* be mangled in the same way as it - would in C. - -Query for this feature with ``__has_extension(attribute_overloadable)``. - - -release_capability (release_shared_capability, clang::release_capability, clang::release_shared_capability) ------------------------------------------------------------------------------------------------------------ -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","X","","", "" - -Marks a function as releasing a capability. - - -kernel ------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","","","", "" - -``__attribute__((kernel))`` is used to mark a ``kernel`` function in -RenderScript. - -In RenderScript, ``kernel`` functions are used to express data-parallel -computations. The RenderScript runtime efficiently parallelizes ``kernel`` -functions to run on computational resources such as multi-core CPUs and GPUs. -See the RenderScript_ documentation for more information. - -.. _RenderScript: https://developer.android.com/guide/topics/renderscript/compute.html - - -target (gnu::target) --------------------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","X","","", "" - -Clang supports the GNU style ``__attribute__((target("OPTIONS")))`` attribute. -This attribute may be attached to a function definition and instructs -the backend to use different code generation options than were passed on the -command line. - -The current set of options correspond to the existing "subtarget features" for -the target with or without a "-mno-" in front corresponding to the absence -of the feature, as well as ``arch="CPU"`` which will change the default "CPU" -for the function. - -Example "subtarget features" from the x86 backend include: "mmx", "sse", "sse4.2", -"avx", "xop" and largely correspond to the machine specific options handled by -the front end. - - -try_acquire_capability (try_acquire_shared_capability, clang::try_acquire_capability, clang::try_acquire_shared_capability) ---------------------------------------------------------------------------------------------------------------------------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","X","","", "" - -Marks a function that attempts to acquire a capability. This function may fail to -actually acquire the capability; they accept a Boolean value determining -whether acquiring the capability means success (true), or failing to acquire -the capability means success (false). - - -nodiscard, warn_unused_result, clang::warn_unused_result, gnu::warn_unused_result ---------------------------------------------------------------------------------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","X","","", "" - -Clang supports the ability to diagnose when the results of a function call -expression are discarded under suspicious circumstances. A diagnostic is -generated when a function or its return type is marked with ``[[nodiscard]]`` -(or ``__attribute__((warn_unused_result))``) and the function call appears as a -potentially-evaluated discarded-value expression that is not explicitly cast to -`void`. - -.. code-block: c++ - struct [[nodiscard]] error_info { /*...*/ }; - error_info enable_missile_safety_mode(); - - void launch_missiles(); - void test_missiles() { - enable_missile_safety_mode(); // diagnoses - launch_missiles(); - } - error_info &foo(); - void f() { foo(); } // Does not diagnose, error_info is a reference. - - -xray_always_instrument (clang::xray_always_instrument), xray_never_instrument (clang::xray_never_instrument) ------------------------------------------------------------------------------------------------------------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","X","","", "" - -``__attribute__((xray_always_instrument))`` or ``[[clang::xray_always_instrument]]`` is used to mark member functions (in C++), methods (in Objective C), and free functions (in C, C++, and Objective C) to be instrumented with XRay. This will cause the function to always have space at the beginning and exit points to allow for runtime patching. - -Conversely, ``__attribute__((xray_never_instrument))`` or ``[[clang::xray_never_instrument]]`` will inhibit the insertion of these instrumentation points. - -If a function has neither of these attributes, they become subject to the XRay heuristics used to determine whether a function should be instrumented or otherwise. - - -Variable Attributes -=================== - - -dllexport (gnu::dllexport) --------------------------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","X","X","", "" - -The ``__declspec(dllexport)`` attribute declares a variable, function, or -Objective-C interface to be exported from the module. It is available under the -``-fdeclspec`` flag for compatibility with various compilers. The primary use -is for COFF object files which explicitly specify what interfaces are available -for external use. See the dllexport_ documentation on MSDN for more -information. - -.. _dllexport: https://msdn.microsoft.com/en-us/library/3y1sfaz2.aspx - - -dllimport (gnu::dllimport) --------------------------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","X","X","", "" - -The ``__declspec(dllimport)`` attribute declares a variable, function, or -Objective-C interface to be imported from an external module. It is available -under the ``-fdeclspec`` flag for compatibility with various compilers. The -primary use is for COFF object files which explicitly specify what interfaces -are imported from external modules. See the dllimport_ documentation on MSDN -for more information. - -.. _dllimport: https://msdn.microsoft.com/en-us/library/3y1sfaz2.aspx - - -init_seg --------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "","","","", "X" - -The attribute applied by ``pragma init_seg()`` controls the section into -which global initialization function pointers are emitted. It is only -available with ``-fms-extensions``. Typically, this function pointer is -emitted into ``.CRT$XCU`` on Windows. The user can change the order of -initialization by using a different section name with the same -``.CRT$XC`` prefix and a suffix that sorts lexicographically before or -after the standard ``.CRT$XCU`` sections. See the init_seg_ -documentation on MSDN for more information. - -.. _init_seg: http://msdn.microsoft.com/en-us/library/7977wcck(v=vs.110).aspx - - -nodebug (gnu::nodebug) ----------------------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","X","","", "" - -The ``nodebug`` attribute allows you to suppress debugging information for a -function or method, or for a variable that is not a parameter or a non-static -data member. - - -nosvm ------ -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","","","", "" - -OpenCL 2.0 supports the optional ``__attribute__((nosvm))`` qualifier for -pointer variable. It informs the compiler that the pointer does not refer -to a shared virtual memory region. See OpenCL v2.0 s6.7.2 for details. - -Since it is not widely used and has been removed from OpenCL 2.1, it is ignored -by Clang. - - -pass_object_size ----------------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","","","", "" - -.. Note:: The mangling of functions with parameters that are annotated with - ``pass_object_size`` is subject to change. You can get around this by - using ``__asm__("foo")`` to explicitly name your functions, thus preserving - your ABI; also, non-overloadable C functions with ``pass_object_size`` are - not mangled. - -The ``pass_object_size(Type)`` attribute can be placed on function parameters to -instruct clang to call ``__builtin_object_size(param, Type)`` at each callsite -of said function, and implicitly pass the result of this call in as an invisible -argument of type ``size_t`` directly after the parameter annotated with -``pass_object_size``. Clang will also replace any calls to -``__builtin_object_size(param, Type)`` in the function by said implicit -parameter. - -Example usage: - -.. code-block:: c - - int bzero1(char *const p __attribute__((pass_object_size(0)))) - __attribute__((noinline)) { - int i = 0; - for (/**/; i < (int)__builtin_object_size(p, 0); ++i) { - p[i] = 0; - } - return i; - } - - int main() { - char chars[100]; - int n = bzero1(&chars[0]); - assert(n == sizeof(chars)); - return 0; - } - -If successfully evaluating ``__builtin_object_size(param, Type)`` at the -callsite is not possible, then the "failed" value is passed in. So, using the -definition of ``bzero1`` from above, the following code would exit cleanly: - -.. code-block:: c - - int main2(int argc, char *argv[]) { - int n = bzero1(argv); - assert(n == -1); - return 0; - } - -``pass_object_size`` plays a part in overload resolution. If two overload -candidates are otherwise equally good, then the overload with one or more -parameters with ``pass_object_size`` is preferred. This implies that the choice -between two identical overloads both with ``pass_object_size`` on one or more -parameters will always be ambiguous; for this reason, having two such overloads -is illegal. For example: - -.. code-block:: c++ - - #define PS(N) __attribute__((pass_object_size(N))) - // OK - void Foo(char *a, char *b); // Overload A - // OK -- overload A has no parameters with pass_object_size. - void Foo(char *a PS(0), char *b PS(0)); // Overload B - // Error -- Same signature (sans pass_object_size) as overload B, and both - // overloads have one or more parameters with the pass_object_size attribute. - void Foo(void *a PS(0), void *b); - - // OK - void Bar(void *a PS(0)); // Overload C - // OK - void Bar(char *c PS(1)); // Overload D - - void main() { - char known[10], *unknown; - Foo(unknown, unknown); // Calls overload B - Foo(known, unknown); // Calls overload B - Foo(unknown, known); // Calls overload B - Foo(known, known); // Calls overload B - - Bar(known); // Calls overload D - Bar(unknown); // Calls overload D - } - -Currently, ``pass_object_size`` is a bit restricted in terms of its usage: - -* Only one use of ``pass_object_size`` is allowed per parameter. - -* It is an error to take the address of a function with ``pass_object_size`` on - any of its parameters. If you wish to do this, you can create an overload - without ``pass_object_size`` on any parameters. - -* It is an error to apply the ``pass_object_size`` attribute to parameters that - are not pointers. Additionally, any parameter that ``pass_object_size`` is - applied to must be marked ``const`` at its function's definition. - - -require_constant_initialization (clang::require_constant_initialization) ------------------------------------------------------------------------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","X","","", "" - -This attribute specifies that the variable to which it is attached is intended -to have a `constant initializer `_ -according to the rules of [basic.start.static]. The variable is required to -have static or thread storage duration. If the initialization of the variable -is not a constant initializer an error will be produced. This attribute may -only be used in C++. - -Note that in C++03 strict constant expression checking is not done. Instead -the attribute reports if Clang can emit the variable as a constant, even if it's -not technically a 'constant initializer'. This behavior is non-portable. - -Static storage duration variables with constant initializers avoid hard-to-find -bugs caused by the indeterminate order of dynamic initialization. They can also -be safely used during dynamic initialization across translation units. - -This attribute acts as a compile time assertion that the requirements -for constant initialization have been met. Since these requirements change -between dialects and have subtle pitfalls it's important to fail fast instead -of silently falling back on dynamic initialization. - -.. code-block:: c++ - - // -std=c++14 - #define SAFE_STATIC [[clang::require_constant_initialization]] - struct T { - constexpr T(int) {} - ~T(); // non-trivial - }; - SAFE_STATIC T x = {42}; // Initialization OK. Doesn't check destructor. - SAFE_STATIC T y = 42; // error: variable does not have a constant initializer - // copy initialization is not a constant expression on a non-literal type. - - -section (gnu::section, __declspec(allocate)) --------------------------------------------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","X","X","", "" - -The ``section`` attribute allows you to specify a specific section a -global variable or function should be in after translation. - - -swiftcall (gnu::swiftcall) --------------------------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","X","","", "" - -The ``swiftcall`` attribute indicates that a function should be called -using the Swift calling convention for a function or function pointer. - -The lowering for the Swift calling convention, as described by the Swift -ABI documentation, occurs in multiple phases. The first, "high-level" -phase breaks down the formal parameters and results into innately direct -and indirect components, adds implicit paraameters for the generic -signature, and assigns the context and error ABI treatments to parameters -where applicable. The second phase breaks down the direct parameters -and results from the first phase and assigns them to registers or the -stack. The ``swiftcall`` convention only handles this second phase of -lowering; the C function type must accurately reflect the results -of the first phase, as follows: - -- Results classified as indirect by high-level lowering should be - represented as parameters with the ``swift_indirect_result`` attribute. - -- Results classified as direct by high-level lowering should be represented - as follows: - - - First, remove any empty direct results. - - - If there are no direct results, the C result type should be ``void``. - - - If there is one direct result, the C result type should be a type with - the exact layout of that result type. - - - If there are a multiple direct results, the C result type should be - a struct type with the exact layout of a tuple of those results. - -- Parameters classified as indirect by high-level lowering should be - represented as parameters of pointer type. - -- Parameters classified as direct by high-level lowering should be - omitted if they are empty types; otherwise, they should be represented - as a parameter type with a layout exactly matching the layout of the - Swift parameter type. - -- The context parameter, if present, should be represented as a trailing - parameter with the ``swift_context`` attribute. - -- The error result parameter, if present, should be represented as a - trailing parameter (always following a context parameter) with the - ``swift_error_result`` attribute. - -``swiftcall`` does not support variadic arguments or unprototyped functions. - -The parameter ABI treatment attributes are aspects of the function type. -A function type which which applies an ABI treatment attribute to a -parameter is a different type from an otherwise-identical function type -that does not. A single parameter may not have multiple ABI treatment -attributes. - -Support for this feature is target-dependent, although it should be -supported on every target that Swift supports. Query for this support -with ``__has_attribute(swiftcall)``. This implies support for the -``swift_context``, ``swift_error_result``, and ``swift_indirect_result`` -attributes. - - -swift_context (gnu::swift_context) ----------------------------------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","X","","", "" - -The ``swift_context`` attribute marks a parameter of a ``swiftcall`` -function as having the special context-parameter ABI treatment. - -This treatment generally passes the context value in a special register -which is normally callee-preserved. - -A ``swift_context`` parameter must either be the last parameter or must be -followed by a ``swift_error_result`` parameter (which itself must always be -the last parameter). - -A context parameter must have pointer or reference type. - - -swift_error_result (gnu::swift_error_result) --------------------------------------------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","X","","", "" - -The ``swift_error_result`` attribute marks a parameter of a ``swiftcall`` -function as having the special error-result ABI treatment. - -This treatment generally passes the underlying error value in and out of -the function through a special register which is normally callee-preserved. -This is modeled in C by pretending that the register is addressable memory: - -- The caller appears to pass the address of a variable of pointer type. - The current value of this variable is copied into the register before - the call; if the call returns normally, the value is copied back into the - variable. - -- The callee appears to receive the address of a variable. This address - is actually a hidden location in its own stack, initialized with the - value of the register upon entry. When the function returns normally, - the value in that hidden location is written back to the register. - -A ``swift_error_result`` parameter must be the last parameter, and it must be -preceded by a ``swift_context`` parameter. - -A ``swift_error_result`` parameter must have type ``T**`` or ``T*&`` for some -type T. Note that no qualifiers are permitted on the intermediate level. - -It is undefined behavior if the caller does not pass a pointer or -reference to a valid object. - -The standard convention is that the error value itself (that is, the -value stored in the apparent argument) will be null upon function entry, -but this is not enforced by the ABI. - - -swift_indirect_result (gnu::swift_indirect_result) --------------------------------------------------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","X","","", "" - -The ``swift_indirect_result`` attribute marks a parameter of a ``swiftcall`` -function as having the special indirect-result ABI treatment. - -This treatment gives the parameter the target's normal indirect-result -ABI treatment, which may involve passing it differently from an ordinary -parameter. However, only the first indirect result will receive this -treatment. Furthermore, low-level lowering may decide that a direct result -must be returned indirectly; if so, this will take priority over the -``swift_indirect_result`` parameters. - -A ``swift_indirect_result`` parameter must either be the first parameter or -follow another ``swift_indirect_result`` parameter. - -A ``swift_indirect_result`` parameter must have type ``T*`` or ``T&`` for -some object type ``T``. If ``T`` is a complete type at the point of -definition of a function, it is undefined behavior if the argument -value does not point to storage of adequate size and alignment for a -value of type ``T``. - -Making indirect results explicit in the signature allows C functions to -directly construct objects into them without relying on language -optimizations like C++'s named return value optimization (NRVO). - - -tls_model (gnu::tls_model) --------------------------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","X","","", "" - -The ``tls_model`` attribute allows you to specify which thread-local storage -model to use. It accepts the following strings: - -* global-dynamic -* local-dynamic -* initial-exec -* local-exec - -TLS models are mutually exclusive. - - -thread ------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "","","X","", "" - -The ``__declspec(thread)`` attribute declares a variable with thread local -storage. It is available under the ``-fms-extensions`` flag for MSVC -compatibility. See the documentation for `__declspec(thread)`_ on MSDN. - -.. _`__declspec(thread)`: http://msdn.microsoft.com/en-us/library/9w1sdazb.aspx - -In Clang, ``__declspec(thread)`` is generally equivalent in functionality to the -GNU ``__thread`` keyword. The variable must not have a destructor and must have -a constant initializer, if any. The attribute only applies to variables -declared with static storage duration, such as globals, class static data -members, and static locals. - - -maybe_unused, unused, gnu::unused ---------------------------------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","X","","", "" - -When passing the ``-Wunused`` flag to Clang, entities that are unused by the -program may be diagnosed. The ``[[maybe_unused]]`` (or -``__attribute__((unused))``) attribute can be used to silence such diagnostics -when the entity cannot be removed. For instance, a local variable may exist -solely for use in an ``assert()`` statement, which makes the local variable -unused when ``NDEBUG`` is defined. - -The attribute may be applied to the declaration of a class, a typedef, a -variable, a function or method, a function parameter, an enumeration, an -enumerator, a non-static data member, or a label. - -.. code-block: c++ - #include - - [[maybe_unused]] void f([[maybe_unused]] bool thing1, - [[maybe_unused]] bool thing2) { - [[maybe_unused]] bool b = thing1 && thing2; - assert(b); - } - - -Type Attributes -=============== - - -align_value ------------ -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","","","", "" - -The align_value attribute can be added to the typedef of a pointer type or the -declaration of a variable of pointer or reference type. It specifies that the -pointer will point to, or the reference will bind to, only objects with at -least the provided alignment. This alignment value must be some positive power -of 2. - - .. code-block:: c - - typedef double * aligned_double_ptr __attribute__((align_value(64))); - void foo(double & x __attribute__((align_value(128)), - aligned_double_ptr y) { ... } - -If the pointer value does not have the specified alignment at runtime, the -behavior of the program is undefined. - - -empty_bases ------------ -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "","","X","", "" - -The empty_bases attribute permits the compiler to utilize the -empty-base-optimization more frequently. -This attribute only applies to struct, class, and union types. -It is only supported when using the Microsoft C++ ABI. - - -flag_enum ---------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","","","", "" - -This attribute can be added to an enumerator to signal to the compiler that it -is intended to be used as a flag type. This will cause the compiler to assume -that the range of the type includes all of the values that you can get by -manipulating bits of the enumerator when issuing warnings. - - -lto_visibility_public (clang::lto_visibility_public) ----------------------------------------------------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "","X","","", "" - -See :doc:`LTOVisibility`. - - -layout_version --------------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "","","X","", "" - -The layout_version attribute requests that the compiler utilize the class -layout rules of a particular compiler version. -This attribute only applies to struct, class, and union types. -It is only supported when using the Microsoft C++ ABI. - - -__single_inhertiance, __multiple_inheritance, __virtual_inheritance -------------------------------------------------------------------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "","","","X", "" - -This collection of keywords is enabled under ``-fms-extensions`` and controls -the pointer-to-member representation used on ``*-*-win32`` targets. - -The ``*-*-win32`` targets utilize a pointer-to-member representation which -varies in size and alignment depending on the definition of the underlying -class. - -However, this is problematic when a forward declaration is only available and -no definition has been made yet. In such cases, Clang is forced to utilize the -most general representation that is available to it. - -These keywords make it possible to use a pointer-to-member representation other -than the most general one regardless of whether or not the definition will ever -be present in the current translation unit. - -This family of keywords belong between the ``class-key`` and ``class-name``: - -.. code-block:: c++ - - struct __single_inheritance S; - int S::*i; - struct S {}; - -This keyword can be applied to class templates but only has an effect when used -on full specializations: - -.. code-block:: c++ - - template struct __single_inheritance A; // warning: inheritance model ignored on primary template - template struct __multiple_inheritance A; // warning: inheritance model ignored on partial specialization - template <> struct __single_inheritance A; - -Note that choosing an inheritance model less general than strictly necessary is -an error: - -.. code-block:: c++ - - struct __multiple_inheritance S; // error: inheritance model does not match definition - int S::*i; - struct S {}; - - -novtable --------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "","","X","", "" - -This attribute can be added to a class declaration or definition to signal to -the compiler that constructors and destructors will not reference the virtual -function table. It is only supported when using the Microsoft C++ ABI. - - -objc_subclassing_restricted ---------------------------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","","","", "" - -This attribute can be added to an Objective-C ``@interface`` declaration to -ensure that this class cannot be subclassed. - - -transparent_union (gnu::transparent_union) ------------------------------------------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","X","","", "" - -This attribute can be applied to a union to change the behaviour of calls to -functions that have an argument with a transparent union type. The compiler -behaviour is changed in the following manner: - -- A value whose type is any member of the transparent union can be passed as an - argument without the need to cast that value. - -- The argument is passed to the function using the calling convention of the - first member of the transparent union. Consequently, all the members of the - transparent union should have the same calling convention as its first member. - -Transparent unions are not supported in C++. - - -Statement Attributes -==================== - - -fallthrough, clang::fallthrough -------------------------------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "","X","","", "" - -The ``fallthrough`` (or ``clang::fallthrough``) attribute is used -to annotate intentional fall-through -between switch labels. It can only be applied to a null statement placed at a -point of execution between any statement and the next switch label. It is -common to mark these places with a specific comment, but this attribute is -meant to replace comments with a more strict annotation, which can be checked -by the compiler. This attribute doesn't change semantics of the code and can -be used wherever an intended fall-through occurs. It is designed to mimic -control-flow statements like ``break;``, so it can be placed in most places -where ``break;`` can, but only if there are no statements on the execution path -between it and the next switch label. - -By default, Clang does not warn on unannotated fallthrough from one ``switch`` -case to another. Diagnostics on fallthrough without a corresponding annotation -can be enabled with the ``-Wimplicit-fallthrough`` argument. - -Here is an example: - -.. code-block:: c++ - - // compile with -Wimplicit-fallthrough - switch (n) { - case 22: - case 33: // no warning: no statements between case labels - f(); - case 44: // warning: unannotated fall-through - g(); - [[clang::fallthrough]]; - case 55: // no warning - if (x) { - h(); - break; - } - else { - i(); - [[clang::fallthrough]]; - } - case 66: // no warning - p(); - [[clang::fallthrough]]; // warning: fallthrough annotation does not - // directly precede case label - q(); - case 77: // warning: unannotated fall-through - r(); - } - - -#pragma clang loop ------------------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "","","","", "X" - -The ``#pragma clang loop`` directive allows loop optimization hints to be -specified for the subsequent loop. The directive allows vectorization, -interleaving, and unrolling to be enabled or disabled. Vector width as well -as interleave and unrolling count can be manually specified. See -`language extensions -`_ -for details. - - -#pragma unroll, #pragma nounroll --------------------------------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "","","","", "X" - -Loop unrolling optimization hints can be specified with ``#pragma unroll`` and -``#pragma nounroll``. The pragma is placed immediately before a for, while, -do-while, or c++11 range-based for loop. - -Specifying ``#pragma unroll`` without a parameter directs the loop unroller to -attempt to fully unroll the loop if the trip count is known at compile time and -attempt to partially unroll the loop if the trip count is not known at compile -time: - -.. code-block:: c++ - - #pragma unroll - for (...) { - ... - } - -Specifying the optional parameter, ``#pragma unroll _value_``, directs the -unroller to unroll the loop ``_value_`` times. The parameter may optionally be -enclosed in parentheses: - -.. code-block:: c++ - - #pragma unroll 16 - for (...) { - ... - } - - #pragma unroll(16) - for (...) { - ... - } - -Specifying ``#pragma nounroll`` indicates that the loop should not be unrolled: - -.. code-block:: c++ - - #pragma nounroll - for (...) { - ... - } - -``#pragma unroll`` and ``#pragma unroll _value_`` have identical semantics to -``#pragma clang loop unroll(full)`` and -``#pragma clang loop unroll_count(_value_)`` respectively. ``#pragma nounroll`` -is equivalent to ``#pragma clang loop unroll(disable)``. See -`language extensions -`_ -for further details including limitations of the unroll hints. - - -__read_only, __write_only, __read_write (read_only, write_only, read_write) ---------------------------------------------------------------------------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "","","","X", "" - -The access qualifiers must be used with image object arguments or pipe arguments -to declare if they are being read or written by a kernel or function. - -The read_only/__read_only, write_only/__write_only and read_write/__read_write -names are reserved for use as access qualifiers and shall not be used otherwise. - -.. code-block:: c - - kernel void - foo (read_only image2d_t imageA, - write_only image2d_t imageB) { - ... - } - -In the above example imageA is a read-only 2D image object, and imageB is a -write-only 2D image object. - -The read_write (or __read_write) qualifier can not be used with pipe. - -More details can be found in the OpenCL C language Spec v2.0, Section 6.6. - - -__attribute__((opencl_unroll_hint)) ------------------------------------ -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","","","", "" - -The opencl_unroll_hint attribute qualifier can be used to specify that a loop -(for, while and do loops) can be unrolled. This attribute qualifier can be -used to specify full unrolling or partial unrolling by a specified amount. -This is a compiler hint and the compiler may ignore this directive. See -`OpenCL v2.0 `_ -s6.11.5 for details. - - -Type Safety Checking -==================== -Clang supports additional attributes to enable checking type safety properties -that can't be enforced by the C type system. To see warnings produced by these -checks, ensure that -Wtype-safety is enabled. Use cases include: - -* MPI library implementations, where these attributes enable checking that - the buffer type matches the passed ``MPI_Datatype``; -* for HDF5 library there is a similar use case to MPI; -* checking types of variadic functions' arguments for functions like - ``fcntl()`` and ``ioctl()``. - -You can detect support for these attributes with ``__has_attribute()``. For -example: - -.. code-block:: c++ - - #if defined(__has_attribute) - # if __has_attribute(argument_with_type_tag) && \ - __has_attribute(pointer_with_type_tag) && \ - __has_attribute(type_tag_for_datatype) - # define ATTR_MPI_PWT(buffer_idx, type_idx) __attribute__((pointer_with_type_tag(mpi,buffer_idx,type_idx))) - /* ... other macros ... */ - # endif - #endif - - #if !defined(ATTR_MPI_PWT) - # define ATTR_MPI_PWT(buffer_idx, type_idx) - #endif - - int MPI_Send(void *buf, int count, MPI_Datatype datatype /*, other args omitted */) - ATTR_MPI_PWT(1,3); - -argument_with_type_tag ----------------------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","","","", "" - -Use ``__attribute__((argument_with_type_tag(arg_kind, arg_idx, -type_tag_idx)))`` on a function declaration to specify that the function -accepts a type tag that determines the type of some other argument. - -This attribute is primarily useful for checking arguments of variadic functions -(``pointer_with_type_tag`` can be used in most non-variadic cases). - -In the attribute prototype above: - * ``arg_kind`` is an identifier that should be used when annotating all - applicable type tags. - * ``arg_idx`` provides the position of a function argument. The expected type of - this function argument will be determined by the function argument specified - by ``type_tag_idx``. In the code example below, "3" means that the type of the - function's third argument will be determined by ``type_tag_idx``. - * ``type_tag_idx`` provides the position of a function argument. This function - argument will be a type tag. The type tag will determine the expected type of - the argument specified by ``arg_idx``. In the code example below, "2" means - that the type tag associated with the function's second argument should agree - with the type of the argument specified by ``arg_idx``. - -For example: - -.. code-block:: c++ - - int fcntl(int fd, int cmd, ...) - __attribute__(( argument_with_type_tag(fcntl,3,2) )); - // The function's second argument will be a type tag; this type tag will - // determine the expected type of the function's third argument. - - -pointer_with_type_tag ---------------------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","","","", "" - -Use ``__attribute__((pointer_with_type_tag(ptr_kind, ptr_idx, type_tag_idx)))`` -on a function declaration to specify that the function accepts a type tag that -determines the pointee type of some other pointer argument. - -In the attribute prototype above: - * ``ptr_kind`` is an identifier that should be used when annotating all - applicable type tags. - * ``ptr_idx`` provides the position of a function argument; this function - argument will have a pointer type. The expected pointee type of this pointer - type will be determined by the function argument specified by - ``type_tag_idx``. In the code example below, "1" means that the pointee type - of the function's first argument will be determined by ``type_tag_idx``. - * ``type_tag_idx`` provides the position of a function argument; this function - argument will be a type tag. The type tag will determine the expected pointee - type of the pointer argument specified by ``ptr_idx``. In the code example - below, "3" means that the type tag associated with the function's third - argument should agree with the pointee type of the pointer argument specified - by ``ptr_idx``. - -For example: - -.. code-block:: c++ - - typedef int MPI_Datatype; - int MPI_Send(void *buf, int count, MPI_Datatype datatype /*, other args omitted */) - __attribute__(( pointer_with_type_tag(mpi,1,3) )); - // The function's 3rd argument will be a type tag; this type tag will - // determine the expected pointee type of the function's 1st argument. - - -type_tag_for_datatype ---------------------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","","","", "" - -When declaring a variable, use -``__attribute__((type_tag_for_datatype(kind, type)))`` to create a type tag that -is tied to the ``type`` argument given to the attribute. - -In the attribute prototype above: - * ``kind`` is an identifier that should be used when annotating all applicable - type tags. - * ``type`` indicates the name of the type. - -Clang supports annotating type tags of two forms. - - * **Type tag that is a reference to a declared identifier.** - Use ``__attribute__((type_tag_for_datatype(kind, type)))`` when declaring that - identifier: - - .. code-block:: c++ - - typedef int MPI_Datatype; - extern struct mpi_datatype mpi_datatype_int - __attribute__(( type_tag_for_datatype(mpi,int) )); - #define MPI_INT ((MPI_Datatype) &mpi_datatype_int) - // &mpi_datatype_int is a type tag. It is tied to type "int". - - * **Type tag that is an integral literal.** - Declare a ``static const`` variable with an initializer value and attach - ``__attribute__((type_tag_for_datatype(kind, type)))`` on that declaration: - - .. code-block:: c++ - - typedef int MPI_Datatype; - static const MPI_Datatype mpi_datatype_int - __attribute__(( type_tag_for_datatype(mpi,int) )) = 42; - #define MPI_INT ((MPI_Datatype) 42) - // The number 42 is a type tag. It is tied to type "int". - - -The ``type_tag_for_datatype`` attribute also accepts an optional third argument -that determines how the type of the function argument specified by either -``arg_idx`` or ``ptr_idx`` is compared against the type associated with the type -tag. (Recall that for the ``argument_with_type_tag`` attribute, the type of the -function argument specified by ``arg_idx`` is compared against the type -associated with the type tag. Also recall that for the ``pointer_with_type_tag`` -attribute, the pointee type of the function argument specified by ``ptr_idx`` is -compared against the type associated with the type tag.) There are two supported -values for this optional third argument: - - * ``layout_compatible`` will cause types to be compared according to - layout-compatibility rules (In C++11 [class.mem] p 17, 18, see the - layout-compatibility rules for two standard-layout struct types and for two - standard-layout union types). This is useful when creating a type tag - associated with a struct or union type. For example: - - .. code-block:: c++ - - /* In mpi.h */ - typedef int MPI_Datatype; - struct internal_mpi_double_int { double d; int i; }; - extern struct mpi_datatype mpi_datatype_double_int - __attribute__(( type_tag_for_datatype(mpi, - struct internal_mpi_double_int, layout_compatible) )); - - #define MPI_DOUBLE_INT ((MPI_Datatype) &mpi_datatype_double_int) - - int MPI_Send(void *buf, int count, MPI_Datatype datatype, ...) - __attribute__(( pointer_with_type_tag(mpi,1,3) )); - - /* In user code */ - struct my_pair { double a; int b; }; - struct my_pair *buffer; - MPI_Send(buffer, 1, MPI_DOUBLE_INT /*, ... */); // no warning because the - // layout of my_pair is - // compatible with that of - // internal_mpi_double_int - - struct my_int_pair { int a; int b; } - struct my_int_pair *buffer2; - MPI_Send(buffer2, 1, MPI_DOUBLE_INT /*, ... */); // warning because the - // layout of my_int_pair - // does not match that of - // internal_mpi_double_int - - * ``must_be_null`` specifies that the function argument specified by either - ``arg_idx`` (for the ``argument_with_type_tag`` attribute) or ``ptr_idx`` (for - the ``pointer_with_type_tag`` attribute) should be a null pointer constant. - The second argument to the ``type_tag_for_datatype`` attribute is ignored. For - example: - - .. code-block:: c++ - - /* In mpi.h */ - typedef int MPI_Datatype; - extern struct mpi_datatype mpi_datatype_null - __attribute__(( type_tag_for_datatype(mpi, void, must_be_null) )); - - #define MPI_DATATYPE_NULL ((MPI_Datatype) &mpi_datatype_null) - int MPI_Send(void *buf, int count, MPI_Datatype datatype, ...) - __attribute__(( pointer_with_type_tag(mpi,1,3) )); - - /* In user code */ - struct my_pair { double a; int b; }; - struct my_pair *buffer; - MPI_Send(buffer, 1, MPI_DATATYPE_NULL /*, ... */); // warning: MPI_DATATYPE_NULL - // was specified but buffer - // is not a null pointer - - -AMD GPU Attributes -================== - - -amdgpu_flat_work_group_size ---------------------------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","","","", "" - -The flat work-group size is the number of work-items in the work-group size -specified when the kernel is dispatched. It is the product of the sizes of the -x, y, and z dimension of the work-group. - -Clang supports the -``__attribute__((amdgpu_flat_work_group_size(, )))`` attribute for the -AMDGPU target. This attribute may be attached to a kernel function definition -and is an optimization hint. - -```` parameter specifies the minimum flat work-group size, and ```` -parameter specifies the maximum flat work-group size (must be greater than -````) to which all dispatches of the kernel will conform. Passing ``0, 0`` -as ``, `` implies the default behavior (``128, 256``). - -If specified, the AMDGPU target backend might be able to produce better machine -code for barriers and perform scratch promotion by estimating available group -segment size. - -An error will be given if: - - Specified values violate subtarget specifications; - - Specified values are not compatible with values provided through other - attributes. - - -amdgpu_num_sgpr ---------------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","","","", "" - -Clang supports the ``__attribute__((amdgpu_num_sgpr()))`` and -``__attribute__((amdgpu_num_vgpr()))`` attributes for the AMDGPU -target. These attributes may be attached to a kernel function definition and are -an optimization hint. - -If these attributes are specified, then the AMDGPU target backend will attempt -to limit the number of SGPRs and/or VGPRs used to the specified value(s). The -number of used SGPRs and/or VGPRs may further be rounded up to satisfy the -allocation requirements or constraints of the subtarget. Passing ``0`` as -``num_sgpr`` and/or ``num_vgpr`` implies the default behavior (no limits). - -These attributes can be used to test the AMDGPU target backend. It is -recommended that the ``amdgpu_waves_per_eu`` attribute be used to control -resources such as SGPRs and VGPRs since it is aware of the limits for different -subtargets. - -An error will be given if: - - Specified values violate subtarget specifications; - - Specified values are not compatible with values provided through other - attributes; - - The AMDGPU target backend is unable to create machine code that can meet the - request. - - -amdgpu_num_vgpr ---------------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","","","", "" - -Clang supports the ``__attribute__((amdgpu_num_sgpr()))`` and -``__attribute__((amdgpu_num_vgpr()))`` attributes for the AMDGPU -target. These attributes may be attached to a kernel function definition and are -an optimization hint. - -If these attributes are specified, then the AMDGPU target backend will attempt -to limit the number of SGPRs and/or VGPRs used to the specified value(s). The -number of used SGPRs and/or VGPRs may further be rounded up to satisfy the -allocation requirements or constraints of the subtarget. Passing ``0`` as -``num_sgpr`` and/or ``num_vgpr`` implies the default behavior (no limits). - -These attributes can be used to test the AMDGPU target backend. It is -recommended that the ``amdgpu_waves_per_eu`` attribute be used to control -resources such as SGPRs and VGPRs since it is aware of the limits for different -subtargets. - -An error will be given if: - - Specified values violate subtarget specifications; - - Specified values are not compatible with values provided through other - attributes; - - The AMDGPU target backend is unable to create machine code that can meet the - request. - - -amdgpu_waves_per_eu -------------------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","","","", "" - -A compute unit (CU) is responsible for executing the wavefronts of a work-group. -It is composed of one or more execution units (EU), which are responsible for -executing the wavefronts. An EU can have enough resources to maintain the state -of more than one executing wavefront. This allows an EU to hide latency by -switching between wavefronts in a similar way to symmetric multithreading on a -CPU. In order to allow the state for multiple wavefronts to fit on an EU, the -resources used by a single wavefront have to be limited. For example, the number -of SGPRs and VGPRs. Limiting such resources can allow greater latency hiding, -but can result in having to spill some register state to memory. - -Clang supports the ``__attribute__((amdgpu_waves_per_eu([, ])))`` -attribute for the AMDGPU target. This attribute may be attached to a kernel -function definition and is an optimization hint. - -```` parameter specifies the requested minimum number of waves per EU, and -*optional* ```` parameter specifies the requested maximum number of waves -per EU (must be greater than ```` if specified). If ```` is omitted, -then there is no restriction on the maximum number of waves per EU other than -the one dictated by the hardware for which the kernel is compiled. Passing -``0, 0`` as ``, `` implies the default behavior (no limits). - -If specified, this attribute allows an advanced developer to tune the number of -wavefronts that are capable of fitting within the resources of an EU. The AMDGPU -target backend can use this information to limit resources, such as number of -SGPRs, number of VGPRs, size of available group and private memory segments, in -such a way that guarantees that at least ```` wavefronts and at most -```` wavefronts are able to fit within the resources of an EU. Requesting -more wavefronts can hide memory latency but limits available registers which -can result in spilling. Requesting fewer wavefronts can help reduce cache -thrashing, but can reduce memory latency hiding. - -This attribute controls the machine code generated by the AMDGPU target backend -to ensure it is capable of meeting the requested values. However, when the -kernel is executed, there may be other reasons that prevent meeting the request, -for example, there may be wavefronts from other kernels executing on the EU. - -An error will be given if: - - Specified values violate subtarget specifications; - - Specified values are not compatible with values provided through other - attributes; - - The AMDGPU target backend is unable to create machine code that can meet the - request. - - -Calling Conventions -=================== -Clang supports several different calling conventions, depending on the target -platform and architecture. The calling convention used for a function determines -how parameters are passed, how results are returned to the caller, and other -low-level details of calling a function. - -fastcall (gnu::fastcall, __fastcall, _fastcall) ------------------------------------------------ -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","X","","X", "" - -On 32-bit x86 targets, this attribute changes the calling convention of a -function to use ECX and EDX as register parameters and clear parameters off of -the stack on return. This convention does not support variadic calls or -unprototyped functions in C, and has no effect on x86_64 targets. This calling -convention is supported primarily for compatibility with existing code. Users -seeking register parameters should use the ``regparm`` attribute, which does -not require callee-cleanup. See the documentation for `__fastcall`_ on MSDN. - -.. _`__fastcall`: http://msdn.microsoft.com/en-us/library/6xa169sk.aspx - - -ms_abi (gnu::ms_abi) --------------------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","X","","", "" - -On non-Windows x86_64 targets, this attribute changes the calling convention of -a function to match the default convention used on Windows x86_64. This -attribute has no effect on Windows targets or non-x86_64 targets. - - -pcs (gnu::pcs) --------------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","X","","", "" - -On ARM targets, this attribute can be used to select calling conventions -similar to ``stdcall`` on x86. Valid parameter values are "aapcs" and -"aapcs-vfp". - - -preserve_all ------------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","","","", "" - -On X86-64 and AArch64 targets, this attribute changes the calling convention of -a function. The ``preserve_all`` calling convention attempts to make the code -in the caller even less intrusive than the ``preserve_most`` calling convention. -This calling convention also behaves identical to the ``C`` calling convention -on how arguments and return values are passed, but it uses a different set of -caller/callee-saved registers. This removes the burden of saving and -recovering a large register set before and after the call in the caller. If -the arguments are passed in callee-saved registers, then they will be -preserved by the callee across the call. This doesn't apply for values -returned in callee-saved registers. - -- On X86-64 the callee preserves all general purpose registers, except for - R11. R11 can be used as a scratch register. Furthermore it also preserves - all floating-point registers (XMMs/YMMs). - -The idea behind this convention is to support calls to runtime functions -that don't need to call out to any other functions. - -This calling convention, like the ``preserve_most`` calling convention, will be -used by a future version of the Objective-C runtime and should be considered -experimental at this time. - - -preserve_most -------------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","","","", "" - -On X86-64 and AArch64 targets, this attribute changes the calling convention of -a function. The ``preserve_most`` calling convention attempts to make the code -in the caller as unintrusive as possible. This convention behaves identically -to the ``C`` calling convention on how arguments and return values are passed, -but it uses a different set of caller/callee-saved registers. This alleviates -the burden of saving and recovering a large register set before and after the -call in the caller. If the arguments are passed in callee-saved registers, -then they will be preserved by the callee across the call. This doesn't -apply for values returned in callee-saved registers. - -- On X86-64 the callee preserves all general purpose registers, except for - R11. R11 can be used as a scratch register. Floating-point registers - (XMMs/YMMs) are not preserved and need to be saved by the caller. - -The idea behind this convention is to support calls to runtime functions -that have a hot path and a cold path. The hot path is usually a small piece -of code that doesn't use many registers. The cold path might need to call out to -another function and therefore only needs to preserve the caller-saved -registers, which haven't already been saved by the caller. The -`preserve_most` calling convention is very similar to the ``cold`` calling -convention in terms of caller/callee-saved registers, but they are used for -different types of function calls. ``coldcc`` is for function calls that are -rarely executed, whereas `preserve_most` function calls are intended to be -on the hot path and definitely executed a lot. Furthermore ``preserve_most`` -doesn't prevent the inliner from inlining the function call. - -This calling convention will be used by a future version of the Objective-C -runtime and should therefore still be considered experimental at this time. -Although this convention was created to optimize certain runtime calls to -the Objective-C runtime, it is not limited to this runtime and might be used -by other runtimes in the future too. The current implementation only -supports X86-64 and AArch64, but the intention is to support more architectures -in the future. - - -regcall (gnu::regcall, __regcall) ---------------------------------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","X","","X", "" - -On x86 targets, this attribute changes the calling convention to -`__regcall`_ convention. This convention aims to pass as many arguments -as possible in registers. It also tries to utilize registers for the -return value whenever it is possible. - -.. _`__regcall`: https://software.intel.com/en-us/node/693069 - - -regparm (gnu::regparm) ----------------------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","X","","", "" - -On 32-bit x86 targets, the regparm attribute causes the compiler to pass -the first three integer parameters in EAX, EDX, and ECX instead of on the -stack. This attribute has no effect on variadic functions, and all parameters -are passed via the stack as normal. - - -stdcall (gnu::stdcall, __stdcall, _stdcall) -------------------------------------------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","X","","X", "" - -On 32-bit x86 targets, this attribute changes the calling convention of a -function to clear parameters off of the stack on return. This convention does -not support variadic calls or unprototyped functions in C, and has no effect on -x86_64 targets. This calling convention is used widely by the Windows API and -COM applications. See the documentation for `__stdcall`_ on MSDN. - -.. _`__stdcall`: http://msdn.microsoft.com/en-us/library/zxk0tw93.aspx - - -thiscall (gnu::thiscall, __thiscall, _thiscall) ------------------------------------------------ -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","X","","X", "" - -On 32-bit x86 targets, this attribute changes the calling convention of a -function to use ECX for the first parameter (typically the implicit ``this`` -parameter of C++ methods) and clear parameters off of the stack on return. This -convention does not support variadic calls or unprototyped functions in C, and -has no effect on x86_64 targets. See the documentation for `__thiscall`_ on -MSDN. - -.. _`__thiscall`: http://msdn.microsoft.com/en-us/library/ek8tkfbw.aspx - - -vectorcall (__vectorcall, _vectorcall) --------------------------------------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","","","X", "" - -On 32-bit x86 *and* x86_64 targets, this attribute changes the calling -convention of a function to pass vector parameters in SSE registers. - -On 32-bit x86 targets, this calling convention is similar to ``__fastcall``. -The first two integer parameters are passed in ECX and EDX. Subsequent integer -parameters are passed in memory, and callee clears the stack. On x86_64 -targets, the callee does *not* clear the stack, and integer parameters are -passed in RCX, RDX, R8, and R9 as is done for the default Windows x64 calling -convention. - -On both 32-bit x86 and x86_64 targets, vector and floating point arguments are -passed in XMM0-XMM5. Homogeneous vector aggregates of up to four elements are -passed in sequential SSE registers if enough are available. If AVX is enabled, -256 bit vectors are passed in YMM0-YMM5. Any vector or aggregate type that -cannot be passed in registers for any reason is passed by reference, which -allows the caller to align the parameter memory. - -See the documentation for `__vectorcall`_ on MSDN for more details. - -.. _`__vectorcall`: http://msdn.microsoft.com/en-us/library/dn375768.aspx - - -Consumed Annotation Checking -============================ -Clang supports additional attributes for checking basic resource management -properties, specifically for unique objects that have a single owning reference. -The following attributes are currently supported, although **the implementation -for these annotations is currently in development and are subject to change.** - -callable_when -------------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","","","", "" - -Use ``__attribute__((callable_when(...)))`` to indicate what states a method -may be called in. Valid states are unconsumed, consumed, or unknown. Each -argument to this attribute must be a quoted string. E.g.: - -``__attribute__((callable_when("unconsumed", "unknown")))`` - - -consumable ----------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","","","", "" - -Each ``class`` that uses any of the typestate annotations must first be marked -using the ``consumable`` attribute. Failure to do so will result in a warning. - -This attribute accepts a single parameter that must be one of the following: -``unknown``, ``consumed``, or ``unconsumed``. - - -param_typestate ---------------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","","","", "" - -This attribute specifies expectations about function parameters. Calls to an -function with annotated parameters will issue a warning if the corresponding -argument isn't in the expected state. The attribute is also used to set the -initial state of the parameter when analyzing the function's body. - - -return_typestate ----------------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","","","", "" - -The ``return_typestate`` attribute can be applied to functions or parameters. -When applied to a function the attribute specifies the state of the returned -value. The function's body is checked to ensure that it always returns a value -in the specified state. On the caller side, values returned by the annotated -function are initialized to the given state. - -When applied to a function parameter it modifies the state of an argument after -a call to the function returns. The function's body is checked to ensure that -the parameter is in the expected state before returning. - - -set_typestate -------------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","","","", "" - -Annotate methods that transition an object into a new state with -``__attribute__((set_typestate(new_state)))``. The new state must be -unconsumed, consumed, or unknown. - - -test_typestate --------------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","","","", "" - -Use ``__attribute__((test_typestate(tested_state)))`` to indicate that a method -returns true if the object is in the specified state.. - - -OpenCL Address Spaces -===================== -The address space qualifier may be used to specify the region of memory that is -used to allocate the object. OpenCL supports the following address spaces: -__generic(generic), __global(global), __local(local), __private(private), -__constant(constant). - - .. code-block:: c - - __constant int c = ...; - - __generic int* foo(global int* g) { - __local int* l; - private int p; - ... - return l; - } - -More details can be found in the OpenCL C language Spec v2.0, Section 6.5. - -constant (__constant) ---------------------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "","","","X", "" - -The constant address space attribute signals that an object is located in -a constant (non-modifiable) memory region. It is available to all work items. -Any type can be annotated with the constant address space attribute. Objects -with the constant address space qualifier can be declared in any scope and must -have an initializer. - - -generic (__generic) -------------------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "","","","X", "" - -The generic address space attribute is only available with OpenCL v2.0 and later. -It can be used with pointer types. Variables in global and local scope and -function parameters in non-kernel functions can have the generic address space -type attribute. It is intended to be a placeholder for any other address space -except for '__constant' in OpenCL code which can be used with multiple address -spaces. - - -global (__global) ------------------ -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "","","","X", "" - -The global address space attribute specifies that an object is allocated in -global memory, which is accessible by all work items. The content stored in this -memory area persists between kernel executions. Pointer types to the global -address space are allowed as function parameters or local variables. Starting -with OpenCL v2.0, the global address space can be used with global (program -scope) variables and static local variable as well. - - -local (__local) ---------------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "","","","X", "" - -The local address space specifies that an object is allocated in the local (work -group) memory area, which is accessible to all work items in the same work -group. The content stored in this memory region is not accessible after -the kernel execution ends. In a kernel function scope, any variable can be in -the local address space. In other scopes, only pointer types to the local address -space are allowed. Local address space variables cannot have an initializer. - - -private (__private) -------------------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "","","","X", "" - -The private address space specifies that an object is allocated in the private -(work item) memory. Other work items cannot access the same memory area and its -content is destroyed after work item execution ends. Local variables can be -declared in the private address space. Function arguments are always in the -private address space. Kernel function arguments of a pointer or an array type -cannot point to the private address space. - - -Nullability Attributes -====================== -Whether a particular pointer may be "null" is an important concern when working with pointers in the C family of languages. The various nullability attributes indicate whether a particular pointer can be null or not, which makes APIs more expressive and can help static analysis tools identify bugs involving null pointers. Clang supports several kinds of nullability attributes: the ``nonnull`` and ``returns_nonnull`` attributes indicate which function or method parameters and result types can never be null, while nullability type qualifiers indicate which pointer types can be null (``_Nullable``) or cannot be null (``_Nonnull``). - -The nullability (type) qualifiers express whether a value of a given pointer type can be null (the ``_Nullable`` qualifier), doesn't have a defined meaning for null (the ``_Nonnull`` qualifier), or for which the purpose of null is unclear (the ``_Null_unspecified`` qualifier). Because nullability qualifiers are expressed within the type system, they are more general than the ``nonnull`` and ``returns_nonnull`` attributes, allowing one to express (for example) a nullable pointer to an array of nonnull pointers. Nullability qualifiers are written to the right of the pointer to which they apply. For example: - - .. code-block:: c - - // No meaningful result when 'ptr' is null (here, it happens to be undefined behavior). - int fetch(int * _Nonnull ptr) { return *ptr; } - - // 'ptr' may be null. - int fetch_or_zero(int * _Nullable ptr) { - return ptr ? *ptr : 0; - } - - // A nullable pointer to non-null pointers to const characters. - const char *join_strings(const char * _Nonnull * _Nullable strings, unsigned n); - -In Objective-C, there is an alternate spelling for the nullability qualifiers that can be used in Objective-C methods and properties using context-sensitive, non-underscored keywords. For example: - - .. code-block:: objective-c - - @interface NSView : NSResponder - - (nullable NSView *)ancestorSharedWithView:(nonnull NSView *)aView; - @property (assign, nullable) NSView *superview; - @property (readonly, nonnull) NSArray *subviews; - @end - -nonnull (gnu::nonnull) ----------------------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","X","","", "" - -The ``nonnull`` attribute indicates that some function parameters must not be null, and can be used in several different ways. It's original usage (`from GCC `_) is as a function (or Objective-C method) attribute that specifies which parameters of the function are nonnull in a comma-separated list. For example: - - .. code-block:: c - - extern void * my_memcpy (void *dest, const void *src, size_t len) - __attribute__((nonnull (1, 2))); - -Here, the ``nonnull`` attribute indicates that parameters 1 and 2 -cannot have a null value. Omitting the parenthesized list of parameter indices means that all parameters of pointer type cannot be null: - - .. code-block:: c - - extern void * my_memcpy (void *dest, const void *src, size_t len) - __attribute__((nonnull)); - -Clang also allows the ``nonnull`` attribute to be placed directly on a function (or Objective-C method) parameter, eliminating the need to specify the parameter index ahead of type. For example: - - .. code-block:: c - - extern void * my_memcpy (void *dest __attribute__((nonnull)), - const void *src __attribute__((nonnull)), size_t len); - -Note that the ``nonnull`` attribute indicates that passing null to a non-null parameter is undefined behavior, which the optimizer may take advantage of to, e.g., remove null checks. The ``_Nonnull`` type qualifier indicates that a pointer cannot be null in a more general manner (because it is part of the type system) and does not imply undefined behavior, making it more widely applicable. - - -returns_nonnull (gnu::returns_nonnull) --------------------------------------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "X","X","","", "" - -The ``returns_nonnull`` attribute indicates that a particular function (or Objective-C method) always returns a non-null pointer. For example, a particular system ``malloc`` might be defined to terminate a process when memory is not available rather than returning a null pointer: - - .. code-block:: c - - extern void * malloc (size_t size) __attribute__((returns_nonnull)); - -The ``returns_nonnull`` attribute implies that returning a null pointer is undefined behavior, which the optimizer may take advantage of. The ``_Nonnull`` type qualifier indicates that a pointer cannot be null in a more general manner (because it is part of the type system) and does not imply undefined behavior, making it more widely applicable - - -_Nonnull --------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "","","","X", "" - -The ``_Nonnull`` nullability qualifier indicates that null is not a meaningful value for a value of the ``_Nonnull`` pointer type. For example, given a declaration such as: - - .. code-block:: c - - int fetch(int * _Nonnull ptr); - -a caller of ``fetch`` should not provide a null value, and the compiler will produce a warning if it sees a literal null value passed to ``fetch``. Note that, unlike the declaration attribute ``nonnull``, the presence of ``_Nonnull`` does not imply that passing null is undefined behavior: ``fetch`` is free to consider null undefined behavior or (perhaps for backward-compatibility reasons) defensively handle null. - - -_Null_unspecified ------------------ -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "","","","X", "" - -The ``_Null_unspecified`` nullability qualifier indicates that neither the ``_Nonnull`` nor ``_Nullable`` qualifiers make sense for a particular pointer type. It is used primarily to indicate that the role of null with specific pointers in a nullability-annotated header is unclear, e.g., due to overly-complex implementations or historical factors with a long-lived API. - - -_Nullable ---------- -.. csv-table:: Supported Syntaxes - :header: "GNU", "C++11", "__declspec", "Keyword", "Pragma" - - "","","","X", "" - -The ``_Nullable`` nullability qualifier indicates that a value of the ``_Nullable`` pointer type can be null. For example, given: - - .. code-block:: c - - int fetch_or_zero(int * _Nullable ptr); - -a caller of ``fetch_or_zero`` can provide null. - - +=================== \ No newline at end of file diff --git a/docs/ClangCommandLineReference.rst b/docs/ClangCommandLineReference.rst new file mode 100644 index 000000000000..add168829e1b --- /dev/null +++ b/docs/ClangCommandLineReference.rst @@ -0,0 +1,2591 @@ +.. + ------------------------------------------------------------------- + NOTE: This file is automatically generated by running clang-tblgen + -gen-opt-docs. Do not edit this file by hand!! + ------------------------------------------------------------------- + +===================================== +Clang command line argument reference +===================================== +.. contents:: + :local: + +Introduction +============ + +This page lists the command line arguments currently supported by the +GCC-compatible ``clang`` and ``clang++`` drivers. + + +.. program:: clang +.. option:: -B, --prefix , --prefix= + +Add to search path for binaries and object files used implicitly + +.. option:: -F + +Add directory to framework include search path + +.. option:: -ObjC + +Treat source input files as Objective-C inputs + +.. program:: clang1 +.. option:: -ObjC++ +.. program:: clang + +Treat source input files as Objective-C++ inputs + +.. option:: -Qunused-arguments + +Don't emit warning for unused driver arguments + +.. option:: -Wa,,... + +Pass the comma separated arguments in to the assembler + +.. option:: -Wlarge-by-value-copy= + +.. option:: -Xarch\_ + +.. option:: -Xcuda-fatbinary + +Pass to fatbinary invocation + +.. option:: -Xcuda-ptxas + +Pass to the ptxas assembler + +.. option:: -Z + +.. option:: -a, --profile-blocks + +.. option:: -all\_load + +.. option:: -allowable\_client + +.. option:: --analyze + +Run the static analyzer + +.. option:: --analyze-auto + +.. option:: --analyzer-no-default-checks + +.. option:: --analyzer-output + +Static analyzer report output format (html\|plist\|plist-multi-file\|plist-html\|text). + +.. option:: -ansi, --ansi + +.. option:: -arch + +.. program:: clang1 +.. option:: -arch\_errors\_fatal +.. program:: clang + +.. program:: clang2 +.. option:: -arch\_only +.. program:: clang + +.. option:: -arcmt-migrate-emit-errors + +Emit ARC errors even if the migrator can fix them + +.. option:: -arcmt-migrate-report-output + +Output path for the plist report + +.. option:: -bind\_at\_load + +.. option:: -bundle + +.. program:: clang1 +.. option:: -bundle\_loader +.. program:: clang + +.. option:: -client\_name + +.. option:: -compatibility\_version + +.. option:: --constant-cfstrings + +.. option:: -coverage, --coverage + +.. option:: --cuda-compile-host-device + +Compile CUDA code for both host and device (default). Has no effect on non-CUDA compilations. + +.. option:: --cuda-device-only + +Compile CUDA code for device only + +.. option:: --cuda-gpu-arch=, --no-cuda-gpu-arch= + +CUDA GPU architecture (e.g. sm\_35). May be specified more than once. + +.. option:: --cuda-host-only + +Compile CUDA code for host only. Has no effect on non-CUDA compilations. + +.. option:: --cuda-noopt-device-debug, --no-cuda-noopt-device-debug + +Enable device-side debug info generation. Disables ptxas optimizations. + +.. option:: -current\_version + +.. option:: -dead\_strip + +.. option:: -dependency-dot + +Filename to write DOT-formatted header dependencies to + +.. option:: -dependency-file + +Filename (or -) to write dependency output to + +.. option:: -dumpmachine + +.. option:: -dumpversion + +.. option:: --dyld-prefix=, --dyld-prefix + +.. option:: -dylib\_file + +.. option:: -dylinker + +.. program:: clang1 +.. option:: -dylinker\_install\_name +.. program:: clang + +.. option:: -dynamic + +.. option:: -dynamiclib + +.. option:: -emit-ast + +Emit Clang AST files for source inputs + +.. option:: -exported\_symbols\_list + +.. option:: -faligned-new= + +.. option:: -fcuda-approx-transcendentals, -fno-cuda-approx-transcendentals + +Use approximate transcendental functions + +.. option:: -fcuda-flush-denormals-to-zero, -fno-cuda-flush-denormals-to-zero + +Flush denormal floating point values to zero in CUDA device mode. + +.. option:: -fheinous-gnu-extensions + +.. option:: -flat\_namespace + +.. option:: -fopenmp-targets=,... + +Specify comma-separated list of triples OpenMP offloading targets to be supported + +.. option:: -force\_cpusubtype\_ALL + +.. program:: clang1 +.. option:: -force\_flat\_namespace +.. program:: clang + +.. program:: clang2 +.. option:: -force\_load +.. program:: clang + +.. option:: -framework + +.. option:: -frtlib-add-rpath, -fno-rtlib-add-rpath + +Add -rpath with architecture-specific resource directory to the linker flags + +.. option:: --gcc-toolchain=, -gcc-toolchain + +Use the gcc toolchain at the given directory + +.. option:: -gcodeview + +Generate CodeView debug information + +.. option:: -headerpad\_max\_install\_names + +.. option:: -help, --help + +Display available options + +.. option:: --help-hidden + +.. option:: -image\_base + +.. option:: -index-header-map + +Make the next included directory (-I or -F) an indexer header map + +.. option:: -init + +.. option:: -install\_name + +.. option:: -keep\_private\_externs + +.. option:: -lazy\_framework + +.. program:: clang1 +.. option:: -lazy\_library +.. program:: clang + +.. option:: -mbig-endian, -EB + +.. option:: --migrate + +Run the migrator + +.. option:: -mios-simulator-version-min=, -miphonesimulator-version-min= + +.. option:: -mlinker-version= + +.. option:: -mlittle-endian, -EL + +.. option:: -mllvm + +Additional arguments to forward to LLVM's option processing + +.. option:: -module-dependency-dir + +Directory to dump module dependencies to + +.. option:: -mtvos-simulator-version-min=, -mappletvsimulator-version-min= + +.. option:: -multi\_module + +.. option:: -multiply\_defined + +.. program:: clang1 +.. option:: -multiply\_defined\_unused +.. program:: clang + +.. option:: -mwatchos-simulator-version-min=, -mwatchsimulator-version-min= + +.. option:: --no-cuda-version-check + +Don't error out if the detected version of the CUDA install is too low for the requested CUDA gpu architecture. + +.. option:: -no-integrated-cpp, --no-integrated-cpp + +.. option:: -no\_dead\_strip\_inits\_and\_terms + +.. option:: -nobuiltininc + +Disable builtin #include directories + +.. option:: -nocudainc + +.. option:: -nocudalib + +.. option:: -nodefaultlibs + +.. option:: -nofixprebinding + +.. option:: -nolibc + +.. option:: -nomultidefs + +.. option:: -nopie + +.. option:: -noprebind + +.. option:: -noseglinkedit + +.. option:: -nostartfiles + +.. option:: -nostdinc, --no-standard-includes + +.. program:: clang1 +.. option:: -nostdinc++ +.. program:: clang + +Disable standard #include directories for the C++ standard library + +.. option:: -nostdlib, --no-standard-libraries + +.. option:: -nostdlibinc + +.. option:: -o, --output , --output= + +Write output to + +.. option:: -objcmt-atomic-property + +Make migration to 'atomic' properties + +.. option:: -objcmt-migrate-all + +Enable migration to modern ObjC + +.. option:: -objcmt-migrate-annotation + +Enable migration to property and method annotations + +.. option:: -objcmt-migrate-designated-init + +Enable migration to infer NS\_DESIGNATED\_INITIALIZER for initializer methods + +.. option:: -objcmt-migrate-instancetype + +Enable migration to infer instancetype for method result type + +.. option:: -objcmt-migrate-literals + +Enable migration to modern ObjC literals + +.. option:: -objcmt-migrate-ns-macros + +Enable migration to NS\_ENUM/NS\_OPTIONS macros + +.. option:: -objcmt-migrate-property + +Enable migration to modern ObjC property + +.. option:: -objcmt-migrate-property-dot-syntax + +Enable migration of setter/getter messages to property-dot syntax + +.. option:: -objcmt-migrate-protocol-conformance + +Enable migration to add protocol conformance on classes + +.. option:: -objcmt-migrate-readonly-property + +Enable migration to modern ObjC readonly property + +.. option:: -objcmt-migrate-readwrite-property + +Enable migration to modern ObjC readwrite property + +.. option:: -objcmt-migrate-subscripting + +Enable migration to modern ObjC subscripting + +.. option:: -objcmt-ns-nonatomic-iosonly + +Enable migration to use NS\_NONATOMIC\_IOSONLY macro for setting property's 'atomic' attribute + +.. option:: -objcmt-returns-innerpointer-property + +Enable migration to annotate property with NS\_RETURNS\_INNER\_POINTER + +.. option:: -objcmt-whitelist-dir-path=, -objcmt-white-list-dir-path= + +Only modify files with a filename contained in the provided directory path + +.. option:: -object + +.. option:: -p, --profile + +.. option:: -pagezero\_size + +.. option:: -pg + +Enable mcount instrumentation + +.. option:: -pie + +.. option:: -pipe, --pipe + +Use pipes between commands, when possible + +.. option:: -prebind + +.. program:: clang1 +.. option:: -prebind\_all\_twolevel\_modules +.. program:: clang + +.. option:: -preload + +.. option:: --print-diagnostic-categories + +.. option:: -print-file-name=, --print-file-name=, --print-file-name + +Print the full library path of + +.. option:: -print-ivar-layout + +Enable Objective-C Ivar layout bitmap print trace + +.. option:: -print-libgcc-file-name, --print-libgcc-file-name + +Print the library path for the currently used compiler runtime library ("libgcc.a" or "libclang\_rt.builtins.\*.a") + +.. option:: -print-multi-directory, --print-multi-directory + +.. option:: -print-multi-lib, --print-multi-lib + +.. option:: -print-prog-name=, --print-prog-name=, --print-prog-name + +Print the full program path of + +.. option:: -print-resource-dir, --print-resource-dir + +Print the resource directory pathname + +.. option:: -print-search-dirs, --print-search-dirs + +Print the paths used for finding libraries and programs + +.. option:: -private\_bundle + +.. option:: -pthread, -no-pthread + +Support POSIX threads in generated code + +.. option:: -pthreads + +.. option:: -rdynamic + +.. option:: -read\_only\_relocs + +.. option:: -relocatable-pch, --relocatable-pch + +Whether to build a relocatable precompiled header + +.. option:: -remap + +.. option:: -rewrite-legacy-objc + +Rewrite Legacy Objective-C source to C++ + +.. option:: -rtlib=, --rtlib=, --rtlib + +Compiler runtime library to use + +.. option:: -save-stats=, --save-stats=, -save-stats (equivalent to -save-stats=cwd), --save-stats (equivalent to -save-stats=cwd) + +Save llvm statistics. + +.. option:: -save-temps=, --save-temps=, -save-temps (equivalent to -save-temps=cwd), --save-temps (equivalent to -save-temps=cwd) + +Save intermediate compilation results. + +.. option:: -sectalign + +.. option:: -sectcreate + +.. option:: -sectobjectsymbols + +.. option:: -sectorder + +.. option:: -seg1addr + +.. option:: -seg\_addr\_table + +.. program:: clang1 +.. option:: -seg\_addr\_table\_filename +.. program:: clang + +.. option:: -segaddr + +.. option:: -segcreate + +.. option:: -seglinkedit + +.. option:: -segprot + +.. option:: -segs\_read\_ + +.. program:: clang1 +.. option:: -segs\_read\_only\_addr +.. program:: clang + +.. program:: clang2 +.. option:: -segs\_read\_write\_addr +.. program:: clang + +.. option:: -serialize-diagnostics , --serialize-diagnostics + +Serialize compiler diagnostics to a file + +.. option:: -shared, --shared + +.. option:: -shared-libasan + +.. option:: -shared-libgcc + +.. option:: -single\_module + +.. option:: -specs=, --specs= + +.. option:: -static, --static + +.. option:: -static-libgcc + +.. option:: -static-libstdc++ + +.. option:: -std-default= + +.. option:: -stdlib=, --stdlib=, --stdlib + +C++ standard library to use + +.. option:: -sub\_library + +.. program:: clang1 +.. option:: -sub\_umbrella +.. program:: clang + +.. option:: --sysroot=, --sysroot + +.. option:: --target-help + +.. option:: --target=, -target + +Generate code for the given target + +.. option:: -time + +Time individual commands + +.. option:: -traditional, --traditional + +.. option:: -traditional-cpp, --traditional-cpp + +Enable some traditional CPP emulation + +.. option:: -twolevel\_namespace + +.. program:: clang1 +.. option:: -twolevel\_namespace\_hints +.. program:: clang + +.. option:: -umbrella + +.. option:: -unexported\_symbols\_list + +.. option:: -v, --verbose + +Show commands to run and use verbose output + +.. option:: --verify-debug-info + +Verify the binary representation of debug output + +.. option:: --version + +.. option:: -w, --no-warnings + +Suppress all warnings + +.. option:: -weak-l + +.. option:: -weak\_framework + +.. program:: clang1 +.. option:: -weak\_library +.. program:: clang + +.. program:: clang2 +.. option:: -weak\_reference\_mismatches +.. program:: clang + +.. option:: -whatsloaded + +.. option:: -whyload + +.. option:: -working-directory, -working-directory= + +Resolve file paths relative to the specified directory + +.. option:: -x, --language , --language= + +Treat subsequent input files as having type + +.. option:: -y + +Actions +======= +The action to perform on the input. + +.. option:: -E, --preprocess + +Only run the preprocessor + +.. option:: -S, --assemble + +Only run preprocess and compilation steps + +.. option:: -c, --compile + +Only run preprocess, compile, and assemble steps + +.. option:: -emit-llvm + +Use the LLVM representation for assembler and object files + +.. option:: -fsyntax-only + +.. option:: -module-file-info + +Provide information about a particular module file + +.. option:: --precompile + +Only precompile the input + +.. option:: -rewrite-objc + +Rewrite Objective-C source to C++ + +.. option:: -verify-pch + +Load and verify that a pre-compiled header file is not stale + +Compilation flags +================= + +Flags controlling the behavior of Clang during compilation. These flags have +no effect during actions that do not perform compilation. + +.. option:: -Xassembler + +Pass to the assembler + +.. option:: -Xclang + +Pass to the clang compiler + +.. option:: -fcomment-block-commands=,... + +Treat each comma separated argument in as a documentation comment block command + +.. option:: -fdeclspec, -fno-declspec + +Allow \_\_declspec as a keyword + +.. option:: -fdepfile-entry= + +.. option:: -fdiagnostics-fixit-info, -fno-diagnostics-fixit-info + +.. option:: -fdiagnostics-format= + +.. option:: -fdiagnostics-parseable-fixits + +Print fix-its in machine parseable form + +.. option:: -fdiagnostics-print-source-range-info + +Print source range spans in numeric form + +.. option:: -fdiagnostics-show-category= + +.. option:: -fexperimental-new-pass-manager, -fno-experimental-new-pass-manager + +Enables an experimental new pass manager in LLVM. + +.. option:: -finline-functions, -fno-inline-functions + +Inline suitable functions + +.. option:: -finline-hint-functions + +Inline functions which are (explicitly or implicitly) marked inline + +.. option:: -fno-crash-diagnostics + +Disable auto-generation of preprocessed source files and a script for reproduction during a clang crash + +.. option:: -fno-sanitize-blacklist + +Don't use blacklist file for sanitizers + +.. option:: -fparse-all-comments + +.. option:: -fsanitize-address-field-padding= + +Level of field padding for AddressSanitizer + +.. option:: -fsanitize-address-use-after-scope, -fno-sanitize-address-use-after-scope + +Enable use-after-scope detection in AddressSanitizer + +.. option:: -fsanitize-blacklist= + +Path to blacklist file for sanitizers + +.. option:: -fsanitize-cfi-cross-dso, -fno-sanitize-cfi-cross-dso + +Enable control flow integrity (CFI) checks for cross-DSO calls. + +.. option:: -fsanitize-coverage=,..., -fno-sanitize-coverage=,... + +Specify the type of coverage instrumentation for Sanitizers + +.. option:: -fsanitize-link-c++-runtime + +.. option:: -fsanitize-memory-track-origins, -fno-sanitize-memory-track-origins + +Enable origins tracking in MemorySanitizer + +.. program:: clang1 +.. option:: -fsanitize-memory-track-origins= +.. program:: clang + +Enable origins tracking in MemorySanitizer + +.. option:: -fsanitize-memory-use-after-dtor + +Enable use-after-destroy detection in MemorySanitizer + +.. option:: -fsanitize-recover, -fno-sanitize-recover + +.. program:: clang1 +.. option:: -fsanitize-recover=,..., -fno-sanitize-recover=,... +.. program:: clang + +Enable recovery for specified sanitizers + +.. option:: -fsanitize-stats, -fno-sanitize-stats + +Enable sanitizer statistics gathering. + +.. option:: -fsanitize-thread-atomics, -fno-sanitize-thread-atomics + +Enable atomic operations instrumentation in ThreadSanitizer (default) + +.. option:: -fsanitize-thread-func-entry-exit, -fno-sanitize-thread-func-entry-exit + +Enable function entry/exit instrumentation in ThreadSanitizer (default) + +.. option:: -fsanitize-thread-memory-access, -fno-sanitize-thread-memory-access + +Enable memory access instrumentation in ThreadSanitizer (default) + +.. option:: -fsanitize-trap=,..., -fno-sanitize-trap=,... + +Enable trapping for specified sanitizers + +.. option:: -fsanitize-undefined-strip-path-components= + +Strip (or keep only, if negative) a given number of path components when emitting check metadata. + +.. option:: -fsanitize-undefined-trap-on-error, -fno-sanitize-undefined-trap-on-error + +.. option:: -fsanitize=,..., -fno-sanitize=,... + +Turn on runtime checks for various forms of undefined or suspicious behavior. See user manual for available checks + +.. option:: --param , --param= + +.. option:: -std=, --std=, --std + +Language standard to compile for + +Preprocessor flags +~~~~~~~~~~~~~~~~~~ + +Flags controlling the behavior of the Clang preprocessor. + +.. option:: -C, --comments + +Include comments in preprocessed output + +.. option:: -CC, --comments-in-macros + +Include comments from within macros in preprocessed output + +.. option:: -D=, --define-macro , --define-macro= + +Define to (or 1 if omitted) + +.. option:: -H, --trace-includes + +Show header includes and nesting depth + +.. option:: -P, --no-line-commands + +Disable linemarker output in -E mode + +.. option:: -U, --undefine-macro , --undefine-macro= + +Undefine macro + +.. option:: -Wp,,... + +Pass the comma separated arguments in to the preprocessor + +.. option:: -Xpreprocessor + +Pass to the preprocessor + +Include path management +----------------------- + +Flags controlling how ``#include``\s are resolved to files. + +.. option:: -I, --include-directory , --include-directory= + +Add directory to include search path + +.. option:: -I-, --include-barrier + +Restrict all prior -I flags to double-quoted inclusion and remove current directory from include path + +.. option:: --cuda-path= + +CUDA installation path + +.. option:: -cxx-isystem + +Add directory to the C++ SYSTEM include search path + +.. option:: -fbuild-session-file= + +Use the last modification time of as the build session timestamp + +.. option:: -fbuild-session-timestamp=