summaryrefslogtreecommitdiffstats
path: root/clang/lib
Commit message (Collapse)AuthorAgeFilesLines
* clang-format: Add an option 'SpaceAfterCStyleCast'.Daniel Jasper2014-09-032-2/+5
| | | | | | | | | | | | | | | | | This permits to add a space after closing parenthesis of a C-style cast. Defaults to false to preserve old behavior. Fixes llvm.org/PR19982. Before: (int)i; After: (int) i; Patch by Marek Kurdej. llvm-svn: 217022
* Allow a scoped lockable object to acquire/release multiple locks.Ed Schouten2014-09-031-125/+162
| | | | | | | | | | | | | | | | | Scoped lockable objects (mutex guards) are implemented as if it is a lock itself that is acquired upon construction and unlocked upon destruction. As it if course needs to be used to actually lock down something else (a mutex), it keeps track of this knowledge through its underlying mutex field in its FactEntry. The problem with this approach is that this only allows us to lock down a single mutex, so extend the code to use a vector of underlying mutexes. This, however, makes the code a bit more complex than necessary, so subclass FactEntry into LockableFactEntry and ScopedLockableFactEntry and move all the logic that differs between regular locks and scoped lockables into member functions. llvm-svn: 217016
* [modules] Use DeclContext::equals rather than == on DeclContext* whenRichard Smith2014-09-031-0/+5
| | | | | | | | | | determining whether a declaration is out of line, instead of assuming that the semantic and lexical DeclContext will be the same declaration whenever they're the same entity. This fixes behavior of declarations within merged classes and enums. llvm-svn: 217008
* Fix up formatting.Eli Bendersky2014-09-021-1/+1
| | | | llvm-svn: 216976
* Don't indent inside a namespace.Rafael Espindola2014-09-021-28/+28
| | | | llvm-svn: 216937
* Don't allow lambdas to capture invalid decls during template instantiations.Richard Trieu2014-09-021-1/+1
| | | | | | Fixes PR20731. llvm-svn: 216936
* Fix for LLVM API change to SpecialCaseList::createDavid Blaikie2014-09-021-1/+2
| | | | llvm-svn: 216926
* Frontend: Reindent Opts.CoverageFileDavid Majnemer2014-09-011-1/+1
| | | | | | No functional change intended. llvm-svn: 216888
* MS ABI: Reindent MicrosoftCXXABI::GetVirtualBaseClassOffsetDavid Majnemer2014-09-011-8/+6
| | | | | | No functional change intended. llvm-svn: 216887
* Typo fix, no functionality change.Alexander Potapenko2014-09-011-1/+1
| | | | llvm-svn: 216876
* Fix some cases where StringRef was being passed by const reference. Remove ↵Craig Topper2014-08-3010-24/+24
| | | | | | const from some other StringRefs since its implicitly const already. llvm-svn: 216825
* Use llvm::makeArrayRef instead of explicitly calling ArrayRef constructor ↵Craig Topper2014-08-308-28/+19
| | | | | | and mentioning the type. This works now that we have a conversion from ArrayRef<T*> to ArrayRef<const T*>. llvm-svn: 216824
* [modules] Fix deserialization cycle when loading a tag declaration with a ↵Richard Smith2014-08-302-59/+77
| | | | | | typedef name for linkage purposes. When loading the type, delay loading its typedef until we've finished loading and merging the type. In its place, save out the name of the typedef, which we need for merging purposes. llvm-svn: 216806
* Debug info: Only emit C++ accessibility specifiers when they are divergingAdrian Prantl2014-08-292-41/+54
| | | | | | | | from the default for the containing type. rdar://problem/18154959 llvm-svn: 216800
* unique_ptrify PTHManager's PerIDCache using the newly added llvm::FreeDeleterDavid Blaikie2014-08-291-14/+12
| | | | llvm-svn: 216786
* unique_ptrify some parameters to PTHManager::PTHManagerDavid Blaikie2014-08-291-35/+29
| | | | | | | | | A couple of these arguments were passed by void* as a rather extreme example of pimpling. Adjusting this to a more classic form of the idiom (involving forward declarations) makes this more legible and allows explicit passing of ownership via std::unique_ptr. llvm-svn: 216785
* Make all virtual member pointers use variadic musttail callsReid Kleckner2014-08-293-12/+40
| | | | | | | | | This avoids encoding information about the function prototype into the thunk at the cost of some function prototype bitcast gymnastics. Fixes PR20653. llvm-svn: 216782
* Fix for PR20660, where unexpanded parameter pack in function parameter ↵Larisse Voufo2014-08-291-7/+31
| | | | | | clause causes clang to crash. llvm-svn: 216778
* Add a comment, no functional change.Nico Weber2014-08-291-1/+1
| | | | llvm-svn: 216777
* Objective-C [qoi]. If property is going to be implementedFariborz Jahanian2014-08-291-3/+4
| | | | | | | | in the super class, do not issue the warning about property in current class's protocol will not be auto synthesized. // rdar://18179833 llvm-svn: 216769
* unique_ptrify the raw_ostream argument to clang::serialized_diags::createDavid Blaikie2014-08-292-12/+12
| | | | llvm-svn: 216767
* unique_ptrify clang::ento::createCheckerManagerDavid Blaikie2014-08-292-18/+11
| | | | llvm-svn: 216765
* unique_ptrify PathDiagnosticConsumer::HandlePathDiagnosticDavid Blaikie2014-08-292-7/+6
| | | | | | | FoldingSet, another intrusive data structure that could use some unique_ptr love on its interfaces. Eventually. llvm-svn: 216764
* Add an option to silence all analyzer warnings.Anna Zaks2014-08-293-2/+12
| | | | | | | | | | | | People have been incorrectly using "-analyzer-disable-checker" to silence analyzer warnings on a file, when analyzing a project. Add the "-analyzer-disable-all-checks" option, which would allow the suppression and suggest it as part of the error message for "-analyzer-disable-checker". The idea here is to compose this with "--analyze" so that users can selectively opt out specific files from static analysis. llvm-svn: 216763
* unique_ptrify thep passing of BugReports to BugReportEquivClassDavid Blaikie2014-08-291-4/+3
| | | | | | | | I suspect llvm::ilist should take elements by unique_ptr, since it does take ownership of the element (by stitching it into the linked list) - one day. llvm-svn: 216761
* unique_ptrify HeaderMap::FileBufferDavid Blaikie2014-08-291-6/+3
| | | | llvm-svn: 216758
* unique_ptrify Preprocessor's TokenLexerCacheDavid Blaikie2014-08-292-13/+12
| | | | llvm-svn: 216756
* unique_ptrify the result of CFG::buildCFG/CFGBuilder::buildCFGDavid Blaikie2014-08-292-11/+9
| | | | llvm-svn: 216755
* Objective-C. Tweak diagnosing properties that are not auto-synthesized.Fariborz Jahanian2014-08-291-20/+19
| | | | | | | | | | | Do not warn when property declared in class's protocol will be auto-synthesized by its uper class implementation because super class has also declared this property while this class has not. Continue to warn if current class has declared the property also (because this declaration will not result in a 2nd synthesis). rdar://18152478 llvm-svn: 216753
* unique_ptrify PathDiagnostic::setEndOfPath's argumentDavid Blaikie2014-08-291-4/+4
| | | | | | | | | | | | | | Again, if shared ownership is the right model here (I assume it is, given graph algorithms & such) this could be tidied up (the 'release' call removed in favor of something safer) by having IntrunsiveRefCntPointer constructible from a unique_ptr. (& honestly I'd probably favor taking a page out of shared_ptr's book, allowing implicit construction from a unique_ptr rvalue, and only allow explicit from a raw pointer - currently IntrusiveRefCntPointer can implicitly own from a raw pointer, which seems unsafe) llvm-svn: 216752
* unique_ptr-ify PathDiagnosticPiece ownershipDavid Blaikie2014-08-294-36/+31
| | | | llvm-svn: 216751
* Provide a BuryPointer for unique_ptrs.David Blaikie2014-08-293-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In theory, it'd be nice if we could move to a case where all buried pointers were buried via unique_ptr to demonstrate that the program had finished with the value (that we could really have cleanly deallocated it) but instead chose to bury it. I think the main reason that's not possible right now is the various IntrusiveRefCntPtrs in the Frontend, sharing ownership for a variety of compiler bits (see the various similar "CompilerInstance::releaseAndLeak*" functions). I have yet to figure out their correct ownership semantics - but perhaps, even if the intrusiveness can be removed, the shared ownership may yet remain and that would lead to a non-unique burying as is there today. (though we could model that a little better - by passing in a shared_ptr, etc - rather than needing the two step that's currently used in those other releaseAndLeak* functions) This might be a bit more robust if BuryPointer took the boolean: BuryPointer(bool, unique_ptr<T>) and the choice to bury was made internally - that way, even when DisableFree was not set, the unique_ptr would still be null in the caller and there'd be no chance of accidentally having a different codepath where the value is used after burial in !DisableFree, but it becomes null only in DisableFree, etc... llvm-svn: 216742
* unique_ptrify Directives in VerifyDiagnosticConsumerDavid Blaikie2014-08-291-19/+21
| | | | llvm-svn: 216740
* clang-format: Fix unary operator detection in corner case.Daniel Jasper2014-08-291-2/+1
| | | | | | | | | | Before: decltype(* ::std::declval<const T &>()) void F(); After: decltype(*::std::declval<const T &>()) void F(); llvm-svn: 216724
* ASTMatchers: Replace some copies of the bound nodes tree builder with moves.Benjamin Kramer2014-08-291-2/+2
| | | | | | | | | But don't move if all we do is clearing the thing. The move method is too large to be inlined and performs a ton of unnecessary checking when the RHS is empty. No functionality change. llvm-svn: 216723
* Use store size instead of alloc size when coercing.James Molloy2014-08-291-3/+5
| | | | | | | | | | Previously, EnterStructPointerForCoercedAccess used Alloc size when determining how to convert. This was problematic, because there were situations were the alloc size was larger than the store size. For example, if the first element of a structure were i24 and the destination type were i32, the old code would generate a GEP and a load i24. The code should compare store sizes to ensure the whole object is loaded. I have attached a test case. This patch modifies the output of arm64-be-bitfield.c test case, but the new IR seems to be equivalent, and after -O3, the compiler generates identical ARM assembly. (asr x0, x0, #54) Patch by Thomas Jablin! llvm-svn: 216722
* unique_ptrify SourceManager::createFileIDDavid Blaikie2014-08-297-9/+10
| | | | llvm-svn: 216715
* CodeGen: Don't completely mess-up optimized atomic libcallsDavid Majnemer2014-08-291-13/+31
| | | | | | | | | | | | | | | | | | | | | | | Summary: We did a great job getting this wrong: - We messed up which LLVM IR types to use for arguments and return values. The optimized libcalls use integer types for values. Clang attempted to use the IR type which corresponds to the value passed in instead of using an appropriately sized integer type. This would result in violations of the ABI for, as an example, floating point types. - We didn't bother recording the result of the atomic libcall in the destination memory. Instead, call the functions with arguments matching the type of the libcall prototype's parameters. This fixes PR20780. Differential Revision: http://reviews.llvm.org/D5098 llvm-svn: 216714
* unique_ptrify Driver Action handlingDavid Blaikie2014-08-292-65/+76
| | | | | | | | | | | | It hits a limit when we reach ActionList, which is used for dynamic conditional ownership, so we lose type safety there. This did expose at least one caller "lying" about ownership (passing ownership to an Action, then updating the Action to specify that it doesn't actually own the thing that was passed) - changing this to unique_ptr just makes that oddity more obvious. llvm-svn: 216713
* Improve unique_ptr-y ownership in ASTUnit::ComputePreambleDavid Blaikie2014-08-292-50/+31
| | | | | | | | | | | | | | Rather than having a pair of pairs and a reference out parameter, build a structure with everything together and named. A raw pointer and a unique_ptr, rather than a raw pointer and a boolean, are used to communicate ownership transfer. It's possible one day we'll end up with a conditional pointer (probably represented by a raw pointer and a boolean) abstraction to use in places like this. Conditional ownership seems to be coming up more often than I'd hoped... llvm-svn: 216712
* Use llvm::makeArrayRef instead of explicitly calling ArrayRef constructor ↵Craig Topper2014-08-291-3/+1
| | | | | | and mentioning the type. This works now that we have a conversion from ArrayRef<T*> to ArrayRef<const T*>. llvm-svn: 216710
* unique_ptrify clang::BackendConsumer::takeModuleDavid Blaikie2014-08-291-2/+2
| | | | llvm-svn: 216707
* call __asan_load_cxx_array_cookie when loading array cookie in asan mode.Kostya Serebryany2014-08-291-5/+14
| | | | | | | | | | | | | | | | | | Summary: The current implementation of asan cookie is incorrect: we add nosanitize metadata to the cookie load, but the metadata may be lost and we will instrument the load from poisoned memory. This change replaces the load with a call to __asan_load_cxx_array_cookie (r216692) Reviewers: rsmith Reviewed By: rsmith Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D5111 llvm-svn: 216702
* Better codegen support for DLL attributes being dropped after the first ↵Hans Wennborg2014-08-291-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | declaration (PR20792) For the following code: __declspec(dllimport) int f(int x); int user(int x) { return f(x); } int f(int x) { return 1; } Clang will drop the dllimport attribute in the AST, but CodeGen would have already put it on the LLVM::Function, and that would never get updated. (The same thing happens for global variables.) This makes Clang check dropped DLL attribute case each time the LLVM object is referenced. This isn't perfect, because we will still get it wrong if the function is never referenced by codegen after the attribute is dropped, but this handles the common cases and makes us not fail in the verifier. llvm-svn: 216699
* Don't create a null reference in ASTUnit::LoadFromCommandLine.Alexey Samsonov2014-08-281-2/+3
| | | | | | | | | This change is the last in the pack of five commits (also see r216691, r216694, r216695, and r216696) that reduces the number of test failures in "check-clang" invocation in UBSan bootstrap from 2443 down to 5. llvm-svn: 216697
* Don't load invalid enum value in Sema::LazilyCreateBuiltin.Alexey Samsonov2014-08-281-10/+8
| | | | | | This bug was reported by UBSan. llvm-svn: 216696
* Don't create a null reference to NestedNameSpecifier.Alexey Samsonov2014-08-281-1/+2
| | | | | | This bug was reported by UBSan. llvm-svn: 216691
* Call powerpc-darwin external tools with -arch ppc.Rafael Espindola2014-08-282-12/+4
| | | | | | | | | | With this patch we call external tools for powerpc-darwin with "-arch ppc" instead of "-arch powerpc", so as to be compatible with the cctools assembler and ld64 linker. Patch by Stephen Drake! llvm-svn: 216687
* Reverting r216675. This breaks some bots. Before this can be committed ↵Aaron Ballman2014-08-284-58/+7
| | | | | | again, I have to explore runtime ABI requirements with libc++abi. llvm-svn: 216677
* Objective-C IRGen. Fixes an assertion crash caused by inconsistentFariborz Jahanian2014-08-281-2/+1
| | | | | | | | linkage related to generation of OBJC_SELECTOR_REFERENCES symbol needed in generation of call to 'super' in a class method. // rdar://18150301 llvm-svn: 216676
OpenPOWER on IntegriCloud