aboutsummaryrefslogtreecommitdiff
path: root/clang/lib
AgeCommit message (Collapse)AuthorFilesLines
2017-03-09[coroutines] Build and pass coroutine_handle to await_suspendGor Nishanov2-14/+110
Summary: This patch adds passing a coroutine_handle object to await_suspend calls. It builds the coroutine_handle using coroutine_handle<PromiseType>::from_address(__builtin_coro_frame()). (a revision of https://reviews.llvm.org/D26316 that for some reason refuses to apply via arc patch) Reviewers: GorNishanov Subscribers: mehdi_amini, cfe-commits, EricWF Differential Revision: https://reviews.llvm.org/D30769 llvm-svn: 297356
2017-03-09Fix handling of -fmodule-map-file=X where X has no directory component.Richard Smith1-2/+4
llvm-svn: 297349
2017-03-09Revert "[ubsan] Detect UB loads from bitfields"Vedant Kumar3-6/+5
This reverts commit r297298. It breaks the self-host on this bot: http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap/builds/962/steps/build%20clang%2Fubsan/logs/stdio llvm-svn: 297331
2017-03-09Driver/ToolChains: Remove extra semicolons. NFCKonstantin Zhuravlyov3-3/+3
llvm-svn: 297329
2017-03-09[analyzer] Extend taint propagation and checking to support LazyCompoundValAnna Zaks2-0/+42
A patch by Vlad Tsyrklevich! Differential Revision: https://reviews.llvm.org/D28445 llvm-svn: 297326
2017-03-09[analyzer] Improve usability of ExprInspectionCheckerAnna Zaks1-2/+2
Some of the magic functions take arguments of arbitrary type. However, for semantic correctness, the compiler still requires a declaration of these functions with the correct type. Since C does not have argument-type-overloaded function, this made those functions hard to use in C code. Improve this situation by allowing arbitrary suffixes in the affected magic functions' names, thus allowing the user to create different declarations for different types. A patch by Keno Fischer! Differential Revision: https://reviews.llvm.org/D30589 llvm-svn: 297325
2017-03-09[analyzer] Add bug visitor for taint checker.Anna Zaks1-2/+46
Add a bug visitor to the taint checker to make it easy to distinguish where the tainted value originated. This is especially useful when the original taint source is obscured by complex data flow. A patch by Vlad Tsyrklevich! Differential Revision: https://reviews.llvm.org/D30289 llvm-svn: 297324
2017-03-09[analyzer] Teach the MallocChecker about about Glib APIAnna Zaks1-7/+40
A patch by Leslie Zhai! Differential Revision: https://reviews.llvm.org/D28348 llvm-svn: 297323
2017-03-08Defensively ensure that GetExternalDeclStmt protects itself from nested ↵David Blaikie1-0/+3
deserialization llvm-svn: 297322
2017-03-08[DebugInfo] Add address space when creating DIDerivedTypesKonstantin Zhuravlyov2-6/+43
Differential Revision: https://reviews.llvm.org/D29671 llvm-svn: 297321
2017-03-08Take into account C++17's noexcept function types during merging -- it shouldRichard Smith1-2/+16
be possible to merge a declaration with an unresolved function type against one with a resolved function type. llvm-svn: 297316
2017-03-08Driver/ToolChains: Mips -> MipsLinuxKonstantin Zhuravlyov4-6/+6
- Mips is architecture, not a toolchain - Might help eliminate the confusion in the future by not having header files with the same name Differential Revision: https://reviews.llvm.org/D30753 llvm-svn: 297312
2017-03-08[ubsan] Detect UB loads from bitfieldsVedant Kumar3-5/+6
It's possible to load out-of-range values from bitfields backed by a boolean or an enum. Check for UB loads from bitfields. This is the motivating example: struct S { BOOL b : 1; // Signed ObjC BOOL. }; S s; s.b = 1; // This is actually stored as -1. if (s.b == 1) // Evaluates to false, -1 != 1. ... Differential Revision: https://reviews.llvm.org/D30423 llvm-svn: 297298
2017-03-08Add missing implementation for AtomicChange::replace(...)Eric Liu1-0/+5
Summary: Just realized the implementation is missing... Reviewers: klimek Reviewed By: klimek Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D30735 llvm-svn: 297289
2017-03-08[analyzer] Clarify 'uninitialized function argument' messagesDaniel Marjamaki1-31/+45
Differential Revision: https://reviews.llvm.org/D30341 llvm-svn: 297283
2017-03-08Honor __unaligned in codegen for declarations and expressionsRoger Ferrer Ibanez3-0/+6
This patch honors the unaligned type qualifier (currently available through he keyword __unaligned and -fms-extensions) in CodeGen. In the current form the patch affects declarations and expressions. It does not affect fields of classes. Differential Revision: https://reviews.llvm.org/D30166 llvm-svn: 297276
2017-03-08[clang-format] Look at NoLineBreak and NoLineBreakInOperand before ↵Krasimir Georgiev1-1/+5
breakProtrudingToken Summary: This patch makes ContinuationIndenter call breakProtrudingToken only if NoLineBreak and NoLineBreakInOperand is false. Previously, clang-format required two runs to converge on the following example with 24 columns: Note that the second operand shouldn't be splitted according to NoLineBreakInOperand, but the token breaker doesn't take that into account: ``` func(a, "long long long long", c); ``` After first run: ``` func(a, "long long " "long long", c); ``` After second run, where NoLineBreakInOperand is taken into account: ``` func(a, "long long " "long long", c); ``` With the patch, clang-format now obtains in one run: ``` func(a, "long long long" "long", c); ``` which is a better token split overall. Reviewers: djasper Reviewed By: djasper Subscribers: cfe-commits, klimek Differential Revision: https://reviews.llvm.org/D30575 llvm-svn: 297274
2017-03-08[XRay] Use AddCXXStdlibLibArgs. NFCI.Jonas Hahnfeld1-4/+3
This function already does the very same thing. llvm-svn: 297271
2017-03-08clang-format: Get slightly better at understanding */&.Daniel Jasper1-1/+2
Before: void f() { MACRO(A * const a); } After: void f() { MACRO(A *const a); } llvm-svn: 297268
2017-03-08[clang-format] Fixed a typo in Format.cpp and a clang-tidy nit about ↵Krasimir Georgiev1-3/+3
std::function copying; NFC llvm-svn: 297265
2017-03-08[clang-format] Fix parameter name comment; NFCKrasimir Georgiev1-1/+1
llvm-svn: 297263
2017-03-08[clang-format] Reformat BreakableToken.h; NFCKrasimir Georgiev1-19/+14
llvm-svn: 297262
2017-03-08[clang-format] Enable comment reflowing in multiline comments containing pragmasKrasimir Georgiev3-12/+17
Summary: This patch enables comment reflowing of lines not matching the comment pragma regex in multiline comments containing comment pragma lines. Previously, these comments were dumped without being reindented to the result. Reviewers: djasper, mprobst Reviewed By: mprobst Subscribers: klimek, mprobst, cfe-commits Differential Revision: https://reviews.llvm.org/D30697 llvm-svn: 297261
2017-03-08[Driver] Consolidate tools and toolchains by target platform. (NFC)David L. Jones86-19213/+20919
Summary: (This is a move-only refactoring patch. There are no functionality changes.) This patch splits apart the Clang driver's tool and toolchain implementation files. Each target platform toolchain is moved to its own file, along with the closest-related tools. Each target platform toolchain has separate headers and implementation files, so the hierarchy of classes is unchanged. There are some remaining shared free functions, mostly from Tools.cpp. Several of these move to their own architecture-specific files, similar to r296056. Some of them are only used by a single target platform; since the tools and toolchains are now together, some helpers now live in a platform-specific file. The balance are helpers related to manipulating argument lists, so they are now in a new file pair, CommonArgs.h and .cpp. I've tried to cluster the code logically, which is fairly straightforward for most of the target platforms and shared architectures. I think I've made reasonable choices for these, as well as the various shared helpers; but of course, I'm happy to hear feedback in the review. There are some particular things I don't like about this patch, but haven't been able to find a better overall solution. The first is the proliferation of files: there are several files that are tiny because the toolchain is not very different from its base (usually the Gnu tools/toolchain). I think this is mostly a reflection of the true complexity, though, so it may not be "fixable" in any reasonable sense. The second thing I don't like are the includes like "../Something.h". I've avoided this largely by clustering into the current file structure. However, a few of these includes remain, and in those cases it doesn't make sense to me to sink an existing file any deeper. Reviewers: rsmith, mehdi_amini, compnerd, rnk, javed.absar Subscribers: emaste, jfb, danalbert, srhines, dschuff, jyknight, nemanjai, nhaehnle, mgorny, cfe-commits Differential Revision: https://reviews.llvm.org/D30372 llvm-svn: 297250
2017-03-08[ODRHash] Hash typedefs and usings statements in classes.Richard Trieu1-0/+17
llvm-svn: 297246
2017-03-07Use filename in linemarker when compiling preprocessed source (Revised)Taewook Oh1-2/+46
Summary: This is a revised version of D28796. Included test is changed to resolve the target compatibility issue reported (rL293032). Reviewers: inglorion, dblaikie, echristo, aprantl, probinson Reviewed By: inglorion Subscribers: mehdi_amini, cfe-commits Differential Revision: https://reviews.llvm.org/D30663 llvm-svn: 297194
2017-03-07[analyzer] Fix crashes in CastToStruct checker for undefined structsDaniel Marjamaki1-0/+4
This crash was reported in https://bugs.llvm.org//show_bug.cgi?id=31173 Differential Revision: https://reviews.llvm.org/D28297 llvm-svn: 297187
2017-03-07[analyzer] Improve valist checks and move it out from alpha state.Gabor Horvath1-24/+65
This patch makes the valist check more robust to the different AST variants on different platforms and also fixes a FIXME. Differential Revision: https://reviews.llvm.org/D30157 llvm-svn: 297153
2017-03-07[clang-format] Fixed indent issue when adding a comment at the end of a ↵Andi-Bogdan Postelnicu1-2/+2
return type in named function declaration. Differential Revision: https://reviews.llvm.org/D30646 llvm-svn: 297143
2017-03-07[clang-format] Support namespaces ending in semicolonKrasimir Georgiev1-7/+21
Summary: This patch adds support for namespaces ending in semicolon to the namespace comment fixer. source: ``` namespace A { int i; int j; }; ``` clang-format before: ``` namespace A { int i; int j; } // namespace A; ``` clang-format after: ``` namespace A { int i; int j; }; // namespace A ``` Reviewers: djasper Reviewed By: djasper Subscribers: cfe-commits, klimek Differential Revision: https://reviews.llvm.org/D30688 llvm-svn: 297140
2017-03-07[index] Mark categories of test classes with the 'UnitTest' symbol property ↵Argyrios Kyrtzidis1-1/+9
as well. llvm-svn: 297133
2017-03-07[AST/ObjC] Make ObjCCategoryImplDecl consistent with ObjCCategoryDecl and ↵Argyrios Kyrtzidis6-8/+15
use the category name as its DeclName This also addresses the badness in ObjCCategoryImplDecl's API, which was hiding NamedDecl's APIs with different meaning. llvm-svn: 297131
2017-03-07[analyzer] Fix crash when building CFG with variable of incomplete typeMartin Bohme1-1/+1
Summary: I've included a unit test with a function template containing a variable of incomplete type. Clang compiles this without errors (the standard does not require a diagnostic in this case). Without the fix, this case triggers the crash. Reviewers: klimek Reviewed By: klimek Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D30636 llvm-svn: 297129
2017-03-07Fix unused variable in SemaCoroutine.cppEric Fiselier1-1/+0
llvm-svn: 297105
2017-03-06Set the Int64Type / IntMaxType types correctly for OpenBSD/mips64Brad Smith1-1/+5
llvm-svn: 297098
2017-03-06[coroutines] Add DependentCoawaitExpr and fix re-building CoroutineBodyStmt.Eric Fiselier15-221/+488
Summary: The changes contained in this patch are: 1. Defines a new AST node `CoawaitDependentExpr` for representing co_await expressions while the promise type is still dependent. 2. Correctly detect and transform the 'co_await' operand to `p.await_transform(<expr>)` when possible. 3. Change the initial/final suspend points to build during the initial parse, so they have the correct operator co_await lookup results. 4. Fix transformation of the CoroutineBodyStmt so that it doesn't re-build the final/initial suspends. @rsmith: This change is a little big, but it's not trivial for me to split it up. Please let me know if you would prefer this submitted as multiple patches. Reviewers: rsmith, GorNishanov Reviewed By: rsmith Subscribers: ABataev, rsmith, mehdi_amini, cfe-commits Differential Revision: https://reviews.llvm.org/D26057 llvm-svn: 297093
2017-03-06[coroutines] Improve diagnostics when building implicit constructs.Eric Fiselier1-19/+27
Previously when a coroutine was building the implicit setup/destroy constructs it would emit diagostics about failures on the first co_await/co_return/co_yield it encountered. This was confusing because that construct may not itself be ill-formed. This patch moves the diagnostics to the function start instead. llvm-svn: 297089
2017-03-06Don't assume cleanup emission preserves dominance in expr evaluationReid Kleckner5-25/+83
Summary: Because of the existence branches out of GNU statement expressions, it is possible that emitting cleanups for a full expression may cause the new insertion point to not be dominated by the result of the inner expression. Consider this example: struct Foo { Foo(); ~Foo(); int x; }; int g(Foo, int); int f(bool cond) { int n = g(Foo(), ({ if (cond) return 0; 42; })); return n; } Before this change, result of the call to 'g' did not dominate its use in the store to 'n'. The early return exit from the statement expression branches to a shared cleanup block, which ends in a switch between the fallthrough destination (the assignment to 'n') or the function exit block. This change solves the problem by spilling and reloading expression evaluation results when any of the active cleanups have branches. I audited the other call sites of enterFullExpression, and they don't appear to keep and Values live across the site of the cleanup, except in ARC code. I wasn't able to create a test case for ARC that exhibits this problem, though. Reviewers: rjmccall, rsmith Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D30590 llvm-svn: 297084
2017-03-06[coroutines] Add co_return statement emissionGor Nishanov3-2/+37
Summary: Added co_return statement emission. Tweaked coro-alloc.cpp test to use co_return to trigger coroutine processing instead of co_await, since this change starts emitting the body of the coroutine and await expression handling has not been upstreamed yet. Reviewers: rsmith, majnemer, EricWF, aaron.ballman Reviewed By: rsmith Subscribers: majnemer, llvm-commits, mehdi_amini Differential Revision: https://reviews.llvm.org/D29979 llvm-svn: 297076
2017-03-06[MS] Add support for __ud2 and __int2c MSVC intrinsicsReid Kleckner2-2/+15
This was requested in PR31958 and elsewhere. llvm-svn: 297057
2017-03-06Further fixes and improvements to the ConstantInitBuilder API.John McCall1-6/+95
llvm-svn: 297050
2017-03-06[clang-format] Make NamespaceEndCommentFixer add at most one commentKrasimir Georgiev1-1/+4
Summary: Until now, NamespaceEndCommentFixer was adding missing comments for every run, which results in multiple end comments for: ``` namespace { int i; int j; } #if A int a = 1; #else int a = 2; #endif ``` result before: ``` namespace { int i; int j; }// namespace // namespace #if A int a = 1; #else int a = 2; #endif ``` result after: ``` namespace { int i; int j; }// namespace #if A int a = 1; #else int a = 2; #endif ``` Reviewers: djasper Reviewed By: djasper Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D30659 llvm-svn: 297028
2017-03-06[CodeGen][Blocks] Refactor capture handling in code that generatesAlex Lorenz1-118/+173
block copy/destroy routines This is a preparation commit for work on merging unique block copy/destroy helper functions. rdar://22950898 Differential Revision: https://reviews.llvm.org/D30345 llvm-svn: 297023
2017-03-06[Sema][ObjC] Warn about 'performSelector' calls with selectorsAlex Lorenz3-8/+81
that return record or vector types The performSelector family of methods from Foundation use objc_msgSend to dispatch the selector invocations to objects. However, method calls to methods that return record types might have to use the objc_msgSend_stret as the return value won't find into the register. This is also supported by this sentence from performSelector documentation: "The method should not have a significant return value and should take a single argument of type id, or no arguments". This commit adds a new warning that warns when a selector which corresponds to a method that returns a record type is passed into performSelector. rdar://12056271 Differential Revision: https://reviews.llvm.org/D30174 llvm-svn: 297019
2017-03-06Do not include GCC "resource" directory into the set of built-in include ↵Anton Korobeynikov1-17/+1
paths on MingW. Patch by Mateusz Mikuła. Differential Revision: https://reviews.llvm.org/D29464 llvm-svn: 297005
2017-03-06[XRay] [clang] Allow logging the first argument of a function call.Dean Michael Berris2-0/+20
Summary: Functions with the "xray_log_args" attribute will tell LLVM to emit a special XRay sled for compiler-rt to copy any call arguments to your logging handler. Reviewers: dberris Reviewed By: dberris Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D29704 llvm-svn: 296999
2017-03-06[ubsan] Extend the nonnull arg check to ObjCVedant Kumar4-15/+39
UBSan's nonnull argument check applies when a parameter has the "nonnull" attribute. The check currently works for FunctionDecls, but not for ObjCMethodDecls. This patch extends the check to work for ObjC. Differential Revision: https://reviews.llvm.org/D30599 llvm-svn: 296996
2017-03-04Refactor ConstantInitBuilder to allow other frontends to moreJohn McCall1-19/+79
easily extend the aggregate-builder API. Stupid missing language features. Also add APIs for constructing a relative reference and computing the offset of a position from the start of the initializer. llvm-svn: 296979
2017-03-04[index] C++: Improve handling of typedefs as base names in C++ class ↵Argyrios Kyrtzidis1-6/+18
declarations Report the typedef as reference, and desugar it to report the underlying class as an implicit 'base' reference. Reporting the underlying base class for 'base' relations matches the ObjC handling and leads to a simpler model. llvm-svn: 296975
2017-03-04[index] ObjC: Improve handling of typedefs as base names in ObjC interface ↵Argyrios Kyrtzidis1-8/+27
declarations - Report the typedef reference occurrence - Mark super or protocol references as 'implicit' when they come from a typedef. llvm-svn: 296974