summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST
Commit message (Collapse)AuthorAgeFilesLines
...
* Convert MemberExpr creation and serialization to work the same way asRichard Smith2019-06-062-20/+53
| | | | | | | | | | most / all other Expr subclasses. This reinstates r362551, reverted in r362597, with a fix to a bug that caused MemberExprs to sometimes have a null FoundDecl after a round-trip through an AST file. llvm-svn: 362756
* [Clang] Fix pretty printing of CUDA address spacesAnastasia Stulova2019-06-051-3/+5
| | | | | | | | Patch by richardmembarth (Richard Membarth)! Differential Revision: https://reviews.llvm.org/D54258 llvm-svn: 362623
* Revert "Factor out duplicated code building a MemberExpr and marking it" and ↵Benjamin Kramer2019-06-052-53/+20
| | | | | | | | "Convert MemberExpr creation and serialization to work the same way as" This reverts commits r362551 and r362563. Crashes during modules selfhost. llvm-svn: 362597
* msabi: Fix exponential mangling time for even more contrived inputsNico Weber2019-06-041-16/+35
| | | | | | | | | | | | | | | This is a follow-up to r362293 which fixed exponential time needed for mangling certain templates. This fixes the same issue if that template pattern happens in template arguments > 10: The first ten template arguments can use back references, and r362293 added caching for back references. For latter arguments, we have to add a cache for the mangling itself instead. Fixes PR42091 even more. Differential Revision: https://reviews.llvm.org/D62780 llvm-svn: 362560
* Convert MemberExpr creation and serialization to work the same way asRichard Smith2019-06-042-20/+53
| | | | | | most / all other Expr subclasses. llvm-svn: 362551
* Make NoThrow FunctionLike, make FunctionLike include references, fixErich Keane2019-06-032-0/+4
| | | | | | | | | | | | | prettyprint __declspec(nothrow) should work on function pointers as well as function references, so this changes it to FunctionLike. Additionally, FunctionLike needed to be modified to permit function references. Finally, the TypePrinter didn't properly print the NoThrow exception specifier, so make sure we get that right as well. llvm-svn: 362435
* Re-check in clang support gun asm goto after fixing tests.Jennifer Yu2019-06-034-11/+51
| | | | llvm-svn: 362410
* [OpenCL] Use long instead of long long in x86 builtinsAndrew Savonichev2019-06-031-4/+15
| | | | | | | | | | | | | | | | | | | | | | Summary: According to C99 standard long long is at least 64 bits in size. However, OpenCL C defines long long as 128 bit signed integer. This prevents one to use x86 builtins when compiling OpenCL C code for x86 targets. The patch changes long long to long for OpenCL only. Patch by: Alexander Batashev <alexander.batashev@intel.com> Reviewers: craig.topper, Ka-Ka, eandrews, erichkeane, Anastasia Reviewed By: Ka-Ka, erichkeane, Anastasia Subscribers: a.elovikov, yaxunl, Anastasia, cfe-commits, ivankara, etyurin, asavonic Tags: #clang Differential Revision: https://reviews.llvm.org/D62580 llvm-svn: 362391
* msabi: Fix exponential mangling time for certain pathological inputsNico Weber2019-06-011-34/+59
| | | | | | | | | | | | | | | | | Template back references used to be recursively recomputed, add a memoization cache to cut down on this. Since there are now two different types of argument maps, rename the existing TypeBackReferences to FunArgBackReferences, and rename mangleArgumentType() to mangleFunctionArgumentType(). Fixes PR42091, the input there now takes 50ms instead of 7s to compile. No intended behavior change. Differential Revision: https://reviews.llvm.org/D62746 llvm-svn: 362293
* Fix constexpr __builtin_*_overflow issue when unsigned->signed operand.Erich Keane2019-05-301-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | As reported here https://bugs.llvm.org/show_bug.cgi?id=42000, it was possible to get the constexpr version of __builtin_*_overflow to give the wrong answer. This was because when extending the operands to fit the largest type (so that the math could be done), the decision on whether to sign/zero extend the operands was based on the result signedness, not on the operands signedness. In the reported case, (unsigned char)255 - (int)100 needed to have each extended to the int in order to do the math. However, when extending the first operand to 'int', we incorrectly sign extended it instead of zero extending. Thus, the result didnt fit back into the unsigned char. The fix for this was simply to choose zero/sign extension based on the sign of the operand itself. Differential Revision: https://reviews.llvm.org/D62665 llvm-svn: 362157
* [c++2a] Fix assertion failure if we would walk over more than one levelRichard Smith2019-05-301-1/+2
| | | | | | | of derived-to-base conversion path when implicitly starting union subobject lifetimes in constant evaluation. llvm-svn: 362147
* Add Attribute NoThrow as an Exception Specifier TypeErich Keane2019-05-303-2/+8
| | | | | | | | | | | | | | | In response to https://bugs.llvm.org/show_bug.cgi?id=33235, it became clear that the current mechanism of hacking through checks for the exception specification of a function gets confused really quickly when there are alternate exception specifiers. This patch introcues EST_NoThrow, which is the equivilent of EST_noexcept when caused by EST_noThrow. The existing implementation is left in place to cover functions with no FunctionProtoType. Differential Revision: https://reviews.llvm.org/D62435 llvm-svn: 362119
* Revert "clang support gnu asm goto."Erich Keane2019-05-304-51/+11
| | | | | | | | | | | This reverts commit 954ec09aed4f2be04bb5f4e10dbb4ea8bd19ef9a. Reverting due to test failures as requested by Jennifer Yu. Conflicts: clang/test/CodeGen/asm-goto.c llvm-svn: 362106
* [AST] asm goto labels don't have constraints, don't try to copy them.Benjamin Kramer2019-05-301-4/+6
| | | | | | Found by asan. llvm-svn: 362062
* clang support gnu asm goto.Jennifer Yu2019-05-304-11/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Syntax: asm [volatile] goto ( AssemblerTemplate : : InputOperands : Clobbers : GotoLabels) https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html New llvm IR is "callbr" for inline asm goto instead "call" for inline asm For: asm goto("testl %0, %0; jne %l1;" :: "r"(cond)::label_true, loop); IR: callbr void asm sideeffect "testl $0, $0; jne ${1:l};", "r,X,X,~{dirflag},~{fpsr},~{flags}"(i32 %0, i8* blockaddress(@foo, %label_true), i8* blockaddress(@foo, %loop)) #1 to label %asm.fallthrough [label %label_true, label %loop], !srcloc !3 asm.fallthrough: Compiler need to generate: 1> a dummy constarint 'X' for each label. 2> an unique fallthrough label for each asm goto stmt " asm.fallthrough%number". Diagnostic 1> duplicate asm operand name are used in output, input and label. 2> goto out of scope. llvm-svn: 362045
* [ObjC] Fix encoding of ObjC pointer types that are pointers to typedefsAkira Hatanaka2019-05-291-36/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | clang was encoding pointers to typedefs as if they were pointers to structs because that is apparently what gcc is doing. For example: ``` @class Class1; typedef NSArray<Class1 *> MyArray; void foo1(void) { const char *s0 = @encode(MyArray *); // "^{NSArray=#}" const char *s1 = @encode(NSArray<Class1 *> *); // "@" } ``` This commit removes the code that was there to make clang compatible with gcc and make clang emit the correct encoding for ObjC pointers, which is "@". rdar://problem/50563529 Differential Revision: https://reviews.llvm.org/D61974 llvm-svn: 362034
* [analyzer][AST] print() JSONify: Stmt implementationCsaba Dabis2019-05-291-5/+15
| | | | | | | | | | | | | | | | | | | | Summary: This patch also adds a function called `JsonFormat()` which: - Flattens the string so removes the new-lines. - Escapes double quotes. Reviewers: NoQ, xazax.hun, ravikandhadai, baloghadamsoftware, Szelethus Reviewed By: NoQ Subscribers: cfe-commits, szepet, rnkovacs, a.sidorin, mikhail.ramalho, donat.nagy, dkrupp Tags: #clang Differential Revision: https://reviews.llvm.org/D62494 llvm-svn: 362000
* Add curley brackets to case statement that declares a variable.Erich Keane2019-05-291-1/+2
| | | | llvm-svn: 361992
* clang-cl: Fix mangling of catchable types with names longer than 4kiBNico Weber2019-05-291-5/+11
| | | | | | | | | | | | | | | The mangling used to contain the MD5 name of both the RTTI type descriptor and the name of the copy ctor in MSVC2013, but it changed to just the former in 2015. It looks like it changed back to the old mangling in VS2017 version 15.7 and onwards, including VS2019 (version 16.0). VS2017 version 15.0 still has the VS2015 mangling. Versions between 15.0 and 15.7 are't on godbolt. I found 15.4 (_MSC_VER 1911) locally and that uses the 15.0 mangling still, but I didn't find 15.5 or 15.6, so I'm not sure where exactly it changed back. Differential Revision: https://reviews.llvm.org/D62490 llvm-svn: 361959
* [clang] Respect TerseOutput when printing lambdasKadir Cetinkaya2019-05-271-1/+4
| | | | | | | | | | | | Reviewers: ilya-biryukov, hokein, sammccall Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D62487 llvm-svn: 361771
* When dumping the AST to JSON, dump the type information from a typeid ↵Aaron Ballman2019-05-272-2/+12
| | | | | | expression with a type operand. llvm-svn: 361769
* When dumping the AST to JSON, dump whether a function is variadic or not.Aaron Ballman2019-05-271-0/+2
| | | | llvm-svn: 361768
* When dumping the AST to JSON, dump the declared name of a MemberExpr operand.Aaron Ballman2019-05-271-2/+3
| | | | llvm-svn: 361767
* When dumping the AST to JSON, dump the argument name to a sizeof pack ↵Aaron Ballman2019-05-271-0/+4
| | | | | | expression. llvm-svn: 361766
* [ASTImporter] Added visibility context check for CXXRecordDecl.Balazs Keri2019-05-271-0/+3
| | | | | | | | | | | | | | | | | | | Summary: ASTImporter makes now difference between classes with same name in different translation units if these are not visible outside. These classes are not linked into one decl chain. Reviewers: martong, a.sidorin, shafik Reviewed By: shafik Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D62312 llvm-svn: 361752
* Permit static local structured bindings to be named from arbitrary scopes ↵Richard Smith2019-05-251-0/+6
| | | | | | inside their declaring scope. llvm-svn: 361686
* Add JSON dumping tests for ObjC statements; add support for dumping @catch ↵Aaron Ballman2019-05-241-0/+7
| | | | | | catch-all statements. llvm-svn: 361660
* Add support for dumping Objective C AST declaration nodes to JSON.Aaron Ballman2019-05-241-4/+155
| | | | llvm-svn: 361652
* [ASTImporter] Call to HandleNameConflict in VisitRecordDecl mistakeningly ↵Shafik Yaghmour2019-05-241-1/+1
| | | | | | | | | | | | | using Name instead of SearchName Summary: https://reviews.llvm.org/D51633 added error handling to the ASTNodeImporter::VisitRecordDecl for the conflicting names case. This could lead to erroneous return of an error in that case since we should have been using SearchName. Name may be empty in the case where we find the name via D->getTypedefNameForAnonDecl()->getDeclName(). This fix is very similar to https://reviews.llvm.org/D59665 Differential Revision: https://reviews.llvm.org/D62352 llvm-svn: 361650
* Fix hang during constant evaluation of union assignment.Eric Fiselier2019-05-231-3/+2
| | | | | | | | | | HandleUnionActiveMemberChange forgot to walk over a nop implicit conversion node and got stuck in the process. As a cleanup I changed the declaration of `E` so it can't be accidentally accessed after the loop. llvm-svn: 361571
* Ensure builtins use the target default Calling ConventionErich Keane2019-05-231-26/+31
| | | | | | | | | | | | | | | | | r355317 changed builtins/allocation functions to use the default calling convention in order to support platforms that use non-cdecl calling conventions by default. However the default calling convention is overridable on Windows 32 bit implementations with some of the /G options. The intent is to permit the user to set the calling convention of normal functions, however it should NOT apply to builtins and C++ allocation functions. This patch ensures that the builtin/allocation functions always use the Target specific Calling Convention, ignoring the user overridden version of said default. llvm-svn: 361507
* [ARM][AArch64] Fix incorrect handling of alignment in va_arg code generationJohn Brawn2019-05-221-1/+1
| | | | | | | | | | | | | Overaligned and underaligned types (i.e. types where the alignment has been increased or decreased using the aligned and packed attributes) weren't being correctly handled in all cases, as the unadjusted alignment should be used. This patch also adjusts getTypeUnadjustedAlign to correctly handle typedefs of non-aggregate types, which it appears it never had to handle before. Differential Revision: https://reviews.llvm.org/D62152 llvm-svn: 361372
* Fixed a -Wunused-variable warning when assertions are disabledDmitri Gribenko2019-05-221-0/+1
| | | | llvm-svn: 361353
* [c++20] P1330R0: permit simple-assignments that change the active memberRichard Smith2019-05-211-7/+195
| | | | | | of a union within constant expression evaluation. llvm-svn: 361329
* Refactor: split Uninitialized state on APValue into an "Absent" stateRichard Smith2019-05-213-24/+36
| | | | | | | representing no such object, and an "Indeterminate" state representing an uninitialized object. The latter is not yet used, but soon will be. llvm-svn: 361328
* [c++20] P0780R2: Support pack-expansion of init-captures.Richard Smith2019-05-218-49/+62
| | | | | | | | | | | This permits an init-capture to introduce a new pack: template<typename ...T> auto x = [...a = T()] { /* a is a pack */ }; To support this, the mechanism for allowing ParmVarDecls to be packs has been extended to support arbitrary local VarDecls. llvm-svn: 361300
* Add support for dumping AST comment nodes to JSON.Aaron Ballman2019-05-212-2/+141
| | | | llvm-svn: 361265
* [Sema] Fix for build on some iOS programs.Leonard Chan2019-05-201-1/+5
| | | | | | | | Nullability attributes weren't being stripped for AttributedTypes that were wrapped in a MacroQualifiedType. This fix adds a check for this type and a test. llvm-svn: 361205
* Add more tests for AST JSON output; NFC.Aaron Ballman2019-05-201-1/+3
| | | | | | This adds tests for dumping expressions in C. It also updates a comment to note an issue to be fixed with printing character literals discovered as part of this testing. llvm-svn: 361193
* Dump macro expansion information as needed when outputting the AST to JSON.Aaron Ballman2019-05-201-3/+25
| | | | llvm-svn: 361172
* Fix compilation warning about unused variable [NFC]Mikael Holmen2019-05-201-1/+1
| | | | | | | | | | | Without the fix at least clang 3.6 complains with ../tools/clang/lib/AST/ExprConstant.cpp:90:24: error: unused variable 'TI' [-Werror,-Wunused-variable] if (TypeInfoLValue TI = B.dyn_cast<TypeInfoLValue>()) ^ 1 error generated. llvm-svn: 361145
* ASTNodeImporter - fix uninitialized variable warnings. NFCI.Simon Pilgrim2019-05-181-2/+2
| | | | llvm-svn: 361096
* [c++20] P1327R1: Support for typeid applied to objects of polymorphicRichard Smith2019-05-171-6/+22
| | | | | | | | | class type in constant evaluation. This reinstates r360977, reverted in r360987, now that its rerequisite patch is reinstated and fixed. llvm-svn: 361067
* Added an assertion to constant evaluation enty points that prohibits ↵Dmitri Gribenko2019-05-172-0/+53
| | | | | | | | | | | | | | | | | | dependent expressions Summary: Constant evaluator does not work on value-dependent or type-dependent expressions. Also fixed bugs uncovered by these assertions. Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D61522 llvm-svn: 361050
* Extract ASTDumper to a header fileStephen Kelly2019-05-171-46/+1
| | | | | | | | | | | | | | | | | | Summary: This class has member APIs which are useful to clients. Make it possible to use those APIs without adding them to dump() member functions. Doing so does not scale. The optional arguments to dump() should be designed to be useful in a debugging context. Reviewers: aaron.ballman Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D61835 llvm-svn: 361034
* Fix crash if, during evaluation of __builtin_object_size, we try to loadRichard Smith2019-05-171-0/+5
| | | | | | through an invalid base. llvm-svn: 360998
* Fix alignment check to check the alignment of the intended type.Richard Smith2019-05-171-1/+1
| | | | llvm-svn: 360997
* Refactor constant evaluation of typeid(T) to track a symbolic type_infoRichard Smith2019-05-172-18/+101
| | | | | | | | | | | | | | object rather than tracking the originating expression. This is groundwork for supporting polymorphic typeid expressions. (Note that this somewhat regresses our support for DR1968, but it turns out that that never actually worked anyway, at least in non-trivial cases.) This reinstates r360974, reverted in r360988, with a fix for a static_assert failure on 32-bit builds: force Type base class to have 8-byte alignment like the rest of Clang's AST nodes. llvm-svn: 360995
* Revert Refactor constant evaluation of typeid(T) to track a symbolic ↵Chris Bieneman2019-05-172-94/+12
| | | | | | | | type_info object rather than tracking the originating expression. This reverts r360974 (git commit 7ee4307bd4450022c3c8777f43a40cc4f0ccc009) llvm-svn: 360988
* Revert [c++20] P1327R1: Support for typeid applied to objects of polymorphic ↵Chris Bieneman2019-05-171-22/+6
| | | | | | | | class type in constant evaluation. This reverts r360977 (git commit f51dc8d2f98f4029247552bc45ef53628ab3b6b9) llvm-svn: 360987
OpenPOWER on IntegriCloud