llvm-project/clang/lib/AST
Aaron Ballman 9955f14aaf [C2x] Disallow functions without prototypes/functions with identifier lists
WG14 has elected to remove support for K&R C functions in C2x. The
feature was introduced into C89 already deprecated, so after this long
of a deprecation period, the committee has made an empty parameter list
mean the same thing in C as it means in C++: the function accepts no
arguments exactly as if the function were written with (void) as the
parameter list.

This patch implements WG14 N2841 No function declarators without
prototypes (http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2841.htm)
and WG14 N2432 Remove support for function definitions with identifier
lists (http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2432.pdf).

It also adds The -fno-knr-functions command line option to opt into
this behavior in other language modes.

Differential Revision: https://reviews.llvm.org/D123955
2022-04-20 13:28:15 -04:00
..
Interp [clang][NFC] Wrap TYPE_SWITCH in "do while (0)" in the interpreter 2022-01-24 09:05:27 -08:00
APValue.cpp [AST] Print NTTP args as string-literals when possible 2022-03-01 19:34:27 -06:00
ASTConcept.cpp [llvm][clang][NFC] updates inline licence info 2021-08-11 02:48:53 +00:00
ASTConsumer.cpp
ASTContext.cpp [C2x] Disallow functions without prototypes/functions with identifier lists 2022-04-20 13:28:15 -04:00
ASTDiagnostic.cpp [NFC] Use range based loop. 2022-03-30 22:44:34 +08:00
ASTDumper.cpp [AST] injected-class-name is not a redecl, even in template specializations 2021-11-02 14:37:45 +01:00
ASTImporter.cpp Reland "[AST] Add a new TemplateKind for template decls found via a using decl."" 2022-04-14 11:04:55 +02:00
ASTImporterLookupTable.cpp [clang][ASTImporter] Update lookup table correctly at deduction guides. 2021-12-06 20:40:16 +01:00
ASTStructuralEquivalence.cpp Reland "[AST] Add a new TemplateKind for template decls found via a using decl."" 2022-04-14 11:04:55 +02:00
ASTTypeTraits.cpp [clang] Add `ObjCProtocolLoc` to represent protocol references 2022-02-18 15:24:00 -05:00
AttrDocTable.cpp Revert "Rename llvm::array_lengthof into llvm::size to match std::size from C++17" 2022-01-26 16:55:53 +01:00
AttrImpl.cpp [clang][OpenMP5.1] Initial parsing/sema for 'indirect' clause 2022-01-10 16:58:56 -08:00
CMakeLists.txt [randstruct] Add randomize structure layout support 2022-04-09 13:15:36 -07:00
CXXABI.h [clang] Remove unused forward declarations (NFC) 2022-01-08 11:56:40 -08:00
CXXInheritance.cpp [clang] Use llvm::erase_if (NFC) 2021-10-17 13:50:29 -07:00
Comment.cpp Use llvm::any_of and llvm::all_of (NFC) 2021-12-11 11:54:37 -08:00
CommentBriefParser.cpp [AST] Remove an unnecessary continue (NFC) 2021-12-11 23:04:08 -08:00
CommentCommandTraits.cpp Revert "Rename llvm::array_lengthof into llvm::size to match std::size from C++17" 2022-01-26 16:55:53 +01:00
CommentLexer.cpp Comment parsing: Don't recognize commands in single-line double quotation 2022-01-14 22:46:07 +01:00
CommentParser.cpp
CommentSema.cpp Comment AST: Recognize function-like objects via return type (NFC) 2021-11-12 21:11:11 +01:00
ComparisonCategories.cpp [clang] Fix a few more comment typos to cycle bots 2021-09-20 20:06:03 -04:00
ComputeDependence.cpp An expression should only contain an unexpanded parameter pack if it 2022-03-31 20:02:53 -07:00
DataCollection.cpp
Decl.cpp Fix size of flexible array initializers, and re-enable assertions. 2022-04-15 12:09:57 -07:00
DeclBase.cpp [Clang] Implement __builtin_source_location. 2022-03-28 18:29:02 -04:00
DeclCXX.cpp Fix memory leak in [Clang] Implement __builtin_source_location. 2022-03-29 17:32:59 -04:00
DeclFriend.cpp
DeclGroup.cpp
DeclObjC.cpp [Clang][Sema] Fix attribute mismatch warning for ObjC class properties 2022-01-11 12:10:18 +00:00
DeclOpenMP.cpp
DeclPrinter.cpp Fix the declaration printer to properly handle prototypes in C 2022-02-17 13:54:09 -05:00
DeclTemplate.cpp [AST] Print NTTP args as string-literals when possible 2022-03-01 19:34:27 -06:00
DeclarationName.cpp [NFC][AST] Return underlying strings directly instead of OS.str() 2021-12-09 16:05:46 -08:00
Expr.cpp [Clang] Implement __builtin_source_location. 2022-03-28 18:29:02 -04:00
ExprCXX.cpp An expression should only contain an unexpanded parameter pack if it 2022-03-31 20:02:53 -07:00
ExprClassification.cpp [Clang] Implement __builtin_source_location. 2022-03-28 18:29:02 -04:00
ExprConcepts.cpp [clang] Remove redundant member initialization (NFC) 2022-01-02 10:20:23 -08:00
ExprConstant.cpp [NFC] Remove unused variable 2022-04-19 15:19:40 +08:00
ExprObjC.cpp [clang] NFC: refactor multiple implementations of getDecltypeForParenthesizedExpr 2021-07-28 23:27:43 +02:00
ExternalASTMerger.cpp [clang] Use llvm::erase_if (NFC) 2021-10-17 13:50:29 -07:00
ExternalASTSource.cpp
FormatString.cpp [clang] Remove unused "using" (NFC) 2021-12-29 08:27:29 -08:00
FormatStringParsing.h
InheritViz.cpp
ItaniumCXXABI.cpp Change __builtin_sycl_unique_stable_name to just use an Itanium mangling 2021-09-28 06:41:03 -07:00
ItaniumMangle.cpp Reland "[AST] Add a new TemplateKind for template decls found via a using decl."" 2022-04-14 11:04:55 +02:00
JSONNodeDumper.cpp [JSONNodeDumper] Do not print mangled names for local variables (PR49111) 2021-12-23 08:55:41 +01:00
Linkage.h [c++20] For P0732R2 / P1907R1: Basic code generation and name 2020-11-09 22:10:27 -08:00
Mangle.cpp [clang][#52782] Bail on incomplete parameter type in stdcall name mangling 2022-01-05 17:58:24 +01:00
MicrosoftCXXABI.cpp [clang] Remove redundant member initialization (NFC) 2022-01-12 22:12:01 -08:00
MicrosoftMangle.cpp [clang] MicrosoftCXXNameMangler::mangleObjCKindOfType - use castAs<> instead of getAs<> to avoid dereference of nullptr 2022-02-12 20:11:21 +00:00
NSAPI.cpp [Clang] Add __ibm128 type to represent ppc_fp128 2021-09-06 18:00:58 +08:00
NestedNameSpecifier.cpp Fully qualify template template parameters when printing 2021-09-02 15:04:34 -07:00
ODRHash.cpp Reland "[AST] Add a new TemplateKind for template decls found via a using decl."" 2022-04-14 11:04:55 +02:00
OSLog.cpp [Sema] Warn about printf %n on Android and Fuchsia 2022-01-21 21:00:39 +00:00
OpenMPClause.cpp [clang][OpenMP5.1] Initial parsing/sema for has_device_addr 2022-04-08 21:19:38 -07:00
ParentMap.cpp Use DenseMap::lookup (NFC) 2021-12-17 18:19:25 -08:00
ParentMapContext.cpp [clang] Add `ObjCProtocolLoc` to represent protocol references 2022-02-18 15:24:00 -05:00
PrintfFormatString.cpp [Sema] Warn about printf %n on Android and Fuchsia 2022-01-21 21:00:39 +00:00
QualTypeNames.cpp Reland "[AST] Add UsingType: a sugar type for types found via UsingDecl" 2021-12-20 18:03:15 +01:00
Randstruct.cpp [randstruct] Fix -Wunused-but-set-variable with Clang>=D122271 in -DLLVM_ENABLE_ASSERTIONS=off builds 2022-04-13 17:09:30 -07:00
RawCommentList.cpp [clang][extract-api] Add global record support 2022-03-16 15:13:55 -07:00
RecordLayout.cpp
RecordLayoutBuilder.cpp GCC ABI Compatibility: Preserve alignment of non-pod members in packed structs 2022-01-28 11:04:20 -08:00
ScanfFormatString.cpp
SelectorLocationsKind.cpp
Stmt.cpp [clang] number labels in asm goto strings after tied inputs 2022-01-11 12:09:24 -08:00
StmtCXX.cpp [C++20] [Coroutines] Implement return value optimization for get_return_object 2022-02-16 13:38:00 +08:00
StmtIterator.cpp
StmtObjC.cpp [clang] Convert ObjCAtTryStmt to llvm::TrailingObjects 2021-10-27 08:57:05 -04:00
StmtOpenMP.cpp [Clang][OpenMP] Use bitfields for flags in `OMPAtomicDirective` 2022-04-15 21:34:28 -04:00
StmtPrinter.cpp [OpenMP] Initial parsing/sema for the 'omp target parallel loop' construct 2022-03-24 09:19:00 -07:00
StmtProfile.cpp [clang][OpenMP5.1] Initial parsing/sema for has_device_addr 2022-04-08 21:19:38 -07:00
StmtViz.cpp
TemplateBase.cpp DebugInfo: Don't use enumerators in template names for debug info as they are not canonical 2022-04-05 17:16:42 +00:00
TemplateName.cpp Reland "[AST] Add a new TemplateKind for template decls found via a using decl."" 2022-04-14 11:04:55 +02:00
TextNodeDumper.cpp Reland "[AST] Add a new TemplateKind for template decls found via a using decl."" 2022-04-14 11:04:55 +02:00
Type.cpp Reland "[AST] Add a new TemplateKind for template decls found via a using decl."" 2022-04-14 11:04:55 +02:00
TypeLoc.cpp [Attr] Fix a btf_type_tag AST generation 2022-03-16 08:46:52 -07:00
TypePrinter.cpp [Attr] Fix a btf_type_tag AST generation 2022-03-16 08:46:52 -07:00
VTTBuilder.cpp
VTableBuilder.cpp Use llvm::append_range instead of push_back loops where applicable. NFCI. 2022-03-18 01:25:34 +01:00