summaryrefslogtreecommitdiffstats
path: root/clang/lib
Commit message (Collapse)AuthorAgeFilesLines
* Add -fno-jump-tables and-fjump-tables flagsNirav Dave2016-04-053-0/+10
| | | | | | | | | | | | | Add no-jump-tables flag to disable use of jump tables when lowering switch statements Reviewers: echristo, hans Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D18407 llvm-svn: 265425
* [X86] Introduction of -march=lakemont.Andrey Turetskiy2016-04-051-3/+16
| | | | | | Differential Revision: http://reviews.llvm.org/D18651 llvm-svn: 265405
* clang-format: Fix cast detection on "this".Daniel Jasper2016-04-051-3/+3
| | | | | | | | | | | | Before: auto x = (X) this; After: auto x = (X)this; This fixes llvm.org/PR27198. llvm-svn: 265385
* Consolidate and improve the handling of built-in feature-like macrosAndy Gibbs2016-04-051-161/+208
| | | | | | | | | | | | | | | | | | Summary: The parsing logic has been separated out from the macro implementation logic, leading to a number of improvements: * Gracefully handle unexpected/invalid tokens, too few, too many and nested parameters * Provide consistent behaviour between all built-in feature-like macros * Simplify the implementation of macro logic * Fix __is_identifier to correctly return '0' for non-identifiers Reviewers: doug.gregor, rsmith Subscribers: rsmith, cfe-commits Differential Revision: http://reviews.llvm.org/D17149 llvm-svn: 265381
* Move local helper class into anonymous namespace.Richard Smith2016-04-041-0/+2
| | | | llvm-svn: 265364
* Set the default C standard to C99 when targeting the PS4.Sunil Srivastava2016-04-041-3/+8
| | | | | | | | Patch by Douglas Yung! Differential Revision: http://reviews.llvm.org/D18708 llvm-svn: 265359
* Fix "suggest parentheses" warning.James Y Knight2016-04-041-3/+3
| | | | llvm-svn: 265355
* Fix an unused-variable warning by using the variable in the placeJohn McCall2016-04-041-1/+1
| | | | | | it was supposed to have been used. llvm-svn: 265344
* [CrashReproducer] Pass -I, -F and -resource-dir to the reproducer script ↵Bruno Cardoso Lopes2016-04-041-4/+4
| | | | | | | | | | when using modules/vfs The reproducer should use -I/-F/-resource-dir in the same way as the original command. The VFS already collects the right headers but without these flags the reproducer will fail to do the right thing. llvm-svn: 265343
* [Sema] Delete FIXME that has been fixed. NFC.George Burgess IV2016-04-041-2/+0
| | | | llvm-svn: 265341
* Add copyright notice to the modulemap file.Yunzhong Gao2016-04-041-0/+23
| | | | | | | | | | The module.modulemap file in the lib/Headers directory was missing the LLVM copyright notice. This patch adds the copyright notice just like the rest of the files in this directory. Differential Revision: http://reviews.llvm.org/D18709 llvm-svn: 265325
* IRGen-level lowering for the Swift calling convention.John McCall2016-04-049-45/+1115
| | | | llvm-svn: 265324
* [OPENMP] Codegen for teams directive for NVPTXCarlo Bertolli2016-04-045-21/+104
| | | | | | | | | | | | This patch implements the teams directive for the NVPTX backend. It is different from the host code generation path as it: Does not call kmpc_fork_teams. All necessary teams and threads are started upon touching the target region, when launching a CUDA kernel, and their execution is coordinated through sequential and parallel regions within the target region. Does not call kmpc_push_num_teams even if a num_teams of thread_limit clause is present. Setting the number of teams and the thread limit is implemented by the nvptx-related runtime. Please note that I am now passing a Clang Expr * to emitPushNumTeams instead of the originally chosen llvm::Value * type. The reason for that is that I want to avoid emitting expressions for num_teams and thread_limit if they are not needed in the target region. http://reviews.llvm.org/D17963 llvm-svn: 265304
* AnnotateFunctions: Tweak for mingw.NAKAMURA Takumi2016-04-041-0/+2
| | | | | | | - Externalize the registry. - Update libdeps. llvm-svn: 265301
* Add a PragmaHandler Registry for plugins to add PragmaHandlers toJohn Brawn2016-04-041-0/+7
| | | | | | | | | | This allows plugins which add AST passes to also define pragmas to do things like only enable certain behaviour of the AST pass in files where a certain pragma is used. Differential Revision: http://reviews.llvm.org/D18319 llvm-svn: 265295
* [OPENMP 4.0] Support for 'inbranch|noinbranch' clauses in 'declareAlexey Bataev2016-04-042-10/+45
| | | | | | | | | simd'. Added parsing/semantic analysis for 'inbranch|notinbranch' clauses of '#pragma omp declare simd' construct. llvm-svn: 265287
* clang-cl: Don't skip i_group flags other than -include when building pchs.Nico Weber2016-04-021-1/+2
| | | | | | | Before this change, e.g. -isystem flags in front of the /FI corresponding to the pch file would be incorrectly ignored. llvm-svn: 265238
* [Objective-C] Introduce objc_runtime_visible attribute.Douglas Gregor2016-04-013-0/+69
| | | | | | | | | | | | | | | | | | | | The objc_runtime_visible attribute deals with an odd corner case where a particular Objective-C class is known to the Objective-C runtime (and, therefore, accessible by name) but its symbol has been hidden for some reason. For such classes, teach CodeGen to use objc_lookUpClass to retrieve the Class object, rather than referencing the class symbol directly. Classes annotated with objc_runtime_visible have two major limitations that fall out from places where Objective-C metadata needs to refer to the class (or metaclass) symbol directly: * One cannot implement a subclass of an objc_runtime_visible class. * One cannot implement a category on an objc_runtime_visible class. Implements rdar://problem/25494092. llvm-svn: 265201
* [CodeGen] Emit lifetime.end intrinsic after objects are destructed inAkira Hatanaka2016-04-013-4/+16
| | | | | | | | | | | | | | | | landing pads. Previously, lifetime.end intrinsics were inserted only on normal control flows. This prevented StackColoring from merging stack slots for objects that were destroyed on the exception handling control flow since it couldn't tell their lifetime ranges were disjoint. This patch fixes code-gen to emit the intrinsic on both control flows. rdar://problem/22181976 Differential Revision: http://reviews.llvm.org/D18196 llvm-svn: 265197
* [modules] Start moving the code for encoding AST records out of ASTWriter intoRichard Smith2016-04-013-419/+415
| | | | | | | | a separate class. The goal is for this class to have a separate lifetime from the AST writer so that it can meaningfully track pending statement nodes and context for more compact encoding of various types. llvm-svn: 265195
* Diagnose missing macro argument following charize operator.Andy Gibbs2016-04-011-2/+3
| | | | | | | For completeness, add a test-case for the equivalent stringize operator diagnostic too. llvm-svn: 265177
* [CrashReproducer] Add -fmodule-cache-path to reproducer scriptBruno Cardoso Lopes2016-04-011-0/+13
| | | | | | | | The cc1 invocation in the reproducer script should contain a valid path in -fmodule-cache-path; for that reuse "<name>.cache/module" dir we already use to dump the vfs and modules. llvm-svn: 265162
* [OpenCL] Moved nosvm attribute handling in Sema to other OpenCL attrsAnastasia Stulova2016-04-011-3/+3
| | | | llvm-svn: 265146
* [Lexer] Let the compiler infer string lengths. No functionality change intended.Benjamin Kramer2016-04-011-2/+2
| | | | llvm-svn: 265126
* [Lexer] Don't read out of bounds if a conflict marker is at the end of a fileBenjamin Kramer2016-04-011-1/+1
| | | | | | | | | | This can happen as we look for '<<<<' while scanning tokens but then expect '<<<<\n' to tell apart perforce from diff3 conflict markers. Just harden the pointer arithmetic. Found by libfuzzer + asan! llvm-svn: 265125
* [OPENMP] Avoid useless recursive calls in getDSA if it is called in a loop, NFCDmitry Polukhin2016-04-011-5/+5
| | | | llvm-svn: 265123
* [OPENMP 4.5] Allow data members as loop counters in loop-basedAlexey Bataev2016-04-011-166/+229
| | | | | | | | | | directives. OpenMP 4.5 allows privatization of non-static data members in non-static member functions. Patch allows to use and implicit privatization of data members used as counters in loop-based directives. llvm-svn: 265121
* Revert "[OPENMP] Allow skip expression after comma in clauses with lists."Alexey Bataev2016-04-011-5/+4
| | | | | | | This reverts commit http://reviews.llvm.org/rL265003. After some thoughts decided to emit errors here. llvm-svn: 265119
* [analyzer] Prefer accessor method in extension over category in CallEvent.Devin Coughlin2016-04-011-2/+24
| | | | | | | | | | | | | | In ObjCMethodCall:getRuntimeDefinition(), if the method is an accessor in a category, and it doesn't have a self declaration, first try to find the method in a class extension. This works around a bug in Sema where multiple accessors are synthesized for properties in class extensions that are redeclared in a category. The implicit parameters are not filled in for the method on the category, which causes a crash when trying to synthesize a getter for the property in BodyFarm. The Sema bug is tracked as rdar://problem/25481164. rdar://problem/25056531 llvm-svn: 265103
* [CUDA] Fix typo in __clang_cuda_runtime_wrapper.h.Justin Lebar2016-04-011-1/+1
| | | | | | We're #including the wrong file! llvm-svn: 265083
* Adapt to LLVM API change in r265077.Adrian Prantl2016-03-311-3/+3
| | | | | | | | | EmissionKind moved from DIBuilder to DICompileUnit. <rdar://problem/25427165> llvm-svn: 265078
* [index] Fix regression where ObjC method declarations may mistakenly get ↵Argyrios Kyrtzidis2016-03-311-3/+3
| | | | | | | | indexed as definition. rdar://25372906 llvm-svn: 265042
* Diagnostics: remove dodgy handler for bitcode inlineasm diagnostics.Tim Northover2016-03-311-8/+0
| | | | | | | | Whatever crash it was there to present appears to have been fixed in the backend now, and it had the nasty side-effect of causing clang to exit(0) and leave a .o containing goodness knows what even when an error hit. llvm-svn: 265038
* [PGO] Avoid instrumenting constants at value sitesBetul Buyukkurt2016-03-311-0/+3
| | | | | | | | | | Value profiling should not profile constants and/or constant expressions when they appear as callees in call instructions. Constant expressions form when a direct callee has bitcasts or inttoptr(ptrtint (callee)) nests surrounding it. Value profiling should avoid instrumenting such cases. Mostly NFC. llvm-svn: 265037
* [OpenCL] Added nosvm attribute for OpenCL v2.0.Anastasia Stulova2016-03-312-1/+13
| | | | | | | | | | | | | It is not widely used and removed from OpenCL v2.1. This change modifies Clang to parse the attribute for OpenCL but ignores it afterwards. Patch by Liu Yaxun (Sam)! Differential Revision: http://reviews.llvm.org/D17861 llvm-svn: 265006
* [OPENMP] Support dumping OpenMP specific constructs.Alexey Bataev2016-03-311-0/+75
| | | | | | | Add proper dumping support for OpenMP declarations, directives and clauses. llvm-svn: 265004
* [OPENMP] Allow skip expression after comma in clauses with lists.Alexey Bataev2016-03-311-4/+5
| | | | | | Compatibility fix for better compatibility with the existing software. llvm-svn: 265003
* [CodeGenCXX] Fix ItaniumCXXABI::getAlignmentOfExnObject to return 8-byteAkira Hatanaka2016-03-312-10/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | alignment on Darwin. Itanium C++ ABI specifies that _Unwind_Exception should be double-word aligned (16B). To conform to the ABI, libraries implementing exception handling declare the struct with __attribute__((aligned)), which aligns the unwindHeader field (and the end of __cxa_exception) to the default target alignment (which is typically 16-bytes). struct __cxa_exception { ... // struct is declared with __attribute__((aligned)). _Unwind_Exception unwindHeader; }; Based on the assumption that _Unwind_Exception is declared with __attribute__((aligned)), ItaniumCXXABI::getAlignmentOfExnObject returns the target default alignment for __attribute__((aligned)). It turns out that libc++abi, which is used on Darwin, doesn't declare the struct with the attribute and therefore doesn't guarantee that unwindHeader is aligned to the alignment specified by the ABI, which in some cases causes the program to crash because of unaligned memory accesses. This commit avoids crashes due to unaligned memory accesses by having getAlignmentOfExnObject return an 8-byte alignment on Darwin. I've only fixed the problem for Darwin, but we should also figure out whether other platforms using libc++abi need similar fixes. rdar://problem/25314277 Differential revision: http://reviews.llvm.org/D18479 llvm-svn: 264998
* Fix -Wdynamic-class-memaccess to skip invalid classes.Richard Trieu2016-03-311-1/+1
| | | | | | | | | This warning sometimes will infinitely recurse on CXXRecordDecl's from ill-formed recursive classes that have fields of themselves. Skip processing these classes to prevent this from happening. Fixes https://llvm.org/bugs/show_bug.cgi?id=27142 llvm-svn: 264991
* [DarwinDriver] Increase the number of valid digits for ld64 version string.Bruno Cardoso Lopes2016-03-312-5/+30
| | | | | | | | | | Previously only 3 digits were valid. Increase it to 5. Differential Revision: http://reviews.llvm.org/D18304 rdar://problem/24843016 llvm-svn: 264987
* [Sema] Fix PR27122: ICE with enable_if+ill-formed call.George Burgess IV2016-03-311-1/+16
| | | | | | | | | | | | | | | | | | | | | | | In some cases, when we encounter a direct function call with an incorrect number of arguments, we'll emit a diagnostic, and pretend that the call to the function was valid. For example, in C: int foo(); int a = foo(1); Prior to this patch, we'd get an ICE if foo had an enable_if attribute, because CheckEnableIf assumes that the number of arguments it gets passed is valid for the function it's passed. Now, we check that the number of args looks valid prior to checking enable_if conditions. This fix was not done inside of CheckEnableIf because the problem presently can only occur in one caller of CheckEnableIf (ActOnCallExpr). Additionally, checking inside of CheckEnableIf would make us emit multiple diagnostics for the same error (one "enable_if failed", one "you gave this function the wrong number of arguments"), which seems worse than just complaining about the latter. llvm-svn: 264975
* [CrashReproducer] Add a module map callback for added headersBruno Cardoso Lopes2016-03-302-1/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current ModuleDependencyCollector has a AST listener to collect header files present in loaded modules, but this isn't enough to collect all headers needed in the crash reproducer. One of the reasons is that the AST writer doesn't write symbolic link header paths in the pcm modules, this makes the listeners on the reader only able to collect the real files. Since the module maps could contain submodules that use headers which are symbolic links, not collecting those forbid the reproducer scripts to regen the modules. For instance: usr/include/module.map: ... module pthread { header "pthread.h" export * module impl { header "pthread_impl.h" export * } } ... usr/include/pthread/pthread_impl.h usr/include/pthread_impl.h -> pthread/pthread_impl.h The AST dump for the module above: <SUBMODULE_HEADER abbrevid=6/> blob data = 'pthread_impl.h' <SUBMODULE_TOPHEADER abbrevid=7/> blob data = '/<path_to_sdk>/usr/include/pthread/pthread_impl.h' Note that we don't have "usr/include/pthread_impl.h" which is requested by the module.map in case we want to reconstruct the module in the reproducer. The reason the original symbolic link path isn't used is because the headers are kept by name and requested through the FileManager, which unique files and returns the real path only. To fix that, add a callback to be invoked everytime a header is added while parsing module maps and hook that up to the module dependecy collector. This callback is only registered when generating the reproducer. Differential Revision: http://reviews.llvm.org/D18585 rdar://problem/24499339 llvm-svn: 264971
* [VFS] Handle empty entries in directory traversalBruno Cardoso Lopes2016-03-301-8/+13
| | | | | | | | | | | | | The VFS YAML files contain empty directory entries to describe that it's returning from a subdirectory before describing new files in the parent. In the future, we should properly sort and write YAML files avoiding such empty dirs and mitigate the extra recurson cost. However, since this is used by previous existing YAMLs, make the traversal work in their presence. rdar://problem/24499339 llvm-svn: 264970
* Fix deduction of __atomic_load's parameter types.Eric Fiselier2016-03-301-10/+13
| | | | | | | | | | | | | | Summary: __atomic_load's allows it's first argument to be a pointer to a const type. However the second argument is an output parameter and must be a pointer to non-const. This patch fixes the signature of __atomic_load generated by clang so that it respects the above requirements. Reviewers: rsmith, majnemer Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D13420 llvm-svn: 264967
* [CUDA] Don't initialize the CUDA toolchain if we don't have any CUDA inputs.Justin Lebar2016-03-301-4/+13
| | | | | | | | | | | | | | | | | | | | Summary: This prevents errors when you invoke clang with a flag that the NVPTX toolchain doesn't support. For example, on x86-64, clang -mthread-model single -x c++ /dev/null -o /dev/null should output just one error about "invalid thread model 'single' in '-mthread-model single' for this target"; x86-64 doesn't support -mthread-model, but we shouldn't also instantiate a NVPTX target! Reviewers: echristo Subscribers: tra, sunfish, cfe-commits Differential Revision: http://reviews.llvm.org/D18629 llvm-svn: 264965
* [CUDA] Make unattributed constexpr functions implicitly host+device.Justin Lebar2016-03-304-3/+58
| | | | | | | | | | | | | | | | | | | | | | | | With this patch, by a constexpr function is implicitly host+device unless: a) it's a variadic function (variadic functions are not allowed on the device side), or b) it's preceeded by a __device__ overload in a system header. The restriction on overloading __host__ __device__ functions on the basis of their CUDA attributes remains in place, but we use (b) to allow us to define __device__ overloads for constexpr functions in cmath, which would otherwise be __host__ __device__ and thus not overloadable. You can disable this behavior with -fno-cuda-host-device-constexpr. Reviewers: tra, rnk, rsmith Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D18380 llvm-svn: 264964
* [CUDA] Add math forward declares to CUDA header wrapper.Justin Lebar2016-03-303-0/+195
| | | | | | | | | | | | | | | | | | Summary: This is necessary for a future patch which will make all constexpr functions implicitly host+device. cmath may declare constexpr functions, but these we do *not* want to be host+device. The forward declares added in this patch prevent this (because the rule will be, constexpr functions become implicitly host+device unless they're preceeded by a decl with __device__). Reviewers: tra Subscribers: cfe-commits, rnk, rsmith Differential Revision: http://reviews.llvm.org/D18539 llvm-svn: 264963
* AMDGPU: Add frexp_mant + frexp_exp builtinsMatt Arsenault2016-03-301-0/+8
| | | | llvm-svn: 264960
* Fix Clang crash with template type diffing.Richard Trieu2016-03-301-3/+8
| | | | | | | | | | Fixes https://llvm.org/bugs/show_bug.cgi?id=27129 which is crash involving type aliases and template type diffing. Template arguments for type aliases and template arguments for the underlying desugared type may not have one-to-one relations, which could mess us the attempt to get more information from the desugared type. For type aliases, ignore the iterator over the desugared type. llvm-svn: 264940
* Canonicalize UnaryTransformType types when they don't have a known ↵Vassil Vassilev2016-03-302-18/+47
| | | | | | | | | | underlying type. Fixes https://llvm.org/bugs/show_bug.cgi?id=26014 Reviewed by Richard Smith. llvm-svn: 264937
OpenPOWER on IntegriCloud