Commit Graph

28 Commits

Author SHA1 Message Date
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