summaryrefslogtreecommitdiffstats
path: root/clang/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* [CodeGen] Attach function attributes to Objective-C and OpenMPAkira Hatanaka2015-10-282-7/+12
| | | | | | | | | | | | | | functions. This commit fixes a bug in CGOpenMPRuntime.cpp and CGObjC.cpp where some of the function attributes are not attached to newly created functions. rdar://problem/20828324 Differential Revision: http://reviews.llvm.org/D13928 llvm-svn: 251476
* clang-format: When a line is formatted, also format subsequence lines if ↵Daniel Jasper2015-10-281-2/+5
| | | | | | | | | | | | | | their indent is off. Summary: This is especially important so that if a change is solely inserting a block around a few statements, clang-format-diff.py will still clean up and add indentation to the inner parts. Reviewers: klimek Subscribers: cfe-commits, klimek Differential Revision: http://reviews.llvm.org/D14105 llvm-svn: 251474
* Add the ability to define "fake" arguments on attributes.John McCall2015-10-281-2/+3
| | | | | | | | | | | | | | Fake arguments are automatically handled for serialization, cloning, and other representational tasks, but aren't included in pretty-printing or parsing (should we eventually ever automate that). This is chiefly useful for attributes that can be written by the user, but which are also frequently synthesized by the compiler, and which we'd like to remember details of the synthesis for. As a simple example, use this to narrow the cases in which we were generating a specialized note for implicitly unavailable declarations. llvm-svn: 251469
* clang-format: Increase cut-off limit for number of analyzed states.Daniel Jasper2015-10-271-1/+1
| | | | | | | | | | | With more complex structures in C++ Lambdas and JavaScript function literals, the old value was simply to small. However, this is a temporary solution, I need to look at this more closely a) to find a fundamentally better approach and b) to look at whether the more recent usage of NoLineBreak makes us visit stuff in an unfortunate order where clang-format waste many states in dead ends. llvm-svn: 251463
* [analyzer] Assume escape is possible through system functions taking void*Anna Zaks2015-10-272-13/+30
| | | | | | | | | | | | | | | | | | The analyzer assumes that system functions will not free memory or modify the arguments in other ways, so we assume that arguments do not escape when those are called. However, this may lead to false positive leak errors. For example, in code like this where the pointers added to the rb_tree are freed later on: struct alarm_event *e = calloc(1, sizeof(*e)); <snip> rb_tree_insert_node(&alarm_tree, e); Add a heuristic to assume that calls to system functions taking void* arguments allow for pointer escape. llvm-svn: 251449
* Tweak how -Wunused-value interacts with macrosNico Weber2015-10-271-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. Make the warning more strict in C mode. r172696 added code to suppress warnings from macro expansions in system headers, which checks `SourceMgr.isMacroBodyExpansion(E->IgnoreParens()->getExprLoc())`. Consider this snippet: #define FOO(x) (x) void f(int a) { FOO(a); } In C, the line `FOO(a)` is an `ImplicitCastExpr(ParenExpr(DeclRefExpr))`, while it's just a `ParenExpr(DeclRefExpr)` in C++. So in C++, `E->IgnoreParens()` returns the `DeclRefExpr` and the check tests the SourceLoc of `a`. In C, the `ImplicitCastExpr` has the effect of checking the SourceLoc of `FOO`, which is a macro body expansion, which causes the diagnostic to be skipped. It looks unintentional that clang does different things for C and C++ here, so use `IgnoreParenImpCasts` instead of `IgnoreParens` here. This has the effect of the warning firing more often than previously in C code – it now fires as often as it fires in C++ code. 2. Suppress the warning if it would warn on `UNREFERENCED_PARAMETER`. `UNREFERENCED_PARAMETER` is a commonly used macro on Windows and it happens to uselessly trigger -Wunused-value. As discussed in the thread "rfc: winnt.h's UNREFERENCED_PARAMETER() vs clang's -Wunused-value" on cfe-dev, fix this by special-casing this specific macro. (This costs a string comparison and some fast-path lexing per warning, but the warning is emitted rarely. It fires once in Windows.h itself, so this code runs at least once per TU including Windows.h, but it doesn't run hundreds of times.) http://reviews.llvm.org/D13969 llvm-svn: 251441
* [mips] Separated mips specific -Wa options, so that they are not checked on ↵Daniel Sanders2015-10-271-12/+30
| | | | | | | | | | | | | | | | other platforms. Summary: This is a follow on to post review comments on revision r248276. Patch by Scott Egerton. Reviewers: vkalintiris, dsanders Subscribers: joerg, rengolin, cfe-commits Differential Revision: http://reviews.llvm.org/D13100 llvm-svn: 251430
* Allow linking multiple bitcode files.Artem Belevich2015-10-272-57/+69
| | | | | | | | | | | | | | | | | | Linking options for particular file depend on the option that specifies the file. Currently there are two: * -mlink-bitcode-file links in complete content of the specified file. * -mlink-cuda-bitcode links in only the symbols needed by current TU. Linked symbols are internalized. This bitcode linking mode is used to link device-specific bitcode provided by CUDA. Files are linked in order they are specified on command line. -mlink-cuda-bitcode replaces -fcuda-uses-libdevice flag. Differential Revision: http://reviews.llvm.org/D13913 llvm-svn: 251427
* [MSVC] Workaround for ICE in cl.exe when compiling ASTContext.cpp in Release ↵Will Wilson2015-10-271-1/+3
| | | | | | | | Win32 Microsoft connect bug: https://connect.microsoft.com/VisualStudio/feedback/details/1741530 llvm-svn: 251415
* [analyzer] Fix lambdas that are capturing constants.Gabor Horvath2015-10-271-7/+14
| | | | llvm-svn: 251407
* clang-format: Undo unwanted format change done in r251405.Daniel Jasper2015-10-272-15/+17
| | | | | | | | Specifically, don't wrap between the {} of an empty constructor if the "}" falls on column 81 and ConstructorInitializerAllOnOneLineOrOnePerLine is set. llvm-svn: 251406
* clang-format: Add an additional value to AlignAfterOpenBracket: AlwaysBreak.Daniel Jasper2015-10-274-21/+44
| | | | | | | | | | | | | | | | | | | | Summary: If this option is set, clang-format will always insert a line wrap, e.g. before the first parameter of a function call unless all parameters fit on the same line. This obviates the need to make a decision on the alignment itself. Use this style for Google's JavaScript style and add some minor tweaks to correctly handle nested blocks etc. with it. Don't use this option for for/while loops. Reviewers: klimek Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D14104 llvm-svn: 251405
* [analyzer] Fix another crash when analyzing lambda functions.Gabor Horvath2015-10-271-1/+2
| | | | llvm-svn: 251404
* Properly clear current coroutine promise on FunctionScopeInfo reuse. ShouldRichard Smith2015-10-271-0/+1
| | | | | | hopefully make bots happy again. llvm-svn: 251397
* Access the right triple field for IAMCU.Michael Kuperstein2015-10-271-2/+2
| | | | llvm-svn: 251396
* Handle target builtin options that are all required rather thanEric Christopher2015-10-272-24/+27
| | | | | | | | | | | | | | | | | only one of a group of possibilities. This changes the syntax in the builtin files to represent: , as the and operator | as the or operator The former syntax matches how the backend tablegen files represent multiple subtarget features being required. Updated the builtin and intrinsic headers accordingly for the new syntax. llvm-svn: 251388
* [coroutines] Creation of promise object, lookup of operator co_await, buildingRichard Smith2015-10-2723-81/+487
| | | | | | of await_* calls, and AST representation for same. llvm-svn: 251387
* Create undef reference to profile hook symbol Xinliang David Li2015-10-272-0/+15
| | | | | | | | | Create undef reference to profile hook symbol when PGO instrumentation is turned on. This allows LLVM to omit emission of hook variable use method for every single module instrumented. llvm-svn: 251385
* Be more conservative about diagnosing "incorrect" uses of __weak:John McCall2015-10-273-60/+138
| | | | | | | | | | | | allow them to be written in certain kinds of user declaration and diagnose on the use-site instead. Also, improve and fix some diagnostics relating to __weak and properties. rdar://23228631 llvm-svn: 251384
* Use early exits to reduce indentation.Eric Christopher2015-10-271-46/+48
| | | | llvm-svn: 251371
* MismatchingNewDeleteDetector uses incorrect field, and finds no initializerIsmail Pazarbasi2015-10-261-2/+4
| | | | | | | | | | | | | | | Summary: In `MismatchingNewDeleteDetector::analyzeInClassInitializer`, if `Field`'s initializer expression is null, lookup the field in implicit instantiation, and use found field's the initializer. Reviewers: rsmith, rtrieu Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D9898 llvm-svn: 251335
* [analyzer] Fixed a rare crash when analyzing lambda functions.Gabor Horvath2015-10-261-1/+1
| | | | llvm-svn: 251289
* clang-format: Fix false positive in cast detection.Daniel Jasper2015-10-261-1/+2
| | | | | | | | | | Before (with spaces in parentheses): void inFunction() { std::function<void( int, int )> fct; } After: void inFunction() { std::function<void( int, int)> fct; } llvm-svn: 251284
* [X86] Mark inregs correctly for MCU psABIMichael Kuperstein2015-10-251-5/+18
| | | | | | | | | The MCU psABI calling convention is somewhat, but not quite, like -mregparm 3. In particular, the rules involving structs are different. Differential Revision: http://reviews.llvm.org/D13978 llvm-svn: 251224
* Simplify boolean conditional return statements in lib/Basic.Rafael Espindola2015-10-241-3/+3
| | | | | | Patch by Richard. llvm-svn: 251214
* [ARM] Renaming +t2dsp feature into +dsp, as discussed on llvm-devArtyom Skrobov2015-10-231-1/+1
| | | | llvm-svn: 251124
* Module Debugging: Emit module debug info for types inside of Objective-CAdrian Prantl2015-10-231-0/+4
| | | | | | | | containers. rdar://problem/23196170 llvm-svn: 251120
* Remove a redundant check. NFCAdrian Prantl2015-10-231-2/+1
| | | | llvm-svn: 251116
* [StaticAnalyzer] Use llvm::utostr and not to_string.Davide Italiano2015-10-231-1/+2
| | | | | | | The latter seems unsupported (at least) on MinGW and FreeBSD (where I hit this failure). We can't have nice things. llvm-svn: 251115
* [AST] Plug a memory leak when promoting a single ParentMap entry to a vector.Benjamin Kramer2015-10-231-1/+1
| | | | | | Found by asan! llvm-svn: 251110
* [AST] Re-add TypeLocs and NestedNameSpecifierLocs to the ParentMap.Benjamin Kramer2015-10-232-33/+84
| | | | | | | | | | | | | | | | | | | | This relands r250831 after some fixes to shrink the ParentMap overall with one addtional tweak: nodes with pointer identity (e.g. Decl* and friends) can be store more efficiently so I put them in a separate map. All other nodes (so far only TypeLoc and NNSLoc) go in a different map keyed on DynTypedNode. This further uglifies the code but significantly reduces memory overhead. Overall this change still make ParentMap significantly larger but it's nowhere as bad as before. I see about 25 MB over baseline (pre-r251008) on X86ISelLowering.cpp. If this becomes an issue we could consider splitting the maps further as DynTypedNode is still larger (32 bytes) than a single TypeLoc (16 bytes) but I didn't want to introduce even more complexity now. Differential Revision: http://reviews.llvm.org/D14011 llvm-svn: 251101
* Use newly introduced interfaces in LLVM (NFC)Xinliang David Li2015-10-222-3/+3
| | | | | | | Replaced references to raw strings in instrumentation and coverage code. llvm-svn: 251072
* Define weak and __weak to mean ARC-style weak references, even in MRC.John McCall2015-10-2220-179/+330
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, __weak was silently accepted and ignored in MRC mode. That makes this a potentially source-breaking change that we have to roll out cautiously. Accordingly, for the time being, actual support for __weak references in MRC is experimental, and the compiler will reject attempts to actually form such references. The intent is to eventually enable the feature by default in all non-GC modes. (It is, of course, incompatible with ObjC GC's interpretation of __weak.) If you like, you can enable this feature with -Xclang -fobjc-weak but like any -Xclang option, this option may be removed at any point, e.g. if/when it is eventually enabled by default. This patch also enables the use of the ARC __unsafe_unretained qualifier in MRC. Unlike __weak, this is being enabled immediately. Since variables are essentially __unsafe_unretained by default in MRC, the only practical uses are (1) communication and (2) changing the default behavior of by-value block capture. As an implementation matter, this means that the ObjC ownership qualifiers may appear in any ObjC language mode, and so this patch removes a number of checks for getLangOpts().ObjCAutoRefCount that were guarding the processing of these qualifiers. I don't expect this to be a significant drain on performance; it may even be faster to just check for these qualifiers directly on a type (since it's probably in a register anyway) than to do N dependent loads to grab the LangOptions. rdar://9674298 llvm-svn: 251041
* [MS ABI] Don't crash when inheriting from base with trailing empty array memberDavid Majnemer2015-10-221-1/+1
| | | | | | | | | | We got this right for Itanium but not MSVC because CGRecordLayoutBuilder was checking if the base's size was zero when it should have been checking the non-virtual size. This fixes PR21040. llvm-svn: 251036
* Unbreak the shared cmake build. libToolingCore now depends on libAST.Benjamin Kramer2015-10-221-0/+1
| | | | llvm-svn: 251026
* Disable trigraph and escaped newline expansion on all types of raw string ↵Craig Topper2015-10-221-1/+1
| | | | | | literals not just ASCII type. llvm-svn: 251025
* [Tooling] Add a utility function to replace one nested name with another.Benjamin Kramer2015-10-222-0/+114
| | | | | | | | | | | | | | | | One problem in clang-tidy and other clang tools face is that there is no way to lookup an arbitrary name in the AST, that's buried deep inside Sema and might not even be what the user wants as the new name may be freshly inserted and not available in the AST. A common use case for lookups is replacing one nested name with another while minimizing namespace qualifications, so replacing 'ns::foo' with 'ns::bar' will use just 'bar' if we happen to be inside the namespace 'ns'. This adds a little helper utility for exactly that use case. Differential Revision: http://reviews.llvm.org/D13931 llvm-svn: 251022
* Attempt to fix build bot test failures.Gabor Horvath2015-10-221-1/+1
| | | | llvm-svn: 251014
* [analyzer] Bug identificationGabor Horvath2015-10-226-10/+262
| | | | | | | | | | | | | | | | This patch adds hashes to the plist and html output to be able to identfy bugs for suppressing false positives or diff results against a baseline. This hash aims to be resilient for code evolution and is usable to identify bugs in two different snapshots of the same software. One missing piece however is a permanent unique identifier of the checker that produces the warning. Once that issue is resolved, the hashes generated are going to change. Until that point this feature is marked experimental, but it is suitable for early adoption. Differential Revision: http://reviews.llvm.org/D10305 Original patch by: Bence Babati! llvm-svn: 251011
* [AST] Remove redundant template keywords.Benjamin Kramer2015-10-221-3/+3
| | | | | | GCC complains about them, clang does not. llvm-svn: 251009
* [AST] Store Decl* and Stmt* directly into the ParentMap.Benjamin Kramer2015-10-221-14/+29
| | | | | | | | | | | | | | | | | | These are by far the most common types to be parents in the AST so it makes sense to optimize for them. Put them directly into the value of the map. This currently saves 32 bytes per parent in the map and a pointer indirection at the cost of some additional complexity in the code. Sadly this means we cannot return an ArrayRef from getParents anymore, add a proxy class that can own a single DynTypedNode and otherwise behaves exactly the same as ArrayRef. For example on a random large file (X86ISelLowering.cpp) this reduces the size of the parent map by 24 MB. Differential Revision: http://reviews.llvm.org/D13976 llvm-svn: 251008
* [MS ABI] Mangle static anonymous unionsDavid Majnemer2015-10-222-13/+4
| | | | | | | | | | | | We believed that internal linkage variables at global scope which are not variable template specializations did not have to be mangled. However, static anonymous unions have no identifier and therefore must be mangled. This fixes PR18204. llvm-svn: 250997
* clang driver toolchain refactoringXinliang David Li2015-10-224-55/+47
| | | | | | | | | | | | | | In this patch, the file static method addProfileRT is moved to be a virtual member function of base ToolChain class. This allows derived toolchain to override the default behavior easily and make it consistent with Darwin toolchain (a TODO was added for this refactoring - now removed). A new helper method is also introduced to test if instrumentation profile option is turned on or not. Differential Revision: http://reviews.llvm.org/D13326 llvm-svn: 250994
* [coroutines] Initial stub Sema functionality for handling coroutine await / ↵Richard Smith2015-10-228-15/+142
| | | | | | yield / return. llvm-svn: 250993
* [coroutines] Add overloaded unary 'operator co_await'.Richard Smith2015-10-225-0/+14
| | | | llvm-svn: 250991
* Convert ActOnForwardProtocolDeclaration to take an ArrayRef and use a ↵Craig Topper2015-10-222-10/+7
| | | | | | range-based for loop. NFC llvm-svn: 250990
* Use an ArrayRef<OffsetOfComponent> instead of pointer and size throughout ↵Craig Topper2015-10-223-19/+13
| | | | | | offsetof handling code. Also use a range-based for loop. NFC llvm-svn: 250989
* Change FindProtocolDeclaration to take an ArrayRef and use a range-based for ↵Craig Topper2015-10-222-16/+10
| | | | | | loop. NFC llvm-svn: 250988
* Change MacroInfo::setArgumentList to take an ArrayRef instead of pointer and ↵Craig Topper2015-10-222-5/+4
| | | | | | size. While there use std::copy intead of a manual loop. llvm-svn: 250987
* [coroutines] Add parsing support for co_await expression, co_yield expression,Richard Smith2015-10-223-3/+54
| | | | | | co_await modifier on range-based for loop, co_return statement. llvm-svn: 250985
OpenPOWER on IntegriCloud