summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDeclCXX.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Standard conversion sequences now have a CopyConstructor field, toDouglas Gregor2008-11-031-2/+6
| | | | | | | | | | | | | | | cope with the case where a user-defined conversion is actually a copy construction, and therefore can be compared against other standard conversion sequences. While I called this a hack before, now I'm convinced that it's the right way to go. Compare overloads based on derived-to-base conversions that invoke copy constructors. Suppress user-defined conversions when attempting to call a user-defined conversion. llvm-svn: 58629
* Add implicitly-declared default and copy constructors to C++ classes,Douglas Gregor2008-11-031-0/+106
| | | | | | | | | | | when appropriate. Conversions for class types now make use of copy constructors. I've replaced the egregious hack allowing class-to-class conversions with a slightly less egregious hack calling these conversions standard conversions (for overloading reasons). llvm-svn: 58622
* Semantic checking of constructor declarations and classification of ↵Douglas Gregor2008-10-311-11/+42
| | | | | | default/copy constructors llvm-svn: 58538
* Implement basic support for converting constructors in user-defined Douglas Gregor2008-10-311-0/+18
| | | | | | | | | | | | | conversions. Notes: - Overload resolution for converting constructors need to prohibit user-defined conversions (hence, the test isn't -verify safe yet). - We still use hacks for conversions from a class type to itself. This will be the case until we start implicitly declaring the appropriate special member functions. (That's next on my list) llvm-svn: 58513
* Made the mechanism of defining preprocessor defs for maxint, ptrdiff_t, wcharSanjiv Gupta2008-10-311-1/+1
| | | | | | | | | | etc more generic. For some targets, long may not be equal to pointer size. For example: PIC16 has int as i16, ptr as i16 but long as i32. Also fixed a few build warnings in assert() functions in CFRefCount.cpp, CGDecl.cpp, SemaDeclCXX.cpp and ParseDeclCXX.cpp. llvm-svn: 58501
* Add support for parsing and representing C++ constructor declarations.Douglas Gregor2008-10-311-2/+41
| | | | | | | | | | | | | | | Notes: - Constructors are never found by name lookup, so they'll never get pushed into any scope. Instead, they are stored as an OverloadedFunctionDecl in CXXRecordDecl for easy overloading. - There's a new action isCurrentClassName that determines whether an identifier is the name of the innermost class currently being defined; we use this to identify the declarator-id grammar rule that refers to a type-name. - MinimalAction does *not* support parsing constructors. - We now handle virtual and explicit function specifiers. llvm-svn: 58499
* Improve documentation for Sema::CheckReferenceInitDouglas Gregor2008-10-291-7/+7
| | | | llvm-svn: 58404
* Implement overloading rules for reference bindingDouglas Gregor2008-10-291-4/+4
| | | | llvm-svn: 58381
* Tweak Sema::CheckReferenceInit so that it (optionally) computes an Douglas Gregor2008-10-291-30/+87
| | | | | | | | | | | ImplicitConversionSequence and, when doing so, following the specific rules of [over.best.ics]. The computation of the implicit conversion sequences implements C++ [over.ics.ref], but we do not (yet) have ranking for implicit conversion sequences that use reference binding. llvm-svn: 58357
* Implement initialization of a reference (C++ [dcl.init.ref]) as partDouglas Gregor2008-10-291-0/+190
| | | | | | | | | | | | | | | | | | | of copy initialization. Other pieces of the puzzle: - Try/Perform-ImplicitConversion now handles implicit conversions that don't involve references. - Try/Perform-CopyInitialization uses CheckSingleAssignmentConstraints for C. PerformCopyInitialization is now used for all argument passing and returning values from a function. - Diagnose errors with declaring references and const values without an initializer. (Uses a new Action callback, ActOnUninitializedDecl). We do not yet have implicit conversion sequences for reference binding, which means that we don't have any overloading support for reference parameters yet. llvm-svn: 58353
* Clean up and document the representation of C++ base classesDouglas Gregor2008-10-231-16/+24
| | | | llvm-svn: 58040
* Added GraphViz visualization of C++ inheritance hierarchies. Douglas Gregor2008-10-221-9/+1
| | | | | | | Factored the QualTypeOrdering predicate into its own header (TypeOrdering.h), now that it is used in two places. llvm-svn: 58001
* Add representation of base classes in the AST, and verify that weDouglas Gregor2008-10-221-12/+63
| | | | | | | | don't have duplicated direct base classes. Seriliazation of base class specifiers is not yet implemented. llvm-svn: 57991
* Preliminary support for function overloadingDouglas Gregor2008-10-211-1/+2
| | | | llvm-svn: 57909
* Fix this bug:Argyrios Kyrtzidis2008-10-151-1/+3
| | | | | | | | | typedef int f(); struct S { f *x; // incorrectly assuming this is function decl, leading to failed assertions. }; llvm-svn: 57598
* Revert my previous change, got stupidly confused with my local changes.Argyrios Kyrtzidis2008-10-141-1/+1
| | | | llvm-svn: 57514
* Fix a call to Sema::LookupDecl that had incorrect parameters.Argyrios Kyrtzidis2008-10-141-1/+1
| | | | llvm-svn: 57511
* Fix a bug that crashed clang when parsing this:Argyrios Kyrtzidis2008-10-081-10/+20
| | | | | | | | | | | | | | | | class C { static const int number = 50; static int arr[number]; }; Here's how it worked: -GetTypeForDeclarator was called from both Sema::ActOnCXXMemberDeclarator and Sema::ActOnDeclarator. -VariableArrayTypes are not uniqued so two VariableArrayTypes were created with the same DeclRefExpr. -On exit they both tried to destroy that one DeclRefExpr. The fix is not to use GetTypeForDeclarator from the Sema::ActOnCXXMemberDeclarator. llvm-svn: 57313
* Simplify handling of direct initializers by letting ↵Argyrios Kyrtzidis2008-10-061-17/+12
| | | | | | | | | | | | Sema::AddInitializerToDecl handle conversions, instead of using Sema::ActOnCXXTypeConstructExpr. Additional benefit is that diagnostics are the same for both direct-initialization and copy-initialization. In the case of "int x( expression );": -The Init expression of VarDecl 'x' will be the expression inside the parentheses. -VarDecl::hasCXXDirectInitializer for VarDecl 'x' will return true to let clients distinguish from "int x = expression ;". llvm-svn: 57219
* Use "unsigned" instead of "int" for i to remove a "comparison between ↵Ted Kremenek2008-10-061-1/+1
| | | | | | unsigned and signed" warning (potential integer overflow). llvm-svn: 57201
* The current semantic process for direct initializers won't work properly for ↵Argyrios Kyrtzidis2008-10-061-21/+13
| | | | | | | | class types. Add a FIXME until class constructors are supported. llvm-svn: 57188
* Implement support for C++ direct initializers in declarations, e.g. "int x(1);".Argyrios Kyrtzidis2008-10-061-0/+80
| | | | | | | | | | | | | | | This is how this kind of initializers appear in the AST: -The Init expression of the VarDecl is a functional type construction (of the VarDecl's type). -The new VarDecl::hasCXXDirectInitializer() returns true. e.g, for "int x(1);": -VarDecl 'x' has Init with expression "int(1)" (CXXFunctionalCastExpr). -hasCXXDirectInitializer() of VarDecl 'x' returns true. A major benefit is that clients that don't particularly care about which exactly form was the initializer can handle both cases without special case code. Note that codegening works now for "int x(1);" without any changes to CodeGen. llvm-svn: 57178
* Pass postfix attributes to ActOnFields.Daniel Dunbar2008-10-031-1/+1
| | | | llvm-svn: 56992
* Use Sema::isDeclInScope instead of IdentifierResolver::isDeclInScope.Argyrios Kyrtzidis2008-09-101-2/+1
| | | | llvm-svn: 56042
* More #include cleaningDaniel Dunbar2008-08-111-7/+0
| | | | | | | | | | | - Kill unnecessary #includes in .cpp files. This is an automatic sweep so some things removed are actually used, but happen to be included by a previous header. I tried to get rid of the obvious examples and this was the easiest way to trim the #includes in one fell swoop. - We now return to regularly scheduled development. llvm-svn: 54632
* Minor #include cleaningDaniel Dunbar2008-08-111-1/+3
| | | | | | | - Drop TokenKinds.h from Action.h - Move DeclSpec.h from Sema.h into individual Sema .cpp files llvm-svn: 54625
* When in C++, invoke ASTConsumer::HandleTagDeclDefinition in ↵Argyrios Kyrtzidis2008-08-091-3/+6
| | | | | | | | Sema::ActOnFinishCXXClassDef, at which point the C++ struct/class/union is fully parsed. llvm-svn: 54569
* Passing right brace location to ActOnFinishCXXClassDef is redundant, since ↵Argyrios Kyrtzidis2008-08-091-1/+1
| | | | | | it gets passed to ActOnFinishCXXMemberSpecification too. llvm-svn: 54567
* Move AsmLabel into Declarator instead of just a parameter toDaniel Dunbar2008-08-051-1/+1
| | | | | | ActOnDeclarator. llvm-svn: 54353
* Add more Parser/Sema support for GCC asm-label extension.Daniel Dunbar2008-08-051-1/+1
| | | | | | | | | | | | | - ActOnDeclarator now takes an additional parameter which is the AsmLabel if used. Its unfortunate that this bubbles up this high, but we cannot just lump it in as an attribute without mistakenly *accepting* it as an attribute. - The actual asm-label itself is, however, encoded as an AsmLabelAttr on the FunctionDecl. - Slightly improved parser error recovery on malformed asm-labels. - CodeGen support still missing... llvm-svn: 54339
* Wherever a type is used/returned from the Action module, use TypeTy instead ↵Argyrios Kyrtzidis2008-08-011-1/+1
| | | | | | | | of DeclTy or void. No functionality change. llvm-svn: 54265
* change more instances of QualType::getCanonicalType to callChris Lattner2008-07-261-12/+10
| | | | | | ASTContext::getCanonicalType instead (PR2189) llvm-svn: 54105
* Add Sema support for C++ classes.Argyrios Kyrtzidis2008-07-011-0/+170
| | | | llvm-svn: 52956
* -Changes to TagDecl:Argyrios Kyrtzidis2008-06-091-1/+1
| | | | | | | | | Added TagKind enum. Added getTagKind() method. Added convenience methods: isEnum(), isStruct(), isUnion(), isClass(). -RecordDecl/CXXRecordDecl::Create() accept a TagKind enum instead of a DeclKind one. llvm-svn: 52160
* Oops...remove weird printf:-)Steve Naroff2008-06-051-1/+0
| | | | llvm-svn: 52025
* Second half of "fix" for <rdar://problem/5986085> clang on xcode: error: ↵Steve Naroff2008-06-051-0/+1
| | | | | | redefinition of 'XCElementToggler' as different kind of symbol llvm-svn: 52024
* - Move ObjC Expresssion AST's from Expr.h => ExprObjC.hSteve Naroff2008-05-291-0/+1
| | | | | | - #include ExprObjC.h in many places llvm-svn: 51703
* -Implement proper name lookup for namespaces.Argyrios Kyrtzidis2008-05-091-1/+2
| | | | | | | -identifierResolver exposes an iterator interface to get all decls through the scope chain. -The semantic staff (checking IdentifierNamespace and Doug's checking for shadowed tags were moved out of IdentifierResolver and back into Sema. IdentifierResolver just gives an iterator for all reachable decls of an identifier. llvm-svn: 50923
* Diagnose attempts to use C++ default arguments outside of a function declarationDouglas Gregor2008-05-071-8/+28
| | | | llvm-svn: 50799
* Parsing of namespaces:Argyrios Kyrtzidis2008-04-271-0/+77
| | | | | | | | | -NamespaceDecl for the AST -Checks for name clashes between namespaces and tag/normal declarations. This commit doesn't implement proper name lookup for namespaces. llvm-svn: 50321
* Remove FileVarDecl and BlockVarDecl. They are replaced by ↵Steve Naroff2008-04-151-4/+5
| | | | | | | | VarDecl::isBlockVarDecl() and VarDecl::isFileVarDecl(). This is a fairly mechanical/large change. As a result, I avoided making any changes/simplifications that weren't directly related. I did break two Analysis tests. I also have a couple FIXME's in UninitializedValues.cpp. Ted, can you take a look? If the bug isn't obvious, I am happy to dig in and fix it (since I broke it). llvm-svn: 49748
* This patch adds very basic support for parsing and type-checking classDouglas Gregor2008-04-131-0/+49
| | | | | | | | | | | inheritance in C++. It'll parse the base-specifier list, e.g., class D : public B1, virtual public B2 { }; and do some of the simpler semantic checks (B1 and B2 are classes; they aren't unions or incomplete types, etc). llvm-svn: 49623
* Default argument cleanups and minor improvements, patch byChris Lattner2008-04-121-55/+60
| | | | | | Doug Gregor! llvm-svn: 49598
* Several improvements from Doug Gregor related to defaultChris Lattner2008-04-101-0/+73
| | | | | | argument handling. I'll fix up the c89 (void) thing next. llvm-svn: 49459
* Add support for C++ default arguments, and rework Parse-Sema Chris Lattner2008-04-081-0/+158
interaction for function parameters, fixing PR2046. Patch by Doug Gregor! llvm-svn: 49370
OpenPOWER on IntegriCloud