summaryrefslogtreecommitdiffstats
path: root/clang/lib
Commit message (Collapse)AuthorAgeFilesLines
* Fixed an assertion failure triggered by invalid code.Enea Zaffanella2013-01-111-0/+4
| | | | | | | | Set invalid type of declarator after emitting error diagnostics, so that it won't be later considered when instantiating the template. Added test5_inst in test/SemaCXX/condition.cpp for non-regression. llvm-svn: 172201
* Improve handling of trailing declaration annotations.Daniel Jasper2013-01-111-13/+11
| | | | | | | | | | | | | | Before: void aaaaaaaaaaaa(int aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) GUARDED_BY( aaaaaaaaaaaaa); After: void aaaaaaaaaaaa(int aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) GUARDED_BY(aaaaaaaaaaaaa); Also did some formatting cleanups with clang-format on the way. llvm-svn: 172200
* Improved formatting of constructor initializersDaniel Jasper2013-01-111-32/+49
| | | | | | | | | Added option to put each constructor initializer on its own line if not all initializers fit on a single line. Enabling this for Google style now as the style guide (arguable) suggests it. Not sure whether we also want it for LLVM. llvm-svn: 172196
* Test commit.Enea Zaffanella2013-01-111-1/+1
| | | | llvm-svn: 172195
* Refactor IndentState into two classes.Daniel Jasper2013-01-111-80/+73
| | | | | | | | As we keep adding more stuff to it, this structure is easier to maintain. At one point we might think about making it an actual class with specific accessors, etc. llvm-svn: 172188
* Pass false instead of 0 since isStar parameter of getArray has type bool. No ↵Nikola Smiljanic2013-01-111-1/+1
| | | | | | functionality change. llvm-svn: 172185
* [analyzer] Rename the warning: state the issue before the hint of how itAnna Zaks2013-01-111-6/+5
| | | | | | can be fixed llvm-svn: 172170
* [analyzer]Recognize ivar invalidation protocol even if it was redeclaredAnna Zaks2013-01-111-2/+2
| | | | | | This will get rid of some false positives as well as false negatives. llvm-svn: 172169
* [analyzer] Ivar invalidation: track ivars declared in categories.Anna Zaks2013-01-111-7/+15
| | | | llvm-svn: 172168
* Truth in advertising: LocallyScopedExternalDecls actually only containsRichard Smith2013-01-104-35/+35
| | | | | | external declarations with C language linkage. llvm-svn: 172150
* [analyzer] Allow IvarInvalidation checker to suppress warnings viaAnna Zaks2013-01-101-6/+14
| | | | | | | | | | | | assertions. To ensure that custom assertions/conditional would also be supported, just check if the ivar that needs to be invalidated or set to nil is compared against 0. Unfortunately, this will not work for code containing 'assert(IvarName)' llvm-svn: 172147
* c++ IRGen. In trivial cases that object is going into staticFariborz Jahanian2013-01-101-0/+17
| | | | | | | | | | storage and thus is implicitly zero-initialized, no need to do C++11 memory model. This patch unconditionally detects such condition and zeroinitializer's the variable. Patch has been commented on and OKed by Doug off-line. // rdar://12897704 llvm-svn: 172144
* Formatter: Put spaces in ObjC method decls in the right place for Google style.Nico Weber2013-01-101-7/+20
| | | | | | | | | | | | | | | | | | | | | | | Objective-C method declarations look like this: - (returntype)name:(type)argname anothername:(type)arg2name; In google style, there's no space after the leading '-' but one after "(returntype)" instead (but none after the argument types), see http://google-styleguide.googlecode.com/svn/trunk/objcguide.xml#Method_Declarations_and_Definitions Not inserting the space after '-' is easy, but to insert the space after the return type, the formatter needs to know that a closing parenthesis ends the return type. To do this, I tweaked the code in parse() to check for this, which in turn required moving detection of TT_ObjCMethodSpecifier from annotate() to parse(), because parse() runs before annotate(). (To keep things interesting, the return type is optional, but it's almost always there in practice.) http://llvm-reviews.chandlerc.com/D280 llvm-svn: 172140
* [analyzer] Fix non-determinizm introduced in r172104.Anna Zaks2013-01-101-17/+29
| | | | | | | | In some cases, we just pick any ivar that needs invalidation and attach the warning to it. Picking the first from DenseMap of pointer keys was triggering non-deterministic output. llvm-svn: 172134
* ToolChains: Minor touchup to use correct type, avoid truncation.Will Dietz2013-01-101-1/+1
| | | | | | | | | Truncation happens regularly when find_first_not_of returns npos, strings long enough to trigger bug here are implausible. No functionality change intended (ignoring absurd string lengths). llvm-svn: 172127
* [ms-inline asm] Extend the inline asm Sema lookup interface to determine if theChad Rosier2013-01-101-6/+10
| | | | | | | Decl is a VarDecl. Part of rdar://12991541 llvm-svn: 172120
* Formatter: No spaces around '=' in @property lines.Nico Weber2013-01-101-1/+12
| | | | | | | | | | | | | Before: @property(assign, getter = isEditable) BOOL editable; Now: @property(assign, getter=isEditable) BOOL editable; It'd be nice if some Apple person could let me know if spaces are preferred around '=' in @synthesize lines (see FIXME in the test). llvm-svn: 172110
* [analyzer] Add more checks to the ObjC Ivar Invalidation checker.Anna Zaks2013-01-101-57/+118
| | | | | | | | | | | | | | Restructured the checker so that it could easily find two new classes of issues: - when a class contains an invalidatable ivar, but no declaration of an invalidation method - when a class contains an invalidatable ivar, but no definition of an invalidation method in the @implementation. The second case might trigger some false positives, for example, when the method is defined in a category. llvm-svn: 172104
* Provide a better warning when case value overflows.Fariborz Jahanian2013-01-101-2/+2
| | | | | | // rdar://11577384 llvm-svn: 172102
* Formatting: In @implementation etc lines, put a space before protocol lists.Nico Weber2013-01-101-1/+5
| | | | | | | | | | | | Don't do this in Google style though: http://google-styleguide.googlecode.com/svn/trunk/objcguide.xml#Protocols Most other places (function declarations, variable declarations) still get this wrong, and since this looks very similiar to template instantiations to the lexer (`id <MyProtocol> a = ...`), it's going to be hard to fix in some places. llvm-svn: 172099
* Refactoring the outermost structure of the formatter.Manuel Klimek2013-01-101-37/+45
| | | | | | | This is the last step of pure shuffling stuff around, the next step will be the actual feature. llvm-svn: 172098
* Formatter: Don't put a space in ObjC number literals like @+50Nico Weber2013-01-101-2/+4
| | | | | | | | | | Before: @ -4.5 Now: @-4.5 llvm-svn: 172095
* Formatter: Add space before '(' in @implemenation, @interface, @protocol linesNico Weber2013-01-101-2/+16
| | | | | | | | The first token in @implementation, @interface, and @protocol lines is now marked TT_ObjCDecl, and lines starting with a TT_ObjCDecl token are now marked LT_ObjCMethodDecl. llvm-svn: 172093
* Pull calculation whether a line fits one level up.Manuel Klimek2013-01-101-29/+36
| | | | | | | This is the next step towards being able to configure multiple unwrapped lines into one. llvm-svn: 172092
* objectiveC++: When throwing c++ exception of Fariborz Jahanian2013-01-104-10/+32
| | | | | | | an objectiveC object, use objc_exception_throw to raise the exception. // rdar://12605907 llvm-svn: 172091
* Pulling formatFirstToken one level up.Manuel Klimek2013-01-101-85/+91
| | | | | | | | | | | | This prepares the code for single line optimizations and changes the dependencies between single-line-formats to the indent of the first token. Conceptually, the first token is "between" the lines anyway, as the whitespace for the first token includes the previous end-of-line, which needs to be escaped when inside a preprocessor directive. llvm-svn: 172083
* Fixes layout of right braces.Manuel Klimek2013-01-101-3/+20
| | | | | | | | | | | | | | | | | | | | | | We now decide whether a newline should go before the closing brace depending on whether a newline was inserted after the opening brace. For example, we now insert a newline before '};' in: static SomeClass WithALoooooooooooooooooooongName = { 100000000, \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\" }; ... while not inserting a newline here: static SomeClass = { a, b, c, d, e, f, g, h, i, j, looooooooooooooooooooooooooooooooooongname, looooooooooooooooooooooooooooooong }; Also fixes the formating of (column limit 25): int x = { avariable, b(alongervariable) }; llvm-svn: 172076
* Basic support for diagnostics.Alexander Kornienko2013-01-103-12/+31
| | | | | | | | | | | | | | Summary: Uses DiagnosticsEngine to output diagnostics. Reviewers: djasper, klimek Reviewed By: djasper CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D278 llvm-svn: 172071
* Fixes formatting of function calls etc inside an initializer list.Manuel Klimek2013-01-101-10/+15
| | | | | | | | | | | | | | | | | | | | | We're now formatting (column limit 25): int x = { avariable, b(alongervariable) }; This also fixes: Aaa({ int i; }, aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb, ccccccccccccccccc)); ... where we would previously break after the '},'. Putting the closing curly into an extra line when there's a break directly after the first curly will be done in a subsequent patch. Paired with djasper. llvm-svn: 172070
* Do not add newline in empty blocks.Manuel Klimek2013-01-102-6/+10
| | | | | | | void f() {} now gets formatted in one line. llvm-svn: 172067
* Improvements to function type and ObjC block formatting.Daniel Jasper2013-01-101-5/+18
| | | | | | | | | | | | | | | | | | | | | Before: int (^myBlock) (int) = ^(int num) {} A<void ()>; int (*b)(int); After: int (^myBlock)(int) = ^(int num) {} A<void()>; int(*b)(int); For function types and function pointer types, this patch only makes the behavior consistent (for types that are keywords and other types). For the latter function pointer type declarations, we'll probably want to add a space after "int". Also added LangOpts.Bool = 1, so we handle "A<bool()>" appropriately Moved the LangOpts-settings to a public place for use by tests and clang-format binary. llvm-svn: 172065
* [Mips] Pass a combination of +soft-float and -mips16-hard-float flags toSimon Atanasyan2013-01-101-1/+8
| | | | | | the backend if hard float ABI is selected under -mips16 mode. llvm-svn: 172062
* Fix layout of blocks inside statements.Manuel Klimek2013-01-103-19/+76
| | | | | | | | | | | | | | | Previously, we would not indent: SOME_MACRO({ int i; }); correctly. This is fixed by adding the trailing }); to the unwrapped line starting with SOME_MACRO({, so the formatter can correctly match the braces and indent accordingly. Also fixes incorrect parsing of initializer lists, like: int a[] = { 1 }; llvm-svn: 172058
* Improve clang-format's understanding of casts.Daniel Jasper2013-01-101-12/+20
| | | | | | | | | | | | This fixes llvm.org/PR14684. Before: int *pa = (int *) & a; After: int *pa = (int *)&a; We still don't understand all kinds of casts. I added a FIXME to address that. llvm-svn: 172056
* Enable intel_ocl_bicc for x86_64 target only. Remove fix from 171969 that ↵Guy Benyei2013-01-101-1/+3
| | | | | | enabled this extension for multiple targets. llvm-svn: 172052
* Introduce a define to switch on debug output.Manuel Klimek2013-01-101-0/+17
| | | | | | | After re-writing the same loop multiple times, we deicided it's time to add this as an optional debugging help. llvm-svn: 172050
* Do more error checking for '{}'.Daniel Jasper2013-01-101-0/+24
| | | | | | | | | This fixes llvm.org/PR14883, where clang-format would run into an assertion on: void f() { return } 42 llvm-svn: 172049
* Testing with a full OpenCL compiler (based on clang) reveals r71734 missedDavid Tweed2013-01-101-2/+6
| | | | | | | difference between type widths of a vector and the width of one of its elements in the case of vector shifts. Use correct witdth in the vector case. llvm-svn: 172047
* Be more careful about updating the failed-modules setDouglas Gregor2013-01-101-2/+3
| | | | llvm-svn: 172035
* Don't assert in codegen on static data members which have NoLinkage. FixesNick Lewycky2013-01-101-4/+2
| | | | | | PR14825! llvm-svn: 172031
* Rework the realpath nonsense for framework lookups to deal moreDouglas Gregor2013-01-102-102/+139
| | | | | | uniformly with symlinks between top-level and embedded frameworks. llvm-svn: 172030
* Formatter: Remove unused @-formatting code.Nico Weber2013-01-101-4/+0
| | | | | | | @optional @property is put on two different unwrapped lines now, so this is no longer necessary. llvm-svn: 172024
* Formatter: @optional and @required go on their own line.Nico Weber2013-01-102-0/+7
| | | | | | | | | | | | | | | | | | | | Previously: @protocol myProtocol - (void)mandatoryWithInt:(int)i; @optional - (void) optional; @required - (void) required; @end Now: @protocol myProtocol - (void)mandatoryWithInt:(int)i; @optional - (void)optional; @required - (void)required; @end llvm-svn: 172023
* Formatter: Add support for @implementation.Nico Weber2013-01-092-3/+4
| | | | | | | Just reuse the @interface code for this. It accepts slightly more than necessary (@implementation cannot have protocol lists), but that's ok. llvm-svn: 172019
* [PreprocessingRecord] A macro expansion can be reported out-of-order in ↵Argyrios Kyrtzidis2013-01-091-3/+11
| | | | | | | | | | | | cases when there are macro expansions inside macro arguments where the arguments are not expanded in the same order as listed; don't assert that all macro expansions are in source order. rdar://12397063 llvm-svn: 172018
* Issue warning when case value is too large to fitFariborz Jahanian2013-01-092-2/+12
| | | | | | | | | in case condition type. // rdar://11577384. Test is conditionalized on x86_64-apple triple as I am not sure if the INT_MAX/LONG_MAX values in the test will pass this test for other hosts. llvm-svn: 172016
* Remove the unused Parser::ParseTranslationUnit functionHal Finkel2013-01-091-15/+0
| | | | | | | Parser::ParseTranslationUnit is now dead because the loop over ParseTopLevelDecl is in ParseAST. llvm-svn: 172005
* Formatter: Make parseObjCUntilAtEnd() actually work.Nico Weber2013-01-091-0/+2
| | | | llvm-svn: 172003
* Formatting: Add support for @protocol.Nico Weber2013-01-092-16/+43
| | | | | | Pull pieces of the @interface code into reusable methods. llvm-svn: 172001
* Formatter: Add support for @interface.Nico Weber2013-01-092-0/+43
| | | | | | | | | | | | | | Previously: @interface Foo + (id)init; @end Now: @interface Foo + (id)init; @end Some tweaking remains, but this is a good first step. llvm-svn: 171995
OpenPOWER on IntegriCloud