summaryrefslogtreecommitdiffstats
path: root/clang/lib
Commit message (Collapse)AuthorAgeFilesLines
* Bugfix for r181629:Adrian Prantl2013-05-221-2/+4
| | | | | | | | | - The return type should be a pointer to the class type. - Make the condition more specific. rdar://problem/13359718 llvm-svn: 182504
* [analyzer;alternate edges] remove puny edges on the same line that span less ↵Ted Kremenek2013-05-221-2/+70
| | | | | | | | | | | than 3 columns. These are legitimate control-flow edges, but visually they add no value. Implements <rdar://problem/13941325>. llvm-svn: 182502
* Remove unnecessary assignment.Ted Kremenek2013-05-221-2/+0
| | | | llvm-svn: 182501
* Remove unused #include <map>Reid Kleckner2013-05-221-1/+0
| | | | llvm-svn: 182500
* [analyzer] Don't crash if a block doesn't have a type signature.Jordan Rose2013-05-222-5/+17
| | | | | | | | | | | Currently, blocks instantiated in templates lose their "signature as written"; it's not clear if this is intentional. Change the analyzer's use of BlockDecl::getSignatureAsWritten to check whether or not the signature is actually there. <rdar://problem/13954714> llvm-svn: 182497
* Use StringMap in MicrosoftMangle to resolve FIXME.Reid Kleckner2013-05-221-3/+2
| | | | llvm-svn: 182488
* Fix uninitialized access error found by valgrind.Manuel Klimek2013-05-221-0/+3
| | | | llvm-svn: 182476
* Makes whitespace management more consistent.Manuel Klimek2013-05-227-285/+408
| | | | | | | | | | | | | | | | | | | | | | | | | Instead of selectively storing some changes and directly generating replacements for others, we now notify the WhitespaceManager of the whitespace before every token (and optionally with more changes inside tokens). Then, we run over all whitespace in the very end in original source order, where we have all information available to correctly align comments and escaped newlines. The future direction is to pull more of the comment alignment implementation that is now in the BreakableToken into the WhitespaceManager. This fixes a bug when aligning comments or escaped newlines in unwrapped lines that are handled out of order: #define A \ f({ \ g(); \ }); ... now gets correctly layouted. llvm-svn: 182467
* Improve clang-format's stream formatting.Daniel Jasper2013-05-221-1/+1
| | | | | | | | | | | | | | | clang-format was a bit too aggressive when trying to keep labels and values on the same line. Before: llvm::outs() << "aaaaaaaaaaaaaaaaaaa: " << aaaaaaaaaaaaa( aaaaaaaaaaaaaaaaaaaaaaaaaaaa); After: llvm::outs() << "aaaaaaaaaaaaaaaaaaa: " << aaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaa); llvm-svn: 182458
* Fix function declaration behavior.Daniel Jasper2013-05-221-1/+1
| | | | | | | | | | | | | | | | | | This only affects styles that prevent bin packing. There, a break after a template declaration also forced a line break after the function name. Before: template <class SomeType, class SomeOtherType> SomeType SomeFunction(SomeType Type, SomeOtherType OtherType) {} After: template <class SomeType, class SomeOtherType> SomeType SomeFunction(SomeType Type, SomeOtherType OtherType) {} This fixes llvm.org/PR16072. llvm-svn: 182457
* Improve handling of trailing 'const'.Daniel Jasper2013-05-221-4/+9
| | | | | | | Reduce the preference for breaking before a trailing 'const' according to review comments on r182362. llvm-svn: 182455
* Cut-off clang-format analysis.Daniel Jasper2013-05-223-29/+24
| | | | | | | | | | | | | | | | If clang-format is confronted with long and deeply nested lines (e.g. complex static initializers or function calls), it can currently try too hard to find the optimal solution and never finish. The reason is that the memoization does not work effectively for deeply nested lines. This patch removes an earlier workaround and instead opts for accepting a non-optimal solution in rare cases. However, it only does so only in cases where it would have to analyze an excessive number of states (currently set to 10000 - the most complex line in Format.cpp requires ~800 states) so this should not change the behavior in a relevant way. llvm-svn: 182449
* [analyzer] Do not assert on reports ending in calls within macros.Anna Zaks2013-05-221-1/+7
| | | | | | | | | The crash is triggered by the newly added option (-analyzer-config report-in-main-source-file=true) introduced in r182058. Note, ideally, we’d like to report the issue within the main source file here as well. For now, just do not crash. llvm-svn: 182445
* Fix crash-on-invalid: only use TransformAddressOfOperand when transforming theRichard Smith2013-05-211-1/+5
| | | | | | operand of a unary address-of expression, not for *all* expressions! llvm-svn: 182436
* PR16090: C++1y: treat undeduced 'auto' as a literal type, so that constexprRichard Smith2013-05-211-0/+5
| | | | | | function templates can use it as a return type. llvm-svn: 182433
* PR16094: I should have known Obj-C init-capture disambiguation couldn't beRichard Smith2013-05-211-7/+73
| | | | | | | | | | | | | | | | | | | | | *that* easy... Try a bit harder to disambiguate. This is mostly straightforward, but for =-style initializers, we actually need to know where an expression ends: [foo = bar baz] is a message send, whereas [foo = bar + baz] is a lambda-introducer. Handle this by parsing the expression eagerly, and replacing it with an annotation token. By chance, we use the *exact same* parsing rules in both cases (except that we need to assume we're inside a message send for the parse, to turn off various forms of inapplicable error recovery). llvm-svn: 182432
* [analyzer;alternate edges] prune out extra edges to a subexpression where we ↵Ted Kremenek2013-05-211-4/+46
| | | | | | | | dive-in and out of a subexpression. Fixes <rdar://problem/13941891>. llvm-svn: 182426
* [analyzer; alternated edges] look through expressions just like Environment ↵Ted Kremenek2013-05-211-1/+3
| | | | | | does. llvm-svn: 182425
* Objective-C arc: don't count use of __weakFariborz Jahanian2013-05-213-5/+5
| | | | | | | variables when they are used in such unevaluated contexts as __typeof, etc. // rdar://13942025 llvm-svn: 182423
* Refactor places which perform contextual implicit conversions to go through aRichard Smith2013-05-214-245/+182
| | | | | | | | | | | | | common function. The C++1y contextual implicit conversion rules themselves are not yet implemented, however. This also fixes a subtle bug where template instantiation context notes were dropped for diagnostics coming from conversions for integral constant expressions -- we were implicitly slicing a SemaDiagnosticBuilder into a DiagnosticBuilder when producing these diagnostics, and losing their context notes in the process. llvm-svn: 182406
* Debug Info: Simplify the code changed in r182403 to reduce indent & avoid a ↵David Blaikie2013-05-211-15/+14
| | | | | | duplicate lookup in the insertion case llvm-svn: 182404
* Debug Info: don't bother reinserting elements into maps we just retrieved ↵David Blaikie2013-05-211-5/+6
| | | | | | | | them from (no intended behavior change) llvm-svn: 182403
* Fix whitespaceDavid Blaikie2013-05-211-8/+6
| | | | llvm-svn: 182400
* Let clang-format move the cursor appropriately.Daniel Jasper2013-05-211-0/+13
| | | | | | | | | With this patch, clang-format will try to keep the cursor at the original code position in editor integrations (implemented for emacs and vim). This means, after formatting, clang-format will try to keep the cursor on the same character of the same token. llvm-svn: 182373
* Allow breaking before a trailing const.Daniel Jasper2013-05-211-1/+1
| | | | | | | | | | | | | | Before: void someLongFunction( int someLongParameter) const; After: void someLongFunction(int someLongParameter) const; Also slightly cleanup tests. llvm-svn: 182362
* In -ast-dump, only dump comments when dumping the actual Decl to which theyRichard Smith2013-05-212-4/+10
| | | | | | | | attach, rather than merging all comments on the declaration chain. This gives a more faithful dump, and has the side benefit of unbreaking uses of dump() from within AST deserialization (where the redeclaration chain may not be sane). llvm-svn: 182350
* [analyzer; alternate edges] optimize edges for ObjC fast enumeration loops.Ted Kremenek2013-05-211-4/+49
| | | | | | Fixes <rdar://problem/13942300>. llvm-svn: 182342
* doc. parsing. HeaderDoc documentaton allows use ofFariborz Jahanian2013-05-201-0/+5
| | | | | | | @class command on an @interface declaration. Turn off the warning for this case. // rdar://13927330 llvm-svn: 182334
* Revert r182331, these checks should be based on the target not the host.Richard Smith2013-05-202-6/+1
| | | | llvm-svn: 182333
* Move two Darwin-specific hacks into #ifdef __APPLE__. These were stat'ingRichard Smith2013-05-202-1/+6
| | | | | | nonexistent Darwin-specific files on every module build. llvm-svn: 182331
* PR14606: Debug Info for namespace aliases/DW_TAG_imported_moduleDavid Blaikie2013-05-204-2/+36
| | | | | | | | | This resolves the last of the PR14606 failures in the GDB 7.5 test suite. (but there are still unresolved issues in the imported_decl case - we need to implement optional/lazy decls for functions & variables like we already do for types) llvm-svn: 182329
* Warn on and drop dllimport attrs from variable definitionsReid Kleckner2013-05-202-3/+11
| | | | | | | AsmPrinter::EmitLinkage() does not handle dllimport linkage. The LLVM verifier should also be fixed to reject this. llvm-svn: 182320
* Objective-C [qoi]: When an class conforms to multipleFariborz Jahanian2013-05-202-0/+78
| | | | | | | | protocols that declare the same property of incompatible types, issue a warning when class implementation synthesizes the property. // rdar://13075400 llvm-svn: 182316
* Make this const since it never changes (and should never change).Eric Christopher2013-05-201-1/+1
| | | | llvm-svn: 182309
* Thread safety analysis: fix use after free bug reported by Evgeniy Stepanov.DeLesley Hutchins2013-05-201-7/+21
| | | | llvm-svn: 182305
* Minor fix: don't crash on empty configuration file, consider empty ↵Alexander Kornienko2013-05-201-0/+2
| | | | | | configuration files invalid. llvm-svn: 182290
* [ms-cxxabi] Look up operator delete() at every virtual dtor declaration.Peter Collingbourne2013-05-202-5/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While the C++ standard requires that this lookup take place only at the definition point of a virtual destructor (C++11 [class.dtor]p12), the Microsoft ABI may require the compiler to emit a deleting destructor for any virtual destructor declared in the TU, including ones without a body, requiring an operator delete() lookup for every virtual destructor declaration. The result of the lookup should be the same no matter which declaration is used (except in weird corner cases). This change will cause us to reject some valid TUs in Microsoft ABI mode, e.g.: struct A { void operator delete(void *); }; struct B { void operator delete(void *); }; struct C : A, B { virtual ~C(); }; As Richard points out, every virtual function declared in a TU (including this virtual destructor) is odr-used, so it must be defined in any program which declares it, or the program is ill formed, no diagnostic required. Because we know that any definition of this destructor will cause the lookup to fail, the compiler can choose to issue a diagnostic here. Differential Revision: http://llvm-reviews.chandlerc.com/D822 llvm-svn: 182270
* Extend default blacklist logic to MSan and TSan.Evgeniy Stepanov2013-05-201-3/+9
| | | | llvm-svn: 182269
* Add arm_neon.h to the builtin intrinsics module map.Douglas Gregor2013-05-201-0/+10
| | | | | | Fixes <rdar://problem/13933913>. llvm-svn: 182268
* Implement __declspec(selectany) under -fms-extensionsReid Kleckner2013-05-203-1/+29
| | | | | | | | | | | | | | | | selectany only applies to externally visible global variables. It has the effect of making the data weak_odr. The MSDN docs suggest that unused definitions can only be dropped at linktime, so Clang uses weak instead of linkonce. MSVC optimizes away references to constant selectany data, so it must assume that there is only one definition, hence weak_odr. Reviewers: espindola Differential Revision: http://llvm-reviews.chandlerc.com/D814 llvm-svn: 182266
* Add -Wincomplete-module, which detects when a header is included from a ↵Douglas Gregor2013-05-201-1/+29
| | | | | | module but isn't itself part of a module. llvm-svn: 182263
* Revert "Revert "Debug Info: Using declarations/DW_TAG_imported_declaration ↵David Blaikie2013-05-203-11/+74
| | | | | | | | | | | | | | | | | | | | | of variables, types, and functions."" This reverts commit r181947 (git d2990ce56a16050cac0d7937ec9919ff54c6df62 ) This addresses one of the two issues identified in r181947, ensuring that types imported via using declarations only result in a declaration being emitted for the type, not a definition. The second issue (emitting using declarations that are unused) is hopefully an acceptable increase as the real fix for this would be a bit difficult (probably at best we could record which using directives were involved in lookups - but may not have been the result of the lookup). This also ensures that DW_TAG_imported_declarations (& directives) are not emitted in line-tables-only mode as well as ensuring that typedefs only require/emit declarations (rather than definitions) for referenced types. llvm-svn: 182231
* OpenBSD/sparc64 uses long long for int64_t and intmax_t.Jakob Stoklund Olesen2013-05-191-3/+10
| | | | | | Other operating systems, including FreeBSD and NetBSD, use long. llvm-svn: 182215
* Clang-format: allow -style="{yaml/json}" on command lineAlexander Kornienko2013-05-191-13/+19
| | | | | | | | | | | | | | Summary: + improved handling of default style and predefined styles. Reviewers: djasper, klimek Reviewed By: klimek CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D813 llvm-svn: 182205
* Fix a logic bug in the handling of -fmath-errno in the driver. We wouldChandler Carruth2013-05-181-2/+11
| | | | | | | | | | | | | | | | | | | | | | | | imply -fno-math-errno if the user passed -fno-fast-math OR -ffast-math, regardless of in which order and regardless of the tool chain default. I've fixed this to follow the logic: 1) If the last dominating flag is -fno-math-errno, -ffast-math, or -Ofast, then do not use math-errno. 2) If the last dominating flag is an explicit -fmath-errno, do use math-errno. 3) Otherwise, use the toolchain default. This, for example, allows the flag sequence '-ffast-math ... -fno-fast-math' with no mention of '-fmath-errno' or '-fno-math-errno' to preserve the toolchain default. Most notably, this should prevent users trying to disable fast-math optimizations on Darwin and BSD platforms from simultaneously enabling (pointless) -fmath-errno. I've enhanced the tests (after more reorganization) to cover this and other weird permutations of flags and targets. llvm-svn: 182203
* Removed invalid character.Serge Pavlov2013-05-181-1/+1
| | | | llvm-svn: 182189
* [analyzer] New edges: include an edge to the end-of-path location.Jordan Rose2013-05-181-0/+2
| | | | llvm-svn: 182188
* [analyzer] "Fix" ParentMap to handle non-syntactic OpaqueValueExprs.Jordan Rose2013-05-181-3/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | Constructs like PseudoObjectExpr, where an expression can appear more than once in the AST, use OpaqueValueExprs to guard against inadvertent re-processing of the shared expression during AST traversal. The most common form of this is to share expressions between the syntactic "as-written" form of, say, an Objective-C property access 'obj.prop', and the underlying "semantic" form '[obj prop]'. However, some constructs can produce OpaqueValueExprs that don't appear in the syntactic form at all; in these cases the ParentMap wasn't ever traversing the children of these expressions. This patch fixes that by checking to see if an OpaqueValueExpr's child has ever been traversed before. There's also a bit of reset logic when visiting a PseudoObjectExpr to handle the case of updating the ParentMap, which some external clients depend on. This still isn't exactly the right fix because we probably want the parent of the OpaqueValueExpr itself to be its location in the syntactic form if it's syntactic and the PseudoObjectExpr or BinaryConditionalOperator itself if it's semantic. Whe I originally wrote the code to do this, I didn't realize that OpaqueValueExprs themselves are shared in the AST, not just their source expressions. This patch doesn't change the existing behavior so as not to break anything inadvertently relying on it; we'll come back to this later. llvm-svn: 182187
* [analyzer] Add a debug dump for PathPieces, a list of PathDiagnosticPieces.Jordan Rose2013-05-181-0/+54
| | | | | | Originally implemented by Ted, extended by me. llvm-svn: 182186
* Revert "[analyzer; alternate edges] improve support for edges with ↵Jordan Rose2013-05-183-146/+25
| | | | | | | | | | | | | PseudoObjectExprs." Ted and I spent a long time discussing this today and found out that neither the existing code nor the new code was doing what either of us thought it was, which is never good. The good news is we found a much simpler way to fix the motivating test case (an ObjCSubscriptExpr). This reverts r182083, but pieces of it will come back in subsequent commits. llvm-svn: 182185
OpenPOWER on IntegriCloud