summaryrefslogtreecommitdiffstats
path: root/clang/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* [analyzer] When we fail to evaluate a pointer cast, escape the pointer.Artem Dergachev2018-04-192-34/+24
| | | | | | | | | | | | | | If a pointer cast fails (evaluates to an UnknownVal, i.e. not implemented in the analyzer) and such cast is in fact the last use of the pointer, the pointer symbol is no longer referenced by the program state and a leak is (mis-)diagnosed. "Escape" the pointer upon a failed cast, i.e. inform the checker that we can no longer reliably track it. Differential Revision: https://reviews.llvm.org/D45698 llvm-svn: 330380
* Implement proper support for `-falign-functions`Saleem Abdulrasool2018-04-195-0/+51
| | | | | | | | | | | | | | | | This implements support for the previously ignored flag `-falign-functions`. This allows the frontend to request alignment on function definitions in the translation unit where they are not explicitly requested in code. This is compatible with the GCC behaviour and the ICC behaviour. The scalar value passed to `-falign-functions` aligns functions to a power-of-two boundary. If flag is used, the functions are aligned to 16-byte boundaries. If the scalar is specified, it must be an integer less than or equal to 4096. If the value is not a power-of-two, the driver will round it up to the nearest power of two. llvm-svn: 330378
* [CFG] [analyzer] Don't treat argument constructors as temporary constructors.Artem Dergachev2018-04-192-0/+13
| | | | | | | | | | | | | | Function argument constructors (that are used for passing objects into functions by value) are completely unlike temporary object constructors, but we were treating them as such because they are also wrapped into a CXXBindTemporaryExpr. This patch adds a partial construction context layer for call argument values, but doesn't proceed to transform it into an actual construction context yet. This is tells the clients that we aren't supporting these constructors yet. Differential Revision: https://reviews.llvm.org/D45650 llvm-svn: 330377
* [analyzer] RetainCount: Accept more "safe" CFRetain wrappers.Artem Dergachev2018-04-191-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | r315736 added support for the misplaced CF_RETURNS_RETAINED annotation on CFRetain() wrappers. It works by trusting the function's name (seeing if it confirms to the CoreFoundation naming convention) rather than the annotation. There are more false positives caused by users using a different naming convention, namely starting the function name with "retain" or "release" rather than suffixing it with "retain" or "release" respectively. Because this isn't according to the naming convention, these functions are usually inlined and the annotation is therefore ignored, which is correct. But sometimes we run out of inlining stack depth and the function is evaluated conservatively and then the annotation is trusted. Add support for the "alternative" naming convention and test the situation when we're running out of inlining stack depth. rdar://problem/18270122 Differential Revision: https://reviews.llvm.org/D45117 llvm-svn: 330375
* [CXX] Templates specialization visibility can be wrongSteven Wu2018-04-191-3/+12
| | | | | | | | | | | | | | | | | | | | | Summary: Under some conditions, LinkageComputer can get the visibility for ClassTemplateSpecializationDecl wrong because it failed to find the Decl that has the explicit visibility. This fixes: llvm.org/bugs/pr36810 rdar://problem/38080953 Reviewers: rsmith, arphaman, doug.gregor Reviewed By: doug.gregor Subscribers: doug.gregor, cfe-commits Differential Revision: https://reviews.llvm.org/D44670 llvm-svn: 330338
* Fix __attribute__((force_align_arg_pointer)) misalignment bugErich Keane2018-04-191-20/+5
| | | | | | | | | | | | | | | | The force_align_arg_pointer attribute was using a hardcoded 16-byte alignment value which in combination with -mstack-alignment=32 (or larger) would produce a misaligned stack which could result in crashes when accessing stack buffers using aligned AVX load/store instructions. Fix the issue by using the "stackrealign" function attribute instead of using a hardcoded 16-byte alignment. Patch By: Gramner Differential Revision: https://reviews.llvm.org/D45812 llvm-svn: 330331
* [clang-format] Don't remove empty lines before namespace endingsKrasimir Georgiev2018-04-194-11/+24
| | | | | | | | | | | | | | Summary: This implements an alternative to r327861, namely preserving empty lines before namespace endings. Reviewers: djasper Reviewed By: djasper Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D45373 llvm-svn: 330324
* Lowering x86 adds/addus/subs/subus intrinsics (clang)Alexander Ivchenko2018-04-191-1/+98
| | | | | | | | | | | This is the patch that lowers x86 intrinsics to native IR in order to enable optimizations. Patch by tkrupa Differential Revision: https://reviews.llvm.org/D44786 llvm-svn: 330323
* OpenBSD add C++ runtime in a driver's standpointDean Michael Berris2018-04-192-0/+10
| | | | | | | | | | | | | | Summary: - Since 6.2 release, on supporters platforms clang is shipped with both libcxx and libcxxabi. Reviewers: dberris, alekseyshl, EricWF Reviewed By: dberris Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D45662 llvm-svn: 330310
* [CodeGen] Do not push a destructor cleanup for a struct that doesn'tAkira Hatanaka2018-04-181-2/+9
| | | | | | | | | | | | | | | have a non-trivial destructor. This fixes a bug introduced in r328731 where CodeGen emits calls to synthesized destructors for non-trivial C structs in C++ mode when the struct passed to EmitCallArg doesn't have a non-trivial destructor. Under Microsoft's ABI, ASTContext::isParamDestroyedInCallee currently always returns true, so it's necessary to check whether the struct has a non-trivial destructor before pushing a cleanup in EmitCallArg. This fixes PR37146. llvm-svn: 330304
* [MS] Fix unprototyped thunk emission for incomplete return typesReid Kleckner2018-04-181-5/+9
| | | | | | Fixes PR37161 llvm-svn: 330303
* [NVPTX, CUDA] Added support for m8n32k16 and m32n8k16 variants of wmma ↵Artem Belevich2018-04-182-26/+146
| | | | | | | | | | instructions. The new instructions were added added for sm_70+ GPUs in CUDA-9.1. Differential Revision: https://reviews.llvm.org/D45068 llvm-svn: 330296
* [OPENMP] Fix -Wunused-lambda-capture. NFCFangrui Song2018-04-181-0/+1
| | | | llvm-svn: 330284
* [CUDA] added missing __ldg(const signed char *)Artem Belevich2018-04-181-0/+3
| | | | | | Differential Revision: https://reviews.llvm.org/D45780 llvm-svn: 330280
* [HIP] Add driver input type for HIPYaxun Liu2018-04-182-6/+19
| | | | | | | | | Patch by Greg Rodgers. Revised by Yaxun Liu. Differential Revision: https://reviews.llvm.org/D45489 llvm-svn: 330279
* [MinGW] Try to fix asan testing after r330244Martin Storsjo2018-04-181-6/+5
| | | | | | Twines shouldn't be stored as they can refer to temporaries. llvm-svn: 330277
* [NVPTX] Emit debug info in DWARF-2 by default for Cuda devices.Alexey Bataev2018-04-182-3/+38
| | | | | | | | | | | | | | Summary: NVPTX target supports debug info in DWARF-2 format. Patch adds emission of debug info in DWARF-2 by default. Reviewers: tra, jlebar Subscribers: aprantl, JDevlieghere, cfe-commits Differential Revision: https://reviews.llvm.org/D42581 llvm-svn: 330272
* [OPENMP] Code cleanup and code improvements.Alexey Bataev2018-04-184-1005/+1006
| | | | llvm-svn: 330270
* [Sema] Disable built-in increment operator for bool in overload resolution ↵Jan Korous2018-04-181-5/+11
| | | | | | | | | | | | | | | | | in C++17 Following: https://llvm.org/svn/llvm-project/cfe/trunk@329804 For C++17 the wording of [over.built] p4 excluded bool: For every pair (T , vq), where T is an arithmetic type other than bool, there exist candidate operator functions of the form vq T & operator++(vq T &); T operator++(vq T &, int); Differential Revision: https://reviews.llvm.org/D45569 llvm-svn: 330254
* [MinGW] Look for a cross sysroot relative to the clang binaryMartin Storsjo2018-04-182-1/+25
| | | | | | | | | If found, prefer this over looking for a similar gcc later in the system path. Differential Revision: https://reviews.llvm.org/D45504 llvm-svn: 330244
* [Modules] Turn on system header validation for implicit modulesBruno Cardoso Lopes2018-04-181-1/+7
| | | | | | | | | | After r300027 implicit builds might fail when updating the SDK on darwin. Make validation of system headers default when implicit modules is on and allow modules to be rebuild when system headers change. rdar://problem/19767523 llvm-svn: 330240
* [AAch64] Add the __ARM_FEATURE_DOTPROD macro definitionJunmo Park2018-04-172-0/+7
| | | | | | | | | This matches what GCC does. https://github.com/gcc-mirror/gcc/blob/master/gcc/config/aarch64/aarch64-c.c Differential Revision: https://reviews.llvm.org/D45544 llvm-svn: 330229
* Add Microsoft mangling for _Float16Erich Keane2018-04-171-0/+3
| | | | | | | | | | | | Enables _Float16 on Windows by creating a mangling mechanism in MicrosoftMangle. It accomplishes this by mangling as a structure type of __clang::_Float16, similar to how Complex works. Patch By: mibintc Differential Revision: https://reviews.llvm.org/D45738 llvm-svn: 330225
* [XRay] Add clang builtin for xray typed events.Keith Wyss2018-04-176-1/+65
| | | | | | | | | | | | | | | | | | | Summary: A clang builtin for xray typed events. Differs from __xray_customevent(...) by the presence of a type tag that is vended by compiler-rt in typical usage. This allows xray handlers to expand logged events with their type description and plugins to process traced events based on type. This change depends on D45633 for the intrinsic definition. Reviewers: dberris, pelikan, rnk, eizan Subscribers: cfe-commits, llvm-commits Differential Revision: https://reviews.llvm.org/D45716 llvm-svn: 330220
* [Driver] Use the per-API level Android library directories.Dan Albert2018-04-171-0/+16
| | | | | | | | | | | | | | | | Summary: Android sysroots contain libraries for each OS version, as well as a handful of unversioned libraries in the typical multiarch directory. Reviewers: srhines, eugenis, george.burgess.iv Reviewed By: eugenis Subscribers: javed.absar, cfe-commits Differential Revision: https://reviews.llvm.org/D45290 llvm-svn: 330213
* Remove unused variableTeresa Johnson2018-04-171-1/+1
| | | | | | Fixes unused variable error introduced in r330194. llvm-svn: 330210
* [Sema] Warn about memcpy'ing non-trivial C structs.Akira Hatanaka2018-04-171-1/+110
| | | | | | | | | | | Issue a warning when non-trivial C structs are copied or initialized by calls to memset, bzero, memcpy, or memmove. rdar://problem/36124208 Differential Revision: https://reviews.llvm.org/D45310 llvm-svn: 330202
* Move the visitor classes that are used to traverse non-trivial C structsAkira Hatanaka2018-04-171-118/+89
| | | | | | | | | | | | | | to a header file. This is in preparation for using the visitor classes to warn about memcpy'ing non-trivial C structs. See the discussion here: https://reviews.llvm.org/D45310 rdar://problem/36124208 llvm-svn: 330201
* Add a command line option 'fregister_global_dtors_with_atexit' toAkira Hatanaka2018-04-177-0/+75
| | | | | | | | | | | | | | | | | | | | | register destructor functions annotated with __attribute__((destructor)) using __cxa_atexit or atexit. Register destructor functions annotated with __attribute__((destructor)) calling __cxa_atexit in a synthesized constructor function instead of emitting references to the functions in a special section. The primary reason for adding this option is that we are planning to deprecate the __mod_term_funcs section on Darwin in the future. This feature is enabled by default only on Darwin. Users who do not want this can use command line option 'fno_register_global_dtors_with_atexit' to disable it. rdar://problem/33887655 Differential Revision: https://reviews.llvm.org/D45578 llvm-svn: 330199
* [ThinLTO] Pass -save-temps to LTO backend for distributed ThinLTO buildsTeresa Johnson2018-04-174-4/+38
| | | | | | | | | | | | | | | | | | | | | | | Summary: The clang driver option -save-temps was not passed to the LTO config, so when invoking the ThinLTO backends via clang during distributed builds there was no way to get LTO to save temp files. Getting this to work with ThinLTO distributed builds also required changing the driver to avoid a separate compile step to emit unoptimized bitcode when the input was already bitcode under -save-temps. Not only is this unnecessary in general, it is problematic for ThinLTO backends since the temporary bitcode file to the backend would not match the module path in the combined index, leading to incorrect ThinLTO backend index-based optimizations. Reviewers: pcc Subscribers: mehdi_amini, inglorion, eraman, cfe-commits Differential Revision: https://reviews.llvm.org/D45217 llvm-svn: 330194
* Add modifiers for unsigned char and signed char field printing for ↵Aaron Ballman2018-04-171-0/+2
| | | | | | | | __builtin_dump_struct. Patch by Paul Semel. llvm-svn: 330188
* Add checks for format specifiers used by __builtin_dump_struct and added a ↵Aaron Ballman2018-04-171-0/+1
| | | | | | | | new specifier for null-terminated constant strings. Patch by Paul Semel. llvm-svn: 330185
* [ARM] Compute a target feature which corresponds to the ARM version.Eli Friedman2018-04-161-0/+11
| | | | | | | | | | | | | | | | Currently, the interaction between the triple, the CPU, and the supported features is a mess: the driver edits the triple to indicate the supported architecture version, and the LLVM backend uses this to figure out what instructions are legal. This makes it difficult to understand what's happening, and makes it impossible to LTO together two modules with different computed architectures. Instead of relying on triple rewriting to get the correct target features, we should add the right target features explicitly. Differential Revision: https://reviews.llvm.org/D45240 llvm-svn: 330169
* [Availability] Improve availability to consider functions run at load timeSteven Wu2018-04-163-0/+32
| | | | | | | | | | | | | | | | | | | | | | Summary: There are some functions/methods that run when the application launches or the library loads. Those functions will run reguardless the OS version as long as it satifies the minimum deployment target. Annotate them with availability attributes doesn't really make sense because they are essentially available on all targets since minimum deployment target. rdar://problem/36093384 Reviewers: arphaman, erik.pilkington Reviewed By: erik.pilkington Subscribers: erik.pilkington, cfe-commits Differential Revision: https://reviews.llvm.org/D45699 llvm-svn: 330166
* Limit types of builtins that can be redeclared.Erich Keane2018-04-164-0/+26
| | | | | | | | | | | | | | | | | | As reported here: https://bugs.llvm.org/show_bug.cgi?id=37033 Any usage of a builtin function that uses a va_list by reference will cause an assertion when redeclaring it. After discussion in the review, it was concluded that the correct way of accomplishing this fix is to make attempts to redeclare certain builtins an error. Unfortunately, doing this limitation for all builtins is likely a breaking change, so this commit simply limits it to types with custom type checking and those that take a reference. Two tests needed to be updated to make this work. Differential Revision: https://reviews.llvm.org/D45383 llvm-svn: 330160
* Defer adding keywords to the identifier table until after the language ↵Aaron Ballman2018-04-162-12/+20
| | | | | | | | | | options have been loaded from the AST file. This fixes issues with "class" being reported as an identifier in "enum class" because the construct is not present when using default language options. Patch by Johann Klähn. llvm-svn: 330159
* [OPENMP] Allow to use declare target variables in map clausesAlexey Bataev2018-04-161-10/+7
| | | | | | | | Global variables marked as declare target are allowed to be used in map clauses. Patch fixes the crash of the compiler on the declare target variables in map clauses. llvm-svn: 330156
* [CodeGen] Fix a crash that occurs when a non-trivial C struct with aAkira Hatanaka2018-04-161-15/+25
| | | | | | | | | | | | | | volatile array field is copied. The crash occurs because method 'visitArray' passes a null FieldDecl to method 'visit' and some of the methods called downstream expect a non-null FieldDecl to be passed. This reapplies r330151 with a fix to the test case. rdar://problem/33599681 llvm-svn: 330155
* [OPENMP] General code improvements.Alexey Bataev2018-04-162-133/+137
| | | | llvm-svn: 330154
* Revert "[CodeGen] Fix a crash that occurs when a non-trivial C struct with a"Akira Hatanaka2018-04-161-25/+15
| | | | | | This reverts commit r330151, which caused bots to fail. llvm-svn: 330153
* Use export_as for autolinking frameworksBruno Cardoso Lopes2018-04-164-0/+34
| | | | | | | | | | | | | | | | framework module SomeKitCore { ... export_as SomeKit } Given the module above, while generting autolink information during codegen, clang should to emit '-framework SomeKitCore' only if SomeKit was not imported in the relevant TU, otherwise it should use '-framework SomeKit' instead. rdar://problem/38269782 llvm-svn: 330152
* [CodeGen] Fix a crash that occurs when a non-trivial C struct with aAkira Hatanaka2018-04-161-15/+25
| | | | | | | | | | | | volatile array field is copied. The crash occurs because method 'visitArray' passes a null FieldDecl to method 'visit' and some of the methods called downstream expect a non-null FieldDecl to be passed. rdar://problem/33599681 llvm-svn: 330151
* [Hexagon] Emit a warning when -fvectorize is given without -mhvxKrzysztof Parzyszek2018-04-162-7/+15
| | | | llvm-svn: 330150
* [OPENMP] General code improvements.Alexey Bataev2018-04-162-718/+861
| | | | llvm-svn: 330140
* [CodeView] Initial support for emitting S_THUNK32 symbols for compiler...Brock Wyma2018-04-163-3/+10
| | | | | | | | | | | When emitting CodeView debug information, compiler-generated thunk routines should be emitted using S_THUNK32 symbols instead of S_GPROC32_ID symbols so Visual Studio can properly step into the user code. This initial support only handles standard thunk ordinals. Differential Revision: https://reviews.llvm.org/D43838 llvm-svn: 330132
* [mips] Prevent PIC to be set to level 2Aleksandar Beserminji2018-04-161-6/+11
| | | | | | | | | | MIPS does not use PIC level 2 for historical reasons, even with -fPIC/-mxgot/multigot options. This patch prevents PIC to be set to level 2 for MIPS. Differential Revision: https://reviews.llvm.org/D44381 llvm-svn: 330118
* Clean carriage returns from lib/ and include/. NFC.Malcolm Parsons2018-04-168-445/+445
| | | | | | | | | | | | | | | | | | | | | | | | Summary: Clean carriage returns from lib/ and include/. NFC. (I have to make this change locally in order for `git diff` to show sane output after I edit a file, so I might as well ask for it to be committed. I don't have commit privs myself.) (Without this patch, `git rebase`ing any change involving SemaDeclCXX.cpp is a real nightmare. :( So while I have no right to ask for this to be committed, geez would it make my workflow easier if it were.) Here's the command I used to reformat things. (Requires bash and OSX/FreeBSD sed.) git grep -l $'\r' lib include | xargs sed -i -e $'s/\r//' find lib include -name '*-e' -delete Reviewers: malcolm.parsons Reviewed By: malcolm.parsons Subscribers: emaste, krytarowski, cfe-commits Differential Revision: https://reviews.llvm.org/D45591 Patch by Arthur O'Dwyer. llvm-svn: 330112
* [X86] Introduce archs: goldmont-plus & tremontGabor Buella2018-04-161-0/+14
| | | | | | | | | | | | Reviewers: craig.topper Reviewed By: craig.topper Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D45613 llvm-svn: 330110
* [analyzer] Do not invalidate the `this` pointer.Henry Wong2018-04-152-0/+15
| | | | | | | | | | | | | | | | | Summary: `this` pointer is not an l-value, although we have modeled `CXXThisRegion` for `this` pointer, we can only bind it once, which is when we start to inline method. And this patch fixes https://bugs.llvm.org/show_bug.cgi?id=35506. In addition, I didn't find any other cases other than loop-widen that could invalidate `this` pointer. Reviewers: NoQ, george.karpenkov, a.sidorin, seaneveson, szepet Reviewed By: NoQ Subscribers: xazax.hun, rnkovacs, cfe-commits, MTC Differential Revision: https://reviews.llvm.org/D45491 llvm-svn: 330095
* Revert "[Serialization] Fix some Clang-tidy modernize and Include What You ↵Vedant Kumar2018-04-141-265/+317
| | | | | | | | | | | | | Use warnings; other minor fixes (NFC)." This reverts commit r330068. It breaks the lldb bots due to assertion failures (more details on cfe-commits). http://lab.llvm.org:8080/green/view/LLDB/job/lldb-cmake/ http://lab.llvm.org:8080/green/view/LLDB/job/lldb-cmake/6341/ stderr: Assertion failed: (M && "imported decl from no module file"), function loadPendingDeclChain, file /Users/vsk/src/llvm.org-lldbsan/llvm/tools/clang/lib/Serialization/ASTReaderDecl.cpp, line 3861. llvm-svn: 330080
OpenPOWER on IntegriCloud