summaryrefslogtreecommitdiffstats
path: root/clang/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix for P41852 where builtin attributes were being caught by ↵Leonard Chan2019-05-121-2/+3
| | | | | | FindLocsWithCommonFileID(). llvm-svn: 360544
* make -ftime-trace also print template argumentsLubos Lunak2019-05-123-4/+17
| | | | | | | | | Without this, I get e.g. 'PerformPendingInstantiations' -> 'std::fill', now I get 'std::fill<unsigned long *, int>'. Differential Revision: https://reviews.llvm.org/D61822 llvm-svn: 360539
* Reject attempts to call non-static member functions on objects outsideRichard Smith2019-05-121-33/+122
| | | | | | | | | | | | | | | | their lifetime in constant expressions. This is undefined behavior per [class.cdtor]p2. We continue to allow this for objects whose values are not visible within the constant evaluation, because there's no way we can tell whether the access is defined or not, existing code relies on the ability to make such calls, and every other compiler allows such calls. This reinstates r360499, reverted in r360531. llvm-svn: 360538
* Fix handling of objects under construction during constant expressionRichard Smith2019-05-122-93/+161
| | | | | | | | | | | | | evaluation. It's not enough to just track the LValueBase that we're evaluating, we need to also track the path to the objects whose constructors are running. This reinstates r360464 (reverted in r360531) with a workaround for an MSVC bug that previously caused the Windows bots to fail. llvm-svn: 360537
* Revert rL360499 and rL360464 from cfe/trunk:Simon Pilgrim2019-05-112-275/+118
| | | | | | | | | | | | | | | | | | | | | | | | Reject attempts to call non-static member functions on objects outside their lifetime in constant expressions. This is undefined behavior per [class.cdtor]p2. We continue to allow this for objects whose values are not visible within the constant evaluation, because there's no way we can tell whether the access is defined or not, existing code relies on the ability to make such calls, and every other compiler allows such calls. ........ Fix handling of objects under construction during constant expression evaluation. It's not enough to just track the LValueBase that we're evaluating, we need to also track the path to the objects whose constructors are running. ........ Fixes windows buildbots llvm-svn: 360531
* ConstantLValueEmitter::tryEmitAbsolute - remove unused variable. NFCI.Simon Pilgrim2019-05-111-3/+1
| | | | | | Duplicate getOffset() call. llvm-svn: 360515
* Reject attempts to call non-static member functions on objects outsideRichard Smith2019-05-111-33/+122
| | | | | | | | | | | | | | their lifetime in constant expressions. This is undefined behavior per [class.cdtor]p2. We continue to allow this for objects whose values are not visible within the constant evaluation, because there's no way we can tell whether the access is defined or not, existing code relies on the ability to make such calls, and every other compiler allows such calls. llvm-svn: 360499
* [cc1as] Change -compress-debug-sections= to use --Fangrui Song2019-05-112-8/+6
| | | | | | The double dash form is documented by GNU as, used by gcc, and accepted by llvm-mc. llvm-svn: 360495
* [Darwin] Introduce a new flag, -fapple-link-rtlib that forces linking of the ↵Amara Emerson2019-05-102-11/+29
| | | | | | | | | | | | | | | builtins library. This driver flag is useful when users want to link against the compiler's builtins, but nothing else, and so use flags like -nostdlib. Darwin can't use -nolibc & nostdlib++ like other platforms on because we disable all runtime lib linking with -static, which we still want to have an option to link with the builtins. Differential Revision: https://reviews.llvm.org/D58320 llvm-svn: 360483
* [CodeGen][ObjC] Emit invoke instead of call to call `objc_release` whenAkira Hatanaka2019-05-101-1/+1
| | | | | | | | | | | | | | | | | | necessary. Prior to r349952, clang used to call objc_msgSend when sending a release messages, emitting an invoke instruction instead of a call instruction when it was necessary to catch an exception. That changed in r349952 because runtime function objc_release is called as a nounwind function, which broke programs that were overriding the dealloc method and throwing an exception from it. This patch restores the behavior prior to r349952. rdar://problem/50253394 Differential Revision: https://reviews.llvm.org/D61803 llvm-svn: 360474
* Fix handling of objects under construction during constant expressionRichard Smith2019-05-102-93/+161
| | | | | | | | | | evaluation. It's not enough to just track the LValueBase that we're evaluating, we need to also track the path to the objects whose constructors are running. llvm-svn: 360464
* Improve interface of APValuePathEntry.Richard Smith2019-05-103-46/+28
| | | | llvm-svn: 360463
* Fix and test for assertion error in P41835.Leonard Chan2019-05-101-0/+6
| | | | llvm-svn: 360448
* [Sema] Mark array element destructors referenced during initializationErik Pilkington2019-05-103-53/+52
| | | | | | | | | | | | This fixes a crash where we would neglect to mark a destructor referenced for an __attribute__((no_destory)) array. The destructor is needed though, since if an exception is thrown we need to cleanup the elements. rdar://48462498 Differential revision: https://reviews.llvm.org/D61165 llvm-svn: 360446
* Add name comments for bools passed to getObjCEncodingForTypeImpl()Nico Weber2019-05-101-52/+85
| | | | | | | | No behavior change. Medium term, probably want to use a bitmask instead of 8 distinct bool parameters, but let's make the call sites easier to read first. llvm-svn: 360427
* Fix Wdocumentation warning. NFCI.Simon Pilgrim2019-05-101-2/+3
| | | | llvm-svn: 360419
* [Preamble] Stop circular inclusion of main file when building preambleNikolai Kosjar2019-05-102-1/+13
| | | | | | | | | | | | | | | If a header file was processed for the second time, we could end up with a wrong conditional stack and skipped ranges: In the particular example, if the header guard is evaluated the second time and it is decided to skip the conditional block, the corresponding "#endif" is never seen since the preamble does not include it and we end up in the Tok.is(tok::eof) case with a wrong conditional stack. Detect the circular inclusion, emit a diagnostic and stop processing the inclusion. llvm-svn: 360418
* Revert "Revert "[clang-format] Keep protobuf "package" statement on one line""Krasimir Georgiev2019-05-101-3/+3
| | | | | | | | | | | | | | | | | | | | | | | Summary: Top-level "package" and "import" statements should generally be kept on one line, for all languages. ---- This reverts commit rL356912. The regression from rL356835 was fixed via rC358275. Reviewers: krasimir, sammccall, MyDeveloperDay, xinz, dchai, klimek Reviewed By: krasimir, xinz, dchai Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D60661 llvm-svn: 360411
* Delete write-only HasQualifiers after rC360370Fangrui Song2019-05-101-2/+0
| | | | llvm-svn: 360408
* Added an assert in `isConstantInitializer`: initializer lists must be in ↵Dmitri Gribenko2019-05-101-0/+1
| | | | | | | | | | | | semantic form Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D61485 llvm-svn: 360406
* Assume `__cxa_allocate_exception` returns an under-aligned memory onAkira Hatanaka2019-05-103-14/+47
| | | | | | | | | | | | | | | | | | | | | Darwin if the version of libc++abi isn't new enough to include the fix in r319123 This patch resurrects r264998, which was committed to work around a bug in libc++abi that was causing _cxa_allocate_exception to return a memory that wasn't double-word aligned. http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20160328/154332.html In addition, this patch makes clang issue a warning if the type of the thrown object requires an alignment that is larger than the minimum guaranteed by the target C++ runtime. rdar://problem/49864414 Differential Revision: https://reviews.llvm.org/D61667 llvm-svn: 360404
* Change -gz and -Wa,--compress-debug-sections to use gABI compression ↵Fangrui Song2019-05-101-2/+1
| | | | | | | | | | | | | | | | | | | | | | | (SHF_COMPRESSED) Since July 15, 2015 (binutils-gdb commit 19a7fe52ae3d0971e67a134bcb1648899e21ae1c, included in 2.26), gas --compress-debug-sections=zlib (gcc -gz) means zlib-gabi: SHF_COMPRESSED. Before that it meant zlib-gnu (.zdebug). clang's -gz was introduced in rC306115 (Jun 2017) to indicate zlib-gnu. It is 2019 now and it is not unreasonable to assume users of the new feature to have new linkers (ld.bfd/gold >= 2.26, lld >= rLLD273661). Change clang's default accordingly to improve standard conformance. zlib-gnu becomes out of fashion and gets poorer toolchain support. Its mangled names confuse tools and are more likely to cause problems. Reviewed By: compnerd Differential Revision: https://reviews.llvm.org/D61689 llvm-svn: 360403
* Remember to decay arrays to pointers before checking whether theRichard Smith2019-05-091-3/+6
| | | | | | left-hand side of an -> operator is a pointer to class type. llvm-svn: 360387
* DR1872: don't allow any calls to virtual functions in constantRichard Smith2019-05-091-6/+8
| | | | | | | | evaluation. Not even in cases where we would not actually perform virtual dispatch. llvm-svn: 360370
* Simplify tracking of end of consumed decl-specifier sequence.Richard Smith2019-05-091-11/+7
| | | | | | | | Patch by Tyker! Differential Revision: https://reviews.llvm.org/D60934 llvm-svn: 360369
* [OPENMP]Fix PR41767: diagnose DSA for variables in clauses with default(none).Alexey Bataev2019-05-091-3/+95
| | | | | | | | | If the combined directive has default(none) clause and has clauses for inner directive that reference some variables, for which data-sharing attributes are not specified, the error messages should be emitted for such variables. llvm-svn: 360365
* [OPENMP]Fix PR41768: check DSA for globals with default(none) clauses.Alexey Bataev2019-05-092-3/+26
| | | | | | | | If the default(none) was specified for the construct, we might miss diagnostic for the globals without explicitly specified data-sharing attributes. Patch fixes this problem. llvm-svn: 360362
* [CodeGen][ObjC] Remove the leading `l_` from ObjC symbols and makeAkira Hatanaka2019-05-091-86/+99
| | | | | | | | | | | | | | | private symbols in the __DATA segment internal. This prevents the linker from removing the symbol names. Keeping the symbols visible enables tools to collect various information about the symbols, for example, tools that discover whether or not a symbol gets dirtied. rdar://problem/48887111 Differential Revision: https://reviews.llvm.org/D61454 llvm-svn: 360359
* [OpenCL] Make global ctor init function a kernelAnastasia Stulova2019-05-094-200/+233
| | | | | | | | | | | | | | We need to be able to enqueue internal function that initializes global constructors on the host side. Therefore it has to be converted to a kernel. This change factors out common logic for adding kernel metadata and moves it from CodeGenFunction to CodeGenModule in order to make it accessible for the extra use case. Differential revision: https://reviews.llvm.org/D61488 llvm-svn: 360342
* Fix gcc compilation warning in an assert [NFC]Mikael Holmen2019-05-091-1/+1
| | | | | | | | | | | | | | Without this, gcc (7.4) complains with ../tools/clang/lib/Parse/ParseDecl.cpp:3937:63: error: suggest parentheses around '&&' within '||' [-Werror=parentheses] assert(!isAlreadyConsumed || RangeEnd != SourceLocation() && ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~ "both or neither of isAlreadyConsumed and " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "RangeEnd needs to be set"); ~ llvm-svn: 360333
* Revert "[OPENMP]Fix PR41768: check DSA for globals with `default(none)` ↵Roman Lebedev2019-05-091-7/+1
| | | | | | | | | | | | clauses." This has introduced (exposed?) a crash in clang sema, that does not happen without this patch. I'll followup in the original bugreport and commit with reproducer. This reverts commit r360061. llvm-svn: 360327
* Revert "[OPENMP]Fix PR41767: diagnose DSA for variables in clauses with ↵Roman Lebedev2019-05-091-96/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | default(none)." This implementation isn't sound as per the standard. It erroneously diagnoses e.g. the following case: ``` $ cat test.cpp void f(int n) { #pragma omp parallel default(none) if(n) ; } ``` ``` $ ./bin/clang -fopenmp test.cpp test.cpp:2:40: error: variable 'n' must have explicitly specified data sharing attributes #pragma omp parallel default(none) if(n) ^ test.cpp:2:31: note: explicit data sharing attribute requested here #pragma omp parallel default(none) if(n) ^ 1 error generated. ``` As per OpenMP Application Programming Interface Version 5.0 November 2018: * 2.19.4.1default Clause The default clause explicitly determines the data-sharing attributes of variables that are referenced *in a parallel, teams, or task generating construct and would otherwise be implicitly determined (see Section 2.19.1.1 on page 270). * 2.6.1 Determining the Number of Threads for a parallel Region Using a variable in an if or num_threads clause expression of a parallel construct causes an implicit reference to the variable in all enclosing constructs. The if clause expression and the num_threads clause expression are evaluated in the context outside of the parallel construct, This reverts commit r360073. llvm-svn: 360326
* [SPIR] Simplified target checking.Anastasia Stulova2019-05-093-7/+3
| | | | | | | | | | Switched to Triple::isSPIR() helper to simplify code. Patch by kpet (Kevin Petit)! Differential revision: https://reviews.llvm.org/D61639 llvm-svn: 360325
* [ARM] Fix the extensions implied by a cpu nameDiogo N. Sampaio2019-05-091-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: When using `clang -mcpu=CPUNAME+FEATURELIST`, the implied features defined by CPUNAME are not obtained, as the entire string is passed. This fixes that by spiting the cpuname string in the first `+`, if any. For example, when using ```clang -### --target=arm-arm-none-eabi -march=armv7-a -mcpu=cortex-a8+nocrc``` the intrinsic ```"target-feature" "+dsp"``` implied by `cortex-a8` is missing. Reviewers: keith.walker.arm, DavidSpickett, carwil Reviewed By: DavidSpickett Subscribers: javed.absar, kristof.beyls, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D61668 llvm-svn: 360324
* [NewPM] Setup Passes for KASan and KMSanPetr Hosek2019-05-091-8/+20
| | | | | | | | | | While ASan and MSan passes were already ported to new PM, the kernel variants weren't setup in the pipeline which makes the KASan and KMSan tests in Clang fail. Differential Revision: https://reviews.llvm.org/D61664 llvm-svn: 360313
* [c++20] Add support for explicit(bool), as described in P0892R2.Richard Smith2019-05-0920-240/+472
| | | | | | | | Patch by Tyker! Differential Revision: https://reviews.llvm.org/D60934 llvm-svn: 360311
* [c++20] Implement P0846R0: allow (ADL-only) calls to template-ids whoseRichard Smith2019-05-0921-181/+499
| | | | | | | | | | | | | | | | | | | | | | | | | template name is not visible to unqualified lookup. In order to support this without a severe degradation in our ability to diagnose typos in template names, this change significantly restructures the way we handle template-id-shaped syntax for which lookup of the template name finds nothing. Instead of eagerly diagnosing an undeclared template name, we now form a placeholder template-name representing a name that is known to not find any templates. When the parser sees such a name, it attempts to disambiguate whether we have a less-than comparison or a template-id. Any diagnostics or typo-correction for the name are delayed until its point of use. The upshot should be a small improvement of our diagostic quality overall: we now take more syntactic context into account when trying to resolve an undeclared identifier on the left hand side of a '<'. In fact, this works well enough that the backwards-compatible portion (for an undeclared identifier rather than a lookup that finds functions but no function templates) is enabled in all language modes. llvm-svn: 360308
* When typo-correcting a function name, consider correcting to a type nameRichard Smith2019-05-092-3/+12
| | | | | | for a function-style cast. llvm-svn: 360302
* Revert Include corecrt.h in stddef.h and vcruntime.h in stdarg.h to improve ↵Reid Kleckner2019-05-082-11/+0
| | | | | | | | | | | | MS compatibility. This reverts r360271 (git commit a0933bd8ec1515167ea653f7ee788b8bbde27d51) There are concerns on the review that this breaks EFI builds and that the transitive includes (sal.h) are actually heavy enough that we might care. llvm-svn: 360291
* Include corecrt.h in stddef.h and vcruntime.h in stdarg.h to improve MSMike Rice2019-05-082-0/+11
| | | | | | | | | | | compatibility. This allows some applications developed with MSVC to compile with clang without any extra changes. Fixes: llvm.org/PR40789 Differential Revision: https://reviews.llvm.org/D61646 llvm-svn: 360271
* [OpenMP][Clang] Support for target math functionsGheorghe-Teodor Bercea2019-05-0810-433/+585
| | | | | | | | | | | | | | | | | | | | | | | Summary: In this patch we propose a temporary solution to resolving math functions for the NVPTX toolchain, temporary until OpenMP variant is supported by Clang. We intercept the inclusion of math.h and cmath headers and if we are in the OpenMP-NVPTX case, we re-use CUDA's math function resolution mechanism. Authors: @gtbercea @jdoerfert Reviewers: hfinkel, caomhin, ABataev, tra Reviewed By: hfinkel, ABataev, tra Subscribers: JDevlieghere, mgorny, guansong, cfe-commits, jdoerfert Tags: #clang Differential Revision: https://reviews.llvm.org/D61399 llvm-svn: 360265
* [ASTImporter] Fix inequivalence of unresolved exception specGabor Marton2019-05-082-17/+36
| | | | | | | | | | | | | | | | | | Summary: Structural equivalence of methods can falsely report false when the exception specifier is unresolved (i.e unevaluated or not instantiated). (This caused one assertion during bitcoin ctu-analysis.) Reviewers: a_sidorin, shafik, a.sidorin Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D61424 llvm-svn: 360261
* [Sema][OpenCL] Make address space conversions a bit stricter.Anastasia Stulova2019-05-082-16/+55
| | | | | | | | | | | | | | | | | | | | | | | | The semantics for converting nested pointers between address spaces are not very well defined. Some conversions which do not really carry any meaning only produce warnings, and in some cases warnings hide invalid conversions, such as 'global int*' to 'local float*'! This patch changes the logic in checkPointerTypesForAssignment and checkAddressSpaceCast to fail properly on implicit conversions that should definitely not be permitted. We also dig deeper into the pointer types and warn on explicit conversions where the address space in a nested pointer changes, regardless of whether the address space is compatible with the corresponding pointer nesting level on the destination type. Fixes PR39674! Patch by ebevhan (Bevin Hansson)! Differential Revision: https://reviews.llvm.org/D58236 llvm-svn: 360258
* [clang] Fix a bug that reports UTF32 (LE) files as UTF16 (LE) onesOwen Pan2019-05-081-3/+3
| | | | | | | | Also fix a typo for the SCSU byte order mark. Differential Revision: https://reviews.llvm.org/D61628 llvm-svn: 360256
* Allow 'static' storage specifier on an out-of-line class member template ↵Aaron Ballman2019-05-081-2/+5
| | | | | | | | declaration in MSVCCompat mode. Patch by Soumi Manna. llvm-svn: 360250
* Fix for the greendragon bots.Leonard Chan2019-05-081-1/+3
| | | | | | Adds extra checks for ObjC GC and Ownership. llvm-svn: 360225
* [Sema] Correct typos in return statements so the return types of 'auto' ↵Sam McCall2019-05-081-1/+7
| | | | | | | | | | | | | | | | | | | | | functions are always deduced. Summary: e.g. auto foo() { return no_such_thing; // Return value is a TypoExpr } using T = decltype(foo()); // Uh-oh, undeduced auto. Reviewers: rsmith Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D61649 llvm-svn: 360224
* Split ActOnCallExpr into an ActOnCallExpr to be called by the parser,Richard Smith2019-05-089-23/+29
| | | | | | | and a BuildCallExpr to be called internally within Sema to build / rebuild calls. llvm-svn: 360217
* [hip] Fix ambiguity from `>>>` of CUDA.Michael Liao2019-05-081-1/+3
| | | | | | | | | | | | | | | | | Summary: - For template arguments ending with `>>>`, we should cease lookahead and treat it as type-id firstly, so that deduction could work properly. Reviewers: tra, yaxunl Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D61396 llvm-svn: 360214
* [COFF] Use COFF stubs for extern_weak functionsReid Kleckner2019-05-071-0/+7
| | | | | | | | | | | | | | | | | | | | | | | Summary: A COFF stub indirects the reference to a symbol through memory. A .refptr.$sym global variable pointer is created to refer to $sym. Typically mingw uses these for external global variable declarations, but we can use them for weak function declarations as well. Updates the dso_local classification to add a special case for extern_weak symbols on COFF in both clang and LLVM. Fixes PR37598 Reviewers: smeenai, mstorsjo Subscribers: hiraditya, cfe-commits, llvm-commits Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D61615 llvm-svn: 360207
OpenPOWER on IntegriCloud