summaryrefslogtreecommitdiffstats
path: root/clang/lib
Commit message (Collapse)AuthorAgeFilesLines
* Reject incompatible redeclarations of extern C symbols.Rafael Espindola2013-01-111-8/+14
| | | | | | | Before we were only checking if the new declaration itself was marked extern C. Fixes prpr14766. llvm-svn: 172243
* Fix crashes in UnwrappedLineParser on missing parens.Manuel Klimek2013-01-111-2/+4
| | | | llvm-svn: 172239
* Fix single-line optimization for ObjC.Manuel Klimek2013-01-111-4/+6
| | | | | | | Puts blocks always into multiple lines when they start with an ObjC keyword or minus. llvm-svn: 172238
* Fix crash on invalid.Manuel Klimek2013-01-111-1/+2
| | | | | | | if { foo; } would previously crash clang-format. llvm-svn: 172232
* Fix parsing of initializer lists with elaborated type specifier.Manuel Klimek2013-01-112-3/+9
| | | | | | | | Now we correctly parse and format: verifyFormat("struct foo a = { bar }; int n; llvm-svn: 172229
* Implements pulling simple blocks into a single line.Manuel Klimek2013-01-111-16/+83
| | | | | | | | void f() { return 42; } The final change that implements the feature. llvm-svn: 172225
* Allow RefactoringTool to write to memory instead of always to diskEdwin Vane2013-01-111-29/+34
| | | | | | | | | | | | | | | RefactoringTool::run() always writes the result of rewrites to disk. Instead, make this optional and provide a method for getting the refactoring results in a memory buffer instead. Also made ClangTool polymorphic so RefactoringTool could inherit from it to properly express the IS-A relationship. This change also provides access to ClangTool's public interface, e.g. mapVirtualFile() which is important once refactored buffers start living in memory instead of on disk. Reviewers: klimek llvm-svn: 172219
* Correct spacing around new and delete.Daniel Jasper2013-01-111-1/+2
| | | | | | | | This fixes llvm.org/PR14913. Before: A *a = new(placement) A; After: A *a = new (placement) A; llvm-svn: 172212
* clang-format: a bit nicer error message.Alexander Kornienko2013-01-111-1/+1
| | | | llvm-svn: 172211
* Enable the new (more C++-like, less broken) EH model when targeting the GNUstepDavid Chisnall2013-01-112-0/+17
| | | | | | Objective-C runtime 1.7 or greater. llvm-svn: 172207
* 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
OpenPOWER on IntegriCloud