summaryrefslogtreecommitdiffstats
path: root/clang/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* Don't emit 'unavailable' errors inside an unavailable function. rdar://9623855.Argyrios Kyrtzidis2011-06-171-12/+14
| | | | llvm-svn: 133264
* When emitting a compound literal of POD type, continue to emit aDouglas Gregor2011-06-171-0/+10
| | | | | | | | | | | | | | | | | separate aggregate temporary and then memcpy it over to the destination. This fixes a regression I introduced with r133235, where the compound literal on the RHS of an assignment makes use of the structure on the LHS of the assignment. I'm deeply suspicious of AggExprEmitter::VisitBinAssign()'s optimization where it emits the RHS of an aggregate assignment directly into the LHS lvalue without checking whether there is any aliasing between the LHS/RHS. However, I'm not in a position to revisit this now. Big thanks to Eli for finding the regression! llvm-svn: 133261
* Fix refactoro, silencing an MSVC warning. Thanks, Francois.Douglas Gregor2011-06-171-1/+1
| | | | llvm-svn: 133257
* Perform an acquire memory barrier on the fast path of a thread-safeJohn McCall2011-06-171-11/+33
| | | | | | static initializer check, as required by the Itanium ABI. llvm-svn: 133250
* Initialize a couple of variables to shut GCC up.John McCall2011-06-172-2/+2
| | | | llvm-svn: 133246
* Objective-C fast enumeration loop variables are not retained in ARC, butJohn McCall2011-06-179-40/+93
| | | | | | | | | | | | they should still be officially __strong for the purposes of errors, block capture, etc. Make a new bit on variables, isARCPseudoStrong(), and set this for 'self' and these enumeration-loop variables. Change the code that was looking for the old patterns to look for this bit, and change IR generation to find this bit and treat the resulting variable as __unsafe_unretained for the purposes of init/destroy in the two places it can come up. llvm-svn: 133243
* Extend the deduced/actual argument type checking of C++Douglas Gregor2011-06-171-1/+12
| | | | | | | [temp.deduct.call]p4 to the deduction performed for 'auto', finishing the fix for PR9233. llvm-svn: 133239
* Factor the checking of the deduced argument type against the actualDouglas Gregor2011-06-171-73/+84
| | | | | | | argument type for C++ [temp.deduct.call]p4 out of Sema::FinishTemplateArgumentDeduction(). No functionality change. llvm-svn: 133237
* When an explicit specialization has a storage specifier, error if thatDouglas Gregor2011-06-171-3/+12
| | | | | | | | | storage specifier is different from the storage specifier on the template. If that storage specifier is the same, then we only warn. Thanks to John for the prodding. llvm-svn: 133236
* Implement proper support for generating code for compound literals inDouglas Gregor2011-06-172-5/+11
| | | | | | | | | | | | | C++, which means: - binding the temporary as needed in Sema, so that we generate the appropriate call to the destructor, and - emitting the compound literal into the appropriate location for the aggregate, rather than trying to emit it as a temporary and memcpy() it. Fixes PR10138 / <rdar://problem/9615901>. llvm-svn: 133235
* Downgrade the error complaining about presence of a storage classDouglas Gregor2011-06-171-1/+1
| | | | | | | specifier on an explicit specialization to a warning, since neither EDG nor GCC diagnose this code as ill-formed. llvm-svn: 133232
* Check the specific target to figure out if a constraint is a validEric Christopher2011-06-171-2/+5
| | | | | | | | | register constraint. Note that we're not checking if the register itself is valid for the constraint. Fixes rdar://9382985 llvm-svn: 133226
* Add some more memory constraints for ARM.Eric Christopher2011-06-171-0/+6
| | | | | | Part of rdar://9197685 llvm-svn: 133225
* On ARM make sure that we continue translating 'p' to 'r' for theEric Christopher2011-06-171-0/+3
| | | | | | | | constraints. rdar://9618597 llvm-svn: 133222
* When synthesizing implicit copy/move constructors and copy/move assignmentJohn McCall2011-06-171-5/+14
| | | | | | | operators, don't make an initializer or sub-operation for zero-width bitfields. llvm-svn: 133221
* Check for placeholder expressions before promoting an argument passedDouglas Gregor2011-06-171-1/+5
| | | | | | through an ellipsis. Fixes <rdar://problem/9623945>. llvm-svn: 133219
* Add support for -force_load flag, for compat with Apple gcc. rdar://9555962 .Eli Friedman2011-06-161-0/+1
| | | | llvm-svn: 133218
* Be sure to try a final ARC-production even in Objective-C++.John McCall2011-06-162-1/+3
| | | | llvm-svn: 133215
* Finish 2 sentences.Francois Pichet2011-06-161-1/+1
| | | | llvm-svn: 133214
* Fix a regression introduced by r131955 which broke #include_next in subtle ↵Chris Lattner2011-06-161-1/+4
| | | | | | | | | situations because the Angled directories and the System directories were not being uniqued together, breaking #include_next. I'll see about a testcase, but it will be insane. llvm-svn: 133212
* code cleanups, no behavior change.Chris Lattner2011-06-161-64/+64
| | | | llvm-svn: 133211
* For the purpose of @encode'ing, accept 'void' typeFariborz Jahanian2011-06-161-1/+2
| | | | | | | (even though it is incomplete type) because gcc says so. // rdar://9622422 llvm-svn: 133208
* Add a new warning when a NULL constant is used in arithmetic operations. ↵Richard Trieu2011-06-161-0/+54
| | | | | | | | The warning will fire on cases such as: int x = 1 + NULL; llvm-svn: 133196
* Move computation of __private_extern__ visibilty toFariborz Jahanian2011-06-162-11/+10
| | | | | | getLVForNamespaceScopeDecl(). // rdar://9609649 llvm-svn: 133182
* Stylistic fix: move virtual keyword before return type.Evan Cheng2011-06-161-2/+1
| | | | llvm-svn: 133181
* Allow comparison between block pointers and NULL pointerDouglas Gregor2011-06-161-2/+4
| | | | | | constants. Fixes PR10145. llvm-svn: 133179
* Teach the warning about non-POD memset/memcpy/memmove to deal with theDouglas Gregor2011-06-161-12/+40
| | | | | | | | | __builtin_ versions of these functions as well as the normal function versions, so that it works on platforms where memset/memcpy/memmove are macros that map down to the builtins (e.g., Darwin). Fixes <rdar://problem/9372688>. llvm-svn: 133173
* arc: diagnose dereferencing a __weak pointer which may beFariborz Jahanian2011-06-161-0/+10
| | | | | | null at any time. // rdar://9612030 llvm-svn: 133168
* Implement the consistency checking for C++ [temp.deduct.call]p3, whichDouglas Gregor2011-06-161-13/+139
| | | | | | | | | | | | | | | checks that the deduced argument type for a function call matches the actual argument type provided. The only place we've found where the consistency checking should actually cause template argument deduction failure is due to qualifier differences that don't fall into the realm of qualification conversions (which are *not* checked when we initially perform deduction). However, we're performing the full checking as specified in the standard to ensure that no other cases exist. Fixes PR9233 / <rdar://problem/9039590>. llvm-svn: 133163
* Raise the ARCMT functionality in Clang into proper FrontendActions.Chandler Carruth2011-06-167-31/+115
| | | | | | | | | | | | | | | | | | | | | These are somewhat special in that they wrap any other FrontendAction, running various ARC transformations or checks prior to the standard action's run. To implement them easily, this extends FrontendAction to have a WrapperFrontendAction utility class which forwards all calls by default to an inner action setup at construction time. This is then subclassed to override the specific behavior needed by the different ARCMT tools. Finally, FrontendTool is taught how to create these wrapper actions from the existing flags and options structures. The result is that clangFrontend no longer depends on clangARCMigrate. This is very important, as clangARCMigrate *heavily* depends on clangFrontend. Fundamentally ARCMigrate is at the same layer as a library like Rewrite, sitting firmly on top of the Frontend, but tied together with the FrontendTool when building the clang binary itself. llvm-svn: 133161
* Set the visibility to 'hidden' when previousFariborz Jahanian2011-06-161-2/+11
| | | | | | | declaration of global var is __private_extern__. // rdar://9609649 llvm-svn: 133157
* Be aware of (x86_64-redhat-linux6E-)g++44 on RHEL5.NAKAMURA Takumi2011-06-162-0/+6
| | | | | | | AFAIK, RHEL5 (and its clones) provides g++44 as the package "gcc44-c++". By default, g++-4.1.1 is available, though, its libstdc++ would not be suitable to clang++. llvm-svn: 133156
* Rework the warning for 'memset(p, 0, sizeof(p))' where 'p' is a pointerChandler Carruth2011-06-161-22/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | and the programmer intended to write 'sizeof(*p)'. There are several elements to the new version: 1) The actual expressions are compared in order to more accurately flag the case where the pattern that works for an array has been used, or a '*' has been omitted. 2) Only do a loose type-based check for record types. This prevents us from warning when we happen to be copying around chunks of data the size of a pointer and the pointer types for the sizeof and source/dest match. 3) Move all the diagnostics behind the runtime diagnostic filter. Not sure this is really important for this particular diagnostic, but almost everything else in SemaChecking.cpp does so. 4) Make the wording of the diagnostic more precise and informative. At least to my eyes. 5) Provide highlighting for the two expressions which had the unexpected similarity. 6) Place this diagnostic under a flag: -Wsizeof-pointer-memaccess This uses the Stmt::Profile system for computing #1. Because of the potential cost, this is guarded by the warning flag. I'd be interested in feedback on how bad this is in practice; I would expect it to be quite cheap in practice. Ideas for a cheaper / better way to do this are also welcome. The diagnostic wording could likely use some further wordsmithing. Suggestions welcome here. The goals I had were to: clarify that its the interaction of 'memset' and 'sizeof' and give more reasonable suggestions for a resolution. An open question is whether these diagnostics should have the note attached for silencing by casting the dest/source pointer to void*. llvm-svn: 133155
* [analyzer] Clean up modeling of strcmp, including cases where a string ↵Jordy Rose2011-06-161-41/+85
| | | | | | literal has an embedded null character, and where both arguments are the same buffer. Also use nested ifs rather than early returns; in this case early returns will lose any assumptions we've made earlier in the function. llvm-svn: 133154
* Make the Stmt::Profile method const, and the StmtProfile visitorChandler Carruth2011-06-162-140/+152
| | | | | | | | | | | | a ConstStmtVisitor. This also required adding some const iteration support for designated initializers and making some of the getters on the designators const. It also made the formatting of StmtProfile.cpp rather awkward. I'm happy to adjust any of the formatting if folks have suggestions. I've at least fitted it all within 80 columns. llvm-svn: 133152
* [analyzer] Fix trivial errors in previous commit.Jordy Rose2011-06-161-2/+3
| | | | | | | | I will not commit without building first. I will not commit without building first. I will not commit without building first... llvm-svn: 133150
* [analyzer] Cleanup: mainly 80-char violations and preferring ↵Jordy Rose2011-06-161-9/+12
| | | | | | SValBuilder::getComparisonType() to just referencing IntTy. llvm-svn: 133149
* Restore correct use of GC barriers.John McCall2011-06-1610-133/+164
| | | | llvm-svn: 133144
* [arcmt] Fix tests in non-darwin.Argyrios Kyrtzidis2011-06-161-0/+5
| | | | llvm-svn: 133140
* Skip both character pointers and void pointers when diagnosing badChandler Carruth2011-06-161-1/+3
| | | | | | | | | | | | | argument types for mem{set,cpy,move}. Character pointers, much like void pointers, often point to generic "memory", so trying to check whether they match the type of the argument to 'sizeof' (or other checks) is unproductive and often results in false positives. Nico, please review; does this miss any of the bugs you were trying to find with this warning? The array test case you had should be caught by the array-specific sizeof warning I think. llvm-svn: 133136
* Weaken the type-matching rules for methods that return aggregates whenJohn McCall2011-06-161-2/+37
| | | | | | complaining about mismatches in the global method pool. llvm-svn: 133123
* Refactor parentheses suggestion notes to have less code duplication andChandler Carruth2011-06-161-63/+36
| | | | | | | | | | be more consistent in how parenthesized ranges which hit macros are handled. Also makes the code significantly shorter, and the diagnostics when macros are present a bit more useful. Pair programmed w/ Matthew. llvm-svn: 133122
* Cleanup the parameter naming style.Chandler Carruth2011-06-161-8/+8
| | | | llvm-svn: 133120
* Unconditionally #define the ARC ownership qualifiers, instead of #definingJohn McCall2011-06-162-8/+10
| | | | | | them only on Darwin tool chains. llvm-svn: 133112
* Suppress a warning in -Asserts builds.John McCall2011-06-151-0/+1
| | | | llvm-svn: 133110
* The ARC Migration Tool. All the credit goes to Argyrios and FariborzJohn McCall2011-06-1513-2/+3830
| | | | | | for this. llvm-svn: 133104
* Automatic Reference Counting.John McCall2011-06-1587-967/+7735
| | | | | | | | | | Language-design credit goes to a lot of people, but I particularly want to single out Blaine Garst and Patrick Beard for their contributions. Compiler implementation credit goes to Argyrios, Doug, Fariborz, and myself, in no particular order. llvm-svn: 133103
* Introduce a utility routine for checking whether a block's capturesJohn McCall2011-06-151-0/+10
| | | | | | include a specific variable. llvm-svn: 133102
* Per Chris's suggestion, simplify code using llvm::getOrEnforceKnownAlignment.Eli Friedman2011-06-151-36/+15
| | | | llvm-svn: 133095
* Generate enumerators for diagnostic categories. Patch by Argyrios!John McCall2011-06-151-1/+23
| | | | | | Depends on LLVM r133093. llvm-svn: 133094
OpenPOWER on IntegriCloud