summaryrefslogtreecommitdiffstats
path: root/clang/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* [analyzer]Print field region even when the base region is not printableAnna Zaks2013-04-123-20/+35
| | | | llvm-svn: 179395
* Sema: Give a typically small DenseMap some inline capacity.Benjamin Kramer2013-04-121-4/+3
| | | | | | Also reflow code a bit, no change in functionality. llvm-svn: 179382
* Revamps structural error detection / handling.Manuel Klimek2013-04-123-40/+44
| | | | | | | | | | | | | | | | | | | | | Previously we'd only detect structural errors on the very first level. This leads to incorrectly balanced braces not being discovered, and thus incorrect indentation. This change fixes the problem by: - changing the parser to use an error state that can be detected anywhere inside the productions, for example if we get an eof on SOME_MACRO({ some block <eof> - previously we'd never break lines when we discovered a structural error; now we break even in the case of a structural error if there are two unwrapped lines within the same line; thus, void f() { while (true) { g(); y(); } } will still be re-formatted, even if there's missing braces somewhere in the file - still exclude macro definitions from generating structural error; macro definitions are inbalanced snippets llvm-svn: 179379
* [analyzer] Fix grammar in comment.Jordan Rose2013-04-121-1/+1
| | | | | | By Adam Schnitzer! llvm-svn: 179352
* [analyzer] Show "Returning from ..." note at caller's depth, not callee's.Jordan Rose2013-04-121-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | Before: 1. Calling 'foo' 2. Doing something interesting 3. Returning from 'foo' 4. Some kind of error here After: 1. Calling 'foo' 2. Doing something interesting 3. Returning from 'foo' 4. Some kind of error here The location of the note is already in the caller, not the callee, so this just brings the "depth" attribute in line with that. This only affects plist diagnostic consumers (i.e. Xcode). It's necessary for Xcode to associate the control flow arrows with the right stack frame. <rdar://problem/13634363> llvm-svn: 179351
* [analyzer] Don't emit extra context arrow after returning from an inlined call.Jordan Rose2013-04-121-9/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In this code int getZero() { return 0; } void test() { int problem = 1 / getZero(); // expected-warning {{Division by zero}} } we generate these arrows: +-----------------+ | v int problem = 1 / getZero(); ^ | +---+ where the top one represents the control flow up to the first call, and the bottom one represents the flow to the division.* It turns out, however, that we were generating the top arrow twice, as if attempting to "set up context" after we had already returned from the call. This resulted in poor highlighting in Xcode. * Arguably the best location for the division is the '/', but that's a different problem. <rdar://problem/13326040> llvm-svn: 179350
* <rdar://problem/13615607> Include SDK version information in the module hash.Douglas Gregor2013-04-121-0/+17
| | | | | | | | | This is a Darwin-SDK-specific hash criteria used to identify a particular SDK without having to hash the contents of all of its headers. If other platforms have such versioned files, we should add those checks here. llvm-svn: 179346
* Struct-path aware TBAA: uniformize scalar tag and path tag.Manman Ren2013-04-115-24/+61
| | | | | | | | | | | | For struct-path aware TBAA, we used to use scalar type node as the scalar tag, which has an incompatible format with the struct path tag. We now use the same format: base type, access type and offset. We also uniformize the scalar type node and the struct type node: name, a list of pairs (offset + pointer to MDNode). For scalar type, we have a single pair. These are to make implementaiton of aliasing rules easier. llvm-svn: 179335
* Fix the driver logic for recent versions of DragonFly.John McCall2013-04-113-39/+73
| | | | | | Patch by John Marino. llvm-svn: 179334
* Add a new -mimplicit-float option for symmetry with -mno-implicit-float.Bob Wilson2013-04-111-1/+4
| | | | | | | This new option is the default, but it is useful to have a flag to override -mno-implicit-float by putting -mimplicit-float later on the command line. llvm-svn: 179309
* [ms-cxxabi] Implement member pointer emission and dereferencingReid Kleckner2013-04-112-60/+293
| | | | | | | | | | | | | | | | | | | | | Summary: Handles all inheritance models for both data and function member pointers. Also implements isZeroInitializable() and refactors some of the null member pointer code. MSVC supports converting member pointers through virtual bases, which clang does not (yet?) support. Implementing that extension is covered by http://llvm.org/15713 Reviewers: rjmccall CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D613 llvm-svn: 179305
* Hexagon: Remove -g option from the assembler command line.Jyotsna Verma2013-04-111-1/+0
| | | | llvm-svn: 179299
* Change clang-format's affinity for breaking after return types.Daniel Jasper2013-04-112-6/+10
| | | | | | | | | | | | | Function declarations are now broken with the following preferences: 1) break amongst arguments. 2) break after return type. 3) break after (. 4) break before after nested name specifiers. Options #2 or #3 are preferred over #1 only if a substantial number of lines can be saved by that. llvm-svn: 179287
* Fix formatting of overloaded assignment operators.Daniel Jasper2013-04-111-1/+2
| | | | | | Before: SomeType &operator=(const SomeType & S); After: SomeType &operator=(const SomeType &S); llvm-svn: 179270
* ARCMigrate/Transforms.h: Remove \arg in comment. [-Wdocumentation]NAKAMURA Takumi2013-04-111-1/+1
| | | | llvm-svn: 179261
* Drop ObjCIndirectCopyRestoreExprs during template instantiation.John McCall2013-04-111-10/+5
| | | | | | | | | It's a kind of implicit conversion, which we generally drop, but more importantly it's got very specific placement requirements. rdar://13617051 llvm-svn: 179254
* Force a load when creating a reference to a temporary copied from a bitfield.Jordan Rose2013-04-113-155/+218
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For this source: const int &ref = someStruct.bitfield; We used to generate this AST: DeclStmt [...] `-VarDecl [...] ref 'const int &' `-MaterializeTemporaryExpr [...] 'const int' lvalue `-ImplicitCastExpr [...] 'const int' lvalue <NoOp> `-MemberExpr [...] 'int' lvalue bitfield .bitfield [...] `-DeclRefExpr [...] 'struct X' lvalue ParmVar [...] 'someStruct' 'struct X' Notice the lvalue inside the MaterializeTemporaryExpr, which is very confusing (and caused an assertion to fire in the analyzer - PR15694). We now generate this: DeclStmt [...] `-VarDecl [...] ref 'const int &' `-MaterializeTemporaryExpr [...] 'const int' lvalue `-ImplicitCastExpr [...] 'int' <LValueToRValue> `-MemberExpr [...] 'int' lvalue bitfield .bitfield [...] `-DeclRefExpr [...] 'struct X' lvalue ParmVar [...] 'someStruct' 'struct X' Which makes a lot more sense. This allows us to remove code in both CodeGen and AST that hacked around this special case. The commit also makes Clang accept this (legal) C++11 code: int &&ref = std::move(someStruct).bitfield PR15694 / <rdar://problem/13600396> llvm-svn: 179250
* [analyzer] Refactoring: better doxygen comment; renaming isTrackedFamily to ↵Anton Yartsev2013-04-111-17/+20
| | | | | | isTrackedByCurrentChecker llvm-svn: 179242
* [analyzer] Address Jordan’s review of r179219Anna Zaks2013-04-102-2/+2
| | | | llvm-svn: 179235
* [analyzer] Address Jordan’s code review of r 179221Anna Zaks2013-04-101-13/+17
| | | | llvm-svn: 179234
* [analyzer] Switched to checkPreCall interface for detecting usage after free.Anton Yartsev2013-04-101-17/+30
| | | | | | Now the check is also applied to arguments for Objective-C method calls and to 'this' pointer. llvm-svn: 179230
* [analyzer] Fix a crash in SyntaxCString checker when given a custom strncat.Anna Zaks2013-04-101-0/+2
| | | | | | Fixes PR13476 llvm-svn: 179228
* [analyzer] When reporting a leak in RetainCount checker due to an early exit ↵Anna Zaks2013-04-101-14/+63
| | | | | | | | | from init, step into init. The heuristic here (proposed by Jordan) is that, usually, if a leak is due to an early exit from init, the allocation site will be a call to alloc. Note that in other cases init resets self to [super init], which becomes the allocation site of the object. llvm-svn: 179221
* [analyzer] Cleanup leak warnings: do not print the names of variables from ↵Anna Zaks2013-04-102-7/+20
| | | | | | other functions. llvm-svn: 179219
* For split dwarf we should also run the objcopy action if we'reEric Christopher2013-04-101-0/+8
| | | | | | just assembling a file and have passed the option. llvm-svn: 179218
* Remove unused arguments.Chad Rosier2013-04-101-4/+3
| | | | llvm-svn: 179217
* [driver] Add a -Ofast option, which enables -O3, -ffast-math, andChad Rosier2013-04-101-2/+14
| | | | | | | -fstrict-aliasing. rdar://13622687 llvm-svn: 179216
* Add an option to parse all comments as documentation commentsDmitri Gribenko2013-04-107-8/+17
| | | | | | Patch by Amin Shali. llvm-svn: 179180
* Fixes recovering from errors when parsing braced init lists.Manuel Klimek2013-04-101-0/+25
| | | | | | | Before we would build huge unwrapped lines which take a long time to optimze. llvm-svn: 179168
* Fix labels with trailing comments and cleanup.Daniel Jasper2013-04-103-75/+62
| | | | | | | | | | | | | | | | | | Before: class A { public : // test }; After: class A { public: // test }; Also remove duplicate methods calculating properties of AnnotatedTokens and make them members of AnnotatedTokens so that they are in a common place. llvm-svn: 179167
* Handle "typeof" in Objective-C format string checking. This previously crashed.Ted Kremenek2013-04-101-0/+4
| | | | | | | | Yes, this came from actual code. Fixes <rdar://problem/13557053>. llvm-svn: 179155
* Add support for computing the exception specification for an inheritingRichard Smith2013-04-101-4/+69
| | | | | | | | | | | constructor. This isn't quite perfect (as usual, we don't handle default arguments correctly yet, and we don't deal with copy/move constructors for arguments correctly either, but this will be fixed when we implement core issue 1351. This completes our support for inheriting constructors. llvm-svn: 179154
* Don't crash when mangling types defined in ObjC class extensions.John McCall2013-04-101-0/+9
| | | | | | | | | The original test case here was mangling a type name for TBAA, but we can provoke this in C++11 easily enough. rdar://13434937 llvm-svn: 179153
* C++11 inheriting constructors: support for inheriting constructor templates.Richard Smith2013-04-102-196/+296
| | | | llvm-svn: 179151
* <rdar://problem/13605348> Don't consider invalid user-defined literal ↵Douglas Gregor2013-04-101-0/+6
| | | | | | operators during overload resolution. llvm-svn: 179150
* [frontend] -frewrite-includes: turn implicit module imports into @imports.Argyrios Kyrtzidis2013-04-101-15/+24
| | | | | | rdar://13610250 llvm-svn: 179145
* [frontend] When preprocessing, turn implicit module imports into @imports.Argyrios Kyrtzidis2013-04-101-0/+29
| | | | | | part of rdar://13610250 llvm-svn: 179144
* [frontend] -frewrite-includes: if there was no inclusion, don't add lineinfo ↵Argyrios Kyrtzidis2013-04-101-3/+8
| | | | | | that indicates return from another file. llvm-svn: 179143
* Improve the diagnostics of the number-reading preprocessor directives.Michael Ilseman2013-04-101-4/+6
| | | | | | | | | | | | | | The GNU line marker directive was sharing code with the #line directive, but some of the warnings/errors were reporting as #line directive diagnostics in both cases. Previously: #line 11foo1 ==> "#line directive requires a simple digit sequence" # 11foo1 ==> "#line directive requires a simple digit sequence" Now, we get: #line 11foo1 ==> "#line directive requires a simple digit sequence" # 11foo1 ==> "GNU line marker directive requires a simple digit sequence" llvm-svn: 179139
* Suppress -Wunused-variable for variables declared in headers, which may inMatt Beaumont-Gay2013-04-101-2/+6
| | | | | | | | | | | fact be defined and used in another TU. Reshuffle some test cases because we suppress -Wunused-variable after we've emitted an error. This fixes PR15558. llvm-svn: 179138
* Objective-C: This patch fixes a none-issuance of warningFariborz Jahanian2013-04-091-1/+4
| | | | | | | | | | | when result type of protocol property and getter method differ by fixing a more serious problem. When a forward protocol declaration comes between its definition and its use in class protocol list, the forward protocol ast was being used in building the protocol list. // rdar://12522752 llvm-svn: 179108
* Fix comments before labels.Daniel Jasper2013-04-091-6/+13
| | | | | | | | | | | | | | | | | | | | | | Before: switch (...) { // a // b // c case first: break; } After: switch (...) { // a // b // c case first: break; } llvm-svn: 179107
* Again macros without trailing semicolons: don't care about declaration context.Alexander Kornienko2013-04-091-3/+30
| | | | | | | | | | | | | | | | Summary: Some codebases use these kinds of macros in functions, e.g. Chromium's IPC_BEGIN_MESSAGE_MAP, IPC_BEGIN_MESSAGE_HANDLER, etc. Reviewers: djasper, klimek Reviewed By: klimek CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D645 llvm-svn: 179099
* [ms-cxxabi] Add "$$C" when mangling template arg QualTypesReid Kleckner2013-04-091-2/+6
| | | | | | Credit goes to Timur Iskhodzhanov for finding the problem and solution. llvm-svn: 179093
* One more follow-up to r179082 - parse PIC/PIE arguments even on platfroms ↵Alexey Samsonov2013-04-091-13/+14
| | | | | | that force default PIC (like Darwin x86-64), otherwise specifying -fPIC will produce bogus unused argument warning llvm-svn: 179092
* Follow-up for r179082: more careful handling of ↵Alexey Samsonov2013-04-091-5/+13
| | | | | | -f(no-)sanitize-address-zero-base-shadow on Android llvm-svn: 179089
* If the user requested a zero-base-shadow sanitizer, infer -pie and -fPIC ↵Peter Collingbourne2013-04-095-58/+76
| | | | | | | | when appropriate. Differential Revision: http://llvm-reviews.chandlerc.com/D502 llvm-svn: 179082
* [analyzer] Replace isIntegerType() with isIntegerOrEnumerationType().Jordan Rose2013-04-0912-26/+31
| | | | | | | | | | | | | | | | | | | | | | | | | Previously, the analyzer used isIntegerType() everywhere, which uses the C definition of "integer". The C++ predicate with the same behavior is isIntegerOrUnscopedEnumerationType(). However, the analyzer is /really/ using this to ask if it's some sort of "integrally representable" type, i.e. it should include C++11 scoped enumerations as well. hasIntegerRepresentation() sounds like the right predicate, but that includes vectors, which the analyzer represents by its elements. This commit audits all uses of isIntegerType() and replaces them with the general isIntegerOrEnumerationType(), except in some specific cases where it makes sense to exclude scoped enumerations, or any enumerations. These cases now use isIntegerOrUnscopedEnumerationType() and getAs<BuiltinType>() plus BuiltinType::isInteger(). isIntegerType() is hereby banned in the analyzer - lib/StaticAnalysis and include/clang/StaticAnalysis. :-) Fixes real assertion failures. PR15703 / <rdar://problem/12350701> llvm-svn: 179081
* When checking for illegal expressions in a default-argumentJohn McCall2013-04-091-0/+18
| | | | | | | | expression, look through pseudo-object expressions. rdar://13602832 llvm-svn: 179080
* Skip transparent contexts when looking for using directives in name lookup.Douglas Gregor2013-04-091-1/+5
| | | | | | Fixes the bootstrap regression I introduced in r179067. llvm-svn: 179079
OpenPOWER on IntegriCloud