summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/Sema.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Generalize -Wempty-body: warn when statement body is empty (closes: PR11329)Dmitri Gribenko2012-02-141-0/+11
| | | | | | | | | | | | | | * if, switch, range-based for: warn if semicolon is on the same line. * for, while: warn if semicolon is on the same line and either next statement is compound statement or next statement has more indentation. Replacing the semicolon with {} or moving the semicolon to the next line will always silence the warning. Tests from SemaCXX/if-empty-body.cpp merged into SemaCXX/warn-empty-body.cpp. llvm-svn: 150515
* Lambdas have a deleted default constructor and a deleted copyDouglas Gregor2012-02-121-0/+1
| | | | | | assignment operator, per C++ [expr.prim.lambda]p19. Make it so. llvm-svn: 150345
* When completing a lambda expression, make sure to check and attach theDouglas Gregor2012-02-081-2/+4
| | | | | | body of the lambda to the function call operator. llvm-svn: 150087
* Make parsing of objc @implementations more robust.Argyrios Kyrtzidis2012-02-071-0/+2
| | | | | | | | | | | | | | | | | | | Parsing of @implementations was based on modifying global state from the parser; the logic for late parsing of methods was spread in multiple places making it difficult to have a robust error recovery. -it was difficult to ensure that we don't neglect parsing the lexed methods. -it was difficult to setup the original objc container context for parsing the lexed methods after completing ParseObjCAtImplementationDeclaration and returning to top level context. Enhance parsing of @implementations by centralizing it in Parser::ParseObjCAtImplementationDeclaration(). ParseObjCAtImplementationDeclaration now returns only after an @implementation is fully parsed; all the data and logic for late parsing of methods is now in one place. This allows us to provide code-completion for late parsed methods with mis-matched braces. rdar://10775381 llvm-svn: 149987
* Rework the external Sema source's ReadMethodPool() so that it doesn'tDouglas Gregor2012-01-251-4/+1
| | | | | | | return pre-built lists. Instead, it feeds the methods it deserializes to Sema so that Sema can unique them, which keeps the chains shorter. llvm-svn: 148889
* Add Sema::isStdInitializerList, which will be necessary for the upcoming ↵Sebastian Redl2012-01-171-1/+1
| | | | | | operations. llvm-svn: 148348
* Delay the creation of the built-in Objective-C class 'Protocol' byDouglas Gregor2012-01-171-13/+5
| | | | | | | moving it from a "special type" to a predefined declaration, as we do for id, Class, and SEL. llvm-svn: 148313
* Introduce a CodeCompletionResult::CreateCodeCompletionString() thatArgyrios Kyrtzidis2012-01-171-2/+3
| | | | | | | | does not depend on Sema, it accepts an ASTContext and a Preprocessor. Step towards making clang_getCursorCompletionString not depend on Sema. llvm-svn: 148278
* De-virtualize getPreviousDecl() and getMostRecentDecl() when we knowDouglas Gregor2012-01-141-2/+2
| | | | | | | | | | | | we have a redeclarable type, and only use the new virtual versions (getPreviousDeclImpl() and getMostRecentDeclImpl()) when we don't have that type information. This keeps us from penalizing users with strict type information (and is the moral equivalent of a "final" method). Plus, settle on the names getPreviousDecl() and getMostRecentDecl() throughout. llvm-svn: 148187
* Per John's comment, it makes sense to ask isLambda on any CXXRecordDecl; ↵Eli Friedman2012-01-101-1/+0
| | | | | | make sure that's safe. Get rid of a check which is now unnecessary in Sema::getFunctionLevelDeclContext(). llvm-svn: 147837
* More lambda work: semantic analysis of capturing 'this'. It's a bit ↵Eli Friedman2012-01-071-2/+10
| | | | | | complicated, but we have to be careful about when exactly captures are marked given PotentiallyPotentiallyEvaluated contexts. (Actually, it's not 100% correct yet, but it's close enough for the moment.) llvm-svn: 147723
* More lambda work. Fixes a minor bug Richard pointed out, makes lookup for ↵Eli Friedman2012-01-061-0/+7
| | | | | | lambda parameters work correctly, recording more information into the AST. llvm-svn: 147650
* More lambda work. Tweak the Sema interface slightly. Start adding the ↵Eli Friedman2012-01-051-2/+7
| | | | | | pieces to build the lambda class and its call operator. Create an actual scope for the lambda body. llvm-svn: 147595
* Store the submodules of a module in source order, as they are storedDouglas Gregor2012-01-041-3/+3
| | | | | | | | in the module map. This provides a bit more predictability for the user, as well as eliminating the need to sort the submodules when serializing them. llvm-svn: 147564
* Fix chaining of ObjCInterfaceDecl redeclarationsDouglas Gregor2011-12-161-0/+1
| | | | llvm-svn: 146722
* Implementing parsing and resolution of module export declarationsDouglas Gregor2011-12-021-1/+27
| | | | | | | | within module maps, which will (eventually) be used to re-export a module from another module. There are still some pieces missing, however. llvm-svn: 145665
* Revert r145244. It causes us to create broken ASTs with missing type informationRichard Smith2011-11-291-43/+15
| | | | | | | | | | for some cast expressions. Original commit message: Removed useless ImplicitCast nodes in explicit cstyle and static casts llvm-svn: 145447
* Removed useless ImplicitCast nodes in explicit cstyle and static castsNicola Gigante2011-11-281-15/+43
| | | | llvm-svn: 145244
* Test commitNicola Gigante2011-11-261-0/+1
| | | | llvm-svn: 145147
* Fixed plausible overloads location.Abramo Bagnara2011-11-151-1/+1
| | | | llvm-svn: 144700
* Implicit casts from rvalue to lvalue are not meaningful. Don't accidentally addRichard Smith2011-11-101-0/+1
| | | | | | | | | | them when performing a const conversion on the implicit object argument for a member operator call on an rvalue. No change to the testsuite: the test for this change is that the added assertion does not fire any more. llvm-svn: 144333
* There's no good reason to track temporaries in ExprWithCleanups,John McCall2011-11-101-1/+1
| | | | | | | but it is sometimes useful to track blocks. Do so. Also optimize the storage of these expressions. llvm-svn: 144263
* Add (hopefully) the last missing lvalue-to-rvalue conversion. Add an assertionRichard Smith2011-10-281-0/+14
| | | | | | to catch some future implicit lvalue-to-rvalue casts of inappropriate kinds. llvm-svn: 143182
* Make the loading of information attached to an IdentifierInfo from anDouglas Gregor2011-10-271-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | AST file more lazy, so that we don't eagerly load that information for all known identifiers each time a new AST file is loaded. The eager reloading made some sense in the context of precompiled headers, since very few identifiers were defined before PCH load time. With modules, however, a huge amount of code can get parsed before we see an @import, so laziness becomes important here. The approach taken to make this information lazy is fairly simple: when we load a new AST file, we mark all of the existing identifiers as being out-of-date. Whenever we want to access information that may come from an AST (e.g., whether the identifier has a macro definition, or what top-level declarations have that name), we check the out-of-date bit and, if it's set, ask the AST reader to update the IdentifierInfo from the AST files. The update is a merge, and we now take care to merge declarations before/after imports with declarations from multiple imports. The results of this optimization are fairly dramatic. On a small application that brings in 14 non-trivial modules, this takes modules from being > 3x slower than a "perfect" PCH file down to 30% slower for a full rebuild. A partial rebuild (where the PCH file or modules can be re-used) is down to 7% slower. Making the PCH file just a little imperfect (e.g., adding two smallish modules used by a bunch of .m files that aren't in the PCH file) tips the scales in favor of the modules approach, with 24% faster partial rebuilds. This is just a first step; the lazy scheme could possibly be improved by adding versioning, so we don't search into modules we already searched. Moreover, we'll need similar lazy schemes for all of the other lookup data structures, such as DeclContexts. llvm-svn: 143100
* -Wc++98-compat: warn if a SFINAE substitution in C++11 suppresses an accessRichard Smith2011-10-191-7/+25
| | | | | | control diagnostic. llvm-svn: 142463
* For modules, all macros that aren't include guards are implicitlyDouglas Gregor2011-10-171-28/+0
| | | | | | | public. Add a __private_macro__ directive to hide a macro, similar to the __module_private__ declaration specifier. llvm-svn: 142188
* HasFormOfMemberPointer implies IsAddressOfOperand for an overload set. SimplifyDouglas Gregor2011-10-131-2/+2
| | | | llvm-svn: 141878
* Allow calling an overloaded function set by taking the address of theDouglas Gregor2011-10-131-4/+2
| | | | | | functions, e.g., (&f)(0). Fixes <rdar://problem/9803316>. llvm-svn: 141877
* Catch placeholder types in DefaultLvalueConversionJohn McCall2011-10-111-16/+100
| | | | | | | | | | | and DefaultFunctionArrayLvalueConversion. To prevent significant regression for should-this-be-a-call fixits, and to repair some such regression from the introduction of bound member placeholders, make those placeholder checks try to build calls appropriately. Harden the build-a-call logic while we're at it. llvm-svn: 141738
* When using an unavailable/deprecated interface Foo inside Foo's ↵Argyrios Kyrtzidis2011-10-061-1/+2
| | | | | | | | interface/implementation don't emit unavailable errors. llvm-svn: 141334
* Only print _Bool as 'bool' when 'bool' is defined as an object-likeDouglas Gregor2011-09-271-0/+17
| | | | | | macro whose only replacement token is '_Bool'. llvm-svn: 140656
* Get rid of useless helper Sema::CastCategory.Eli Friedman2011-09-271-6/+0
| | | | llvm-svn: 140642
* Rename DiagnosticInfo to Diagnostic as per issue 5397David Blaikie2011-09-261-1/+1
| | | | llvm-svn: 140493
* Rename Diagnostic to DiagnosticsEngine as per issue 5397David Blaikie2011-09-251-2/+2
| | | | llvm-svn: 140478
* Introduce an egregious hack for modules to cope with headers that comeDouglas Gregor2011-09-201-0/+29
| | | | | | | | from unfriendly (== not at all modularized) directories. This is temporary, and it only affects module construction until I'll figured out how to deal with system headers. llvm-svn: 140159
* Give conversions of block pointers to ObjC pointers a different cast kindJohn McCall2011-09-091-1/+3
| | | | | | | | than conversions of C pointers to ObjC pointers. In order to ensure that we've caught every case, add asserts to CastExpr that strictly determine which cast kind is used for which kind of bit cast. llvm-svn: 139352
* Warn on missing [super finalize] calls.Nico Weber2011-08-281-0/+1
| | | | | | This matches gcc's logic. Second half of PR10661. llvm-svn: 138730
* Introduce a -cc1 option "-emit-module", that creates a binary moduleDouglas Gregor2011-08-251-6/+13
| | | | | | | | | from the given source. -emit-module behaves similarly to -emit-pch, except that Sema is somewhat more strict about the contents of -emit-module. In the future, there are likely to be more interesting differences. llvm-svn: 138595
* Warn on missing [super dealloc] calls.Nico Weber2011-08-221-0/+1
| | | | | | This matches gcc's logic. Half of PR10661. llvm-svn: 138240
* Switch the __int128_t and __uint128_t types over to predefined typesDouglas Gregor2011-08-121-32/+24
| | | | | | | in the AST format, which are built lazily by the ASTContext when requested. llvm-svn: 137437
* Switch the Objective-C 'SEL' type over to a predefined type in theDouglas Gregor2011-08-121-13/+6
| | | | | | | AST file format, lazily generating the actual declaration in ASTContext as needed. llvm-svn: 137434
* Switch the Objective-C 'Class' type over to a predefined type in theDouglas Gregor2011-08-121-13/+5
| | | | | | | AST file format, lazily generating the actual declaration in ASTContext as needed. llvm-svn: 137431
* Move the creation of the predefined typedef for Objective-C's 'id'Douglas Gregor2011-08-121-12/+10
| | | | | | | | | type over into the AST context, then make that declaration a predefined declaration in the AST format. This ensures that different AST files will at least agree on the (global) declaration ID for 'id', and eliminates one of the "special" types in the AST file format. llvm-svn: 137429
* Encapsulate the Objective-C id/Class/SEL "redefinition" types inDouglas Gregor2011-08-111-3/+0
| | | | | | | | | ASTContext with accessors/mutators. The only functional change is that the AST writer won't bother writing the id/Class/SEL redefinition type if it hasn't been explicitly set; previously, it ended up being written as a synonym for the built-in id/Class/SEL. llvm-svn: 137349
* Make Sema::WeakUndeclaredIdentifiers lazily deserialized.Douglas Gregor2011-07-281-0/+17
| | | | llvm-svn: 136368
* Switch Sema::DynamicClasses over to LazyVectorDouglas Gregor2011-07-281-5/+6
| | | | llvm-svn: 136317
* Switch Sema::UnusedFileScopedDecls over to a LazyVector. Douglas Gregor2011-07-271-3/+7
| | | | | | | | | - Added LazyVector::erase() to support this use case. - Factored out the LazyDecl-of-Decls to RecordData translation in the ASTWriter. There is still a pile of code duplication here to eliminate. llvm-svn: 136270
* Introduce a new data structure, LazyVector, which is a vector whoseDouglas Gregor2011-07-271-2/+6
| | | | | | | | | | | | | contents are lazily loaded on demand from an external source (e.g., an ExternalASTSource or ExternalSemaSource). The "loaded" entities are kept separate from the "local" entities, so that the two can grow independently. Switch Sema::TentativeDefinitions from a normal vector that is eagerly populated by the ASTReader into one of these LazyVectors, making the ASTReader a bit more like me (i.e., lazy). llvm-svn: 136262
* Cleanup the stray comments and variables I could dig out of Sema toChandler Carruth2011-07-261-4/+4
| | | | | | refer to 'expansion' instead of 'instantiation'. llvm-svn: 136060
* Mechanically rename SourceManager::getInstantiationLoc andChandler Carruth2011-07-251-1/+1
| | | | | | | | FullSourceLoc::getInstantiationLoc to ...::getExpansionLoc. This is part of the API and documentation update from 'instantiation' as the term for macros to 'expansion'. llvm-svn: 135914
OpenPOWER on IntegriCloud