summaryrefslogtreecommitdiffstats
path: root/clang/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* Diagnose loads of 'half' l-values in OpenCL.John McCall2013-02-123-21/+9
| | | | | | Patch by Joey Gouly! llvm-svn: 174928
* Backing out r174919 while I investigate a self-host bug on Takumi's builder.Lang Hames2013-02-123-364/+1
| | | | llvm-svn: 174925
* In ARC, emit non-peepholed +1s within the full-expression insteadJohn McCall2013-02-121-17/+19
| | | | | | of immediately afterwards. llvm-svn: 174922
* When generating IR for default copy-constructors, copy-assignment operators,Lang Hames2013-02-113-1/+364
| | | | | | | | | | | | | | | | | | | | move-constructors and move-assignment operators, use memcpy to copy adjacent POD members. Previously, classes with one or more Non-POD members would fall back on element-wise copies for all members, including POD members. This often generated a lot of IR. Without padding metadata, it wasn't often possible for the LLVM optimizers to turn the element-wise copies into a memcpy. This code hasn't yet received any serious tuning. I didn't see any serious regressions on a self-hosted clang build, or any of the nightly tests, but I think it's important to get this out in the wild to get more testing. Insights, feedback and comments welcome. Many thanks to David Blaikie, Richard Smith, and especially John McCall for their help and feedback on this work. llvm-svn: 174919
* Don't bother reconciling external visible decls against our current set ofRichard Smith2013-02-111-11/+5
| | | | | | declarations if we didn't have a lookup map when the external decls were added. llvm-svn: 174906
* objective-C modern translator: Fixes a mistranslationFariborz Jahanian2013-02-111-1/+3
| | | | | | | of @throw statement by finding location of the ';' correctly. // rdar://13186010 llvm-svn: 174898
* [Modules] Cope better with top-level declarations loaded after being ↵Douglas Gregor2013-02-112-3/+31
| | | | | | | | | | | | | | | | | | | | declared in the current translation unit <rdar://problem/13189985>. These two related tweaks to keep the information associated with a given identifier correct when the identifier has been given some top-level information (say, a top-level declaration) and more information is then loaded from a module. The first ensures that an identifier that was "interesting" before being loaded from an AST is considered to be different from its on-disk counterpart. Otherwise, we lose such changes when writing the current translation unit as a module. Second, teach the code that injects AST-loaded names into the identifier chain for name lookup to keep the most recent declaration, so that we don't end up confusing our declaration chains by having a different declaration in there. llvm-svn: 174895
* Formatter: Detect ObjC message expressions after 'in' in loopNico Weber2013-02-113-6/+22
| | | | | | | | | | | | | | | | Before: for (id foo in[self getStuffFor : bla]) { } Now: for (id foo in [self getStuffFor:bla]) { } "in" is treated as loop keyword if the line starts with "for", and as a regular identifier else. To check for "in", its IdentifierInfo is handed through a few layers. llvm-svn: 174889
* Get rid of manual debug output, now that the test runner supports it.Manuel Klimek2013-02-112-6/+0
| | | | | | You can run tests with -debug instead now. llvm-svn: 174880
* Fix invalid formatting with spaces before trailing comments.Daniel Jasper2013-02-113-9/+11
| | | | | | | | In google style, trailing comments are separated by two spaces. This patch fixes the counting of these spaces and prevents clang-format from creating a line with 81 columns. llvm-svn: 174879
* Fixes handling of empty lines in macros.Manuel Klimek2013-02-112-4/+6
| | | | | | | | | | | | | | Now correctly formats: #define A \ \ b; to #define A b; Added the state whether an unwrapped line is a macro to the debug output. llvm-svn: 174878
* Fix formatting of overloaded operator definitions.Daniel Jasper2013-02-112-17/+13
| | | | | | | | | | | | Before: operatorvoid*(); operator vector< A< A>>(); After: operator void *(); operator vector<A<A> >(); llvm-svn: 174863
* Formatter: Remove now-unneeded code for formatting ':'s in ObjC method decls.Nico Weber2013-02-101-21/+0
| | | | | | | The more general code for formatting ObjC method exprs does this and more, it's no longer necessary to special-case this. No behavior change. llvm-svn: 174843
* Formatter: Initial support for ObjC dictionary literals.Nico Weber2013-02-101-1/+16
| | | | | | | | | | | | | | | | | | Before: @{ foo: bar } ; Now: @{ foo : bar }; parseBracedList() already does the right thing from an UnwrappedLineParser perspective, so check for "@{" in all loops that process constructs that can contain expressions and call parseBracedList() if found. llvm-svn: 174840
* Use -mno-implicit-float by default for kernel/kext code. <rdar://13177960>Bob Wilson2013-02-101-4/+12
| | | | | | | | | | | Apple's kernel engineers have been expecting this behavior even though we've never implemented it before, as far as I can tell. In recent months, clang has gotten better at using vector instructions to optimize memcpy-like operations, and that has exposed problems when vector/floating-point instructions are used in kexts that don't support that. This behavior also matches what Apple's GCC did for PowerPC targets. llvm-svn: 174838
* Delete an extra blank line.Bob Wilson2013-02-101-1/+0
| | | | llvm-svn: 174837
* Recognize -mno-implicit-float option for x86 as well as ARM. <rdar://13180731>Bob Wilson2013-02-101-1/+2
| | | | | | | | | For x86 targets, we've been using the -msoft-float option to control passing the no-implicit-float option to cc1. Since the -mno-implicit-float option is now accepted by the driver, this just makes it work for x86 the same as it does for ARM targets. llvm-svn: 174836
* Use static functions instead of an unnamed namespaceDmitri Gribenko2013-02-101-6/+8
| | | | llvm-svn: 174835
* Reformat formatter code. No functionality change.Nico Weber2013-02-101-10/+9
| | | | llvm-svn: 174823
* Formatter: Detect ObjC array literals.Nico Weber2013-02-102-5/+13
| | | | | | | | Use this to add a space after "@[" and before "]" for now. Later, I want to use this to format multi-line array literals nicer, too. llvm-svn: 174822
* objective-C: Fixes a bogus warning due to not settingFariborz Jahanian2013-02-101-3/+13
| | | | | | | | the "nonatomic" attribute in property redeclaration in class extension. Also, improved on diagnostics in this area while at it. // rdar://13156292 llvm-svn: 174821
* Comment parsing: use CharInfo.hDmitri Gribenko2013-02-092-43/+17
| | | | | | | This also gives us 0.2% speedup on '-fsyntax-only -Wdocumentation' time for a testcase that consists of all Clang headers. llvm-svn: 174810
* Remove some stray uses of <ctype.h> functions.Jordan Rose2013-02-094-4/+7
| | | | | | These are causing assertions on some MSVC builds. llvm-svn: 174805
* QoI: -Wreadonly-iboutlet-property should have the warning's location on the ↵Ted Kremenek2013-02-091-2/+2
| | | | | | | | | | property. There's no need to refer to the @implementation at all. Fixes <rdar://problem/13186515> llvm-svn: 174802
* Ensure that type definitions present in just-loaded modules areDouglas Gregor2013-02-095-18/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | visible. The basic problem here is that a given translation unit can use forward declarations to form pointers to a given type, say, class X; X *x; and then import a module that includes a definition of X: import XDef; We will then fail when attempting to access a member of X, e.g., x->method() because the AST reader did not know to look for a default of a class named X within the new module. This implementation is a bit of a C-centric hack, because the only definitions that can have this property are enums, structs, unions, Objective-C classes, and Objective-C protocols, and all of those are either visible at the top-level or can't be defined later. Hence, we can use the out-of-date-ness of the name and the identifier-update mechanism to force the update. In C++, we will not be so lucky, and will need a more advanced solution, because the definitions could be in namespaces defined in two different modules, e.g., // module 1 namespace N { struct X; } // module 2 namespace N { struct X { /* ... */ }; } One possible implementation here is for C++ to extend the information associated with each identifier table to include the declaration IDs of any definitions associated with that name, regardless of context. We would have to eagerly load those definitions. llvm-svn: 174794
* clang/lib/StaticAnalyzer/Core/BugReporter.cpp: Appease old msvc in ↵NAKAMURA Takumi2013-02-091-1/+2
| | | | | | std::pair(0, 0). llvm-svn: 174792
* Properly validate UCNs for C99 and C++03 (both more restrictive than C(++)11).Jordan Rose2013-02-092-89/+582
| | | | | | | | Add warnings under -Wc++11-compat, -Wc++98-compat, and -Wc99-compat when a particular UCN is incompatible with a different standard, and -Wunicode when a UCN refers to a surrogate character in C++03. llvm-svn: 174788
* [analyzer] Invalidation checker: move the "missing implementation" checkAnna Zaks2013-02-091-12/+13
| | | | | | | | | | | | The missing definition check should be in the same category as the missing ivar validation - in this case, the intent is to invalidate in the given class, as described in the declaration, but the implementation does not perform the invalidation. Whereas the MissingInvalidationMethod checker checks the cases where the method intention is not to invalidate. The second checker has potential to have a much higher false positive rate. llvm-svn: 174787
* [analyzer] Move DefaultBool so that all checkers can share it.Anna Zaks2013-02-082-14/+0
| | | | llvm-svn: 174782
* [analyzer] Split IvarInvalidation into two checkersAnna Zaks2013-02-082-45/+91
| | | | | | | Separate the checking for the missing invalidation methods into a separate checker so that it can be turned on/off independently. llvm-svn: 174781
* [analyzer] IvarInvalidation: refactor, pull out the diagnostic printingAnna Zaks2013-02-081-49/+69
| | | | llvm-svn: 174780
* [analyzer] IvarInvalidation: add annotation for partial invalidationAnna Zaks2013-02-081-39/+78
| | | | | | | | | | | The new annotation allows having methods that only partially invalidate IVars and might not be called from the invalidation methods directly (instead, are guaranteed to be called before the invalidation occurs). The checker is going to trust the programmer to call the partial invalidation method before the invalidator.This is common in cases when partial object tear down happens before the death of the object. llvm-svn: 174779
* objective-C: don't issue bogus warning aboutFariborz Jahanian2013-02-081-12/+30
| | | | | | | | "auto-synthesized may not work correctly with 'nib' loader" when 'readonly' property is redeclared 'readwrite' in class extension. // rdar://13123861 llvm-svn: 174775
* CharInfo: Add missing "using namespace clang::charinfo" in .cpp file.Jordan Rose2013-02-081-2/+3
| | | | | | Should fix the MSC bot. llvm-svn: 174769
* Excise <cctype> from Clang (except clang-tblgen) in favor of CharInfo.h.Jordan Rose2013-02-0826-99/+93
| | | | | | | Nearly all of these changes are one-to-one replacements; the few that aren't have to do with custom identifier validation. llvm-svn: 174768
* Simplify logic for avoiding concatenation after numeric constants.Jordan Rose2013-02-081-6/+5
| | | | | | | I threw in a couple of test cases for UD-suffixes -- already working, but it wasn't immediately obvious to me. llvm-svn: 174767
* StmtPrinter: Write large char values using \u or \U.Jordan Rose2013-02-081-8/+9
| | | | | | | | | This may not always be valid, but we were previously just emitting them raw. While here, s/isprint/isPrintable/ (using the new CharInfo). llvm-svn: 174766
* Pull Lexer's CharInfo table out for general use throughout Clang.Jordan Rose2013-02-083-170/+86
| | | | | | | | | | | Rewriting the same predicates over and over again is bad for code size and code maintainence. Using the functions in <ctype.h> is generally unsafe unless they are specified to be locale-independent (i.e. only isdigit and isxdigit). The next commit will try to clean up uses of <ctype.h> functions within Clang. llvm-svn: 174765
* Always keep highest identifier, selector, and macro IDs when we'veDouglas Gregor2013-02-081-5/+21
| | | | | | read another one, just as we do for types. llvm-svn: 174745
* Never cache the result of a module file lookup.Douglas Gregor2013-02-083-8/+15
| | | | llvm-svn: 174744
* Fix indentation-detection at indent level 0.Manuel Klimek2013-02-081-2/+2
| | | | | | | | | | | This correctly formats: { a; } where { is incorrectly indented by 2, but is at level 0, when reformatting only 'a;'. llvm-svn: 174737
* Teach BugReporter (extensive diagnostics) to emit a diagnostic when a loop ↵Ted Kremenek2013-02-081-3/+51
| | | | | | | | body is skipped. Fixes <rdar://problem/12322528>. llvm-svn: 174736
* Remove stale instance variable.Ted Kremenek2013-02-081-1/+0
| | | | llvm-svn: 174730
* objective-C modern translation: Fix another random translation bugFariborz Jahanian2013-02-081-0/+2
| | | | | | | involving property getter expressions on rhs of property setter. // rdar://13138459 llvm-svn: 174729
* Takes the context into account when re-indenting regions.Manuel Klimek2013-02-081-25/+62
| | | | | | Fixes llvm.org/PR14916. llvm-svn: 174720
* objective-C modern translator. Fixes a trivialFariborz Jahanian2013-02-081-3/+3
| | | | | | | rewriting bug where #ifdef ended up on the same line as the attribute declaration. llvm-svn: 174719
* Fix handling of fake parenthesis during formatting.Daniel Jasper2013-02-082-2/+2
| | | | | | | | | | | | | | | | | | They are much easier to handle when attached to the previous token. Before: unsigned Indent = formatFirstToken(TheLine.First, IndentForLevel[TheLine.Level] >= 0 ? IndentForLevel[TheLine.Level] : TheLine.Level * 2, TheLine.InPPDirective, PreviousEndOfLineColumn); After: unsigned Indent = formatFirstToken( TheLine.First, IndentForLevel[TheLine.Level] >= 0 ? IndentForLevel[TheLine.Level] : TheLine.Level * 2, TheLine.InPPDirective, PreviousEndOfLineColumn); llvm-svn: 174718
* Implement a tiny expression parser to improve formatting decisions.Daniel Jasper2013-02-083-43/+138
| | | | | | | | | | | | | | | | | | | | | | | | | | | | With this patch, the formatter introduces 'fake' parenthesis according to the operator precedence of binary operators. Before: return aaaa & AAAAAAAAAAAAAAAAAAAAAAAAAAAAA || bbbb & BBBBBBBBBBBBBBBBBBBBBBBBBBBBB || cccc & CCCCCCCCCCCCCCCCCCCCCCCCCC || dddd & DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD; f(aaaaaaaaaaaaaaaaaaaa && aaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaa && aaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaa && aaaaaaaaaaaaaaaaaaaa); After: return aaaa & AAAAAAAAAAAAAAAAAAAAAAAAAAAAA || bbbb & BBBBBBBBBBBBBBBBBBBBBBBBBBBBB || cccc & CCCCCCCCCCCCCCCCCCCCCCCCCC || dddd & DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD; f(aaaaaaaaaaaaaaaaaaaa && aaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaa && aaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaa && aaaaaaaaaaaaaaaaaaaa); Future improvements: - Get rid of some of the hacky ways to nicely format certain constructs. - Merge this parser and the AnnotatingParser as we now have several parsers that analyze (), [], etc. llvm-svn: 174714
* Avoid unnecessary line breaks in nested ObjC calls.Daniel Jasper2013-02-081-16/+39
| | | | | | | | | | | | Before: [pboard setData:[NSData dataWithBytes:&button length:sizeof(button)] forType:kBookmarkButtonDragType]; After: [pboard setData:[NSData dataWithBytes:&button length:sizeof(button)] forType:kBookmarkButtonDragType]; llvm-svn: 174701
* Use the target address space value when mangling names.Tanya Lattner2013-02-081-1/+2
| | | | llvm-svn: 174688
OpenPOWER on IntegriCloud