summaryrefslogtreecommitdiffstats
path: root/clang/lib
Commit message (Collapse)AuthorAgeFilesLines
* Better diagnostics for range-based for loops with bad range types.Sam Panzer2012-08-214-171/+336
| | | | | | | | | | | | | The old error message stating that 'begin' was an undeclared identifier is replaced with a new message explaining that the error is in the range expression, along with which of the begin() and end() functions was problematic if relevant. Additionally, if the range was a pointer type or defines operator*, attempt to dereference the range, and offer a FixIt if the modified range works. llvm-svn: 162248
* [analyzer] Assume that reference symbols are non-null.Jordan Rose2012-08-212-1/+15
| | | | | | | | By doing this in the constraint managers, we can ensure that ANY reference whose value we don't know gets the effect, even if it's not a top-level parameter. llvm-svn: 162246
* DeclPrinter: add terse output mode and lots of testsDmitri Gribenko2012-08-201-0/+3
| | | | | | | | | | | | | | Add a flag PrintingPolicy::DontRecurseInDeclContext to provide "terse" output from DeclPrinter. The motivation is to use DeclPrinter to print declarations in user-friendly format, without overwhelming user with inner detail of the declaration being printed. Also add many tests for DeclPrinter. There are quite a few things that we print incorrectly: search for WRONG in DeclPrinterTest.cpp -- and these tests check our output against incorrect output, so that we can fix/refactor/rewrite the DeclPrinter later. llvm-svn: 162245
* Fix a pair of bugs relating to properties in ARC.John McCall2012-08-202-2/+28
| | | | | | | | | | | | | | | | | | | | First, when synthesizing an explicitly strong/retain/copy property of Class type, don't pretend during compatibility checking that the property is actually assign. Instead, resolve incompatibilities by secretly changing the type of *implicitly* __unsafe_unretained Class ivars to be strong. This is moderately evil but better than what we were doing. Second, when synthesizing the setter for a strong property of non-retainable type, be sure to use objc_setProperty. This is possible when the property is decorated with the NSObject attribute. This is an ugly, ugly corner of the language, and we probably ought to deprecate it. The first is rdar://problem/12039404; the second was noticed by inspection while fixing the first. llvm-svn: 162244
* Reapply:Eric Christopher2012-08-202-14/+31
| | | | | | | | | | | | | | | Author: Eric Christopher <echristo@apple.com> Date: Thu Aug 16 23:50:46 2012 +0000 Add some caching here for the builtin types. rdar://12117935 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162066 91177308-0d34-0410-b5e6-96231b3b80d8 after fixing a thinko. llvm-svn: 162243
* Attaching comments to declarations: ignore implicit decls. Decl::isImplicit()Dmitri Gribenko2012-08-201-0/+18
| | | | | | | | does not return true for all implicit decls currently. This should fix PR13634 for now, but Decl::isImplicit() should be fixed, too. llvm-svn: 162238
* Fix -Wswitch warning introduced by r162231David Blaikie2012-08-201-1/+2
| | | | llvm-svn: 162236
* Make Option non virtual.Michael J. Spencer2012-08-203-194/+96
| | | | llvm-svn: 162231
* Thread-safety analysis: fix scoping issues related to 'this', including anDeLesley Hutchins2012-08-201-29/+34
| | | | | | ICE in friend functions. llvm-svn: 162229
* Fix InitListExpr::isStringLiteralInit so it handles various edge cases ↵Eli Friedman2012-08-201-3/+3
| | | | | | correctly. PR13643. llvm-svn: 162226
* Code-complete 'weak' for properties under ARC-with-weak-references (or GC)Jordan Rose2012-08-201-10/+14
| | | | | | | | | | Also, suggest 'readonly' even if the property has been given an ownership attribute ('strong', 'weak', etc). This is used when properties are declared readonly in the public interface but readwrite in a class extension. <rdar://problem/11500004&11932285> llvm-svn: 162220
* [analyzer] Add comments to ExplodedNode::NodeGroup.Jordan Rose2012-08-201-0/+12
| | | | | | No functionality change. llvm-svn: 162216
* [analyzer] Replace boolean IsSink parameters with 'generateSink' methods.Jordan Rose2012-08-205-36/+28
| | | | | | | | | | | Generating a sink is significantly different behavior from generating a normal node, and a simple boolean parameter can be rather opaque. Per offline discussion with Anna, adding new generation methods is the clearest way to communicate intent. No functionality change. llvm-svn: 162215
* PR13619: Make sure we're not at EOF before looking at NextToken().Richard Smith2012-08-201-4/+5
| | | | llvm-svn: 162212
* [ms-inline asm] Remove old cruft now that MS-style asms their own code path.Chad Rosier2012-08-206-22/+10
| | | | llvm-svn: 162210
* [analyzer] The result of && or || is always a 1 or 0.Jordan Rose2012-08-201-2/+20
| | | | | | | | | | | Forgetting to at least cast the result was giving us Loc/NonLoc problems in SValBuilder (hitting an assertion). But the standard (both C and C++) does actually guarantee that && and || will result in the actual values 1 and 0, typed as 'int' in C and 'bool' in C++, and we can easily model that. PR13461 llvm-svn: 162209
* Better wording for reference self-initialization warning.Hans Wennborg2012-08-202-2/+8
| | | | llvm-svn: 162198
* Allow -verify to be used with files that don't have an associated FileEntry.Jordan Rose2012-08-181-43/+115
| | | | | | | | | | | | | | | | | | In Debug builds, VerifyDiagnosticConsumer checks any files with diagnostics to make sure we got the chance to parse them for directives (expected-warning and friends). This check previously relied on every parsed file having a FileEntry, which broke the cling interpreter's test suite. This commit changes the extra debug checking to mark a file as unparsed as soon as we see a diagnostic from that file. At the very end, any files that are still marked as unparsed are checked for directives, and a fatal error is emitted (as before) if we find out that there were directives we missed. -verify directives should always live in actual parsed files, not in PCH or AST files. Patch by Andy Gibbs, with slight modifications by me. llvm-svn: 162171
* When mangling a negative number, remember that negating it does notJohn McCall2012-08-181-3/+4
| | | | | | | always yield a positive number. Just print the negated result as an unsigned number. llvm-svn: 162163
* PR41111, PR5925, PR13210: Teach tentative parsing to annotate identifiers andRichard Smith2012-08-186-155/+320
| | | | | | | | | | | | | | | | | nested names as id-expressions, using the annot_primary_expr annotation, where possible. This removes some redundant lookups, and also allows us to typo-correct within tentative parsing, and to carry on disambiguating past an identifier which we can determine will fail lookup as both a type and as a non-type, allowing us to disambiguate more declarations (and thus offer improved error recovery for such cases). This also introduces to the parser the notion of a tentatively-declared name, which is an identifier which we *might* have seen a declaration for in a tentative parse (but only if we end up disambiguating the tokens as a declaration). This is necessary to correctly disambiguate cases where a variable is used within its own initializer. llvm-svn: 162159
* [analyzer] Treat C++ 'throw' as a sink.Jordan Rose2012-08-181-7/+2
| | | | | | | | | | | | | | | | | | | | Our current handling of 'throw' is all CFG-based: it jumps to a 'catch' block if there is one and the function exit block if not. But this doesn't really get the right behavior when a function is inlined: execution will continue on the caller's side, which is always the wrong thing to do. Even within a single function, 'throw' completely skips any destructors that are to be run. This is essentially the same problem as @finally -- a CFGBlock that can have multiple entry points, whose exit points depend on whether it was entered normally or exceptionally. Representing 'throw' as a sink matches our current (non-)handling of @throw. It's not a perfect solution, but it's better than continuing analysis in an inconsistent or even impossible state. <rdar://problem/12113713> llvm-svn: 162157
* [analyzer] Treat @throw as a sink (stop processing).Jordan Rose2012-08-181-1/+1
| | | | | | | | | | | | The CFG approximates @throw as a return statement, but that's not good enough in inlined functions. Moreover, since Objective-C exceptions are usually considered fatal, we should be suppressing leak warnings like we do for calls to noreturn functions (like abort()). The comments indicate that we were probably intending to do this all along; it may have been inadvertantly changed during a refactor at one point. llvm-svn: 162156
* [analyzer] Remove obsolete GenericNodeBuilderRefCount from RetainCountChecker.Jordan Rose2012-08-181-39/+16
| | | | | | | | | | This was once an adapter class between callbacks that had CheckerContexts and those that don't, but for a while now it's essentially just been a wrapper around a ProgramPointTag. We can just pass the tag around instead. No functionality change. llvm-svn: 162155
* [analyzer] Use PointerUnion to implement ExplodedNode::NodeGroup.Jordan Rose2012-08-181-51/+57
| | | | | | | | | We shouldn't be reinventing our own wheels. This also paves the way for marking different kinds of sinks. No functionality change. llvm-svn: 162154
* Reapply:Eric Christopher2012-08-171-6/+8
| | | | | | | | Make isa part of objc_object at metadata generation time. Noticed on inspection. llvm-svn: 162145
* When code completion is enabled, don't do any work inDouglas Gregor2012-08-171-0/+5
| | | | | | Sema::ActOnEndOfTranslationUnit(). This is a (minor) optimization. llvm-svn: 162144
* c: privide deprecated warning when __private_extern__ storageFariborz Jahanian2012-08-171-1/+3
| | | | | | | | specifier is unsed in a declaration; as it may not make the symbol local to linkage unit as intended. Suggest using "hidden" visibility attribute instead. // rdar://7703982 llvm-svn: 162138
* [ms-inline asm] Update comment.Chad Rosier2012-08-171-1/+1
| | | | llvm-svn: 162134
* [ms-inline asm] Extract AsmStmt handling into a separate file, so as to notChad Rosier2012-08-173-611/+636
| | | | | | pollute SemaStmt with extraneous asm handling logic. llvm-svn: 162132
* darwin/driver: Support using SDKROOT to define the default for -isysroot.Daniel Dunbar2012-08-171-0/+14
| | | | | | | - The SDKROOT environment variable is the de facto way to set the default SDK for a number of tools, join forces with them. llvm-svn: 162116
* Fixed crash and added a test and a minor output problemAlexander Kornienko2012-08-171-2/+3
| | | | llvm-svn: 162110
* c: implement gcc's -Wbad-function-cast which warnsFariborz Jahanian2012-08-171-1/+38
| | | | | | | on unsafe cast of a c-function call. This is a C-only option. llvm-svn: 162109
* [ms-inline asm] Instantiate the MCStreamer as a NullStream. We're parsingChad Rosier2012-08-171-1/+1
| | | | | | instruction, not emitting them, so a NullStream is fine. llvm-svn: 162105
* Warn about self-initialization of references.Hans Wennborg2012-08-171-6/+9
| | | | | | | Initializing a reference with itself, e.g. "int &a = a;" seems like a very bad idea. llvm-svn: 162093
* Make the spacing of the code completion result for NSDictionaryDouglas Gregor2012-08-171-1/+0
| | | | | | | literals match the spacing introduced by the ObjC modernizer. Fixes the rest of <rdar://problem/11889572>. llvm-svn: 162084
* Don't do jump-scope checking when code completion is enabled. It'sDouglas Gregor2012-08-172-2/+4
| | | | | | | | both a waste of time, and prone to crash due to the use of the error-recovery path in parser. Fixes <rdar://problem/12103608>, which has been driving me nuts. llvm-svn: 162081
* Temporarily revert r162066 and r162062 to see if it brings the gdbEric Christopher2012-08-172-32/+15
| | | | | | bots back. llvm-svn: 162080
* Fix undefined behavior in debug info emission: operator* on WeakVH returns aRichard Smith2012-08-171-17/+24
| | | | | | | | reference, so &* on an empty WeakVH binds a reference to a dereferenced null pointer. So don't do that; we have a perfectly good implicit conversion to Value*. llvm-svn: 162079
* Switch PTH format from a 7 byte magic number to an 8 byte one, to avoidRichard Smith2012-08-172-4/+4
| | | | | | misaligned reads throughout the file. Bump PTH format version to 10. llvm-svn: 162076
* Fix -Wl,--no-demangle to actually pass the flag to the linker on Linux insteadNick Lewycky2012-08-171-0/+3
| | | | | | of silently dropping it on the floor. llvm-svn: 162075
* Don't forget to apply #pragma pack to partial and explicit specializations ofRichard Smith2012-08-171-0/+7
| | | | | | | class templates. This fixes misalignment issues in llvm/Support/Endian.h when built by Clang. llvm-svn: 162074
* Avoid binding a reference to a dereferenced null pointer, if we try to emit aRichard Smith2012-08-171-0/+3
| | | | | | diagnostic before we have a source manager. llvm-svn: 162070
* Don't form a null reference when checking for validity of an anonymousRichard Smith2012-08-171-2/+1
| | | | | | | elaborated type specifier in template instantiation: such a specifier is always valid because it must be specified within the definition of the type. llvm-svn: 162068
* Add support for "type safety" attributes that allow checking that 'void *'Dmitri Gribenko2012-08-175-1/+649
| | | | | | | | | | | | | | function arguments and arguments for variadic functions are of a particular type which is determined by some other argument to the same function call. Usecases include: * MPI library implementations, where these attributes enable checking that buffer type matches the passed MPI_Datatype; * for HDF5 library there is a similar usecase as MPI; * checking types of variadic functions' arguments for functions like fcntl() and ioctl(). llvm-svn: 162067
* Add some caching here for the builtin types.Eric Christopher2012-08-162-15/+30
| | | | | | rdar://12117935 llvm-svn: 162066
* Remove FIXME, the constraints contain more options than theEric Christopher2012-08-161-1/+0
| | | | | | current available documentation. llvm-svn: 162065
* Add a missing 'break' to ensure that we reject inline assemblyEric Christopher2012-08-161-1/+1
| | | | | | constraints we don't recognize. llvm-svn: 162064
* Random string removal.Eric Christopher2012-08-161-1/+1
| | | | llvm-svn: 162063
* Make isa part of objc_object at metadata generation time.Eric Christopher2012-08-161-6/+8
| | | | | | Noticed on inspection. llvm-svn: 162062
* Fix misaligned allocation of TemplateParameterList objects.Richard Smith2012-08-161-1/+2
| | | | llvm-svn: 162056
OpenPOWER on IntegriCloud