summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/StmtDumper.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Send AST dumping/printing to stdout instead of stderr.Argyrios Kyrtzidis2010-08-031-8/+8
| | | | llvm-svn: 110123
* Update ImplicitCastExpr to be able to represent an XValue.Sebastian Redl2010-07-201-1/+9
| | | | llvm-svn: 108807
* make -ast-dump print something like this for declstmts:Chris Lattner2010-05-251-1/+1
| | | | | | | | | | | | (DeclStmt 0x3405550 <line:3:4, col:11> 0x34053a0 "int x") instead of: (DeclStmt 0x3405550 <line:3:4, col:11> 0x34053a0 "int x" which has unbalanced parens (PR7228) llvm-svn: 104620
* Let StmtDumper.cpp handle using declarations.Sebastian Redl2010-05-041-0/+7
| | | | llvm-svn: 103006
* Make the static type of the exception variable in an Objective-CDouglas Gregor2010-04-261-1/+1
| | | | | | | @catch a VarDecl. The dynamic type is still a ParmVarDecl, but that will change soon. No effective functionality change. llvm-svn: 102341
* Actually produce base paths for CastExprs of kind CK_DerivedToBase.Anders Carlsson2010-04-241-2/+30
| | | | llvm-svn: 102259
* Improve the AST representation of Objective-C @try/@catch/@finallyDouglas Gregor2010-04-231-0/+11
| | | | | | | | | | statements. Instead of the @try having a single @catch, where all of the @catch's were chained (using an O(n^2) algorithm nonetheless), @try just holds an array of its @catch blocks. The resulting AST is slightly more compact (not important) and better represents the actual language semantics (good). llvm-svn: 102221
* Overhaul the AST representation of Objective-C message sendDouglas Gregor2010-04-211-2/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | expressions, to improve source-location information, clarify the actual receiver of the message, and pave the way for proper C++ support. The ObjCMessageExpr node represents four different kinds of message sends in a single AST node: 1) Send to a object instance described by an expression (e.g., [x method:5]) 2) Send to a class described by the class name (e.g., [NSString method:5]) 3) Send to a superclass class (e.g, [super method:5] in class method) 4) Send to a superclass instance (e.g., [super method:5] in instance method) Previously these four cases where tangled together. Now, they have more distinct representations. Specific changes: 1) Unchanged; the object instance is represented by an Expr*. 2) Previously stored the ObjCInterfaceDecl* referring to the class receiving the message. Now stores a TypeSourceInfo* so that we know how the class was spelled. This both maintains typedef information and opens the door for more complicated C++ types (e.g., dependent types). There was an alternative, unused representation of these sends by naming the class via an IdentifierInfo *. In practice, we either had an ObjCInterfaceDecl *, from which we would get the IdentifierInfo *, or we fell into the case below... 3) Previously represented by a class message whose IdentifierInfo * referred to "super". Sema and CodeGen would use isStr("super") to determine if they had a send to super. Now represented as a "class super" send, where we have both the location of the "super" keyword and the ObjCInterfaceDecl* of the superclass we're targetting (statically). 4) Previously represented by an instance message whose receiver is a an ObjCSuperExpr, which Sema and CodeGen would check for via isa<ObjCSuperExpr>(). Now represented as an "instance super" send, where we have both the location of the "super" keyword and the ObjCInterfaceDecl* of the superclass we're targetting (statically). Note that ObjCSuperExpr only has one remaining use in the AST, which is for "super.prop" references. The new representation of ObjCMessageExpr is 2 pointers smaller than the old one, since it combines more storage. It also eliminates a leak when we loaded message-send expressions from a precompiled header. The representation also feels much cleaner to me; comments welcome! This patch attempts to maintain the same semantics we previously had with Objective-C message sends. In several places, there are massive changes that boil down to simply replacing a nested-if structure such as: if (message has a receiver expression) { // instance message if (isa<ObjCSuperExpr>(...)) { // send to super } else { // send to an object } } else { // class message if (name->isStr("super")) { // class send to super } else { // send to class } } with a switch switch (E->getReceiverKind()) { case ObjCMessageExpr::SuperInstance: ... case ObjCMessageExpr::Instance: ... case ObjCMessageExpr::SuperClass: ... case ObjCMessageExpr::Class:... } There are quite a few places (particularly in the checkers) where send-to-super is effectively ignored. I've placed FIXMEs in most of them, and attempted to address send-to-super in a reasonable way. This could use some review. llvm-svn: 101972
* Add raw_ostream operators to NamedDecl for convenience. Switch over all ↵Benjamin Kramer2010-04-171-9/+7
| | | | | | | | users of getNameAsString on a stream. The next step is to print the name directly into the stream, avoiding a temporary std::string copy. llvm-svn: 101632
* Dump the constructor type for a CXXConstructExpr.John McCall2010-02-021-0/+2
| | | | llvm-svn: 95106
* StmtDumper::VisitUnresolvedLookupExprJohn McCall2009-12-111-0/+14
| | | | llvm-svn: 91163
* Convert StmtDumper to raw_ostream. I forget why.Daniel Dunbar2009-12-031-129/+121
| | | | llvm-svn: 90435
* Remove VISIBILITY_HIDDEN from lib/AST.Benjamin Kramer2009-11-281-2/+1
| | | | llvm-svn: 90043
* When dumping implicit cast exprs, print out whether the cast is an lvalue ↵Anders Carlsson2009-11-141-0/+7
| | | | | | cast or not. llvm-svn: 88821
* Move clients to use IdentifierInfo::getNameStart() instead of getName()Daniel Dunbar2009-10-181-4/+4
| | | | llvm-svn: 84436
* Refactor the representation of qualifiers to bring ExtQualType out of theJohn McCall2009-09-241-6/+3
| | | | | | | | Type hierarchy. Demote 'volatile' to extended-qualifier status. Audit our use of qualifiers and fix a few places that weren't dealing with qualifiers quite right; many more remain. llvm-svn: 82705
* Remove tabs, and whitespace cleanups.Mike Stump2009-09-091-33/+33
| | | | llvm-svn: 81346
* Add CastExpr::getCastKindName and use it in the StmtDumper.Anders Carlsson2009-09-031-41/+4
| | | | llvm-svn: 80862
* Add a CK_FunctionToPointerDecay cast kind.Anders Carlsson2009-09-011-0/+3
| | | | llvm-svn: 80719
* path to ir-gen 12.3.1 Conversion by constructorFariborz Jahanian2009-08-281-0/+3
| | | | llvm-svn: 80398
* More work for conversion functions.Mike Stump2009-08-261-0/+3
| | | | llvm-svn: 80142
* Add CK_NullToMemberPointer and CK_BaseToDerivedMemberPointer cast kinds. ↵Anders Carlsson2009-08-221-11/+46
| | | | | | Make -ast-dump print out the cast kinds of cast expressions. llvm-svn: 79787
* Using "ObjCImplicitSetterGetterRefExpr" instead of ↵Fariborz Jahanian2009-08-201-4/+4
| | | | | | | | "ObjCImplctSetterGetterRefExpr". A field rename and more comments. llvm-svn: 79537
* Renamed ObjCKVCRefExpr to ObjCImplctSetterGetterRefExpr.Fariborz Jahanian2009-08-181-2/+4
| | | | | | | | Removed an unnecessary loop to get to setters incoming argument. Added DoxyGen comments. Still more work to do in this area (WIP). llvm-svn: 79365
* Fix spacingAnders Carlsson2009-08-141-1/+1
| | | | llvm-svn: 78981
* Add some information about temporaries to the statement dumper.Anders Carlsson2009-08-121-0/+31
| | | | llvm-svn: 78754
* Key decisions about 'bool' vs '_Bool' to be based on a new flag in langoptions.Chris Lattner2009-06-301-2/+2
| | | | | | | | | | | | This is simple enough, but then I thought it would be nice to make PrintingPolicy get a LangOptions so that various things can key off "bool" and "C++" independently. This spiraled out of control. There are many fixme's, but I think things are slightly better than they were before. One thing that can be improved: CFG should probably have an ASTContext pointer in it, which would simplify its clients. llvm-svn: 74493
* Create a new PrintingPolicy class, which we pass down through the ASTDouglas Gregor2009-05-291-1/+4
| | | | | | | | | printing logic to help customize the output. For now, we use this rather than a special flag to suppress the "struct" when printing "struct X" and to print the Boolean type as "bool" in C++ but "_Bool" in C. llvm-svn: 72590
* Audit __private_extern__ handling.Daniel Dunbar2009-04-141-8/+3
| | | | | | | | | | | | | | - Exposed quite a few Sema issues and a CodeGen crash. - See FIXMEs in test case, and in SemaDecl.cpp (PR3983). I'm skeptical that __private_extern__ should actually be a storage class value. I think that __private_extern__ basically amounts to extern A __attribute__((visibility("hidden"))) and would be better off handled (a) as that, or (b) with an extra bit in the VarDecl. llvm-svn: 69020
* simplifyChris Lattner2009-03-291-1/+1
| | | | llvm-svn: 68000
* Change compound assignment operators to keep track of both the promoted Eli Friedman2009-03-281-2/+4
| | | | | | | | | | | | | | | | | LHS type and the computation result type; this encodes information into the AST which is otherwise non-obvious. Fix Sema to always come up with the right answer for both of these types. Fix IRGen and the analyzer to account for these changes. This fixes PR2601. The approach is inspired by PR2601 comment 2. Note that this changes real *= complex in CodeGen from a silent miscompilation to an explicit error. I'm not really sure that the analyzer changes are correct, or how to test them... someone more familiar with the analyzer should check those changes. llvm-svn: 67889
* Semantic analysis, ASTs, and unqualified name lookup support for C++Douglas Gregor2009-02-031-0/+9
| | | | | | using directives, from Piotr Rak! llvm-svn: 63646
* Introduce a new PresumedLoc class to represent the concept of a locationChris Lattner2009-01-271-11/+16
| | | | | | | | | | | | | | | | | | | as reported to the user and as manipulated by #line. This is what __FILE__, __INCLUDE_LEVEL__, diagnostics and other things should follow (but not dependency generation!). This patch also includes several cleanups along the way: - SourceLocation now has a dump method, and several other places that did similar things now use it. - I cleaned up some code in AnalysisConsumer, but it should probably be simplified further now that NamedDecl is better. - TextDiagnosticPrinter is now simplified and cleaned up a bit. This patch is a prerequisite for #line, but does not actually provide any #line functionality. llvm-svn: 63098
* Remove ScopedDecl, collapsing all of its functionality into Decl, soDouglas Gregor2009-01-201-1/+1
| | | | | | | | | | | | | | | | that every declaration lives inside a DeclContext. Moved several things that don't have names but were ScopedDecls (and, therefore, NamedDecls) to inherit from Decl rather than NamedDecl, including ObjCImplementationDecl and LinkageSpecDecl. Now, we don't store empty DeclarationNames for these things, nor do we try to insert them into DeclContext's lookup structure. The serialization tests are temporarily disabled. We'll re-enable them once we've sorted out the remaining ownership/serialiazation issues between DeclContexts and TranslationUnion, DeclGroups, etc. llvm-svn: 62562
* Change some terminology in SourceLocation: instead of referring to Chris Lattner2009-01-161-6/+7
| | | | | | | the "physical" location of tokens, refer to the "spelling" location. This is more concrete and useful, tokens aren't really physical objects! llvm-svn: 62309
* Correct the order in which we cope with end-of-class-definitionDouglas Gregor2008-12-241-6/+8
| | | | | | | | | | | | | | | | | | | | | | semantics and improve our handling of default arguments. Specifically, we follow this order: - As soon as the see the '}' in the class definition, the class is complete and we add any implicit declarations (default constructor, copy constructor, etc.) to the class. - If there are any default function arguments, parse them - If there were any inline member function definitions, parse them As part of this change, we now keep track of the the fact that we've seen unparsed default function arguments within the AST. See the new ParmVarDecl::hasUnparsedDefaultArg member. This allows us to properly cope with calls inside default function arguments to other functions where we're making use of the default arguments. Made some C++ error messages regarding failed initializations more specific. llvm-svn: 61406
* Migrate some stuff from NamedDecl::getName() to Chris Lattner2008-11-241-2/+2
| | | | | | NamedDecl::getNameAsString() to make it more explicit. llvm-svn: 59937
* Rename NamedDecl::getIdentifierName() to ::getNameAsCString() and make itChris Lattner2008-11-241-5/+4
| | | | | | | | | assert if the name is not an identifier. Update callers to do the right thing and avoid this method in unsafe cases. This also fixes an objc warning that was missing a space, and migrates a couple more to taking IdentifierInfo and QualTypes instead of std::strings. llvm-svn: 59936
* Rename Selector::getName() to Selector::getAsString(), and addChris Lattner2008-11-241-6/+5
| | | | | | | | | | | | | a new NamedDecl::getAsString() method. Change uses of Selector::getName() to just pass in a Selector where possible (e.g. to diagnostics) instead of going through an std::string. This also adds new formatters for objcinstance and objcclass as described in the dox. llvm-svn: 59933
* New AST node to access "implicit" setter/getter using property dor syntax.Fariborz Jahanian2008-11-221-10/+13
| | | | | | | Issuing diagnostics when assigning to read-only properties. This is work in progress. llvm-svn: 59874
* Introduction the DeclarationName class, as a single, general method ofDouglas Gregor2008-11-171-6/+10
| | | | | | | | representing the names of declarations in the C family of languages. DeclarationName is used in NamedDecl to store the name of the declaration (naturally), and ObjCMethodDecl is now a NamedDecl. llvm-svn: 59441
* Introduce a single AST node SizeOfAlignOfExpr for all sizeof and alignof ↵Sebastian Redl2008-11-111-3/+4
| | | | | | expressions, both of values and types. llvm-svn: 59057
* Add a new expression class, ObjCSuperExpr, to handle the Objective-C ↵Douglas Gregor2008-11-041-2/+13
| | | | | | 'super'. Remove ObjCThis from PredefinedExpr llvm-svn: 58698
* Refactor the expression class hierarchy for casts. Most importantly:Douglas Gregor2008-10-271-3/+11
| | | | | | | | | | | | | | | | | | | | | | - CastExpr is the root of all casts - ImplicitCastExpr is (still) used for all explicit casts - ExplicitCastExpr is now the root of all *explicit* casts - ExplicitCCastExpr (new name needed!?) is a C-style cast in C or C++ - CXXFunctionalCastExpr inherits from ExplicitCastExpr - CXXNamedCastExpr inherits from ExplicitCastExpr and is the root of all of the C++ named cast expression types (static_cast, dynamic_cast, etc.) - Added classes CXXStaticCastExpr, CXXDynamicCastExpr, CXXReinterpretCastExpr, and CXXConstCastExpr to Also, fixed returned-stack-addr.cpp, which broke once when we fixed reinterpret_cast to diagnose double->int* conversions and again when we eliminated implicit conversions to reference types. The fix is in both testcase and SemaChecking.cpp. Most of this patch is simply support for the renaming. There's very little actual change in semantics. llvm-svn: 58264
* Simplify handling of struct/union/class tags.Argyrios Kyrtzidis2008-10-151-6/+2
| | | | | | | Instead of using two sets of Decl kinds (Struct/Union/Class and CXXStruct/CXXUnion/CXXClass), use one 'Record' and one 'CXXRecord' Decl kind and make tag kind a property of TagDecl. Cleans up the code a bit and better reflects that Decl class structure. llvm-svn: 57541
* Use Decl::decl_iterator instead of walking the ScopedDecl chain (which will ↵Ted Kremenek2008-10-061-1/+3
| | | | | | soon be removed). llvm-svn: 57190
* Fix ObjCPropertRefExpr to be able to encode all the information forDaniel Dunbar2008-09-031-5/+8
| | | | | | | uses which refer to methods not properties. - Not yet wired in Sema. llvm-svn: 55681
* Add Objective-C property setter support.Daniel Dunbar2008-08-301-0/+13
| | | | | | | | | | | | | | | | | | | | | | - Change Obj-C runtime message API, drop the ObjCMessageExpr arg in favor of just result type and selector. Necessary so it can be reused in situations where we don't want to cons up an ObjCMessageExpr. - Update aggregate binary assignment to know about special property ref lvalues. - Add CodeGenFunction::EmitCallArg overload which takes an already emitted rvalue. Add CodeGenFunction::StoreComplexIntoAddr. Disabled logic in Sema for parsing Objective-C dot-syntax that accesses methods. This code does not search in the correct order and the AST node has no way of properly representing its results. Updated StmtDumper to print a bit more information about ObjCPropertyRefExprs. llvm-svn: 55561
* More #include cleaningDaniel Dunbar2008-08-111-3/+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
* rename PreDefinedExpr -> PredefinedExprChris Lattner2008-08-101-6/+6
| | | | llvm-svn: 54605
OpenPOWER on IntegriCloud