summaryrefslogtreecommitdiffstats
path: root/clang/test
Commit message (Collapse)AuthorAgeFilesLines
* Fix AAPCS ABI. I can't actually test this, but it restores the behavior ↵Eli Friedman2012-08-091-0/+6
| | | | | | from before r159168. PR13562. llvm-svn: 161554
* [analyzer] Bifurcate the path with dynamic dispatch.Anna Zaks2012-08-091-0/+51
| | | | | | | | | | | | | This is an initial (unoptimized) version. We split the path when inlining ObjC instance methods. On one branch we always assume that the type information for the given memory region is precise. On the other we assume that we don't have the exact type info. It is important to check since the class could be subclassed and the method can be overridden. If we always inline we can loose coverage. Had to refactor some of the call eval functions. llvm-svn: 161552
* Handle deprecation diagnostics correctly for C struct fields and Objective-C ↵Eli Friedman2012-08-082-1/+21
| | | | | | properties/ivars. <rdar://problem/6642337>. llvm-svn: 161534
* Comment XML: use xml:space="preserve" in Verbatim tags, so that XML tidy doesDmitri Gribenko2012-08-082-1/+2
| | | | | | not compress spaces in verbatim content. llvm-svn: 161531
* Unify the codepaths for emitting deprecation warnings. The test changes are ↵Eli Friedman2012-08-088-22/+22
| | | | | | just to account for us emitting notes more consistently. llvm-svn: 161528
* Address code review comments for Wstrncat-size warning (r161440).Anna Zaks2012-08-081-1/+6
| | | | llvm-svn: 161527
* Implicitly annotate __CFStringMakeConstantString with format_arg(1).Jordan Rose2012-08-081-3/+3
| | | | | | | | | We handled the builtin version of this function in r157968, but the builtin isn't used when compiling as -fno-constant-cfstrings. This should complete <rdar://problem/6157200>. llvm-svn: 161525
* [ms-inline asm] Add basic codegen support for simple asm stmts. Currently,Chad Rosier2012-08-081-1/+2
| | | | | | only machine specific clobbers are modeled. llvm-svn: 161524
* Don't add attributes for "#pragma pack" and friends to tag declarations whichEli Friedman2012-08-081-0/+16
| | | | | | | are not definitions. This follows the behavior of both gcc and earlier versions of clang. Regression from r156531. <rdar://problem/12048621>. llvm-svn: 161523
* [ms-inline asm] Add a very simple test case. Basically, we're only testing forChad Rosier2012-08-081-0/+7
| | | | | | crashers at the moment (and coincidentally this case was causing a crash). llvm-svn: 161520
* [analyzer] Clean up the printing of FieldRegions for leaks.Jordan Rose2012-08-081-3/+9
| | | | | | | | | | | | | | Unfortunately, generalized region printing is very difficult: - ElementRegions are used both for casting and as actual elements. - Accessing values through a pointer means going through an intermediate SymbolRegionValue; symbolic regions are untyped. - Referring to implicitly-defined variables like 'this' and 'self' could be very confusing if they come from another stack frame. We fall back to simply not printing the region name if we can't be sure it will print well. This will allow us to improve in the future. llvm-svn: 161512
* [analyzer] Track malloc'd regions stored in structs.Jordan Rose2012-08-082-27/+24
| | | | | | | | | | | The main blocker on this (besides the previous commit) was that ScanReachableSymbols was not looking through LazyCompoundVals. Once that was fixed, it's easy enough to clear out malloc data on return, just like we do when we bind to a global region. <rdar://problem/10872635> llvm-svn: 161511
* [analyzer] Revamp RegionStore to distinguish regions with symbolic offsets.Jordan Rose2012-08-081-0/+92
| | | | | | | | | | | | | | | | | RegionStore currently uses a (Region, Offset) pair to describe the locations of memory bindings. However, this representation breaks down when we have regions like 'array[index]', where 'index' is unknown. We used to store this as (SubRegion, 0); now we mark them specially as (SubRegion, SYMBOLIC). Furthermore, ProgramState::scanReachableSymbols depended on the existence of a sub-region map, but RegionStore's implementation doesn't provide for such a thing. Moving the store-traversing logic of scanReachableSymbols into the StoreManager allows us to eliminate the notion of SubRegionMap altogether. This fixes some particularly awkward broken test cases, now in array-struct-region.c. llvm-svn: 161510
* Implement warning for integral null pointer constants other than the literal 0.David Blaikie2012-08-084-9/+16
| | | | | | | | | | | | | | | | | | | | This is effectively a warning for code that violates core issue 903 & thus will become standard error in the future, hopefully. It catches strange null pointers such as: '\0', 1 - 1, const int null = 0; etc... There's currently a flaw in this warning (& the warning for 'false' as a null pointer literal as well) where it doesn't trigger on comparisons (ptr == '\0' for example). Fix to come in a future patch. Also, due to this only being a warning, not an error, it triggers quite frequently on gtest code which tests expressions for null-pointer-ness in a SFINAE context (so it wouldn't be a problem if this was an error as in an actual implementation of core issue 903). To workaround this for now, the diagnostic does not fire in unevaluated contexts. Review by Sean Silva and Richard Smith. llvm-svn: 161501
* objc: Include all types when issuing warning underFariborz Jahanian2012-08-081-0/+5
| | | | | | -Wdirect-ivar-access. llvm-svn: 161500
* Preprocessor: fix __OPTIMIZE_SIZE__ and -OzDylan Noblesmith2012-08-081-19/+29
| | | | | | | | | | | | Add some tests for __OPTIMIZE_SIZE__ and __NO_INLINE__, removing the superfluous copies in the target-specific tests, since it's target-independent. This uncovered a bug in the handling of -Oz: it would attempt to store the value 2 in the 1-bit bitfield OptimizeSize, leaving a value of 0 and never defining __OPTIMIZE_SIZE__. llvm-svn: 161495
* Implement final piece of DR963 and also DR587:Richard Smith2012-08-082-2/+28
| | | | | | | | | | | A conditional operator between glvalues of types cv1 T and cv2 T produces a glvalue if the expressions are of the same value kind and one of cv1 and cv2 is a subset of the other. A conditional operator between two null pointer constants is permitted if one of them is of type std::nullptr_t. llvm-svn: 161476
* Get rid of an early return in Sema::ActOnFields which doesn't make sense ↵Eli Friedman2012-08-083-5/+14
| | | | | | | | | anymore. Fixes a crash (<rdar://problem/11067144>), and generally seems to improve recovery in other cases. llvm-svn: 161474
* Fix an assertion failure with a C++ constructor initializing aEli Friedman2012-08-081-0/+10
| | | | | | member of reference type in an anonymous struct. PR13154. llvm-svn: 161473
* objc-arc: Make -Wdirect-ivar-access accessible to allFariborz Jahanian2012-08-071-3/+16
| | | | | | | memory models, except when arc is accessing a weak ivar (which is an error). // rdar://6505197 llvm-svn: 161458
* When building a conditional operator where one operand is a throw-expressionRichard Smith2012-08-071-3/+20
| | | | | | | | | and the other is a glvalue of class type, don't forget to copy-initialize a temporary when performing the lvalue-to-rvalue conversion on the glvalue. Strangely, DefaultLvalueConversions misses this part of the lvalue-to-rvalue conversions. llvm-svn: 161450
* -Wunused-private-fields: Don't try to check unresolved initializer expressionsRichard Smith2012-08-071-1/+26
| | | | | | | | for side-effects. Instead, check for side-effects after performing initialization. Doing so also removes some strange corner cases and differences between in-class initialization and constructor initialization. llvm-svn: 161449
* objc-arc: set nonlazybind attribute on objc_retain/Fariborz Jahanian2012-08-071-0/+3
| | | | | | | objc_release for performance for these most often called APIs. // rdar://12040837 llvm-svn: 161448
* Don't complain about -fobjc-link-runtime being unused with -fobjc-arc.Bob Wilson2012-08-071-0/+4
| | | | | | | If you build with -fobjc-arc, then -fobjc-link-runtime is implied but we don't need to warn about it being unused in that case. rdar://12039965 llvm-svn: 161444
* Comment AST: DeclInfo: add a special kind for enums.Dmitri Gribenko2012-08-073-2/+19
| | | | | | Comment XML: add a root node kind for enums. llvm-svn: 161442
* Turn on strncat-size warning implemented a while ago.Anna Zaks2012-08-071-1/+1
| | | | | | | | | | | | | | | | Warns on anti-patterns/typos in the 'size' argument to strncat. The correct size argument should look like the following: - strncat(dst, src, sizeof(dst) - strlen(dest) - 1); We warn on: - sizeof(dst) - sizeof(src) - sizeof(dst) - strlen(dst) - sizeof(src) - anything (This has been implemented in void Sema::CheckStrncatArguments().) llvm-svn: 161440
* Comment AST: treat enumerators as "variables" in DeclInfo.Dmitri Gribenko2012-08-071-1/+6
| | | | llvm-svn: 161435
* libclang API for comment-to-xml conversion.Dmitri Gribenko2012-08-0735-34/+475
| | | | | | | | | | | | The implementation also includes a Relax NG schema and tests for the schema itself. The schema is used in c-index-test to verify that XML documents we produce are valid. In order to do the validation, we add an optional libxml2 dependency for c-index-test. Credits for CMake part go to Doug Gregor. Credits for Autoconf part go to Eric Christopher. Thanks! llvm-svn: 161431
* objective-c: Exclude -Wdirect-ivar-access for arc.Fariborz Jahanian2012-08-071-0/+5
| | | | | | | Allow direct ivar access in init and dealloc methods in mrr. // rdar://650197 llvm-svn: 161426
* Properly check length modfiers for %n in format strings.Hans Wennborg2012-08-073-0/+66
| | | | llvm-svn: 161408
* Remove ScanfArgType and bake that logic into ArgType.Hans Wennborg2012-08-071-0/+6
| | | | | | | | This is useful for example for %n in printf, which expects a pointer to int with the same logic for checking as %d would have in scanf. llvm-svn: 161407
* Objective-C pointer types don't have C-linkage, even though they areDouglas Gregor2012-08-071-0/+3
| | | | | | non-POD. Fixes <rdar://problem/12031870>. llvm-svn: 161395
* Update documentation of HasSideEffects to match its callers' expectations, andRichard Smith2012-08-071-3/+15
| | | | | | | | | | | | update implementation to match. An elidable, non-trivial constructor call is a side-effect under this definition, but wasn't under the old one, because we are not required to evaluate it even though it may have an effect. Also rationalize checking for volatile reads: just look for lvalue-to-rvalue conversions on volatile glvalues, and ignore whether a DeclRefExpr etc is for a volatile variable. llvm-svn: 161393
* [analyzer] + New line at end of fileAnna Zaks2012-08-071-1/+1
| | | | llvm-svn: 161392
* [analyzer] Address Jordan's review of DynamicTypePropagation.Anna Zaks2012-08-071-2/+16
| | | | llvm-svn: 161391
* Fix the test RUN line for this better.Eric Christopher2012-08-071-1/+1
| | | | llvm-svn: 161390
* Teach Expr::HasSideEffects about all the Expr types, and fix a bug where itRichard Smith2012-08-075-49/+122
| | | | | | | | | | | | | | | | | | | was mistakenly classifying dynamic_casts which might throw as having no side effects. Switch it from a visitor to a switch, so it is kept up-to-date as future Expr nodes are added. Move it from ExprConstant.cpp to Expr.cpp, since it's not really related to constant expression evaluation. Since we use HasSideEffect to determine whether to emit an unused global with internal linkage, this has the effect of suppressing emission of globals in some cases. I've left many of the Objective-C cases conservatively assuming that the expression has side-effects. I'll leave it to someone with better knowledge of Objective-C than mine to improve them. llvm-svn: 161388
* [analyzer] Add a test case for OS X 10.8's NSMakeCollectable under non-GC.Jordan Rose2012-08-071-0/+13
| | | | | | | This is an additional test for r161349 (ignoring 10.8's annotations for NSMakeCollectable). llvm-svn: 161380
* If we don't have a complete type for the array type yet either thenEric Christopher2012-08-071-0/+14
| | | | | | | | just let the alignment be zero. PR13531 llvm-svn: 161379
* Specify a triple on this to make it easier to test.Eric Christopher2012-08-071-1/+1
| | | | llvm-svn: 161372
* Make sure when we get the replacement type for a template argumentEric Christopher2012-08-071-0/+23
| | | | | | | | that we attach the lost qualifiers. Fixes rdar://11882155 llvm-svn: 161368
* [analyzer] DynTypes: Add a test for improper cast performed by user.Anna Zaks2012-08-061-0/+37
| | | | | | | Dynamic type inference does the right thing in this case. However, as Jordan suggested, it would be nice to add a warning here as well. llvm-svn: 161365
* objective-c: Implement gcc's -Wdirect-ivar-access option.Fariborz Jahanian2012-08-061-0/+33
| | | | | | // rdar://6505197 llvm-svn: 161362
* [analyzer] Dynamic type info - propagate through implicit casts.Anna Zaks2012-08-061-4/+22
| | | | | | | | I currently have a bit of redundancy with the cast kind switch statement inside the ImplicitCast callback, but I might be adding more casts going forward. llvm-svn: 161358
* [analyzer] Add a checker to manage dynamic type propagation.Anna Zaks2012-08-062-1/+76
| | | | | | | | | | | | Instead of sprinkling dynamic type info propagation throughout ExprEngine, the added checker would add the more precise type information on known APIs (Ex: ObjC alloc, new) and propagate the type info in other cases (ex: ObjC init method, casts (the second is not implemented yet)). Add handling of ObjC alloc, new and init to the checker. llvm-svn: 161357
* [analyzer] Add plist output checks for all four "path notes" tests.Jordan Rose2012-08-064-1/+7625
| | | | | | | | | No functionality change, but from now on, any new path notes should be tested both with plain-text output (for ease of human auditing) and with plist output (to ensure control flow and events are being correctly represented in Xcode). llvm-svn: 161351
* [analyzer] Improve arrow locations for PseudoObjectExprs.Jordan Rose2012-08-061-196/+399
| | | | llvm-svn: 161350
* For global record types, the self reference checker was called twice, resultingRichard Trieu2012-08-061-0/+23
| | | | | | | in duplicate -Wuninitialized warnings. Change so that only the check in TryConstructorInitialization() will be used and a single warning be emitted. llvm-svn: 161345
* Fix MIPS DSP Rev1 intrinsics memory properties.Simon Atanasyan2012-08-061-2/+98
| | | | | | The patch reviewed by Akira Hatanaka. llvm-svn: 161333
* Comment diagnostics: warn on duplicate \brief and \return commands.Dmitri Gribenko2012-08-062-64/+122
| | | | | | | | | | Doxygen manual claims that multiple \brief or \returns commands will be merged together, but actual behavior is different (second \brief command becomes a part of a discussion, second \returns becomes a "Returns: blah" paragraph on its own). Anyway, it seems to be a bad idea to use multiple \brief or \returns commands in a single command. llvm-svn: 161325
OpenPOWER on IntegriCloud