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

36 Коммитов

Автор SHA1 Сообщение Дата
Chris Lattner c7229c338c move IdentifierTable.h from liblex to libbasic.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42730 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-07 08:58:51 +00:00
Steve Naroff 6a8a9a41e9 - Add ObjcInterfaceDecl::lookupInstanceMethod(), lookupClassMethod().
- Add ObjcMessageExpr::getSelector(), getClassName().
- Change Sema::getObjCInterfaceDecl() to simply take an IdentifierInfo (no Scope needed).
- Remove FIXME for printing ObjCMessageExpr's.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42543 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-02 20:01:56 +00:00
Chris Lattner c9bec4bfea further apfloat'ize the front-end, allowing codegen to pass
APFloat straight through to LLVM now.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42236 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-22 18:47:25 +00:00
Steve Naroff 563477da25 Progress on message expressions...
- Add ObjcMessageExpr AST node and associated constructors.
- Add SourceLocation's to ActOnKeywordMessage/ActOnUnaryMessage API.
- Instantiate message expressions...
- Replace alloca usage with SmallString.

Next step, installing a correct type, among other tweaks...



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42116 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-18 23:55:05 +00:00
Chris Lattner 8bdcc47d26 pretty print some nodes more nicely.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41989 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-15 21:49:37 +00:00
Steve Naroff 9474504790 Move Decl::NextDeclarator (w/ setters/getters) down to ScopedDecl/FieldDecl.
Decl is now svelte:-)



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41935 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-13 23:52:58 +00:00
Gabor Greif 8467583c27 get rid of ugly "warning: no newline at end of file"
warnings that some compilers diagnose


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41847 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-11 15:32:40 +00:00
Ted Kremenek 42a509f6a4 Added "PrinterHelper" interface (include/AST/PrinterHelper) that can
be passed as an (optional) argument to StmtPrinter to customize
printing of AST nodes.

Used new PrinterHelper interface to enhance printing and visualization
of CFGs.  The CFGs now illustrate the semantic connectives between
statements and terminators, wheras in the previous printing certain
expressions would (visible) be printed multiple times to reflect which
expressions used the results of other expressions.

The end result is that the CFG is easier to read for flow of
expression values (following principles similar to the LLVM IR).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41651 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-31 21:30:12 +00:00
Anders Carlsson 66b5a8a390 Add InitListExpr class.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41636 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-31 04:56:16 +00:00
Chris Lattner 704fe35d13 implement pretty printing of offsetof
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41615 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-30 17:59:59 +00:00
Chris Lattner 5d66145eed add a new ImaginaryLiteral AST node that is used to
represent imaginary literals:

float _Complex A;
void foo() {
  A = 1.0iF;
}

generates:

  (BinaryOperator 0x2305ec0 '_Complex float' '='
    (DeclRefExpr 0x2305e60 '_Complex float' Decl='A' 0x2305cf0)
    (ImaginaryLiteral 0x2305f40 '_Complex float'
      (FloatingLiteral 0x2305ea0 'float' 1.000000))))



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41413 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-26 03:42:43 +00:00
Chris Lattner eb14fe839e Split the ASTNode out for compound assignments out from binary operators. Now
they show up in dumps etc.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41393 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-25 02:00:02 +00:00
Chris Lattner 296bf19bf8 Pretty print as:
"case sizeof x:"
instead of:
  "case sizeofx:"



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41339 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-23 21:46:40 +00:00
Anders Carlsson f9bcf01f82 Parse @encode expressions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41273 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-22 15:14:15 +00:00
Anders Carlsson 5508518a27 Implement parsing and code generation of Objective-C string literals.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41238 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-21 17:43:55 +00:00
Chris Lattner c5598cbc4c Switch StmtVisitor from using dynamic to static dispatch. This makes it
significantly faster and actually reduces the amount of code in the system.
This also allows for future visitor changes.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41211 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-21 04:04:25 +00:00
Ted Kremenek 2324512285 Modified ArraySubscriptExpr to have accessors getLHS and getRHS in addition
to getBase and getIdx.  getBase and getIdx now return a "normalized" view
of the expression (e.g., always "A[4]" instead of possibly "4[A]").  getLHS
and getRHS return the expressions with syntactic fidelity to the original
source code.

Also modified client code of ArraySubscriptExpr, including the AST dumper
and pretty printer, the return-stack value checker, and the LLVM code
generator.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41180 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-20 16:18:38 +00:00
Chris Lattner 36460eea64 move a switch to common code.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40967 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-09 17:34:19 +00:00
Chris Lattner 6000dace22 add a new AST dumper interface (E->dump()). This dumps out
the AST in a structural, non-pretty, form useful for understanding
the AST.  It isn't quite done yet, but is already somewhat useful.

For this example:

int test(short X, long long Y) {
  return X < ((100));
}

we get (with -parse-ast-dump):

int test(short X, long long Y)
(CompoundStmt 0x2905ce0
  (ReturnStmt 0x2905cd0
    (BinaryOperator 0x2905cb0 '<'
      (ImplicitCastExpr 0x2905ca0
        (DeclRefExpr 0x2905c20 Decl='X' 0x2905bb0))
      (ParenExpr 0x2905c80
        (ParenExpr 0x2905c60
          (IntegerLiteral 0x2905c40 100))))))




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40954 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-08 22:51:59 +00:00
Chris Lattner 94f05e3648 Implement codegen for __builtin_choose_expr. For example:
struct X { int A; };

void foo() {
  struct X s;
  int i;
  i = __builtin_choose_expr(0, s, i);
}

compiles to:

        %tmp = load i32* %i             ; <i32> [#uses=1]
        store i32 %tmp, i32* %i

wow :)



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40801 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-04 00:20:15 +00:00
Steve Naroff d04fdd5f99 Implement __builtin_choose_expr.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40794 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-03 21:21:27 +00:00
Chris Lattner 6481a57fef Rename AddrLabel and OCUVectorComponent -> AddrLabelExpr and OCUVectorElementExpr respectively. This is for consistency with other expr nodes end with *Expr.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40785 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-03 17:31:20 +00:00
Steve Naroff d34e915f33 Add AST/Sema support for __builtin_types_compatible_p (a GNU extension).
Todo...still need to call the action from the parser...


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40693 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-01 22:05:33 +00:00
Chris Lattner 86e499d952 Print floating point literal values better.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40659 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-01 00:23:58 +00:00
Steve Naroff 31a458462c Added a new expression, OCUVectorComponent.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40577 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-28 23:10:27 +00:00
Chris Lattner ab18c4c0ac implement ast building and trivial semantic analysis of stmt exprs.
This implements test/Sema/stmt_exprs.c



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40465 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-24 16:58:17 +00:00
Anders Carlsson c1fcb77626 Refactor switch analysis to make it possible to detect duplicate case values
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40388 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-22 07:07:56 +00:00
Anders Carlsson 227426661b Implement code generation for __func__, __FUNCTION__ and __PRETTY_FUNCTION__
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40162 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-21 05:21:51 +00:00
Steve Naroff aff1edd84a Finish fixing crasher with compound literals.
We still need to do sematic analysis (and implement initializers), however this 
should complete the parsing & ast building for compound literals.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40067 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-19 21:32:11 +00:00
Chris Lattner 26dc7b3926 Remove an extraneous QualType from CastExpr, it's type is always
the result type of the expr node.

Implement isIntegerConstantExpr for ImplicitCastExpr nodes the same
was as for CastExpr nodes.

Implement proper sign/zero extension as well as truncation and noop
conversion in the i-c-e evaluator.  This allows us to correctly
handle i-c-e's like these:

char array[1024/(sizeof (long))];
int x['\xBb' == (char) 187 ? 1: -1];

this implements test/Sema/i-c-e2.c



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39888 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-15 23:54:50 +00:00
Chris Lattner 8bf9f079f1 Improve char literal pretty printing, patch by Keith Bauer!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39846 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-13 23:58:20 +00:00
Steve Naroff 90045e8eba More changes related to implementing ImplicitCastExpr.
- Fixed a recent regression discovered by Keith Bauer (thanks!). 
The fix involved adding (back) two arguments to UsualArithmeticConversions.
Without the reference arguments, no unary conversions were being passed back
to the caller. This had the effect of turning off the UsualUnaryConversions.
- Refactored CheckAssignmentConstraints into 3 functions. CheckAssignmentConstraints,
CheckSingleAssignmentConstraints, and CheckCompoundAssignmentConstraints. 
- Changed the argument type of DefaultFunctionArrayConversion from QualType->Expr*&.
- Removed a bunch of casts in routines I was working on (cleanup).
- Fixed the visitor for ImplicitCastExpr (oops).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39840 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-13 23:32:42 +00:00
Steve Naroff 49b4526992 Add (explicit) AST support for implicit casts. This should simplify the
code generator. Source translation tools can simply ignore this node.

- Added a new Expr node, ImplicitCastExpr.
- Changed UsualUnaryConversions/UsualArithmeticConversions to take references 
to Expr *'s. This will allow these routines to instantiate the new AST node
and pass it back.
- Changed all clients of UsualUnary/UsualArithmetic (lot's of diff's).
- Changed some names in CheckConditionalOperands. Several variables where
only distinguished by their case (e.g. Cond, cond). Yuck (what was I thinking).
- Removed an old/crufty constructor in CastExpr (cleanup).

This check-in does not actually create the new AST node. I wanted to separate
the mechanical changes from the semantic changes. In addition, I need to 
coordinate with Chris, since the semantic change will break the code generator.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39814 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-13 16:58:59 +00:00
Chris Lattner b0a721a51a "Codegen for Character Literals and Conditional Operator
Both in one patch, and the test case that Chris didn't commit last
time is in there too...

I'll split the patch up if somebody wants it split."

Patch by Keith Bauer.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39796 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-13 05:18:11 +00:00
Chris Lattner 24c3990cd2 remember the initializer for a variable in the AST and teach the
pretty printer to print it.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39770 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-12 00:36:32 +00:00
Reid Spencer 5f016e2cb5 Stage two of getting CFE top correct.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39734 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-11 17:01:13 +00:00