summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST
Commit message (Collapse)AuthorAgeFilesLines
...
* [OPENMP] CodeGen of the 'linear' clause for the 'omp simd' directive.Alexander Musman2015-03-212-8/+47
| | | | | | | | | The linear variable is privatized (similar to 'private') and its value on current iteration is calculated, similar to the loop counter variables. Differential revision: http://reviews.llvm.org/D8375 llvm-svn: 232890
* [modules] Remove some redundant work when building a lookup table for a ↵Richard Smith2015-03-202-31/+6
| | | | | | | | | | | | | | | | | | | | | | | | DeclContext. When we need to build the lookup table for a DeclContext, we used to pull in all lexical declarations for the context; instead, just build a lookup table for the local lexical declarations. We previously didn't guarantee that the imported declarations would be in the returned map, but in some cases we'd happen to put them all in there regardless. Now we're even lazier about this. This unnecessary work was papering over some other bugs: - LookupVisibleDecls would use the DC for name lookups in the TU in C, and this was not guaranteed to find all imported names (generally, the DC for the TU in C is not a reliable place to perform lookups). We now use an identifier-based lookup mechanism for this. - We didn't actually load in the list of eagerly-deserialized declarations when importing a module (so external definitions in a module wouldn't be emitted by users of those modules unless they happened to be deserialized by the user of the module). llvm-svn: 232793
* C++14: Disable sized deallocation by default due to ABI breakageReid Kleckner2015-03-201-33/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are no widely deployed standard libraries providing sized deallocation functions, so we have to punt and ask the user if they want us to use sized deallocation. In the future, when such libraries are deployed, we can teach the driver to detect them and enable this feature. N3536 claimed that a weak thunk from sized to unsized deallocation could be emitted to avoid breaking backwards compatibility with standard libraries not providing sized deallocation. However, this approach and other variations don't work in practice. With the weak function approach, the thunk has to have default visibility in order to ensure that it is overridden by other DSOs providing sized deallocation. Weak, default visibility symbols are particularly expensive on MachO, so John McCall was considering disabling this feature by default on Darwin. It also changes behavior ELF linking behavior, causing certain otherwise unreferenced object files from an archive to be pulled into the link. Our second approach was to use an extern_weak function declaration and do an inline conditional branch at the deletion call site. This doesn't work because extern_weak only works on MachO if you have some archive providing the default value of the extern_weak symbol. Arranging to provide such an archive has the same challenges as providing the symbol in the standard library. Not to mention that extern_weak doesn't really work on COFF. Reviewers: rsmith, rjmccall Differential Revision: http://reviews.llvm.org/D8467 llvm-svn: 232788
* Don't crash-on-valid when an inline function is friend of class templateDavid Majnemer2015-03-202-2/+3
| | | | | | | | | We assumed that the most recent declaration of an inline function would also be inline. However, a more recent declaration can come from a friend declaration in a class template that is instantiated at the definition of the function. llvm-svn: 232786
* Fix -ast-dump of dependent new and delete exprsReid Kleckner2015-03-191-8/+12
| | | | llvm-svn: 232748
* Add -ast-dump support for new and delete expressions to help figure out ↵Reid Kleckner2015-03-191-0/+24
| | | | | | which operator got selected llvm-svn: 232740
* Devirtualize Attr and all subclasses.Benjamin Kramer2015-03-191-7/+1
| | | | | | | | | | | | We know all subclasses in tblgen so just generate a giant switch for the few virtual methods or turn them into a member variable using spare bits. The giant jump tables aren't pretty but still much smaller than a vtable for every attribute, shrinking Release+Asserts clang by ~400k. Also halves the size of the Attr base class. No functional change intended. llvm-svn: 232726
* MS ABI: Don't try to emit VF/VB-Tables for extern class templatesDavid Majnemer2015-03-181-1/+3
| | | | | | | | | There will be an explicit template instantiation in another translation unit which will provide the definition of the VF/VB-Tables. This fixes PR22932. llvm-svn: 232680
* MS ABI: Empty pack expansions had their mangling changed in 2013->2015David Majnemer2015-03-181-1/+5
| | | | | | | | | | We used to support the 2013 mangling and changed it to the more reasonable 2015 mangling. Let's make the mangling conditional on what version of MSVC is targeted. This fixes PR21888. llvm-svn: 232609
* MS ABI: Fix a couple of -Winconsistent-missing-override warningsJustin Bogner2015-03-171-1/+1
| | | | llvm-svn: 232559
* MS ABI: Emit HandlerMap entries for C++ catchDavid Majnemer2015-03-171-0/+18
| | | | | | | | | | | | | The HandlerMap describes, to the runtime, what sort of catches surround the try. In principle, this structure has to be emitted by the backend because only it knows the layout of the stack (the runtime needs to know where on the stack the destination of a copy lives, etc.) but there is some C++ specific information that the backend can't reason about. Stick this information in special LLVM globals with the relevant "const", "volatile", "reference" info mangled into the name. llvm-svn: 232538
* Sort ObjCProtocolDecls with array_pod_sort.Benjamin Kramer2015-03-141-5/+5
| | | | | | The predicate is essentially a string comparison. NFC. llvm-svn: 232264
* MS ABI: Mangle virtual member pointer thunks with the correct CCDavid Majnemer2015-03-141-1/+1
| | | | | | | | | | Virtual member pointers are implemented using a thunk. We assumed that the calling convention for this thunk was always __thiscall for 32-bit targets and __cdecl for 64-bit targets. However, this is not the case. Mangle in whichever calling convention is appropriate for this member function thunk. llvm-svn: 232254
* MS ABI: Generate default constructor closuresDavid Majnemer2015-03-131-1/+2
| | | | | | | | | | | | | | | | | | | | The MS ABI utilizes a compiler generated function called the "vector constructor iterator" to construct arrays of objects with non-trivial constructors/destructors. For this to work, the constructor must follow a specific calling convention. A thunk must be created if the default constructor has default arguments, is variadic or is otherwise incompatible. This thunk is called the default constructor closure. N.B. Default constructor closures are only generated if the default constructor is exported because clang itself does not utilize vector constructor iterators. Failing to export the default constructor closure will result in link/load failure if a translation unit compiled with MSVC is on the import side. Differential Revision: http://reviews.llvm.org/D8331 llvm-svn: 232229
* MS ABI: Implement __GetExceptionInfo for std::make_exception_ptrDavid Majnemer2015-03-132-1/+11
| | | | | | | | | std::make_exception_ptr calls std::__GetExceptionInfo in order to figure out how to properly copy the exception object. Differential Revision: http://reviews.llvm.org/D8280 llvm-svn: 232188
* [OPENMP] Additional sema analysis for 'omp atomic[ update]'.Alexey Bataev2015-03-131-3/+6
| | | | | | Adds additional semantic analysis + generation of helper expressions for proper codegen. llvm-svn: 232164
* MS ABI: Implement copy-ctor closures, finish implementing throwDavid Majnemer2015-03-116-18/+113
| | | | | | | | | | | | | | | This adds support for copy-constructor closures. These are generated when the C++ runtime has to call a copy-constructor with a particular calling convention or with default arguments substituted in to the call. Because the runtime has no mechanism to call the function with a different calling convention or know-how to evaluate the default arguments at run-time, we create a thunk which will do all the appropriate work and package it in a way the runtime can use. Differential Revision: http://reviews.llvm.org/D8225 llvm-svn: 231952
* revert r231700 (designated initializer patch) which brokeFariborz Jahanian2015-03-111-10/+0
| | | | | | several projects. rdar://20120666. llvm-svn: 231939
* For PR22870: produce an error rather than asserting if a designated ↵Richard Smith2015-03-111-1/+1
| | | | | | initializer appears in a signature. llvm-svn: 231892
* MS ABI: Mangle the location of the catchable type into it's nameDavid Majnemer2015-03-101-2/+17
| | | | | | | | Because the catchable type has a reference to its name, mangle the location to ensure that two catchable types with different locations are distinct. llvm-svn: 231819
* Teach raw_ostream to accept SmallString.Yaron Keren2015-03-101-1/+1
| | | | | | | | | | | | | | Saves adding .str() call to any raw_ostream << SmallString usage and a small step towards making .str() consistent in the ADTs by removing one of the SmallString::str() use cases, discussion at http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20141013/240026.html I'll update the Phabricator patch http://reviews.llvm.org/D6372 for review of the Twine SmallString support, it's more complex than this one. llvm-svn: 231763
* [modules] Don't clobber a destructor's operator delete when adding another one;Richard Smith2015-03-101-0/+9
| | | | | | | move the operator delete updating into a separate update record so we can cope with updating another module's destructor's operator delete. llvm-svn: 231735
* [PATCH Sema Objective-C]. Patch to warn on missing designated initializerFariborz Jahanian2015-03-091-0/+10
| | | | | | | override where at least a declaration of a designated initializer is in a super class and not necessarily in the current class. rdar://19653785. llvm-svn: 231700
* Make helper functions static. NFC.Benjamin Kramer2015-03-091-3/+4
| | | | | | Found by -Wmissing-prototypes. llvm-svn: 231668
* InheritViz: Hide implementation detailsBenjamin Kramer2015-03-091-11/+8
| | | | | | NFC. llvm-svn: 231655
* Simplify boolean expressions in clang with clang-tidyDavid Blaikie2015-03-091-1/+1
| | | | | | | | Patch by Richard (legalize at xmission dot com). Differential Revision: http://reviews.llvm.org/D8155 llvm-svn: 231619
* Replace Sema's map of locally-scoped extern "C" declarations with a DeclContextRichard Smith2015-03-073-1/+18
| | | | | | | | | | of extern "C" declarations. This is simpler and vastly more efficient for modules builds (we no longer need to load *all* extern "C" declarations to determine if we have a redeclaration). No functionality change intended. llvm-svn: 231538
* MS ABI: Insert copy-constructors into the CatchableTypeDavid Majnemer2015-03-065-12/+69
| | | | | | | | | | | | | | | | Find all unambiguous public classes of the exception object's class type and reference all of their copy constructors. Yes, this is not conforming but it is necessary in order to implement their ABI. This is because the copy constructor is actually referenced by the metadata describing which catch handlers are eligible to handle the exception object. N.B. This doesn't yet handle the copy constructor closure case yet, that work is ongoing. Differential Revision: http://reviews.llvm.org/D8101 llvm-svn: 231499
* Sema: The i8 suffix should yield a literal of type charDavid Majnemer2015-03-061-1/+2
| | | | | | | | | We would make i8 literals turn into signed char instead of char. This is incompatible with MSVC. This fixes PR22824. llvm-svn: 231494
* Use delegating ctors to reduce code duplication. NFC.Benjamin Kramer2015-03-062-39/+4
| | | | llvm-svn: 231476
* [modules] Rework merging of redeclaration chains on module import.Richard Smith2015-03-051-0/+5
| | | | | | | | | | | | | | | | | | | | | | We used to save out and eagerly load a (potentially huge) table of merged formerly-canonical declarations when we loaded each module. This was extremely inefficient in the presence of large amounts of merging, and didn't actually save any merging lookup work, because we still needed to perform name lookup to check that our merged declaration lists were complete. This also resulted in a loss of laziness -- even if we only needed an early declaration of an entity, we would eagerly pull in all declarations that had been merged into it regardless. We now store the relevant fragments of the table within the declarations themselves. In detail: * The first declaration of each entity within a module stores a list of first declarations from imported modules that are merged into it. * Loading that declaration pre-loads those other entities, so that they appear earlier within the redeclaration chain. * The name lookup tables list the most recent local lookup result, if there is one, or all directly-imported lookup results if not. llvm-svn: 231424
* MS ABI: Implement support for throwing a C++ exceptionDavid Majnemer2015-03-051-0/+39
| | | | | | | | | | | | | | | | | | | | | | | Throwing a C++ exception, under the MS ABI, is implemented using three components: - ThrowInfo structure which contains information like CV qualifiers, what destructor to call and a pointer to the CatchableTypeArray. - In a significant departure from the Itanium ABI, copying by-value occurs in the runtime and not at the catch site. This means we need to enumerate all possible types that this exception could be caught as and encode the necessary information to convert from the exception object's type to the catch handler's type. This includes complicated derived to base conversions and the execution of copy-constructors. N.B. This implementation doesn't support the execution of a copy-constructor from within the runtime for now. Adding support for that functionality is quite difficult due to things like default argument expressions which may evaluate arbitrary code hiding in the copy-constructor's parameters. Differential Revision: http://reviews.llvm.org/D8066 llvm-svn: 231328
* New ObjC warning: circular containers.Alex Denisov2015-03-041-1/+96
| | | | | | | | | | | | | | | | | | | | | This commit adds new warning to prevent user from creating 'circular containers'. Mutable collections from NSFoundation allows user to add collection to itself, e.g.: NSMutableArray *a = [NSMutableArray new]; [a addObject:a]; The code above leads to really weird behaviour (crashes, 'endless' recursion) and retain cycles (collection retains itself) if ARC enabled. Patch checks the following collections: - NSMutableArray, - NSMutableDictionary, - NSMutableSet, - NSMutableOrderedSet, - NSCountedSet. llvm-svn: 231265
* TypePrinter print __restrict if not in C99 modeJacques Pienaar2015-03-031-6/+10
| | | | | | | | | | | | | | restrict is a keyword in C99 but not in C++ while clang accepts __restrict for C++ code. Modify the TypePrinter to print __restrict when not processing C99 code. Printing restrict in C++ was problematic as printing the argument of int f(int * __restrict a) { ... } resulted in int *restrict a which is incorrect. http://reviews.llvm.org/D8048 llvm-svn: 231179
* Sema: Properly initialize the thrown exception objectDavid Majnemer2015-03-031-0/+13
| | | | | | | We would create the exception object with the wrong qualifiers, ensuring that the wrong copy constructor would get called. llvm-svn: 231049
* Add clang support for Objective-C application extensions.Bob Wilson2015-03-021-8/+22
| | | | | | | | This adds the -fapplication-extension option, along with the ios_app_extension and macosx_app_extension availability attributes. Patch by Ted Kremenek llvm-svn: 230989
* Fix ObjCInterfaceDecl::getCategoryMethod() and give it a caller. No behavior ↵Nico Weber2015-03-021-2/+1
| | | | | | change. llvm-svn: 230928
* Add support for generating MIPS legacy NaNPetar Jovanovic2015-02-261-4/+17
| | | | | | | | | | | Currently, the NaN values emitted for MIPS architectures do not cover non-IEEE754-2008 compliant case. This change fixes the issue. Patch by Vladimir Radosavljevic. Differential Revision: http://reviews.llvm.org/D7882 llvm-svn: 230653
* Update assumption in template diffing about integer template arguments.Richard Trieu2015-02-261-6/+14
| | | | | | | | | | Fix for PR22017. Integer template arguments are automatically bit extended to the size of the integer type. In template diffing, evaluated expressions were not having their results extending, leading to comparing two APSInt's with different widths. Apply the proper bit extending when evaluating template arguments. This mainly affected bool template arguments. llvm-svn: 230603
* [modules] Even if we already have a definition of a class, loading in anotherRichard Smith2015-02-251-5/+8
| | | | | | | | one can give us more lookup results (due to implicit special members). Be sure to complete the redecl chain for every kind of DeclContext before performing a lookup into it, rather than only doing so for NamespaceDecls. llvm-svn: 230558
* Reland (2x) r230314, "Fix codegen for virtual methods that are (re-) ↵Reid Kleckner2015-02-251-0/+4
| | | | | | | | exported from multiple modules." This reverts commits r230477 and r230478. llvm-svn: 230526
* Reland r230446, "MS ABI: Try to respect external AST source record layouts"Reid Kleckner2015-02-251-59/+129
| | | | | | | | | It broke test/PCH/headersearch.cpp because it was using -Wpadding, which only works for Itanium layout. Before this commit, we would use Itanium record layout when using PCH, which is crazy. Now that the test uses an explicit Itanium triple, we can reland. llvm-svn: 230525
* Sema: Parenthesized bound destructor member expressions can be calledDavid Majnemer2015-02-253-15/+17
| | | | | | | | | We would wrongfully reject (a.~A)() in both the destructor and pseudo-destructor cases. This fixes PR22668. llvm-svn: 230512
* Whitespace.NAKAMURA Takumi2015-02-251-1/+1
| | | | llvm-svn: 230478
* Revert r230448, "Reland r230314 "Fix codegen for virtual methods that are ↵NAKAMURA Takumi2015-02-251-5/+1
| | | | | | (re-) exported from multiple modules."", since I have reverted r230446. llvm-svn: 230477
* Whitespace.NAKAMURA Takumi2015-02-251-8/+8
| | | | llvm-svn: 230475
* Revert r230446, "MS ABI: Try to respect external AST source record layouts"NAKAMURA Takumi2015-02-251-130/+60
| | | | | | It fails on Clang::PCH/headersearch.cpp for targeting msvc. llvm-svn: 230474
* Reland r230314 "Fix codegen for virtual methods that are (re-) exported from ↵Reid Kleckner2015-02-251-1/+5
| | | | | | | | | | multiple modules." This reverts the revert from commit r230406. The changes in r230445 and r230446 make the test pass on Windows now. llvm-svn: 230448
* MS ABI: Try to respect external AST source record layoutsReid Kleckner2015-02-251-60/+130
| | | | | | | | Covered by existing tests in test/CodeGen/override-layout.c and test/CodeGenCXX/override-layout.cpp. Seriously, they found real bugs in my code. :) llvm-svn: 230446
* Add missing MD canonicalization to MS vtable builderReid Kleckner2015-02-251-0/+1
| | | | llvm-svn: 230445
OpenPOWER on IntegriCloud