summaryrefslogtreecommitdiff
path: root/include
Commit message (Collapse)AuthorAgeFilesLines
* Revert r372325 - Reverting r372323 because it broke color tests on Linux.Aaron Ballman2019-09-191-2/+0
| | | | | | This corrects the testing issues. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@372334 91177308-0d34-0410-b5e6-96231b3b80d8
* Reverting r372323 because it broke color tests on Linux.Aaron Ballman2019-09-191-0/+2
| | | | | | http://lab.llvm.org:8011/builders/clang-x86_64-debian-fast/builds/17919 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@372325 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove an unsafe member variable that wasn't needed; NFC.Aaron Ballman2019-09-191-2/+0
| | | | | | People use the AST dumping interface while debugging, so it's not safe to assume that a declaration will be dumped before a constant expression is dumped. This means the Context member may not get set properly and problems would happen. Rather than rely on the interface that requires the ASTContext, call the generic dump() interface instead; this allows us to remove the Context member variable. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@372323 91177308-0d34-0410-b5e6-96231b3b80d8
* Clean out unused diagnostics. NFC.Benjamin Kramer2019-09-195-21/+0
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@372319 91177308-0d34-0410-b5e6-96231b3b80d8
* [Builtins] Delete setjmp_syscall and qsetjmpFangrui Song2019-09-191-2/+0
| | | | | | | | Similar to the resolution of gcc PR71876. Nobody uses them or needs the [-Wincomplete-setjmp-declaration] diagnostic. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@372299 91177308-0d34-0410-b5e6-96231b3b80d8
* [CLANG][BPF] change __builtin_preserve_access_index() signatureYonghong Song2019-09-192-1/+4
| | | | | | | | | | | | | | | | | | | | | | | The clang intrinsic __builtin_preserve_access_index() currently has signature: const void * __builtin_preserve_access_index(const void * ptr) This may cause compiler warning when: - parameter type is "volatile void *" or "const volatile void *", or - the assign-to type of the intrinsic does not have "const" qualifier. Further, this signature does not allow dereference of the builtin result pointer as it is a "const void *" type, which adds extra step for the user to do type casting. Let us change the signature to: PointerT __builtin_preserve_access_index(PointerT ptr) such that the result and argument types are the same. With this, directly dereferencing the builtin return value becomes possible. Differential Revision: https://reviews.llvm.org/D67734 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@372294 91177308-0d34-0410-b5e6-96231b3b80d8
* Initialize all fields in ABIArgInfo.Serge Guelton2019-09-191-6/+4
| | | | | | | | | | | Due to usage of an uninitialized fields, we end up with a Conditional jump or move depends on uninitialised value Fixes https://bugs.llvm.org/show_bug.cgi?id=40547 Commited on behalf of Martin Liska <mliska@suse.cz> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@372281 91177308-0d34-0410-b5e6-96231b3b80d8
* [Sema] Suppress -Wformat diagnostics for bool types when printed using %hhdErik Pilkington2019-09-181-0/+3
| | | | | | | | | | | Also, add a diagnostic under -Wformat for printing a boolean value as a character. rdar://54579473 Differential revision: https://reviews.llvm.org/D66856 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@372247 91177308-0d34-0410-b5e6-96231b3b80d8
* [c++20] P1331R2: Allow transient use of uninitialized objects inRichard Smith2019-09-183-29/+48
| | | | | | constant evaluation. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@372237 91177308-0d34-0410-b5e6-96231b3b80d8
* [OPENMP5.0]Allow multiple context selectors in the context selectorAlexey Bataev2019-09-182-7/+23
| | | | | | | | | sets. According to OpenMP 5.0, context selector set might include several context selectors, separated with commas. Patch fixes this problem. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@372235 91177308-0d34-0410-b5e6-96231b3b80d8
* [AST] CommentLexer - Remove (optional) Invalid parameter from getSpelling.Simon Pilgrim2019-09-181-2/+1
| | | | | | The static analyzer noticed that we were dereferencing it even when the default null value was being used. Further investigation showed that we never explicitly set the parameter so I've just removed it entirely. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@372217 91177308-0d34-0410-b5e6-96231b3b80d8
* [lldb] Print better diagnostics for user expressions and modulesRaphael Isemann2019-09-181-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Currently our expression evaluators only prints very basic errors that are not very useful when writing complex expressions. For example, in the expression below the user made a type error, but it's not clear from the diagnostic what went wrong: ``` (lldb) expr printf("Modulos are:", foobar%mo1, foobar%mo2, foobar%mo3) error: invalid operands to binary expression ('int' and 'double') ``` This patch enables full Clang diagnostics in our expression evaluator. After this patch the diagnostics for the expression look like this: ``` (lldb) expr printf("Modulos are:", foobar%mo1, foobar%mo2, foobar%mo3) error: <user expression 1>:1:54: invalid operands to binary expression ('int' and 'float') printf("Modulos are:", foobar%mo1, foobar%mo2, foobar%mo3) ~~~~~~^~~~ ``` To make this possible, we now emulate a user expression file within our diagnostics. This prevents that the user is exposed to our internal wrapper code we inject. Note that the diagnostics that refer to declarations from the debug information (e.g. 'note' diagnostics pointing to a called function) will not be improved by this as they don't have any source locations associated with them, so caret or line printing isn't possible. We instead just suppress these diagnostics as we already do with warnings as they would otherwise just be a context message without any context (and the original diagnostic in the user expression should be enough to explain the issue). Fixes rdar://24306342 Reviewers: JDevlieghere, aprantl, shafik, #lldb Reviewed By: JDevlieghere, #lldb Subscribers: usaxena95, davide, jingham, aprantl, arphaman, kadircet, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D65646 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@372203 91177308-0d34-0410-b5e6-96231b3b80d8
* [Sema] Split of versions of -Wimplicit-{float,int}-conversion for ↵Erik Pilkington2019-09-172-3/+22
| | | | | | | | | | | | | Objective-C BOOL Also, add a diagnostic group, -Wobjc-signed-char-bool, to control all these related diagnostics. rdar://51954400 Differential revision: https://reviews.llvm.org/D67559 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@372183 91177308-0d34-0410-b5e6-96231b3b80d8
* Use 'BOOL' instead of BOOL in diagnostic messagesErik Pilkington2019-09-171-4/+4
| | | | | | Type names should be enclosed in single quotes. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@372152 91177308-0d34-0410-b5e6-96231b3b80d8
* [OPENMP5.0]Introduce attribute for declare variant directive.Alexey Bataev2019-09-174-0/+61
| | | | | | | | Added attribute for declare variant directive. It will allow to handle declare variant directive at the codegen and will allow to add extra checks. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@372147 91177308-0d34-0410-b5e6-96231b3b80d8
* [RISCV] Add option aliases: -mcmodel=medany and -mcmodel=medlowKito Cheng2019-09-171-0/+6
| | | | | | | | | | | | | | RISC-V GCC use -mcmodel=medany and -mcmodel=medlow, but LLVM use -mcmodel=small and -mcmodel=medium. Add those two option aliases for provide same user interface between GCC and LLVM. Reviewed By: lenary Differential Revision: https://reviews.llvm.org/D67066 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@372080 91177308-0d34-0410-b5e6-96231b3b80d8
* [clangd] Fix a crash when renaming operator.Haojian Wu2019-09-161-2/+1
| | | | | | | | | | | | | | | | | | | | Summary: The renamelib uses a tricky way to calculate the end location by relying on decl name, this is incorrect for the overloaded operator (the name is "operator++" instead of "++"), which will cause out-of-file offset. We also disable renaming operator symbol, this case is tricky, and renamelib doesnt handle it properly. Reviewers: ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D67607 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@371971 91177308-0d34-0410-b5e6-96231b3b80d8
* Change signature of __builtin_rotateright64 back to unsignedKarl-Johan Karlsson2019-09-161-1/+1
| | | | | | | | | | | | | | | | The signature of __builtin_rotateright64 was by misstake changed from unsigned to signed in r360863, this patch will change it back to unsigned as intended. This fixes pr43309 Reviewers: efriedma, hans Reviewed By: hans Differential Revision: https://reviews.llvm.org/D67606 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@371969 91177308-0d34-0410-b5e6-96231b3b80d8
* [WebAssembly] Narrowing and widening SIMD opsThomas Lively2019-09-131-0/+14
| | | | | | | | | | | | | | | | Summary: Implements target-specific LLVM intrinsics and clang builtins for these new SIMD operations, as described at https://github.com/WebAssembly/simd/blob/master/proposals/simd/SIMD.md#integer-to-integer-narrowing. Reviewers: aheejin Subscribers: dschuff, sbc100, jgravelle-google, hiraditya, sunfish, cfe-commits, llvm-commits Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D67425 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@371906 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-scan-deps] Fix for headers having the same name as a directoryAlex Lorenz2019-09-131-0/+3
| | | | | | | | | | | | Scan deps tool crashes when called on a C++ file, containing an include that has the same name as a directory. The tool crashes since it finds foo/dir and tries to read that as a file and fails. Patch by: kousikk (Kousik Kumar) Differential Revision: https://reviews.llvm.org/D67091 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@371903 91177308-0d34-0410-b5e6-96231b3b80d8
* [OPENMP5.0]Add basic support for declare variant directive.Alexey Bataev2019-09-135-6/+59
| | | | | | | Added basic support for declare variant directive and its match clause with user context selector. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@371892 91177308-0d34-0410-b5e6-96231b3b80d8
* Reland r371785: Add -Wpoison-system-directories warningManoj Gupta2019-09-131-0/+5
| | | | | | | | | | | | | | | | | | | | When using clang as a cross-compiler, we should not use system headers to do the compilation. This CL adds support of a new warning flag -Wpoison-system-directories which emits warnings if --sysroot is set and headers from common host system location are used. By default the warning is disabled. The intention of the warning is to catch bad includes which are usually generated by third party build system not targeting cross-compilation. Such cases happen in Chrome OS when someone imports a new package or upgrade one to a newer version from upstream. This is reland of r371785 with a fix to test file. Patch by: denik (Denis Nikitin) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@371878 91177308-0d34-0410-b5e6-96231b3b80d8
* [NFCI]Create CommonAttributeInfo Type as base type of *Attr and ParsedAttr.Erich Keane2019-09-137-286/+390
| | | | | | | | | | | | In order to enable future improvements to our attribute diagnostics, this moves info from ParsedAttr into CommonAttributeInfo, then makes this type the base of the *Attr and ParsedAttr types. Quite a bit of refactoring took place, including removing a bunch of redundant Spelling Index propogation. Differential Revision: https://reviews.llvm.org/D67368 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@371875 91177308-0d34-0410-b5e6-96231b3b80d8
* [Clang Interpreter] Initial patch for the constexpr interpreterNandor Licker2019-09-135-0/+98
| | | | | | | | | | | | | | | | | | Summary: This patch introduces the skeleton of the constexpr interpreter, capable of evaluating a simple constexpr functions consisting of if statements. The interpreter is described in more detail in the RFC. Further patches will add more features. Reviewers: Bigcheese, jfb, rsmith Subscribers: bruno, uenoku, ldionne, Tyker, thegameg, tschuett, dexonsmith, mgorny, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D64146 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@371834 91177308-0d34-0410-b5e6-96231b3b80d8
* For PR17164: split -fno-lax-vector-conversion into three differentRichard Smith2019-09-133-3/+17
| | | | | | | | | | | | | | | | | | | | | levels: -- none: no lax vector conversions [new GCC default] -- integer: only conversions between integer vectors [old GCC default] -- all: all conversions between same-size vectors [Clang default] For now, Clang still defaults to "all" mode, but per my proposal on cfe-dev (2019-04-10) the default will be changed to "integer" as soon as that doesn't break lots of testcases. (Eventually I'd like to change the default to "none" to match GCC and general sanity.) Following GCC's behavior, the driver flag -flax-vector-conversions is translated to -flax-vector-conversions=integer. This reinstates r371805, reverted in r371813, with an additional fix for lldb. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@371817 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove reliance on lax vector conversions from altivec.h and its test.Richard Smith2019-09-131-2/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@371814 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "For PR17164: split -fno-lax-vector-conversion into three different"Jonas Devlieghere2019-09-133-17/+3
| | | | | | | This breaks the LLDB build. I tried reaching out to Richard, but haven't gotten a reply yet. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@371813 91177308-0d34-0410-b5e6-96231b3b80d8
* For PR17164: split -fno-lax-vector-conversion into three differentRichard Smith2019-09-133-3/+17
| | | | | | | | | | | | | | | | | | levels: -- none: no lax vector conversions [new GCC default] -- integer: only conversions between integer vectors [old GCC default] -- all: all conversions between same-size vectors [Clang default] For now, Clang still defaults to "all" mode, but per my proposal on cfe-dev (2019-04-10) the default will be changed to "integer" as soon as that doesn't break lots of testcases. (Eventually I'd like to change the default to "none" to match GCC and general sanity.) Following GCC's behavior, the driver flag -flax-vector-conversions is translated to -flax-vector-conversions=integer. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@371805 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r371785.Manoj Gupta2019-09-131-5/+0
| | | | | | r371785 is causing fails on clang-hexagon-elf buildbots. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@371799 91177308-0d34-0410-b5e6-96231b3b80d8
* [libclang] Expose abort()-ing LLVM fatal error handlerJan Korous2019-09-121-0/+33
| | | | | | Differential Revision: https://reviews.llvm.org/D66775 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@371787 91177308-0d34-0410-b5e6-96231b3b80d8
* Add -Wpoison-system-directories warningManoj Gupta2019-09-121-0/+5
| | | | | | | | | | | | | | | | | | When using clang as a cross-compiler, we should not use system headers to do the compilation. This CL adds support of a new warning flag -Wpoison-system-directories which emits warnings if --sysroot is set and headers from common host system location are used. By default the warning is disabled. The intention of the warning is to catch bad includes which are usually generated by third party build system not targeting cross-compilation. Such cases happen in Chrome OS when someone imports a new package or upgrade one to a newer version from upstream. Patch by: denik (Denis Nikitin) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@371785 91177308-0d34-0410-b5e6-96231b3b80d8
* Improve code generation for thread_local variables:Richard Smith2019-09-121-0/+6
| | | | | | | | | | | | | | | | | | | | | Summary: * Don't bother using a thread wrapper when the variable is known to have constant initialization. * Emit the thread wrapper as discardable-if-unused in TUs that don't contain a definition of the thread_local variable. * Don't emit the thread wrapper at all if the thread_local variable is unused and discardable; it will be emitted by all TUs that need it. Reviewers: rjmccall, jdoerfert Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D67429 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@371767 91177308-0d34-0410-b5e6-96231b3b80d8
* [CFG] Add dumps for CFGElement and CFGElementRefKristof Umann2019-09-121-2/+17
| | | | | | | | | Seems like we never had these, so here we go! I also did some refactoring as I was chasing a bug unrelated to this revision. Differential Revision: https://reviews.llvm.org/D66715 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@371765 91177308-0d34-0410-b5e6-96231b3b80d8
* [analyzer][NFC] Fix inconsistent references to checkers as "checks"Kristof Umann2019-09-127-78/+89
| | | | | | | | | | | | | | Traditionally, clang-tidy uses the term check, and the analyzer uses checker, but in the very early years, this wasn't the case, and code originating from the early 2010's still incorrectly refer to checkers as checks. This patch attempts to hunt down most of these, aiming to refer to checkers as checkers, but preserve references to callback functions (like checkPreCall) as checks. Differential Revision: https://reviews.llvm.org/D67140 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@371760 91177308-0d34-0410-b5e6-96231b3b80d8
* [MS] Warn when shadowing template parameters under -fms-compatibilityReid Kleckner2019-09-121-0/+2
| | | | | | | | | | | | | | | | | | | | Summary: C++ does not allow shadowing template parameters, but previously we allowed it under -fms-extensions. Now this behavior is controlled by -fms-compatibility, and we emit a -Wmicrosoft-template warning when it happens. Fixes PR43265 Reviewers: thakis, hans Subscribers: amccarth, rsmith, STL_MSFT, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D67463 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@371753 91177308-0d34-0410-b5e6-96231b3b80d8
* Removed some questionable default arguments from settersDmitri Gribenko2019-09-121-7/+5
| | | | | | | | | | | | | | | | | Summary: They can be confusing -- what does it mean to call a setter without a value? Also, some setters, like `setPrintTemplateTree` had `false` as the default value! The callers are largely not using these default arguments anyway. Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D67491 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@371731 91177308-0d34-0410-b5e6-96231b3b80d8
* Removed dead code from DiagnosticBuilderDmitri Gribenko2019-09-121-5/+0
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@371723 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-format] Add new style option IndentGotoLabelsPaul Hoad2019-09-121-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This option determines whether goto labels are indented according to scope. Setting this option to false causes goto labels to be flushed to the left. This is mostly copied from [[ http://lists.llvm.org/pipermail/cfe-dev/2015-September/045014.html | this patch ]] submitted by Christian Neukirchen that didn't make its way into trunk. ``` true: false: int f() { vs. int f() { if (foo()) { if (foo()) { label1: label1: bar(); bar(); } } label2: label2: return 1; return 1; } } ``` Reviewers: klimek, MyDeveloperDay Reviewed By: MyDeveloperDay Subscribers: cfe-commits Tags: #clang, #clang-tools-extra Patch by: tetsuo-cpp Differential Revision: https://reviews.llvm.org/D67037 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@371719 91177308-0d34-0410-b5e6-96231b3b80d8
* [WebAssembly] Add -fwasm-exceptions for wasm EHHeejin Ahn2019-09-122-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This adds `-fwasm-exceptions` (in similar fashion with `-fdwarf-exceptions` or `-fsjlj-exceptions`) that turns on everything with wasm exception handling from the frontend to the backend. We currently have `-mexception-handling` in clang frontend, but this is only about the architecture capability and does not turn on other necessary options such as the exception model in the backend. (This can be turned on with `llc -exception-model=wasm`, but llc is not invoked separately as a command line tool, so this option has to be transferred from clang.) Turning on `-fwasm-exceptions` in clang also turns on `-mexception-handling` if not specified, and will error out if `-mno-exception-handling` is specified. Reviewers: dschuff, tlively, sbc100 Subscribers: aprantl, jgravelle-google, sunfish, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D67208 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@371708 91177308-0d34-0410-b5e6-96231b3b80d8
* [analyzer] NFC: Move PathDiagnostic classes to libAnalysis.Artem Dergachev2019-09-113-2/+2
| | | | | | | | | | | | At this point the PathDiagnostic, PathDiagnosticLocation, PathDiagnosticPiece structures no longer rely on anything specific to Static Analyzer, so we can move them out of it for everybody to use. PathDiagnosticConsumers are still to be handed off. Differential Revision: https://reviews.llvm.org/D67419 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@371661 91177308-0d34-0410-b5e6-96231b3b80d8
* [analyzer] NFC: Move resetDiagnosticLocationToMainFile() to BugReporter.Artem Dergachev2019-09-111-10/+13
| | | | | | | | | | This method of PathDiagnostic is a part of Static Analyzer's particular path diagnostic construction scheme. As such, it doesn't belong to the PathDiagnostic class, but to the Analyzer. Differential Revision: https://reviews.llvm.org/D67418 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@371660 91177308-0d34-0410-b5e6-96231b3b80d8
* [analyzer] NFC: Move getStmt() and createEndOfPath() out of PathDiagnostic.Artem Dergachev2019-09-112-17/+32
| | | | | | | | | | These static functions deal with ExplodedNodes which is something we don't want the PathDiagnostic interface to know anything about, as it's planned to be moved out of libStaticAnalyzerCore. Differential Revision: https://reviews.llvm.org/D67382 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@371659 91177308-0d34-0410-b5e6-96231b3b80d8
* [analyzer] NFC: Re-implement stack hints as a side map in BugReport.Artem Dergachev2019-09-112-64/+74
| | | | | | | | | | That's one of the few random entities in the PathDiagnostic interface that are specific to the Static Analyzer. By moving them out we could let everybody use path diagnostics without linking against Static Analyzer. Differential Revision: https://reviews.llvm.org/D67381 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@371658 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-scan-deps] add skip excluded conditional preprocessor block ↵Alex Lorenz2019-09-118-3/+109
| | | | | | | | | | | | | | | preprocessing optimization This commit adds an optimization to clang-scan-deps and clang's preprocessor that skips excluded preprocessor blocks by bumping the lexer pointer, and not lexing the tokens until reaching appropriate #else/#endif directive. The skip positions and lexer offsets are computed when the file is minimized, directly from the minimized tokens. On an 18-core iMacPro with macOS Catalina Beta I got 10-15% speed-up from this optimization when running clang-scan-deps on the compilation database for a recent LLVM and Clang (3511 files). Differential Revision: https://reviews.llvm.org/D67127 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@371656 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix -Wnonportable-include-path suppression for header maps with absolute paths.Volodymyr Sapsai2019-09-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | In `DirectoryLookup::LookupFile` parameter `HasBeenMapped` doesn't cover the case when clang finds a file through a header map but doesn't remap the lookup filename because the target path is an absolute path. As a result, -Wnonportable-include-path suppression for header maps introduced in r301592 wasn't triggered. Change parameter `HasBeenMapped` to `IsInHeaderMap` and use parameter `MappedName` to track the filename remapping. This way we can handle both relative and absolute paths in header maps, and account for their specific properties, like filename remapping being a property preserved across lookups in multiple directories. rdar://problem/39516483 Reviewers: dexonsmith, bruno Reviewed By: dexonsmith Subscribers: jkorous, cfe-commits, ributzka Differential Revision: https://reviews.llvm.org/D58094 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@371655 91177308-0d34-0410-b5e6-96231b3b80d8
* Reland "clang-misexpect: Profile Guided Validation of Performance ↵Petr Hosek2019-09-112-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Annotations in LLVM" This patch contains the basic functionality for reporting potentially incorrect usage of __builtin_expect() by comparing the developer's annotation against a collected PGO profile. A more detailed proposal and discussion appears on the CFE-dev mailing list (http://lists.llvm.org/pipermail/cfe-dev/2019-July/062971.html) and a prototype of the initial frontend changes appear here in D65300 We revised the work in D65300 by moving the misexpect check into the LLVM backend, and adding support for IR and sampling based profiles, in addition to frontend instrumentation. We add new misexpect metadata tags to those instructions directly influenced by the llvm.expect intrinsic (branch, switch, and select) when lowering the intrinsics. The misexpect metadata contains information about the expected target of the intrinsic so that we can check against the correct PGO counter when emitting diagnostics, and the compiler's values for the LikelyBranchWeight and UnlikelyBranchWeight. We use these branch weight values to determine when to emit the diagnostic to the user. A future patch should address the comment at the top of LowerExpectIntrisic.cpp to hoist the LikelyBranchWeight and UnlikelyBranchWeight values into a shared space that can be accessed outside of the LowerExpectIntrinsic pass. Once that is done, the misexpect metadata can be updated to be smaller. In the long term, it is possible to reconstruct portions of the misexpect metadata from the existing profile data. However, we have avoided this to keep the code simple, and because some kind of metadata tag will be required to identify which branch/switch/select instructions are influenced by the use of llvm.expect Patch By: paulkirth Differential Revision: https://reviews.llvm.org/D66324 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@371635 91177308-0d34-0410-b5e6-96231b3b80d8
* [OPENMP] Update the diagnosis message for canonical loop form, by ChiAlexey Bataev2019-09-111-1/+1
| | | | | | | | | | | | | | | Chun Chen. The previous patch (https://reviews.llvm.org/D54441) support the relational-op != very well for openmp canonical loop form, however, it didn't update the diagnosis message. So this patch is simply update the diagnosis message by adding !=, update the test related to it, and update the section number for canonical loop form for OpenMP 5.0 in comment. Differential Revision: https://reviews.llvm.org/D66559 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@371631 91177308-0d34-0410-b5e6-96231b3b80d8
* [Diagnostics] Add -Wsizeof-array-divDavid Bolvansky2019-09-111-0/+4
| | | | | | | | | | Summary: Clang version of https://www.viva64.com/en/examples/v706/ Reviewers: rsmith Differential Revision: https://reviews.llvm.org/D67287 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@371605 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "clang-misexpect: Profile Guided Validation of Performance ↵Dmitri Gribenko2019-09-112-7/+1
| | | | | | | | | | | | | | | | | | | Annotations in LLVM" This reverts commit r371584. It introduced a dependency from compiler-rt to llvm/include/ADT, which is problematic for multiple reasons. One is that it is a novel dependency edge, which needs cross-compliation machinery for llvm/include/ADT (yes, it is true that right now compiler-rt included only header-only libraries, however, if we allow compiler-rt to depend on anything from ADT, other libraries will eventually get used). Secondly, depending on ADT from compiler-rt exposes ADT symbols from compiler-rt, which would cause ODR violations when Clang is built with the profile library. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@371598 91177308-0d34-0410-b5e6-96231b3b80d8
* [ARM] Take into account -mcpu and -mfpu options while handling 'crypto' featureDiogo N. Sampaio2019-09-111-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Submittin in behalf of krisb (Kristina Bessonova) <ch.bessonova@gmail.com> Summary: '+crypto' means '+aes' and '+sha2' for arch >= ARMv8 when they were not disabled explicitly. But this is correctly handled only in case of '-march' option, though the feature may also be specified through the '-mcpu' or '-mfpu' options. In the following example: $ clang -mcpu=cortex-a57 -mfpu=crypto-neon-fp-armv8 'aes' and 'sha2' are disabled that is quite unexpected: $ clang -cc1 -triple armv8--- -target-cpu cortex-a57 <...> -target-feature -sha2 -target-feature -aes -target-feature +crypto This exposed by https://reviews.llvm.org/D63936 that makes the 'aes' and 'sha2' features disabled by default. So, while handling the 'crypto' feature we need to take into account: - a CPU name, as it provides the information about architecture (if no '-march' option specified), - features, specified by the '-mcpu' and '-mfpu' options. Reviewers: SjoerdMeijer, ostannard, labrinea, dnsampaio Reviewed By: dnsampaio Subscribers: ikudrin, javed.absar, kristof.beyls, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66018 Author: krisb git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@371597 91177308-0d34-0410-b5e6-96231b3b80d8