summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
Commit message (Collapse)AuthorAgeFilesLines
...
* Eliminate ASTMutationListener::UpdatedAttributeList, which is noDouglas Gregor2012-01-011-6/+1
| | | | | | longer needed now that we aren't back-patching ObjCProtocolDecls. llvm-svn: 147413
* Wire up redeclaration chains for Objective-C protocols, so that bothDouglas Gregor2012-01-013-55/+65
| | | | | | | forward declarations and definitions of an Objective-C protocol are represented within a single chain of ObjCProtocolDecls. llvm-svn: 147412
* Introduce the core infrastructure needed to model redeclaration chainsDouglas Gregor2012-01-011-0/+2
| | | | | | | | | | | | | | | for Objective-C protocols, including: - Using the first declaration as the canonical declaration - Using the definition as the primary DeclContext - Making sure that all declarations have a pointer to the definition data, and that we know which declaration is the definition - Serialization support for redeclaration chains and for adding definitions to already-serialized declarations. However, note that we're not taking advantage of much of this code yet, because we're still re-using ObjCProtocolDecls. llvm-svn: 147410
* Move the data that corresponds to the definition of a protocol into aDouglas Gregor2012-01-012-25/+39
| | | | | | | | | separately-allocated DefinitionData structure. Introduce various functions that will help with the separation of declarations from definitions (isThisDeclarationADefinition(), hasDefinition(), getDefinition()). llvm-svn: 147408
* Use hasSameType.Rafael Espindola2012-01-011-2/+1
| | | | llvm-svn: 147407
* Change the diagnostics which said 'accepted as an extension' to instead sayRichard Smith2011-12-293-7/+4
| | | | | | | 'is an extension'. The former is inappropriate and confusing when building with -Werror/-pedantic-errors. llvm-svn: 147357
* Small refactoring and simplification of constant evaluation and some of itsRichard Smith2011-12-283-23/+11
| | | | | | clients. No functionality change. llvm-svn: 147318
* Eliminate ObjCClassDecl, which is redundant now that ObjCInterfaceDeclDouglas Gregor2011-12-274-31/+19
| | | | | | | covers both declarations (@class) and definitions (@interface) of an Objective-C class. llvm-svn: 147299
* Delay checking of typedefs of dependent types. Fixes PR11630.Rafael Espindola2011-12-262-21/+32
| | | | llvm-svn: 147281
* Fix constexpr handling to allow 'extern constexpr' variable declarations. We noRichard Smith2011-12-251-38/+14
| | | | | | | longer have access to the source locations we need to produce the 'replace constexpr with const' fixits, so they're gone for now. llvm-svn: 147273
* Remove unused variables.Rafael Espindola2011-12-251-1/+0
| | | | llvm-svn: 147260
* Always implicitly declare move assignment operations for dynamic classes, inRichard Smith2011-12-241-0/+11
| | | | | | | case they override virtual functions from a base class. Also fix -print-stats counting of move assignment/construction. llvm-svn: 147258
* Fix several issues related to specializations and explicit instantiations.Nico Weber2011-12-231-4/+26
| | | | | | | | | | | | | | | Explicit instantiations following specializations are no-ops and hence have no PointOfInstantiation. That was done correctly in most cases, but for a specialization -> instantiation decl -> instantiation definition chain, the definition didn't realize that it was a no-op. Fix that. Also, when printing diagnostics for these no-ops, get the diag location from the decl name location. Add many test cases, one of them not yet passing (but it failed the same way before this change). Fixes http://llvm.org/pr11558 and more. llvm-svn: 147225
* Mass rename C1x references to C11. The name hasn't proliferated like "C++0x" ↵Benjamin Kramer2011-12-231-5/+5
| | | | | | | | so this patch is surprisingly small. Also drop -Wc1x-extensions in favor of -Wc11-extensions. I don't think we need to keep this around for compatibility. llvm-svn: 147221
* Fix build under -Wswitch by adding support for FK_ListConstructorOverloadFailedNick Lewycky2011-12-221-0/+4
| | | | | | to initialization sequence dumping. llvm-svn: 147171
* Overloading for initializer list construction.Sebastian Redl2011-12-222-84/+140
| | | | llvm-svn: 147156
* List-initialization via constructor part 1. Still needs: pretty-printing, ↵Sebastian Redl2011-12-221-218/+304
| | | | | | overloading, initializer_list. llvm-svn: 147145
* PR11614: Mark defaulted special constructors as constexpr if their implicitRichard Smith2011-12-221-47/+109
| | | | | | definition would satisfy the constexpr requirements. llvm-svn: 147128
* C++11 half of r147023: In C++11, additionally eagerly instantiate:Richard Smith2011-12-212-5/+9
| | | | | | | | - constexpr function template instantiations - variables of reference type - constexpr variables llvm-svn: 147031
* C++ constant expression handling: eagerly instantiate static const integral dataRichard Smith2011-12-212-3/+7
| | | | | | | | members of class templates so that their values can be used in ICEs. This required reverting r105465, to get such instantiated members to be included in serialized ASTs. llvm-svn: 147023
* objc QOI: Don't't warn about mismatch between attributes Fariborz Jahanian2011-12-211-2/+5
| | | | | | | on method declaration and definition if former is in a system header. // rdar://10580333 llvm-svn: 147020
* objc/c++: Issue diagnostic when free-standing ivar is accessed Fariborz Jahanian2011-12-201-0/+6
| | | | | | in class method instead of crash. // rdar://10593227 llvm-svn: 146998
* Fix a crash on invalid, http://llvm.org/pr11599Nico Weber2011-12-201-2/+10
| | | | llvm-svn: 146988
* When performing name lookup for a redeclaration, ignore moduleDouglas Gregor2011-12-203-50/+3
| | | | | | | | | | | | | | | | | | | | | visibility restrictions. This ensures that all declarations of the same entity end up in the same redeclaration chain, even if some of those declarations aren't visible. While this may seem unfortunate to some---why can't two C modules have different functions named 'f'?---it's an acknowedgment that a module does not introduce a new "namespace" of names. As part of this, stop merging the 'module-private' bit from previous declarations to later declarations, because we want each declaration in a module to stand on its own because this can effect, for example, submodule visibility. Note that this notion of names that are invisible to normal name lookup but are available for redeclaration lookups is how we should implement friend declarations and extern declarations within local function scopes. I'm not tackling that problem now. llvm-svn: 146980
* Update the CMake build for r146959's new files.Chandler Carruth2011-12-201-0/+1
| | | | llvm-svn: 146967
* Revert r146766, and add a testcase for which it introduced a wrong-code bug.Richard Smith2011-12-201-37/+6
| | | | llvm-svn: 146961
* Unweaken vtables as per ↵David Blaikie2011-12-202-0/+16
| | | | | | http://llvm.org/docs/CodingStandards.html#ll_virtual_anch llvm-svn: 146959
* Unlike in C++03, a constant-expression is not an unevaluated operand in C++11.Richard Smith2011-12-206-34/+53
| | | | | | | | | | | | | | | | | | | | | | Split out a new ExpressionEvaluationContext flag for this case, and don't treat it as unevaluated in C++11. This fixes some crash-on-invalids where we would allow references to class members in potentially-evaluated constant expressions in static member functions, and also fixes half of PR10177. The fix to PR10177 exposed a case where template instantiation failed to provide a source location for a diagnostic, so TreeTransform has been tweaked to supply source locations when transforming a type. The source location is still not very good, but MarkDeclarationsReferencedInType would need to operate on a TypeLoc to improve it further. Also fix MarkDeclarationReferenced in C++98 mode to trigger instantiation for static data members of class templates which are used in constant expressions. This fixes a link-time problem, but we still incorrectly treat the member as non-constant. The rest of the fix for that issue is blocked on PCH support for early-instantiated static data members, which will be added in a subsequent patch. llvm-svn: 146955
* constexpr handling improvements. Produce detailed diagnostics when a 'constexpr'Richard Smith2011-12-191-9/+31
| | | | | | | | | | | | | | | | | | | | | variable is initialized by a non-constant expression, and pass in the variable being declared so that earlier-initialized fields' values can be used. Rearrange VarDecl init evaluation to make this possible, and in so doing fix a long-standing issue in our C++ constant expression handling, where we would mishandle cases like: extern const int a; const int n = a; const int a = 5; int arr[n]; Here, n is not initialized by a constant expression, so can't be used in an ICE, even though the initialization expression would be an ICE if it appeared later in the TU. This requires computing whether the initializer is an ICE eagerly, and saving that information in PCH files. llvm-svn: 146856
* Silence gcc warnings.Benjamin Kramer2011-12-181-1/+2
| | | | llvm-svn: 146847
* Completely re-implement (de-)serialization of declarationDouglas Gregor2011-12-171-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | chains. The previous implementation relied heavily on the declaration chain being stored as a (circular) linked list on disk, as it is in memory. However, when deserializing from multiple modules, the different chains could get mixed up, leading to broken declaration chains. The new solution keeps track of the first and last declarations in the chain for each module file. When we load a declaration, we search all of the module files for redeclarations of that declaration, then splice together all of the lists into a coherent whole (along with any redeclarations that were actually parsed). As a drive-by fix, (de-)serialize the redeclaration chains of TypedefNameDecls, which had somehow gotten missed previously. Add a test of this serialization. This new scheme creates a redeclaration table that is fairly large in the PCH file (on the order of 400k for Cocoa.h's 12MB PCH file). The table is mmap'd in and searched via a binary search, but it's still quite large. A future tweak will eliminate entries for declarations that have no redeclarations anywhere, and should drastically reduce the size of this table. llvm-svn: 146841
* Remove a non-gcc-compatible extension that would apply attributes on ↵Eli Friedman2011-12-171-3/+21
| | | | | | declarations without a declarator to structs. Add a warning for ignored attributes. Patch by Michael Han. llvm-svn: 146796
* Fix an inconsistency in the syntactic form of InitListExpr in case of ↵Nicola Gigante2011-12-161-6/+37
| | | | | | initialization that involves a ConstructorConversion llvm-svn: 146766
* PR11594: Don't blindly build a UnaryOperator UO_Minus on an expression whichRichard Smith2011-12-162-5/+5
| | | | | | | might not be an rvalue when checking array accesses. Instead, pass through a flag indicating the array index is negated. llvm-svn: 146753
* C++11 constexpr: Add note stacks containing backtraces if constant evaluationRichard Smith2011-12-161-1/+1
| | | | | | | | | | fails within a call to a constexpr function. Add -fconstexpr-backtrace-limit argument to driver and frontend, to control the maximum number of notes so produced (default 10). Fix APValue printing to be able to pretty-print all APValue types, and move the testing for this functionality from a unittest to a -verify test now that it's visible in clang's output. llvm-svn: 146749
* Support decltype in pseudo destructors and dependent destructor calls.David Blaikie2011-12-161-33/+50
| | | | | | Reviewed by Eli Friedman. llvm-svn: 146738
* objc: after issuing the warning on direct use of __attribute__((NSObject))Fariborz Jahanian2011-12-161-3/+1
| | | | | | on properties, prevent consequential error diagnostics. // rdar://10591336 llvm-svn: 146737
* Fix chaining of ObjCInterfaceDecl redeclarationsDouglas Gregor2011-12-162-15/+10
| | | | llvm-svn: 146722
* Sema::RequireCompleteType currently attempts toSean Callanan2011-12-161-28/+28
| | | | | | | | | | | | | | instantiate a class from its template pattern before it consults the ExternalASTSource. LLDB in particular will sometimes provide patterns that need to be completed first. To make this possible, I have moved the completion before the code that does the instantiation, allowing the ExternalASTSource to provide the required information. llvm-svn: 146715
* Move ObjCInterfaceDecl's "EndLoc" into DefinitionData, since it onlyDouglas Gregor2011-12-152-10/+14
| | | | | | | | applies to an actual definition. Plus, clarify the purpose of this field and give the accessor a different name, since getLocEnd() is supposed to be the same as getSourceRange().getEnd(). llvm-svn: 146694
* When name lookup finds a module-private Objective-C class declaration,Douglas Gregor2011-12-151-0/+2
| | | | | | check whether any previous declarations of the class were visible. llvm-svn: 146680
* Keep track of all declarations of an Objective-C class (both forwardDouglas Gregor2011-12-153-60/+44
| | | | | | | | | | declarations and definitions) as ObjCInterfaceDecls within the same redeclaration chain. This new representation matches what we do for C/C++ variables/functions/classes/templates/etc., and makes it possible to answer the query "where are all of the declarations of this class?" llvm-svn: 146679
* Refactor and simplify AddInitializerToDecl.Richard Smith2011-12-151-101/+73
| | | | llvm-svn: 146673
* Two null Decl*'s don't refer to the same declaration, because theyDouglas Gregor2011-12-151-3/+4
| | | | | | | | don't refer to anything. Amusingly, we were relying on this in one place. Thanks to Chandler for noticing the weirdness in declaresSameEntity. llvm-svn: 146659
* Support the 'a' length modifier in scanf format strings as a C90Hans Wennborg2011-12-151-2/+4
| | | | | | | | | extension. This fixes gcc.dg/format/c90-scanf-3.c and ext-4.c (test for excess errors). llvm-svn: 146649
* Move the definition-specific data of ObjCInterfaceDecl into aDouglas Gregor2011-12-153-13/+21
| | | | | | | | | | | | | | | | separately-allocated DefinitionData structure, which we manage the same way as CXXRecordDecl::DefinitionData. This prepares the way for making ObjCInterfaceDecls redeclarable, to more accurately model forward declarations of Objective-C classes and eliminate the mutation of ObjCInterfaceDecl that causes us serious trouble in the AST reader. Note that ObjCInterfaceDecl's accessors are fairly robust against being applied to forward declarations, because Clang (and Sema in particular) doesn't perform RequireCompleteType/hasDefinition() checks everywhere it has to. Each of these overly-robust cases is marked with a FIXME, which we can tackle over time. llvm-svn: 146644
* Enhance the -Wsign-compare handling to suppress the -Wsign-compare warning ↵Eli Friedman2011-12-151-1/+1
| | | | | | in the case of a shifted bitfield. PR11572. llvm-svn: 146634
* objc: do not auto synthesize properties declared inFariborz Jahanian2011-12-151-1/+7
| | | | | | protocols; with a warning. // rdar://10567333 llvm-svn: 146626
* In debugger support mode, if we have a top-level message sendDouglas Gregor2011-12-151-0/+9
| | | | | | | expression with an unknown result type, assume that the result type is 'id'. Fixes <rdar://problem/10400663>. llvm-svn: 146622
* Replace all comparisons between ObjCInterfaceDecl pointers with callsDouglas Gregor2011-12-156-12/+13
| | | | | | | | to declaresSameEntity(), as a baby step toward tracking forward declarations of Objective-C classes precisely. Part of <rdar://problem/10583531>. llvm-svn: 146618
OpenPOWER on IntegriCloud