summaryrefslogtreecommitdiffstats
path: root/clang/lib
Commit message (Collapse)AuthorAgeFilesLines
* Add configuration plumbing to enable static initializer branching in the CFG ↵Ted Kremenek2013-03-293-2/+10
| | | | | | | | | for the analyzer. This setting still isn't enabled yet in the analyzer. This is just prep work. llvm-svn: 178317
* Objective-C: Produce precise diagnostic whenFariborz Jahanian2013-03-282-15/+36
| | | | | | | | 'isa' ivar is accessed provided it is the first ivar. Fixit hint will follow in another patch. This is continuation of // rdar://13503456 llvm-svn: 178313
* [analyzer] Document existence of ConstPointerEscape.Anna Zaks2013-03-281-0/+12
| | | | llvm-svn: 178311
* [analyzer] Add support for escape of const pointers and use it to allow ↵Anna Zaks2013-03-285-28/+103
| | | | | | | | | | | | | “newed” pointers to escape Add a new callback that notifies checkers when a const pointer escapes. Currently, this only works for const pointers passed as a top level parameter into a function. We need to differentiate the const pointers escape from regular escape since the content pointed by const pointer will not change; if it’s a file handle, a file cannot be closed; but delete is allowed on const pointers. This should suppress several false positives reported by the NewDelete checker on llvm codebase. llvm-svn: 178310
* [analyzer] Apply the suppression rules to the nil receiver only if the value ↵Anna Zaks2013-03-283-40/+61
| | | | | | | | | | | | | | participates in the computation of the nil we warn about. We should only suppress a bug report if the IDCed or null returned nil value is directly related to the value we are warning about. This was not the case for nil receivers - we would suppress a bug report that had an IDCed nil receiver on the path regardless of how it’s related to the warning. 1) Thread EnableNullFPSuppression parameter through the visitors to differentiate between tracking the value which is directly responsible for the bug and other values that visitors are tracking (ex: general tracking of nil receivers). 2) in trackNullOrUndef specifically address the case when a value of the message send is nil due to the receiver being nil. llvm-svn: 178309
* [ms-cxxabi] Add more tests for r178297Reid Kleckner2013-03-281-2/+2
| | | | | | | This covers a few cases where the class of a member pointer is not a CXXRecordDecl. llvm-svn: 178307
* [sema] Check the result of getAsCXXRecordDecl() to fix the buildReid Kleckner2013-03-281-2/+2
| | | | | | | I'm not 100% sure what should happen here to find the real CXXRecordDecl. llvm-svn: 178297
* Warn about more than the first unused variable when -Werror is set.Matt Beaumont-Gay2013-03-281-1/+1
| | | | | | | To do this, thread DiagnosticErrorTrap's hasUnrecoverableErrorOccurred through to Scope. llvm-svn: 178294
* [sema] Remove unused variable from r178283Reid Kleckner2013-03-281-1/+0
| | | | | | | Wouldn't it be cool if we had a compiler for Windows that could warn about these things? llvm-svn: 178289
* [ms-cxxabi] Correctly compute the size of member pointersReid Kleckner2013-03-285-30/+110
| | | | | | | | | | | | | | | | | Summary: This also relaxes the requirement on Windows that the member pointer class type be a complete type (http://llvm.org/PR12070). We still ask for a complete type to instantiate any templates (MSVC does this), but if that fails we continue as normal, relying on any inheritance attributes on the declaration. Reviewers: rjmccall CC: triton, timurrrr, cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D568 llvm-svn: 178283
* Objective-C: Provide fixit suggestions when class objectFariborz Jahanian2013-03-285-6/+33
| | | | | | | | is accessed via accessing 'isa' ivar to use object_getClass/object_setClass apis. // rdar://13503456 llvm-svn: 178282
* Provide a fixit to static_cast for reinterpret_casts within a class hierarchy.Jordan Rose2013-03-281-6/+7
| | | | | | | | | The suggestion was already in the text of the note; this just adds the actual fixit and the appropriate test cases. Patch by Alexander Zinenko! llvm-svn: 178274
* Implemented a warning when an input several bitwise operations areSam Panzer2013-03-281-16/+119
| | | | | | | | | | | likely be implicitly truncated: * All forms of Bitwise-and, bitwise-or, and integer multiplication. * The assignment form of integer addition, subtraction, and exclusive-or * The RHS of the comma operator * The LHS of left shifts. llvm-svn: 178273
* Rename clang::driver::tools::linuxtools to clang::driver::tools::gnutools.Thomas Schwinge2013-03-283-17/+16
| | | | | | | This is about the GNU Binutils' assembler and linker, so reflect that in the name. llvm-svn: 178272
* Rename LinuxDistro to Distro.Thomas Schwinge2013-03-281-11/+11
| | | | | | | | The concept of such a software distribution is not tied to the Linux kernel; for example Debian GNU/Linux, Debian GNU/Hurd, and Debian GNU/kFreeBSD all share the same source packages and generally the same user-space configuration. llvm-svn: 178270
* Use early return in printing logic. Minor cleanup.Ted Kremenek2013-03-281-2/+4
| | | | llvm-svn: 178264
* Add CFG logic to create a conditional branch for modeling static initializers.Ted Kremenek2013-03-281-1/+31
| | | | | | | | | | | | | | | | This is an optional variant of the CFG. This allows analyses to model whether or not a static initializer has run, e.g.: static Foo x = bar(); For basic dataflow analysis in Sema we will just assume that the initializer always runs. For the static analyzer we can use this branch to accurately track whether or not initializers are on. This patch just adds the (opt-in) functionality to the CFG. The static analyzer still needs to be modified to adopt this feature. llvm-svn: 178263
* Fixed handling of comments before preprocessor directives.Alexander Kornienko2013-03-281-0/+1
| | | | | | | | | Comments before preprocessor directives used to be stored with InPPDirective flag set, which prevented correct comment splitting in this case. Fixed by flushing comments before switching on InPPDirective. Added a new test and fixed one of the existing tests. llvm-svn: 178261
* Fix order of initialization warning.Eric Christopher2013-03-281-1/+1
| | | | llvm-svn: 178255
* [analyzer] These implements unix.MismatchedDeallocatorChecker checker.Anton Yartsev2013-03-282-75/+301
| | | | | | | | + Improved display names for allocators and deallocators The checker checks if a deallocation function matches allocation one. ('free' for 'malloc', 'delete' for 'new' etc.) llvm-svn: 178250
* [analyzer] For now assume all standard global 'operator new' functions ↵Anton Yartsev2013-03-282-8/+31
| | | | | | | | allocate memory in heap. + Improved test coverage for cplusplus.NewDelete checker. llvm-svn: 178244
* Add support for gcc-compatible -mpopcntd -mno-popcntd PPC optionsHal Finkel2013-03-282-1/+6
| | | | | | | gcc provides -mpopcntd and -mno-popcntd for controlling the popcntd target feature; support these options as well. llvm-svn: 178235
* [Mips] Handle pseudo-target flags '-EL' and '-EB' and properly adjustSimon Atanasyan2013-03-281-0/+15
| | | | | | toolchain flags for MIPS targets. llvm-svn: 178232
* Add support for gcc-compatible -mmfcrf -mno-mfcrf PPC optionsHal Finkel2013-03-282-5/+11
| | | | | | | | gcc provides -mmfcrf and -mno-mfcrf for controlling what we call the mfocrf target feature. Also, PPC is now making use of the static function AddTargetFeature used by the Mips Driver code. llvm-svn: 178227
* Define __SIZE_MAX__ preprocessor macro.Evgeniy Stepanov2013-03-281-0/+1
| | | | llvm-svn: 178226
* For -Wignored-qualifiers, don't warn on qualifiers which we acquire via aRichard Smith2013-03-281-5/+6
| | | | | | | typedef. Also don't warn on the _Atomic type specifier, just on the _Atomic type qualifier. llvm-svn: 178218
* Teach -Wigored-qualifiers about exotic flavors of declarator and the _Atomic ↵Richard Smith2013-03-281-76/+111
| | | | | | type qualifier. llvm-svn: 178217
* Remove outdated FIXME.Richard Smith2013-03-281-1/+0
| | | | llvm-svn: 178211
* Support C11 _Atomic type qualifier. This is more-or-less just syntactic ↵Richard Smith2013-03-286-47/+176
| | | | | | sugar for the _Atomic type specifier. llvm-svn: 178210
* Fold together the two implementations of 6.7.3p2 in SemaType. Fix two bugs, ↵Richard Smith2013-03-281-53/+24
| | | | | | | | | each of which was only present in one version: * Give the right diagnostic for 'restrict' applied to a non-pointer, non-reference type. * Don't reject 'restrict' applied indirectly to an Objective-C object pointer type (eg, through template instantiation). llvm-svn: 178200
* [Parser] Don't code-complete twice.Argyrios Kyrtzidis2013-03-274-5/+5
| | | | | | | | | | | | | | | When we are consuming the current token just to enter a new token stream, we push the current token in the back of the stream so that we get it again. Unfortunately this had the effect where if the current token is a code-completion one, we would code-complete once during consuming it and another time after the stream ended. Fix this by making sure that, in this case, ConsumeAnyToken() will consume a code-completion token without invoking code-completion. rdar://12842503 llvm-svn: 178199
* Don't reject __restrict applied to a dependent type; it might instantiate to ↵Richard Smith2013-03-272-2/+4
| | | | | | a pointer or reference type. llvm-svn: 178198
* UBSan: Don't diagnose inf/nan conversions between floating-point types. It's ↵Richard Smith2013-03-271-34/+49
| | | | | | far from clear whether these have undefined behavior, and these checks are helping no-one. Keep the double->float overflow warnings, though, since those are useful in practice, even though it's unclear whether such operations have defined behavior. llvm-svn: 178194
* Revert "[lib/Headers] Define NULL as __DARWIN_NULL when on __APPLE__."Argyrios Kyrtzidis2013-03-271-3/+1
| | | | | | | | | Per feedback by Doug, we should avoid platform-specific implementations in lib/Headers as much as possible. This reverts commit r178110. llvm-svn: 178181
* Objective-C: Issue more precise warning when userFariborz Jahanian2013-03-272-4/+6
| | | | | | | is accessing 'isa' as an object pointer. // rdar://13503456. FixIt to follow in another patch. llvm-svn: 178179
* [analyzer] Use evalBind for C++ new of scalar types.Jordan Rose2013-03-271-7/+10
| | | | | | | | | | These types will not have a CXXConstructExpr to do the initialization for them. Previously we just used a simple call to ProgramState::bindLoc, but that doesn't trigger proper checker callbacks (like pointer escape). Found by Anton Yartsev. llvm-svn: 178160
* [analyzer] Cleanup: only get the PostStmt when we need the underlying Stmt + ↵Anna Zaks2013-03-271-4/+4
| | | | | | comment llvm-svn: 178153
* [analyzer] Ensure that the node NilReceiverBRVisitor is looking for is not ↵Anna Zaks2013-03-272-4/+5
| | | | | | | | | reclaimed The visitor should look for the PreStmt node as the receiver is nil in the PreStmt and this is the node. Also, tag the nil receiver nodes with a special tag for consistency. llvm-svn: 178152
* [modules] Make sure enabled diagnostic pragmas inside the module don't ↵Argyrios Kyrtzidis2013-03-271-3/+9
| | | | | | | | | | | | affect the translation unit that imports the module. Getting diagnostic sections from modules properly working is a fixme. rdar://13516663 llvm-svn: 178151
* Insert extra new line before access specifiers.Alexander Kornienko2013-03-272-18/+29
| | | | | | | | | | | | | | Summary: Insert extra new line before access specifiers. Reviewers: djasper Reviewed By: djasper CC: cfe-commits, klimek Differential Revision: http://llvm-reviews.chandlerc.com/D581 llvm-svn: 178149
* <rdar://problem/13509689> Introduce -module-file-info option that provides ↵Douglas Gregor2013-03-279-8/+163
| | | | | | | | | | | information about a particular module file. This option can be useful for end users who want to know why they ended up with a ton of different variants of the "std" module in their module cache. This problem should go away over time, as we reduce the need for module variants, but it will never go away entirely. llvm-svn: 178148
* Add const in preparation for a simplify_type change in llvm.Rafael Espindola2013-03-271-1/+1
| | | | llvm-svn: 178146
* <rdar://problem/13317030> Consider using directives when performing ↵Douglas Gregor2013-03-271-1/+15
| | | | | | unqualified name lookup into declarations contexts represented by the qualified-id but not in the actual scope hierarchy. llvm-svn: 178136
* Split line commentsAlexander Kornienko2013-03-271-33/+86
| | | | | | | | | | | | | | | | Summary: Split line comments that exceed column limit + fixed leading whitespace handling when splitting block comments. Reviewers: djasper, klimek Reviewed By: djasper CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D577 llvm-svn: 178133
* Pass the diagnostic in for better error messages.Bill Wendling2013-03-271-8/+6
| | | | llvm-svn: 178120
* [lib/Headers] Break the module import cycle between _Builtin_intrinsics.sse ↵Argyrios Kyrtzidis2013-03-272-1/+2
| | | | | | | | | | | | | | | | | and _Builtin_intrinsics.sse2 Module "sse" implicitly exports module "sse2". This is bad because we also have module "sse2" export module "sse" (as intended) so we end up with a cycle in the module import graph: 1. sse2 -> (also imports) sse 2. sse -> (also imports) sse2 To eliminate the cycle remove 2.; importing module "sse2" will also import module "sse", but just importing module "sse" will not also import module "sse2". rdar://13240552 llvm-svn: 178117
* Implement compiler intrinsics needed for compatibility with MSVC 2012 ↵Joao Matos2013-03-274-31/+86
| | | | | | | | <type_traits>. Patch by me and Ryan Molden. llvm-svn: 178111
* [lib/Headers] Define NULL as __DARWIN_NULL when on __APPLE__.Argyrios Kyrtzidis2013-03-271-1/+3
| | | | | | This makes it identical with the system definition. llvm-svn: 178110
* [modules] Before marking the module imported macros as ambiguous, check if ↵Argyrios Kyrtzidis2013-03-271-11/+57
| | | | | | | | | | | | | this is a case where the system macro uses a not identical definition compared to a macro from the clang headers. For example (these come from different modules): \#define LONG_MAX __LONG_MAX__ (clang's limits.h) \#define LONG_MAX 0x7fffffffffffffffL (system's limits.h) in which case don't mark them ambiguous to avoid the "ambiguous macro expansion" warning. llvm-svn: 178109
* [PCH/modules] Remove HiddenName::MacroUndefArgyrios Kyrtzidis2013-03-271-5/+0
| | | | llvm-svn: 178107
OpenPOWER on IntegriCloud