summaryrefslogtreecommitdiffstats
path: root/clang/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* [Frontend] Return an error on bad inputs to PrecompiledPreabmleIlya Biryukov2019-05-222-8/+10
| | | | | | | | | | | | | | | | | | Summary: Instead of failing with assertions. Fixes a crash found by oss-fuzz: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=12865 Reviewers: sammccall Reviewed By: sammccall Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D62137 llvm-svn: 361376
* [ARM][AArch64] Fix incorrect handling of alignment in va_arg code generationJohn Brawn2019-05-222-15/+15
| | | | | | | | | | | | | Overaligned and underaligned types (i.e. types where the alignment has been increased or decreased using the aligned and packed attributes) weren't being correctly handled in all cases, as the unadjusted alignment should be used. This patch also adjusts getTypeUnadjustedAlign to correctly handle typedefs of non-aggregate types, which it appears it never had to handle before. Differential Revision: https://reviews.llvm.org/D62152 llvm-svn: 361372
* [Driver][Windows] Add dependent lib argument for -fprofile-generate and ↵Russell Gallop2019-05-221-0/+4
| | | | | | | | | | -fcs-profile-generate Follows on from r360674 which added it for -fprofile-instr-generate. Differential Revision: https://reviews.llvm.org/D62200 llvm-svn: 361368
* [PPC64] Fix PPC64TargetInfo ABI on clang side after D61950Fangrui Song2019-05-221-1/+2
| | | | llvm-svn: 361365
* [PPC64] Fix PPC64TargetInfo after D61950Fangrui Song2019-05-221-0/+1
| | | | llvm-svn: 361363
* [PPC64] Parse -elfv1 -elfv2 when specified on target tripleFangrui Song2019-05-221-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: For big-endian powerpc64, the default ABI is ELFv1. OpenPower ABI ELFv2 is supported when -mabi=elfv2 is specified. FreeBSD support for PowerPC64 ELFv2 ABI with LLVM is in progress[1]. This patch adds an alternative way to specify ELFv2 ABI on target triple [2]. The following results are expected: ELFv1 when using: -target powerpc64-unknown-freebsd12.0 -target powerpc64-unknown-freebsd12.0 -mabi=elfv1 -target powerpc64-unknown-freebsd12.0-elfv1 ELFv2 when using: -target powerpc64-unknown-freebsd12.0 -mabi=elfv2 -target powerpc64-unknown-freebsd12.0-elfv2 [1] https://wiki.freebsd.org/powerpc/llvm-elfv2 [2] https://clang.llvm.org/docs/CrossCompilation.html Patch by Alfredo Dal'Ava Júnior! Differential Revision: https://reviews.llvm.org/D61950 llvm-svn: 361355
* Fixed a -Wunused-variable warning when assertions are disabledDmitri Gribenko2019-05-221-0/+1
| | | | llvm-svn: 361353
* [PragmaHandler] Expose `#pragma` locationJoel E. Denny2019-05-214-104/+99
| | | | | | | | | | | | | | | | | | | | | | | Currently, a pragma AST node's recorded location starts at the namespace token (such as `omp` in the case of OpenMP) after the `#pragma` token, and the `#pragma` location isn't available. However, the `#pragma` location can be useful when, for example, rewriting a directive using Clang's Rewrite facility. This patch makes `#pragma` locations available in any `PragmaHandler` but it doesn't yet make use of them. This patch also uses the new `struct PragmaIntroducer` to simplify `Preprocessor::HandlePragmaDirective`. It doesn't do the same for `PPCallbacks::PragmaDirective` because that changes the API documented in `clang-tools-extra/docs/pp-trace.rst`, and I'm not sure about backward compatibility guarantees there. Reviewed By: ABataev, lebedev.ri, aaron.ballman Differential Revision: https://reviews.llvm.org/D61643 llvm-svn: 361335
* [c++20] P1330R0: permit simple-assignments that change the active memberRichard Smith2019-05-211-7/+195
| | | | | | of a union within constant expression evaluation. llvm-svn: 361329
* Refactor: split Uninitialized state on APValue into an "Absent" stateRichard Smith2019-05-217-29/+46
| | | | | | | representing no such object, and an "Indeterminate" state representing an uninitialized object. The latter is not yet used, but soon will be. llvm-svn: 361328
* [Driver] Verify GCCInstallation is validNick Desaulniers2019-05-211-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | Summary: Values returned by GCCInstallation.getParentLibPath() and GCCInstallation.getTriple() are not valid unless GCCInstallation.isValid() returns true. This has previously been ignored, and the former two values were used without checking whether GCCInstallation is valid. This led to the bad path "/../bin" being added to the list of program paths. author: danielmentz "Daniel Mentz <danielmentz@google.com>" Reviewers: #clang, tstellar, srhines Reviewed By: srhines Subscribers: danielmentz, ormris, nickdesaulniers, srhines, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D57930 llvm-svn: 361314
* Let -static-pie win if it is specified along with -pie or -static.Siva Chandra2019-05-211-7/+28
| | | | | | | | Also, disallow specifying -no-pie/-nopie along with -static-pie. Differential Revision: https://reviews.llvm.org/D59841 llvm-svn: 361312
* [c++20] P0780R2: Support pack-expansion of init-captures.Richard Smith2019-05-2117-207/+370
| | | | | | | | | | | This permits an init-capture to introduce a new pack: template<typename ...T> auto x = [...a = T()] { /* a is a pack */ }; To support this, the mechanism for allowing ParmVarDecls to be packs has been extended to support arbitrary local VarDecls. llvm-svn: 361300
* [OpenMP] Add support for registering requires directives with the runtimeGheorghe-Teodor Bercea2019-05-215-5/+113
| | | | | | | | | | | | | | | | | | | | | | | Summary: This patch adds support for the registration of the requires directives with the runtime. Each requires directive clause will enable a particular flag to be set. The set of flags is passed to the runtime to be checked for compatibility with other such flags coming from other object files. The registration function is called whenever OpenMP is present even if a requires directive is not present. This helps detect cases in which requires directives are used inconsistently. Reviewers: ABataev, AlexEichenberger, caomhin Reviewed By: ABataev, AlexEichenberger Subscribers: jholewinski, guansong, jfb, jdoerfert, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D60568 llvm-svn: 361298
* [DebugInfo] Don't emit checksums when compiling a preprocessed CPPAlexandre Ganea2019-05-212-3/+12
| | | | | | | | Fixes PR41215 Differential Revision: https://reviews.llvm.org/D60283 llvm-svn: 361296
* [OPENMP]Use the attributes for dso locality when building for device.Alexey Bataev2019-05-211-1/+1
| | | | | | | | | Currently, we ignore all dso locality attributes/info when building for the device and thus all symblos are externally visible and can be preemted at the runtime. It may lead to incorrect results. We need to follow the same logic, compiler uses for static/pie builds. llvm-svn: 361283
* [clang][Darwin] Refactor header search path logic into the driverLouis Dionne2019-05-213-63/+182
| | | | | | | | | | | | | | | | | | | | | | | Summary: This commit moves the logic for determining system, resource and C++ header search paths from CC1 to the driver. This refactor has already been made for several platforms, but Darwin had been left behind. This refactor tries to implement the previous search path logic with perfect accuracy. In particular, the order of all include paths inside CC1 and all paths that were skipped because nonexistent are conserved after the refactor. This change was also tested against a code base of significant size and revealed no problems. Reviewers: jfb, arphaman Subscribers: nemanjai, javed.absar, kbarton, christof, jkorous, dexonsmith, jsji, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D61963 llvm-svn: 361278
* Do not use the incorrect attribute spelling list index when translating a ↵Aaron Ballman2019-05-211-3/+15
| | | | | | | | no_sanitize_foo attribute into a no_sanitize("foo") attribute. This fixes a crash when AST pretty printing declarations marked with no_sanitize_memory. llvm-svn: 361274
* [OPENMP][NVPTX]Mark more functions as always_inline for betterAlexey Bataev2019-05-212-9/+26
| | | | | | | | | | | performance. Internally generated functions must be marked as always_inlines in most cases. Patch marks some extra reduction function + outlined parallel functions as always_inline for better performance, but only if the optimization is requested. llvm-svn: 361269
* Add support for dumping AST comment nodes to JSON.Aaron Ballman2019-05-212-2/+141
| | | | llvm-svn: 361265
* [ARM][CMSE] Add commandline option and feature macroJaved Absar2019-05-214-0/+17
| | | | | | | | | | | Defines macro ARM_FEATURE_CMSE to 1 for v8-M targets and introduces -mcmse option which for v8-M targets sets ARM_FEATURE_CMSE to 3. A diagnostic is produced when the option is given on architectures without support for Security Extensions. Reviewed By: dmgreen, snidertm Differential Revision: https://reviews.llvm.org/D59879 llvm-svn: 361261
* [CodeGenModule] BlockByrefHelpers - add missing uninitialized variables to ↵Simon Pilgrim2019-05-211-1/+2
| | | | | | constructor. NFCI. llvm-svn: 361242
* [CGBuiltin] dumpRecord - remove unused field offset. NFCI.Simon Pilgrim2019-05-211-5/+0
| | | | llvm-svn: 361238
* [Preamble] Reuse preamble even if an unsaved file does not existNikolai Kosjar2019-05-212-17/+33
| | | | | | | | | | | | | | | | | | | | | When a preamble is created an unsaved file not existing on disk is already part of PrecompiledPreamble::FilesInPreamble. However, when checking whether the preamble can be re-used, a failed stat of such an unsaved file invalidated the preamble, which led to pointless and time consuming preamble regenerations on subsequent reparses. Do not require anymore that unsaved files should exist on disk. This avoids costly preamble invalidations depending on timing issues for the cases where the file on disk might be removed just to be regenerated a bit later. It also allows an IDE to provide in-memory files that might not exist on disk, e.g. because the build system hasn't generated those yet. Differential Revision: https://reviews.llvm.org/D41005 llvm-svn: 361226
* [Sema] Fix for build on some iOS programs.Leonard Chan2019-05-201-1/+5
| | | | | | | | Nullability attributes weren't being stripped for AttributedTypes that were wrapped in a MacroQualifiedType. This fix adds a check for this type and a test. llvm-svn: 361205
* Add more tests for AST JSON output; NFC.Aaron Ballman2019-05-201-1/+3
| | | | | | This adds tests for dumping expressions in C. It also updates a comment to note an issue to be fixed with printing character literals discovered as part of this testing. llvm-svn: 361193
* Rearrange and clean up how we disambiguate lambda-introducers from ObjCRichard Smith2019-05-203-110/+167
| | | | | | | | | | | | | | | | message sends, designators, and attributes. Instead of having the tentative parsing phase sometimes return an indicator to say what diagnostic to produce if parsing fails and sometimes ask the caller to run it again, consistently ask the caller to try parsing again if tentative parsing would fail or is otherwise unable to completely parse the lambda-introducer without producing an irreversible semantic effect. Mostly NFC, but we should recover marginally better in some error cases (avoiding duplicate diagnostics). llvm-svn: 361182
* Dump macro expansion information as needed when outputting the AST to JSON.Aaron Ballman2019-05-201-3/+25
| | | | llvm-svn: 361172
* [Intrinsics] Merge lround.i32 and lround.i64 into a single intrinsic with ↵Craig Topper2019-05-201-8/+15
| | | | | | | | | | overloaded result type. Make result type for llvm.llround overloaded instead of fixing to i64 We shouldn't really make assumptions about possible sizes for long and long long. And longer term we should probably support vectorizing these intrinsics. By making the result types not fixed we can support vectors as well. Differential Revision: https://reviews.llvm.org/D62026 llvm-svn: 361169
* [LibTooling] Add RangeSelector library for defining source ranges based on ↵Yitzhak Mandelbaum2019-05-202-0/+265
| | | | | | | | | | | | | | | | | | | | | | bound AST nodes. Summary: The RangeSelector library defines a combinator language for specifying source ranges based on bound ids for AST nodes. The combinator approach follows the design of the AST matchers. The RangeSelectors defined here will be used in both RewriteRule, for specifying source affected by edit, and in Stencil for specifying source to use constructively in a replacement. Reviewers: ilya-biryukov Subscribers: mgorny, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D61774 llvm-svn: 361152
* [Syntax] Introduce TokenBuffer, start clangToolingSyntax libraryIlya Biryukov2019-05-203-0/+520
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: TokenBuffer stores the list of tokens for a file obtained after preprocessing. This is a base building block for syntax trees, see [1] for the full proposal on syntax trees. This commits also starts a new sub-library of ClangTooling, which would be the home for the syntax trees and syntax-tree-based refactoring utilities. [1]: https://lists.llvm.org/pipermail/cfe-dev/2019-February/061414.html Reviewers: gribozavr, sammccall Reviewed By: sammccall Subscribers: mgrang, riccibruno, Eugene.Zelenko, mgorny, jdoerfert, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D59887 llvm-svn: 361148
* Fix compilation warning about unused variable [NFC]Mikael Holmen2019-05-201-1/+1
| | | | | | | | | | | Without the fix at least clang 3.6 complains with ../tools/clang/lib/AST/ExprConstant.cpp:90:24: error: unused variable 'TI' [-Werror,-Wunused-variable] if (TypeInfoLValue TI = B.dyn_cast<TypeInfoLValue>()) ^ 1 error generated. llvm-svn: 361145
* [Analyzer] Refactor begin and end symbol creationAdam Balogh2019-05-201-22/+36
| | | | | | | | | | | | This patch refactors begin and end symbol creation by moving symbol conjuration into the `create...` functions. This way the functions' responsibilities are clearer and makes possible to add more functions handling these symbols (e.g. functions for handling the container's size) without code multiplication. Differential Revision: https://reviews.llvm.org/D61136 llvm-svn: 361141
* Fix buildbot: Use correct Consume*() for braces.Nicolas Lesser2019-05-191-1/+2
| | | | llvm-svn: 361120
* Added a better diagnostic when using the delete operator with lambdasNicolas Lesser2019-05-191-2/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This adds a new error for missing parentheses around lambdas in delete operators. ``` int main() { delete []() { return new int(); }(); } ``` This will result in: ``` test.cpp:2:3: error: '[]' after delete interpreted as 'delete[]' delete []() { return new int(); }(); ^~~~~~~~~ test.cpp:2:9: note: add parentheses around the lambda delete []() { return new int(); }(); ^ ( ) ``` Reviewers: rsmith Reviewed By: rsmith Subscribers: riccibruno, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D36357 llvm-svn: 361119
* [AVR] Automatically link CRT and libgcc from the system avr-gccDylan McKay2019-05-193-6/+148
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch modifies the AVR toolchain so that if avr-gcc and avr-libc are detected during compilation, the CRT, libgcc, libm, and libc anre linked. This matches avr-gcc's default behaviour, and the expected behaviour of all C compilers - including the C runtime. avr-gcc also needs a -mmcu specified in order to link runtime libraries. The difference betwen this patch and avr-gcc is that this patch will warn users whenever they compile without a runtime, as opposed to GCC, which silently trims the runtime libs from the linker arguments when no -mmcu is specified. Reviewers: aaron.ballman, kparzysz, asb, hfinkel, brucehoult, TimNN Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D54334 llvm-svn: 361116
* [X86] Remove semicolons at the end of intrinsics implemented as macros so ↵Craig Topper2019-05-193-28/+28
| | | | | | | | | | they can be used as arguments to other intrinsics. Also fix one intrinsic that was using variable names without underscores. Fixes PR41932 llvm-svn: 361109
* ScalarExprEmitter::EmitCompoundAssign - fix uninitialized variable warning. ↵Simon Pilgrim2019-05-181-1/+1
| | | | | | NFCI. llvm-svn: 361098
* MIGChecker - assert we have a non-null LocationContext. NFCI.Simon Pilgrim2019-05-181-0/+2
| | | | | | Fixes scan-build warning. llvm-svn: 361097
* ASTNodeImporter - fix uninitialized variable warnings. NFCI.Simon Pilgrim2019-05-181-2/+2
| | | | llvm-svn: 361096
* [c++20] P1327R1: Support for typeid applied to objects of polymorphicRichard Smith2019-05-171-6/+22
| | | | | | | | | class type in constant evaluation. This reinstates r360977, reverted in r360987, now that its rerequisite patch is reinstated and fixed. llvm-svn: 361067
* [OpenMP][bugfix] Add missing math functions variants for log and abs.Gheorghe-Teodor Bercea2019-05-172-0/+16
| | | | | | | | | | | | | | | | Summary: When including the random header in C++, some of the math functions it relies on are not present in the CUDA headers. We include this variants in this case. Reviewers: jdoerfert, hfinkel, tra, caomhin Reviewed By: tra Subscribers: efriedma, guansong, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D62046 llvm-svn: 361066
* Added an assertion to constant evaluation enty points that prohibits ↵Dmitri Gribenko2019-05-174-4/+69
| | | | | | | | | | | | | | | | | | dependent expressions Summary: Constant evaluator does not work on value-dependent or type-dependent expressions. Also fixed bugs uncovered by these assertions. Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D61522 llvm-svn: 361050
* [analyzer] Remove the default value arg from getChecker*OptionKristof Umann2019-05-1713-51/+55
| | | | | | | | | | | | | | | | | | | Since D57922, the config table contains every checker option, and it's default value, so having it as an argument for getChecker*Option is redundant. By the time any of the getChecker*Option function is called, we verified the value in CheckerRegistry (after D57860), so we can confidently assert here, as any irregularities detected at this point must be a programmer error. However, in compatibility mode, verification won't happen, so the default value must be restored. This implies something else, other than adding removing one more potential point of failure -- debug.ConfigDumper will always contain valid values for checker/package options! Differential Revision: https://reviews.llvm.org/D59195 llvm-svn: 361042
* [LibTooling] Add support to Transformer for composing rules as an ordered ↵Yitzhak Mandelbaum2019-05-171-8/+105
| | | | | | | | | | | | | | | | | | | | choice. This revision updates `RewriteRule` to support multiple subrules that are interpreted as an ordered-choice (apply the first one that matches). With this feature, users can write the rules that appear later in the list of subrules knowing that previous rules' patterns *have not matched*, freeing them from reasoning about those cases in the current pattern. Reviewers: ilya-biryukov Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D61335 llvm-svn: 361037
* Extract ASTDumper to a header fileStephen Kelly2019-05-171-46/+1
| | | | | | | | | | | | | | | | | | Summary: This class has member APIs which are useful to clients. Make it possible to use those APIs without adding them to dump() member functions. Doing so does not scale. The optional arguments to dump() should be designed to be useful in a debugging context. Reviewers: aaron.ballman Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D61835 llvm-svn: 361034
* [analyzer] Validate checker option names and valuesKristof Umann2019-05-171-18/+101
| | | | | | | | | | Validate whether the option exists, and also whether the supplied value is of the correct type. With this patch, invoking the analyzer should be, at least in the frontend mode, a lot safer. Differential Revision: https://reviews.llvm.org/D57860 llvm-svn: 361011
* [Lex] Allow to consume tokens while preprocessingIlya Biryukov2019-05-1721-81/+113
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: By adding a hook to consume all tokens produced by the preprocessor. The intention of this change is to make it possible to consume the expanded tokens without re-runnig the preprocessor with minimal changes to the preprocessor and minimal performance penalty when preprocessing without recording the tokens. The added hook is very low-level and reconstructing the expanded token stream requires more work in the client code, the actual algorithm to collect the tokens using this hook can be found in the follow-up change. Reviewers: rsmith Reviewed By: rsmith Subscribers: eraman, nemanjai, kbarton, jsji, riccibruno, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D59885 llvm-svn: 361007
* [analyzer] Insert checker options into AnalyzerOption::ConfigTableKristof Umann2019-05-172-5/+9
| | | | | | | | | | | | | The more entries we have in AnalyzerOptions::ConfigTable, the more helpful debug.ConfigDumper is. With this patch, I'm pretty confident that it'll now emit the entire state of the analyzer, minus the frontend flags. It would be nice to reserve the config table specifically to checker options only, as storing the regular analyzer configs is kinda redundant. Differential Revision: https://reviews.llvm.org/D57922 llvm-svn: 361006
* Fix crash if, during evaluation of __builtin_object_size, we try to loadRichard Smith2019-05-171-0/+5
| | | | | | through an invalid base. llvm-svn: 360998
OpenPOWER on IntegriCloud