summaryrefslogtreecommitdiffstats
path: root/clang/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* clang-format: [JS] more precisely detect enums.Daniel Jasper2015-03-151-1/+7
| | | | | | | | | | | | The current enum detection is overly aggressive. As NestingLevel only applies per line (?) it classifies many if not most object literals as enum declarations and adds superfluous line breaks into them. This change narrows the heuristic by requiring an assignment just before the open brace and requiring the line to start with an identifier. Patch by Martin Probst. Thank you. llvm-svn: 232320
* MS ABI: Don't use qualified pointee types for 'catch' EH TypeDescriptorsDavid Majnemer2015-03-154-32/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Qualifiers are located next to the TypeDescriptor in order to properly ensure that a pointer type can only be caught by a more qualified catch handler. This means that a catch handler of type 'const int *' requires an RTTI object for 'int *'. We got this correct for 'throw' but not for 'catch'. N.B. We don't currently have the means to store the qualifiers because LLVM's EH strategy is tailored to the Itanium scheme. The Itanium ABI stores qualifiers inside the type descriptor in such a way that the manner of qualification is stored in addition to the pointee type's descriptor. Perhaps the best way of modeling this for the MS ABI is using an aggregate type to bundle the qualifiers with the descriptor? This is tricky because we want to make it clear to the optimization passes which catch handlers invalidate other handlers. My current thoughts on a design for this is along the lines of: { { TypeDescriptor* TD, i32 QualifierFlags }, i32 MiscFlags } The idea is that the inner most aggregate is all that is needed to communicate that one catch handler might supercede another. The 'MiscFlags' field would be used to hold the bitpattern for the notion that the 'catch' handler does not need to invoke a copy-constructor because we are catching by reference. llvm-svn: 232318
* -Wempty-body: fix false negative triggered by macrosDmitri Gribenko2015-03-151-1/+1
| | | | | | | | | | | | | When if statement condition ended in a macro: if (ptr == NULL); the check used to consider the definition location of NULL, instead of the current line. Patch by Manasij Mukherjee. llvm-svn: 232295
* MS ABI: Tidy up references to the ASTContextDavid Majnemer2015-03-141-20/+21
| | | | | | | CGCXXABI has a handy getContext() method. Use that instead of explicitly going through the CodeGenModule. llvm-svn: 232289
* CodeGen: Correctly initialize bitfields with non-constant initializersDavid Majnemer2015-03-141-3/+8
| | | | | | | | It is possible to construct an initializer for a bitfield which is not constant. Instead of emitting code to initialize the field before the execution of main, clang would crash. llvm-svn: 232285
* Sort ObjCProtocolDecls with array_pod_sort.Benjamin Kramer2015-03-141-5/+5
| | | | | | The predicate is essentially a string comparison. NFC. llvm-svn: 232264
* [analyzer] Sort path diagnostics with array_pod_sort.Benjamin Kramer2015-03-141-5/+9
| | | | | | | | | | | | | | | They're expensive to compare and we won't sort many of them so std::sort doesn't give any benefits and causes code bloat. Func fact: clang -O3 didn't even bother to inline libc++'s std::sort here. While there validate the predicate a bit harder, the sort is unstable and we don't want to introduce any non-determinism. I had to spell out the function pointer type because GCC 4.7 still fails to convert the lambda to a function pointer :( No intended functionality change. llvm-svn: 232263
* 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
* [modules] Teach the AST reader to handle the case of importing a moduleChandler Carruth2015-03-143-54/+58
| | | | | | | | | | | | | | | | | | | with a subset of the existing target CPU features or mismatched CPU names. While we can't check that the CPU name used to build the module will end up being able to codegen correctly for the translation unit, we actually check that the imported features are a subset of the existing features. While here, rewrite the code to use std::set_difference and have it diagnose all of the differences found. Test case added which walks the set relationships and ensures we diagnose all the right cases and accept the others. No functional change for implicit modules here, just better diagnostics. llvm-svn: 232248
* Implement bad cast checks using control flow integrity information.Peter Collingbourne2015-03-145-3/+120
| | | | | | | | | | | This scheme checks that pointer and lvalue casts are made to an object of the correct dynamic type; that is, the dynamic type of the object must be a derived class of the pointee type of the cast. The checks are currently only introduced where the class being casted to is a polymorphic class. Differential Revision: http://reviews.llvm.org/D8312 llvm-svn: 232241
* MS ABI: Generate default constructor closuresDavid Majnemer2015-03-135-27/+81
| | | | | | | | | | | | | | | | | | | | 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-137-47/+77
| | | | | | | | | 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
* Sema: Replace the SetVector/DenseMap/std::sort combination with a simple ↵Benjamin Kramer2015-03-131-21/+1
| | | | | | | | | | | | std::map This guarantees the order and doesn't increase malloc counts a lot as there are typically very few elements int the map. Provide a little iterator adapter to keep the same interface as we had with the flat sorted list. No functional change intended. llvm-svn: 232173
* When building a module, all headers of submodules can be used.Daniel Jasper2015-03-131-1/+2
| | | | | | This extends r232159. llvm-svn: 232168
* clang-format: Don't corrupt macros with open braces.Daniel Jasper2015-03-131-5/+8
| | | | | | | | | | | | | | | | | | | | | | | | Formatting: #define A { { #define B } } Before: #define A \ { \ { #define B } \ } After: #define A \ { \ { #define B \ } \ } This fixes llvm.org/PR22884. llvm-svn: 232166
* [OPENMP] Additional sema analysis for 'omp atomic[ update]'.Alexey Bataev2015-03-134-8/+237
| | | | | | Adds additional semantic analysis + generation of helper expressions for proper codegen. llvm-svn: 232164
* Make a module "use" also count as use of all its submodulesDaniel Jasper2015-03-131-3/+5
| | | | llvm-svn: 232159
* [OPENMP] Re-factor __kmpc_for_static_init_* routine generation.Alexander Musman2015-03-132-93/+32
| | | | llvm-svn: 232154
* [Modules] Teach Clang to survive ambiguous macros which come from systemChandler Carruth2015-03-131-7/+5
| | | | | | | | | | | | | | | | | | | | | headers even if they arrived when merging non-system modules. The idea of this code is that we don't want to warn the user about macros defined multiple times by their system headers with slightly different definitions. We should have this behavior if either the macro comes from a system module, or the definition within the module comes from a system header. Previously, we would warn on ambiguous macros being merged when they came from a users modules even though they only showed up via system headers. By surviving this we can handle common system header macro differences like differing 'const' qualification of pointers due to some headers predating 'const' being valid in C code, even when those systems headers are pre-built into a system module. Differential Revision: http://reviews.llvm.org/D8310 llvm-svn: 232149
* [libclang] Fix crash when code-completing inside constructor initializer for ↵Argyrios Kyrtzidis2015-03-131-1/+7
| | | | | | | | a builtin type. rdar://20149746 llvm-svn: 232145
* Deduplicate #undef directives imported from multiple modules.Richard Smith2015-03-132-4/+10
| | | | | | | No functionality change, but deeply-importing module files are smaller and faster now. llvm-svn: 232140
* Simplify.Joerg Sonnenberger2015-03-131-9/+1
| | | | llvm-svn: 232130
* Disambiguate call for GCC.Benjamin Kramer2015-03-122-2/+2
| | | | llvm-svn: 232122
* CodeGen: Base the conditional cleanup machinery on variadic templatesBenjamin Kramer2015-03-122-139/+34
| | | | | | | | | | | This is complicated by the fact that we can't simply use side-effecting calls in an argument list without losing all guarantees about the order they're emitted. To keep things deterministic we use tuples and brace initialization, which thankfully guarantees evaluation order. No functionality change intended. llvm-svn: 232121
* clang-format: [OBJC] Don't indent 8 spaces in method declarations.Daniel Jasper2015-03-121-7/+3
| | | | | | | | | | | | Before: - (void)aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa: (SoooooooooooooooooooooomeType *)bbbbbbbbbb; After: - (void)aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa: (SoooooooooooooooooooooomeType *)bbbbbbbbbb; llvm-svn: 232112
* [X86, AVX2] Replace inserti128 and extracti128 intrinsics with generic shufflesSanjay Patel2015-03-122-10/+15
| | | | | | | | | | | | This is nearly identical to the v*f128_si256 parts of r231792 and r232052. AVX2 introduced proper integer variants of the hacked integer insert/extract C intrinsics that were created for this same functionality with AVX1. This should complete the front end fixes for insert/extract128 intrinsics. Corresponding LLVM patch to follow. llvm-svn: 232109
* Fix grammar in a comment, wrap to 80 columns. No behavior change.Nico Weber2015-03-121-2/+3
| | | | llvm-svn: 232087
* MS ABI: Allow a nullptr_t exception to be caught by void * catch handlerDavid Majnemer2015-03-121-0/+11
| | | | | | | | | A nullptr exception object can be caught by any pointer type catch handler. However, it is not possible to express this in the exception info for the MS ABI. As a middle ground, allow such exception objects to be caught with pointer-to-void catch handlers. llvm-svn: 232069
* Replace second (hopefully unused) access of macro input argument with zero ↵Sanjay Patel2015-03-121-3/+3
| | | | | | | | | | vector to be safer. Suggested by Craig Topper in D8275. This is a follow-on to r232052. llvm-svn: 232061
* ASTMatchers: Add an explicit dependency on libclangBasic.Benjamin Kramer2015-03-121-0/+1
| | | | | | | In a static build the dependency is picked up implictly, but not in a shared library build. This is needed for the new ObjC matchers that reference Selector. llvm-svn: 232055
* [X86, AVX] replace vextractf128 intrinsics with generic shufflesSanjay Patel2015-03-122-16/+28
| | | | | | | | | | | This is very much like D8088 (checked in at r231792). Now that we've replaced the vinsertf128 intrinsics, do the same for their extract twins. Differential Revision: http://reviews.llvm.org/D8275 llvm-svn: 232052
* Add support for a few Objective-C matchers.Manuel Klimek2015-03-121-0/+8
| | | | | | | | | | | Add some matchers for Objective-C selectors and messages to ASTMatchers.h. Minor mods to ASTMatchersTest.h to allow test files with ".m" extension in addition to ".cpp". New tests added to ASTMatchersTest.c. Patch by Dean Sutherland. llvm-svn: 232051
* clang-format: When putting */& next to types, also wrap before them.Daniel Jasper2015-03-122-5/+12
| | | | | | | | | | | | Before: LoooooooooooongType * loooooooooooongVariable; After: LoooooooooooongType *loooooooooooongVariable; llvm-svn: 232044
* clang-format: [Java] Support anonymous classes after = and return.Daniel Jasper2015-03-122-0/+29
| | | | | | | | | | | | | | | | | | | Before: A a = new A(){public String toString(){return "NotReallyA"; } } ; After: A a = return new A() { public String toString() { return "NotReallyA"; } }; This fixes llvm.org/PR22878. llvm-svn: 232042
* Sema: Don't emit a missing prototype warning for deleted functions.Benjamin Kramer2015-03-122-27/+32
| | | | | | | | | | | | | This is a bit more involved than I anticipated, so here's a breakdown of the changes: 1. Call ActOnFinishFunctionBody _after_ we parsed =default and =delete specifiers. Saying that we finished the body before parsing =default is just wrong. Changing this allows us to use isDefaulted and isDeleted on a decl in ActOnFinishFunctionBody. 2. Check for -Wmissing-prototypes after we parsed the function body. 3. Disable -Wmissing-prototypes when the Decl isDeleted. llvm-svn: 232040
* Use Sema's PrintingPolicy when diagnosing DeclSpecs.Benjamin Kramer2015-03-121-1/+2
| | | | | | | | | | | | | Sema overrides ASTContext's policy on the first emitted diagnostic (doesn't matter if it's ignored or not). This means changing the order of diagnostic emission in Sema suddenly changes the text of diagnostic emitted from the parser. In the test case -Wmissing-prototypes (ignored) was the culprit, use 'int main' to suppress that warning so we see when this regresses. Also move it into Sema/ as it's not testing any C++. llvm-svn: 232039
* Reverting r232034, as it broke one of the bots with link errors. Details at: ↵Aaron Ballman2015-03-121-8/+0
| | | | | | http://bb.pgr.jp/builders/ninja-clang-x64-mingw64-RA/builds/6352/steps/build/logs/stdio llvm-svn: 232038
* Instead of dereferencing std::vector::end() (which is UB and causes failed ↵Aaron Ballman2015-03-121-1/+2
| | | | | | assertions in debug builds with Visual Studio), use data() + size() to calculate the end iterator. Amends r231952. llvm-svn: 232037
* [OPENMP] CodeGen - 'omp for' with dynamic schedule kinds.Alexander Musman2015-03-123-44/+213
| | | | | | Differential Revision: http://reviews.llvm.org/D7138 llvm-svn: 232036
* Added some matchers for objective c selectors and messages to ASTMatchers.h. ↵Aaron Ballman2015-03-121-0/+8
| | | | | | | | Minor mods to ASTMatchersTest.h to allow test files with ".m" extension in addition to ".cpp". New tests added to ASTMatchersTest.c. Patch by Dean Sutherland, reviewed by Manuel Klimek. From http://reviews.llvm.org/D7710 llvm-svn: 232034
* [OPENMP] Initial codegen for 'omp sections' and 'omp section' directives.Alexey Bataev2015-03-122-23/+135
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If only one section is found in the sections region, it is emitted just like single region. Otherwise it is emitted as a static non-chunked loop. #pragma omp sections { #pragma omp section {1} ... #pragma omp section {n} } is translated to something like i32 <iter_var> i32 <last_iter> = 0 i32 <lower_bound> = 0 i32 <upper_bound> = n-1 i32 <stride> = 1 call void @__kmpc_for_static_init_4(<loc>, i32 <gtid>, i32 34/*static non-chunked*/, i32* <last_iter>, i32* <lower_bound>, i32* <upper_bound>, i32* <stride>, i32 1/*increment always 1*/, i32 1/*chunk always 1*/) <upper_bound> = min(<upper_bound>, n-1) <iter_var> = <lb> check: br <iter_var> <= <upper_bound>, label cont, label exit continue: switch (IV) { case 0: {1}; break; ... case <NumSection> - 1: {n}; break; } ++<iter_var> br label check exit: call void @__kmpc_for_static_fini(<loc>, i32 <gtid>) Differential Revision: http://reviews.llvm.org/D8244 llvm-svn: 232021
* Driver: Keep -isysroot flags in crash scripts if we're dumping a VFSJustin Bogner2015-03-121-4/+7
| | | | | | | | | | | | | For crashes with a VFS (ie, with modules), the -isysroot flag is often necessary to reproduce the crash. This is especially true if some modules need to be rebuilt, since without the sysroot they'll try to read headers that are outside of the VFS. I find it likely that we should keep some of the other -i flags in this case as well, but I haven't seen that come up in practice yet so it seems better to be conservative. llvm-svn: 231997
* Driver: Print the clang version and original command in crash scriptsJustin Bogner2015-03-121-0/+3
| | | | | | | | | | When a crash report script doesn't work for a reproduction on your machine for one reason or another, it can be really tricky to figure out why not. The compiler version that crashed and the original command line before stripping flags are very helpful when this comes up. llvm-svn: 231989
* Under duress, move check for target support of __builtin_setjmp/Joerg Sonnenberger2015-03-115-46/+28
| | | | | | __builtin_longjmp to Sema as requested by John McCall. llvm-svn: 231986
* Add deprecation notice for -f(no-)sanitize-recover flags.Alexey Samsonov2015-03-111-2/+7
| | | | | | | These flags should be replaced with corresponding -f(no-)sanitize-recover=<list> flags. llvm-svn: 231983
* [PowerPC] ABI support for the QPX vector instruction setHal Finkel2015-03-113-26/+108
| | | | | | | | | | | | | | Support for the QPX vector instruction set, used on the IBM BG/Q supercomputer, has recently been added to the LLVM PowerPC backend. This vector instruction set requires some ABI modifications because the ABI on the BG/Q expects <4 x double> vectors to be provided with 32-byte stack alignment, and to be handled as native vector types (similar to how Altivec vectors are handled on mainline PPC systems). I've named this ABI variant elfv1-qpx, have made this the default ABI when QPX is supported, and have updated the ABI handling code to provide QPX vectors with the correct stack alignment and associated register-assignment logic. llvm-svn: 231960
* MS ABI: Implement copy-ctor closures, finish implementing throwDavid Majnemer2015-03-1110-29/+296
| | | | | | | | | | | | | | | 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
* [modules] When merging the pattern of a class template definition into a priorRichard Smith2015-03-111-0/+1
| | | | | | | | | | definition, be sure to update the definition data on all declarations, not just the canonical one, since the pattern might not be in the list of pending definitions (if it used to be canonical itself). One-line fix by me; reduced testcase by Daniel Jasper! llvm-svn: 231950
* Reverted OpenCL2.0 atomic type commits r231932, r231935Anastasia Stulova2015-03-113-71/+1
| | | | | | (caused undesirable update of -std flag to use _Atomic) llvm-svn: 231942
* revert r231700 (designated initializer patch) which brokeFariborz Jahanian2015-03-113-18/+5
| | | | | | several projects. rdar://20120666. llvm-svn: 231939
OpenPOWER on IntegriCloud