summaryrefslogtreecommitdiffstats
path: root/clang/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* [analyzer] Improve Nullability checker diagnosticsAnna Zaks2016-01-293-34/+69
| | | | | | | | | - Include the position of the argument on which the nullability is violated - Differentiate between a 'method' and a 'function' in the message wording - Test for the error message text in the tests - Fix a bug with setting 'IsDirectDereference' which resulted in regular dereferences assumed to have call context. llvm-svn: 259221
* Revert r259210 "Extend hasType narrowing matcher for TypedefDecls, add ↵Hans Wennborg2016-01-291-1/+0
| | | | | | | | functionProtoType matcher for FunctionProtoType nodes, extend parameterCountIs to FunctionProtoType nodes." It didn't pass check-clang. llvm-svn: 259218
* Extend hasType narrowing matcher for TypedefDecls, add functionProtoType ↵Aaron Ballman2016-01-291-0/+1
| | | | | | | | matcher for FunctionProtoType nodes, extend parameterCountIs to FunctionProtoType nodes. Patch by Richard Thomson llvm-svn: 259210
* Removing unnecessary casts; NFC.Aaron Ballman2016-01-291-2/+2
| | | | llvm-svn: 259194
* Implement TemplateArgument::dump() method for debugging, patterned after ↵Yaron Keren2016-01-291-0/+9
| | | | | | TemplateName::dump(). llvm-svn: 259192
* Add an optional ToolName argument to ↵Benjamin Kramer2016-01-291-8/+10
| | | | | | | | | | runToolOnCodeWithArgs/buildASTFromCodeWithArgs. This can be used as a way to modify argv[0] for a clang tool. Differential Revision: http://reviews.llvm.org/D16718 llvm-svn: 259187
* [Concepts] Implement a portion of Concepts TS[dcl.spec.concept]p5 and p6:Nathan Wilson2016-01-291-0/+17
| | | | | | | | | | | Diagnose if the return type of a function concept or declaration type of a variable concept is not bool. Reviewers: hubert.reinterpretcast Differential Revision: http://reviews.llvm.org/D16163 llvm-svn: 259159
* Use a consistent spelling for vtables.Eric Christopher2016-01-296-19/+19
| | | | llvm-svn: 259137
* [CUDA] Generate CUDA's printf alloca in its function's entry block.Justin Lebar2016-01-281-39/+18
| | | | | | | | | | | | | | | Summary: This is necessary to prevent llvm from generating stacksave intrinsics around this alloca. NVVM doesn't have a stack, and we don't handle said intrinsics. Reviewers: rnk, echristo Subscribers: cfe-commits, jhen, tra Differential Revision: http://reviews.llvm.org/D16664 llvm-svn: 259122
* Class Property: change PropertyMap to include isClassProperty.Manman Ren2016-01-283-23/+38
| | | | | | | | | | | | | | PropertyMap used to map IdentifierInfo (name of the property) to ObjcPropertyDecl *. Now that a class property can have the same name as an instance property, we change PropertyMap to map a pair <IdentifierInfo *, unsigned> to ObjcPropertyDecl *. Also update a few places from iterating over instance_properties to iterating over all properties. rdar://23891898 llvm-svn: 259119
* [analyzer] NullabilityChecker: Remove unused isReturnSelf() function.Devin Coughlin2016-01-281-16/+0
| | | | | | | Remove the now-unused isReturnSelf() function so we don't get a compiler warning. Apologies for not doing this in r259099. llvm-svn: 259118
* Check for frontend errors after releasing the Builder.Manman Ren2016-01-281-3/+6
| | | | | | | | | | | | | Frontend can emit errors when releaseing the Builder. If there are errors before or when releasing the Builder, we reset the module to stop here before invoking the backend. Before this commit, clang will continue to invoke the backend and backend can crash. Differential Revision: http://reviews.llvm.org/D16564 llvm-svn: 259116
* [analyzer] Suppress nullability warnings in copy, mutableCopy, and init ↵Devin Coughlin2016-01-281-11/+10
| | | | | | | | | | | | | | families. There are multiple, common idioms of defensive nil-checks in copy, mutableCopy, and init methods in ObjC. The analyzer doesn't currently have the capability to distinguish these idioms from true positives, so suppress all warnings about returns in those families. This is a pretty blunt suppression that we should improve later. rdar://problem/24395811 llvm-svn: 259099
* Include RecordDecls from anonymous unions in the AST.Nico Weber2016-01-286-29/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For void f() { union { int i; }; } clang used to omit the RecordDecl from the anonymous union from the AST. That's because the code creating it only called PushOnScopeChains(), which adds it to the current DeclContext, which here is the function's DeclContext. But RecursiveASTVisitor doesn't descent into all decls in a FunctionDecl. Instead, for DeclContexts that contain statements, return the RecordDecl so that it can be included in the DeclStmt containing the VarDecl for the union. Interesting bits from the AST before this change: |-FunctionDecl | `-CompoundStmt | |-DeclStmt | | `-VarDecl 0x589cd60 <col:3> col:3 implicit used 'union (anonymous at test.cc:3:3)' callinit After this change: -FunctionDecl | `-CompoundStmt | |-DeclStmt | | |-CXXRecordDecl 0x4612e48 <col:3, col:18> col:3 union definition | | | |-FieldDecl 0x4612f70 <col:11, col:15> col:15 referenced i 'int' | | `-VarDecl 0x4613010 <col:3> col:3 implicit used 'union (anonymous at test.cc:3:3)' callinit This is now closer to how anonymous struct and unions are represented as members of structs. It also enabled deleting some one-off code in the template instantiation code. Finally, it fixes a crash with ASTMatchers, see the included test case (this fixes http://crbug.com/580749). llvm-svn: 259079
* Remove unused parameter.Nico Weber2016-01-281-9/+6
| | | | llvm-svn: 259077
* Class Property: class property and instance property can have the same name.Manman Ren2016-01-2812-55/+127
| | | | | | | | | | | | | | | | | | | Add "enum ObjCPropertyQueryKind" to a few APIs that used to only take the name of the property: ObjCPropertyDecl::findPropertyDecl, ObjCContainerDecl::FindPropertyDeclaration, ObjCInterfaceDecl::FindPropertyVisibleInPrimaryClass, ObjCImplDecl::FindPropertyImplDecl, and Sema::ActOnPropertyImplDecl. ObjCPropertyQueryKind currently has 3 values: OBJC_PR_query_unknown, OBJC_PR_query_instance, OBJC_PR_query_class This extra parameter specifies that we are looking for an instance property with the given name, or a class property with the given name, or any property with the given name (if both exist, the instance property will be returned). rdar://23891898 llvm-svn: 259070
* Fix strange indent.Nico Weber2016-01-281-2/+2
| | | | llvm-svn: 259063
* [Coverage] Use a set to track visited FileIDs (NFC)Vedant Kumar2016-01-281-3/+3
| | | | llvm-svn: 259061
* Revert r259036, it introduces a cyclic library dependencyOliver Stannard2016-01-281-65/+11
| | | | llvm-svn: 259043
* Add backend dignostic printer for unsupported featuresOliver Stannard2016-01-281-11/+65
| | | | | | | | | | | | | | | | | | Re-commit of r258950 after fixing layering violation. Add backend dignostic printer for unsupported features The related LLVM patch adds a backend diagnostic type for reporting unsupported features, this adds a printer for them to clang. In the case where debug location information is not available, I've changed the printer to report the location as the first line of the function, rather than the closing brace, as the latter does not give the user any information. This also affects optimisation remarks. Differential Revision: http://reviews.llvm.org/D16591 llvm-svn: 259036
* Fix isBeforeInTranslationUnit to not abort on macros defined in cmdline.Yury Gribov2016-01-281-0/+8
| | | | | | Differential Revision: http://reviews.llvm.org/D15804 llvm-svn: 259031
* Small refactor in isBeforeInTranslationUnit.Yury Gribov2016-01-281-6/+6
| | | | | | Differential Revision: http://reviews.llvm.org/D15804 llvm-svn: 259030
* [Lex] Share some common code between decimal and octal parsing in ↵Craig Topper2016-01-281-61/+47
| | | | | | | | NumericLiteralParser. There were a couple slight variations between the two copies that I don't believe were intentional. For example, only one of the paths checked for digit separations proceeding a '.', but I think the lexer itself splits the token if a digit separator proceeds a period. llvm-svn: 259022
* Revert r258951 (and r258950), "Refactor backend diagnostics for unsupported ↵NAKAMURA Takumi2016-01-281-64/+11
| | | | | | | | | | | features" It broke layering violation in LLVMIR. clang r258950 "Add backend dignostic printer for unsupported features" llvm r258951 "Refactor backend diagnostics for unsupported features" llvm-svn: 259016
* [Sema] Make extended vectors of `bool` an error.George Burgess IV2016-01-281-4/+10
| | | | | | | | | | | | | | In OpenCL, `bool` vectors are a reserved type, and are therefore illegal. Outside of OpenCL, if we try to make an extended vector of N `bool`s, Clang will lower it to an `[N x i1]`. LLVM has no ABI for bitvectors, so lots of operations on such vectors are thoroughly broken. As a result, this patch makes them illegal in everything else, as well. :) Differential Revision: http://reviews.llvm.org/D15721 llvm-svn: 259011
* ARMv7k: simplify logic for deciding sjlj-exceptions.Tim Northover2016-01-271-2/+1
| | | | | | | Slight change of behaviour in the odd armv7+watchos case, which should match the other runtime components. llvm-svn: 258994
* clang-format: [Java] Remove unnecessary line break after complex annotationsDaniel Jasper2016-01-271-0/+1
| | | | | | | | | | | | | | | Before: @Annotation("Some" + " text") List<Integer> list; After: @Annotation("Some" + " text") List<Integer> list; llvm-svn: 258981
* Class Property: create accessors (class methods) for class property.Manman Ren2016-01-272-24/+50
| | | | | | | | | Change a few places where we assume property accessors can only be instance methods. rdar://23891898 llvm-svn: 258980
* Class Property: handle class properties.Manman Ren2016-01-274-7/+7
| | | | | | | | At places where we handle instance properties, if necessary. rdar://23891898 llvm-svn: 258979
* ARMv7k: select ABI based on v7k Arch rather than watchos OS.Tim Northover2016-01-274-8/+11
| | | | | | | | Various bits we'd like to use the new ABI actually compile with "-arch armv7k -miphoneos-version-min=9.0". Not ideal, but also not ridiculous given how slices work. llvm-svn: 258976
* Emit calls to objc_unsafeClaimAutoreleasedReturnValue whenJohn McCall2016-01-275-171/+454
| | | | | | | | | | | | | | | | | reclaiming a call result in order to ignore it or assign it to an __unsafe_unretained variable. This avoids adding an unwanted retain/release pair when the return value is not actually returned autoreleased (e.g. when it is returned from a nonatomic getter or a typical collection accessor). This runtime function is only available on the latest Apple OS releases; the backwards-compatibility story is that you don't get the optimization unless your deployment target is recent enough. Sorry. rdar://20530049 llvm-svn: 258962
* Add backend dignostic printer for unsupported featuresOliver Stannard2016-01-271-11/+64
| | | | | | | | | | | | | | The related LLVM patch adds a backend diagnostic type for reporting unsupported features, this adds a printer for them to clang. In the case where debug location information is not available, I've changed the printer to report the location as the first line of the function, rather than the closing brace, as the latter does not give the user any information. This also affects optimisation remarks. Differential Revision: http://reviews.llvm.org/D16591 llvm-svn: 258950
* Update for LLVM change.Benjamin Kramer2016-01-271-1/+1
| | | | llvm-svn: 258918
* Fix array index out of boundsDaniel Marjamaki2016-01-271-2/+2
| | | | | | Differential Revision: http://reviews.llvm.org/D16582 llvm-svn: 258911
* [analyzer] ObjCDeallocChecker: Only operate on classes with retained properties.Devin Coughlin2016-01-271-50/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously the ObjC Dealloc Checker only checked classes with ivars, not retained properties, which caused three bugs: - False positive warnings about a missing -dealloc method in classes with only ivars. - Missing warnings about a missing -dealloc method on classes with only properties. - Missing warnings about an over-released or under-released ivar associated with a retained property in classes with only properties. The fix is to check only classes with at least one retained synthesized property. This also exposed a bug when reporting an over-released or under-released property that did not contain a synthesize statement. The checker tried to associate the warning with an @synthesize statement that did not exist, which caused an assertion failure in debug builds. The fix is to fall back to the @property statement in this case. A patch by David Kilzer! Part of rdar://problem/6927496 Differential Revision: http://reviews.llvm.org/D5023 llvm-svn: 258896
* Revert "Change of UserLabelPrefix default value from "_" to """James Y Knight2016-01-272-23/+32
| | | | | | | | | | | | | This reverts commit r258504. This commit breaks (at least) sparc-rtems -- the OS (RTEMS) used to override UserLabelPrefix to "", despite the arch (SPARC) having set it to "_". Now, the OS doesn't override anymore, but the arch sets it to "_", resulting in the wrong value. I expect this probably breaks other OSes that overrode to "" before, as well. (Clearly we have some missing test cases, here...) llvm-svn: 258894
* [analyzer] Body farm: Look for property ivar in shadowing readwrite property.Devin Coughlin2016-01-261-1/+40
| | | | | | | | | | | | After r251874, readonly properties that are shadowed by a readwrite property in a class extension no longer have an instance variable, which caused the body farm to not synthesize getters. Now, if a readonly property does not have an instance variable look for a shadowing property and try to get the instance variable from there. rdar://problem/24060091 llvm-svn: 258886
* [CUDA] Implemented device-side support functions in <cmath>.Artem Belevich2016-01-263-1/+228
| | | | | | | | | | | | | | | | CUDA expects math functions in std:: namespace to work on device side. In order to make it work with clang without allowing device-side code generation for functions w/o appropriate target attributes, this patch provides device-side implementations for <cmath> functions. Most of them call global-scope math functions provided by CUDA headers. In few cases we use clang builtins. Tested out-of tree by compiling and running thrust's unit_tests. https://github.com/thrust/thrust/tree/master/testing Differential Revision: http://reviews.llvm.org/D16593 llvm-svn: 258880
* [WinEH] Annotate calls to __RTtypeid with a funclet bundleDavid Majnemer2016-01-261-2/+5
| | | | | | | | | | Clang's CodeGen has several paths which end up invoking or calling a function. The one that we used for calls to __RTtypeid did not appropriately annotate the call with a funclet bundle. This fixes PR26329. llvm-svn: 258877
* Remove autoconf supportChris Bieneman2016-01-2627-548/+0
| | | | | | | | | | | | | | | | | Summary: This patch is provided in preparation for removing autoconf on 1/26. The proposal to remove autoconf on 1/26 was discussed on the llvm-dev thread here: http://lists.llvm.org/pipermail/llvm-dev/2016-January/093875.html "This is the way [autoconf] ends Not with a bang but a whimper." -T.S. Eliot Reviewers: chandlerc, grosbach, bob.wilson, echristo Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D16472 llvm-svn: 258862
* Do not define GXX_RTTI macro for C.Yunzhong Gao2016-01-261-1/+1
| | | | | | | | This is same as GCC behavior (tested with GCC 4.8.2). Differential Revision: http://reviews.llvm.org/D16365 llvm-svn: 258850
* [MS ABI] Allow a member pointers' converted type to changeDavid Majnemer2016-01-2610-5/+54
| | | | | | | | | | | | | | | | | | | | | | | | Member pointers in the MS ABI are tricky for a variety of reasons. The size of a member pointer is indeterminate until the program reaches a point where the representation is required to be known. However, *pointers* to member pointers may exist without knowing the pointee type's representation. In these cases, we synthesize an opaque LLVM type for the pointee type. However, we can be in a situation where the underlying member pointer's representation became known mid-way through the program. To account for this, we attempted to manicure CodeGen's type-cache so that we can replace the opaque member pointer type with the real deal while leaving the pointer types unperturbed. This, unfortunately, is a problematic approach to take as we will violate CodeGen's invariants. These violations are mostly harmless but let's do the right thing instead: invalidate the type-cache if a member pointer's LLVM representation changes. This fixes PR26313. llvm-svn: 258839
* Fix Clang-tidy modernize-use-nullptr warnings; other minor fixes.Eugene Zelenko2016-01-265-30/+24
| | | | | | Differential revision: http://reviews.llvm.org/D16567 llvm-svn: 258836
* Class Property: parse property attribute (class).Manman Ren2016-01-264-0/+15
| | | | | | | | | This is the third patch in a series of patches to support class properties in addition to instance properties in objective-c. rdar://23891898 llvm-svn: 258834
* [OpenMP] Parsing + sema for target parallel directive.Arpith Chacko Jacob2016-01-2613-5/+180
| | | | | | | | | | | | | Summary: This patch adds parsing + sema for the target parallel directive and its clauses along with testcases. Reviewers: ABataev Differential Revision: http://reviews.llvm.org/D16553 Rebased to current trunk and updated test cases. llvm-svn: 258832
* Use instance_properties instead of properties. NFC.Manman Ren2016-01-2612-37/+40
| | | | | | | | | | | All current properties are instance properties. This is the second patch in a series of patches to support class properties in addition to instance properties in objective-c. rdar://23891898 llvm-svn: 258824
* [CUDA] Add -fcuda-allow-variadic-functions.Justin Lebar2016-01-262-3/+8
| | | | | | | | | | | | | | | | | Summary: Turns out the variadic function checking added in r258643 was too strict for some existing users; give them an escape valve. When -fcuda-allow-variadic-functions is passed, the front-end makes no attempt to disallow C-style variadic functions. Calls to va_arg are still not allowed. Reviewers: tra Subscribers: cfe-commits, jhen, echristo, bkramer Differential Revision: http://reviews.llvm.org/D16559 llvm-svn: 258822
* [OpenMP] Parsing + sema for defaultmap clause.Arpith Chacko Jacob2016-01-269-0/+129
| | | | | | | | | | | Summary: This patch adds parsing + sema for the defaultmap clause associated with the target directive (among others). Reviewers: ABataev Differential Revision: http://reviews.llvm.org/D16527 llvm-svn: 258817
* Revert "[Driver] Make sure -fno-math-builtin option is being passed by the ↵Chad Rosier2016-01-261-3/+2
| | | | | | | | driver." This reverts commit r258814. llvm-svn: 258815
* [Driver] Make sure -fno-math-builtin option is being passed by the driver.Chad Rosier2016-01-261-2/+3
| | | | | | | | | | Support for the -fno-math-builtin option was added in r186899. The codegen side is being tested in test/CodeGen/nomathbuiltin.c. The missing part was just passing the option through the driver. PR26317 llvm-svn: 258814
OpenPOWER on IntegriCloud