summaryrefslogtreecommitdiffstats
path: root/clang/lib
Commit message (Collapse)AuthorAgeFilesLines
* Teach __builtin_unpredictable to work through implicit casts.Erich Keane2018-12-121-1/+1
| | | | | | | | | The __builtin_unpredictable implementation is confused by any implicit casts, which happen in C++. This patch strips those off so that if/switch statements now work with it in C++. Change-Id: I73c3bf4f1775cd906703880944f4fcdc29fffb0a llvm-svn: 348969
* Change CallGraph print to show the fully qualified nameErich Keane2018-12-121-1/+1
| | | | | | | | | | CallGraph previously would just show the normal name of a function, which gets really confusing when using it on large C++ projects. This patch switches the printName call to a printQualifiedName, so that the namespaces are included. Change-Id: Ie086d863f6b2251be92109ea1b0946825b28b49a llvm-svn: 348950
* [Driver] Add support for -fembed-bitcode for assembly fileSteven Wu2018-12-121-0/+5
| | | | | | | | | | | | | | | | | | Summary: Handle -fembed-bitcode for assembly inputs. When the input file is assembly, write a marker as "__LLVM,__asm" section. Fix llvm.org/pr39659 Reviewers: compnerd, dexonsmith Reviewed By: compnerd Subscribers: rjmccall, dblaikie, jkorous, cfe-commits Differential Revision: https://reviews.llvm.org/D55525 llvm-svn: 348943
* Basic: make `int_least64_t` and `int_fast64_t` match on DarwinSaleem Abdulrasool2018-12-121-0/+9
| | | | | | | | | The Darwin targets use `int64_t` and `uint64_t` to define the `int_least64_t` and `int_fast64_t` types. The underlying type is actually a `long long`. Match the types to allow the printf specifiers to work properly and have the compiler vended macros match the implementation on the target. llvm-svn: 348939
* [ExprConstant] Improve memchr/memcmp for type mismatch and multibyte element ↵Hubert Tong2018-12-121-22/+133
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | types Summary: `memchr` and `memcmp` operate upon the character units of the object representation; that is, the `size_t` parameter expresses the number of character units. The constant folding implementation is updated in this patch to account for multibyte element types in the arrays passed to `memchr`/`memcmp` and, in the case of `memcmp`, to account for the possibility that the arrays may have differing element types (even when they are byte-sized). Actual inspection of the object representation is not implemented. Comparisons are done only between elements with the same object size; that is, `memchr` will fail when inspecting at least one character unit of a multibyte element. The integer types are assumed to have two's complement representation with 0 for `false`, 1 for `true`, and no padding bits. `memcmp` on multibyte elements will only be able to fold in cases where enough elements are equal for the answer to be 0. Various tests are added to guard against incorrect folding for cases that miscompile on some system or other prior to this patch. At the same time, the unsigned 32-bit `wchar_t` testing in `test/SemaCXX/constexpr-string.cpp` is restored. Reviewers: rsmith, aaron.ballman, hfinkel Reviewed By: rsmith Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D55510 llvm-svn: 348938
* [mips] Enable using of integrated assembler in all cases.Simon Atanasyan2018-12-121-10/+1
| | | | llvm-svn: 348935
* Remove TODO leftover from my devleopment branchErich Keane2018-12-121-1/+0
| | | | | | | Accidentially checked in a TODO line from r348899. This removes it. Change-Id: I74b59c0ecfe147af8a08dd7fd10893a4ca351d6d llvm-svn: 348932
* Revert "[OpenCL] Add generic AS to 'this' pointer"Mikael Nilsson2018-12-1232-180/+113
| | | | | | Reverting because the patch broke lldb. llvm-svn: 348931
* [CUDA][OPENMP][NVPTX]Improve logic of the debug info support.Alexey Bataev2018-12-123-26/+58
| | | | | | | | | | | | | | | | | | | | | | Summary: Added support for the -gline-directives-only option + fixed logic of the debug info for CUDA devices. If optimization level is O0, then options --[no-]cuda-noopt-device-debug do not affect the debug info level. If the optimization level is >O0, debug info options are used + --no-cuda-noopt-device-debug is used or no --cuda-noopt-device-debug is used, the optimization level for the device code is kept and the emission of the debug directives is used. If the opt level is > O0, debug info is requested + --cuda-noopt-device-debug option is used, the optimization is disabled for the device code + required debug info is emitted. Reviewers: tra, echristo Subscribers: aprantl, guansong, JDevlieghere, cfe-commits Differential Revision: https://reviews.llvm.org/D51554 llvm-svn: 348930
* [OpenCL] Add generic AS to 'this' pointerMikael Nilsson2018-12-1232-113/+180
| | | | | | | | | | Address spaces are cast into generic before invoking the constructor. Added support for a trailing Qualifiers object in FunctionProtoType. Differential Revision: https://reviews.llvm.org/D54862 llvm-svn: 348927
* [ASTImporter] Remove import of definition from GetAlreadyImportedOrNullGabor Marton2018-12-121-10/+8
| | | | | | | | | | | | Summary: a_sidorin Reviewers: a.sidorin Subscribers: rnkovacs, dkrupp, Szelethus, cfe-commits Differential Revision: https://reviews.llvm.org/D53755 llvm-svn: 348923
* [OpenCL] Fix for TBAA information of pointer after addresspacecastAndrew Savonichev2018-12-121-2/+3
| | | | | | | | | | | | | | Summary: When addresspacecast is generated resulting pointer should preserve TBAA information from original value. Reviewers: rjmccall, yaxunl, Anastasia Reviewed By: rjmccall Subscribers: asavonic, kosarev, cfe-commits, llvm-commits Differential Revision: https://reviews.llvm.org/D55262 llvm-svn: 348919
* Add explicit dependency on clangSerialization for a bunch of components to ↵Fangrui Song2018-12-121-0/+1
| | | | | | | | | | | | | | | fix -DBUILD_SHARED_LIBS=on build This is a more thorough fix of rC348911. The story about -DBUILD_SHARED_LIBS=on build after rC348907 (Move PCHContainerOperations from Frontend to Serialization) is: 1. libclangSerialization.so defines PCHContainerReader dtor, ... 2. clangFrontend and clangTooling define classes inheriting from PCHContainerReader, thus their DSOs have undefined references on PCHContainerReader dtor 3. Components depending on either clangFrontend or clangTooling cannot be linked unless they have explicit dependency on clangSerialization due to the default linker option -z defs. The explicit dependency could be avoided if libclang{Frontend,Tooling}.so had these undefined references. This patch adds the explicit dependency on clangSerialization to make them build. llvm-svn: 348915
* [CodeGen] Fix -DBUILD_SHARED_LIBS=on build after rC348907Fangrui Song2018-12-121-0/+1
| | | | llvm-svn: 348911
* Move PCHContainerOperations from Frontend to SerializationRichard Trieu2018-12-127-7/+7
| | | | | | | Fix a layering violation. Frontend depends on Serialization, so anything used by both should be in Serialization. llvm-svn: 348907
* Replace Const-Member checking with non-recursive version.Erich Keane2018-12-112-27/+45
| | | | | | | | | | | | | | As reported in PR39946, these two implementations cause stack overflows to occur when a type recursively contains itself. While this only happens when an incomplete version of itself is used by membership (and thus an otherwise invalid program), the crashes might be surprising. The solution here is to replace the recursive implementation with one that uses a std::vector as a queue. Old values are kept around to prevent re-checking already checked types. Change-Id: I582bb27147104763d7daefcfee39d91f408b9fa8 llvm-svn: 348899
* Revert r348889; it fails some tests.Aaron Ballman2018-12-111-22/+4
| | | | | | http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/40784 llvm-svn: 348892
* Emit -Wformat properly for bit-field promotions.Aaron Ballman2018-12-111-4/+22
| | | | | | Only explicitly look through integer and floating-point promotion where the result type is actually a promotion, which is not always the case for bit-fields in C. llvm-svn: 348889
* [analyzer][CStringChecker] evaluate explicit_bzeroDavid Carlier2018-12-111-5/+55
| | | | | | | | | | | | | - explicit_bzero has limited scope/usage only for security/crypto purposes but is non-optimisable version of memset/0 and bzero. - explicit_memset has similar signature and semantics as memset but is also a non-optimisable version. Reviewers: NoQ Reviewed By: NoQ Differential Revision: https://reviews.llvm.org/D54592 llvm-svn: 348884
* Remove CGDebugInfo::getOrCreateFile() and use TheCU->getFile() directly.Adrian Prantl2018-12-112-26/+16
| | | | llvm-svn: 348866
* Reuse code from CGDebugInfo::getOrCreateFile() when creating the fileAdrian Prantl2018-12-112-9/+17
| | | | | | | | | | | | | for the DICompileUnit. This addresses post-commit feedback for D55085. Without this patch, a main source file with an absolute paths may appear in different DIFiles, once with the absolute path and once with the common prefix between the absolute path and the current working directory. Differential Revision: https://reviews.llvm.org/D55519 llvm-svn: 348865
* Pass PartialOverloading argument to the correct corresponding parameterEric Fiselier2018-12-111-5/+7
| | | | llvm-svn: 348864
* Revert "[PowerPC] Make no-PIC default to match GCC - CLANG"Stefan Pintilie2018-12-111-1/+1
| | | | | | This reverts commit rL348299. llvm-svn: 348858
* Reland r348741 "[Sema] Further improvements to to static_assert diagnostics."Clement Courbet2018-12-112-34/+40
| | | | | | Fix a dangling reference to temporary, never return nullptr. llvm-svn: 348834
* Revert r348830 "[Sema]improve static_assert(!expr)"Clement Courbet2018-12-111-14/+0
| | | | | | Submitted the wrong change. llvm-svn: 348831
* [Sema]improve static_assert(!expr)Clement Courbet2018-12-111-0/+14
| | | | llvm-svn: 348830
* Move CodeGenOptions from Frontend to BasicRichard Trieu2018-12-1129-29/+26
| | | | | | Basic uses CodeGenOptions and should not depend on Frontend. llvm-svn: 348827
* [analyzer] Remove memoization from RunLoopAutoreleaseLeakCheckerGeorge Karpenkov2018-12-111-26/+8
| | | | | | | | | | | | | Memoization dose not seem to be necessary, as other statement visitors run just fine without it, and in fact seems to be causing memory corruptions. Just removing it instead of investigating the root cause. rdar://45945002 Differential Revision: https://reviews.llvm.org/D54921 llvm-svn: 348822
* [analyzer] Hack for backwards compatibility for options for RetainCountChecker.George Karpenkov2018-12-111-1/+13
| | | | | | To be removed once the clients update. llvm-svn: 348821
* [analyzer] Display a diagnostics when an inlined function violates its ↵George Karpenkov2018-12-111-12/+93
| | | | | | | | | | | | | os_consumed summary This is currently a diagnostics, but might be upgraded to an error in the future, especially if we introduce os_return_on_success attributes. rdar://46359592 Differential Revision: https://reviews.llvm.org/D55530 llvm-svn: 348820
* [analyzer] Resolve another bug where the name of the leaked object was not ↵George Karpenkov2018-12-111-3/+3
| | | | | | | | printed properly Differential Revision: https://reviews.llvm.org/D55528 llvm-svn: 348819
* Revert "Change InitListExpr dump to label and pointer"Stephen Kelly2018-12-101-5/+4
| | | | | | This reverts commit r348794. llvm-svn: 348799
* Fix nitsStephen Kelly2018-12-101-8/+7
| | | | llvm-svn: 348798
* Re-order content of template parameter dumpsStephen Kelly2018-12-101-17/+26
| | | | | | | | | | Reviewers: aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D55393 llvm-svn: 348797
* Re-order content in OMPDeclareReductionDecl dumpStephen Kelly2018-12-101-3/+7
| | | | | | | | | | Reviewers: aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D55395 llvm-svn: 348795
* Change InitListExpr dump to label and pointerStephen Kelly2018-12-101-4/+5
| | | | | | | | | | | | Summary: Don't add a child just for the label. Reviewers: aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D55495 llvm-svn: 348794
* [constexpr][c++2a] Try-catch blocks in constexpr functionsBruno Cardoso Lopes2018-12-102-14/+52
| | | | | | | | | | | | | | | | | | | | | | Implement support for try-catch blocks in constexpr functions, as proposed in http://wg21.link/P1002 and voted in San Diego for c++20. The idea is that we can still never throw inside constexpr, so the catch block is never entered. A try-catch block like this: try { f(); } catch (...) { } is then morally equivalent to just { f(); } Same idea should apply for function/constructor try blocks. rdar://problem/45530773 Differential Revision: https://reviews.llvm.org/D55097 llvm-svn: 348789
* ComputeLineNumbers: delete SSE2 vectorizationFangrui Song2018-12-101-56/+13
| | | | | | | | | | | | | | | | | | | | | | | Summary: SSE2 vectorization was added in 2012, but it is 2018 now and I can't observe any performance boost (testing clang -E [all Sema/* CodeGen/* with proper -I options]) with the existing _mm_movemask_epi8+countTrailingZeros or the following SSE4.2 (compiling with -msse4.2): __m128i C = _mm_setr_epi8('\r','\n',0,0,0,0,0,0,0,0,0,0,0,0,0,0); _mm_cmpestri(C, 2, Chunk, 16, _SIDD_UBYTE_OPS | _SIDD_CMP_EQUAL_ANY | _SIDD_POSITIVE_POLARITY | _SIDD_LEAST_SIGNIFICANT) Delete the vectorization to simplify the code. Also simplify the code a bit and don't check the line ending sequence \n\r Reviewers: bkramer, #clang Reviewed By: bkramer Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D55484 llvm-svn: 348777
* Use zip_longest for iterator range comparisons. NFC.Michael Kruse2018-12-102-20/+28
| | | | | | | | | | | | | | | | | | | Use zip_longest in two locations that compare iterator ranges. zip_longest allows the iteration using a range-based for-loop and to be symmetric over both ranges instead of prioritizing one over the other. In that latter case code have to handle the case that the first is longer than the second, the second is longer than the first, and both are of the same length, which must partially be checked after the loop. With zip_longest, this becomes an element comparison within the loop like the comparison of the elements themselves. The symmetry makes it clearer that neither the first and second iterators are handled differently. The iterators are not event used directly anymore, just the ranges. Differential Revision: https://reviews.llvm.org/D55468 llvm-svn: 348762
* Misc typos fixes in ./lib folderRaphael Isemann2018-12-1052-81/+81
| | | | | | | | | | | | | | Summary: Found via `codespell -q 3 -I ../clang-whitelist.txt -L uint,importd,crasher,gonna,cant,ue,ons,orign,ned` Reviewers: teemperor Reviewed By: teemperor Subscribers: teemperor, jholewinski, jvesely, nhaehnle, whisperity, jfb, cfe-commits Differential Revision: https://reviews.llvm.org/D55475 llvm-svn: 348755
* [OpenCL][CodeGen] Fix replacing memcpy with addrspacecastAndrew Savonichev2018-12-101-4/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: If a function argument is byval and RV is located in default or alloca address space an optimization of creating addrspacecast instead of memcpy is performed. That is not correct for OpenCL, where that can lead to a situation of address space casting from __private * to __global *. See an example below: ``` typedef struct { int x; } MyStruct; void foo(MyStruct val) {} kernel void KernelOneMember(__global MyStruct* x) { foo (*x); } ``` for this code clang generated following IR: ... %0 = load %struct.MyStruct addrspace(1)*, %struct.MyStruct addrspace(1)** %x.addr, align 4 %1 = addrspacecast %struct.MyStruct addrspace(1)* %0 to %struct.MyStruct* ... So the optimization was disallowed for OpenCL if RV is located in an address space different than that of the argument (0). Reviewers: yaxunl, Anastasia Reviewed By: Anastasia Subscribers: cfe-commits, asavonic Differential Revision: https://reviews.llvm.org/D54947 llvm-svn: 348752
* Revert r348741 "[Sema] Further improvements to to static_assert diagnostics."Clement Courbet2018-12-102-42/+38
| | | | | | Seems to break build bots. llvm-svn: 348742
* [Sema] Further improvements to to static_assert diagnostics.Clement Courbet2018-12-102-38/+42
| | | | | | | | | | | | | | Summary: We're now handling cases like `static_assert(!expr)` and static_assert(!(expr))`. Reviewers: aaron.ballman, Quuxplusone Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D55270 llvm-svn: 348741
* [X86] Remove the addcarry builtins. Leaving only the addcarryx builtins ↵Craig Topper2018-12-102-14/+6
| | | | | | | | | | since that matches gcc. The addcarry and addcarryx builtins do the same thing. The only difference is that addcarryx previously required adx feature. This commit removes the adx feature check from addcarryx and removes the addcarry builtin. This matches the builtins that gcc has. We don't guarantee compatibility in builtins, but we generally try to be consistent if its not a burden. llvm-svn: 348738
* NFC: Rename TemplateDecl dump utilitiesStephen Kelly2018-12-091-18/+17
| | | | | | | | | | There is a clang::TemplateDecl AST type, so a method called VisitTemplateDecl looks like it should 'override' the method from the base visitor, but it does not because of the extra parameters it takes. In reality, these methods are utilities, so name them like utilities. llvm-svn: 348720
* NFC: Move dump of individual comment nodes to NodeDumperStephen Kelly2018-12-092-154/+148
| | | | | | | | | | Reviewers: aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D55190 llvm-svn: 348719
* Revert "Introduce optional labels to dumpStmt"Stephen Kelly2018-12-091-15/+6
| | | | | | This reverts commit 933402caa09963792058198578522a95f013c69c. llvm-svn: 348718
* Introduce optional labels to dumpStmtStephen Kelly2018-12-091-6/+15
| | | | | | | | If the label is present, it is added as a child, with the statement a child of the label. This preserves behavior of the InitListExpr dump output. llvm-svn: 348717
* Inline hasNodes into only callerStephen Kelly2018-12-091-13/+8
| | | | | | It is easier to refactor with fewer utility methods. llvm-svn: 348716
* Inline dumpFullComment into callersStephen Kelly2018-12-091-10/+7
| | | | | | | It causes confusion over whether it or dumpComment is the more important. It is easier to refactor with fewer utility methods. llvm-svn: 348715
OpenPOWER on IntegriCloud