summaryrefslogtreecommitdiffstats
path: root/clang
Commit message (Collapse)AuthorAgeFilesLines
...
* Use a non-recursive implementation to reconstruct line breaks.Manuel Klimek2013-05-291-16/+17
| | | | | | | | | Now that the TokenAnnotator does not require stack space anymore, reconstructing the lines has become the limiting factor. This patch fixes that problem, allowing large files with multiple megabytes of single unwrapped lines to be formatted. llvm-svn: 182861
* The second step in the token refactoring.Manuel Klimek2013-05-296-582/+513
| | | | | | | | | | Gets rid of AnnotatedToken, putting everything into FormatToken. FormatTokens are created once, and only referenced by pointer. This enables multiple future features, like having tokens shared between multiple UnwrappedLines (while there's still work to do to fully enable that). llvm-svn: 182859
* Add return missing in r182855.Daniel Jasper2013-05-292-0/+9
| | | | llvm-svn: 182856
* Leave some macros on their own lineDaniel Jasper2013-05-292-1/+35
| | | | | | | | | | | | | | | | | | | If an identifier is on its own line and it is all upper case, it is highly likely that this is a macro that is meant to stand on a line by itself. Before: class A : public QObject { Q_OBJECT A() {} }; Ater: class A : public QObject { Q_OBJECT A() {} }; llvm-svn: 182855
* Add option to always break template declarations.Daniel Jasper2013-05-294-2/+25
| | | | | | | | | | | | | | With option enabled (e.g. in Google-style): template <typename T> void f() {} With option disabled: template <typename T> void f() {} Enabling this for Google-style and Chromium-style, not sure which other styles would prefer that. llvm-svn: 182849
* Don't compute the visibility unless we really have to.Rafael Espindola2013-05-291-24/+39
| | | | | | | This brings the number of linkage computations in "clang -cc1" in SemaExpr.ii from 58426 to 43134. With -emit-llvm the number goes from 161045 to 145461. llvm-svn: 182823
* Fix bad indentation.Jakob Stoklund Olesen2013-05-291-4/+4
| | | | llvm-svn: 182821
* Add a testcase from pr16059.Rafael Espindola2013-05-291-0/+14
| | | | | | It was fixed back in r182750, but this is a nice testcase to have. llvm-svn: 182818
* Disallow extern decls of type void in C++ modeDavid Majnemer2013-05-293-6/+12
| | | | | | | C++ and C differ with respect to the handling of extern void declarations. Enforce the C++ behavior in C++ mode. llvm-svn: 182814
* Objective-C [qoi]: Improve on diagnostic when a method usedFariborz Jahanian2013-05-283-8/+8
| | | | | | | in an @selector expression has no implementation. // rdar://14002507 llvm-svn: 182812
* Remove links to old checker builds.Ted Kremenek2013-05-281-20/+11
| | | | llvm-svn: 182811
* [analyzer] Use the expression’s type instead of region’s type in ↵Anna Zaks2013-05-285-21/+17
| | | | | | | | | ArrayToPointer decay evaluation This gives slightly better precision, specifically, in cases where a non-typed region represents the array or when the type is a non-array type, which can happen when an array is a result of a reinterpret_cast. llvm-svn: 182810
* [analyzer] Re-enable reasoning about CK_LValueBitCastAnna Zaks2013-05-283-4/+24
| | | | | | | | | It’s important for us to reason about the cast as it is used in std::addressof. The reason we did not handle the cast previously was a crash on a test case (see commit r157478). The crash was in processing array to pointer decay when the region type was not an array. Address the issue, by just returning an unknown in that case. llvm-svn: 182808
* Check the linkage cache at every recursive step.Rafael Espindola2013-05-283-50/+65
| | | | | | | | | | | | | | | | | | | | | | | Before this patch the linkage cache was only used by the entry level function (getLinkage). The function that does the actual computation (getLVForDecl), never looked at it. This means that we would not reuse an entry in the cache when getLVForDecl did a recursive call. This patch fixes that by adding another computation enum value for when we don't care about the linkage at all and having getLVForDecl check the cache in that case. When running "clang -cc1" over SemaExpr.ii this brings the number of linkage computations from 93749 to 58426. When running "clang -cc1 -emit-llvm -O3" it goes from 198708 to 161444. For SemaExpr.ii at least linkage computation is a small enough percentage of the work that the time difference was in the noise. When asserts are enabled this patch also causes clang to check the linkage cache even on recursive calls. llvm-svn: 182799
* Add an overridable MatchCallback::onEndOfTranslationUnit() function.Peter Collingbourne2013-05-283-0/+36
| | | | | | Differential Revision: http://llvm-reviews.chandlerc.com/D745 llvm-svn: 182798
* Remove obsolete variable as discovered in post-commit review.Daniel Jasper2013-05-281-4/+0
| | | | llvm-svn: 182796
* Support uniform inits in braced lists.Daniel Jasper2013-05-282-18/+6
| | | | | | | | | | | | | This made it necessary to remove an error detection which would let us bail out of braced lists in certain situations of missing "}". However, as we always entirely escape from the braced list on finding ";", this should not be a big problem. With this, we can no format braced lists with uniformat inits: return { arg1, SomeType { parameter } }; llvm-svn: 182788
* Patch to issue error when target of MacOS and iOS Fariborz Jahanian2013-05-286-9/+63
| | | | | | | does not support large load/store of atomic objects. // rdar://13973577 llvm-svn: 182781
* [analyzer] Use a more generic MemRegion.getAsOffset to evaluate bin ↵Anna Zaks2013-05-283-69/+109
| | | | | | | | | operators on MemRegions In addition to enabling more code reuse, this suppresses some false positives by allowing us to compare an element region to its base. See the ptr-arith.cpp test cases for an example. llvm-svn: 182780
* Fix formatting regression regarding pointers to arrays.Daniel Jasper2013-05-282-1/+2
| | | | | | | | | Before: f( (*PointerToArray)[10]); After: f((*PointerToArray)[10]); This fixes llvm.org/PR16163 llvm-svn: 182777
* Fix a crash when we were trying to compute the linkage too early.Rafael Espindola2013-05-282-2/+23
| | | | llvm-svn: 182773
* Make UnwrappedLines and AnnotatedToken contain pointers to FormatToken.Manuel Klimek2013-05-286-109/+123
| | | | | | The FormatToken is now not copyable any more. llvm-svn: 182772
* clang/test/Driver/dyld-prefix.c: Exclude MSYS bash.NAKAMURA Takumi2013-05-281-0/+2
| | | | llvm-svn: 182769
* A first step towards giving format tokens pointer identity.Manuel Klimek2013-05-283-190/+199
| | | | | | | | | | | With this patch, we create all tokens in one go before parsing and pass an ArrayRef<FormatToken*> to the UnwrappedLineParser. The UnwrappedLineParser is switched to use pointer-to-token internally. The UnwrappedLineParser still copies the tokens into the UnwrappedLines. This will be fixed in an upcoming patch. llvm-svn: 182768
* Initial support for designated initializers.Daniel Jasper2013-05-284-11/+40
| | | | llvm-svn: 182767
* Disable tab expansion when counting the columns in block comments.Manuel Klimek2013-05-282-34/+45
| | | | | | | | | | | | | | | | | To fully support this, we also need to expand tabs in the text before the block comment. This patch breaks indentation when there was a non-standard mixture of spaces and tabs used for indentation, but fixes a regression in the simple case: { /* * Comment. */ int i; } Is now formatted correctly, if there were tabs used for indentation before. llvm-svn: 182760
* Fixes indentation of empty lines in block comments.Manuel Klimek2013-05-282-2/+18
| | | | | | | | | | | Block comment indentation of empty lines regressed, as we did not have a test for it. /* Comment with... * * empty line. */ is now formatted correctly again. llvm-svn: 182757
* Clean up formatting of function types.Daniel Jasper2013-05-283-18/+16
| | | | | | | | | | | | Before: int (*func)(void*); void f() { int(*func)(void*); } After (consistent space after "int"): int (*func)(void*); void f() { int (*func)(void*); } llvm-svn: 182756
* Fix formatting of expressions containing ">>".Daniel Jasper2013-05-282-0/+4
| | | | | | | | | | | | | This gets turned into two ">" operators at the beginning in order to simplify template parameter handling. Thus, we need a special case to handle those two binary operators correctly. With this patch, clang-format can now correctly handle cases like: aaaaaa = aaaaaaa(aaaaaaa, // break aaaaaa) >> bbbbbb; llvm-svn: 182754
* Build correct coercion types in SparcV9ABIInfo.Jakob Stoklund Olesen2013-05-282-3/+161
| | | | | | | | | | | | | | | | The coercion type serves two purposes: 1. Pad structs to a multiple of 64 bits, so they are passed 'left-aligned' in registers. 2. Expose aligned floating point elements as first-level elements, so the code generator knows to pass them in floating point registers. We also compute the InReg flag which indicates that the struct contains aligned 32-bit floats. This flag is used by the code generator to pick the right registers. llvm-svn: 182753
* Propagate VisibleNoLinkage down to class members.Rafael Espindola2013-05-282-3/+15
| | | | | | Fixes PR16114. llvm-svn: 182750
* use getLVForDecl for consistency.Rafael Espindola2013-05-281-1/+1
| | | | | | No intended functionality change. llvm-svn: 182749
* Add a SparcV9ABIInfo class for handling the standard SPARC v9 ABI.Jakob Stoklund Olesen2013-05-272-0/+151
| | | | | | | | | | | | | | | | - All integer arguments smaller than 64 bits are extended. - Large structs are passed indirectly, not using 'byval'. - Structs up to 32 bytes in size are returned in registers. Some things are not implemented yet: - EmitVAArg can be implemented in terms of the va_arg instruction. - When structs are passed in registers, float members require special handling because they are passed in the floating point registers. - Structs are left-aligned when passed in registers. This may require padding. llvm-svn: 182745
* Driver: implement --dyld-prefix option.Peter Collingbourne2013-05-275-30/+48
| | | | | | | | | This option is used to select a dynamic loader prefix to be used at runtime. Currently this is implemented for the Linux toolchain. Differential Revision: http://llvm-reviews.chandlerc.com/D851 llvm-svn: 182744
* Remove unreachable returnDavid Blaikie2013-05-271-1/+0
| | | | llvm-svn: 182742
* Improve formatting of templates.Daniel Jasper2013-05-272-14/+6
| | | | | | | | | Before: A < int&& > a; After: A<int &&> a; Also remove obsolete FIXMEs. llvm-svn: 182741
* Major refactoring of BreakableToken.Manuel Klimek2013-05-277-347/+537
| | | | | | | | | | | | | | | | | | | Unify handling of whitespace when breaking protruding tokens with other whitespace replacements. As a side effect, the BreakableToken structure changed significantly: - have a common base class for single-line breakable tokens, as they are much more similar - revamp handling of multi-line comments; we now calculate the information about lines in multi-line comments similar to normal tokens, and always issue replacements As a result, we were able to get rid of special casing of trailing whitespace deletion for comments in the whitespace manager and the BreakableToken and fixed bugs related to tab handling and escaped newlines. llvm-svn: 182738
* Fix the linkage of local types in inline VisibleNoLinkage functions.Rafael Espindola2013-05-272-1/+17
| | | | | | We were handling only local types in inline External functions before. llvm-svn: 182737
* Move 3 helper function to Linkage.hRafael Espindola2013-05-273-15/+22
| | | | | | | This removes a duplicate from Decl.cpp and a followup patch will use isExternallyVisible. llvm-svn: 182735
* Improve indentation of assignments.Daniel Jasper2013-05-272-1/+8
| | | | | | | | | | | | | | | Before: unsigned OriginalStartColumn = SourceMgr.getSpellingColumnNumber( Current.FormatTok.getStartOfNonWhitespace()) - 1; After: unsigned OriginalStartColumn = SourceMgr.getSpellingColumnNumber( Current.FormatTok.getStartOfNonWhitespace()) - 1; llvm-svn: 182733
* Address post-review comment from dblakie.Manuel Klimek2013-05-271-1/+1
| | | | llvm-svn: 182732
* Fix hacky way of preventing a certain type of line break.Daniel Jasper2013-05-272-10/+20
| | | | | | | | | | | | | | | | | | | | | | | | In general, we like to avoid line breaks like: ... SomeParameter, OtherParameter).DoSomething( ... as they tend to make code really hard to read (how would you even indent the next line?). Previously we have implemented this in a hacky way, which has now shown to lead to problems. This fixes a few weird looking formattings, such as: Before: aaaaa( aaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) .aaaaa(aaaaa), aaaaaaaaaaaaaaaaaaaaa); After: aaaaa(aaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa).aaaaa(aaaaa), aaaaaaaaaaaaaaaaaaaaa); llvm-svn: 182731
* Add -fsanitize=leak to driver options.Sergey Matveev2013-05-275-7/+80
| | | | | | | | If -fsanitize=leak is specified, link the program with the LeakSanitizer runtime. Ignore this option when -fsanitize=address is specified, because AddressSanitizer has this functionality built in. llvm-svn: 182729
* Tests and status for DR51-99.Richard Smith2013-05-263-60/+566
| | | | llvm-svn: 182720
* Formatter/ObjC: In dictionary literals, break after ':', not before it.Nico Weber2013-05-263-5/+25
| | | | | | | | | | | | | | | | Before: @{ NSFontAttributeNameeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee : regularFont, }; Now: @{ NSFontAttributeNameeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee : regularFont, }; ':'s in dictionary literals (and the corresponding {}s) are now marked as TT_ObjCDictLiteral too, which makes further improvements to dict literal layout possible. llvm-svn: 182716
* Fix linkage computation for derived types in inline functions.Rafael Espindola2013-05-2513-66/+142
| | | | | | | | | | | | | | | | | John noticed that the fix for pr15930 (r181981) didn't handle indirect uses of local types. For example, a pointer to local struct, or a function that returns it. One way to implement this would be to recursively look for local types. This would look a lot like the linkage computation itself for types. To avoid code duplication and utilize the existing linkage cache, this patch just makes the computation of "type with no linkage but externally visible because it is from an inline function" part of the linkage computation itself. llvm-svn: 182711
* Fix comment type pointed out by Kim Gräsman.Duncan Sands2013-05-251-1/+1
| | | | llvm-svn: 182702
* [Preprocessor] Prevent expansion of y in x ## y when x is emptyArgyrios Kyrtzidis2013-05-252-10/+20
| | | | | | | | | | | | When x is empty, x ## is suppressed, and when y gets expanded, the fact that it follows ## is not available in the macro expansion result. The macro definition can be checked instead, the ## will be available there regardless of what x expands to. Fixes http://llvm.org/PR12767 Patch by Harald van Dijk! llvm-svn: 182699
* Make isBeforeInTranslationUnit consistent in the face of failures to get a ↵Argyrios Kyrtzidis2013-05-251-1/+1
| | | | | | valid FileID (V2). llvm-svn: 182698
* Increase the portability of this script a bit: use /usr/bin/env to find bash,Richard Smith2013-05-241-1/+1
| | | | | | rather than assuming it lives in the path. Patch by Eitan Adler! llvm-svn: 182696
OpenPOWER on IntegriCloud