summaryrefslogtreecommitdiffstats
path: root/clang/test/AST
Commit message (Collapse)AuthorAgeFilesLines
* [Concepts] Placeholder constraints and abbreviated templatesSaar Raz2020-01-241-15/+42
| | | | | | | | | | | | | | | | | | | | | | | This patch implements P1141R2 "Yet another approach for constrained declarations". General strategy for this patch was: - Expand AutoType to include optional type-constraint, reflecting the wording and easing the integration of constraints. - Replace autos in parameter type specifiers with invented parameters in GetTypeSpecTypeForDeclarator, using the same logic previously used for generic lambdas, now unified with abbreviated templates, by: - Tracking the template parameter lists in the Declarator object - Tracking the template parameter depth before parsing function declarators (at which point we can match template parameters against scope specifiers to know if we have an explicit template parameter list to append invented parameters to or not). - When encountering an AutoType in a parameter context we check a stack of InventedTemplateParameterInfo structures that contain the info required to create and accumulate invented template parameters (fields that were already present in LambdaScopeInfo, which now inherits from this class and is looked up when an auto is encountered in a lambda context). Resubmit after fixing MSAN failures caused by incomplete initialization of AutoTypeLocs in TypeSpecLocFiller. Differential Revision: https://reviews.llvm.org/D65042 (cherry picked from commit b481f028144ca91c15d1db3649ce14f174259e7e)
* Disallow an empty string literal in an asm labelAaron Ballman2020-01-081-4/+4
| | | | | | | | An empty string literal in an asm label does not make a whole lot of sense. GCC does not diagnose such a construct, but it also generates code that cannot be assembled by gas should two symbols have an empty asm label within the same TU. This does not affect an asm statement with an empty string literal, which is still a useful construct.
* [OpenCL] Pretty print __private addr spaceAnastasia Stulova2019-12-271-2/+2
| | | | | | | | | | Add printing of __private address space to TypePrinter to allow it appears in diagnostics and AST dumps as all other language addr spaces. Tags: #clang Differential Revision: https://reviews.llvm.org/D71272
* [Wdocumentation] Implement \anchorMark de Wever2019-12-211-0/+5
| | | | Differential revision: https://reviews.llvm.org/D69223
* Apply the alignment specifier attribute to anonymous unions and structs.Kamlesh Kumar2019-12-201-0/+7
|
* Refactor CompareReferenceRelationship and its callers in preparation forRichard Smith2019-12-181-5/+0
| | | | | | | | | | | | | | implementing the resolution of CWG2352. No functionality change, except that we now convert the referent of a reference binding to the underlying type of the reference in more cases; we used to happen to preserve the type sugar from the referent if the only type change was in the cv-qualifiers. This exposed a bug in how we generate code for trivial assignment operators: if the type sugar (particularly the may_alias attribute) got lost during reference binding, we'd use the "wrong" TBAA information for the load during the assignment.
* [AST] Enable expression of OpenCL language address spaces an attributeVictor Lomuller2019-12-051-0/+36
| | | | | | | | | | | | | | | | | | Summary: Enable a way to set OpenCL language address space using attributes in addition to existing keywords. Signed-off-by: Victor Lomuller victor@codeplay.com Reviewers: aaron.ballman, Anastasia Subscribers: yaxunl, ebevhan, cfe-commits, Naghasan Tags: #clang Differential Revision: https://reviews.llvm.org/D71005 Signed-off-by: Alexey Bader <alexey.bader@intel.com>
* Switch to opening the temp file in binary modeAaron Ballman2019-12-031-1/+1
| | | | | This corrects an issue where the script would write the file with the incorrect line endings on Windows.
* Correcting the offsets within the test to fix the bots.Aaron Ballman2019-12-031-15/+15
|
* Differentiate between the presumed and actual file when dumping the AST to JSONAaron Ballman2019-12-032-1/+312
| | | | | | | | | | Currently, when dumping the AST to JSON, the presumed file is what is included when dumping a source location. This patch changes the behavior to instead dump the actual file, and only dump a presumed file name when it differs from the actual file. This also corrects an issue with the test script generator that would prevent it from working on Windows due to file permissions issues.
* [ConstExprPreter] Removed the flag forcing the use of the interpreterNandor Licker2019-11-271-1/+1
| | | | | | | | | | | | | | | | | | | Summary: Removed the ```-fforce-experimental-new-constant-interpreter flag```, leaving only the ```-fexperimental-new-constant-interpreter``` one. The interpreter now always emits an error on an unsupported feature. Allowing the interpreter to bail out would require a mapping from APValue to interpreter memory, which will not be necessary in the final version. It is more sensible to always emit an error if the interpreter fails. Reviewers: jfb, Bigcheese, rsmith, dexonsmith Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D70071
* [Attr] Fix `-ast-print` for `asm` attributeJoel E. Denny2019-11-181-0/+5
| | | | | | | | | | | | | | | | Without this fix, the tests introduced here produce the following assert fail: ``` clang: /home/jdenny/llvm/clang/include/clang/Basic/AttributeCommonInfo.h:163: unsigned int clang::AttributeCommonInfo::getAttributeSpellingListIndex() const: Assertion `(isAttributeSpellingListCalculated() || AttrName) && "Spelling cannot be found"' failed. ``` The bug was introduced by D67368, which caused `AsmLabelAttr`'s spelling index to be set to `SpellingNotCalculated`. Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D70349
* Add a missing triple in ast-dump-decl-json.mAlex Richardson2019-11-151-197/+197
| | | | | Since there was no triple argument this test started failing on macOS bots, where the mangled names are prefixed with an underscore.
* Include the mangled name in -ast-dump=jsonAlex Richardson2019-11-1515-0/+274
| | | | | | | | | | | | | | | | | | | | I am planning to use this feature to make update_cc_test_checks.py less fragile by obtaining the mangled names directly from -ast-dump=json. Currently, it uses c-index-test which ignores the -triple=, etc. arguments that are in the RUN: line and therefore does not generate checks for some targets. The AST dump tests were updated using the following command: `python $LLVM_BINDIR/gen_ast_dump_json_test.py --update --source $LLVM_SRC/clang/test/AST/*-json.*` Reviewers: aaron.ballman Reviewed By: aaron.ballman Subscribers: rsmith, MaskRay, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D69564
* [NFC] Regenerate ast-dump-json testsAlex Richardson2019-11-152-5579/+5579
| | | | | | | This was done by running `python $LLVM_BINDIR/gen_ast_dump_json_test.py --update --source $LLVM_SRC/clang/test/AST/*-json.*` Only changes are whitespace and line endings. Differential Revision: https://reviews.llvm.org/D70119
* [gen_ast_dump_json_test.py] Allow updating multiple files in one goAlex Richardson2019-11-151-26/+34
| | | | | | | | With this change it is possible to update all JSON dump tests using the following command: python $LLVM_BINDIR/gen_ast_dump_json_test.py --update --source $LLVM_SRC/clang/test/AST/*-json.* See https://reviews.llvm.org/D70119
* [gen_ast_dump_json_test.py] Copy to binary directory to omit --clang argumentAlex Richardson2019-11-151-2/+10
| | | | | | | | | | The script will now check if a clang binary exists in the same directory and default to that instead of requiring a --clang argument. The script is copied to the clang build directory using CMake configure_file() with COPYONLY. This ensures that the version in the build directory is updated any time the source version changes. See https://reviews.llvm.org/D70119
* [gen_ast_dump_json_test.py] Skip manual tests when using --updateAlex Richardson2019-11-151-3/+8
| | | | See https://reviews.llvm.org/D70119
* [gen_ast_dump_json_test.py] Infer --filters flags when using --updateAlex Richardson2019-11-151-10/+27
| | | | See https://reviews.llvm.org/D70119
* [gen_ast_dump_json_test.py] Parse RUN: lines with --updateAlex Richardson2019-11-151-8/+33
| | | | See https://reviews.llvm.org/D70119
* [gen_ast_dump_json_test.py] Add a --update flagAlex Richardson2019-11-151-12/+21
| | | | | | | | | This will allow updating the JSON tests for new format changes. Instead of simply appending the JSON to the input file, the script will now make a copy of the input file up to the "CHECK lines have been autogenerated" disclaimer and then append the new JSON. See https://reviews.llvm.org/D70119
* [OPENMP]Use copy constructors instead of assignment operators in declareAlexey Bataev2019-11-121-7/+5
| | | | | | | reduction initializers. Better to use copy constructor at the initialization of the declare reduction construct rather than assignment operator.
* Redeclare Objective-C property accessors inside the ObjCImplDecl in which ↵Adrian Prantl2019-11-081-1/+167
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | they are synthesized. This patch is motivated by (and factored out from) https://reviews.llvm.org/D66121 which is a debug info bugfix. Starting with DWARF 5 all Objective-C methods are nested inside their containing type, and that patch implements this for synthesized Objective-C properties. 1. SemaObjCProperty populates a list of synthesized accessors that may need to inserted into an ObjCImplDecl. 2. SemaDeclObjC::ActOnEnd inserts forward-declarations for all accessors for which no override was provided into their ObjCImplDecl. This patch does *not* synthesize AST function *bodies*. Moving that code from the static analyzer into Sema may be a good idea though. 3. Places that expect all methods to have bodies have been updated. I did not update the static analyzer's inliner for synthesized properties to point back to the property declaration (see test/Analysis/Inputs/expected-plists/nullability-notes.m.plist), which I believed to be more bug than a feature. Differential Revision: https://reviews.llvm.org/D68108 rdar://problem/53782400
* Include leading attributes in DeclStmt's SourceRangeStephan Bergmann2019-10-171-0/+16
| | | | | | Differential Revision: https://reviews.llvm.org/D68581 llvm-svn: 375104
* Add more information to JSON AST dumping of source locations.Aaron Ballman2019-10-1524-3131/+8107
| | | | | | This adds information about the offset within the source file to the given source location as well as information about the include file a location is from. These pieces of information allow for more efficient post-processing of JSON AST dumps. llvm-svn: 374921
* [clang] Make handling of unnamed template params similar to function paramsKadir Cetinkaya2019-10-014-32/+14
| | | | | | | | | | | | | | | | | | | | | Summary: Clang uses the location identifier should be inserted for declarator decls when a decl is unnamed. But for type template and template template paramaters it uses the location of "typename/class" keyword, which makes it hard for tooling to insert/change parameter names. This change tries to unify these two cases by making template parameter parsing and sourcerange operations similar to function params/declarator decls. Reviewers: ilya-biryukov Subscribers: arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68143 llvm-svn: 373340
* [Sema] Fix the atomic expr rebuilding order.Michael Liao2019-09-231-1/+42
| | | | | | | | | | | | | | | | Summary: - Rearrange the atomic expr order to the API order when rebuilding atomic expr during template instantiation. Reviewers: erichkeane Subscribers: jfb, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D67924 llvm-svn: 372640
* Fix test atomic-expr.cpp after R372422Erich Keane2019-09-231-1/+1
| | | | | | | The test tried to match a path in a printout by doing '^:' which failed on windows, since C:\... is a path. llvm-svn: 372611
* Ensure AtomicExpr goes through SEMA checking after TreeTransformErich Keane2019-09-201-0/+19
| | | | | | | | | | | RebuildAtomicExpr was skipping doing semantic analysis which broke in the cases where the expressions were not dependent. This resulted in the ImplicitCastExpr from an array to a pointer being lost, causing a crash in IR CodeGen. Differential Revision: https://reviews.llvm.org/D67854 llvm-svn: 372422
* Revert r372325 - Reverting r372323 because it broke color tests on Linux.Aaron Ballman2019-09-191-2/+2
| | | | | | This corrects the testing issues. llvm-svn: 372334
* [Clang Interpreter] Initial patch for the constexpr interpreterNandor Licker2019-09-131-0/+11
| | | | | | | | | | | | | | | | | | Summary: This patch introduces the skeleton of the constexpr interpreter, capable of evaluating a simple constexpr functions consisting of if statements. The interpreter is described in more detail in the RFC. Further patches will add more features. Reviewers: Bigcheese, jfb, rsmith Subscribers: bruno, uenoku, ldionne, Tyker, thegameg, tschuett, dexonsmith, mgorny, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D64146 llvm-svn: 371834
* Generate parent context id from Decl* instead of DeclContext*.Aaron Ballman2019-09-044-4/+290
| | | | | | | | | | | | | Because of multiple inheritance, a DeclContext pointer does not produce the same pointer representation as a Decl pointer that references the same AST Node. When dumping the parentDeclContextId field of a node, convert the pointer to Decl* first, so the id can be used to find the AST node it references. Patch by Bert Belder. llvm-svn: 370970
* Revert "[Clang Interpreter] Initial patch for the constexpr interpreter"Roman Lebedev2019-09-041-11/+0
| | | | | | | | | Breaks BUILD_SHARED_LIBS build, introduces cycles in library dependency graphs. (clangInterp depends on clangAST which depends on clangInterp) This reverts r370839, which is an yet another recommit of D64146. llvm-svn: 370874
* [Clang Interpreter] Initial patch for the constexpr interpreterNandor Licker2019-09-041-0/+11
| | | | | | | | | | | | | | | | | | Summary: This patch introduces the skeleton of the constexpr interpreter, capable of evaluating a simple constexpr functions consisting of if statements. The interpreter is described in more detail in the RFC. Further patches will add more features. Reviewers: Bigcheese, jfb, rsmith Subscribers: bruno, uenoku, ldionne, Tyker, thegameg, tschuett, dexonsmith, mgorny, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D64146 llvm-svn: 370839
* Revert [Clang Interpreter] Initial patch for the constexpr interpreterNandor Licker2019-09-021-11/+0
| | | | | | This reverts r370636 (git commit 8327fed9475a14c3376b4860c75370c730e08f33) llvm-svn: 370642
* [Clang Interpreter] Initial patch for the constexpr interpreterNandor Licker2019-09-021-0/+11
| | | | | | | | | | | | | | | | | | Summary: This patch introduces the skeleton of the constexpr interpreter, capable of evaluating a simple constexpr functions consisting of if statements. The interpreter is described in more detail in the RFC. Further patches will add more features. Reviewers: Bigcheese, jfb, rsmith Subscribers: bruno, uenoku, ldionne, Tyker, thegameg, tschuett, dexonsmith, mgorny, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D64146 llvm-svn: 370636
* Revert [Clang Interpreter] Initial patch for the constexpr interpreterNandor Licker2019-08-311-11/+0
| | | | | | This reverts r370584 (git commit afcb3de117265a69d21e5673356e925a454d7d02) llvm-svn: 370588
* [Clang Interpreter] Initial patch for the constexpr interpreterNandor Licker2019-08-311-0/+11
| | | | | | | | | | | | | | | | | | Summary: This patch introduces the skeleton of the constexpr interpreter, capable of evaluating a simple constexpr functions consisting of if statements. The interpreter is described in more detail in the RFC. Further patches will add more features. Reviewers: Bigcheese, jfb, rsmith Subscribers: bruno, uenoku, ldionne, Tyker, thegameg, tschuett, dexonsmith, mgorny, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D64146 llvm-svn: 370584
* Revert [Clang Interpreter] Initial patch for the constexpr interpreterNandor Licker2019-08-301-11/+0
| | | | | | This reverts r370531 (git commit d4c1002e0bbbbab50f6891cdd2f5bd3a8f3a3584) llvm-svn: 370535
* [Clang Interpreter] Initial patch for the constexpr interpreterNandor Licker2019-08-301-0/+11
| | | | | | | | | | | | | | | | | | Summary: This patch introduces the skeleton of the constexpr interpreter, capable of evaluating a simple constexpr functions consisting of if statements. The interpreter is described in more detail in the RFC. Further patches will add more features. Reviewers: Bigcheese, jfb, rsmith Subscribers: bruno, uenoku, ldionne, Tyker, thegameg, tschuett, dexonsmith, mgorny, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D64146 llvm-svn: 370531
* Revert [Clang Interpreter] Initial patch for the constexpr interpreterNandor Licker2019-08-301-11/+0
| | | | | | This reverts r370476 (git commit a5590950549719d0d9ea69ed164b0c8c0f4e02e6) llvm-svn: 370481
* [Clang Interpreter] Initial patch for the constexpr interpreterNandor Licker2019-08-301-0/+11
| | | | | | | | | | | | | | | | | | Summary: This patch introduces the skeleton of the constexpr interpreter, capable of evaluating a simple constexpr functions consisting of if statements. The interpreter is described in more detail in the RFC. Further patches will add more features. Reviewers: Bigcheese, jfb, rsmith Subscribers: bruno, uenoku, ldionne, Tyker, thegameg, tschuett, dexonsmith, mgorny, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D64146 llvm-svn: 370476
* Avoid crash when dumping NULL Type as JSON.Aaron Ballman2019-08-292-1/+78
| | | | | | Patch by Bert Belder. llvm-svn: 370401
* [ASTDump] Add is_anonymous to VisitCXXRecordDeclShafik Yaghmour2019-08-121-4/+4
| | | | | | | | | Summary: Adding is_anonymous the ASTDump for CXXRecordDecl. This turned out to be useful when debugging some problems with how LLDB creates ASTs from DWARF. Differential Revision: https://reviews.llvm.org/D66028 llvm-svn: 368591
* Add SVE opaque built-in typesRichard Sandiford2019-08-091-0/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds the SVE built-in types defined by the Procedure Call Standard for the Arm Architecture: https://developer.arm.com/docs/100986/0000 It handles the types in all relevant places that deal with built-in types. At the moment, some of these places bail out with an error, including: (1) trying to generate LLVM IR for the types (2) trying to generate debug info for the types (3) trying to mangle the types using the Microsoft C++ ABI (4) trying to @encode the types in Objective C (1) and (2) are fixed by follow-on patches but (unlike this patch) they deal mostly with target-specific LLVM details, so seemed like a logically separate change. There is currently no spec for (3) and (4), so reporting an error seems like the correct behaviour for now. The intention is that the types will become sizeless types: http://lists.llvm.org/pipermail/cfe-dev/2019-June/062523.html The main purpose of the sizeless type extension is to diagnose impossible or dangerous uses of the types, such as any that would require sizeof to have a meaningful defined value. Until then, the patch sets the alignments of the types to the values specified in the link above. It also sets the sizes of the types to zero, which is chosen to be consistently wrong and shouldn't affect correctly-written code (i.e. code that would compile even with the sizeless type extension). The patch adds the common subset of functionality needed to test the sizeless type extension on the one hand and to provide SVE intrinsic functions on the other. After this patch, the two pieces of work are essentially independent. The patch is based on one by Graham Hunter: https://reviews.llvm.org/D59245 Differential Revision: https://reviews.llvm.org/D62960 llvm-svn: 368413
* Add typedef declaration information to the JSON AST dump.Aaron Ballman2019-07-303-52/+104
| | | | | | When dumping a desugared QualType and the type is a type alias, also print out the id for the type alias declaration. llvm-svn: 367312
* Add lifetime categories attributesMatthias Gehre2019-07-251-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This is the first part of work announced in "[RFC] Adding lifetime analysis to clang" [0], i.e. the addition of the [[gsl::Owner(T)]] and [[gsl::Pointer(T)]] attributes, which will enable user-defined types to participate in the lifetime analysis (which will be part of the next PR). The type `T` here is called "DerefType" in the paper, and denotes the type that an Owner owns and a Pointer points to. E.g. `std::vector<int>` should be annotated with `[[gsl::Owner(int)]]` and a `std::vector<int>::iterator` with `[[gsl::Pointer(int)]]`. [0] http://lists.llvm.org/pipermail/cfe-dev/2018-November/060355.html Reviewers: gribozavr Subscribers: xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63954 llvm-svn: 367040
* [Clang] New loop pragma vectorize_predicateSjoerd Meijer2019-07-251-0/+4
| | | | | | | | | | | | | | | | | | | This adds a new vectorize predication loop hint: #pragma clang loop vectorize_predicate(enable) that can be used to indicate to the vectoriser that all (load/store) instructions should be predicated (masked). This allows, for example, folding of the remainder loop into the main loop. This patch will be followed up with D64916 and D65197. The former is a refactoring in the loopvectorizer and the groundwork to make tail loop folding a more general concept, and in the latter the actual tail loop folding transformation will be implemented. Differential Revision: https://reviews.llvm.org/D64744 llvm-svn: 366989
* Dump actual line numbers when dumping the AST to JSON.Aaron Ballman2019-07-121-0/+147
| | | | | | The "line" attribute is now the physical line within the source file for the location. A "presumedLine" attribute is printed when the presumed line number does not match the given source line number. We continue to not print repeated line information in subsequent source locations, but we track presumed and actual lines separately. llvm-svn: 365919
* Dump floating-point values as strings when dumping to JSON.Aaron Ballman2019-07-122-5062/+5083
| | | | | | This fixes a bug where we would have an invalid JSON attribute (e.g., "value": inf). It also increases the precision of the values because they're not represented as approximate doubles with the host architecture's floating-point model. llvm-svn: 365900
OpenPOWER on IntegriCloud