summaryrefslogtreecommitdiffstats
path: root/clang/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* [X86] Add 'prfchw' to the correct CPUs to match the backend.Craig Topper2017-12-221-0/+3
| | | | llvm-svn: 321341
* Diagnose the various invalid decl-specifiers on nontype template parameters.Faisal Vali2017-12-221-0/+54
| | | | | | | | | | | | | The standard correctly forbids various decl-specifiers that dont make sense on non-type template parameters - such as the extern in: template<extern int> struct X; This patch implements those restrictions (in a fashion similar to the corresponding checks on function parameters within ActOnParamDeclarator). Credit goes to miyuki (Mikhail Maltsev) for drawing attention to this issue, authoring the initial versions of this patch, and supporting the effort to re-engineer it slightly. Thank you! For details of how this patch evolved please see: https://reviews.llvm.org/D40705 llvm-svn: 321339
* [Modules] Change private modules rules and warningsBruno Cardoso Lopes2017-12-222-40/+71
| | | | | | | | | | | | | | | | We used to advertise private modules to be declared as submodules (Foo.Private). This has proven to not scale well since private headers might carry several dependencies, introducing unwanted content into the main module and often causing dep cycles. Change the canonical way to name it to Foo_Private, forcing private modules as top level ones, and provide warnings under -Wprivate-module to suggest fixes for other private naming. Update documentation to reflect that. rdar://problem/31173501 llvm-svn: 321337
* [CUDA] More fixes for __shfl_* intrinsics.Artem Belevich2017-12-211-28/+49
| | | | | | | | | * __shfl_{up,down}* uses unsigned int for the third parameter. * added [unsigned] long overloads for non-sync shuffles. Differential Revision: https://reviews.llvm.org/D41521 llvm-svn: 321326
* [X86] Allow _mm_prefetch (both the header implementation and the builtin) to ↵Craig Topper2017-12-213-7/+11
| | | | | | | | accept bit 2 which is supposed to indicate the prefetched addresses will be written to Add the appropriate _MM_HINT_ET0/ET1 defines to match gcc. llvm-svn: 321325
* Correct hasFeature/isValidFeatureName's handling of shstk/adx/mwaitxErich Keane2017-12-211-2/+7
| | | | | | | | | | | | https://bugs.llvm.org/show_bug.cgi?id=35721 reports that x86intrin.h is issuing a few warnings. This is because attribute target is using isValidFeatureName for its source. It was also discovered that two of these were missing from hasFeature. Additionally, shstk is and ibu are reordered alphabetically, as came up during code review. llvm-svn: 321324
* Delete dead code.Adrian Prantl2017-12-211-1/+0
| | | | llvm-svn: 321321
* [analyzer] Add Javascript to analyzer HTML output to allow keyboard navigation.George Karpenkov2017-12-212-2/+94
| | | | | | Differential Revision: https://reviews.llvm.org/D41414 llvm-svn: 321320
* [ODRHash] Canonicalize Decl's before processing.Richard Trieu2017-12-211-0/+1
| | | | | | | Canonicalizing the Decl before processing it as part of the hash should reduce issues with non-canonical types showing up as mismatches. llvm-svn: 321319
* Suppress "redundant parens" warning for "A (::B())".Richard Smith2017-12-211-1/+6
| | | | | | | | This is a slightly odd construct (it's more common to see "A (::B)()") but can happen in friend declarations, and the parens are not redundant as they prevent the :: binding to the left. llvm-svn: 321318
* [scudo] Add -fsanitize=scudo option to FuchsiaPetr Hosek2017-12-211-0/+1
| | | | | | | | | | | | | | Apparently the -fsanitize flag hadn't been added for Scudo upstream yet. Patch By: flowerhack Reviewers: cryptoad, alekseyshl, mcgrathr, phosek Reviewed By: mcgrathr, phosek Differential Revision: https://reviews.llvm.org/D41413 llvm-svn: 321314
* [AST] Incorrectly qualified unscoped enumeration as template actual parameter.Paul Robinson2017-12-211-1/+4
| | | | | | | | | | | | | | | An unscoped enumeration used as template argument, should not have any qualified information about its enclosing scope, as its visibility is global. In the case of scoped enumerations, they must include information about their enclosing scope. Patch by Carlos Alberto Enciso! Differential Revision: https://reviews.llvm.org/D39239 llvm-svn: 321312
* Re-commit r321223, which adds a printing policy to the ASTDumper.Aaron Ballman2017-12-213-347/+367
| | | | | | | | This allows you to dump C++ code that spells bool instead of _Bool, leaves off the elaborated type specifiers when printing struct or class names, and other C-isms. Fixes the -Wreorder issue and fixes the ast-dump-color.cpp test. llvm-svn: 321310
* Revert "[CodeGen] Fix crash when a function taking transparent union is ↵Volodymyr Sapsai2017-12-211-5/+5
| | | | | | | | | | | | redeclared." This reverts commit r321296. It caused performance regressions FAIL: imp.execution_time FAIL: 2007-01-04-KNR-Args.execution_time FAIL: sse_expandfft.execution_time FAIL: sse_stepfft.execution_time llvm-svn: 321306
* Don't produce redundant parentheses warning for "A (::B);" and the like.Richard Smith2017-12-211-1/+19
| | | | | | | The parentheses here are not redundant as they affect the binding of the '::' token. llvm-svn: 321304
* [AArch64] Enable fp16 data type for the Builtin for AArch64 only.Abderrazek Zaafrani2017-12-212-24/+37
| | | | | | Differential Revision: https:://reviews.llvm.org/D41360 llvm-svn: 321301
* Revert "Fix for PR32990"Reid Kleckner2017-12-211-33/+9
| | | | | | | | | | | | This reverts commit r321239. It broke the Chromium DLL build: [8834/50217] LINK(DLL) icui18n.dll icui18n.dll.lib icui18n.dll.pdb FAILED: icui18n.dll icui18n.dll.lib icui18n.dll.pdb zrule.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __cdecl icu_60::UnicodeString::`vbase destructor'(void)" (__imp_??_DUnicodeString@icu_60@@QEAAXXZ) llvm-svn: 321298
* When instantiating a deduction guide, transform its name.Richard Smith2017-12-211-3/+7
| | | | | | Otherwise it will serve as a deduction guide for the wrong class template. llvm-svn: 321297
* [CodeGen] Fix crash when a function taking transparent union is redeclared.Volodymyr Sapsai2017-12-211-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a function taking transparent union is declared as taking one of union members earlier in the translation unit, clang would hit an "Invalid cast" assertion during EmitFunctionProlog. This case corresponds to function f1 in test/CodeGen/transparent-union-redecl.c. We decided to cast i32 to union because after merging function declarations function parameter type becomes int, CGFunctionInfo::ArgInfo type matches with ABIArgInfo type, so we decide it is a trivial case. But these types should also be castable to parameter declaration type which is not the case here. The fix is in checking for the trivial case if ABIArgInfo type matches with parameter declaration type. It exposed inconsistency that we check hasScalarEvaluationKind for different types in EmitParmDecl and EmitFunctionProlog, and comment says they should match. Additional tests in Sema/transparent-union.c capture current behavior and make sure there are no regressions. rdar://problem/34949329 Reviewers: rjmccall, rafael Reviewed By: rjmccall Subscribers: aemerson, cfe-commits, kristof.beyls Differential Revision: https://reviews.llvm.org/D41311 llvm-svn: 321296
* [AARch64] Add ARMv8.2-A FP16 vector intrinsicsAbderrazek Zaafrani2017-12-214-7/+182
| | | | | | | | Putting back the code that was reverted few weeks ago. Differential Revision: https://reviews.llvm.org/D34161 llvm-svn: 321294
* [analyzer] Fix zero-initialization of stack VLAs under ObjC ARC.Artem Dergachev2017-12-211-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Using ARC, strong, weak, and autoreleasing stack variables are implicitly initialized with nil. This includes variable-length arrays of Objective-C object pointers. However, in the analyzer we don't zero-initialize them. We used to, but it accidentally regressed after r289618. Under ARC, the array variable's initializer within DeclStmt is an ImplicitValueInitExpr. Environment doesn't maintain any bindings for this expression kind - instead it always knows that it's a known constant (0 in our case), so it just returns the known value by calling SValBuilder::makeZeroVal() (see EnvironmentManager::getSVal(). Commit r289618 had introduced reasonable behavior of SValBuilder::makeZeroVal() for the arrays, which produces a zero-length compoundVal{}. When such value is bound to arrays, in RegionStoreManager::bindArray() "remaining" items in the array are default-initialized with zero, as in RegionStoreManager::setImplicitDefaultValue(). The similar mechanism works when an array is initialized by an initializer list that is too short, eg. int a[3] = { 1, 2 }; would result in a[2] initialized with 0. However, in case of variable-length arrays it didn't know if any more items need to be added, because, well, the length is variable. Add the default binding anyway, regardless of how many actually need to be added. We don't really care how many, because the default binding covers the whole array anyway. Differential Revision: https://reviews.llvm.org/D41478 rdar://problem/35477763 llvm-svn: 321290
* Added helper to get size of PrecompiledPreambleIlya Biryukov2017-12-211-3/+24
| | | | llvm-svn: 321266
* [CodeGen] Fix access sizes in new-format TBAA tagsIvan A. Kosarev2017-12-211-1/+3
| | | | | | | | | | | | The new format requires to specify both the type of the access and its size. This patch fixes setting access sizes for TBAA tags that denote accesses to structure members. This fix affects all future TBAA metadata tests for the new format, so I guess we don't need any special tests for this fix. Differential Revision: https://reviews.llvm.org/D41452 llvm-svn: 321250
* Fix for PR32990Erich Keane2017-12-211-9/+33
| | | | | | | | | This fixes the bug in https://bugs.llvm.org/show_bug.cgi?id=32990. Patch By: zahiraam Differential Revision: https://reviews.llvm.org/D39063 llvm-svn: 321239
* [ubsan] Diagnose noreturn functions which returnVedant Kumar2017-12-215-17/+45
| | | | | | | | | | | | | | | | | | Diagnose 'unreachable' UB when a noreturn function returns. 1. Insert a check at the end of functions marked noreturn. 2. A decl may be marked noreturn in the caller TU, but not marked in the TU where it's defined. To diagnose this scenario, strip away the noreturn attribute on the callee and insert check after calls to it. Testing: check-clang, check-ubsan, check-ubsan-minimal, D40700 rdar://33660464 Differential Revision: https://reviews.llvm.org/D40698 llvm-svn: 321231
* [Driver] Ensure no overlap between trapping & recoverable sanitizers. NFC.Vedant Kumar2017-12-211-0/+3
| | | | | | | This is NFC because in EmitCheck(), -fsanitize-trap=X overrides -fsanitize-recover=X. llvm-svn: 321230
* Reverting r321223 and its follow-up commit because of failing bots due to ↵Aaron Ballman2017-12-203-365/+347
| | | | | | Misc/ast-dump-color.cpp. llvm-svn: 321229
* Silence a -Wreorder warning from r321223.Aaron Ballman2017-12-201-2/+2
| | | | llvm-svn: 321228
* Add a printing policy to the ASTDumper.Aaron Ballman2017-12-203-347/+365
| | | | | | This allows you to dump C++ code that spells bool instead of _Bool, leaves off the elaborated type specifiers when printing struct or class names, and other C-isms. llvm-svn: 321223
* Fix an assertion failure regression in isDesignatorAtObjectEnd forAlex Lorenz2017-12-201-1/+4
| | | | | | | | | | | | | | __builtin_object_size with incomplete array type in struct The commit r316245 introduced a regression that causes an assertion failure when Clang tries to cast an IncompleteArrayType to a PointerType when evaluating __builtin_object_size. rdar://36094951 Differential Revision: https://reviews.llvm.org/D41405 llvm-svn: 321222
* [hwasan] Implement -fsanitize-recover=hwaddress.Evgeniy Stepanov2017-12-201-1/+5
| | | | | | | | | | | | Summary: Very similar to AddressSanitizer, with the exception of the error type encoding. Reviewers: kcc, alekseyshl Subscribers: cfe-commits, kubamracek, llvm-commits, hiraditya Differential Revision: https://reviews.llvm.org/D41417 llvm-svn: 321203
* Add support for ObjectFormat to TargetSpecificAttrErich Keane2017-12-201-6/+0
| | | | | | | | | | | | | | | | Looking through the code, I saw a FIXME on IFunc to switch it to a target specific attribute. In looking through it, i saw that the no-longer-appropriately-named TargetArch didn't support ObjectFormat checking. This patch changes the name of TargetArch to TargetSpecific (since it checks much more than just Arch), makes "Arch" optional, adds support for ObjectFormat, better documents the TargetSpecific type, and changes IFunc over to a TargetSpecificAttr. Differential Revision: https://reviews.llvm.org/D41303 llvm-svn: 321201
* Make DiagnosticIDs::getAllDiagnostics use std::vector. NFC.Gabor Horvath2017-12-202-2/+2
| | | | | | | | | | | | The size of the result vector is currently around 4600 with Flavor::WarningOrError, which makes std::vector a better candidate than llvm::SmallVector. Patch by: Andras Leitereg! Differential Revision: https://reviews.llvm.org/D39372 llvm-svn: 321190
* [clang] Add BeforeExecute method to PrecompiledPreambleIlya Biryukov2017-12-201-0/+2
| | | | | | | | | | | | | | | | | Summary: Adds BeforeExecute method to PrecompiledPreamble to be called before Execute(). This method can be overriden. Patch by William Enright. Reviewers: malaperle, ilya-biryukov Reviewed By: ilya-biryukov Subscribers: arphaman, cfe-commits, ilya-biryukov Differential Revision: https://reviews.llvm.org/D41365 llvm-svn: 321189
* [Complex] Don't use __div?c3 when building with fast-math.Florian Hahn2017-12-201-8/+29
| | | | | | | | | | | | Summary: Plant an inline version of "((ac+bd)/(cc+dd)) + i((bc-ad)/(cc+dd))" instead. Patch by Paul Walker. Reviewed By: hfinkel Differential Revision: https://reviews.llvm.org/D40299 llvm-svn: 321183
* [Frontend] Handle skipped bodies in template instantiationsIlya Biryukov2017-12-202-11/+18
| | | | | | | | | | | | | | | | | | Summary: - Fixed an assert in Sema::InstantiateFunctionDefinition and added support for instantiating a function template with skipped body. - Properly call setHasSkippedBody for FunctionTemplateDecl passed to Sema::ActOnSkippedFunctionBody. Reviewers: sepavloff, bkramer Reviewed By: sepavloff Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D41237 llvm-svn: 321174
* Remove llvm::MemoryBuffer const_castsPavel Labath2017-12-202-7/+7
| | | | | | | | | | | | | | | Summary: llvm has grown a WritableMemoryBuffer class, which is convertible (inherits from) a MemoryBuffer. We can use it to avoid conts_casting the buffer contents when we want to write to it. Reviewers: dblaikie, rsmith Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D41387 llvm-svn: 321167
* [darwin][driver] Warn about mismatching -<os>-version-min rather thanAlex Lorenz2017-12-201-4/+21
| | | | | | | | | | superfluous -<os>-version-min compiler option rdar://35813850 Differential Revision: https://reviews.llvm.org/D41425 llvm-svn: 321145
* Revert r320942, "[ASTImporter] Support importing FunctionTemplateDecl and ↵Peter Collingbourne2017-12-201-126/+0
| | | | | | | | | | | | | | | | | CXXDependentScopeMemberExpr" Caused a test failure on Windows: [ RUN ] ImportExpr.ImportCXXDependentScopeMemberExpr C:\b\rr\tmppzcp4w\w\src\third_party\llvm\tools\clang\unittests\AST\ASTImporterTest.cpp(526): error: Value of: testImport("template <typename T> class C { T t; };" "template <typename T> void declToImport() {" " C<T> d;" " d.t;" "}", Lang_CXX, "", Lang_CXX, Verifier, functionTemplateDecl(has(functionDecl(has(compoundStmt( has(cxxDependentScopeMemberExpr()))))))) Actual: false (Could not find match) Expected: true C:\b\rr\tmppzcp4w\w\src\third_party\llvm\tools\clang\unittests\AST\ASTImporterTest.cpp(534): error: Value of: testImport("template <typename T> class C { T t; };" "template <typename T> void declToImport() {" " C<T> d;" " (&d)->t;" "}", Lang_CXX, "", Lang_CXX, Verifier, functionTemplateDecl(has(functionDecl(has(compoundStmt( has(cxxDependentScopeMemberExpr()))))))) Actual: false (Could not find match) Expected: true [ FAILED ] ImportExpr.ImportCXXDependentScopeMemberExpr (37 ms) llvm-svn: 321139
* [analyzer] De-duplicate path diagnostics for each exploded graph node.Artem Dergachev2017-12-201-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | The bugreporter::trackNullOrUndefValue() mechanism contains a system of bug reporter visitors that recursively call each other in order to track where a null or undefined value came from, where each visitor represents a particular tracking mechanism (track how the value was stored, track how the value was returned from a function, track how the value was constrained to null, etc.). Each visitor is only added once per value it needs to track. Almost. One exception from this rule would be FindLastStoreBRVisitor that has two operation modes: it contains a flag that indicates whether null stored values should be suppressed. Two instances of FindLastStoreBRVisitor with different values of this flag are considered to be different visitors, so they can be added twice and produce the same diagnostic twice. This was indeed the case in the affected test. With the current logic of this whole machinery, such duplication seems unavoidable. We should be able to safely add visitors with different flag values without constructing duplicate diagnostic pieces. Hence the effort in this commit to de-duplicate diagnostics regardless of what visitors have produced them. Differential Revision: https://reviews.llvm.org/D41258 llvm-svn: 321135
* [analyzer] trackNullOrUndefValue: always track through parentheses and casts.Artem Dergachev2017-12-201-6/+2
| | | | | | | | | | | | | | | When trying to figure out where a null or undefined value came from, parentheses and cast expressions are either completely irrelevant, or, in the case of lvalue-to-rvale cast, straightforwardly lead us in the right direction when we remove them. There is a regression that causes a certain diagnostic to appear twice in the path-notes.cpp test (changed to FIXME). It would be addressed in the next commit. Differential revision: https://reviews.llvm.org/D41254 llvm-svn: 321133
* [analyzer] trackNullOrUndefValue: track last store to non-variables.Artem Dergachev2017-12-201-1/+4
| | | | | | | | | | | | | | | | | When reporting certain kinds of analyzer warnings, we use the bugreporter::trackNullOrUndefValue mechanism, which is part of public checker API, to understand where a zero, null-pointer, or garbage value came from, which would highlight important events with respect to that value in the diagnostic path notes, and help us suppress various false positives that result from values appearing from particular sources. Previously, we've lost track of the value when it was written into a memory region that is not a plain variable. Now try to resume tracking in this situation by finding where the last write to this region has occured. Differential revision: https://reviews.llvm.org/D41253 llvm-svn: 321130
* [X86] Add more CPUID bits to cpuid.h to match gcc and support icelake features.Craig Topper2017-12-201-5/+14
| | | | llvm-svn: 321129
* [analyzer] Fix a crash during C++17 aggregate construction of base objects.Artem Dergachev2017-12-202-2/+32
| | | | | | | | | | | | | | | | | | | | | | | Since C++17, classes that have base classes can potentially be initialized as aggregates. Trying to construct such objects through brace initialization was causing the analyzer to crash when the base class has a non-trivial constructor, while figuring target region for the base class constructor, because the parent stack frame didn't contain the constructor of the subclass, because there is no constructor for subclass, merely aggregate initialization. This patch avoids the crash, but doesn't provide the actually correct region for the constructor, which still remains to be fixed. Instead, construction goes into a fake temporary region which would be immediately discarded. Similar extremely conservative approach is used for other cases in which the logic for finding the target region is not yet implemented, including aggregate initialization with fields instead of base-regions (which is not C++17-specific but also never worked, just didn't crash). Differential revision: https://reviews.llvm.org/D40841 rdar://problem/35441058 llvm-svn: 321128
* Add explicit break (PR35700).Adrian Prantl2017-12-191-0/+1
| | | | llvm-svn: 321116
* Silence a bunch of implicit fallthrough warningsAdrian Prantl2017-12-1927-66/+71
| | | | llvm-svn: 321115
* [driver][darwin] Set the 'simulator' environment when it's specifiedAlex Lorenz2017-12-191-6/+21
| | | | | | | | | | in '-target' rdar://35742458 Differential Revision: https://reviews.llvm.org/D41076 llvm-svn: 321102
* [driver][darwin] Take the OS version specified in "-target" as the targetAlex Lorenz2017-12-191-47/+69
| | | | | | | | | | | | | OS instead of inferring it from SDK / environment The OS version is specified in -target should be used instead of the one in an environment variable / SDK name. rdar://35813850 Differential Revision: https://reviews.llvm.org/D40998 llvm-svn: 321099
* [clang] -foptimization-record-file= should imply -fsave-optimization-recordJonas Devlieghere2017-12-191-0/+1
| | | | | | | | | | | | | | | | | The Clang option -foptimization-record-file= controls which file an optimization record is output to. Optimization records are output if you use the Clang option -fsave-optimization-record. If you specify the first option without the second, you get a warning that the command line argument was unused. Passing -foptimization-record-file= should imply -fsave-optimization-record. This fixes PR33670 Patch by: Dmitry Venikov <venikov@phystech.edu> Differential revision: https://reviews.llvm.org/D39834 llvm-svn: 321090
* Rename sparc-myriad-elf triplet to sparc-myriad-rtemsWalter Lee2017-12-191-4/+5
| | | | | | | | | | | | | Summary: This is to be consistent with latest Movidius MDK releases. Also, don't inherit any gcc paths for shave triple. Reviewers: jyknight Subscribers: emaste, fedor.sergeev Differential Revision: https://reviews.llvm.org/D41295 llvm-svn: 321080
OpenPOWER on IntegriCloud