summaryrefslogtreecommitdiffstats
path: root/clang/utils/TableGen
Commit message (Collapse)AuthorAgeFilesLines
...
* Use the container form llvm::sort(C, ...)Fangrui Song2018-09-302-3/+3
| | | | | | | | | There are a few leftovers of rC343147 that are not (\w+)\.begin but in the form of ([-[:alnum:]>.]+)\.begin or spanning two lines. Change them to use the container form in this commit. The 12 occurrences have been inspected manually for safety. llvm-svn: 343425
* llvm::sort(C.begin(), C.end(), ...) -> llvm::sort(C, ...)Fangrui Song2018-09-263-13/+11
| | | | | | | | | | | | | | Summary: The convenience wrapper in STLExtras is available since rL342102. Reviewers: rsmith, #clang, dblaikie Reviewed By: rsmith, #clang Subscribers: mgrang, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D52576 llvm-svn: 343147
* Replaces __inline by __inline__ / C89 compatibleDiogo N. Sampaio2018-09-071-2/+2
| | | | llvm-svn: 341644
* Fix arm_neon.h and arm_fp16.h generation for compiling with std=c89Diogo N. Sampaio2018-09-051-2/+2
| | | | | | | | | | | | | | | | | Summary: The inline attribute is not valid for C standard 89. Replace the argument in the generation of header files with __inline, as well adding tests for both header files. Reviewers: pbarrio, SjoerdMeijer, javed.absar, t.p.northover Subscribers: t.p.northover, kristof.beyls, chrib, cfe-commits Differential Revision: https://reviews.llvm.org/D51683 test/Headers/arm-fp16-header.c test/Headers/arm-neon-header.c utils/TableGen/NeonEmitter.cpp llvm-svn: 341475
* Update FIXME as requested in code review.Richard Smith2018-08-301-1/+2
| | | | llvm-svn: 341100
* Improve attribute documentation to list which spellings are used in which ↵Richard Smith2018-08-301-79/+86
| | | | | | | | | | | | | | | | | | | | | | | | | syntaxes. Summary: Instead of listing all the spellings (including attribute namespaces) in the section heading, only list the actual attribute names there, and list the spellings in the supported syntaxes table. This allows us to properly describe things like [[fallthrough]], for which we allow a clang:: prefix in C++ but not in C, and AlwaysInline, which has one spelling as a GNU attribute and a different spelling as a keyword, without needing to repeat the syntax description in the documentation text. Sample rendering: https://pste.eu/p/T1ZV.html Reviewers: aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D51473 llvm-svn: 341097
* Adjust Attr representation so that changes to documentation don't affectRichard Smith2018-08-301-12/+8
| | | | | | | | | | | | | | | | | how we parse source code. Instead of implicitly opting all undocumented attributes out of '#pragma clang attribute' support, explicitly opt them all out and remove the documentation check from TableGen. (No new attributes should be added without documentation, so this has little chance of backsliding. We already support the pragma on one undocumented attribute, so we don't even want to enforce our old "rule".) No functionality change intended. llvm-svn: 341009
* Fix typoStephen Kelly2018-08-231-1/+1
| | | | llvm-svn: 340586
* [clang-tblgen] Add -print-records and -dump-json modes.Simon Tatham2018-08-221-0/+12
| | | | | | | | | | | | | | | | | | | | | | Currently, if clang-tblgen is run without a mode option, it defaults to the first mode in its 'enum Action', which happens to be -gen-clang-attr-classes. I think it makes more sense for it to behave the same way as llvm-tblgen, i.e. print a diagnostic dump if it's not given any more specific instructions. I've also added the same -dump-json that llvm-tblgen supports. This means any tblgen command line (whether llvm- or clang-) can be mechanically turned into one that processes the same input into JSON. Reviewers: nhaehnle Reviewed By: nhaehnle Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D50771 llvm-svn: 340390
* Model type attributes as regular Attrs.Richard Smith2018-08-201-0/+2
| | | | | | | | | | | | | | Specifically, AttributedType now tracks a regular attr::Kind rather than having its own parallel Kind enumeration, and AttributedTypeLoc now holds an Attr* instead of holding an ad-hoc collection of Attr fields. Differential Revision: https://reviews.llvm.org/D50526 This reinstates r339623, reverted in r339638, with a fix to not fail template instantiation if we instantiate a QualType with no associated type source information and we encounter an AttributedType. llvm-svn: 340215
* Revert r339623 "Model type attributes as regular Attrs."Reid Kleckner2018-08-141-2/+0
| | | | | | | | This breaks compiling atlwin.h in Chromium. I'm sure the code is invalid in some way, but we put a lot of work into accepting it, and I'm sure rejecting it was not an intended consequence of this refactoring. :) llvm-svn: 339638
* Model type attributes as regular Attrs.Richard Smith2018-08-131-0/+2
| | | | | | | | | | Specifically, AttributedType now tracks a regular attr::Kind rather than having its own parallel Kind enumeration, and AttributedTypeLoc now holds an Attr* instead of holding an ad-hoc collection of Attr fields. Differential Revision: https://reviews.llvm.org/D50526 llvm-svn: 339623
* Implement diagnostic stream operator for ParsedAttr.Erich Keane2018-08-091-1/+1
| | | | | | | | | | | | | As a part of attempting to clean up the way attributes are printed, this patch adds an operator << to the diagnostics/ partialdiagnostics so that ParsedAttr can be sent directly. This patch also rewrites a large amount* of the times when ParsedAttr was printed using its IdentifierInfo object instead of being printed itself. *"a large amount" == "All I could find". llvm-svn: 339344
* revert r338831 - Fix unused variable warning in tablegen generated codeErich Keane2018-08-031-8/+4
| | | | | | No longer necessary thanks to r338889 (and friends). llvm-svn: 338893
* Fix unused variable warning in tablegen generated codeKarl-Johan Karlsson2018-08-031-4/+8
| | | | llvm-svn: 338831
* [P0936R0] add [[clang::lifetimebound]] attributeRichard Smith2018-08-011-2/+7
| | | | | | | | | | | | | | | | | | | This patch adds support for a new attribute, [[clang::lifetimebound]], that indicates that the lifetime of a function result is related to one of the function arguments. When walking an initializer to make sure that the lifetime of the initial value is at least as long as the lifetime of the initialized object, we step through parameters (including the implicit object parameter of a non-static member function) that are marked with this attribute. There's nowhere to write an attribute on the implicit object parameter, so in lieu of that, it may be applied to a function type (where it appears immediately after the cv-qualifiers and ref-qualifier, which is as close to a declaration of the implicit object parameter as we have). I'm currently modeling this in the AST as the attribute appertaining to the function type. Differential Revision: https://reviews.llvm.org/D49922 llvm-svn: 338464
* Implement cpu_dispatch/cpu_specific MultiversioningErich Keane2018-07-201-0/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As documented here: https://software.intel.com/en-us/node/682969 and https://software.intel.com/en-us/node/523346. cpu_dispatch multiversioning is an ICC feature that provides for function multiversioning. This feature is implemented with two attributes: First, cpu_specific, which specifies the individual function versions. Second, cpu_dispatch, which specifies the location of the resolver function and the list of resolvable functions. This is valuable since it provides a mechanism where the resolver's TU can be specified in one location, and the individual implementions each in their own translation units. The goal of this patch is to be source-compatible with ICC, so this implementation diverges from the ICC implementation in a few ways: 1- Linux x86/64 only: This implementation uses ifuncs in order to properly dispatch functions. This is is a valuable performance benefit over the ICC implementation. A future patch will be provided to enable this feature on Windows, but it will obviously more closely fit ICC's implementation. 2- CPU Identification functions: ICC uses a set of custom functions to identify the feature list of the host processor. This patch uses the cpu_supports functionality in order to better align with 'target' multiversioning. 1- cpu_dispatch function def/decl: ICC's cpu_dispatch requires that the function marked cpu_dispatch be an empty definition. This patch supports that as well, however declarations are also permitted, since the linker will solve the issue of multiple emissions. Differential Revision: https://reviews.llvm.org/D47474 llvm-svn: 337552
* [NFC] Rename clang::AttributeList to clang::ParsedAttrErich Keane2018-07-131-26/+27
| | | | | | | Since The type no longer contains the 'next' item anymore, it isn't a list, so rename it to ParsedAttr to be more accurate. llvm-svn: 337005
* [AArch64] Corrected FP16 Intrinsic range checks in Clang + added Sema testsLuke Geeson2018-06-121-5/+8
| | | | | | | | | | | | | | | | | | Summary: This fixes the ranges for the vcvth family of FP16 intrinsics in the clang front end. Previously it was accepting incorrect ranges -Changed builtin range checking in SemaChecking -added tests SemaCheck changes - included in their own file since no similar one exists -modified existing tests to reflect new ranges Reviewers: SjoerdMeijer, javed.absar Reviewed By: SjoerdMeijer Subscribers: kristof.beyls, cfe-commits Differential Revision: https://reviews.llvm.org/D47592 llvm-svn: 334489
* [ClangDiagnostics] Silence warning about fallthrough after PrintFatalErrorDavid Bolvansky2018-05-261-1/+1
| | | | | | | | | | | | | | | | | | | | Summary: ClangDiagnosticsEmitter.cpp:1047:57: warning: this statement may fall through [-Wimplicit-fallthrough=] Builder.PrintFatalError("Unknown modifier type: " + Modifier); ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~ ClangDiagnosticsEmitter.cpp:1048:5: note: here case MT_Select: { ^ Reviewers: rsmith, rtrieu Reviewed By: rtrieu Subscribers: rtrieu, ilya-biryukov, ioeric, MaskRay, jkorous, cfe-commits Differential Revision: https://reviews.llvm.org/D47340 llvm-svn: 333340
* [Clang Tablegen] Add llvm_unreachable() to getModifierName()Mark Searles2018-05-211-0/+2
| | | | | | | | | | | | | | | | | Fix internal build failure: ../../../ClangDiagnosticsEmitter.cpp -o ClangDiagnosticsEmitter.o ../../../ClangDiagnosticsEmitter.cpp: In function 'llvm::StringRef {anonymous}::getModifierName({anonymous}::ModifierType)': ../../../ClangDiagnosticsEmitter.cpp:495:1: error: control reaches end of non-void function [-Werror=return-type] } ^ Build failure triggered by git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@332799 91177308-0d34-0410-b5e6-96231b3b80d8 Differential Revision: https://reviews.llvm.org/D47150 llvm-svn: 332854
* [Clang Tablegen][RFC] Allow Early Textual Substitutions in `Diagnostic` ↵Eric Fiselier2018-05-191-263/+743
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | messages. Summary: There are cases where the same string or select is repeated verbatim in a lot of diagnostics. This can be a pain to maintain and update. Tablegen provides no way stash the common text somewhere and reuse it in the diagnostics, until now! This patch allows diagnostic texts to contain `%sub{<definition-name>}`, where `<definition-name>` names a Tablegen record of type `TextSubstitution`. These substitutions are done early, before the diagnostic string is otherwise processed. All `%sub` modifiers will be replaced before the diagnostic definitions are emitted. The substitution must specify all arguments used by the substitution, and modifier indexes in the substitution are re-numbered accordingly. For example: ``` def select_ovl_candidate : TextSubstitution<"%select{function|constructor}0%select{| template| %2}1">; ``` when used as ``` "candidate `%sub{select_ovl_candidate}3,2,1 not viable" ``` will act as if we wrote: ``` "candidate %select{function|constructor}3%select{| template| %1}2 not viable" ``` Reviewers: rsmith, rjmccall, aaron.ballman, a.sidorin Reviewed By: rjmccall Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D46740 llvm-svn: 332799
* Remove \brief commands from doxygen comments.Adrian Prantl2018-05-094-12/+12
| | | | | | | | | | | | | | | | | | | This is similar to the LLVM change https://reviews.llvm.org/D46290. We've been running doxygen with the autobrief option for a couple of years now. This makes the \brief markers into our comments redundant. Since they are a visual distraction and we don't want to encourage more \brief markers in new code either, this patch removes them all. Patch produced by for i in $(git grep -l '\@brief'); do perl -pi -e 's/\@brief //g' $i & done for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done Differential Revision: https://reviews.llvm.org/D46320 llvm-svn: 331834
* Allow writing calling convention attributes on function types.Aaron Ballman2018-05-031-2/+5
| | | | | | Calling convention attributes notionally appertain to the function type -- they modify the mangling of the function, change the behavior of assignment operations, etc. This commit allows the calling convention attributes to be written in the type position as well as the declaration position. llvm-svn: 331459
* [ARM,AArch64] Add intrinsics for dot product instructionsOliver Stannard2018-04-271-0/+13
| | | | | | | | | | The ACLE spec which describes these intrinsics hasn't been published yet, but this is based on the final draft which will be published soon, and these have already been implemented by GCC. Differential revision: https://reviews.llvm.org/D46109 llvm-svn: 331039
* Fix typos in clangAlexander Kornienko2018-04-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Found via codespell -q 3 -I ../clang-whitelist.txt Where whitelist consists of: archtype cas classs checkk compres definit frome iff inteval ith lod methode nd optin ot pres statics te thru Patch by luzpaz! (This is a subset of D44188 that applies cleanly with a few files that have dubious fixes reverted.) Differential revision: https://reviews.llvm.org/D44188 llvm-svn: 329399
* [clang] Change std::sort to llvm::sort in response to r327219Mandeep Singh Grang2018-03-274-18/+19
| | | | | | | | | | | r327219 added wrappers to std::sort which randomly shuffle the container before sorting. This will help in uncovering non-determinism caused due to undefined sorting order of objects having the same key. To make use of that infrastructure we need to invoke llvm::sort instead of std::sort. llvm-svn: 328636
* Reland "[Attr] Fix parameter indexing for several attributes"Joel E. Denny2018-03-131-4/+35
| | | | | | | | | Relands r326602 (reverted in r326862) with new test and fix for PR36620. Differential Revision: https://reviews.llvm.org/D43248 llvm-svn: 327405
* Revert r326602, it caused PR36620.Nico Weber2018-03-071-136/+3
| | | | llvm-svn: 326862
* TableGen: Give up on exact fixits for diagnostic groupsNicolai Haehnle2018-03-061-32/+6
| | | | | | | | | | | With recent changes in the TableGen frontend, we no longer have usable location information for anonymous defs. Fixes test breakage caused by r326788. The normal, non-error TableGen output is not affected by this change. llvm-svn: 326822
* [Attr] Fix parameter indexing for several attributesJoel E. Denny2018-03-021-3/+136
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The patch fixes a number of bugs related to parameter indexing in attributes: * Parameter indices in some attributes (argument_with_type_tag, pointer_with_type_tag, nonnull, ownership_takes, ownership_holds, and ownership_returns) are specified in source as one-origin including any C++ implicit this parameter, were stored as zero-origin excluding any this parameter, and were erroneously printing (-ast-print) and confusingly dumping (-ast-dump) as the stored values. * For alloc_size, the C++ implicit this parameter was not subtracted correctly in Sema, leading to assert failures or to silent failures of __builtin_object_size to compute a value. * For argument_with_type_tag, pointer_with_type_tag, and ownership_returns, the C++ implicit this parameter was not added back to parameter indices in some diagnostics. This patch fixes the above bugs and aims to prevent similar bugs in the future by introducing careful mechanisms for handling parameter indices in attributes. ParamIdx stores a parameter index and is designed to hide the stored encoding while providing accessors that require each use (such as printing) to make explicit the encoding that is needed. Attribute declarations declare parameter index arguments as [Variadic]ParamIdxArgument, which are exposed as ParamIdx[*]. This patch rewrites all attribute arguments that are processed by checkFunctionOrMethodParameterIndex in SemaDeclAttr.cpp to be declared as [Variadic]ParamIdxArgument. The only exception is xray_log_args's argument, which is encoded as a count not an index. Differential Revision: https://reviews.llvm.org/D43248 llvm-svn: 326602
* Test commit access: apply clang-format suggestionJoel E. Denny2018-02-281-2/+2
| | | | llvm-svn: 326332
* Improve the way attribute argument printing happens for omitted optional ↵Aaron Ballman2018-02-271-37/+97
| | | | | | | | arguments when pretty printing. Patch by Joel Denny. llvm-svn: 326266
* [docs] Fix duplicate arguments for JoinedAndSeparateJonas Hahnfeld2018-02-221-7/+15
| | | | | | | | | We can't see how many arguments are in the meta var name, so just assume that it is the right number. Differential Revision: https://reviews.llvm.org/D42840 llvm-svn: 325805
* [OpenMP] Fix trailing space when printing pragmas, by Joel. E. DennyAlexey Bataev2018-02-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: -ast-print prints omp pragmas with a trailing space. While this behavior is likely of little concern to most users, surely it's unintentional, and it's annoying for some source-level work I'm pursuing. This patch focuses on omp pragmas, but it also fixes init_seg and loop hint pragmas because they share implementation. The testing strategy here is to add usually just one '{{$}}' per relevant -ast-print test file. This seems to achieve good code coverage. However, this strategy is probably easy to forget as the tests evolve. That's probably fine as this fix is far from critical. The main goal of the testing is to aid the initial review. This patch also adds a fixme for "#pragma unroll", which prints as "#pragma unroll (enable)", which is invalid syntax. Reviewers: ABataev Reviewed By: ABataev Subscribers: guansong, cfe-commits Differential Revision: https://reviews.llvm.org/D43204 llvm-svn: 325145
* Mark fallthrough with LLVM_FALLTHROUGHAdrian Prantl2018-02-011-1/+1
| | | | llvm-svn: 323986
* [AArch64] Add ARMv8.2-A FP16 scalar intrinsicsAbderrazek Zaafrani2018-01-193-1/+153
| | | | | | https://reviews.llvm.org/D41792 llvm-svn: 323006
* Make attribute instantiation instantiate all attributes, not just the first ofRichard Smith2018-01-041-2/+10
| | | | | | | | | | | | | | | | | | | | each kind. Attribute instantiation would previously default to instantiating each kind of attribute only once. This was overridden by a flag whose intended purpose was to permit attributes from a prior declaration to be inherited onto a new declaration even if that new declaration had its own copy of the attribute. This is the wrong behavior: when instantiating attributes from a template, we should always instantiate all the attributes that were written on that template. This patch renames the flag in the Attr class (and TableGen sources) to more clearly identify what it's actually for, and removes the usage of the flag from template instantiation. I also removed the flag from AlignedAttr, which was only added to work around the incorrect suppression of duplicate attribute instantiation. llvm-svn: 321834
* Introduce some infrastructure for adding C attributes with [[]] syntax.Aaron Ballman2018-01-031-0/+2
| | | | | | | | This patch adds support to the attribute tablegen for specifying a [[]] attribute is allowed in C mode. This patch also adds the annotate attribute to the list of double square bracket attributes we support in C mode. Eventually, I anticipate that this logic will be reversed (you have to opt out of allowing an attribute in C rather than opting in), but I want to see how the design plays out as more attributes are considered. llvm-svn: 321763
* Avoid int to string conversion in Twine or raw_ostream contexts.Benjamin Kramer2017-12-281-3/+3
| | | | | | Some output changes from uppercase hex to lowercase hex, no other functionality change intended. llvm-svn: 321526
* [AARch64] Add ARMv8.2-A FP16 vector intrinsicsAbderrazek Zaafrani2017-12-211-1/+5
| | | | | | | | Putting back the code that was reverted few weeks ago. Differential Revision: https://reviews.llvm.org/D34161 llvm-svn: 321294
* Add support for ObjectFormat to TargetSpecificAttrErich Keane2017-12-201-40/+42
| | | | | | | | | | | | | | | | Looking through the code, I saw a FIXME on IFunc to switch it to a target specific attribute. In looking through it, i saw that the no-longer-appropriately-named TargetArch didn't support ObjectFormat checking. This patch changes the name of TargetArch to TargetSpecific (since it checks much more than just Arch), makes "Arch" optional, adds support for ObjectFormat, better documents the TargetSpecific type, and changes IFunc over to a TargetSpecificAttr. Differential Revision: https://reviews.llvm.org/D41303 llvm-svn: 321201
* Silence a bunch of implicit fallthrough warningsAdrian Prantl2017-12-191-3/+3
| | | | llvm-svn: 321115
* Determine the attribute subject for diagnostics based on declarative ↵Aaron Ballman2017-11-261-121/+57
| | | | | | | | | | information in DeclNodes.td. This greatly reduces the number of enumerated values used for more complex diagnostics; these are now only required when the "attribute only applies to" diagnostic needs to be generated manually as part of semantic processing. This also clarifies some terminology used by the diagnostic (methods -> Objective-C methods, fields -> non-static data members, etc). Many of the tests needed to be updated in multiple places for the diagnostic wording tweaks. The first instance of the diagnostic for that attribute is fully specified and subsequent instances cut off the complete list (to make it easier if additional subjects are added in the future for the attribute). llvm-svn: 319002
* Move the clang-tblgen project into the Clang tablegenning folder on IDEs ↵Aaron Ballman2017-11-041-0/+1
| | | | | | like Visual Studio rather than leave it in the root directory. NFC. llvm-svn: 317418
* Add a new attribute definition spelling, Clang<"attr">, that expands to two ↵Aaron Ballman2017-10-261-6/+10
| | | | | | | | | | attribute spellings: GNU<"attr"> and CXX11<"clang", "attr">. This is similar to how the GCC spelling works and is intended to be used for attributes introduced for Clang. Changes all existing attributes that currently use GNU<"attr"> and CXX11<"clang", "attr> spellings to instead use the Clang<"attr"> spelling. No additional tests are necessary because the existing tests already use both spellings for the attributes converted to the new spelling. No functional changes are expected. llvm-svn: 316658
* Silence -Wimplicit-fallthrough warnings with the generated code; NFC.Aaron Ballman2017-10-181-1/+1
| | | | llvm-svn: 316075
* Fix usage in TableGen of getValueAsStringErich Keane2017-10-161-28/+27
| | | | | | | | | | | | | | | Record::getValueAsString returns a stringref to an interned string (apparently had been changed since most of tablegen was written). In this patch, I audited the usage of getValueAsString to find places where we can trivially stop storing 'std::string' and instead keep the stringref. There was one instance where an unnecessary 'stringstream' was being used, so that has been removed as well to unblock the stringref replacing string fix. Differential Revision: https://reviews.llvm.org/D38979 llvm-svn: 315956
* Replace usage of std::stringstream with raw_string_ostreamErich Keane2017-10-161-2/+3
| | | | | | | | Typically we don't use the stringstream, so instead use raw_string_stream. Additionally, the dependent function changed to use raw_ostream. llvm-svn: 315950
* Sort Attributes by "HeaderName" Erich Keane2017-10-161-20/+36
| | | | | | | | | | | | | | Attributes in the docs were previously sorted (apparently) by the attribute name, so AnyX86Interrupt ended up being the first one, rather than in a meaningful place. This resulted in the 4 'interrupt' titled sections being all in different places. This replaces it with a naive alphabetical sort (case sensitive, underscore and special characters first, etc). Differential Revision: https://reviews.llvm.org/D38969 llvm-svn: 315931
OpenPOWER on IntegriCloud