TTobias Hieta[clang] Reject if constexpr in C (#112685)
| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
[OpenACC] Initial commits to support OpenACC (#70234) Initial commits to support OpenACC. This patchset: adds a clang-command line argument '-fopenacc', and starts to define _OPENACC, albeit to '1' instead of the standardized value (since we don't properly implement OpenACC yet). The OpenACC spec defines _OPENACC to be equal to the latest standard implemented. However, since we're not done implementing any standard, we've defined this by default to be 1. As it is useful to run our compiler against existing OpenACC workloads, we're providing a temporary override flag to change the _OPENACC value to be any entirely digit value, permitting testing against any existing OpenACC project. Exactly like the OpenMP parser, the OpenACC pragma parser needs to consume and reprocess the tokens. This patch sets up the infrastructure to do so by refactoring the OpenMP version of this into a more general version that works for OpenACC as well. Additionally, this adds a few diagnostics and token kinds to get us started. | 2 年前 | |
Record mainfile name in the Frontend time trace (#99866) | 2 年前 | |
[Clang] Ensure the method scope at the late parsing of noexcept specifiers (#98023) Previously, we only pushed the function scope once we entered the function definition, whereas tryCaptureVariable() requires at least one function scope available when ParmVarDecls being captured have been owned by a function. This led to problems parsing the noexcept specifiers, as the DeclRefExprs inside them were improperly computed. Fixes https://github.com/llvm/llvm-project/issues/97453 | 2 年前 | |
| 2 年前 | ||
[HLSL] Implement export keyword (#96823) Implements export keyword in HLSL. There are two ways the export keyword can be used: 1. On individual function declarations export void f() {} 2. On a group of function declaration: export { void f1(); void f2() {} } Functions declared with the export keyword have external linkage. The implementation does not include validation of when a function can or cannot be exported, such as when it has resource argument or semantic annotations. That will be covered by llvm/llvm-project#93330. Currently all function declarations in global or named namespaces have external linkage by default so there are no specific code changes required right now to make sure exported function have external linkage as well. That will change as part of llvm/llvm-project#92071. Any additional changes to make sure exported functions still have external linkage will be done as part of this work item. Fixes #92812 | 2 年前 | |
[clang] Remove __is_layout_compatible from revertible type traits list (#100572) __is_layout_compatible was added in Clang 19 (#81506), and at that time it wasn't entirely clear whether it should be a revertible type trait or not. We decided to follow the example of other type traits. Since then #95969 happened, and now we know that we don't want new revertible type traits. This patch removes __is_layout_compatible from revertible type traits list, and leaves a comment what revertible type traits are, and that new type traits should not be added there. The intention is to also cherry-pick this to 19 branch. (cherry picked from commit 3295d377f37a60597321f502d164b5d6b1948e28) | 2 年前 | |
Revert "Reapply "[Clang] Implement resolution for CWG1835 (#92957)" (#98547)" This reverts commit ce4aada6e2135e29839f672a6599db628b53295d and a follow-up patch 8ef26f1289bf069ccc0d6383f2f4c0116a1206c1. This new warning can not be fully suppressed by the -Wno-missing-dependent-template-keyword flag, this gives developer no time to do the cleanup in a large codebase, see https://github.com/llvm/llvm-project/pull/98547#issuecomment-2228250884 | 2 年前 | |
[ParserHLSL] Attempt to parse HLSL annotations on Field Decls. (#96346) MaybeParseHLSLAnnotations should be run on Field Decls instead of just assuming that any colon after a field decl is a bitfield. In the case that HLSL is the language, the code after the colon may be an annotation. This PR gives the parser a chance to parse the subsequent text as if it was an HLSL annotation. The burden of parsing is now on the HLSL parser, but the actual work needs to be done in handling every case of an hlsl annotation on a field decl. SV_DispatchThreadID was straightforward enough to implement in this PR, and tests have been added that the annotation appears as an attribute in the AST. Previously, the hlsl_annotations_on_struct_members.hlsl test would result in an error shown below on the line that declares variable a in struct Eg9: error: use of undeclared identifier 'SV_DispatchThreadID' This is because the annotation is parsed as if it was a c++ bit field, and an identifier that represents an integer is expected, but not found. This test ensures that hlsl annotations are parsed when parsing struct decls. This test not only ensures we make progress by moving the validation error from the realm of C++ and expecting bitfields, to HLSL and a specialized error for the recognized annotation, but also validates that the parser does parse the annotation and adds an attribute to the field decl in the AST. Fixes https://github.com/llvm/llvm-project/issues/57889 | 2 年前 | |
Reland [clang][Sema, Lex, Parse] Preprocessor embed in C and C++ (#95802) This commit implements the entirety of the now-accepted [N3017 -Preprocessor Embed](https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3017.htm) and its sister C++ paper [p1967](https://wg21.link/p1967). It implements everything in the specification, and includes an implementation that drastically improves the time it takes to embed data in specific scenarios (the initialization of character type arrays). The mechanisms used to do this are used under the "as-if" rule, and in general when the system cannot detect it is initializing an array object in a variable declaration, will generate EmbedExpr AST node which will be expanded by AST consumers (CodeGen or constant expression evaluators) or expand embed directive as a comma expression. This reverts commit https://github.com/llvm/llvm-project/commit/682d461d5a231cee54d65910e6341769419a67d7. --------- Co-authored-by: The Phantom Derpstorm <phdofthehouse@gmail.com> Co-authored-by: Aaron Ballman <aaron@aaronballman.com> Co-authored-by: cor3ntin <corentinjabot@gmail.com> Co-authored-by: H. Vetinari <h.vetinari@gmx.com> | 2 年前 | |
Reland #90786 ([BoundsSafety] Allow 'counted_by' attribute on pointers in structs in C) (#93121) [BoundsSafety] Reland #93121 Allow 'counted_by' attribute on pointers in structs in C (#93121) Fixes #92687. Previously the attribute was only allowed on flexible array members. This patch patch changes this to also allow the attribute on pointer fields in structs and also allows late parsing of the attribute in some contexts. For example this previously wasn't allowed: struct BufferTypeDeclAttributePosition { size_t count; char* buffer __counted_by(count); // Now allowed } Note the attribute is prevented on pointee types where the size isn't known at compile time. In particular pointee types that are: * Incomplete (e.g. void) and sizeless types * Function types (e.g. the pointee of a function pointer) * Struct types with a flexible array member This patch also introduces late parsing of the attribute when used in the declaration attribute position. For example struct BufferTypeDeclAttributePosition { char* buffer __counted_by(count); // Now allowed size_t count; } is now allowed but **only** when passing -fexperimental-late-parse-attributes. The motivation for using late parsing here is to avoid breaking the data layout of structs in existing code that want to use the counted_by attribute. This patch is the first use of LateAttrParseExperimentalExt in Attr.td that was introduced in a previous patch. Note by allowing the attribute on struct member pointers this now allows the possiblity of writing the attribute in the type attribute position. For example: struct BufferTypeAttributePosition { size_t count; char *__counted_by(count) buffer; // Now allowed } However, the attribute in this position is still currently parsed immediately rather than late parsed. So this will not parse currently: struct BufferTypeAttributePosition { char *__counted_by(count) buffer; // Fails to parse size_t count; } The intention is to lift this restriction in future patches. It has not been done in this patch to keep this size of this commit small. There are also several other follow up changes that will need to be addressed in future patches: * Make late parsing working with anonymous structs (see on_pointer_anon_buf in attr-counted-by-late-parsed-struct-ptrs.c). * Allow counted_by on more subjects (e.g. parameters, returns types) when -fbounds-safety is enabled. * Make use of the attribute on pointer types in code gen (e.g. for _builtin_dynamic_object_size and UBSan's array-bounds checks). This work is heavily based on a patch originally written by Yeoul Na. ** Differences between #93121 and this patch ** * The memory leak that caused #93121 to be reverted (see #92687) should now be fixed. See "The Memory Leak". * The fix to pragma-attribute-supported-attributes-list.test (originally in cef6387) has been incorporated into this patch. * A relaxation of counted_by semantics (originally in 112eadd) has been incorporated into this patch. * The assert in Parser::DistributeCLateParsedAttrs has been removed because that broke downstream code. * The switch statement in Parser::ParseLexedCAttribute has been removed in favor of using Parser::ParseGNUAttributeArgs which does the same thing but is more feature complete. * The EnterScope parameter has been plumbed through Parser::ParseLexedCAttribute and Parser::ParseLexedCAttributeList. It currently doesn't do anything but it will be needed in future commits. ** The Memory Leak ** The problem was that these lines parsed the attributes but then did nothing to free the memory assert(!getLangOpts().CPlusPlus); for (auto *LateAttr : LateFieldAttrs) ParseLexedCAttribute(*LateAttr); To fix this this a new Parser::ParseLexedCAttributeList method has been added (based on Parser::ParseLexedAttributeList) which does the necessary memory management. The intention is to merge these two methods together so there is just one implementation in a future patch (#93263). A more principled fixed here would be to fix the ownership of the LateParsedAttribute objects. In principle LateParsedAttrList should own its pointers exclusively and be responsible for deallocating them. Unfortunately this is complicated by LateParsedAttribute objects also being stored in another data structure (LateParsedDeclarations) as can be seen below (LA gets stored in two places). // Handle attributes with arguments that require late parsing. LateParsedAttribute *LA = new LateParsedAttribute(this, *AttrName, AttrNameLoc); LateAttrs->push_back(LA); // Attributes in a class are parsed at the end of the class, along // with other late-parsed declarations. if (!ClassStack.empty() && !LateAttrs->parseSoon()) getCurrentClass().LateParsedDeclarations.push_back(LA); this means the ownership of LateParsedAttribute objects isn't very clear. rdar://125400257 | 2 年前 | |
[OpenACC] Implement auto/seq/independent clause Sema for 'loop' These three clauses are all quite trivial, as they take no parameters. They are mutually exclusive, and 'seq' has some other exclusives that are implemented here. The ONE thing that isn't implemented is 2.9's restriction (line 2010): 'A loop associated with a 'loop' construct that does not have a 'seq' clause must be written to meet all the following conditions'. Future clauses will require similar work, so it'll be done as a followup. | 2 年前 | |
[Clang][OpenMP] Add interchange directive (#93022) Add the interchange directive which will be introduced in the upcoming OpenMP 6.0 specification. A preview has been published in [Technical Report 12](https://www.openmp.org/wp-content/uploads/openmp-TR12.pdf). | 2 年前 | |
[AIX] Revert #pragma mc_func check (#102919) https://github.com/llvm/llvm-project/pull/99888 added a specific diagnostic for #pragma mc_func on AIX. There are some disagreements on: 1. If the check should be on by default. Leaving the check off by default is dangerous, since it is difficult to be aware of such a check. Turning it on by default at the moment causes build failures on AIX. See https://github.com/llvm/llvm-project/pull/101336 for more details. 2. If the check can be made more general. See https://github.com/llvm/llvm-project/pull/101336#issuecomment-2269283906. This PR reverts this check from main so we can flush out these disagreements. (cherry picked from commit 123b6fcc70af17d81c903b839ffb55afc9a9728f) | 1 年前 | |
[clang] Reject if constexpr in C (#112685) Fixes https://github.com/llvm/llvm-project/issues/112587 | 1 年前 | |
[clang] Fix bugprone argument comments (NFC) Identified with bugprone-argument-comment. | 4 年前 | |
[clang] Inject tokens containing #embed back into token stream (#97274) Instead of playing "whack a mole" with places where #embed should be expanded as comma-separated list, just inject each byte as a token back into the stream, separated by commas. | 2 年前 | |
| 2 年前 | ||
| 2 年前 |