- Change enum name to Kind.
- Change enum constants to English strings.
Also, fix getPropertyImplementation (which probably should be renamed)
llvm-svn: 55354
-The Parser calls a new "ActOnCXXTypeConstructExpr" action.
-Sema, depending on the type and expressions number:
-If the type is a class, it will treat it as a class constructor. [TODO]
-If there's only one expression (i.e. "int(0.5)" ), creates a new "CXXFunctionalCastExpr" Expr node
-If there are no expressions (i.e "int()" ), creates a new "CXXZeroInitValueExpr" Expr node.
llvm-svn: 55177
testing compatibility. This is necessary for some constructs, like merging
redeclarations.
Also, there are some ObjC changes to make sure that
typesAreCompatible(a,b) == typesAreCompatible(b,a). I don't have any
ObjC code beyond the testsuite, so please tell me if there are any cases
where this doesn't behave as expected.
llvm-svn: 55158
- 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
- Drop {Decl.h,DeclObjC.h,IdentifierTable.h} from Expr.h
- Moved Sema::getCurMethodDecl() out of line (dependent on
ObjCMethodDecl via dyn_cast).
llvm-svn: 54629
Updated a few clients of DeclStmt::getNextDeclarator() to use decl_iterator instead. Will update other clients after additional testing.
llvm-svn: 54368
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
First, fix canonical type handling of these, since protocol qualified id's are always
canonical. Next, enhance SemaType to actually make these when used (instead of int)
allowing them to actually be used when appropriate. Finally remove a bunch of logic
relating to the mishandling of canonical types with protocol-qual id's. This fixes
rdar://5986251
llvm-svn: 54083
This change also fixes a subtle bug where the access control of an ivar would be initialized to garbage if we didn't have an explicit visibility specifier (e.g., @private).
llvm-svn: 53955
the standard "set these as the list of protocols" interface instead of a
strange "set this as the size and then set each one to the value" interface.
The problem with the later is that it a) is completely different from
everything else, b) is awkward, and c) doesn't handle the case when a
referenced protocol is invalid: it set it to null.
This meant that all clients downstream would have to handle null protocols
in the protocol list, and empirically they didn't. Fix this by not setting
invalid protocols in the referenced protocol list, fixing the crash on
test/Sema/objc-interface-1.m
While I'm at it, clean up some locations so that we produce:
t.m:1:25: error: cannot find interface declaration for 'NSObject', superclass of 'NSWhatever'
@interface NSWhatever : NSObject <NSCopying>
~~~~~~~~~~~~~~~~~~~~~ ^
instead of:
t.m:1:1: error: cannot find interface declaration for 'NSObject', superclass of 'NSWhatever'
@interface NSWhatever : NSObject <NSCopying>
^
llvm-svn: 53846
- Make sure ObjCIvarDecl propagates the bitfield width.
- RewriteObjC::SynthesizeIvarOffsetComputation(): Avoid using the __OFFSETOF__ mumbo jumbo for bitfields (since it isn't legal C). This fixes <rdar://problem/5986079> clang ObjC rewriter: bitfields and ivar access don't mix.
llvm-svn: 53694
also fix the correspondent test (it was expecting more errors than it should. please confirm my fix is correct (at least gcc agrees with me)
llvm-svn: 53174
1) add a new ASTContext::getFloatTypeSemantics method.
2) Use it from SemaExpr.cpp, CodeGenTypes.cpp and other places.
3) Change the TargetInfo.h get*Format methods to return their
fltSemantics byref instead of by pointer.
4) Change CodeGenFunction::EmitBuiltinExpr to allow builtins which
sometimes expand specially and othertimes fall back to libm.
5) Add support for __builtin_nan("") to codegen, cases that don't pass
in an empty string are currently lowered to libm calls.
6) Fix codegen of __builtin_infl.
llvm-svn: 52914
integers which have the same width and different signedness work
correctly. (The testcase in PR2501 uses a comparison between long and
unsigned int).
llvm-svn: 52853
clang as a Release build.
The big change is that all AST nodes (subclasses of Stmt) whose children are
Expr* store their children as Stmt* or arrays of Stmt*. This is to remove
strict-aliasing warnings when using StmtIterator. None of the interfaces of any
of the classes have changed (except those with arg_iterators, see below), as the
accessor methods introduce the needed casts (via cast<>). While this extra
casting may seem cumbersome, it actually adds some important sanity checks
throughout the codebase, as clients using StmtIterator can potentially overwrite
children that are expected to be Expr* with Stmt* (that aren't Expr*). The casts
provide extra sanity checks that are operational in debug builds to catch
invariant violations such as these.
For classes that have arg_iterators (e.g., CallExpr), the definition of
arg_iterator has been replaced. Instead of it being Expr**, it is an actual
class (called ExprIterator) that wraps a Stmt**, and provides the necessary
operators for iteration. The nice thing about this class is that it also uses
cast<> to type-checking, which introduces extra sanity checks throughout the
codebase that are useful for debugging.
A few of the CodeGen functions that use arg_iterator (especially from
OverloadExpr) have been modified to take begin and end iterators instead of a
base Expr** and the number of arguments. This matches more with the abstraction
of iteration. This still needs to be cleaned up a little bit, as clients expect
that ExprIterator is a RandomAccessIterator (which we may or may not wish to
allow for efficiency of representation).
This is a fairly large patch. It passes the tests (except CodeGen/bitfield.c,
which was already broken) on both a Debug and Release build, but it should
obviously be reviewed.
llvm-svn: 52378
have Destroy methods of ObjcMethodDecl and ObjCInterfaceDecl which recursively
destroy their owned Decls and Stmts. There are a few cases where it is not
clear what to do (FIXMEs included in the patch).
llvm-svn: 52050
In addition to fixing the crasher, this commit fixes further improves property lookup (by searching protocols of qualified interfaces..."NSObject <prot>").
llvm-svn: 52001
moves the check for the invalid construct to a point where it doesn't
affect other uses of isIntegerConstantExpr, and we can warn properly
when the extension is used. This makes it a bit more complicated, but
it's a lot cleaner.
Steve, please tell me if this check is sufficient to handle the
relevant system header. I know it's enough to handle the testcase, but
I don't know what exactly the original looks like.
llvm-svn: 51918
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>
llvm-svn: 51825
and union codepaths and fixes some minor bugs.
I'm reasonably confident this is accurate, at least for X86. I'll
correct any bugs as I find them; I haven't found any for a while,
though.
llvm-svn: 51762
While it is far from complete, it does fix the following <rdar://problem/5967199> clang on xcode: error: member reference is not to a structure or union
llvm-svn: 51719
encountered. Mixing up the decls is unintuitive, and confuses the AST
destruction code. Fixes PR2360.
Note that there is a need to look up the characteristics and
declarations of a function associated with a particular name or decl,
but the original swapping code doesn't solve it properly.
http://lists.cs.uiuc.edu/pipermail/cfe-dev/2008-May/001644.html is one
suggestion for how to fix that.
llvm-svn: 51584
lib/CodeGen/CGExpr.cpp and to change include/clang/AST/Attr.h to
use its own enum for visibility types instead of using
llvm::GlobalValue::VisibilityTypes. These changes eliminate
dependencies in the AST library on LLVM's VMCore library.
llvm-svn: 51398
Fixed a bug in ParmVarDecl::param_end(): Handle the case where there are no
ParmVarDecls for a FunctionDecl, but its function prototype has formal arguments
(can happen with typedefs).
llvm-svn: 51297
1) Sema::ParseAST now constructs a TranslationUnit object to own the top-level Decls, which releases the top-level Decls upon exiting ParseAST.
2) Bug fix: TranslationUnit::~TranslationUnit handles the case where a Decl is added more than once as a top-level Decl.
3) Decl::Destroy is now a virtual method, obviating the need for a special dispatch based on DeclKind.
3) FunctionDecl::Destroy now releases its Body using its Destroy method.
4) Added Stmt::Destroy and Stmt::DestroyChildren, which recursively delete the child ASTs of a Stmt and call their dstors. We may need to special case dstor/Destroy methods for particular Stmt subclasses that own other dynamically allocated objects besides AST nodes.
5) REGRESSION: We temporarily are not deallocating attributes; a FIXME is provided.
llvm-svn: 51286
expressing the full flexibility of the LLVM shufflevector instruction.
The expected immediate usage is in *mmintrin.h, so that they don't
depend on the mess of gcc-inherited (and not completely implemented)
shuffle builtins.
llvm-svn: 51113
ScopedDecl with the backpatcher, and *not* a local variable on the stack. The
value of DeclCtx gets filled in *later* by the backpatcher.
This fixes: http://llvm.org/bugs/show_bug.cgi?id=2308
llvm-svn: 50976
vector of the same element type and half the width, with the high, low, even,
and odd elements respectively.
Allow member references to member references, so that .hi.hi gives you the high
quarter of a vector. This is fairly convenient syntax for some insert/extract
operations.
Remove some unnecessary methods/types in the ExtVectorElementExpr class.
llvm-svn: 50892
std::pair<CFGBlock*, CFGBlock*> that have an 8-byte alignment for use with
ProgramPoint. This fixes a bug reported by Argiris where using std::set<> on
Windows would result in a 4-byte alignment, not an 8-byte alignment.
Fixes: <rdar://problem/5892265>
llvm-svn: 50364
-NamespaceDecl for the AST
-Checks for name clashes between namespaces and tag/normal declarations.
This commit doesn't implement proper name lookup for namespaces.
llvm-svn: 50321
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.
llvm-svn: 50149
DeclContext *CtxDecl -> DeclContext *DeclCtx
DeclContext *CD -> DeclContext *DC
It makes the code more consistent."
Patch by Zhongxing Xu!
llvm-svn: 50105
Added iterators, methods to find property and categories.
Use them in doing semantic analysis on property implementation
declarations. Fixed typos.
llvm-svn: 50050
Added assertion if unexpected property decls are found where they don't belong.
Consolidated property decl. printing by using a helper function.
llvm-svn: 49862
-Added TranslationUnitDecl class to serve as top declaration context
-ASTContext gets a TUDecl member and a getTranslationUnitDecl() function
-All ScopedDecls get the TUDecl as DeclContext when declared at global scope
llvm-svn: 49855
Refactored LiveVariables to use getTerminatorCondition() in VisitTerminator().
Bug fix: CFG now computes Block-level expression numbers using information
from block terminators. This fixes <rdar://problem/5868189>.
llvm-svn: 49818
This is a fairly mechanical/large change. As a result, I avoided making any changes/simplifications that weren't directly related. I did break two Analysis tests. I also have a couple FIXME's in UninitializedValues.cpp. Ted, can you take a look? If the bug isn't obvious, I am happy to dig in and fix it (since I broke it).
llvm-svn: 49748
allows the parsing of "class" in addition to "struct" and "union" to
declare a record. So this patch allows:
class C { };
class C c1;
But it does not contain the lookup bits, so this won't work yet:
C c2;
Patch by Doug Gregor!
llvm-svn: 49613
While it is similar to the other compatibility predicates in ASTContext,
it is not used by them and is different.
In addition, greatly simplify ObjCQualifiedIdTypesAreCompatible and
fix some canonical type bugs. Also, simplify my Type::getAsObjC* methods.
llvm-svn: 49313
sema. This allows clients of the parser to have the unmolested
list if desired, and guarantees that noone can create an
ObjCQualifiedInterfaceType with an unsorted list.
llvm-svn: 49310
#1: To be consistent with FieldDecl::getContextDecl(), which serves the same purpose.
#2: From my perspective, getContext() is too general (and used by several other classes for different purposes).
llvm-svn: 49224
-Added ContextDecl (no TranslationUnitDecl)
-ScopedDecl class has a ContextDecl member
-FieldDecl class has a ContextDecl member, so that a Field or a ObjCIvar can be traced back to their RecordDecl/ObjCInterfaceDecl easily
-FunctionDecl, ObjCMethodDecl, TagDecl, ObjCInterfaceDecl inherit from ContextDecl. With TagDecl as ContextDecl, enum constants have a EnumDecl as their context.
-Moved Decl class to a "DeclBase.h" along with ContextDecl class
-CurContext is handled by Sema
llvm-svn: 49208
First, we got several CVR propagation cases wrong, which Eli pointed
out in PR2039.
Second, we didn't propagate address space qualifiers correctly, leading
to incorrect lowering of code in CodeGen/address-space.c.
Third, we didn't uniformly propagate the specifier in the array to the
pointer ("int[restrict 4]" -> "int *restrict").
This adds an ASTContext::getArrayDecayedType member that handles the
non-trivial logic for this seemingly simple operation.
llvm-svn: 49078
- Added a DenseMap to associate an IdentifierInfo with the ObjCCompatibleAliasDecl.
- Renamed LookupScopedDecl->LookupDecl and changed it's return type to Decl. Also added lookup for ObjCCompatibleAliasDecl's.
- Removed Sema::LookupInterfaceDecl(). Converted clients to used LookupDecl().
- Some minor indentation changes.
Will deal with ObjCInterfaceDecl and getObjCInterfaceDecl() in a separate commit...
llvm-svn: 49058
Fix objc ivar lookup. Ivar lookup should occur between lookup
of method-local values and lookup of globals. Emulate this with
some logic in the handling of Sema::ActOnIdentifierExpr.
Two todo's left:
1) sema shouldn't turn a bare reference to an ivar into "self->ivar"
in the AST. This is a hack.
2) The new ScopedDecl::isDefinedOutsideFunctionOrMethod method does
not correctly handle typedefs and enum constants yet.
llvm-svn: 48972
specified. Previously, the ctor would allocate memory for the list and then
it would get filled in later. Move the allocation+filling in to be more
consistent with other stuff, e.g. the addMethods method.
llvm-svn: 48427
lib dir and move all the libraries into it. This follows the main
llvm tree, and allows the libraries to be built in parallel. The
top level now enforces that all the libs are built before Driver,
but we don't care what order the libs are built in. This speeds
up parallel builds, particularly incremental ones.
llvm-svn: 48402