[PATCH] D50767: [C++2a] Parsing and semantic analysis for contracts (P0542R5)
Hamza Sood via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 15 04:59:46 PDT 2018
hamzasood created this revision.
hamzasood added reviewers: rsmith, faisalv, aaron.ballman, erik.pilkington.
Herald added subscribers: cfe-commits, eraman, mgorny.
This patch implements Parsing, Semantic analysis, and AST representation for contract attributes as described in P0542R5 <http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0542r5.html>.
Missing from the implementation:
1. CodeGen and library support are on hold until the relevant ABI decisions <https://github.com/itanium-cxx-abi/cxx-abi/issues/59> are made.
2. The supporting AST stuff (serialisation etc.) isn't included yet; this patch is large enough as it is.
3. Specifying a build level requires a compiler option, which probably requires further discussion.
The rest of it is mostly complete, however there're a few things that I couldn't work out:
1. Are contracts allowed on constructors/destructors, or any special member function for that matter? If so, then is `MyClass() [[expects: something()]] = default` a trivial constructor? I can't seem to find anything relevant in the standard but that seems quite contradictory.
2. Are contracts allowed on explicit instantiations? The latest proposal (r5) explicitly forbids it, but that sentence is missing from the current working draft (N4762). Does that mean that it should follow the usual redeclaration rules?
This is dependent on the following patches:
- https://reviews.llvm.org/D50021: [Support] Add casting iterator adapters
- https://reviews.llvm.org/D50763: [Parser] Refactor and fix bugs in late-parsing
- https://reviews.llvm.org/D50764: [AST] Make NullStmt final and give it factory functions
Repository:
rC Clang
https://reviews.llvm.org/D50767
Files:
include/clang/AST/AttrContract.h
include/clang/AST/Decl.h
include/clang/AST/DeclBase.h
include/clang/AST/Stmt.h
include/clang/Basic/Contract.h
include/clang/Basic/DiagnosticASTKinds.td
include/clang/Basic/DiagnosticParseKinds.td
include/clang/Basic/DiagnosticSemaKinds.td
include/clang/Parse/Parser.h
include/clang/Sema/DeclSpec.h
include/clang/Sema/DelayedDiagnostic.h
include/clang/Sema/Ownership.h
include/clang/Sema/Scope.h
include/clang/Sema/Sema.h
lib/AST/AttrContract.cpp
lib/AST/CMakeLists.txt
lib/AST/Decl.cpp
lib/AST/DeclPrinter.cpp
lib/AST/ExprConstant.cpp
lib/AST/Stmt.cpp
lib/AST/StmtPrinter.cpp
lib/AST/StmtProfile.cpp
lib/CodeGen/CGStmt.cpp
lib/CodeGen/CodeGenFunction.cpp
lib/CodeGen/CodeGenFunction.h
lib/Parse/ParseCXXInlineMethods.cpp
lib/Parse/ParseDecl.cpp
lib/Parse/ParseDeclCXX.cpp
lib/Parse/ParseStmt.cpp
lib/Parse/Parser.cpp
lib/Sema/CMakeLists.txt
lib/Sema/DeclSpec.cpp
lib/Sema/Scope.cpp
lib/Sema/SemaAccess.cpp
lib/Sema/SemaCast.cpp
lib/Sema/SemaContract.cpp
lib/Sema/SemaDecl.cpp
lib/Sema/SemaDeclCXX.cpp
lib/Sema/SemaDeclObjC.cpp
lib/Sema/SemaExpr.cpp
lib/Sema/SemaStmt.cpp
lib/Sema/SemaTemplateDeduction.cpp
lib/Sema/SemaTemplateInstantiate.cpp
lib/Sema/SemaTemplateInstantiateDecl.cpp
lib/Sema/SemaType.cpp
lib/Sema/TreeTransform.h
test/CXX/dcl.dcl/dcl.attr/dcl.attr.contract/dcl.attr.contract.cond/p1.cpp
test/CXX/dcl.dcl/dcl.attr/dcl.attr.contract/dcl.attr.contract.cond/p2.cpp
test/CXX/dcl.dcl/dcl.attr/dcl.attr.contract/dcl.attr.contract.cond/p3.cpp
test/CXX/dcl.dcl/dcl.attr/dcl.attr.contract/dcl.attr.contract.cond/p4.cpp
test/CXX/expr/expr.const/p2-2a.cpp
test/CodeGenCXX/cxx2a-contracts-unsupported.cpp
test/FixIt/fixit-cxx-contract.cpp
test/Parser/cxx-contract.cpp
test/SemaCXX/typo-correction-contract.cpp
test/SemaCXX/warn-unused-result-contract.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50767.160766.patch
Type: text/x-patch
Size: 144393 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180815/d994d267/attachment-0001.bin>
More information about the cfe-commits
mailing list