summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
Commit message (Collapse)AuthorAgeFilesLines
* [ms-inline asm] Remove a bunch of parsing code from the front-end, which will beChad Rosier2012-10-111-71/+2
| | | | | | reimplemented in the AsmParser where it belongs. llvm-svn: 165752
* [ms-inline asm] Lookup the IdentifierInfo using the Idents table and remove theChad Rosier2012-10-111-17/+1
| | | | | | | | | now unused static helper function. The test case needs to be remove temporarily until I can better filter memory operands that aren't actual variable reference. llvm-svn: 165751
* Add null check for malformed code.Ted Kremenek2012-10-111-2/+5
| | | | llvm-svn: 165733
* -Warc-repeated-use-of-weak: fix a use-of-uninitialized and add a test case.Jordan Rose2012-10-111-1/+1
| | | | | | Fix-up for r165718, should get the buildbots back online. llvm-svn: 165723
* -Warc-repeated-use-of-weak: Don't warn on a single read followed by writes.Jordan Rose2012-10-111-4/+36
| | | | | | | | | | This is a "safe" pattern, or at least one that cannot be helped by using a strong local variable. However, if the single read is within a loop, it should /always/ be treated as potentially dangerous. <rdar://problem/12437490> llvm-svn: 165719
* -Warc-repeated-use-of-weak: Check messages to property accessors as well.Jordan Rose2012-10-112-3/+47
| | | | | | | | | | | | | | | | | | | Previously, [foo weakProp] was not being treated the same as foo.weakProp. Now, for every explicit message send, we check if it's a property access, and if so, if the property is weak. Then for every assignment of a message, we have to do the same thing again. This is a potentially expensive increase because determining whether a method is a property accessor requires searching through the methods it overrides. However, without it -Warc-repeated-use-of-weak will miss cases from people who prefer not to use dot syntax. If this turns out to be too expensive, we can try caching the result somewhere, or even lose precision by not checking superclass methods. The warning is off-by-default, though. <rdar://problem/12407765> llvm-svn: 165718
* Add codegen support for __uuidof().Nico Weber2012-10-111-22/+2
| | | | llvm-svn: 165710
* Minor cleanup for r165678; no functional change.Eli Friedman2012-10-111-1/+1
| | | | llvm-svn: 165679
* Make sure we perform the variadic method check correctly for calls to a ↵Eli Friedman2012-10-111-2/+14
| | | | | | member operator(). PR14057. llvm-svn: 165678
* -Warc-repeated-use-of-weak: look through explicit casts on assigned values.Jordan Rose2012-10-101-1/+1
| | | | | | | Reading from a weak property, casting the result, and assigning to a strong pointer should still be considered safe. llvm-svn: 165629
* Move Sema::PropertyIfSetterOrGetter to ObjCMethodDecl::findPropertyDecl.Jordan Rose2012-10-103-106/+13
| | | | | | | | Then, switch users of PropertyIfSetterOrGetter and LookupPropertyDecl (the latter by name) over to findPropertyDecl. This actually makes -Wreceiver-is-weak a bit stronger than it was before. llvm-svn: 165628
* Change Sema::PropertyIfSetterOrGetter to make use of isPropertyAccessor.Jordan Rose2012-10-101-35/+34
| | | | | | | | | | | | | | | | | | | | | | | | Old algorithm: 1. See if the name looks like a getter or setter. 2. Use the name to look up a property in the current ObjCContainer and all its protocols. 3. If the current container is an interface, also look in all categories and superclasses (and superclass categories, and so on). New algorithm: 1. See if the method is marked as a property accessor. If so, look through all properties in the current container and find one that has a matching selector. 2. Find all overrides of the method using ObjCMethodDecl's getOverriddenMethods. This collects methods in superclasses and protocols (as well as superclass categories, which isn't really necessary), and checks if THEY are accessors. This part is not done recursively, since getOverriddenMethods is already recursive. This lets us handle getters and setters that do not match the property names. llvm-svn: 165627
* Rename ObjCMethodDecl::isSynthesized to isPropertyAccessor.Jordan Rose2012-10-104-21/+21
| | | | | | | | | | | | | This more accurately reflects its use: this flag is set when a method matches the getter or setter name for a property in the same class, and does not actually specify whether or not the definition of the method will be synthesized (either implicitly or explicitly with @synthesize). This renames the setter and backing field as well, and changes the (soon-to-be-obsolete?) XML dump format to use 'property_accessor' instead of 'synthesized'. llvm-svn: 165626
* Fix stack overflow when trying to create an implicit movingArgyrios Kyrtzidis2012-10-101-1/+1
| | | | | | | | constructor with invalid code. rdar://12240916 llvm-svn: 165623
* If a macro has been #undef'd in a precompiled header, we still need toDouglas Gregor2012-10-091-14/+12
| | | | | | | | | | | | write out the macro history for that macro. Similarly, we need to cope with reading a macro definition that has been #undef'd. Take advantage of this new ability so that global code-completion results can refer to #undef'd macros, rather than losing them entirely. For multiply defined/#undef'd macros, we will still get the wrong result, but it's better than getting no result. llvm-svn: 165502
* Clearing a SmallPtrSet is still expensive, split it out from ↵Benjamin Kramer2012-10-091-1/+5
| | | | | | OverloadCandidateSet::clear and don't do it on destruction. llvm-svn: 165501
* When storing the C++ overridden methods, store them once for theArgyrios Kyrtzidis2012-10-091-1/+2
| | | | | | canonical method; avoid storing them again for an out-of-line definition. llvm-svn: 165472
* Use a single note diagnostic for all the precedent/parentheses warnings.David Blaikie2012-10-081-8/+10
| | | | llvm-svn: 165384
* StringRef-ify Binary/UnaryOperator::getOpcodeStrDavid Blaikie2012-10-083-5/+5
| | | | llvm-svn: 165383
* Workaround for libstdc++4.6 <atomic> bug: make comment more explicit about ↵Richard Smith2012-10-051-2/+7
| | | | | | what's going on, per Sean Silva's suggestion. llvm-svn: 165286
* Implement -Wshift-op-parentheses for: a << b + cDavid Blaikie2012-10-051-0/+21
| | | | | | | | | | | | This appears to be consistent with GCC's implementation of the same warning under -Wparentheses. Suppressing a << b + c for cases where 'a' is a user defined type for compatibility with C++ stream IO. Otherwise suggest parentheses around the addition or subtraction subexpression. (this came up when MSVC was complaining (incorrectly, so far as I can tell) about a perceived violation of this within the LLVM codebase, PR14001) llvm-svn: 165283
* [libclang] Introduce CXCursor_ModuleImportDecl cursor kind, used for a moduleArgyrios Kyrtzidis2012-10-051-0/+3
| | | | | | import declaration. llvm-svn: 165277
* Egriegious hack to support libstdc++4.6's broken <atomic> header, which definesRichard Smith2012-10-041-24/+41
| | | | | | | | a non-inline namespace, then reopens it as inline to try to add its symbols to the surrounding namespace. In this one special case, permit the namespace to be reopened as inline, and patch up the name lookup tables to match. llvm-svn: 165263
* Fixed FunctionTypeLoc source range.Abramo Bagnara2012-10-044-21/+55
| | | | llvm-svn: 165259
* Fixed instantiated operators source range.Abramo Bagnara2012-10-041-1/+1
| | | | llvm-svn: 165258
* Fixed ParamDecl source range for implicit typed k&r parameters.Abramo Bagnara2012-10-041-0/+3
| | | | llvm-svn: 165256
* Fix scope location when parsing GNU attributes.Michael Han2012-10-041-2/+1
| | | | | | | | For GNU attributes, instead of reusing attribute source location for the scope location, use SourceLocation() since GNU attributes don not have scope tokens. llvm-svn: 165234
* Permanently end the whole "pragma got handled by the parser too early"Eli Friedman2012-10-041-15/+8
| | | | | | | mess by handling all pragmas which the parser touches uniformly. <rdar://problem/12248901>, etc. llvm-svn: 165195
* objective-C arc: Warn under arc about a use of an ivar inside a blockFariborz Jahanian2012-10-031-0/+3
| | | | | | | that doesn't have a 'self' as this implicitly captures 'self' and could create retain cycles. Provide fixit. // rdar://11194874 llvm-svn: 165133
* Improve C++11 attribute parsing.Michael Han2012-10-031-2/+7
| | | | | | | | - General C++11 attributes were previously parsed and ignored. Now they are parsed and stored in AST. - Add support to parse arguments of attributes that in 'gnu' namespace. - Differentiate unknown attributes and known attributes that can't be applied to statements when emitting diagnostic. llvm-svn: 165082
* Change how the SelfReferenceChecker handles MemberExpr. Instead of treatingRichard Trieu2012-10-031-11/+39
| | | | | | | each one separately, process a stack of MemberExpr's as a single unit so that static calls and member access will not be warned on. llvm-svn: 165074
* Revert 165058, per Jim request. This requires further discussion.Chad Rosier2012-10-021-38/+2
| | | | llvm-svn: 165070
* [ms-inline asm] Rewrite the symbol references as wildcard MCParsedAsmOperands.Chad Rosier2012-10-021-2/+38
| | | | | | | A Sema lookup is used to determine the size of the variable, which is in turn used during wildcard matching. llvm-svn: 165058
* [ms-inline asm] Enhance the isSimpleMSAsm() function to handle operands with ↵Chad Rosier2012-10-021-24/+26
| | | | | | | | pointer size directives (e.g., dword ptr [eax]). llvm-svn: 165031
* No need to call the InitializeAll* functions.Chad Rosier2012-10-021-5/+0
| | | | llvm-svn: 165025
* Allowing individual targets to determine whether a given calling convention ↵Aaron Ballman2012-10-022-3/+10
| | | | | | | | is allowed or ignored with warning. This allows for correct name mangling for x64 targets on Windows, which in turn allows for linking against the Win32 APIs. Fixes PR13782 llvm-svn: 165015
* Tweak diagnostic text to indicate that __weak on a local variable is only ↵Ted Kremenek2012-10-021-1/+3
| | | | | | | | allowed for ARC. Fixes <rdar://problem/12407705> llvm-svn: 164990
* Add FP_CONTRACT support for clang.Lang Hames2012-10-026-23/+34
| | | | | | | | Clang will now honor the FP_CONTRACT pragma and emit LLVM fmuladd intrinsics for expressions of the form A * B + C (when they occur in a single statement). llvm-svn: 164989
* Check if an IdentifierInfo* is null when the FunctionDecl isn't a simple C ↵Ted Kremenek2012-10-021-2/+6
| | | | | | | | function. Fixes <rdar://problem/12355298> llvm-svn: 164988
* -Wformat: Don't check format strings in uninstantiated templates.Jordan Rose2012-10-021-3/+2
| | | | | | | | | | | | | Also applies to -Wnonnull, -Wtype-safety, and -Wnon-pod-varargs. All of these can be better checked at instantiation time. This change does not actually affect regular CallExpr function calls, since the checks there only happen after overload resolution. However, it will affect Objective-C method calls. <rdar://problem/12373934> llvm-svn: 164984
* [ms-inline asm] Use the convertToMapAndConstraints() function in the front-end.Chad Rosier2012-10-011-62/+72
| | | | | | Rework the logic to account for the fact that we no longer create a MCInst. llvm-svn: 164980
* PR13978: A 'decltype' DeclSpec has an expression representation, not a typeRichard Smith2012-10-011-1/+1
| | | | | | | representation. Fix crash if it appears in the return type of a member function definition. llvm-svn: 164967
* Move isObjCSelf into Expr.Anna Zaks2012-10-011-20/+2
| | | | llvm-svn: 164966
* Cleaning up the self initialization checker.Richard Trieu2012-10-012-39/+38
| | | | | | | | | | | -Allow Sema to do more processing on the initial Expr before checking it. -Remove the special conditions in HandleExpr() -Move the code so that only one call site is needed. -Removed the function from Sema and only call it locally. -Warn on potentially evaluated reference variables, not just casts to r-values. -Update tests. llvm-svn: 164951
* Move the 'find macro by spelling' infrastructure to the Preprocessor class andDmitri Gribenko2012-09-292-59/+9
| | | | | | | use it to suggest appropriate macro for __attribute__((deprecated)) in -Wdocumentation-deprecated-sync. llvm-svn: 164892
* Fix buildbots by not using a template from another namespace.Jordan Rose2012-09-281-8/+7
| | | | | | | No need to specialize BeforeThanCompare for a comparator that's only going to be used once. llvm-svn: 164859
* Compatibility macro detection for the -Wimplicit-fallthrough diagnostic.Alexander Kornienko2012-09-281-1/+66
| | | | | | | | | | | | | | | | | | | Summary: When issuing a diagnostic message for the -Wimplicit-fallthrough diagnostics, always try to find the latest macro, defined at the point of fallthrough, which is immediately expanded to "[[clang::fallthrough]]", and use it's name instead of the actual sequence. Known issues: * uses PP.getSpelling() to compare macro definition with a string (anyone can suggest a convenient way to fill a token array, or maybe lex it in runtime?); * this can be generalized and used in other similar cases, any ideas where it should reside then? Reviewers: doug.gregor, rsmith Reviewed By: rsmith CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D50 llvm-svn: 164858
* -Wreceiver-is-weak: rephrase warning text and add a suggestion Note.Jordan Rose2012-09-281-13/+14
| | | | | | | | | | | | New output: warning: weak property may be unpredictably set to nil note: property declared here note: assign the value to a strong variable to keep the object alive during use <rdar://problem/12277204> llvm-svn: 164857
* Pull ScopeInfo implementation into its own file.Jordan Rose2012-09-283-159/+182
| | | | | | | | | The infrastructure for -Warc-repeated-use-of-weak got a little too heavy to leave sitting at the top of Sema.cpp. No functionality change. llvm-svn: 164856
* -Warc-repeated-use-of-weak: check ivars and variables as well.Jordan Rose2012-09-286-73/+161
| | | | | | | | | | Like properties, loading from a weak ivar twice in the same function can give you inconsistent results if the object is deallocated between the two loads. It is safer to assign to a strong local variable and use that. Second half of <rdar://problem/12280249>. llvm-svn: 164855
OpenPOWER on IntegriCloud