summaryrefslogtreecommitdiffstats
path: root/clang/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* clang/Modules: Clean up modules on error in ReadASTDuncan P. N. Exon Smith2019-11-111-14/+18
| | | | | | | | ReadASTBlock and ReadASTExtensions can both return failures. Be consistent and remove all the just-loaded modules, just like when ReadASTCore returns failures. https://reviews.llvm.org/D70055
* clang/Modules: Add missing diagnostics for malformed AST filesDuncan P. N. Exon Smith2019-11-111-2/+6
| | | | | | | These were found via an audit. In the case of `ParseLineTable` this is actually dead code, since parsing the line table always succeeds, but it's prudent to be defensive since it's possible an assertion there could be converted to a `true` return in the future.
* clang/Modules: Split loop in ReadAST between failable and notDuncan P. N. Exon Smith2019-11-111-1/+7
| | | | | | | | | | | | | Split a loop in ReadAST that visits the just-loaded module chain, between an initial loop that reads further from the ASTs (and can fail) and a second loop that does some preloading (and cannot fail). This makes it less likely for a reading failure to affect the AST. This is not fixing a known bug and the behaviour change may not be observable, it's just part of an audit to look at all of the error handling in the ASTReader. https://reviews.llvm.org/D70056
* clang/Modules: Use range-based for in ASTReader::ReadAST, NFCDuncan P. N. Exon Smith2019-11-111-11/+7
|
* clang/Modules: Delay err_module_file_conflict if a diagnostic is in flightDuncan P. N. Exon Smith2019-11-112-12/+10
| | | | | | | As part of an audit of whether all errors are being reported from the ASTReader, delay err_module_file_conflict if a diagnostic is already in flight when it is hit. This required plumbing an extra argument through the delayed diagnostic mechanics in DiagnosticsEngine.
* [OPENMP50]Generalize handling of context matching/scoring.Alexey Bataev2019-11-115-110/+240
| | | | | | | | | | | | | | Summary: Untie context matching/scoring from the attribute for declare variant directive to simplify future uses in other context-dependent directives. Reviewers: jdoerfert Subscribers: guansong, kkwli0, caomhin, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D69952
* [OPENMP50]Add support for nested atomic and simd constructs inAlexey Bataev2019-11-111-3/+12
| | | | | | | | simd-based directives. According to OpenMP 5.0 standard, ordered simd, atomic and simd directives are allowed as nested directives in the simd-based directives.
* [libTooling] Further simplify `Stencil` type and introduce `MatchComputation`.Yitzhak Mandelbaum2019-11-112-26/+42
| | | | | | | | | | | | | | | | | | | | Summary: This revision introduces a new interface `MatchComputation` which generalizes the `Stencil` interface and replaces the `std::function` interface of `MatchConsumer`. With this revision, `Stencil` (as an abstraction) becomes just one collection of implementations of `MatchComputation<std::string>`. Correspondingly, we remove the `Stencil` class entirely in favor of a simple type alias, deprecate `MatchConsumer` and change all functions that accepted `MatchConsumer<std::string>` to use `MatchComputation<std::string>` instead. Reviewers: gribozavr Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D69802
* clang-format: [JS] support null operators.Martin Probst2019-11-112-0/+14
| | | | | | | | | | | | | | | | | | | Summary: JavaScript / TypeScript is adding two new operators: the null propagating operator `?.` and the nullish coalescing operator `??`. const x = foo ?? 'default'; const z = foo?.bar?.baz; This change adds support to lex and format both. Reviewers: krasimir Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D69971
* Revert cdcf58e5af0 "[RISCV] enable LTO support, pass some options to linker."Hans Wennborg2019-11-115-136/+89
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This started passing target-features on the linker line, not just for RISCV but for all targets, leading to error messages in Chromium Android build: '+soft-float-abi' is not a recognized feature for this target (ignoring feature) '+soft-float-abi' is not a recognized feature for this target (ignoring feature) See Phabricator review for details. Reverting until this can be fixed properly. > Summary: > 1. enable LTO need to pass target feature and abi to LTO code generation > RISCV backend need the target feature to decide which extension used in > code generation. > 2. move getTargetFeatures to CommonArgs.h and add ForLTOPlugin flag > 3. add general tools::getTargetABI in CommonArgs.h because different target uses different > way to get the target ABI. > > Patch by Kuan Hsu Chen (khchen) > > Reviewers: lenary, lewis-revill, asb, MaskRay > > Reviewed By: lenary > > Subscribers: hiraditya, dschuff, aheejin, fedor.sergeev, mehdi_amini, inglorion, asb, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, kito-cheng, shiva0217, jrtc27, MaskRay, zzheng, edward-jones, steven_wu, rogfer01, MartinMosbeck, brucehoult, the_o, dexonsmith, rkruppe, PkmX, jocewei, psnobl, benna, Jim, lenary, s.egerton, pzheng, cfe-commits > > Tags: #clang > > Differential Revision: https://reviews.llvm.org/D67409
* clang/Modules: Remove unused parameter from ModuleManager::removeModulesDuncan P. N. Exon Smith2019-11-102-9/+2
| | | | | | The other paremeters appear to be sufficient to determine which modules have just been loaded and need to be removed, so stop collecting and sending in that set explicitly.
* [Driver] Remove unused variable. NFC.Benjamin Kramer2019-11-101-1/+0
|
* Fix variable ‘LookedUpGetterSetter’ set but not used warning. NFCI.Simon Pilgrim2019-11-091-2/+0
|
* Revert "[BPF] Add preserve_access_index attribute for record definition"Yonghong Song2019-11-092-133/+8
| | | | | | This reverts commit 4a5aa1a7bf8b1714b817ede8e09cd28c0784228a. There are some other test failures. Investigate them first.
* [BPF] Add preserve_access_index attribute for record definitionYonghong Song2019-11-092-8/+133
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch introduced a new bpf specific attribute which can be added to struct or union definition. For example, struct s { ... } __attribute__((preserve_access_index)); union u { ... } __attribute__((preserve_access_index)); The goal is to simplify user codes for cases where preserve access index happens for certain struct/union, so user does not need to use clang __builtin_preserve_access_index for every members. The attribute has no effect if -g is not specified. When the attribute is specified and -g is specified, any member access defined by that structure or union, including array subscript access and inner records, will be preserved through __builtin_preserve_{array,struct,union}_access_index() IR intrinsics, which will enable relocation generation in bpf backend. The following is an example to illustrate the usage: -bash-4.4$ cat t.c #define __reloc__ __attribute__((preserve_access_index)) struct s1 { int c; } __reloc__; struct s2 { union { struct s1 b[3]; }; } __reloc__; struct s3 { struct s2 a; } __reloc__; int test(struct s3 *arg) { return arg->a.b[2].c; } -bash-4.4$ clang -target bpf -g -S -O2 t.c A relocation with access string "0:0:0:0:2:0" will be generated representing access offset of arg->a.b[2].c. forward declaration with attribute is also handled properly such that the attribute is copied and populated in real record definition. Differential Revision: https://reviews.llvm.org/D69759
* [Parser] Warn when ScopeDepthOrObjCQuals overflowsMark de Wever2019-11-091-0/+13
| | | | | | | | | Before when the overflow occured an assertion was triggered. Now check whether the maximum has been reached and warn properly. This patch fixes the original submission of PR19607. Differential Revision: https://reviews.llvm.org/D63975
* [NFC] Supress GCC "Bitfield too small to hold all values of enum" warning.Richard Smith2019-11-091-8/+8
| | | | | | Patch by Wang Tianqing! Differential Revision: https://reviews.llvm.org/D69792
* [Diagnostics] Fixed crash with non pointer type (PR43950)Dávid Bolvanský2019-11-091-1/+2
|
* [analyzer] Fix skipping the call during inlined defensive check suppression.Artem Dergachev2019-11-081-11/+12
| | | | | | | | | | | | | | | | | | | | | When bugreporter::trackExpressionValue() is invoked on a DeclRefExpr, it tries to do most of its computations over the node in which this DeclRefExpr is computed, rather than on the error node (or whatever node is stuffed into it). One reason why we can't simply use the error node is that the binding to that variable might have already disappeared from the state by the time the bug is found. In case of the inlined defensive checks visitor, the DeclRefExpr node is in fact sometimes too *early*: the call in which the inlined defensive check has happened might have not been entered yet. Change the visitor to be fine with tracking dead symbols (which it is totally capable of - the collapse point for the symbol is still well-defined), and fire it up directly on the error node. Keep using "LVState" to find out which value should we be tracking, so that there weren't any problems with accidentally loading an ill-formed value from a dead variable. Differential Revision: https://reviews.llvm.org/D67932
* [analyzer] Nullability: Don't infer nullable when passing as nullable parameter.Artem Dergachev2019-11-081-5/+0
| | | | You can't really infer anything from that.
* [clang][IFS] Adds support for more decl types in clang interface stubs.Puyan Lotfi2019-11-081-6/+32
| | | | | | | | | | | | | Adding support for processing the following Decls: NonTypeTemplateParmDecl, CXXConversionDecl, UnresolvedUsingValueDecl, UsingDecl, UsingShadowDecl, TypeAliasTemplateDecl, TypeAliasDecl, VarTemplateDecl, VarTemplateSpecializationDecl, UsingDirectiveDecl, TemplateTemplateParmDecl, ClassTemplatePartialSpecializationDecl, IndirectFieldDecl. Also, this allows for processing NamedDecls that don't have an identifier and skips over VarDecls that are dependent on template types. Differential Revision: https://reviews.llvm.org/D69995
* Debug Info: Nest Objective-C property function decls inside their container.Adrian Prantl2019-11-082-25/+53
| | | | | | | | | | | | | | | | | | This has the nice side-effect of also fixing a crash in Clang. Starting with DWARF 5 we are emitting ObjC method declarations as children of their containing entity. This worked for interfaces, but didn't consider the case of synthessized properties. When a property of a protocol is synthesized in an interface implementation the ObjCMethodDecl that was passed to CGF::StartFunction was the property *declaration* which obviously couldn't have a containing interface. This patch passes the containing interface all the way through to CGDebugInfo, so the function declaration can be created with the correct parent (= the class implementing the protocol). rdar://problem/53782400 Differential Revision: https://reviews.llvm.org/D66121
* Revert "Reland "[clang] Report sanitizer blacklist as a dependency in cc1""Jan Korous2019-11-082-12/+37
| | | | This reverts commit cae4a28864f4e8a55920e2b94e2cd43617902dec.
* Revert "Reapply "Fix crash on switch conditions of non-integer types in ↵Melanie Blower2019-11-082-11/+0
| | | | | | | templates"" This reverts commit 759948467ea3181615d44d80f74ffeb260180fd0. There were build bot failures in clang-tidy
* Basic: fix FileManager invalidation issue for file redirectAlex Suhan2019-11-081-7/+11
| | | | | Insertion into SeenFileEntries can invalidate iterators, we need to do another lookup on the re-intern path.
* [clang] Fix -fsanitize-system-blacklist processing in cc1Jan Korous2019-11-081-0/+5
|
* Reland "[clang] Report sanitizer blacklist as a dependency in cc1"Jan Korous2019-11-082-37/+12
| | | | This reverts commit 3182027282c59c51d5080d83365917fccd695854.
* Reland "[clang] Report sanitizer blacklist as a dependency in cc1"Jan Korous2019-11-082-12/+37
| | | | This reverts commit 9b8413ac6e56e7a6e0ba884773d13bcf9414bd43.
* [clang] Add VFS support for sanitizers' blacklistsJan Korous2019-11-082-4/+8
| | | | Differential Revision: https://reviews.llvm.org/D69648
* Reapply "Fix crash on switch conditions of non-integer types in templates"Melanie Blower2019-11-082-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | This patch reapplies commit 76945821b9cad3. The first version broke buildbots due to clang-tidy test fails. The fails are because some errors in templates are now diagnosed earlier (does not wait till instantiation). I have modified the tests to add checks for these diagnostics/prevent these diagnostics. There are no additional code changes. Summary of code changes: Clang currently crashes for switch statements inside a template when the condition is a non-integer field member because contextual implicit conversion is skipped when parsing the condition. This conversion is however later checked in an assert when the case statement is handled. The conversion is skipped when parsing the condition because the field member is set as type-dependent based on its containing class. This patch sets the type dependency based on the field's type instead. This patch fixes Bug 40982. Reviewers: rnk, gribozavr2 Patch by: Elizabeth Andrews (eandrews) Differential revision: https://reviews.llvm.org/D69950
* remove redundant LLVM version from version string when setting CLANG_VENDORNick Desaulniers2019-11-081-5/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: When downstream LLVM distributions (like AOSP) set the CLANG_VENDOR cmake variable, the version string printed by the clang driver looks like: $ clang --version [CLANG_VENDOR] clang version X.X.X ([CLANG_REPOSITORY_STRING] sha) (based on LLVM X.X.X) Rather than the more standard: $ clang --version clang version X.X.X ([CLANG_REPOSITORY_STRING] sha) Based on feedback the the version string is a little long, the trailing "(based on LLVM X.X.X)" is redundant and makes less sense after moving LLVM to the monorepo. And it is only added should vendors set the cmake variable CLANG_VENDOR. Let's remove it. Reviewers: jyknight, eli.friedman, rsmith, rjmccall, efriedma Reviewed By: efriedma Subscribers: arphaman, efriedma, cfe-commits, srhines Tags: #clang Differential Revision: https://reviews.llvm.org/D69925
* Redeclare Objective-C property accessors inside the ObjCImplDecl in which ↵Adrian Prantl2019-11-0819-173/+289
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | they are synthesized. This patch is motivated by (and factored out from) https://reviews.llvm.org/D66121 which is a debug info bugfix. Starting with DWARF 5 all Objective-C methods are nested inside their containing type, and that patch implements this for synthesized Objective-C properties. 1. SemaObjCProperty populates a list of synthesized accessors that may need to inserted into an ObjCImplDecl. 2. SemaDeclObjC::ActOnEnd inserts forward-declarations for all accessors for which no override was provided into their ObjCImplDecl. This patch does *not* synthesize AST function *bodies*. Moving that code from the static analyzer into Sema may be a good idea though. 3. Places that expect all methods to have bodies have been updated. I did not update the static analyzer's inliner for synthesized properties to point back to the property declaration (see test/Analysis/Inputs/expected-plists/nullability-notes.m.plist), which I believed to be more bug than a feature. Differential Revision: https://reviews.llvm.org/D68108 rdar://problem/53782400
* Revert "Revert "Revert "[clang] Report sanitizer blacklist as a dependency ↵Abel Kocsis2019-11-082-37/+12
| | | | | | in cc1""" This reverts commit 3182027282c59c51d5080d83365917fccd695854.
* Revert "Revert "[clang] Report sanitizer blacklist as a dependency in cc1""Abel Kocsis2019-11-082-12/+37
| | | | This reverts commit 6b45e1bc11e91ea7b57a6ab1c19461a86dba33f8.
* Revert "[clang] Report sanitizer blacklist as a dependency in cc1"Jeremy Morse2019-11-082-37/+12
| | | | | | | | | | This reverts commit 03b84e4f6d0e1c04f22d69cc445f36e1f713beb4. This breaks dfsan tests with a linking failure, in for example this build: http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux/builds/24312 Reverting this patch locally makes those tests succeed.
* [Analyzer] Checker for Debugging Iterator CheckersAdam Balogh2019-11-081-2/+155
| | | | | | | | | For white-box testing correct container and iterator modelling it is essential to access the internal data structures stored for container and iterators. This patch introduces a simple debug checkers called debug.IteratorDebugging to achieve this. Differential Revision: https://reviews.llvm.org/D67156
* [PowerPC][Altivec] Fix offsets for vec_xl and vec_xstNemanja Ivanovic2019-11-071-20/+40
| | | | | | | | As we currently have it implemented in altivec.h, the offsets for these two intrinsics are element offsets. The documentation in the ABI (as well as the implementation in both XL and GCC) states that these should be byte offsets. Differential revision: https://reviews.llvm.org/D63636
* [PowerPC][Altivec] Emit correct builtin for single precision vec_all_neNemanja Ivanovic2019-11-071-1/+1
| | | | | | | We currently emit a double precision comparison instruction for this, whereas we need to emit the single precision version. Differential revision: https://reviews.llvm.org/D64024
* [analyzer] PR41729: CStringChecker: Improve strlcat and strlcpy modeling.Artem Dergachev2019-11-071-135/+166
| | | | | | | | | | | - Fix false positive reports of strlcat. - The return value of strlcat and strlcpy is now correctly calculated. - The resulting string length of strlcat and strlcpy is now correctly calculated. Patch by Daniel Krupp! Differential Revision: https://reviews.llvm.org/D66049
* [SEH] Defer checking filter expression types until instantiatonReid Kleckner2019-11-071-11/+8
| | | | | | | | | | | While here, wordsmith the error a bit. Now clang says: error: filter expression has non-integral type 'Foo' Fixes PR43779 Reviewers: amccarth Differential Revision: https://reviews.llvm.org/D69969
* [clang] Report sanitizer blacklist as a dependency in cc1Jan Korous2019-11-072-12/+37
| | | | | | | | Previously these were reported from the driver which blocked clang-scan-deps from getting the full set of dependencies from cc1 commands. Also the default sanitizer blacklist that is added in driver was never reported as a dependency. I introduced -fsanitize-system-blacklist cc1 option to keep track of which blacklists were user-specified and which were added by driver and clang -MD now also reports system blacklists as dependencies. Differential Revision: https://reviews.llvm.org/D69290
* [Diagnostics] Teach -Wnull-dereference about address_space attributeDávid Bolvanský2019-11-071-9/+14
| | | | | | | | | | | | | | | | | | | | | | Summary: Clang should not warn for: > test.c:2:12: warning: indirection of non-volatile null pointer will be deleted, > not trap [-Wnull-dereference] > return *(int __attribute__((address_space(256))) *) 0; > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Solves PR42292. Reviewers: aaron.ballman, rsmith Reviewed By: aaron.ballman Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D69664
* [CodeGenModule] Group blocks runtime globals together, NFCVedant Kumar2019-11-071-4/+4
|
* [Sema] Fixes a crash with a templated destructorMark de Wever2019-11-071-4/+3
| | | | | | | | The issue was introduced by D33189 which fixed PR33189. Fixes PR38671: "destructor cannot be declared as a template" leads to segfault in Sema::LookupSpecialMember Differential Revision: https://reviews.llvm.org/D69225
* [clang] Add -fdebug-default-version for specifying the default DWARF versionDavid Blaikie2019-11-073-1/+30
| | | | | | | | | | This flag decouples specifying the DWARF version from enabling/disabling DWARF in general (or the gN level - gmlt/limited/standalone, etc) while still allowing existing -gdwarf-N flags to override this default. Patch by Caroline Tice! Differential Revision: https://reviews.llvm.org/D69822
* Revert "[Sema] Suppress -Wchar-subscripts if the index is a literal char"Edward Jones2019-11-071-2/+1
| | | | This reverts commit 7adab7719e55e1b29bfd521dcc73f202139e8f41.
* [Sema] Suppress -Wchar-subscripts if the index is a literal charEdward Jones2019-11-071-1/+2
| | | | | | | | Assume that the user knows what they're doing if they provide a char literal as an array index. This more closely matches the behavior of GCC. Differential Revision: https://reviews.llvm.org/D58896
* Add support for options -frounding-math, ftrapping-math, -ffp-model=, and ↵Melanie Blower2019-11-074-9/+282
| | | | | | | | | | | | -ffp-exception-behavior= Add options to control floating point behavior: trapping and exception behavior, rounding, and control of optimizations that affect floating point calculations. More details in UsersManual.rst. Reviewers: rjmccall Differential Revision: https://reviews.llvm.org/D62731
* [RISCV] Improve sysroot computation if no GCC install detectedEdward Jones2019-11-071-7/+14
| | | | | | | | | | If a GCC installed is not detected, the driver would default to the root of the filesystem. This is not ideal when this doesn't match the install directory of the toolchain and can cause undesireable behavior such as picking up system libraries or the system linker when cross-compiling. Differential Revision: https://reviews.llvm.org/D68391
* [OpenCL] Add geometric and relational builtin functionsSven van Haastregt2019-11-071-0/+100
| | | | | | | | | Add the geometric and relational builtin functions from the OpenCL C specification. Patch by Pierre Gondois and Sven van Haastregt. Differential Revision: https://reviews.llvm.org/D69908
OpenPOWER on IntegriCloud