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

1153 Коммитов

Автор SHA1 Сообщение Дата
Douglas Gregor e0a5d5fe8e Move Sema::GetNonReferenceType to QualType::getNonReferenceType and make it inline
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57951 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-22 04:14:44 +00:00
Douglas Gregor 9b6e2d209c Fix a thinko in the qualification-conversion check when the qualificaitons are disjoint, and add some overloading-based tests of qualification conversions
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57942 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-22 00:38:21 +00:00
Douglas Gregor 98cd599ee8 Initial step toward supporting qualification conversions (C++ 4.4).
Changes:
  - Sema::IsQualificationConversion determines whether we have a qualification
    conversion.
  - Sema::CheckSingleAssignment constraints now follows the C++ rules in C++,
    performing an implicit conversion from the right-hand side to the type of
    the left-hand side rather than checking based on the C notion of 
    "compatibility". We now rely on the implicit-conversion code to
    determine whether the conversion can happen or
    not. Sema::TryCopyInitialization has an ugly reference-related
    hack to cope with the initialization of references, for now.
  - When building DeclRefExprs, strip away the reference type, since
    there are no expressions whose type is a reference. We'll need to
    do this throughout Sema.
  - Expr::isLvalue now permits functions to be lvalues in C++ (but not
  in C).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57935 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-21 23:43:52 +00:00
Douglas Gregor 8e9bebdea6 Preliminary support for function overloading
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57909 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-21 16:13:35 +00:00
Argyrios Kyrtzidis 509447e7cb Change a couple of cast<> to reinterpret_cast<>.
The casts<> require that "Decl.h" is included before "Type.h", use reinterpret_cast<> to remove that kind of dependency.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57781 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-19 12:05:48 +00:00
Mon P Wang 7ae48ee2fb Make llvm memory barrier available as an intrinsic
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57751 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-18 02:49:28 +00:00
Daniel Dunbar 0d504c1da8 Remove unneeded EncodingRecordTypes argument to getObjCEncodingForType.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57716 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-17 20:21:44 +00:00
Mon P Wang 6d5e211fc5 Fixed vec_set_v2di signature
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57696 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-17 17:39:34 +00:00
Daniel Dunbar d96b35bc6b More Obj-C type encoding improvements.
- Encode unions and bit-fields correctly.
 - Accept option to name record fields (used for NeXT runtime).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57685 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-17 16:17:37 +00:00
Daniel Dunbar 82a6cfbc42 Fix bug in Obj-C type encoding for structures.
- Mechanism for detecting if a structure should be expanded wasn't
   reliable. Simplified by just keeping track of what we should be
   expanding.

 - This fixes a bug in using NSInvocation to invoke a method which
   returned a structure, which in used by Key Value Observing, which
   in the end, caused a miscompile in poor little Sketch.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57675 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-17 07:30:50 +00:00
Daniel Dunbar 3b0db908eb Implement #pragma pack use in structure packing. The general approach
is to encode the state of the #pragma pack stack as an attribute when
the structure is declared. 

 - Extend PackedAttr to take an alignment (in bits), and reuse for
   both __attribute__((packed)) (which takes no argument, instead
   packing tightly (to "minimize the memory required") and for #pragma
   pack (which allows specification of the maximum alignment in
   bytes). __attribute__((packed)) is just encoded as Alignment=1.

   This conflates two related but different mechanisms, but it didn't
   seem worth another attribute.

 - I have attempted to follow the MSVC semantics as opposed to the gcc
   ones, since if I understand correctly #pragma pack originated with
   MSVC. The semantics are generally equivalent except when the stack
   is altered during the definition of a structure; its not clear if
   anyone does this in practice. See testcase if curious.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57623 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-16 02:34:03 +00:00
Daniel Dunbar 20c77e995d Use BatchEmitOwnedPtrs for writing multiple child exprs, per review.
Also added serialization support to OverloadExpr.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57588 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-15 17:52:29 +00:00
Mon P Wang bc4f4030e2 Added pinsrd, pinsrq, and some other vector intrinsics
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57563 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-15 06:18:34 +00:00
Argyrios Kyrtzidis 35bc0821c4 Simplify handling of struct/union/class tags.
Instead of using two sets of Decl kinds (Struct/Union/Class and CXXStruct/CXXUnion/CXXClass), use one 'Record' and one 'CXXRecord' Decl kind and make tag kind a property of TagDecl.
Cleans up the code a bit and better reflects that Decl class structure.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57541 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-15 00:42:39 +00:00
Daniel Dunbar d17c24ff85 Add serialization support in several missing places.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57502 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-14 16:57:09 +00:00
Daniel Dunbar 708ef456a1 Move Type::EmitImpl into header, add FIXME to make abstract.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57501 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-14 16:55:17 +00:00
Argyrios Kyrtzidis e2ed203b43 More const-ness goodness.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57420 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-12 18:45:56 +00:00
Argyrios Kyrtzidis d2595ecce5 Improve the const-ness of a few methods.
No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57417 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-12 18:40:01 +00:00
Argyrios Kyrtzidis 42220c5432 Implement more efficient Decl <-> DeclContext conversions.
When the static type on the Decl side is a subclass of DeclContext the compiler will use a "inlinable" static_cast, instead of always using an out-of-line function call.

Note, though, that the isa<> check still uses an out-of-line function call.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57415 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-12 16:14:48 +00:00
Steve Naroff 090276f5e1 Final phase of converting BlockDecls over to DeclContext. This is unfortunately a largish/complex diff, however it was necessry to pass all the current block tests.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57337 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-10 01:28:17 +00:00
Steve Naroff 1c90bfcbd7 Instantiate the BlockDecl in ActOnBlockStart() so we can use it as a DeclContext.
This required changes to attach the compound statement later on (like we do for functions).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57304 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-08 18:44:00 +00:00
Steve Naroff 56ee6896f2 - Add BlockDecl AST node.
- Modify BlockExpr to reference the BlockDecl.

This is "cleanup" necessary to improve our lookup semantics for blocks (to fix <rdar://problem/6272905> clang block rewriter: parameter to function not imported into block?).

Still some follow-up work to finish this (forthcoming).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57298 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-08 17:01:13 +00:00
Ted Kremenek 8ffb159441 Migrate DeclStmt over to using a DeclGroup instead of a pointer to a ScopedDecl*.
This also removes the ugly hack needed in CFG.cpp for subclassing DeclStmt to create a DeclStmt with one Decl*.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57275 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-07 23:09:49 +00:00
Ted Kremenek 401adfad4a Add const_iterator to DeclGroup.
Serialization for OwningDeclGroupRefs now works.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57272 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-07 23:06:01 +00:00
Ted Kremenek 3e6d1203b3 Add StmtIterator support for DeclGroups.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57271 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-07 23:04:14 +00:00
Ted Kremenek c7b07c19da Added prototype serialization code for DeclGroup.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57222 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-06 23:49:24 +00:00
Argyrios Kyrtzidis ce8e2926d8 Simplify handling of direct initializers by letting Sema::AddInitializerToDecl handle conversions, instead of using Sema::ActOnCXXTypeConstructExpr.
Additional benefit is that diagnostics are the same for both direct-initialization and copy-initialization.

In the case of "int x( expression );":
-The Init expression of VarDecl 'x' will be the expression inside the parentheses.
-VarDecl::hasCXXDirectInitializer for VarDecl 'x' will return true to let clients distinguish from "int x = expression ;".

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57219 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-06 23:08:37 +00:00
Ted Kremenek 655137a6c1 Remove DeclStmt::getDecl(). Now clients of DeclStmt must explicitly reason about a DeclStmt referring to a collection of Decls.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57217 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-06 22:51:42 +00:00
Ted Kremenek e285a9505c Modified DeclGroupRef to always load/store the internal pointer value as Decl*. This hopefully will obviate any concerns with violating strict type-aliasing issues.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57213 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-06 22:17:16 +00:00
Ted Kremenek 65aa3b9fda Add DeclStmt::hasSolitaryDecl() and DeclStmt::getSolitaryDecl()
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57204 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-06 20:54:44 +00:00
Ted Kremenek 8a0d2660b6 Add const_decl_iterator to DecStmt.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57186 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-06 18:35:55 +00:00
Argyrios Kyrtzidis 73a0d889ed Implement support for C++ direct initializers in declarations, e.g. "int x(1);".
This is how this kind of initializers appear in the AST:
-The Init expression of the VarDecl is a functional type construction (of the VarDecl's type).
-The new VarDecl::hasCXXDirectInitializer() returns true.

e.g, for "int x(1);":
-VarDecl 'x' has Init with expression "int(1)" (CXXFunctionalCastExpr).
-hasCXXDirectInitializer() of VarDecl 'x' returns true.

A major benefit is that clients that don't particularly care about which exactly form was the initializer can handle both cases without special case code.
Note that codegening works now for "int x(1);" without any changes to CodeGen.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57178 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-06 17:10:33 +00:00
Chris Lattner 6b47561af7 Remove the 'C' / isConstantExpr flag on builtins. Code should never
depend on the value of this flag, it should depend on whether 
tryEvaluate is able to *actually* fold a builtin.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57160 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-06 06:51:12 +00:00
Chris Lattner 45b6b9d080 Add a Expr::isEvaluatable method, eliminate isBuiltinConstantExpr
which is checking for something that can be inconsistent with
what we can constant fold.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57159 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-06 06:49:02 +00:00
Chris Lattner a4d55d89c8 Move folding of __builtin_classify_type out of the CallExpr
interface into the constant folding interface.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57158 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-06 06:40:35 +00:00
Chris Lattner 019f4e858e Add a comment that describes tryEvaluate. Make tryEvaluate fold
__builtin_constant_p properly, and add some scaffolding for
FloatExprEvaluator to eventually handle huge_val and inf.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57152 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-06 05:28:25 +00:00
Chris Lattner cb88896740 add a new CallExpr::isBuiltinCall() method, and use it to simplify some existing
code.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57151 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-06 05:00:53 +00:00
Anders Carlsson 232eb7d33b Implement support for the const and pure attributes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57142 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-05 23:32:53 +00:00
Chris Lattner 8223b1d05f Fix a problem reported in PR2766 that makes clang reject old versions
of GCC's headers.  This impacts people that run clang in Tiger systems.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57126 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-05 19:05:44 +00:00
Daniel Dunbar affc3a9bfa Fix X86 palignr[128] builtins to match LLVM.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57102 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-05 06:35:41 +00:00
Daniel Dunbar ec04b2622a Fix another X86 builtin definitions.
- vec_set_v4hi had "v4s" in place of "V4s"


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57099 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-05 05:21:00 +00:00
Daniel Dunbar 1827db7711 Fix some X86 builtin definitions.
- cmp instructions return int
 - storedqu had bad const qualifier
 - pmuldq128 used invalid type code


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57098 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-05 05:14:37 +00:00
Steve Naroff 83ba14e260 - Add a convenience constructor to Type.
- Many rewriter modifications.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57003 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-03 15:04:50 +00:00
Steve Naroff 0eb07bfde0 Add getTypeSpecStartLoc() to VarDecls and FunctionDecls.
This is a temporary solution to help with the block rewriter (though it certainly has general utility).
Once DeclGroup's are implemented, this SourceLocation should be stored with it (since it applies to all the decls).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56985 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-03 00:02:03 +00:00
Daniel Dunbar ae3f4919e4 Add Builtins.def attribute for "can be a constant expression".
- Enabled for builtins which are always constant expressions
   (__builtin_huge_val*, __builtin_inf*, __builtin_constant_p,
   __builtin_classify_type, __builtin___CFStringMakeConstantString).

Added Builtin::Context::isConstantExpr.
 - Currently overly simply interface which only works for builtins
   whose constantexprness does not depend on their arguments.

CallExpr::isBuiltinConstantExpr now takes an ASTContext argument.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56983 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-02 23:30:31 +00:00
Mon P Wang 946685626e Added SSE4.1 blend intrinsics
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56936 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-01 23:08:39 +00:00
Mon P Wang 7f57b000f2 Added support for sse intrinsics loadlpd, loadhpd, muldq128, and mulld128
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56830 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-30 05:31:27 +00:00
Chris Lattner a09f585a7f move ExtVectorElementExpr down into the 'clang extensions' section.
Wrap line to 80 cols.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56805 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-29 21:30:29 +00:00
Chris Lattner bd7eb1c3b2 Replace a comparison with a static list of builtins that was wrong (it
wasn't covering checking builtins like __builtin___vsnprintf_chk) with
a check that won't get out of date. 


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56767 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-28 05:54:29 +00:00
Ted Kremenek 9da13f9ddb Internally store the body of a BlockExpr using a Stmt* instead of a CompoundStmt*, and use the getBody() method to do the appropriate checking. This both removes the type-punning warnings in Expr.cpp and also makes BlockExpr have more consistency checks against modifications to its body (via StmtIterator).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56710 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-26 23:24:14 +00:00
Ted Kremenek e7b8d40020 Forgot to check in header file with last commit.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56709 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-26 23:24:05 +00:00
Steve Naroff 4f6a7d7ead Tweak Expr::isModifiableLvalue() and Expr::isLvalue() to better deal with BlockDeclRef exprs.
This fixes <rdar://problem/6248392> clang: Error when using address of stack variable inside block.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56652 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-26 14:41:28 +00:00
Ted Kremenek d17062cc23 Added prototype implementation of the DeclGroup, DeclGroupRef, and DeclGroupOwningRef classes.
Documentation and testing are pending.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56611 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-25 17:13:40 +00:00
Steve Naroff 9eae5761c0 Finish pushing blocks attribute through the clang attribute machinery.
Also added a couple simple tests from the "gcc.apple" test suite.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56309 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-18 16:44:58 +00:00
Steve Naroff 9c3c902835 Remove BlockStmtExpr.
Block literals are now represented by the concrete BlockExpr class.
This is cleanup (removes a FIXME).
No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56288 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-17 18:37:59 +00:00
Steve Naroff 17dab4f616 Remove support for BlockExprExpr. For example...
^(expression) or ^(int arg1, float arg2)(expression)
...is no longer supported. 
All block literals now require a compound statement.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56257 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-16 23:11:46 +00:00
Ted Kremenek d452758bb6 ProgramPoint now takes the space of two pointers instead of one. This change was
motivated because it became clear that the number of subclasses of ProgramPoint
would expand and we ran out of bits to represent a pointer variant. As a plus of
this change, BlockEdge program points can now be represented explicitly without
using a cache of CFGBlock* pairs in CFG.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56245 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-16 18:44:52 +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 df3ffb300a Round out object size checking builtins (fprintf ones disabled as we
have no mapping to FILE*). We are also missing printf format
attributes for the printf style ones.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56168 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-12 18:39:42 +00:00
Douglas Gregor 77a52233f7 Give string literals const element typesin C++, and cope with the deprecated C++ conversion from a string literal to a pointer-to-non-const-character
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56137 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-12 00:47:35 +00:00
Mon P Wang 3e877ec791 Added SSE41 pminsd, pmaxsd, roundps and a few others
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56114 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-11 19:22:31 +00:00
Daniel Dunbar 9776ba0d84 Add ObjCMethodDecl::getSourceRange.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56083 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-11 00:47:15 +00:00
Argyrios Kyrtzidis 9e922b1663 Add new 'CXXConditionDeclExpr' expression node used for a 'condition' declaration, e.g: "if (int x=0) {...}".
It is a subclass of DeclRefExpr and the main difference is that CXXConditionDeclExpr owns the declaration that it references.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56033 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-09 23:47:53 +00:00
Mon P Wang e01c2c9e07 Added SSE4.1 packusdw
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55978 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-09 02:49:09 +00:00
Mon P Wang f47be933be Added SSE41 pmovsx pmovzx intrinsics
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55967 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-09 00:19:01 +00:00
Daniel Dunbar 6f0200e9eb Add ThreadSpecified bit to Decl.
- Patch from Kevin Tew.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55940 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-08 20:05:47 +00:00
Ted Kremenek 4b7c98378a Change struct forward declarations and definitions to use unique RecordDecls, as opposed to creating a single RecordDecl and reusing it.
This change effects both RecordDecls and CXXRecordDecls, but does not effect EnumDecls (yet).

The motivation of this patch is as follows:
- Capture more source information, necessary for refactoring/rewriting clients.

- Pave the way to resolve ownership issues with RecordDecls with the forthcoming
  addition of DeclGroups.

Current caveats:
- Until DeclGroups are in place, we will leak RecordDecls not explicitly
  referenced by the AST.  For example:

    typedef struct { ... } x;  

  The RecordDecl for the struct will be leaked because the TypedefDecl doesn't
  refer to it.  This will be solved with DeclGroups.
  
- This patch also (temporarily) breaks CodeGen.  More below.

High-level changes:
- As before, TagType still refers to a TagDecl, but it doesn't own it.  When
  a struct/union/class is first referenced, a RecordType and RecordDecl are
  created for it, and the RecordType refers to that RecordDecl.  Later, if
  a new RecordDecl is created, the pointer to a RecordDecl in RecordType is
  updated to point to the RecordDecl that defines the struct/union/class.

- TagDecl and RecordDecl now how a method 'getDefinition()' to return the
  TagDecl*/RecordDecl* that refers to the TagDecl* that defines a particular
  enum/struct/class/union. This is useful from going from a RecordDecl* that
  defines a forward declaration to the RecordDecl* that provides the actual
  definition. Note that this also works for EnumDecls, except that in this case
  there is no distinction between forward declarations and definitions (yet).

- Clients should no longer assume that 'isDefinition()' returns true from a
  RecordDecl if the corresponding struct/union/class has been defined.
  isDefinition() only returns true if a particular RecordDecl is the defining
  Decl. Use 'getDefinition()' instead to determine if a struct has been defined.

- The main changes to Sema happen in ActOnTag. To make the changes more
  incremental, I split off the processing of enums and structs et al into two
  code paths. Enums use the original code path (which is in ActOnTag) and
  structs use the ActOnTagStruct. Eventually the two code paths will be merged,
  but the idea was to preserve the original logic both for comparison and not to
  change the logic for both enums and structs all at once.

- There is NO CHAINING of RecordDecls for the same RecordType. All RecordDecls
  that correspond to the same type simply have a pointer to that type. If we
  need to figure out what are all the RecordDecls for a given type we can build
  a backmap.

- The diff in CXXRecordDecl.[cpp,h] is actually very small; it just mimics the
  changes to RecordDecl. For some reason 'svn' marks the entire file as changed.

Why is CodeGen broken:
- Codegen assumes that there is an equivalence between RecordDecl* and
  RecordType*. This was true before because we only created one RecordDecl* for
  a given RecordType*, but it is no longer true. I believe this shouldn't be too
  hard to change, but the patch was big enough as it is.
  
I have tested this patch on both the clang test suite, and by running the static analyzer over Postgresql and a large Apple-internal project (mix of Objective-C and C).  


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55839 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-05 17:16:31 +00:00
Daniel Dunbar 797a35d8a4 Fix placement of const on a number of X86 builtins.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55827 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-05 05:56:16 +00:00
Ted Kremenek df042e6c2b Remove "NextDecl" from RecordDecl. This change touches many files that where RecordDecl or CXXRecordDecl was constructed, always with an argument of 'NULL' for the previous declaration.
The motivation behind this change is that chaining the RecordDecls is simply unnecessary.  Once we create multiple RecordDecls for the same struct/union/class, clients that care about all the declarations of the same struct can build a back map by seeing which Decls refer to the same RecordType.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55821 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-05 01:34:33 +00:00
Steve Naroff 39218dfef5 Touchup CheckSingleAssignmentConstraints() and CheckCompareOperands() to check for block pointers.
Added a couple FIXME's wrt PointLikeType. If the author reads this, it would be great to get some background on this class (thanks in advance).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55778 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-04 16:56:14 +00:00
Steve Naroff 1c7d067550 Add type checking for blocks.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55767 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-04 15:10:53 +00:00
Daniel Dunbar d5f8a4fd4d Add __builtin_object_size support.
- Currently CodeGen always returns a conservative value for this (-1
   or 0 depending on the context).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55735 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-03 21:13:56 +00:00
Daniel Dunbar b0a86c21f9 Modify object size checking builtins to lower to libc calls.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55721 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-03 20:28:50 +00:00
Steve Naroff 4eb206bebc Add semantic analysis for "blocks".
Highlights...

- 4 new AST nodes, BlockExpr, BlockStmtExpr, BlockExprExpr, BlockDeclRefExpr.
- Sema::ActOnBlockStart(), ActOnBlockError(), ActOnBlockStmtExpr(), ActOnBlockExprExpr(), ActOnBlockReturnStmt().

Next steps...

- hack Sema::ActOnIdentifierExpr() to deal with block decl refs.
- add attribute handler for byref decls.
- add test cases.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55710 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-03 18:15:37 +00:00
Daniel Dunbar e66f4e3e3a Fix ObjCPropertRefExpr to be able to encode all the information for
uses which refer to methods not properties.
 - Not yet wired in Sema.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55681 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-03 00:27:26 +00:00
Ted Kremenek 6359792ca9 RecordDecl:
- Remove method 'isForwardDecl'; this functionality is already provided by
  'isDefinition()'
- Move method definitions to be co-located with other RecordDecl methods.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55649 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-02 21:12:32 +00:00
Ted Kremenek a39da06576 RecordDecl:
- Added method 'isForwardDeclaration', a predicate method that returns true
  if a RecordDecl represents a forward declaration.
- Added method 'getDefinitionDecl', a query method that returns a pointer to
  the RecordDecl that provides the actual definition of a struct/union.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55642 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-02 20:25:22 +00:00
Ted Kremenek df91eca19b CXXRecordDecl and RecordDecl:
- Change constructor and create methods to accept a CXXRecordDecl* (RecordDecl*)
  instead of a ScopedDecl* for PrevDecl.  This causes the type checking
  to be more tight and doesn't break any code.
  
RecordDecl:

- Don't use the NextDeclarator field in ScopedDecl to represent the previous
  declaration. This is a conflated use of the NextDeclarator field, which will
  be removed anyway when DeclGroups are fully implemented.

- Instead, represent (a soon to be implemented) chain of RecordDecls using a
  NextDecl field.  The last RecordDecl in the chain is always the 'defining'
  RecordDecl that owns the FieldDecls.  The other RecordDecls in the chain
  are forward declarations.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55640 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-02 20:13:32 +00:00
Nuno Lopes b381aac9ba codegen constant data as such. add QualType::isConstant()
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55603 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-01 11:33:04 +00:00
Anders Carlsson bd4c1ada2e Add code to create the fast enumeration state type
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55572 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-30 19:34:46 +00:00
Nico Weber 91c027e202 fix a comment that was forgotten in r54071
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55543 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-29 17:24:46 +00:00
Daniel Dunbar 9048891ff9 Fix double-free error with sizeof applied to VLA types.
- PR2727.

Also, fix warning in CodeGenTypes for new BlockPointer type.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55479 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-28 18:02:04 +00:00
Argyrios Kyrtzidis 77a49f6b1e Fix compilation error on MSVC.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55465 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-28 07:45:57 +00:00
Daniel Dunbar c56f34a1c1 NeXT: Emit mostly-correct property type encoding.
- Added ASTContext::getObjCEncodingForPropertyDecl.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55461 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-28 04:38:10 +00:00
Steve Naroff 5618bd4a52 First wave of changes to support "blocks" (an extension to C).
This commit adds the declaration syntax (and associated type).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55417 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-27 16:04:49 +00:00
Daniel Dunbar 7b4732296b Add addPropertyMethods implementations for
ObjC{Category,Protocol}Decl.
 - No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55404 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-27 02:09:39 +00:00
Daniel Dunbar af05bb9073 Objective-C @synthesize support.
- Only supports simple assignment and atomic semantics are ignored.
 - Not quite usable yet because the methods do not actually get added
   to the class metadata.
 - Added ObjCPropertyDecl::getSetterKind (one of Assign, Copy, Retain).
 - Rearrange CodeGenFunction so synthesis can reuse function prolog /
   epilog code.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55365 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-26 08:29:31 +00:00
Daniel Dunbar 394d33f1f6 Add ObjCPropertyDecl::isReadOnly.
Respect isReadOnly when generating synthesized method decls.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55364 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-26 07:16:44 +00:00
Daniel Dunbar 3216dcdebb constify ObjC*::getClassMethod,getInstanceMethod
No (intended) functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55362 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-26 06:53:45 +00:00
Daniel Dunbar 451318c08a Move implicit Obj-C param creation into ObjCMethodDecl.
- Add ObjCMethodDecl::createImplicitParams.
 - Remove ObjCMethodDecl::set{Self,Cmd}Decl
 - Remove Sema::CreateImplicitParameter

No (intended) functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55356 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-26 06:07:48 +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
Anders Carlsson aa0d25b44e Add support for parsing the objc_gc attribute. Tests will come shortly.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55269 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-23 23:22:21 +00:00
Argyrios Kyrtzidis cb6accb465 CXXFunctionalCastExpr is a subclass of CastExpr. Make it known to isa/dyn_cast/cast.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55237 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-23 15:36:01 +00:00
Argyrios Kyrtzidis 987a14bf58 Add support for C++'s "type-specifier ( expression-list )" expression:
-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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55177 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-22 15:38:55 +00:00
Eli Friedman 86da77fdaf Minor const cleanup.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55160 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-22 00:59:49 +00:00
Eli Friedman 3d815e7eb5 Rewrite type compatibility testing to do type merging rather than just
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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55158 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-22 00:56:42 +00:00
Daniel Dunbar dbc933701d NeXT: Emit [meta]class protocol references.
Updated ObjCProtocolDecl::protocol_iterator to match that of
ObjCInterfaceDecl.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55143 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-21 21:57:41 +00:00
Daniel Dunbar f6414927e6 Fix attributes on Obj-C interfaces & methods.
- Drop MethodAttrs parameter to ObjCMethodDecl
 - Call ProcessDeclAttributeList for interface & method decls.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55068 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-20 18:02:42 +00:00
Ted Kremenek 01e6779fac Added ObjCAtDefsFieldDecl to represent FieldDecls created by @defs.
This fixes an ownership issue where FieldDecls could be owned both by an ObjCInterfaceDecl and a RecordDecl.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55037 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-20 03:26:33 +00:00
Argyrios Kyrtzidis 0835a3cdee Add ExplicitCastExpr to replace the current CastExpr, and have ImplicitCastExpr and ExplicitCastExpr derive from a common base class (CastExpr):
Expr
  -> CastExpr
     -> ExplicitCastExpr
     -> ImplicitCastExpr 

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54955 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-18 23:01:59 +00:00
Argyrios Kyrtzidis 2ff9b4c7c8 Type::isIntegerType() returns true for types between Bool and LongLong.
Put WChar between them to make it integer type.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54882 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-17 13:24:01 +00:00
Daniel Dunbar 8070a8497c Update Expr::{getIntegerConstantExprValue, isIntegerConstantExpr} to
use default APSInt constructor instead of embedding arbitrary
  constant.

Update OverloadExpr::getNumArgs to use getIntegerConstantExprValue.

Update OverloadExpr::getExpr to be const.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54828 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-15 23:29:09 +00:00
Daniel Dunbar 226e04a9b7 Ident class tree in DeclBase properly.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54826 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-15 23:18:35 +00:00
Daniel Dunbar c4a1dea2dc More #include cleaning
- Drop {Decl.h,DeclObjC.h,IdentifierTable.h} from Expr.h
 - Moved Sema::getCurMethodDecl() out of line (dependent on
   ObjCMethodDecl via dyn_cast).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54629 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-11 05:35:13 +00:00
Daniel Dunbar e91593ef08 More #include cleaning
- Drop Expr.h,RecordLayout.h from ASTContext.h (for DeclBase.h and
   SourceLocation.h)
 - Move ASTContext constructor into implementation


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54627 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-11 04:54:23 +00:00
Steve Naroff 3ac5e9fc38 Forgot to modify LAST_EXPR (thanks Nuno).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54619 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-10 19:28:37 +00:00
Steve Naroff 76de9d7a32 Cleanup ObjCSuperRefExpr (remove last usage and AST node:-).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54617 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-10 19:10:41 +00:00
Daniel Dunbar a5d1cb7ef3 Update ShuffeVectorExpr::getShuffleMaskIdx to use
getIntegerConstantExprValue.

Tweak getIntegerConstantExprValue to suppress warning in
  Release-Asserts mode.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54609 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-10 06:58:01 +00:00
Chris Lattner d9f6910f4e rename PreDefinedExpr -> PredefinedExpr
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54605 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-10 01:53:14 +00:00
Argyrios Kyrtzidis 55f4b02bc7 Change 'Wchar' to 'WChar' casing, for consistency.
No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54588 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-09 17:20:01 +00:00
Argyrios Kyrtzidis 64c438a4be Implement support for the 'wchar_t' C++ type.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54585 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-09 16:51:54 +00:00
Argyrios Kyrtzidis 243e4b2fd5 Make RecordDecl::Destroy() public.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54561 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-08 22:25:06 +00:00
Argyrios Kyrtzidis 296e8671bc Change line endings, CRLF -> LF.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54530 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-08 16:58:19 +00:00
Argyrios Kyrtzidis 274479ec1f Revert my previous commit where I replaced cast<> with static_cast<> in CXXFieldDecl::getMember().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54529 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-08 16:48:14 +00:00
Argyrios Kyrtzidis 997b6c6d73 Destroy and delete the FieldDecl members of a RecordDecl.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54527 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-08 14:08:55 +00:00
Argyrios Kyrtzidis afebac1df8 Add iterator access to field members for RecordDecl.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54526 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-08 13:54:06 +00:00
Argyrios Kyrtzidis fef35f1ce9 Use static_cast<> instead of cast<> for CXXFieldDecl::getMember().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54525 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-08 13:26:45 +00:00
Argyrios Kyrtzidis 49aa7ff124 Add CXXRecordType class.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54488 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-07 20:55:28 +00:00
Ted Kremenek ce1eb34bbe Always construct the BumpPtrAllocator used by CFG as an instance variable.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54429 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-06 22:22:32 +00:00
Ted Kremenek 55b0c192e1 Add missing "classof" methods to NonNullAttr, fixing a heisencrash.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54373 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-05 21:29:52 +00:00
Ted Kremenek 14f8b4ff66 Added decl_iterator to DeclStmt to provide an abstract interface to iterate over the ScopedDecls of a DeclStmt.
Updated a few clients of DeclStmt::getNextDeclarator() to use decl_iterator instead.  Will update other clients after additional testing.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54368 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-05 20:46:55 +00:00
Daniel Dunbar a80f8749f2 Add more Parser/Sema support for GCC asm-label extension.
- ActOnDeclarator now takes an additional parameter which is the
   AsmLabel if used. Its unfortunate that this bubbles up this high,
   but we cannot just lump it in as an attribute without mistakenly
   *accepting* it as an attribute.
 - The actual asm-label itself is, however, encoded as an AsmLabelAttr
   on the FunctionDecl.
 - Slightly improved parser error recovery on malformed asm-labels.
 - CodeGen support still missing...


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54339 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-05 01:35:17 +00:00
Ted Kremenek a34ea07237 Nico Weber:
"the attached patch fixes some typos, 80 cols violations, etc. in comments."


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54328 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-04 22:51:42 +00:00
Chris Lattner c63a1f276f 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54317 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-04 07:31:14 +00:00
Daniel Dunbar 6bfed7e411 Support constructor and destructor attributes in CodeGen
- There is an miscompilation issue remaining due to a poor
   interaction between the delayed emission of static functions and
   the emission of constructors, but that already existed prior to
   this change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54258 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-01 00:01:51 +00:00
Daniel Dunbar 3068ae0feb Support __attribute__(({con,de}structor)) in Parse & Sema
- Including possible priority argument
 - In other news, the attribute parsing code really needs a cleanup


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54257 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-31 22:40:48 +00:00
Ted Kremenek 69c8f0aab6 Remove getCodeBody() from Decl, and hoist getBody() into Decl as a virtual function.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54247 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-31 17:32:12 +00:00
Ted Kremenek d90700108c Fix serialization for TypedefType by allowing TypedefType to access the internal CanonicalType stored in Type.
The test case Serialization/stmt_exprs.c now passes.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54117 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-27 03:47:53 +00:00
Chris Lattner c36d405a02 make "call foo.dump()" and "call foo->dump()" work in GDB,
with QualTypes and Types.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54116 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-27 00:48:22 +00:00
Chris Lattner 4243a94b43 remove QualType::getCanonicalType. Also make
QualType::ReadBackpatch public so that FieldDecl doesn't need
to be a friend of QualType.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54115 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-27 00:06:09 +00:00
Chris Lattner b77792eabf change more instances of QualType::getCanonicalType to call
ASTContext::getCanonicalType instead (PR2189)



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54105 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-26 22:17:49 +00:00
Chris Lattner 28be73f74c convert more code to use ASTContext to get canonical types instead
of doing it directly.  This is required for PR2189.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54102 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-26 21:30:36 +00:00
Chris Lattner 717250a205 remove a helper method.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54101 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-26 20:50:02 +00:00
Chris Lattner 62f5f7ffad fix several problems with the protocol qualified id handling where id was implicit.
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


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54083 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-26 00:46:50 +00:00
Daniel Dunbar fb754b6db2 Remove unused ASTConsumer::HandleTopLevelDeclaration
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54071 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-25 22:39:30 +00:00
Ted Kremenek be57c3a3fe Refine ObjCPropertyImplDecl:
- Remove a bunch of setXXX methods until we actually need them. This cleans up the
interface, and makes the object immutable until we have a reason to be mutable.

- Remove enum value OBJC_PR_IMPL_None since it was never used.

- Remove instance variable 'PropertyImplKind PropertyImplementation;'. This is
  not needed because we can tell if ObjCPropertyImplDecl represents @synthesize
  if 'ObjCPropertyDecl *PropertyDecl' is not null.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54055 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-25 20:43:38 +00:00
Nate Begeman 82354bcedd De-tabify
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54046 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-25 20:15:14 +00:00
Ted Kremenek 7379889275 Implemented Sema support for attribute "unused".
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54008 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-25 04:39:19 +00:00
Ted Kremenek b6ccaac65c Move isObjCObjectPointerType() from Sema to ASTContext.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53998 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-24 23:58:27 +00:00
Steve Naroff fc93d52ada Fix Sema::ActOnClassMessage() to pass through the identifier for "super".
This fixes a critical rewriter bug (<rdar://problem/6096760> clang ObjC rewriter: 'self' not expected value in class method called with 'super').

Also added a couple FIXME's since I'm not happy with my fix to Sema. It would be nicer if the super handling for class/instance messages was the same (based on PreDefinedExpr).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53994 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-24 19:44:33 +00:00
Daniel Dunbar cd8f646eca Add Expr::getIntegerConstantExprValue helper method
- For getting an APSInt from a known integer constant Expr.
 - TODO: Many users of Expr::isIntegerConstantExpr in codegen should
   probably be using this instead...


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53974 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-24 01:08:37 +00:00
Ted Kremenek 5a56ac30d0 Added UnaryOperator::isPrefix().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53963 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-23 22:18:43 +00:00
Ted Kremenek 8f50b9c02a Initialize instance variable DeclAccess in ctor for ObjCIvarDecl.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53956 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-23 18:12:25 +00:00
Ted Kremenek b8db21d4df When constructing an ObjCIvarDecl object in Sema, provide its visibility up front instead of setting it afterwards.
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).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53955 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-23 18:04:17 +00:00
Ted Kremenek f079570fca Updated comment for class ObjCIvarDecl: it turns out the default access control
is protected, not private.

Added ObjCIvarDecl::getCanonicalAccessControl() to report the visible access
control of an ivar, whereas getAccessControl() returns the access control
relating to how the ivar was actually declared.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53954 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-23 17:44:44 +00:00
Argyrios Kyrtzidis ea7e97e14f Fix compilation error on GCC 4.3.0 ('memcpy' was not declared in this scope).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53934 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-22 21:56:45 +00:00
Ted Kremenek 584def7364 Added path-sensitive checking for null pointer values passed to function arguments marked nonnull.
This implements <rdar://problem/6069935>


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53891 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-22 00:46:16 +00:00
Daniel Dunbar 1caae95901 Implement bzero, memset, memmove builtins.
This subsumes Nico Weber's patch and implements bzero in terms
of llvm.memset to match llvm-gcc.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53888 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-22 00:26:45 +00:00
Daniel Dunbar 4493f79fce Implement nans, prefetch, and trap builtins.
This closes <rdar://problem/6080720>, support for __builtin_constant_p
has been filed separately.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53885 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-21 22:59:13 +00:00
Ted Kremenek eb2b2a3f18 Added sema support for the nonnull attribute. Will add test cases soon.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53881 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-21 21:53:04 +00:00
Chris Lattner 780f329cb0 move two more lists of protocols over to use ObjCList<ObjCProtocolDecl>,
simplifying code along the way and fixing a problem and memory leak or two.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53876 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-21 21:32:27 +00:00
Daniel Dunbar a933c3c052 Add __builtin_powi[fl] support
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53866 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-21 18:44:41 +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
Chris Lattner f7b2c98c16 rename setReferencedProtocolList -> addReferencedProtocols to
be consistent with ObjCInterfaceDecl.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53852 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-21 17:23:15 +00:00
Daniel Dunbar 04b290030e Implement ffs, parity, and popcount builtins.
+ test case


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53851 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-21 17:19:41 +00:00
Chris Lattner b752f28902 Switch initialization of the protocol list for an interface decl to use
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>
^




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53846 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-21 07:06:49 +00:00
Chris Lattner 2b1cc8be4d continue cleaning up code, and disable sending a message directly to an
interface.  This fixes a bug where we used to accept:

void test2(NSNumber x) {
	[x METH];
}

which doesn't make sense and GCC rejects.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53841 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-21 06:12:56 +00:00
Chris Lattner 9baefc21bf rename getProtocols -> getProtocol, as it only returns a single
protocol.  Simplify some code to use unconditional form of the
protocol access list.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53832 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-21 05:20:01 +00:00
Chris Lattner fb7701df54 improve documentation of ObjCInterfaceType significantly. Also,
make the qual_* iterators and getNumProtocols() lists be accessible through
ObjCInterfaceType (returning an empty range if not a 
ObjCQualifiedInterfaceType).  This eliminates special checks in clients.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53830 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-21 05:13:51 +00:00
Chris Lattner 68a057b429 simplify a bunch of code, no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53823 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-21 04:36:39 +00:00
Chris Lattner d85376aa66 improve comments.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53818 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-21 04:07:11 +00:00
Ted Kremenek f2da7a06f6 Provide static methods in BinaryOperator to determine if an opcode is an equality opcode, a relational opcode, or a logical opcode.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53744 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-17 23:24:36 +00:00
Steve Naroff 8f3b2654a9 Two fixes:
- 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53694 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-16 18:22:22 +00:00
Ted Kremenek 96329d4e07 Added parsing/sema support for __attribute__ ((IBOutlet)), a clang-specific attribute that the static analyzer will use to recognize what ivars are IBOutlets.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53644 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-15 22:26:48 +00:00
Chris Lattner cf0f51d10f rename "SInt" methods to "Int" in APValue.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53467 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-11 19:19:21 +00:00
Chris Lattner b542afe02d make the new evaluator avoid conversions APValue<->APSInt in some cases.
Add some accessors to APValue.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53465 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-11 19:10:17 +00:00
Ted Kremenek 0ce902bb29 Patch by Csaba Hruska and Peter Neumark:
"adds support (de)serialization (from)to (in memory) buffer."


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53425 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-10 22:10:48 +00:00
Chris Lattner f8396b6b58 Add parser support for __builtin_stdarg_start, PR2531
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53328 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-09 17:26:36 +00:00
Anders Carlsson 62f6b21107 Add LValue setters for APValue
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53216 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-08 04:35:19 +00:00
Seo Sanghyeon b4825df6af Fix warnings
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53133 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-04 09:32:15 +00:00
Ted Kremenek a0fb5861de Added an "ivar_empty" method to ObjCInterfaceDecl.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53099 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-03 15:30:49 +00:00
Anders Carlsson c44eec6dd2 Shuffle things around in preparation for integrating Eli's constant evaluator.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53074 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-03 04:20:39 +00:00
Anders Carlsson 2e478080f8 Make APValue an APSInt.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53072 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-03 04:00:59 +00:00
Ted Kremenek c87190da60 Added method "HandleTranslationUnit" to ASTConsumer. This is called by ParseAST when all of the ASTs in a translation unit have been built.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53042 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-02 18:32:45 +00:00
Argyrios Kyrtzidis 07952324dd Add Sema support for C++ classes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52956 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-01 10:37:29 +00:00
Chris Lattner b7cfe88e88 Make a few related changes:
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.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52914 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-30 18:32:54 +00:00
Eli Friedman ad74a75818 Fix for PR2501; this patch makes usual arithmetic conversions for
integers which have the same width and different signedness work 
correctly. (The testcase in PR2501 uses a comparison between long and 
unsigned int).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52853 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-28 06:23:08 +00:00
Matthijs Kooijman e9484fc09a Make clang work on 32 bit powerpc linux.
Patch by Nick Lewycky!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52777 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-26 08:39:30 +00:00
Ted Kremenek 3f2dcb1ca8 Add Profile method to QualType.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52735 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-25 17:24:26 +00:00
Argyrios Kyrtzidis 09c31b0d78 Set CXXClassVar to identifier namespace IDNS_Ordinary.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52718 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-25 14:04:17 +00:00
Argyrios Kyrtzidis 1ce6eadf80 Set CXXMethod to identifier namespace IDNS_Ordinary.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52697 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-24 22:56:42 +00:00
Ted Kremenek be78424edf Update serialization for ObjCMessageExpr to handle additional bit-swizziling of receiver information.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52679 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-24 17:00:08 +00:00
Ted Kremenek 4df728e368 ObjCMessageExpr objects that represent messages to class methods now can contain the ObjCInterfaceDecl* of the target class if it was available when the ObjCMessageExpr object was constructed. The original interfaces of the class has been preserved (requiring no functionality changes from clients), but now a "getClasSInfo" method returns both the ObjCInterfaceDecl* and IdentifierInfo* of the target class.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52676 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-24 15:50:53 +00:00
Ted Kremenek a75a8ea5b7 Fix comments: "class method" should be "instance method" and vis versa
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52669 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-24 04:44:10 +00:00
Chris Lattner 8031a85dc8 add a new clang::APValue class at Eli's request. It is a discriminated
union between [potentially complex] APInt/APFloat.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52609 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-22 05:45:53 +00:00
Chris Lattner 63e9d56737 remove dead enums.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52581 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-21 18:06:44 +00:00
Chris Lattner 0d17f6f7b1 Switch 'super' from being a weird cast thing to being a predefined expr node.
Patch by David Chisnall with objc rewriter and stmtdumper updates from me.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52580 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-21 18:04:54 +00:00
Ted Kremenek f8e32cf062 Added ParentMap, a class to represent a lazily constructed mapping from child to parents.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52553 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-20 21:40:36 +00:00
Ted Kremenek 792481eec2 Added "Decl::getCodyBody()", a virtual method that returns the root AST node (Stmt*) that the Decl wraps (if any). Currently this only returns a non-null value for FunctionDecl and ObjCMethodDecl.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52552 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-20 21:39:47 +00:00
Chris Lattner 4111024be8 Change self/_cmd to be instances of ImplicitParamDecl instead of ParmVarDecl.
Patch by David Chisnall!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52422 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-17 18:05:57 +00:00
Ted Kremenek 1060aff23f Fix more strict-aliasing warnings.
Fix indentation of class declarations in ExprCXX.h


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52380 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-17 03:11:08 +00:00
Ted Kremenek 5549976193 This patch is motivated by numerous strict-aliasing warnings when compiling
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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52378 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-17 02:43:46 +00:00
Eli Friedman dbdbbd7a7b Fix getTrueExpr for ConditionalOperator to actually work. No testcase
because it's currently unused.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52166 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-10 05:00:13 +00:00
Argyrios Kyrtzidis 7643536c36 -Add DeclChain member to DeclContext.
-ScopedDecls get chained to their DeclContext.
-DeclContext's DeclChain replaces FunctionDecl's DeclChain and EnumDecl's ElementList.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52164 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-10 01:32:09 +00:00
Argyrios Kyrtzidis 39ba4aeca2 -Changes to TagDecl:
Added TagKind enum.
  Added getTagKind() method.
  Added convenience methods: isEnum(), isStruct(), isUnion(), isClass().
-RecordDecl/CXXRecordDecl::Create() accept a TagKind enum instead of a DeclKind one.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52160 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-09 23:19:58 +00:00
Argyrios Kyrtzidis d3bb44f0f1 Added new C++ AST Decl subclasses.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52155 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-09 21:05:31 +00:00
Nuno Lopes d4cbda6292 implement the alias attirbute (in both Sema and Codegen)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52092 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-08 15:45:52 +00:00
Chris Lattner c250aae4f6 capture whether a CharacterLiteral was wide or not in the AST.
Patch by Mike Stump!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52081 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-07 22:35:38 +00:00
Chris Lattner da8249e57f Fix ast dumping to work with long double literals, e.g. we dump:
long double X() { return 1.0L; }

as:

long double X()
(CompoundStmt 0xb06a00 <t.c:2:17, col:32>
  (ReturnStmt 0xb068d0 <col:19, col:26>
    (FloatingLiteral 0xb02cf0 <col:26> 'long double' 1.000000)))




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52080 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-07 22:13:43 +00:00
Ted Kremenek 05ac3ef08f Reclaim memory owned by ObjCForwardProtocolDecls.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52063 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-06 21:05:33 +00:00
Ted Kremenek 400d95fb7b Implement "Destroy" and destructor for ObjCClassDecl, allowing us to reclaim its memory and the memory of the Decls it owns.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52059 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-06 20:11:53 +00:00
Ted Kremenek 1c8a413c1e Implement "Destroy" and destructor for ObjCProtocolDecl, allowing us to reclaim its memory and the memory of the Decls it owns.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52055 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-06 19:48:57 +00:00
Ted Kremenek 8a77931487 Initial work on additional memory collection for ObjC AST objects. We now
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).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52050 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-06 16:45:15 +00:00
Devang Patel 6a5a34c0e5 During interface layout, don't forget super class.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52035 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-06 02:14:01 +00:00
Devang Patel 80d310c631 Undo previous check-in.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52034 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-06 02:00:35 +00:00
Devang Patel 0e8eda7a4d During interface layout, don't forget super class.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52033 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-06 01:50:12 +00:00
Steve Naroff 3d2c22b1d3 Fix <rdar://problem/5987482> clang on xcode: null dereference in Sema::ActOnMemberReferenceExpr.
In addition to fixing the crasher, this commit fixes further improves property lookup (by searching protocols of qualified interfaces..."NSObject <prot>").


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52001 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-05 13:55:23 +00:00
Devang Patel 44a3dded80 Add ObjCInterface layout support.
Reuse RecordLayout.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51968 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-04 21:54:36 +00:00
Devang Patel 8b27704d61 Refactoring.
Move field layout code in a ASTRecordLayout member fn.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51966 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-04 21:22:16 +00:00
Eli Friedman 50c5c72410 Don't assume that the type of a FunctionDecl is a FunctionType; that
assumption isn't accurate in the presence of typedefs.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51951 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-04 17:58:41 +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
Steve Naroff eaf9a42b78 Add a few more built-in functions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51921 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-03 22:16:48 +00:00
Steve Naroff cf00e0bee3 Add a builtin. Fixes <rdar://problem/5982037> clang on xcode: error: incompatible operand types ('int' and 'char *').
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51908 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-03 17:37:43 +00:00
Steve Naroff e3e9add4fd Fix <rdar://problem/5979875> clang on xcode: error: use of undeclared identifier 'super'
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51888 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-02 23:03:37 +00:00
Nuno Lopes 9141bee299 fix decl attributes cleaning
this plugs the leak of attributes and also fixes a crash in the test

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51862 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-01 22:53:53 +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
Ted Kremenek b306404158 Fix some strict-aliasing warnings by using Stmt* instead of Expr* in VariableArrayType, EnumConstantDecl, and VarDecl.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51772 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-30 16:14:41 +00:00
Steve Naroff ae7840776d Add basic support for properties references (a missing feature).
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



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51719 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-30 00:40:33 +00:00
Steve Naroff f494b579b2 - Move ObjC Expresssion AST's from Expr.h => ExprObjC.h
- #include ExprObjC.h in many places


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51703 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-29 21:12:08 +00:00
Anton Korobeynikov 525204a7ca Update to follow recent LLVM changes
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51689 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-29 17:42:01 +00:00
Eli Friedman bcfd5d4ac6 Add the copysign builtins; I ran into a program that wanted
__builtin_copysign.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51597 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-27 15:59:57 +00:00
Eli Friedman 2742496d75 Don't swap function decls, and add them to the scope as they are
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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51584 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-27 05:07:37 +00:00
Sanjiv Gupta 1c6a38bcea Generate subprogram debug info with -g.
Also take care of freeing memory at the right places.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51553 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-25 05:15:42 +00:00
Steve Naroff 8bf3b1d0e7 Fix range info for explicit ivar refs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51507 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-23 22:00:37 +00:00
Dan Gohman 4f8d123e3e Move getAccessedFieldNo out of lib/AST/Expr.cpp into
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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51398 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-22 00:50:06 +00:00
Ted Kremenek 4b05b1dee6 Add Destroy method to Types, making there destruction more harmonious with
the destruction of Decls and Stmts.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51385 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-21 16:38:54 +00:00
Ted Kremenek 8e355f296a When destroying DeclStmts, also destroy the associated Decl (reclaim its memory).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51379 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-21 15:53:55 +00:00
Eli Friedman 5f1adf8fb4 Fix the destruction "properly" in the sense that we actually destroy the
ASTs.  This is a hack, but I haven't considered how we really 
want to do this.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51364 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-21 05:33:10 +00:00
Eli Friedman 6cfda23b37 Add __builtin_frame_address and __builtin_return_address gcc builtins to
Sema. No codegen yet.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51307 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-20 08:23:37 +00:00
Ted Kremenek d1ac17ae7d Reclaim memory from chains of ScopedDecls, and reclaim memory for the initializers of EnumConstantDecls.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51299 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-20 04:49:55 +00:00
Ted Kremenek f809e3bd0c Delete AST nodes, not just Decls.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51298 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-20 04:10:52 +00:00
Ted Kremenek b65cf41707 Reclaim memory allocated for ParmVarDecl's in FunctionDecl::Destroy.
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).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51297 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-20 03:56:00 +00:00
Ted Kremenek 27f8a28bee Try to plug some memory leaks...
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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51286 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-20 00:43:19 +00:00
Ted Kremenek 9c1863ef36 Added Stmt::DestroyChildren, which will be used by the dstors of the subclasses of Stmt to recursively delete their child AST nodes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51278 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-19 22:02:12 +00:00
Nate Begeman 2451250131 Fix some prototypes, and implement some builtins until we have our header files completed.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51199 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-16 18:59:42 +00:00
Eli Friedman dde8c94873 Fix review nit.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51194 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-16 17:44:00 +00:00
Ted Kremenek 9c2535a35d Added CFGBlock::hasBinaryBranchTerminator().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51190 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-16 16:06:00 +00:00
Argyrios Kyrtzidis 1bf7dd7570 Make isFileVarDecl() return true when the VarDecl is in a C++ namespace.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51153 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-15 17:53:43 +00:00
Steve Naroff 6c178c563d Add some of GCC's object checking builtin's.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51133 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-14 22:12:15 +00:00
Eli Friedman d38617c8a5 Implementation of __builtin_shufflevector, a portable builtin capable of
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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51113 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-14 19:38:39 +00:00
Nate Begeman 3b8d116703 Remove AST dependency on VMCore by switching ExtVectorElementExpr off Constant.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51068 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-13 21:03:02 +00:00
Ted Kremenek 901b412d65 80 col violation fix.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50977 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-12 17:40:13 +00:00
Ted Kremenek 769c9cfc6e Add Type::getAsTypedefType().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50970 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-12 16:22:53 +00:00
Mon P Wang 1ffe281890 Added support to generate some atomic operators (add, sub, and, or etc..)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50919 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-09 22:40:52 +00:00
Nate Begeman 8a99764f9b Extend vector member references to include {.hi, .lo, .e, .o} which return a
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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50892 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-09 06:41:27 +00:00
Nate Begeman f8add5dd6f Add the non-immediate-shift vector builtins
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50870 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-08 21:51:12 +00:00
Fariborz Jahanian 4607034e62 Synthesized getter/setter method declarations need not have
an implementation. This fixes couple of failing prperty tests
caused by my previous patch.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50830 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-07 20:53:44 +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 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
Chris Lattner 28a309e387 Fix a bug from when this was a pointer instead of vector.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50639 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-05 07:03:40 +00:00
Chris Lattner a212c56e9b Simplify FunctionDecl::AddRedeclaration a bit by using std::swap.
Fix 'swapping' of attributes to not insert null values into the 
DeclAttrs map.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50612 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-04 02:29:49 +00:00
Chris Lattner da2d71a50f improve array type comments.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50609 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-04 01:11:46 +00:00
Fariborz Jahanian aebf0cba02 This patch is about merging ObjC2's properties declared in class
protocols into class's property list and performing semantics
on them for while doing so.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50587 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-02 19:17:30 +00:00
Ted Kremenek ea958e57a3 Use pointer swizziling to unify in ObjCMessageExpr the receiver and classname "fields". This saves us a pointer.
Implemented serialization for ObjCMessageExpr.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50528 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-01 17:26:20 +00:00
Ted Kremenek 66783caa67 Added comments to ObjCMessageExpr.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50525 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-01 15:55:24 +00:00
Steve Naroff c5ae899b4b Extend InitListExpr API/IMPL to support arbitrary add/remove (in support of the initializer rewrite I am doing).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50511 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-01 02:04:18 +00:00
Ted Kremenek 274f4334f6 Bug fix in CFG::getBlockEdgeImpl(): Use a BumpPtrAllocator to allocate
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>


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50364 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-28 18:00:46 +00:00
Argyrios Kyrtzidis 2d1c5d313c Parsing of namespaces:
-NamespaceDecl for the AST
-Checks for name clashes between namespaces and tag/normal declarations.

This commit doesn't implement proper name lookup for namespaces.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50321 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-27 13:50:30 +00:00
Nuno Lopes 27ae6c6531 initial support for recognizing __transparent_union__ attributes
comments on the ML will follow

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50262 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-25 09:32:00 +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
Chris Lattner 9fdf9c6d35 "This patch renames
DeclContext *CtxDecl -> DeclContext *DeclCtx
DeclContext *CD -> DeclContext *DC

It makes the code more consistent."

Patch by Zhongxing Xu!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50105 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-22 18:39:57 +00:00
Fariborz Jahanian c35b9e4e2e Support for @dynamic AST build.
More property semantics checking.
First test case for ObjC2's property implementation.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50057 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-21 21:05:54 +00:00
Fariborz Jahanian 559c0c4bbe Continuation of work on ObjC2's properties.
Added iterators, methods to find property and categories.
Use them in doing semantic analysis on property implementation
declarations. Fixed typos.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50050 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-21 19:04:53 +00:00
Douglas Gregor f009795057 Clean up handling of function redeclarations
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50021 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-21 02:02:58 +00:00
Nate Begeman 213541a68a OCUVector -> ExtVector, shorthand for extended vector, per feedback from Chris.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49942 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-18 23:10:10 +00:00
Ted Kremenek 866b5c03e3 Several Expr subclasses did not mark "getSourceRange()" virtual. Fixed.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49890 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-18 04:18:16 +00:00
Fariborz Jahanian f624f8186d Initial work for property implementation declarations.
Mostly semantic checking in this patch. This is on going
and incomplete.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49882 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-18 00:19:30 +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
Argyrios Kyrtzidis ef17782010 Addition of TranslationUnitDecl to the AST:
-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


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49855 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-17 14:40:12 +00:00
Fariborz Jahanian 61d46159af New AST class for property implementation declarations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49821 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-16 22:00:24 +00:00
Ted Kremenek 411cdee0b4 Added CFGBlock::getTerminatorCondition() to get the Expr* of the condition a block's terminator.
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>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49818 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-16 21:10:48 +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 97b7f26a92 Remove uses of "Selector&" and "const Selector&", since Selector is just an
immutable smart pointer (we don't need to pass references, just pass Selector).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49773 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-16 04:30:16 +00:00
Steve Naroff 248a753f6b Remove FileVarDecl and BlockVarDecl. They are replaced by VarDecl::isBlockVarDecl() and VarDecl::isFileVarDecl().
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).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49748 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-15 22:42:06 +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
Douglas Gregor 2ce52f3fb9 Introduce support for finding class and enum names via ordinary name lookup in C++
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49621 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-13 21:07:44 +00:00
Chris Lattner 99dc914221 This patch is just the easy part of the class names patch, which
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!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49613 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-13 18:59:07 +00:00
Chris Lattner 9e979557ee Default argument cleanups and minor improvements, patch by
Doug Gregor!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49598 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-12 23:52:44 +00:00
Fariborz Jahanian dae1a1a2aa AST generation for objc2's property declarations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49565 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-11 23:40:25 +00:00
Steve Naroff d6a07aaf62 Add class and super class location info to ObjCInterfaceDecl...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49553 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-11 19:35:35 +00:00
Sam Bishop 1bb19638f2 Invoke destructors in Decl::Destroy().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49547 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-11 18:04:39 +00:00
Sam Bishop bb45c512e0 Stub out and start using a Decl::Destroy() method.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49532 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-11 15:01:25 +00:00
Chris Lattner 8123a95c33 Several improvements from Doug Gregor related to default
argument handling.  I'll fix up the c89 (void) thing next.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49459 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-10 02:22:51 +00:00
Sam Bishop 670aa9d763 Changed the Decl::Kind enum of the ObjCPropertyDecl class, so that it follows
the pattern of the other Decl classes.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49399 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-08 20:49:25 +00:00
Chris Lattner 0442108783 Add support for C++ default arguments, and rework Parse-Sema
interaction for function parameters, fixing PR2046.

Patch by Doug Gregor!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49369 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-08 04:40:51 +00:00
Sam Bishop e2563ca02a Pass the ASTContext object around when deserializing Decl and Stmt objects, so
they can be created using the same allocator as in the "from source code" case.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49353 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-07 21:55:54 +00:00
Chris Lattner acc9972da2 simplify array compatibility testing.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49326 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-07 06:56:55 +00:00
Chris Lattner 78eca286b0 simplify compatibility testing for tag types.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49323 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-07 06:49:41 +00:00
Chris Lattner 1ee0700c7d Fix a really bad bug where type uniquing would merge a<x> with b<x> as the same
type, because it did not include a/b in the hash.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49321 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-07 06:37:47 +00:00
Chris Lattner 3cc4c0c305 Remove a dead check for compatible builtin types
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49319 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-07 05:55:38 +00:00
Chris Lattner 6e26f5db80 futher simplify compatibility testing of objc interface types.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49318 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-07 05:53:18 +00:00
Chris Lattner f62f9cd5a7 simplify vector type compatibility testing.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49314 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-07 05:36:14 +00:00
Chris Lattner eca7be6b7e move ObjCQualifiedIdTypesAreCompatible out of ASTContext into Sema.
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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49313 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-07 05:30:13 +00:00
Chris Lattner 372bed091b improve comments.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49311 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-07 04:58:07 +00:00
Chris Lattner 065f0d7b00 eliminate getReferencedProtocols from
ObjCQualifiedIdType/ObjCQualifiedInterfaceType, adding an interator 
interface instead.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49308 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-07 04:44:08 +00:00
Chris Lattner 3b27546b42 make QualifiedInterfaceTypesAreCompatible a static function
and start simplifying it.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49307 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-07 04:17:40 +00:00
Chris Lattner 53efc25179 This predicate is just a generic "issuperclass" predicate, move it to the
ObjCInterfaceType as a method.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49306 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-07 04:13:03 +00:00
Chris Lattner c4e4059962 Simplify some objc compatibility testing, make interfaceTypesAreCompatible
a static function named isCompatibleInterfaceAssign.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49305 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-07 04:07:56 +00:00