Commit Graph

115 Commits

Author SHA1 Message Date
Chris Lattner 3088a31e96 remove ASTContext::buildObjCInterfaceType, which breaks canonical
types.  It is no longer needed now that the code generator 
re-lays-out interfaces if they are defines after being laid out
from a forward decl.

llvm-svn: 68194
2009-04-01 06:23:52 +00:00
Douglas Gregor dc572a3266 Improve the representation of template names in the AST. This
representation handles the various ways in which one can name a
template, including unqualified references ("vector"), qualified
references ("std::vector"), and dependent template names
("MetaFun::template apply").

One immediate effect of this change is that the representation of
nested-name-specifiers in type names for class template
specializations (e.g., std::vector<int>) is more accurate. Rather than
representing std::vector<int> as

  std::(vector<int>)

we represent it as

  (std::vector)<int>

which more closely follows the C++ grammar. 

Additionally, templates are no longer represented as declarations
(DeclPtrTy) in Parse-Sema interactions. Instead, I've introduced a new
OpaquePtr type (TemplateTy) that holds the representation of a
TemplateName. This will simplify the handling of dependent
template-names, once we get there.

llvm-svn: 68074
2009-03-30 22:58:21 +00:00
Devang Patel afc1c1d405 Do not emit debug information for variables while generating optimized code. The llvm optimizer and code generator are not yet ready to support optimized code debugging.
llvm-svn: 67876
2009-03-27 23:16:32 +00:00
Chris Lattner 8c37df4f91 simplify some conditionals, don't copy LangOptions.
llvm-svn: 67674
2009-03-25 03:28:08 +00:00
Devang Patel 94406c954f Encode language.
llvm-svn: 67650
2009-03-24 20:35:51 +00:00
Devang Patel 9f804934df Fix ivar's size encoding.
llvm-svn: 67389
2009-03-20 18:24:39 +00:00
Devang Patel ec4bad5093 Encode ivar access control info.
llvm-svn: 67267
2009-03-19 00:23:53 +00:00
Douglas Gregor 5253768ada Introduce a representation for types that we referred to via a
qualified name, e.g., 

  foo::x

so that we retain the nested-name-specifier as written in the source
code and can reproduce that qualified name when printing the types
back (e.g., in diagnostics). This is PR3493, which won't be complete
until finished the other tasks mentioned near the end of this commit.

The parser's representation of nested-name-specifiers, CXXScopeSpec,
is now a bit fatter, because it needs to contain the scopes that
precede each '::' and keep track of whether the global scoping
operator '::' was at the beginning. For example, we need to keep track
of the leading '::', 'foo', and 'bar' in
 
  ::foo::bar::x

The Action's CXXScopeTy * is no longer a DeclContext *. It's now the
opaque version of the new NestedNameSpecifier, which contains a single
component of a nested-name-specifier (either a DeclContext * or a Type
*, bitmangled). 

The new sugar type QualifiedNameType composes a sequence of
NestedNameSpecifiers with a representation of the type we're actually
referring to. At present, we only build QualifiedNameType nodes within
Sema::getTypeName. This will be extended to other type-constructing
actions (e.g., ActOnClassTemplateId).

Also on the way: QualifiedDeclRefExprs will also store a sequence of
NestedNameSpecifiers, so that we can print out the property
nested-name-specifier. I expect to also use this for handling
dependent names like Fibonacci<I - 1>::value.

llvm-svn: 67265
2009-03-19 00:18:19 +00:00
Devang Patel bd93351c42 Fix struct field's debug info.
llvm-svn: 67062
2009-03-16 23:47:53 +00:00
Sebastian Redl 0f8b23f71f Almost complete implementation of rvalue references. One bug, and a few unclear areas. Maybe Doug can shed some light on some of the fixmes.
llvm-svn: 67059
2009-03-16 23:22:08 +00:00
Devang Patel c0f58ea60b Emit super class debug info.
llvm-svn: 66580
2009-03-10 21:30:26 +00:00
Devang Patel eed256da90 Set isMain bit for MainFile.
llvm-svn: 66120
2009-03-05 01:55:07 +00:00
Devang Patel 13dbe873bd Enable Objective-C interface debug info.
llvm-svn: 65850
2009-03-02 17:58:28 +00:00
Douglas Gregor 89ee6822d8 Eliminate CXXRecordType
llvm-svn: 65671
2009-02-28 01:32:25 +00:00
Eli Friedman 015a4742c1 Fix enumeration in switch warnings. No behavior change.
llvm-svn: 65659
2009-02-27 23:15:07 +00:00
Douglas Gregor deaad8cc34 Create a new TypeNodes.def file that enumerates all of the types,
giving them rough classifications (normal types, never-canonical
types, always-dependent types, abstract type representations) and
making it far easier to make sure that we've hit all of the cases when
decoding types. 

Switched some switch() statements on the type class over to using this
mechanism, and filtering out those things we don't care about. For
example, CodeGen should never see always-dependent or non-canonical
types, while debug info generation should never see always-dependent
types. More switch() statements on the type class need to be moved 
over to using this approach, so that we'll get warnings when we add a
new type then fail to account for it somewhere in the compiler.

As part of this, some types have been renamed:

  TypeOfExpr -> TypeOfExprType
  FunctionTypeProto -> FunctionProtoType
  FunctionTypeNoProto -> FunctionNoProtoType

There shouldn't be any functionality change...

llvm-svn: 65591
2009-02-26 23:50:07 +00:00
Devang Patel f4c205b2fa Add support to emit debug info for objective-c interfaces.
(This is not yet used.)

llvm-svn: 65573
2009-02-26 21:10:26 +00:00
Devang Patel 410dc00184 Fix comments.
llvm-svn: 65423
2009-02-25 01:36:11 +00:00
Devang Patel ab19ecad22 If Loc is invalid (e.g. "self" in Objective-C) then use MainFileID's compile unit.
llvm-svn: 65403
2009-02-24 23:16:03 +00:00
Fariborz Jahanian ece8582ca2 Renamed ASQualType to ExtQualType to reflect its more
general use; as for, objc2's gc type attributes. No
change in functionality.

llvm-svn: 64778
2009-02-17 18:27:45 +00:00
Daniel Dunbar d404862cf9 When making dummy file entries, the directory name should also be
non-empty.

llvm-svn: 63986
2009-02-07 00:40:41 +00:00
Chris Lattner 88ea93e6b4 lower the interface to getLineNumber like we did for
getColumnNumber.  This fixes a FIXME in 
SourceManager::getPresumedLoc because we now just decompose
the sloc once.

llvm-svn: 63701
2009-02-04 01:06:56 +00:00
Nuno Lopes bb537dc189 fix PR3427: fix debuginfo for incomplete array types
llvm-svn: 63158
2009-01-28 00:35:17 +00:00
Daniel Dunbar 56493b0d54 Allow creation of "dummy" compile units for debug information.
- Although gross, this is needed currently to ensure that we produce
   well formed debug information (to match pace with the assertions
   being added to DebugInfo in LLVM).

llvm-svn: 62734
2009-01-22 00:09:25 +00:00
Daniel Dunbar 9789e1ebcb Update for new SourceLocation API.
llvm-svn: 62556
2009-01-20 01:06:30 +00:00
Chris Lattner cbc35ecb04 Rename SourceManager::getCanonicalFileID -> getFileID. There is
no longer such thing as a non-canonical FileID.

llvm-svn: 62499
2009-01-19 07:46:45 +00:00
Chris Lattner f809bbdbb8 remove the SourceManager:: and FullSourceLoc::getFileEntryForLoc methods.
llvm-svn: 62496
2009-01-19 07:36:42 +00:00
Chris Lattner 8a42586c54 more SourceLocation lexicon change: instead of referring to the
"logical" location, refer to the "instantiation" location.

llvm-svn: 62316
2009-01-16 07:36:28 +00:00
Anders Carlsson d8cd7b6c34 Generate debug info for VLA types
llvm-svn: 61661
2009-01-05 01:23:29 +00:00
Douglas Gregor e029561346 Actually distinguish between RecordDecl::field_iterator and RecordDecl::field_const_iterator, propagating the constness down to the FieldDecls.
llvm-svn: 60883
2008-12-11 17:59:21 +00:00
Douglas Gregor 91f84216f7 Unifies the name-lookup mechanisms used in various parts of the AST
and separates lexical name lookup from qualified name lookup. In
particular:
  * Make DeclContext the central data structure for storing and
    looking up declarations within existing declarations, e.g., members
    of structs/unions/classes, enumerators in C++0x enums, members of
    C++ namespaces, and (later) members of Objective-C
    interfaces/implementations. DeclContext uses a lazily-constructed
    data structure optimized for fast lookup (array for small contexts,
    hash table for larger contexts). 

  * Implement C++ qualified name lookup in terms of lookup into
    DeclContext.

  * Implement C++ unqualified name lookup in terms of
    qualified+unqualified name lookup (since unqualified lookup is not
    purely lexical in C++!)

  * Limit the use of the chains of declarations stored in
    IdentifierInfo to those names declared lexically.

  * Eliminate CXXFieldDecl, collapsing its behavior into
    FieldDecl. (FieldDecl is now a ScopedDecl).

  * Make RecordDecl into a DeclContext and eliminates its
    Members/NumMembers fields (since one can just iterate through the
    DeclContext to get the fields).

llvm-svn: 60878
2008-12-11 16:49:14 +00:00
Anders Carlsson f7a9a92359 Convert incomplete array types before emitting debug info for them, fixes PR3134.
llvm-svn: 60109
2008-11-26 17:40:42 +00:00
Chris Lattner f3d3faeca6 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.

llvm-svn: 59947
2008-11-24 05:29:24 +00:00
Chris Lattner 86d7d91366 Rename NamedDecl::getIdentifierName() to ::getNameAsCString() and make it
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
2008-11-24 03:54:41 +00:00
Douglas Gregor 77324f3854 Introduction the DeclarationName class, as a single, general method of
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
2008-11-17 14:58:09 +00:00
Chris Lattner cd2523b41c implement debug info for typeof()
llvm-svn: 59032
2008-11-11 07:01:36 +00:00
Chris Lattner f61801403d Fix even more bugs in debug info support:
1. emit proper debug info for forward decls of structs.
2. emit DW_TAG_member nodes around members of a field like llvm-gcc does.

This slows down debug info generation, but is required for correctness.

llvm-svn: 58973
2008-11-10 06:10:01 +00:00
Chris Lattner affb37337f reimplement debug info generation in terms of DebugInfo.h instead of
using MachineModuleInfo.  This runs at about the same speed as the old
code, but fixes a bunch of bugs and is simpler and shorter.

llvm-svn: 58971
2008-11-10 06:08:34 +00:00
Daniel Dunbar 238475c8ca Avoid redundant cast<>s / simplify type dispatch.
llvm-svn: 58892
2008-11-08 06:12:46 +00:00
Daniel Dunbar 8ec8048f93 "Fix" PR3021, don't crash on generating record types when we can't
generate the type of a member.

llvm-svn: 58889
2008-11-08 04:42:29 +00:00
Daniel Dunbar cb4638599c Move IRBuilder type definition to common file.
- No functionality change.

llvm-svn: 58546
2008-11-01 01:53:16 +00:00
Daniel Dunbar 0c248e7ed8 Debug info: Bug fix, function types should always include the return
type.

llvm-svn: 58497
2008-10-31 08:12:03 +00:00
Daniel Dunbar d678ae2da3 Quick fix for PR2950, infinite loop generating debug info for
recursive types.
 - Style will be clean up in further patches.

llvm-svn: 58490
2008-10-31 04:04:54 +00:00
Daniel Dunbar a290ded36a Formatting tweaks.
- No functionality change.

llvm-svn: 58488
2008-10-31 03:54:29 +00:00
Daniel Dunbar dec8a89d37 Don't crash on invalid source locations in
CGDebugInfo::getOrCreateCompileUnit.

llvm-svn: 58081
2008-10-24 08:38:36 +00:00
Daniel Dunbar 607f67b16c Map compilation units using FileEntry pointers instead of
FileIDs. This seems better conceptually and lets the SourceManager
handle details of mapping the location to a file ID.
 - In practice, fixes an assert because this code wasn't using
   getPhysicalLoc.

llvm-svn: 58055
2008-10-24 00:46:51 +00:00
Daniel Dunbar 354d278518 Debug info bug fix, function start wasn't getting generated correctly
for Obj-C methods.

llvm-svn: 57769
2008-10-18 18:22:23 +00:00
Daniel Dunbar b9fd902fdc Change CGDebugInfo::setLocation to just ignore invalid locations. This
simplifies clients.

Also, add assert that RegionStack is empty when the CGDebugInfo is
destroyed.

llvm-svn: 57684
2008-10-17 16:15:48 +00:00
Daniel Dunbar 380827cfa1 Quick patch for PR2784, assert genereting debug info for opaque
structure.
 - I'm not sure yet about the behavior, but this at least prevents the
   crash.

Add some asserts on RegionStack usage.

llvm-svn: 57661
2008-10-17 01:07:56 +00:00
Daniel Dunbar 221fa94e40 More #include cleaning
- Drop Expr.h,RecordLayout.h from ASTContext.h (for DeclBase.h and
   SourceLocation.h)
 - Move ASTContext constructor into implementation

llvm-svn: 54627
2008-08-11 04:54:23 +00:00
Chris Lattner c893a67fe3 update to make IRBuilder API change.
llvm-svn: 54548
2008-08-08 19:57:58 +00:00
Chris Lattner 7adf076088 Finally fix PR2189. This makes a fairly invasive but important change to
move getAsArrayType into ASTContext instead of being a method on type.
This is required because getAsArrayType(const AT), where AT is a typedef
for "int[10]" needs to return ArrayType(const int, 10).

Fixing this greatly simplifies getArrayDecayedType, which is a good sign.

llvm-svn: 54317
2008-08-04 07:31:14 +00:00
Bill Wendling e7264ec999 Remove removed header.
llvm-svn: 53121
2008-07-03 22:54:30 +00:00
Cedric Venet 3903908794 Add missing include file (due to a file splitting in llvm).
Add new file to Sema Project for VS.
this unbreak the build for VS2005 (with the associated patch on llvm).

llvm-svn: 52830
2008-06-27 17:53:02 +00:00
Mike Stump d7667bd8e0 Remove tabs.
llvm-svn: 52507
2008-06-19 20:57:50 +00:00
Sanjiv Gupta 224e8ea2bb Generate debug descriptors for array types while generating the debug info.
llvm-svn: 52140
2008-06-09 10:47:41 +00:00
Nuno Lopes cc041ea68e fix compiler warnings
llvm-svn: 52089
2008-06-08 10:16:34 +00:00
Sanjiv Gupta 1929242a94 Create debug type descriptors for aggregate/enum types.
llvm-svn: 52070
2008-06-07 04:46:53 +00:00
Sanjiv Gupta 158143ad54 Emit debug information for global and static variables when -g is specified.
llvm-svn: 51993
2008-06-05 08:59:10 +00:00
Sanjiv Gupta 18de624ca0 Emit parameter and local variable debug information with -g.
llvm-svn: 51765
2008-05-30 10:30:31 +00:00
Eli Friedman b65ff27f53 A couple minor fixes to make debug info usable for arbitrary code: don't
emit incomplete types, because they crash llc, and always use the 
logical location as the current location so we don't crash doing invalid 
queries on CurLoc.

llvm-svn: 51675
2008-05-29 11:08:17 +00:00
Sanjiv Gupta 98070578bf Generate subprogram debug info with -g.
Also take care of freeing memory at the right places.

llvm-svn: 51553
2008-05-25 05:15:42 +00:00
Eli Friedman 1763075b9c Make debugging information usable. This is barebones, but it makes -g
actually work (instead of crashing llc), and there's enough info emitted 
to get line number information in gdb. This should hopefully be helpful 
for debugging non-working programs.

I got rid of the begin/endregion calls because the implementation wasn't 
working; someone who knows the debugging info a bit better might try to 
add it. I really have no clue how a compiler is supposed to emit them.

This commit shouldn't have any effect without -g.

llvm-svn: 51404
2008-05-22 01:40:10 +00:00
Eli Friedman 1a5754a26a Detabify.
llvm-svn: 51042
2008-05-13 14:40:48 +00:00
Sanjiv Gupta 15cb669039 Added -g command line options to clang for generating source level debug information. This patch currently enables generation of line number debug information (stoppoints) and region begin/end debug information. The new files CGDebugInfo.h and CGDebugInfo.cpp implements the debug info manager class CGDebugInfo.
llvm-svn: 50848
2008-05-08 08:54:20 +00:00