Граф коммитов

138 Коммитов

Автор SHA1 Сообщение Дата
Douglas Gregor 074149e11b Introduce support for "transparent" DeclContexts, which are
DeclContexts whose members are visible from enclosing DeclContexts up
to (and including) the innermost enclosing non-transparent
DeclContexts. Transparent DeclContexts unify the mechanism to be used
for various language features, including C enumerations, anonymous
unions, C++0x inline namespaces, and C++ linkage
specifications. Please refer to the documentation in the Clang
internals manual for more information.

Only enumerations and linkage specifications currently use transparent
DeclContexts.

Still to do: use transparent DeclContexts to implement anonymous
unions and GCC's anonymous structs extension, and, later, the C++0x
features. We also need to tighten up the DeclContext/ScopedDecl link
to ensure that every ScopedDecl is in a single DeclContext, which
will ensure that we can then enforce ownership and reduce the memory
footprint of DeclContext.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61735 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-05 19:45:36 +00:00
Douglas Gregor 45579f5e29 Make sure that enumerators show up within the enumeration declaration. Fixes. PR clang/3220
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61116 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-17 02:04:30 +00:00
Douglas Gregor f44515a49b Make linkage-specifications hold on to all of their declarations
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61110 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-16 22:23:02 +00:00
Eli Friedman f595eb04a7 Fix crash with -ast-dump in C++.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61108 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-16 22:14:15 +00:00
Chris Lattner d9d22dd9c9 Rename NamedDecl::getName() to getNameAsString(). Replace a bunch of
uses of getName() with uses of getDeclName().  This upgrades a bunch of
diags to take DeclNames instead of std::strings.

This also tweaks a couple of diagnostics to be cleaner and changes
CheckInitializerTypes/PerformInitializationByConstructor to pass
around DeclarationNames instead of std::strings.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59947 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-24 05:29:24 +00:00
Chris Lattner 077bf5e2f4 Rename Selector::getName() to Selector::getAsString(), and add
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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59933 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-24 03:33:13 +00:00
Ted Kremenek ad99dbfc1d Rename 'HTMLDiagnostics.h' to 'PathDiagnosticClients.h'
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58646 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-03 22:31:48 +00:00
Douglas Gregor 1f81230ac5 Move viewInheritance to CXXRecordDecl, and make sure it builds in Release mode, too
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58105 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-24 19:53:54 +00:00
Ted Kremenek 7cae2f64a7 Added driver option "-cxx-inheritance-view" for viewing the C++ hierarchy of a class in GraphViz.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58051 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-23 23:36:29 +00:00
Daniel Dunbar d46075f8c3 Commito, didn't mean to remove this header.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57938 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-21 23:54:00 +00:00
Daniel Dunbar d69bacc399 [LLVM up] Add basic -S option to clang.
- Split backend related consumer out into Backend.cpp, replaces
   LLVMCodeGenWriter.
 - Structure follows llvm-gcc to some extent.
 - Still need to implement all the options which impact code
   generation and the optimization passes which llvm-gcc uses at
   various levels.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57936 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-21 23:49:24 +00:00
Daniel Dunbar 539ced1fdd Add dummy -ast-dump support for ObjC category implementations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57087 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-05 00:31:15 +00:00
Ted Kremenek a95d375044 Patch by Csaba Hruska!
"Here is a patch what replaces std::ostream with llvm::raw_ostream. This patch
covers the AST library, but ignores Analysis lib."


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56185 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-13 05:16:45 +00:00
Daniel Dunbar 9f0afd4e79 Rename ObjCPropertyImplDecl::PropertyImplKind (consistency)
- Change enum name to Kind.
 - Change enum constants to English strings.

Also, fix getPropertyImplementation (which probably should be renamed)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55354 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-26 04:47:31 +00:00
Zhongxing Xu 8148839c10 Moved HTMLDiagnostics to lib/Driver.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55274 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-24 02:33:36 +00:00
Chris Lattner 405674c26c adjust to changes in various APIs from LLVM. We can't print
an APInt directly to an ostream now, so add some hacks.  It would
be better to switch all of the bugreport (and friends) stuff over
to raw_ostream.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55264 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-23 22:23:37 +00:00
Chris Lattner efe8a96f59 improve pretty printing of objc method declaration,
patch contributed by Benjamin Stiglitz!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55170 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-22 06:59:15 +00:00
Nico Weber be1eb5c919 Do not crash with -serialize.
This happened because seralization was done in the constructor, and at that time the TranslationUnit is no longer valid.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54618 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-10 19:20:05 +00:00
Nico Weber dae86966bb do not serialize invalid asts. this fixes bug #2637
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54590 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-09 18:32:11 +00:00
Matthijs Kooijman 992a8786f2 Let LLVMCodeGenWriter forward all the methods defined in ASTConsumer, to
prevent unexpected surprises later on.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54469 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-07 16:04:15 +00:00
Ted Kremenek 815c78fd9a Refactored driver logic for CodeGen into LLVMCodeGenWriter. This ASTConsumer layers on top of LLVMCodeGen (another existing ASTConsumer) to emit bitcode files to disk. This layering takes this logic out of clang.cpp and puts it directly into the ASTConsumer interface. The benefit is that now --emit-llvm works with both serialized ASTs and regular source files.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54364 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-05 18:50:11 +00:00
Chris Lattner 3db6cae19c introduce a new ObjCList templated class and start moving
various objc lists over to it.  First up, the protocol list 
on ObjCInterfaceDecl.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53856 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-21 18:19:38 +00:00
Ted Kremenek 902141f74a Moved logic for -dump-cfg and -view-cfg into AnalysisConsumer.
Renamed -dump-cfg to -cfg-dump, and -view-cfg to -cfg-view.  This naming better matches the same options for asts (e.g. -ast-dump).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53041 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-02 18:23:21 +00:00
Ted Kremenek 235e031e84 Move -dump-live-variables logic to AnalysisConsumer.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53039 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-02 18:11:29 +00:00
Ted Kremenek 34d7734b6e Migrate CheckerConsumer diagnostics to the new AnalysisConsumer interface.
Remove CheckerConsumer.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53029 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-02 16:49:11 +00:00
Ted Kremenek bc46f34583 Move logic for "-checker-simple" to the new AnalysisConsumer interface.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53028 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-02 16:35:50 +00:00
Ted Kremenek b35a74a40c Migrated driver logic for running the CF retain/release checker over to the new AnalysisConsumer interface.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53002 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-02 00:44:58 +00:00
Ted Kremenek f4381fddf1 Added AnalysisConsumer, a meta-level ASTConsumer class to drive various
analyses. This potentially is the primordial origins of a Clang-equivalent
"PassManager".

The new AnalysisConsumer interface allows multiple analyses to be run from a
single invocation of Clang.

Migrated the logic of "-warn-dead-stores" and "-warn-uninit-values" to use the
new AnalysisConsumer interface. The new interface results in a significant code
reduction to incorporate an analysis into the Driver.

Updated a test case to (correctly) acknowledge that it contains a dead store
(this check wasn't being performed because it was previously masked by
-warn-uninit-values).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52996 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-02 00:03:09 +00:00
Chris Lattner 23a0e45540 Implement printing for ObjCClassDecl's, patch by Jean-Daniel Dupas!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52598 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-21 21:40:20 +00:00
Ted Kremenek 354840eec2 Updated call to dead stores to use proper arguments.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52560 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-20 21:55:29 +00:00
Eli Friedman d8a65c16bb Get -serialize working again, plus a bit of minor cleanup.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52152 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-09 20:02:51 +00:00
Ted Kremenek e7d07d1136 Moved LangOptions from TranslationUnit to ASTContext. This induced a variety of cleanups in some ASTConsumers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51943 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-04 15:55:15 +00:00
Ted Kremenek e3a6198400 Added "InitializeTU" to ASTConsumer. This is used by Sema::ParseAST to pass a
TranslationUnit object instead of an ASTContext. By default it calls
Initialize(ASTConstext& Context) (to match with the current interface used by
most ASTConsumers).

Modified the ObjC-Rewriter to use InitializeTU, and to tell the TranslationUnit
to not free its Decls.  This is a workaround for: <rdar://problem/5966749>


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51825 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-31 20:11:04 +00:00
Eli Friedman 9b5239339d Fix crash with -serialize (reported to cfe-dev). The issue was
essentially that we were destroying the declarations twice.

(Note that we don't use -serialize directly in the testsuite, only 
SerializeTest.)



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51768 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-30 11:28:30 +00:00
Steve Naroff 1a2b90d081 Make sure method definitions get output with -ast-dump.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51494 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-23 18:50:58 +00:00
Fariborz Jahanian 33de3f0333 This patch introduces declaration of getter methods for ObjC2's
properties. Couple of property tests will fail with this patch.
Will fix them next.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50818 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-07 17:43:59 +00:00
Fariborz Jahanian b89ca237a7 Print ObjC methods of ObjC classes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50779 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-06 23:14:25 +00:00
Fariborz Jahanian 5251e130a2 Patch to refactor setter/getter names of property attributes into Selector
(was IdentifierInfo * before). This will make method declartations whole
lot easier.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50747 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-06 18:09:04 +00:00
Fariborz Jahanian 46b55e56d0 percolate @optional/@required protocols down to ASTs for
properties declared in the protocol.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50662 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-05 18:51:55 +00:00
Ted Kremenek 9f7416138b When running the reference count checker twice (GC and non-GC mode), only emit
basic warnings (dead stores, null dereferences) on the first pass.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50584 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-02 18:01:49 +00:00
Ted Kremenek 072192bcbb added preliminary diagnostics in scan-build results to denote whether
a CF memory leak occurred with GC enabled, etc.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50507 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-30 23:47:44 +00:00
Ted Kremenek e5c30122ca Provide the option to run the CF-retain checker in GC enabled mode.
The transfer functions for the checker don't do anything special yet in GC mode.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50394 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-29 05:13:59 +00:00
Ted Kremenek c1e9dea3d9 TranslationUnit now owns IdentifierTable, TargetInfo, and Selectors objects
when it is constructed via deserialization.  This is done by recording a flag
indicating that this is the case, and it deletes these objects by getting
the references stored in the ASTContext object.  This fixes some memory
leaks that occurs when we deserialize translation units from bitcode files.

The rationale between having TranslationUnit sometimes own these objects and
sometimes not is that a TranslationUnit object can be constructed from
state generated by the parser (Preprocessor; semantic analyzer, etc.), and thus
in these cases won't own the IdentifierTable or Selectors, etc.  During
deserialization, there is no Preprocessor, so somebody needs to own these
objects in order for them to be properly reclaimed.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50149 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-23 16:25:39 +00:00
Fariborz Jahanian 628b96f34e Patch to build AST for property implementation declarations and
to print declaration from its AST.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50117 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-23 00:06:01 +00:00
Ted Kremenek 339b9c2775 class Preprocessor: Now owns the "predefines" char*; it deletes [] it in its dstor.
clang.cpp: InitializePreprocessor now makes a copy of the contents of PredefinesBuffer and
  passes it to the preprocessor object.
  
clang.cpp: DriverPreprocessorFactory now calls "InitializePreprocessor" instead of this being done in main().

html::HighlightMacros() now takes a PreprocessorFactory, allowing it to conjure up a new
Preprocessor to highlight macros.

class HTMLDiagnostics now takes a PreprocessorFactory* that it can use for html::HighlightMacros().
Updated clients of HTMLDiagnostics to use this new interface.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49875 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-17 22:31:54 +00:00
Fariborz Jahanian 3dd4ba4068 Added property decl support for protocols.
Added assertion if unexpected property decls are found where they don't belong.
Consolidated property decl. printing by using a helper function.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49862 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-17 18:25:18 +00:00
Fariborz Jahanian 7e7e3872b5 This patch adds support for declaraing properties in categories,
just as they are declared in objc classes.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49817 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-16 21:08:45 +00:00
Ted Kremenek 47abe76904 Hook up HTMLDiagnostics to use Chris's new syntax highlighting. --html-diags
currently doesn't pass in the Preprocessor from the driver, so we don't get
syntax highlighting when we create HTMLDiagnostics in that way.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49796 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-16 16:39:56 +00:00
Ted Kremenek 24bd3c4484 Handle "__private_extern__" storage class when printing FunctionDecls.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49706 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-15 03:57:09 +00:00
Fariborz Jahanian 1de1e74541 New AST representation for each objc2's property declaration.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49699 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-14 23:36:35 +00:00