summaryrefslogtreecommitdiffstats
path: root/clang/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* [CodeComplete] Fix assertion failureIlya Biryukov2018-12-071-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: ...that fires when running completion inside an argument of UnresolvedMemberExpr (see the added test). The assertion that fires is from Sema::TryObjectArgumentInitialization: assert(FromClassification.isLValue()); This happens because Sema::AddFunctionCandidates does not account for object types which are pointers. It ends up classifying them incorrectly. All usages of the function outside code completion are used to run overload resolution for operators. In those cases the object type being passed is always a non-pointer type, so it's not surprising the function did not expect a pointer in the object argument. However, code completion reuses the same function and calls it with the object argument coming from UnresolvedMemberExpr, which can be a pointer if the member expr is an arrow ('->') access. Extending AddFunctionCandidates to allow pointer object types does not seem too crazy since all the functions down the call chain can properly handle pointer object types if we properly classify the object argument as an l-value, i.e. the classification of the implicitly dereferenced pointer. Reviewers: kadircet Reviewed By: kadircet Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D55331 llvm-svn: 348590
* [CTU] Add asserts to protect invariantsGabor Marton2018-12-071-0/+3
| | | | | | | | | | Reviewers: xazax.hun, a_sidorin Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits Differential Revision: https://reviews.llvm.org/D55132 llvm-svn: 348586
* [CTU] Add statisticsGabor Marton2018-12-071-1/+15
| | | | | | | | | | Reviewers: xazax.hun, a_sidorin Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits Differential Revision: https://reviews.llvm.org/D55133 llvm-svn: 348584
* [PowerPC] VSX register support for inline assemblyKang Zhang2018-12-072-0/+32
| | | | | | | | | | | | Summary: The patch is to add the VSX register support for inline assembly. After this patch, we can use VSX register in inline assembly clobber list without error. Reviewed By: jsji, nemanjai Differential Revision: https://reviews.llvm.org/D55192 llvm-svn: 348572
* Fix thunks returning memptrs via sret by emitting also scalar return values ↵Hans Wennborg2018-12-072-5/+3
| | | | | | | | | | | | | | | | | | | directly in sret slot (PR39901) Thunks that return member pointers via sret are broken due to using temporary storage for the return value on the stack and then passing that pointer to a tail call, violating the rule that a tail call can't access allocas in the caller (see bug). Since r90526, we put aggregate return values directly in the sret slot, but this doesn't apply to member pointers which are considered scalar. Unless I'm missing something subtle, we should be able to always use the sret slot directly for indirect return values. Differential revision: https://reviews.llvm.org/D55371 llvm-svn: 348569
* NFC: Move VisitExpr code to dumpStmtStephen Kelly2018-12-061-89/+38
| | | | | | | | | | | | | | | | Summary: The call is duplicated in the handlers of all Expr subclasses. This change makes it easy to split statement handling out to TextNodeDumper. Reviewers: aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D55339 llvm-svn: 348546
* NFC: Move VisitStmt code to dumpStmtStephen Kelly2018-12-061-23/+6
| | | | | | | | | | | | Summary: This call is duplicated in Visits of all direct subclasses of Stmt. Reviewers: aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D55338 llvm-svn: 348545
* [frontend][darwin] warn_stdlibcxx_not_found: supress warning for ↵Alex Lorenz2018-12-061-1/+7
| | | | | | | | preprocessed input Addresses second post-commit feedback for r335081 from Nico llvm-svn: 348540
* [analyzer] Rely on os_consumes_this attribute to signify that the method ↵George Karpenkov2018-12-061-0/+3
| | | | | | | | call consumes a reference for "this" Differential Revision: https://reviews.llvm.org/D55158 llvm-svn: 348533
* [attributes] Add an attribute os_consumes_this, with similar semantics to ↵George Karpenkov2018-12-061-0/+3
| | | | | | | | | | | ns_consumes_self The attribute specifies that the call of the C++ method consumes a reference to "this". Differential Revision: https://reviews.llvm.org/D55155 llvm-svn: 348532
* [analyzer] Fix an infinite recursion bug while checking parent methods in ↵George Karpenkov2018-12-061-1/+1
| | | | | | | | RetainCountChecker Differential Revision: https://reviews.llvm.org/D55351 llvm-svn: 348531
* Allow forwarding -fdebug-compilation-dir to cc1asNico Weber2018-12-061-0/+3
| | | | | | | | | | | | | | | | | | | The flag -fdebug-compilation-dir is useful to make generated .o files independent of the path of the build directory, without making the compile command-line dependent on the path of the build directory, like -fdebug-prefix-map requires. This change makes it so that the driver can forward the flag to -cc1as, like it already can for -cc1. We might want to consider making -fdebug-compilation-dir a driver flag in a follow-up. (Since -fdebug-compilation-dir defaults to PWD, it's already possible to get this effect by setting PWD, but explicit compiler flags are better than env vars, because e.g. ninja tracks command lines and reruns commands that change.) Somewhat related to PR14625. Differential Revision: https://reviews.llvm.org/D55377 llvm-svn: 348515
* Reapply "Avoid emitting redundant or unusable directories in DIFile metadata ↵Adrian Prantl2018-12-062-15/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | entries."" This reverts commit r348280 and reapplies D55085 without modifications. Original commit message: Avoid emitting redundant or unusable directories in DIFile metadata entries. As discussed on llvm-dev recently, Clang currently emits redundant directories in DIFile entries, such as .file 1 "/Volumes/Data/llvm" "/Volumes/Data/llvm/tools/clang/test/CodeGen/debug-info-abspath.c" This patch looks at any common prefix between the compilation directory and the (absolute) file path and strips the redundant part. More importantly it leaves the compilation directory empty if the two paths have no common prefix. After this patch the above entry is (assuming a compilation dir of "/Volumes/Data/llvm/_build"): .file 1 "/Volumes/Data/llvm" "tools/clang/test/CodeGen/debug-info-abspath.c" When building the FileCheck binary with debug info, this patch makes the build artifacts ~1kb smaller. Differential Revision: https://reviews.llvm.org/D55085 llvm-svn: 348513
* [CUDA] Fix nvidia-cuda-toolkit detection on UbuntuJoel E. Denny2018-12-061-1/+1
| | | | | | | | | | This just extends D40453 (r319317) to Ubuntu. Reviewed By: Hahnfeld, tra Differential Revision: https://reviews.llvm.org/D55269 llvm-svn: 348504
* [OPENMP][NVPTX] Fix globalization of the mapped array sections.Alexey Bataev2018-12-061-3/+5
| | | | | | | | | If the array section is based on pointer and this sections is mapped in target region + then it is used in the inner parallel region, it also must be globalized as the pointer itself is passed by value, not by reference. llvm-svn: 348492
* Diagnose friend function template redefinitions.Serge Pavlov2018-12-062-1/+26
| | | | | | | | | | | | | | Friend function template defined in a class template becomes available if the enclosing class template is instantiated. Until the function template is used, it does not have a body, but still is considered a definition for the purpose of redeclaration checks. This change modifies redefinition check so that it can find the friend function template definitions in instantiated classes. Differential Revision: http://reviews.llvm.org/D21508 llvm-svn: 348473
* Remove unnecessary include.Richard Trieu2018-12-061-1/+0
| | | | llvm-svn: 348459
* Remove CodeGen dependencies on Sema.Richard Trieu2018-12-064-4/+3
| | | | | | | Move diagnostics from Sema to Frontend (or Common) so that CodeGen no longer needs to include the Sema diagnostic IDs. llvm-svn: 348458
* ARM, AArch64: support `__attribute__((__swiftcall__))`Saleem Abdulrasool2018-12-062-0/+2
| | | | | | | | | | Support the Swift calling convention on Windows ARM and AArch64. Both of these conform to the AAPCS, AAPCS64 calling convention, and LLVM has been adjusted to account for the register usage. Ensure that the frontend passes this into the backend. This allows the swift runtime to be built for Windows. llvm-svn: 348454
* [darwin] remove version number check when enabling ↵Alex Lorenz2018-12-061-1/+0
| | | | | | | | | | -fobjc-subscripting-legacy-runtime This subscripting feature actually works on older OS versions anyway. rdar://36287065 llvm-svn: 348448
* [Sema/Attribute] Check for noderef attributeLeonard Chan2018-12-065-7/+202
| | | | | | | | | | This patch adds the noderef attribute in clang and checks for dereferences of types that have this attribute. This attribute is currently used by sparse and would like to be ported to clang. Differential Revision: https://reviews.llvm.org/D49511 llvm-svn: 348442
* [Sema] Push and Pop Expression Evaluation Context Records at the start and ↵Leonard Chan2018-12-063-5/+30
| | | | | | | | | | | | end of function definitions This patch creates a new context for every function definition we enter. Currently we do not push and pop on these, usually working off of the global context record added in the Sema constructor, which never gets popped. Differential Revision: https://reviews.llvm.org/D54014 llvm-svn: 348434
* [Hexagon] Add intrinsics for Hexagon V66Krzysztof Parzyszek2018-12-051-735/+747
| | | | llvm-svn: 348419
* [Hexagon] Add support for Hexagon V66Krzysztof Parzyszek2018-12-052-1/+5
| | | | llvm-svn: 348415
* NFC: Extract TextNodeDumper classStephen Kelly2018-12-053-253/+261
| | | | | | | | | | | | | | | Summary: Start by moving some utilities to it. It will eventually house dumping of individual nodes (after indentation etc has already been accounted for). Reviewers: aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D55189 llvm-svn: 348412
* NFC: Extract TextTreeStructure classStephen Kelly2018-12-051-145/+6
| | | | | | | | | | Reviewers: aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D55188 llvm-svn: 348410
* NFC: Inline handling of DependentSizedArrayTypeStephen Kelly2018-12-051-1/+7
| | | | | | | | | | | | | | | | Summary: Re-order handling of getElementType and getBracketsRange. It is necessary to perform all printing before any traversal to child nodes. This causes no change in the output of ast-dump-array.cpp due to the way child nodes are printed with a delay. This new order of the code is also the order that produces the expected output anyway. Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D55257 llvm-svn: 348409
* Do not check for parameters shadowing fields in function declarations.Aaron Ballman2018-12-052-7/+12
| | | | | | We would issue a false-positive diagnostic for parameters in function declarations shadowing fields; we now only issue the diagnostic on a function definition instead. llvm-svn: 348400
* Honor -fdebug-prefix-map when creating function names for the debug info.Adrian Prantl2018-12-053-6/+13
| | | | | | | | | | | | | This adds a callback to PrintingPolicy to allow CGDebugInfo to remap file paths according to -fdebug-prefix-map. Otherwise the debug info (particularly function names for C++ lambdas) may contain paths that should have been remapped in the debug info. <rdar://problem/46128056> Differential Revision: https://reviews.llvm.org/D55137 llvm-svn: 348397
* [analyzer] Attribute for RetainCountChecker for OSObject should propagate ↵George Karpenkov2018-12-051-18/+51
| | | | | | | | | | with inheritance rdar://46388388 Differential Revision: https://reviews.llvm.org/D55154 llvm-svn: 348396
* [CodeComplete] Fix a crash in access checks of inner classesIlya Biryukov2018-12-052-12/+31
| | | | | | | | | | | | | | Summary: The crash was introduced in r348135. Reviewers: kadircet Reviewed By: kadircet Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D55260 llvm-svn: 348387
* [Basic] Cleanups in IdentifierInfo following the removal of PTHBruno Ricci2018-12-051-22/+0
| | | | | | | | | | | | | | | | | The Entry pointer in IdentifierInfo was only null for IdentifierInfo created from a PTH. Now that PTH support has been removed we can remove some PTH specific code in IdentifierInfo::getLength and IdentifierInfo::getNameStart. Also make the constructor of IdentifierInfo private to make sure that they are only created by IdentifierTable, and move it to the header so that it can be inlined in IdentifierTable::get and IdentifierTable::getOwn. Differential Revision: https://reviews.llvm.org/D54866 Reviewed By: erichkeane llvm-svn: 348384
* [OpenCL] Diagnose conflicting address spaces in templates.Anastasia Stulova2018-12-052-16/+29
| | | | | | | | | | | | | Added new diagnostic when templates are instantiated with different address space from the one provided in its definition. This also prevents deducing generic address space in pointer type of templates to allow giving them concrete address space during instantiation. Differential Revision: https://reviews.llvm.org/D55127 llvm-svn: 348382
* [Haiku] Support __float128 for x86 and x86_64Kristina Brooks2018-12-051-0/+10
| | | | | | | | | | | | | This patch addresses a compilation error with clang when running in Haiku being unable to compile code using float128 (throws compilation error such as 'float128 is not supported on this target'). Patch by kallisti5 (Alexander von Gluck IV) Differential Revision: https://reviews.llvm.org/D54901 llvm-svn: 348368
* Move detection of libc++ include dirs to Driver on MacOSIlya Biryukov2018-12-053-16/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The intention is to make the tools replaying compilations from 'compile_commands.json' (clang-tidy, clangd, etc.) find the same standard library as the original compiler specified in 'compile_commands.json'. Previously, the library detection logic was in the frontend (InitHeaderSearch.cpp) and relied on the value of resource dir as an approximation of the compiler install dir. The new logic uses the actual compiler install dir and is performed in the driver. This is consistent with the C++ standard library detection on other platforms and allows to override the resource dir in the tools using the compile_commands.json without altering the standard library detection mechanism. The tools have to override the resource dir to make sure they use a consistent version of the builtin headers. There is still logic in InitHeaderSearch that attemps to add the absolute includes for the the C++ standard library, so we keep passing the -stdlib=libc++ from the driver to the frontend via cc1 args to avoid breaking that. In the long run, we should move this logic to the driver too, but it could potentially break the library detection on other systems, so we don't tackle it in this patch to keep its scope manageable. This is a second attempt to fix the issue, first one was commited in r346652 and reverted in r346675. The original fix relied on an ad-hoc propagation (bypassing the cc1 flags) of the install dir from the driver to the frontend's HeaderSearchOptions. Unsurpisingly, the propagation was incomplete, it broke the libc++ detection in clang itself, which caused LLDB tests to break. The LLDB tests pass with new fix. Reviewers: JDevlieghere, arphaman, EricWF Reviewed By: arphaman Subscribers: mclow.lists, ldionne, dexonsmith, ioeric, christof, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D54630 llvm-svn: 348365
* Revert: Honor -fdebug-prefix-map when creating function names for the debug ↵Renato Golin2018-12-053-13/+6
| | | | | | | | | info. This commit reverts r348060 and r348062 due to it breaking the AArch64 Full buildbot: https://bugs.llvm.org/show_bug.cgi?id=39892 llvm-svn: 348364
* [clang] - Simplify tools::SplitDebugName.George Rimar2018-12-055-21/+13
| | | | | | | | | | | | | | | | | | This is an updated version of the D54576, which was reverted. Problem was that SplitDebugName calls the InputInfo::getFilename which asserts if InputInfo given is not of type Filename: const char *getFilename() const { assert(isFilename() && "Invalid accessor."); return Data.Filename; } At the same time at that point, it can be of type Nothing and we need to use getBaseInput(), like original code did. Differential revision: https://reviews.llvm.org/D55006 llvm-svn: 348352
* [asan] Add clang flag -fsanitize-address-use-odr-indicatorVitaly Buka2018-12-053-2/+17
| | | | | | | | | | Reviewers: eugenis, m.ostapenko, ygribov Subscribers: hiraditya, llvm-commits Differential Revision: https://reviews.llvm.org/D55157 llvm-svn: 348327
* [Sema] Remove some conditions of a failing assertErik Pilkington2018-12-051-2/+0
| | | | | | | | | | We should have been checking that this state is consistent, but its possible for it to be filled later, so it isn't really sound to check it here anyways. Fixes llvm.org/PR39742 llvm-svn: 348325
* Fix crash if an in-class explicit function specialization has explicitRichard Smith2018-12-041-10/+12
| | | | | | template arguments referring to template paramaeters. llvm-svn: 348313
* [PowerPC] Make no-PIC default to match GCC - CLANGStefan Pintilie2018-12-041-1/+1
| | | | | | | | Make -fno-PIC default on PowerPC LE. Differential Revision: https://reviews.llvm.org/D53384 llvm-svn: 348299
* [AST] Assert that no type class is polymorphicBruno Ricci2018-12-041-0/+8
| | | | | | | | | | | Add a static_assert checking that no type class is polymorphic. People should use LLVM style RTTI instead. Differential Revision: https://reviews.llvm.org/D55225 Reviewed By: aaron.ballman llvm-svn: 348281
* Revert "Avoid emitting redundant or unusable directories in DIFile metadata ↵Ilya Biryukov2018-12-042-48/+15
| | | | | | | | | | entries." This reverts commit r348154 and follow-up commits r348211 and r3248213. Reason: the original commit broke compiler-rt tests and a follow-up fix (r348203) broke our integrate and was reverted. llvm-svn: 348280
* [AST] Assert that no statement/expression class is polymorphicBruno Ricci2018-12-041-0/+8
| | | | | | | | | | | Add a static_assert checking that no statement/expression class is polymorphic. People should use LLVM style RTTI instead. Differential Revision: https://reviews.llvm.org/D55222 Reviewed By: aaron.ballman llvm-svn: 348278
* [AST][NFC] Make ArrayTypeTraitExpr non polymorphicBruno Ricci2018-12-041-2/+0
| | | | | | | | | | | ArrayTypeTraitExpr is the only expression class which is polymorphic. As far as I can tell this is completely pointless. Differential Revision: https://reviews.llvm.org/D55221 Reviewed By: aaron.ballman llvm-svn: 348276
* [OPENMP][NVPTX]Fixed emission of the critical region.Alexey Bataev2018-12-041-2/+4
| | | | | | | | | | | | | Critical regions in NVPTX are the constructs, which, generally speaking, are not supported by the NVPTX target. Instead we're using special technique to handle the critical regions. Currently they are supported only within the loop and all the threads in the loop must execute the same critical region. Inside of this special regions the regions still must be emitted as critical, to avoid possible data races between the teams + synchronization must use __kmpc_barrier functions. llvm-svn: 348272
* [OPENMP][NVPTX]Mark __kmpc_barrier functions as convergent.Alexey Bataev2018-12-044-7/+53
| | | | | | | | __kmpc_barrier runtime functions must be marked as convergent to prevent some dangerous optimizations. Also, for NVPTX target all barriers must be emitted as simple barriers. llvm-svn: 348271
* PTH-- Remove feature entirely-Erich Keane2018-12-0420-1738/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When debugging a boost build with a modified version of Clang, I discovered that the PTH implementation stores TokenKind in 8 bits. However, we currently have 368 TokenKinds. The result is that the value gets truncated and the wrong token gets picked up when including PTH files. It seems that this will go wrong every time someone uses a token that uses the 9th bit. Upon asking on IRC, it was brought up that this was a highly experimental features that was considered a failure. I discovered via googling that BoostBuild (mostly Boost.Math) is the only user of this feature, using the CC1 flag directly. I believe that this can be transferred over to normal PCH with minimal effort: https://github.com/boostorg/build/issues/367 Based on advice on IRC and research showing that this is a nearly completely unused feature, this patch removes it entirely. Note: I considered leaving the build-flags in place and making them emit an error/warning, however since I've basically identified and warned the only user, it seemed better to just remove them. Differential Revision: https://reviews.llvm.org/D54547 Change-Id: If32744275ef1f585357bd6c1c813d96973c4d8d9 llvm-svn: 348266
* [SystemZ] Do not support __float128Ulrich Weigand2018-12-041-1/+0
| | | | | | | | | | | | | As of rev. 268898, clang supports __float128 on SystemZ. This seems to have been in error. GCC has never supported __float128 on SystemZ, since the "long double" type on the platform is already IEEE-128. (GCC only supports __float128 on platforms where "long double" is some other data type.) For compatibility reasons this patch removes __float128 on SystemZ again. The test case is updated accordingly. llvm-svn: 348247
* [Analyzer] Iterator Checker - Forbid decrements past the begin() and ↵Adam Balogh2018-12-041-90/+154
| | | | | | | | | | | | | | | | | | | | increments past the end() of containers Previously, the iterator range checker only warned upon dereferencing of iterators outside their valid range as well as increments and decrements of out-of-range iterators where the result remains out-of-range. However, the C++ standard is more strict than this: decrementing begin() or incrementing end() results in undefined behaviour even if the iterator is not dereferenced afterwards. Coming back to the range once out-of-range is also undefined. This patch corrects the behaviour of the iterator range checker: warnings are given for any operation whose result is ahead of begin() or past the end() (which is the past-end iterator itself, thus now we are speaking of past past-the-end). Differential Revision: https://reviews.llvm.org/D53812 llvm-svn: 348245
OpenPOWER on IntegriCloud