summaryrefslogtreecommitdiffstats
path: root/clang
Commit message (Collapse)AuthorAgeFilesLines
* StaticAnalyzer: fix compiler warning. NFCPavel Labath2018-03-141-1/+1
| | | | | | | | | | | | My compiler (clang-3.8) complains that the RCC variable is unused. That's not really true, as it's checked by the if-declaration, but it's also kinda true, because we don't need to declaration if we only check it in the if statement. In reality, all this means that the dyn_cast<> can be replaced by isa<>, so that's what I do here. llvm-svn: 327491
* [hwasan] update docsKostya Serebryany2018-03-141-14/+23
| | | | llvm-svn: 327471
* Check that a field is not annotated with attribute "unavailable" beforeAkira Hatanaka2018-03-133-4/+23
| | | | | | | | | | | | setting the NonTrivialToPrimitive* flags of a record. Union fields that have non-trivial Objective-C ownership qualifications are normally not legal, but if the union is declared in a system header, the fields are annotated with attribute "unavailable". rdar://problem/38431072 llvm-svn: 327464
* [OpenMP] Add flag for linking runtime bitcode libraryGheorghe-Teodor Bercea2018-03-134-0/+64
| | | | | | | | | | | | | | Summary: This patch adds an additional flag to the OpenMP device offloading toolchain to link in the runtime library bitcode. Reviewers: Hahnfeld, ABataev, carlo.bertolli, caomhin, grokos, hfinkel Reviewed By: ABataev, grokos Subscribers: jholewinski, guansong, cfe-commits Differential Revision: https://reviews.llvm.org/D43197 llvm-svn: 327460
* [Attr] Merge two dependent tests from different directoriesJoel E. Denny2018-03-132-7/+2
| | | | | | Suggested at: https://reviews.llvm.org/D43248 llvm-svn: 327456
* [ARM] ACLE FP16 feature test macrosSjoerd Meijer2018-03-133-0/+25
| | | | | | | | | This is a partial recommit of r327189 that was reverted due to test issues. I.e., this recommits minimal functional change, the FP16 feature test macros, and adds tests that were missing in the original commit. llvm-svn: 327455
* [Analysis] Fix some Clang-tidy modernize and Include What You Use warnings; ↵Eugene Zelenko2018-03-138-320/+326
| | | | | | other minor fixes (NFC). llvm-svn: 327453
* Revert revision 327438.Gheorghe-Teodor Bercea2018-03-134-61/+0
| | | | llvm-svn: 327447
* [OpenMP] Add flag for linking runtime bitcode libraryGheorghe-Teodor Bercea2018-03-134-0/+62
| | | | | | | | | | | | | | Summary: This patch adds an additional flag to the OpenMP device offloading toolchain to link in the runtime library bitcode. Reviewers: Hahnfeld, ABataev, carlo.bertolli, caomhin, grokos, hfinkel Reviewed By: ABataev, grokos Subscribers: jholewinski, guansong, cfe-commits Differential Revision: https://reviews.llvm.org/D43197 llvm-svn: 327438
* This reverts "r327189 - [ARM] Add ARMv8.2-A FP16 vector intrinsic"Sjoerd Meijer2018-03-137-1237/+217
| | | | | | | This is causing problems in testing, and PR36683 was raised. Reverting it until we have sorted out how to pass f16 vectors. llvm-svn: 327437
* Serialize the NonTrivialToPrimitive* flags I added in r326307.Akira Hatanaka2018-03-135-10/+36
| | | | | | rdar://problem/38421774 llvm-svn: 327434
* [analyzer] Fix the matcher for GCDAntipattern to look for "signal" call in ↵George Karpenkov2018-03-132-2/+17
| | | | | | | | all parameters rdar://38405904 llvm-svn: 327426
* Reland "[Attr] Fix parameter indexing for several attributes"Joel E. Denny2018-03-1317-153/+418
| | | | | | | | | Relands r326602 (reverted in r326862) with new test and fix for PR36620. Differential Revision: https://reviews.llvm.org/D43248 llvm-svn: 327405
* [Hexagon] Clang side of r327302 in LLVMKrzysztof Parzyszek2018-03-132-24/+38
| | | | | | | Add option -m[no-]packets to control generation of instruction packets (enabled by default). llvm-svn: 327393
* clang-import-test: fix build with clang-3.8Pavel Labath2018-03-131-1/+1
| | | | | | | | clang-3.8 complains that constructor for '...' must explicitly initialize the const object. Newer clangs and gcc seem to be fine with this, but explicitly initializing the variable does not hurt. llvm-svn: 327383
* Add missing "env" so that test added in r327322 passes on Windows bots.Douglas Yung2018-03-131-1/+1
| | | | llvm-svn: 327354
* [CFG] [analyzer] Don't add construction context to a return-by-reference call.Artem Dergachev2018-03-124-6/+62
| | | | | | | | | | | | | | Call expressions that return objects by an lvalue reference or an rvalue reference have a value type in the AST but wear an auxiliary flag of being an lvalue or an xvalue respectively. Use the helper method for obtaining the actual return type of the function. Fixes a crash. Differential Revision: https://reviews.llvm.org/D44273 llvm-svn: 327352
* [analyzer] Support temporaries conjured by conservatively evaluated functions.Artem Dergachev2018-03-123-17/+81
| | | | | | | | | | | | | | Properly perform destruction and lifetime extension of such temporaries. C++ object-type return values of conservatively evaluated functions are now represented as compound values of well-defined temporary object regions. The function creates a region that represents the temporary object and will later be used for destruction or materialization, invalidates it, and returns the invalidated compound value of the object. Differential Revision: https://reviews.llvm.org/D44131 llvm-svn: 327348
* [analyzer] NFC: Move the code for setting temp object lifetime into method.Artem Dergachev2018-03-123-61/+69
| | | | | | Differential Revision: https://reviews.llvm.org/D44129 llvm-svn: 327347
* [analyzer] Destroy and lifetime-extend inlined function return values properly.Artem Dergachev2018-03-122-29/+214
| | | | | | | | | | | | | | | This patch uses the newly added CFGCXXRecordTypedCall element at the call site of the caller to construct the return value within the callee directly into the caller's stack frame. This way it is also capable of populating the temporary destructor and lifetime extension maps for the temporary, which allows temporary destructors and lifetime extension to work correctly. This patch does not affect temporaries that were returned from conservatively evaluated functions. Differential Revision: https://reviews.llvm.org/D44124 llvm-svn: 327345
* [CFG] [analyzer] Add construction context to C++ return-by-value call elements.Artem Dergachev2018-03-126-74/+171
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds a new CFGStmt sub-class, CFGCXXRecordTypedCall, which replaces the regular CFGStmt for the respective CallExpr whenever the CFG has additional information to provide regarding the lifetime of the returned value. This additional call site information is represented by a ConstructionContext (which was previously used for CFGConstructor elements) that provides references to CXXBindTemporaryExpr and MaterializeTemporaryExpr that surround the call. This corresponds to the common C++ calling convention solution of providing the target address for constructing the return value as an auxiliary implicit argument during function call. One of the use cases for such extra context at the call site would be to perform any sort of inter-procedural analysis over the CFG that involves functions returning objects by value. In this case the elidable constructor at the return site would construct the object explained by the context at the call site, and its lifetime would also be managed by the caller, not the callee. The extra context would also be useful for properly handling the return-value temporary at the call site, even if the callee is not being analyzed inter-procedurally. Differential Revision: https://reviews.llvm.org/D44120 llvm-svn: 327343
* Re-land "[Sema] Make getCurFunction() return null outside function parsing"Reid Kleckner2018-03-1210-101/+116
| | | | | | | | | | | | | | This relands r326965. There was a null dereference in typo correction that was triggered in Sema/diagnose_if.c. We are not always in a function scope when doing typo correction. The fix is to add a null check. LLVM's optimizer made it hard to find this bug. I wrote it up in a not-very-well-editted blog post here: http://qinsb.blogspot.com/2018/03/ub-will-delete-your-null-checks.html llvm-svn: 327334
* [Tooling] Clear the PreambleSrcLocCache when preamble is discarded during ↵Alex Lorenz2018-03-125-0/+17
| | | | | | | | | | | reparsing This ensures that diagnostics are not remapped to incorrect preamble locations after the second reparse with a remapped header file occurs. rdar://37502480 llvm-svn: 327322
* Check that ubsan is the only supported sanitizer on OpenBSDVedant Kumar2018-03-121-0/+19
| | | | | | | | Patch by David Carlier! Differential Revision: https://reviews.llvm.org/D44069 llvm-svn: 327317
* [Driver] Add text description of --help-hidden so it is shown in helpJan Korous2018-03-121-1/+2
| | | | llvm-svn: 327313
* [analyzer] Move the GCDAsyncSemaphoreChecker to optin.performanceGeorge Karpenkov2018-03-124-43/+82
| | | | | | | | rdar://38383753 Differential Revision: https://reviews.llvm.org/D44228 llvm-svn: 327309
* Revert "[ObjC] Allow declaring __weak pointer fields in C structs inAkira Hatanaka2018-03-1218-380/+51
| | | | | | | | | | | ARC." This reverts commit r327206 as there were test failures caused by this patch. http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20180312/221427.html llvm-svn: 327294
* [clang-format] Improve detection of Objective-C block typesBen Hamilton2018-03-123-6/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Previously, clang-format would detect the following as an Objective-C block type: FOO(^); when it actually must be a C or C++ macro dealing with an XOR statement or an XOR operator overload. According to the Clang Block Language Spec: https://clang.llvm.org/docs/BlockLanguageSpec.html block types are of the form: int (^)(char, float) and block variables of block type are of the form: void (^blockReturningVoidWithVoidArgument)(void); int (^blockReturningIntWithIntAndCharArguments)(int, char); void (^arrayOfTenBlocksReturningVoidWithIntArgument[10])(int); This tightens up the detection so we don't unnecessarily detect C macros which pass in the XOR operator. Depends On D43904 Test Plan: New tests added. Ran tests with: make -j12 FormatTests && ./tools/clang/unittests/Format/FormatTests Reviewers: krasimir, jolesiak, djasper Reviewed By: djasper Subscribers: djasper, cfe-commits, klimek Differential Revision: https://reviews.llvm.org/D43906 llvm-svn: 327285
* [clang-format] Don't detect C++11 attribute specifiers as ObjCBen Hamilton2018-03-124-29/+96
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Previously, clang-format would detect C++11 and C++17 attribute specifiers like the following as Objective-C method invocations: [[noreturn]]; [[clang::fallthrough]]; [[noreturn, deprecated("so sorry")]]; [[using gsl: suppress("type")]]; To fix this, I ported part of the logic from tools/clang/lib/Parse/ParseTentative.cpp into TokenAnnotator.cpp so we can explicitly parse and identify C++11 attribute specifiers. This allows the guessLanguage() and getStyle() APIs to correctly guess files containing the C++11 attribute specifiers as C++, not Objective-C. Test Plan: New tests added. Ran tests with: make -j12 FormatTests && ./tools/clang/unittests/Format/FormatTests Reviewers: krasimir, jolesiak, djasper Reviewed By: djasper Subscribers: aaron.ballman, cfe-commits, klimek Differential Revision: https://reviews.llvm.org/D43902 llvm-svn: 327284
* [analyzer] Trying to fix Windows buildbots after r327258Maxim Ostapenko2018-03-121-1/+1
| | | | llvm-svn: 327270
* Update the supported C language standards in the user manual.Aaron Ballman2018-03-121-4/+5
| | | | | | Remove mention of -std=c94 (it is spelled iso9899:1994, not c94) and add mention of -std=c17 and -std=gnu17. llvm-svn: 327264
* [analyzer] Trying to fix buildbots after r327258Maxim Ostapenko2018-03-121-2/+2
| | | | llvm-svn: 327263
* [analyzer] Add scope information to CFGMaxim Ostapenko2018-03-1212-10/+1437
| | | | | | | | | | | This patch adds two new CFG elements CFGScopeBegin and CFGScopeEnd that indicate when a local scope begins and ends respectively. We use first VarDecl declared in a scope to uniquely identify it and add CFGScopeBegin and CFGScopeEnd elements into corresponding basic blocks. Differential Revision: https://reviews.llvm.org/D16403 llvm-svn: 327258
* clang-format: Properly handle implicit string concatenation in text protosDaniel Jasper2018-03-125-5/+24
| | | | | | | | | | | | | Three issues to fix: - char_constants weren't properly treated as string literals - Prevening the break after "label: " does not make sense in concunction with AlwaysBreakBeforeMultilineStrings. It leads to situations where clang-format just cannot find a viable format (it must break and yet it must not break). - AlwaysBreakBeforeMultilineStrings should not be on for LK_TextProto in Google style. llvm-svn: 327255
* Don't re-format raw string literal contents when formatting is disableDaniel Jasper2018-03-122-1/+15
| | | | | | | Not entirely sure this is the best place to put this check, but it fixes the immediate issue. llvm-svn: 327253
* [Driver] Update the comment about incompatible sanitizersPetr Hosek2018-03-121-1/+2
| | | | | | Differential Revision: https://reviews.llvm.org/D44371 llvm-svn: 327249
* [CodeGen] Eagerly emit lifetime.end markers for callsGeorge Burgess IV2018-03-102-6/+129
| | | | | | | | | | | | | | | | | | | | | | In C, we'll wait until the end of the scope to clean up aggregate temporaries used for returns from calls. This means in cases like: { // Assuming that `Bar` is large enough to warrant indirect returns struct Bar b = {}; b = foo(&b); b = foo(&b); b = foo(&b); b = foo(&b); } ...We'll allocate space for 5 Bars on the stack (`b`, and 4 temporaries). This becomes painful in things like large switch statements. If cleaning up sooner is trivial, we should do it. llvm-svn: 327229
* [ObjC] Allow declaring __weak pointer fields in C structs in ARC.Akira Hatanaka2018-03-1018-51/+380
| | | | | | | | | | | | This patch uses the infrastructure added in r326307 for enabling non-trivial fields to be declared in C structs to allow __weak fields in C structs in ARC. rdar://problem/33599681 Differential Revision: https://reviews.llvm.org/D44095 llvm-svn: 327206
* [Driver] Pass Default=false to hasFlag.Akira Hatanaka2018-03-102-1/+3
| | | | | | I forgot to do this in r326530. llvm-svn: 327204
* Revert r326946. It caused stack overflows by significantly increasing the ↵Richard Smith2018-03-1015-332/+111
| | | | | | size of a CallArgList. llvm-svn: 327195
* [CodeGen] Try to not call a dtor after lifetime.endGeorge Burgess IV2018-03-102-47/+82
| | | | | | | | | | | | | | | | | | | | If CodeGenFunction::EmitCall is: - asked to emit a call with an indirectly returned value, - given an invalid return value slot, and - told the return value of the function it's calling is unused then it'll make its own temporary, and add lifetime markers so that the temporary's lifetime ends immediately after the call. The early lifetime.end becomes problematic when we need to run a destructor on the result of the function. Instead of unconditionally saying that results of all calls are used here (which would be correct, but would also cause us to never emit lifetime markers for these temporaries), we just build our own temporary to pass in when a dtor has to be run. llvm-svn: 327192
* [ARM] Add ARMv8.2-A FP16 vector intrinsicAbderrazek Zaafrani2018-03-097-217/+1237
| | | | | | | | Add the fp16 neon vector intrinsic for ARM as described in the ARM ACLE document. Reviews in https://reviews.llvm.org/D43650 llvm-svn: 327189
* test: repair windows build after SVN r327105Saleem Abdulrasool2018-03-091-1/+1
| | | | | | | Thanks to Nico Weber for pointing out the failure. Add an explicit target for the test. llvm-svn: 327183
* Fix Clang test case.Peter Collingbourne2018-03-091-1/+1
| | | | llvm-svn: 327166
* Don't use -pie in relocatable link.Evgeniy Stepanov2018-03-092-1/+19
| | | | | | | | | | | | | | Summary: Android, in particular, got PIE enabled by default in r316606. It resulted in relocatable links passing both -r and -pie to the linker, which is not allowed. Reviewers: srhines Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D44229 llvm-svn: 327165
* [OPENMP] Fix the address of the original variable in task reductions.Alexey Bataev2018-03-092-1/+6
| | | | | | | | If initialization of the task reductions requires pointer to original variable, which is stored in the threadprivate storage, we used the address of this pointer instead. llvm-svn: 327136
* [SemaOverload] Fixed crash on code completionIlya Biryukov2018-03-092-6/+19
| | | | | | | | | | | | | | | | | | Summary: The relevant failing assertion message is: ../tools/clang/lib/Sema/SemaInit.cpp:8411: PerformCopyInitialization(): Assertion `InitE && "No initialization expression?"' failed. See the added test case for a repro. Reviewers: bkramer, sammccall, ioeric, hokein Reviewed By: sammccall Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D44300 llvm-svn: 327134
* CodeGen: simplify and validate exception personalitiesSaleem Abdulrasool2018-03-095-19/+323
| | | | | | | | | | | | Simplify the dispatching for the personality routines. This really had no test coverage previously, so add test coverage for the various cases. This turns out to be pretty complicated as the various languages and models interact to change personalities around. You really should feel bad for the compiler if you are using exceptions. There is no reason for this type of cruelty. llvm-svn: 327105
* PR36645: Go looking for an appropriate array bound when constant-evaluating aRichard Smith2018-03-092-4/+16
| | | | | | name of an array object. llvm-svn: 327099
* [analyzer] MmapWriteExecChecker: Add support for mprotect().Artem Dergachev2018-03-092-3/+12
| | | | | | | | | | | mprotect() allows setting memory access flags similarly to mmap(), causing similar security issues if these flags are needlessly broad. Patch by David Carlier! Differential Revision: https://reviews.llvm.org/D44250 llvm-svn: 327098
OpenPOWER on IntegriCloud