Commit Graph

48 Commits

Author SHA1 Message Date
Alexander Kornienko 2018618b4d Fixed crash and added a test and a minor output problem
llvm-svn: 162110
2012-08-17 17:38:39 +00:00
Michael Han 1fb908f745 Fix base type of ASTDeclNodeLister.
llvm-svn: 161963
2012-08-15 17:56:58 +00:00
Alexander Kornienko 4de035947b Added -ast-list option to dump filterable AST decl node names.
llvm-svn: 161040
2012-07-31 09:37:40 +00:00
Alexander Kornienko 3db68ee109 Added -ast-dump-filter option to clang -cc1.
llvm-svn: 160784
2012-07-26 16:01:23 +00:00
Argyrios Kyrtzidis 841dd8861a Change ASTConsumer::HandleTopLevelDecl to return true for the parser to continue
parsing or false to abort parsing.

llvm-svn: 144943
2011-11-18 00:26:59 +00:00
Benjamin Kramer b89514a9b8 Change operator<< for raw_ostream and NamedDecl to take a reference instead of a pointer.
Passing a pointer was a bad idea as it collides with the overload for void*.

llvm-svn: 141971
2011-10-14 18:45:37 +00:00
John McCall f937c023bf Rename TagDecl::isDefinition -> isCompleteDefinition
for better self-documenting code, since the semantics
are subtly different from getDefinition().

llvm-svn: 141355
2011-10-07 06:10:15 +00:00
Douglas Gregor c0b07286cf When 'bool' is not a built-in type but is defined as a macro, print
'bool' rather than '_Bool' within types, to make things a bit more
readable. Fixes <rdar://problem/10063263>.

llvm-svn: 140650
2011-09-27 22:38:19 +00:00
David Blaikie 83d382b1ca Switch assert(0/false) llvm_unreachable.
llvm-svn: 140367
2011-09-23 05:06:16 +00:00
Richard Trieu 82398f9cd6 Add template instantiations to the output of -ast-dump.
llvm-svn: 136306
2011-07-28 00:19:05 +00:00
Chris Lattner 0e62c1cc0b remove unneeded llvm:: namespace qualifiers on some core types now that LLVM.h imports
them into the clang namespace.

llvm-svn: 135852
2011-07-23 10:55:15 +00:00
Alexis Hunt 4a8ea1092a Modify some deleted function methods to better reflect reality:
- New isDefined() function checks for deletedness
 - isThisDeclarationADefinition checks for deletedness
 - New doesThisDeclarationHaveABody() does what
   isThisDeclarationADefinition() used to do
 - The IsDeleted bit is not propagated across redeclarations
 - isDeleted() now checks the canoncial declaration
 - New isDeletedAsWritten() does what it says on the tin.
 - isUserProvided() now correct (thanks Richard!)

This fixes the bug that we weren't catching

void foo() = delete;
void foo() {}

as being a redefinition.

llvm-svn: 131013
2011-05-06 20:44:56 +00:00
Richard Smith dda56e4b4a Support for C++11 (non-template) alias declarations.
llvm-svn: 129567
2011-04-15 14:24:37 +00:00
Douglas Gregor cfee35b845 Remove the AST printer (-ast-print-xml), which is too incomplete and
too low-level to actually be useful but is just interesting enough for
people to try to use it (which won't actually work beyond toy examples).

To bring back the AST printer, it needs to be:
  - Complete, covering all of C/C++/Objective-C
  - Documented, with appropriate Schema against which we can validate
  the output
  - Designed for C/C++/Objective-C, not Clang's specific ASTs
  - Stable across Clang versions
  - Well-tested

llvm-svn: 127141
2011-03-07 01:03:30 +00:00
Chris Lattner d12b480e29 handle labeldecls.
llvm-svn: 125806
2011-02-18 00:52:55 +00:00
Douglas Gregor d6f8124c9c Eliminate the internal command-line option for viewing inheritance in C++ classes, since it's only really worked for the trivial cases anyway due to lame pseudo-parsing of the class name. The viewInheritance() function is still available for use in the debugger, where this is far more useful
llvm-svn: 125762
2011-02-17 19:04:40 +00:00
Francois Pichet 48e2d9e2be Add IndirectField case in DeclContextPrinter::PrintDeclContext.
Fix PR8832.

llvm-svn: 122311
2010-12-21 03:08:02 +00:00
Michael J. Spencer 8aaf49959c Merge System into Support.
llvm-svn: 120297
2010-11-29 18:12:39 +00:00
John McCall 9b66c4bbbe Add -cc1 -ast-dump-xml, an excessively detailed XML dump of the internals
of the ASTs.  Only available in assertions builds.  No stability guarantee.

This is intended solely as a debugging tool.  I'm not sure if the goals
are sufficiently aligned with the XML printer to allow a common
implementation.

Currently just falls back on the StmtDumper to display statements,
which means it doesn't produce valid XML in those cases.

llvm-svn: 120088
2010-11-24 11:21:45 +00:00
Argyrios Kyrtzidis 1e1de05f18 Send AST dumping/printing to stdout instead of stderr.
llvm-svn: 110123
2010-08-03 17:29:57 +00:00
Argyrios Kyrtzidis 46f556d4e5 Simplify code. FunctionDecl and ObjCMethodDecl have some common interfaces.
llvm-svn: 107769
2010-07-07 11:31:23 +00:00
Daniel Dunbar c1b1729b66 Break Frontend's dependency on Rewrite, Checker and CodeGen in shared library configuration
Currently, all AST consumers are located in the Frontend library,
meaning that in a shared library configuration, Frontend has a
dependency on Rewrite, Checker and CodeGen.  This is suboptimal for
clients which only wish to make use of the frontend.  CodeGen in
particular introduces a large number of unwanted dependencies.

This patch breaks the dependency by moving all AST consumers with
dependencies on Rewrite, Checker and/or CodeGen to their respective
libraries.  The patch therefore introduces dependencies in the other
direction (i.e. from Rewrite, Checker and CodeGen to Frontend).

After applying this patch, Clang builds correctly using CMake and
shared libraries ("cmake -DBUILD_SHARED_LIBS=ON").

N.B. This patch includes file renames which are indicated in the
patch body.

Changes in this revision of the patch:
 - Fixed some copy-paste mistakes in the header files
 - Modified certain aspects of the coding to comply with the LLVM
   Coding Standards

llvm-svn: 106010
2010-06-15 17:48:49 +00:00
Benjamin Kramer b11416d061 Add raw_ostream operators to NamedDecl for convenience. Switch over all 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
2010-04-17 09:33:03 +00:00
Daniel Dunbar 8ee6760971 Fronted: Kill overly specialized RecordLayoutDumper, just make -dump-record-layouts a bit that Sema honors.
llvm-svn: 100747
2010-04-08 02:59:56 +00:00
Daniel Dunbar aa423afffc AST: Move C++ record layout dumping to ASTContext::DumpRecordLayout.
llvm-svn: 100746
2010-04-08 02:59:49 +00:00
Douglas Gregor 0a5a2216e2 Eliminate the ASTContext parameter from RecordDecl::getDefinition()
and CXXRecordDecl::getDefinition(); it's totally unnecessary. No
functionality change.

llvm-svn: 95836
2010-02-11 01:04:33 +00:00
Zhongxing Xu 00c6046a81 Add a missing case for DeclContext printer.
llvm-svn: 93973
2010-01-20 03:21:28 +00:00
Eli Friedman c6f59b1c49 Better coverage for -dump-record-layouts and -print-decl-contexts.
llvm-svn: 92441
2010-01-03 02:01:11 +00:00
Eli Friedman 897bc03305 Small compatibility fix for -print-decl-contexts.
llvm-svn: 90838
2009-12-08 06:22:37 +00:00
Daniel Dunbar f680e7d855 Kill a few more random stderr uses.
llvm-svn: 90441
2009-12-03 09:14:02 +00:00
Sebastian Redl 1054faed32 Audit the code for places where it is assumed that every base specifier refers to a RecordType. Add assertions or conditions as appropriate. This fixes another crash in the Apache stdlib vector.
llvm-svn: 85055
2009-10-25 17:03:50 +00:00
John McCall 856bbea332 Remove OriginalTypeParmDecl; the original type is the one specified
in the DeclaratorInfo, if one is present.

Preserve source information through template instantiation.  This is made
more complicated by the possibility that ParmVarDecls don't have DIs, which
is possibly worth fixing in the future.

Also preserve source information for function parameters in ObjC method
declarations.

llvm-svn: 84971
2009-10-23 21:48:59 +00:00
Anders Carlsson 294616a74c Don't try to dump invalid decls or forward decls.
llvm-svn: 82827
2009-09-26 01:02:04 +00:00
Anders Carlsson e1883100a3 Who would have thought that empty classes were so tricky? Handle cases where an empty virtual base class needs to be moved aside because it conflicts with the first field.
llvm-svn: 82746
2009-09-25 01:54:38 +00:00
Anders Carlsson 6d2b6f49ce Improve the record layout dumper.
llvm-svn: 82733
2009-09-24 23:50:42 +00:00
Anders Carlsson d934010557 Add a -dump-record-layouts argument to clang-cc.
llvm-svn: 82703
2009-09-24 18:54:49 +00:00
Douglas Gregor e2350a3b97 Eliminate FunctionDecl::getBodyIfAvailable
llvm-svn: 81588
2009-09-12 00:08:48 +00:00
Mike Stump 11289f4280 Remove tabs, and whitespace cleanups.
llvm-svn: 81346
2009-09-09 15:08:12 +00:00
Torok Edwin db7149246f Fix build of clang with gcc-4.4: #include <cstdio> was missing.
llvm-svn: 79916
2009-08-24 13:25:12 +00:00
Benjamin Kramer 89b422c118 Replace cerr with errs().
llvm-svn: 79854
2009-08-23 12:08:50 +00:00
Zhongxing Xu 5df79c6642 remove dead code.
llvm-svn: 74517
2009-06-30 07:50:26 +00:00
Argyrios Kyrtzidis cfbfe78e9e De-ASTContext-ify DeclContext.
Remove ASTContext parameter from DeclContext's methods. This change cascaded down to other Decl's methods and changes to call sites started "escalating".
Timings using pre-tokenized "cocoa.h" showed only a ~1% increase in time run between and after this commit.

llvm-svn: 74506
2009-06-30 02:36:12 +00:00
Argyrios Kyrtzidis 8a803cc351 Remove the ASTContext parameter from the printing related methods of Decl.
llvm-svn: 74503
2009-06-30 02:35:04 +00:00
Argyrios Kyrtzidis c4b766bc65 Move CXXMethodDecl::OutOfLineDefinition into Decl::OutOfLine.
llvm-svn: 73651
2009-06-17 22:49:50 +00:00
Douglas Gregor 278f52ec29 Refactor and clean up the AST printer, so that it uses a DeclVisitor,
walks through DeclContexts properly, and prints more of the
information available in the AST. The functionality is still available
via -ast-print, -ast-dump, etc., and also via the new member functions
Decl::dump() and Decl::print().

llvm-svn: 72597
2009-05-30 00:08:05 +00:00
Douglas Gregor 7de5966d76 Create a new PrintingPolicy class, which we pass down through the AST
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
2009-05-29 20:38:28 +00:00
Douglas Gregor 7f5601e55f AST XML dump, from Olaf Krzikalla!
llvm-svn: 72224
2009-05-21 20:55:50 +00:00
Eli Friedman 9f30fc33d9 Move ASTConsumers.h to include/clang/Frontend, and move the associated
.cpp files to lib/Frontend.  (As proposed on cfe-dev.)

llvm-svn: 72060
2009-05-18 22:50:54 +00:00