summaryrefslogtreecommitdiffstats
path: root/clang/lib
Commit message (Collapse)AuthorAgeFilesLines
* [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
* [coroutines] Add feature-test macro for coroutines, defined to 1 to indicateRichard Smith2015-10-221-0/+2
| | | | | | the implementation is incomplete. llvm-svn: 250982
* [coroutines] Add lexer support for co_await, co_yield, and co_return keywords.Richard Smith2015-10-222-1/+4
| | | | | | | Add -fcoroutines flag (just for -cc1 for now) to enable the feature. Early indications are that this will be part of -std=c++1z. llvm-svn: 250980
* Fix a couple places where InsertText was being called with a pointer and ↵Craig Topper2015-10-222-5/+5
| | | | | | | | size when it really expects a StringRef and a normally optional bool argument. The pointer was being implicitly converted to a StringRef and the size was being passed into the bool. Since the bool has a default value normally, no one noticed that the wrong number of arguments was given. llvm-svn: 250977
* Pass an ArrayRef instead of pointer and size. NFCCraig Topper2015-10-222-68/+38
| | | | llvm-svn: 250976
* Change SortAndUniqueProtocols to operate directly on a SmallVector rather ↵Craig Topper2015-10-221-16/+11
| | | | | | | | than taking a pointer and element count that it modifies. This paves the way to directly convert the small vector into an ArrayRef without needing to explicitly pass the modified size. No functional change intended. While there also use a range-based for loop and use append instead of insert to copy elements into the empty SmallVector." llvm-svn: 250971
* Use front() instead of [0] to make code more consistent with the next line ↵Craig Topper2015-10-221-1/+1
| | | | | | that uses back(). llvm-svn: 250970
* Fix use-after-free in ModuleManagerBen Langmuir2015-10-211-0/+3
| | | | | | | | | | | | | When removing out-of-date modules we might have left behind a VisitOrder that contains pointers to freed ModuleFiles. This was very rarely seen, because it only happens when modules go out of date and the VisitOrder happens to have the right size to not be recomputed. Thanks ASan! rdar://23181512 llvm-svn: 250963
* Enable ARC on the fragile runtime.John McCall2015-10-211-2/+7
| | | | | | | | | | | | | | | | This is almost entirely a matter of just flipping a switch. 99% of the runtime support is available all the way back to when it was implemented in the non-fragile runtime, i.e. in Lion. However, fragile runtimes do not recognize ARC-style ivar layout strings, which means that accessing __strong or __weak ivars reflectively (e.g. via object_setIvar) will end up accessing the ivar as if it were __unsafe_unretained. Therefore, when using reflective technologies like KVC, be sure that your paths always refer to a property. rdar://23209307 llvm-svn: 250955
* [Driver] Alias -fvisibility=internal to -fvisibility=hiddenReid Kleckner2015-10-211-1/+1
| | | | | | | | | | | | | | | | | | The ELF symbol visibilities are: - internal: Not visibile across DSOs, cannot pass address across DSOs - hidden: Not visibile across DSOs, can be called indirectly - default: Usually visible across DSOs, possibly interposable - protected: Visible across DSOs, not interposable LLVM only supports the latter 3 visibilities. Internal visibility is in theory useful, as it allows you to assume that the caller is maintaining a PIC register for you in %ebx, or in some other pre-arranged location. As far as LLVM is concerned, this isn't worth the trouble. Using hidden visibility is always correct, so we can just do that. Resolves PR9183. llvm-svn: 250954
* MemorySanitizer does not require PIE.Evgeniy Stepanov2015-10-211-6/+8
| | | | | | | | | | | | | Since r249754 MemorySanitizer should work equally well for PIE and non-PIE executables on Linux/x86_64. Beware, with this change -fsanitize=memory no longer adds implicit -fPIE -pie compiler/linker flags on Linux/x86_64. This is a re-land of r250941, limited to Linux/x86_64 + a very minor refactoring in SanitizerArgs. llvm-svn: 250949
* Revert "MemorySanitizer does not require PIE."Evgeniy Stepanov2015-10-211-1/+1
| | | | | | It actually does require PIE on some targets. llvm-svn: 250944
* MemorySanitizer does not require PIE.Evgeniy Stepanov2015-10-211-1/+1
| | | | | | | | | | Since r249754 MemorySanitizer should work equally well for PIE and non-PIE executables. Beware, with this change -fsanitize=memory no longer adds implicit -fPIE -pie compiler/linker flags, unless the target defaults to PIE. llvm-svn: 250941
* [Sema] Remove an unreachable llvm_unreachableDavid Majnemer2015-10-211-1/+0
| | | | | | No functionality change is intended. llvm-svn: 250935
* [Myriad]: Always add -L paths even if -nostdlib is set.Douglas Katzman2015-10-211-7/+5
| | | | llvm-svn: 250932
* Fix and stylize the emission of GC/ARC ivar and GC block layout strings.John McCall2015-10-211-397/+405
| | | | | | | | | | | | | | | Specifically, handle under-aligned object references (by explicitly ignoring them, because this just isn't representable in the format; yes, this means that GC silently ignores such references), descend into anonymous structs and unions, stop classifying fields of pointer-to-strong/weak type as strong/weak in ARC mode, and emit skips to cover the entirety of block layouts in GC mode. As a cleanup, extract this code into a helper class, avoid a number of unnecessary copies and layout queries, generate skips implicitly instead of explicitly tracking them, and clarify the bitmap-creation logic. llvm-svn: 250919
* Unify the ObjC entrypoint caches.John McCall2015-10-215-49/+47
| | | | llvm-svn: 250918
* Some minor ARC diagnostic improvements.John McCall2015-10-211-2/+5
| | | | llvm-svn: 250917
* In ARC, peephole the initialization of a __weak variable withJohn McCall2015-10-211-0/+47
| | | | | | | a value loaded from a __weak variable into a call to objc_copyWeak or objc_moveWeak. llvm-svn: 250916
* clang-format: Teach --sort-includes to interleave #include and #import.Nico Weber2015-10-211-4/+5
| | | | | | | | | | clang accepts both #include and #import for includes (the latter having an implicit header guard). Let clang-format interleave both types if --sort-includes is passed. #import is used frequently in Objective-C code. http://reviews.llvm.org/D13853 llvm-svn: 250909
* Update clang to match llvm r250901. OptTable constructor now takes an ↵Craig Topper2015-10-211-1/+1
| | | | | | ArrayRef. NFC llvm-svn: 250903
* Use StringRef instead of calling c_str and doing pointer math before ↵Craig Topper2015-10-211-2/+2
| | | | | | eventually creating a StringRef. NFC llvm-svn: 250902
* Revert "[AST] Put TypeLocs and NestedNameSpecifierLocs into the ParentMap."Benjamin Kramer2015-10-212-36/+21
| | | | | | | | | | | | Putting DynTypedNode in the ParentMap bloats its memory foot print. Before the void* key had 8 bytes, now we're at 40 bytes per key which can mean multiple gigabytes increase for large ASTs and this count doesn't even include all the added TypeLoc nodes. Revert until I come up with a better data structure. This reverts commit r250831. llvm-svn: 250889
* Fix __ARM_FP value for sp-only FPUs with Half-precisionRichard Barton2015-10-211-1/+1
| | | | | | | | | The logic for parsing FP capabilities to set __ARM_FP was mistakenly removing the Half-Precision capability when handling fp-only-sp resulting in a value of 0x4. Section 6.5.1 of ACLE states that for such FP architectures the value should be 0x6 llvm-svn: 250888
* [modules] libstdc++ defines some static inline functions in its internalRichard Smith2015-10-211-0/+36
| | | | | | | | | | | headers. If those headers end up being textually included twice into the same module, we get ambiguity errors. Work around this by downgrading the ambiguity error to a warning if multiple identical internal-linkage functions appear in an overload set, and just pick one of those functions as the lookup result. llvm-svn: 250884
* Use range-based for loops. NFC.Craig Topper2015-10-211-24/+18
| | | | llvm-svn: 250881
* Use std::find instead of a manual loop.Craig Topper2015-10-211-4/+2
| | | | llvm-svn: 250880
* Parse into an unsigned type instead of a signed type and then checking for ↵Craig Topper2015-10-211-5/+4
| | | | | | positive and casting to unsigned. Since we know the string starts with a digit it couldn't be negative anyway. NFCI llvm-svn: 250879
* Fix bad indentation.Craig Topper2015-10-211-1/+1
| | | | llvm-svn: 250878
OpenPOWER on IntegriCloud