summaryrefslogtreecommitdiffstats
path: root/clang/lib
Commit message (Collapse)AuthorAgeFilesLines
* [analyzer] Don't crash if a block's signature just has the return type.Jordan Rose2013-05-301-4/+9
| | | | | | | | | | | It is okay to declare a block without an argument list: ^ {} or ^void {}. In these cases, the BlockDecl's signature-as-written will just contain the return type, rather than the entire function type. It is unclear if this is intentional, but the analyzer shouldn't crash because of it. <rdar://problem/14018351> llvm-svn: 182948
* Do not reuse the debug location of the return value's store if there is ↵Adrian Prantl2013-05-301-2/+4
| | | | | | | | autorelease code to be emitted between store and return instructions. This is analoguous to what we do for lexical scope cleanups. rdar://problem/13977888 llvm-svn: 182947
* fix formatting.Adrian Prantl2013-05-301-1/+1
| | | | llvm-svn: 182946
* More fixes for clang-format's multiline comment breaking.Daniel Jasper2013-05-301-3/+1
| | | | llvm-svn: 182940
* Microsoft has a language extension which allows union members to beAaron Ballman2013-05-301-3/+7
| | | | | | | references. What's more, they use this language extension in their ATL header files (which come as part of MFC and the Win32 SDK). This patch implements support for the Microsoft extension, and addresses PR13737. llvm-svn: 182936
* Fix another clang-format crasher related to multi-line comments.Daniel Jasper2013-05-301-0/+3
| | | | | | | | | | This fixes: /* * * something long going over the column limit. */ llvm-svn: 182932
* Add asserts to guard against regressions.Manuel Klimek2013-05-301-0/+2
| | | | llvm-svn: 182916
* Fix crasher when formatting certain block comments.Daniel Jasper2013-05-301-0/+5
| | | | | | | | | Smallest reproduction: /* ** */ llvm-svn: 182913
* Add support to fallback on operator new when a placement operator new[] is ↵Aaron Ballman2013-05-301-0/+15
| | | | | | called for which there is no valid declaration. This fallback only happens in Microsoft compatibility mode. This patch addresses PR13164, and improves support for the WDK. llvm-svn: 182905
* [analyzer; new edges] In for(;;), use the ForStmt itself for loop notes.Jordan Rose2013-05-301-3/+6
| | | | | | | | | | | Most loop notes (like "entering loop body") are attached to the condition expression guarding a loop or its equivalent. For loops may not have a condition expression, though. Rather than crashing, just use the entire ForStmt as the location. This is probably the best we can do. <rdar://problem/14016063> llvm-svn: 182904
* Fixes error when splitting block comments.Manuel Klimek2013-05-291-2/+10
| | | | | | | | When trying to fall back to search from the end onwards, we would still find leading whitespace if the leading whitespace went on after the end of the line. llvm-svn: 182886
* Split off casts to void* for -Wint-to-pointer-cast to subgroup ↵Ted Kremenek2013-05-291-2/+12
| | | | | | | | | | | | | -Wint-to-void-pointer-cast. This change is motivated from user feedback that some APIs use void* as an opaque "context" object that may not really be a pointer. Such users want an ability to turn off the warning for casts to void* while preserving the warning for other cases. Implements <rdar://problem/14016721>. llvm-svn: 182884
* Turn CLANG_ENABLE_{ARCMT,REWRITER,STATIC_ANALYZER} into proper options so thatRoman Divacky2013-05-291-2/+6
| | | | | | users can disable those. Just like in autoconf generated makefiles. llvm-svn: 182881
* [analyzer] Accept references to variables declared "extern void" (C only).Jordan Rose2013-05-292-2/+4
| | | | | | | | | | | | | | | In C, 'void' is treated like any other incomplete type, and though it is never completed, you can cast the address of a void-typed variable to do something useful. (In C++ it's illegal to declare a variable with void type.) Previously we asserted on this code; now we just treat it like any other incomplete type. And speaking of incomplete types, we don't know their extent. Actually check that in TypedValueRegion::getExtent, though that's not being used by any checkers that are on by default. llvm-svn: 182880
* Remove unused field.Rafael Espindola2013-05-291-2/+1
| | | | llvm-svn: 182874
* [libclang] For "@import .." code-completion results, associate a ↵Argyrios Kyrtzidis2013-05-291-2/+2
| | | | | | CXCursor_ModuleImportDecl cursor instead of CXCursor_NotImplemented. llvm-svn: 182871
* [ms-cxxabi] Implement MSVC virtual base adjustmentReid Kleckner2013-05-295-43/+149
| | | | | | | | | | | | While we can't yet emit vbtables, this allows us to find virtual bases of objects constructed in other TUs. This make iostream hello world work, since basic_ostream virtually inherits from basic_ios. Differential Revision: http://llvm-reviews.chandlerc.com/D795 llvm-svn: 182870
* [ms-cxxabi] There are no key functions in the Microsoft C++ ABIReid Kleckner2013-05-291-0/+3
| | | | | | | | | | | MSVC's class data is always comdat, so clang's should always be linkonce_odr in LLVM IR. Reviewers: pcc Differential Revision: http://llvm-reviews.chandlerc.com/D838 llvm-svn: 182865
* 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-291-0/+1
| | | | llvm-svn: 182856
* Leave some macros on their own lineDaniel Jasper2013-05-291-1/+7
| | | | | | | | | | | | | | | | | | | 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-292-0/+7
| | | | | | | | | | | | | | 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
* Disallow extern decls of type void in C++ modeDavid Majnemer2013-05-291-5/+9
| | | | | | | C++ and C differ with respect to the handling of extern void declarations. Enforce the C++ behavior in C++ mode. llvm-svn: 182814
* [analyzer] Use the expression’s type instead of region’s type in ↵Anna Zaks2013-05-282-18/+7
| | | | | | | | | 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-282-4/+7
| | | | | | | | | 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-281-49/+63
| | | | | | | | | | | | | | | | | | | | | | | 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-281-0/+10
| | | | | | 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-281-5/+0
| | | | | | | | | | | | | 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-282-3/+25
| | | | | | | 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-281-69/+71
| | | | | | | | | 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-281-1/+1
| | | | | | | | | 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-281-2/+1
| | | | 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
* 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-283-11/+22
| | | | llvm-svn: 182767
* Disable tab expansion when counting the columns in block comments.Manuel Klimek2013-05-281-10/+8
| | | | | | | | | | | | | | | | | 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-281-2/+11
| | | | | | | | | | | 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-282-12/+11
| | | | | | | | | | | | 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-281-0/+1
| | | | | | | | | | | | | 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-281-3/+127
| | | | | | | | | | | | | | | | 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-281-3/+4
| | | | | | 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-271-0/+93
| | | | | | | | | | | | | | | | - 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-272-30/+36
| | | | | | | | | 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-271-1/+2
| | | | | | | | | Before: A < int&& > a; After: A<int &&> a; Also remove obsolete FIXMEs. llvm-svn: 182741
OpenPOWER on IntegriCloud