]> granicus.if.org Git - clang/log
clang
17 years agoimplement dumper support for the rest of expressions.
Chris Lattner [Thu, 9 Aug 2007 17:35:30 +0000 (17:35 +0000)]
implement dumper support for the rest of expressions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40968 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agomove a switch to common code.
Chris Lattner [Thu, 9 Aug 2007 17:34:19 +0000 (17:34 +0000)]
move a switch to common code.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40967 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agominor fixes
Chris Lattner [Thu, 9 Aug 2007 17:33:55 +0000 (17:33 +0000)]
minor fixes

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40966 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agodump strings with escapes and other stuff in them nicely.
Chris Lattner [Thu, 9 Aug 2007 17:14:24 +0000 (17:14 +0000)]
dump strings with escapes and other stuff in them nicely.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40964 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agominor cleanups
Chris Lattner [Thu, 9 Aug 2007 17:01:07 +0000 (17:01 +0000)]
minor cleanups

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40963 91177308-0d34-0410-b5e6-96231b3b80d8

17 years ago__attribute__ starts a declspec.
Chris Lattner [Thu, 9 Aug 2007 16:40:21 +0000 (16:40 +0000)]
__attribute__ starts a declspec.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40962 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoadd dumping support for some new nodes
Chris Lattner [Thu, 9 Aug 2007 01:04:32 +0000 (01:04 +0000)]
add dumping support for some new nodes

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40959 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoDump out types for expressions, and handle typedefs nicely.
Chris Lattner [Thu, 9 Aug 2007 00:36:22 +0000 (00:36 +0000)]
Dump out types for expressions, and handle typedefs nicely.
This allows us to dump:

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

as:

typedef short S;

int test(S X, long long Y)
(CompoundStmt 0x2905d40
  (ReturnStmt 0x2905d30
    (BinaryOperator 0x2905d10 'int' '<'
      (ImplicitCastExpr 0x2905d00 'int'
        (DeclRefExpr 0x2905c80 'S':'short' Decl='X' 0x2905c20))
      (ParenExpr 0x2905ce0 'int'
        (ParenExpr 0x2905cc0 'int'
          (IntegerLiteral 0x2905ca0 'int' 100))))))

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40956 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoadd a new AST dumper interface (E->dump()). This dumps out
Chris Lattner [Wed, 8 Aug 2007 22:51:59 +0000 (22:51 +0000)]
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

17 years agoFinish implementing __builtin_classify_type()...
Steve Naroff [Wed, 8 Aug 2007 22:15:55 +0000 (22:15 +0000)]
Finish implementing __builtin_classify_type()...

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40951 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agonow that implicit conversions are explicit, we can eliminate
Chris Lattner [Wed, 8 Aug 2007 17:49:18 +0000 (17:49 +0000)]
now that implicit conversions are explicit, we can eliminate
EmitUsualArithmeticConversions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40931 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoAdd support for __builtin_classify_type(). This builtin function isn't "public",...
Steve Naroff [Wed, 8 Aug 2007 17:48:34 +0000 (17:48 +0000)]
Add support for __builtin_classify_type(). This builtin function isn't "public", however
it is used by "tgmath.h" (so we need to support it). It might also come in handy when
developing the overloaded function macros for OpenCU.

Next check-in will make this an integer constant expression...

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40930 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agonow that implicit conversions are explicit, we can eliminate
Chris Lattner [Wed, 8 Aug 2007 17:43:05 +0000 (17:43 +0000)]
now that implicit conversions are explicit, we can eliminate
EmitExprWithUsualUnaryConversions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40929 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoMove the function/array conversion for ParmVarDecl's from Sema::ParseIdentifierExpr()
Steve Naroff [Tue, 7 Aug 2007 22:44:21 +0000 (22:44 +0000)]
Move the function/array conversion for ParmVarDecl's from Sema::ParseIdentifierExpr()
to Sema::ParseParamDeclarator(). After discussing this with Chris, we decided this
approach has more immediate benefit (though we loose some information in the AST).
The comment below should describe more (if interested).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40907 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoadd some helpers
Chris Lattner [Tue, 7 Aug 2007 17:33:34 +0000 (17:33 +0000)]
add some helpers

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40901 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoRemove a space from "typeof" printing. It was causing the following error...
Steve Naroff [Sun, 5 Aug 2007 03:24:45 +0000 (03:24 +0000)]
Remove a space from "typeof" printing. It was causing the following error...

[dylan:clang/test/Parser] admin% ../../../../Debug/bin/clang -parse-ast-check typeof.c
Warnings expected but not seen:
  Line 21: incompatible types assigning 'typeof(*pi) const' to 'int *'
Warnings seen but not expected:
  Line 21: incompatible types assigning 'typeof(*pi)  const' to 'int *'

Also corrected a typo from my previous commit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40832 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoMake sure the good old "function/array conversion" is done to function parameters.
Steve Naroff [Sun, 5 Aug 2007 02:16:31 +0000 (02:16 +0000)]
Make sure the good old "function/array conversion" is done to function parameters.

This resulted in the following error...

[dylan:clang/test/Parser] admin% cat parmvardecl_conversion.c
// RUN: clang -parse-ast-check %s

void f (int p[]) { p++; }

[dylan:clang/test/Parser] admin% clang -parse-ast-check parmvardecl_conversion.c
Errors seen but not expected:
  Line 3: cannot modify value of type 'int []'

With this fix, the test case above succeeds.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40831 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoImplement codegen for __builtin_choose_expr. For example:
Chris Lattner [Sat, 4 Aug 2007 00:20:15 +0000 (00:20 +0000)]
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

17 years agothe sse intrinsics are missing, leading to errors.
Chris Lattner [Sat, 4 Aug 2007 00:19:10 +0000 (00:19 +0000)]
the sse intrinsics are missing, leading to errors.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40800 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agofix hang in testsuite
Chris Lattner [Sat, 4 Aug 2007 00:18:28 +0000 (00:18 +0000)]
fix hang in testsuite

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40799 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agofix constness issues.
Chris Lattner [Sat, 4 Aug 2007 00:14:36 +0000 (00:14 +0000)]
fix constness issues.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40798 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoRestrict vector component access (using "." and "[]") to variables.
Steve Naroff [Fri, 3 Aug 2007 22:40:33 +0000 (22:40 +0000)]
Restrict vector component access (using "." and "[]") to variables.
Chris suggested this, since it simplifies the code generator.
If this features is needed (and we don't think it is), we can revisit.

The following test case now produces an error.
[dylan:~/llvm/tools/clang] admin% cat t.c

typedef __attribute__(( ocu_vector_type(4) )) float float4;

static void test() {
    float4 vec4;

    vec4.rg.g;
    vec4.rg[1];
}
[dylan:~/llvm/tools/clang] admin% ../../Debug/bin/clang t.c
t.c:8:12: error: vector component access limited to variables
    vec4.rg.g;
           ^~
t.c:9:12: error: vector component access limited to variables
    vec4.rg[1];
           ^~~
2 diagnostics generated.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40795 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoImplement __builtin_choose_expr.
Steve Naroff [Fri, 3 Aug 2007 21:21:27 +0000 (21:21 +0000)]
Implement __builtin_choose_expr.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40794 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoAdd a test case to validate code gen for typeof/builtin_types_compatible.
Steve Naroff [Fri, 3 Aug 2007 18:38:22 +0000 (18:38 +0000)]
Add a test case to validate code gen for typeof/builtin_types_compatible.

This test case currently generates the following unexpected warnings (when compared with gcc).

[dylan:clang/test/Parser] admin% ../../../../Debug/bin/clang -parse-ast-check builtin_types_compatible.c
Warnings seen but not expected:
  Line 28: expression result unused
  Line 29: expression result unused
  Line 30: expression result unused
  Line 31: expression result unused
  Line 32: expression result unused
  Line 33: expression result unused

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40789 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoimplement codegen support for __builtin_types_compatible_p
Chris Lattner [Fri, 3 Aug 2007 17:51:03 +0000 (17:51 +0000)]
implement codegen support for __builtin_types_compatible_p

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40788 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agofix a buggy comment I added
Chris Lattner [Fri, 3 Aug 2007 17:47:51 +0000 (17:47 +0000)]
fix a buggy comment I added

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40787 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoRename AddrLabel and OCUVectorComponent -> AddrLabelExpr and OCUVectorElementExpr...
Chris Lattner [Fri, 3 Aug 2007 17:31:20 +0000 (17:31 +0000)]
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

17 years agotestcase for vector element access stuff.
Chris Lattner [Fri, 3 Aug 2007 16:42:43 +0000 (16:42 +0000)]
testcase for vector element access stuff.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40783 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoimplement codegen for multidest ocuvector expressions, like:
Chris Lattner [Fri, 3 Aug 2007 16:37:04 +0000 (16:37 +0000)]
implement codegen for multidest ocuvector expressions, like:

   vec2.yx = vec2; // reverse

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40782 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoadd codegen support for storing into a single-element ocu lvalue, such as:
Chris Lattner [Fri, 3 Aug 2007 16:28:33 +0000 (16:28 +0000)]
add codegen support for storing into a single-element ocu lvalue, such as:

    vec2.x = f;

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40781 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agorefactor handling of ocuvector lvalue->rvalue codegen into its own method.
Chris Lattner [Fri, 3 Aug 2007 16:18:34 +0000 (16:18 +0000)]
refactor handling of ocuvector lvalue->rvalue codegen into its own method.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40780 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoIn the common case where we are shuffling a vector, emit an
Chris Lattner [Fri, 3 Aug 2007 16:09:33 +0000 (16:09 +0000)]
In the common case where we are shuffling a vector, emit an
llvm vector shuffle instead of a bunch of insert/extract operations.
For:   vec4 = vec4.yyyy;  // splat

Emit:
        %tmp1 = shufflevector <4 x float> %tmp, <4 x float> undef, <4 x i32> < i32 1, i32 1, i32 1, i32 1 >

instead of:

        %tmp1 = extractelement <4 x float> %tmp, i32 1
        %tmp2 = insertelement <4 x float> undef, float %tmp1, i32 0
        %tmp3 = extractelement <4 x float> %tmp, i32 1
        %tmp4 = insertelement <4 x float> %tmp2, float %tmp3, i32 1
        %tmp5 = extractelement <4 x float> %tmp, i32 1
        %tmp6 = insertelement <4 x float> %tmp4, float %tmp5, i32 2
        %tmp7 = extractelement <4 x float> %tmp, i32 1
        %tmp8 = insertelement <4 x float> %tmp6, float %tmp7, i32 3

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40779 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoadd OCUVectorComponent::getNumComponents()
Chris Lattner [Fri, 3 Aug 2007 16:00:20 +0000 (16:00 +0000)]
add OCUVectorComponent::getNumComponents()

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40778 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoAdd support for scalar-returning element accesses like V.x
Chris Lattner [Fri, 3 Aug 2007 15:52:31 +0000 (15:52 +0000)]
Add support for scalar-returning element accesses like V.x

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40777 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoimplement lvalue to rvalue conversion for ocuvector components. We can now compile...
Chris Lattner [Fri, 3 Aug 2007 00:16:29 +0000 (00:16 +0000)]
implement lvalue to rvalue conversion for ocuvector components.  We can now compile stuff
like this:

typedef __attribute__(( ocu_vector_type(4) )) float float4;
float4 test1(float4 V) {
  return V.wzyx+V;
}

to:
_test1:
        pshufd  $27, %xmm0, %xmm1
        addps   %xmm0, %xmm1
        movaps  %xmm1, %xmm0
        ret

and:

_test1:
        mfspr r2, 256
        oris r3, r2, 4096
        mtspr 256, r3
        li r3, lo16(LCPI1_0)
        lis r4, ha16(LCPI1_0)
        lvx v3, r4, r3
        vperm v3, v2, v2, v3
        vaddfp v2, v3, v2
        mtspr 256, r2
        blr

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40771 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoadd support for codegen of an OCUVectorComponent as an lvalue.
Chris Lattner [Thu, 2 Aug 2007 23:37:31 +0000 (23:37 +0000)]
add support for codegen of an OCUVectorComponent as an lvalue.

We can now codegen:

  vec4.xy;

as nothing!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40769 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoAdd support for encoding a OCUVectorComponent into a single integer.
Chris Lattner [Thu, 2 Aug 2007 23:36:59 +0000 (23:36 +0000)]
Add support for encoding a OCUVectorComponent into a single integer.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40768 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agooops, this is the real fix.
Chris Lattner [Thu, 2 Aug 2007 22:41:43 +0000 (22:41 +0000)]
oops, this is the real fix.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40766 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoupdate test
Chris Lattner [Thu, 2 Aug 2007 22:36:03 +0000 (22:36 +0000)]
update test

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40765 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agorename some helpers, have them return the idx of the field being accessed.
Chris Lattner [Thu, 2 Aug 2007 22:33:49 +0000 (22:33 +0000)]
rename some helpers, have them return the idx of the field being accessed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40764 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoUse static methods, which don't require an instance of OCUVectorType
Chris Lattner [Thu, 2 Aug 2007 22:20:00 +0000 (22:20 +0000)]
Use static methods, which don't require an instance of OCUVectorType

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40763 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agomark some methods static, don't consider a vector to be an ocuvector
Chris Lattner [Thu, 2 Aug 2007 22:19:39 +0000 (22:19 +0000)]
mark some methods static, don't consider a vector to be an ocuvector

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40762 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agosilence some warnings.
Chris Lattner [Thu, 2 Aug 2007 21:50:34 +0000 (21:50 +0000)]
silence some warnings.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40761 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoMinor comment improvements.
Chris Lattner [Thu, 2 Aug 2007 21:47:28 +0000 (21:47 +0000)]
Minor comment improvements.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40760 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agomake sure we don't lose the ability to parse carbon.h
Chris Lattner [Thu, 2 Aug 2007 21:40:29 +0000 (21:40 +0000)]
make sure we don't lose the ability to parse carbon.h

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40759 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoHyphenate a word, to check auto-update feature. Third times the charm!
Reid Spencer [Thu, 2 Aug 2007 09:58:41 +0000 (09:58 +0000)]
Hyphenate a word, to check auto-update feature. Third times the charm!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40734 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoExpand a contraction to test auto-update on commit.
Reid Spencer [Thu, 2 Aug 2007 09:54:52 +0000 (09:54 +0000)]
Expand a contraction to test auto-update on commit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40733 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoTest auto-update with minor grammaro fix.
Reid Spencer [Thu, 2 Aug 2007 09:50:49 +0000 (09:50 +0000)]
Test auto-update with minor grammaro fix.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40732 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoFix a bug in my previous commit
Chris Lattner [Thu, 2 Aug 2007 04:22:39 +0000 (04:22 +0000)]
Fix a bug in my previous commit

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40719 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoswitch a fixme to an assert.
Chris Lattner [Thu, 2 Aug 2007 04:14:33 +0000 (04:14 +0000)]
switch a fixme to an assert.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40717 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoTweak to Expr::isIntegerConstantExpr...make sure the result is appropriately size...
Steve Naroff [Thu, 2 Aug 2007 04:09:23 +0000 (04:09 +0000)]
Tweak to Expr::isIntegerConstantExpr...make sure the result is appropriately size for TypesCompatibleExpr's.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40716 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoIncrease the macro id cache to look up several recent entries, not just the last...
Chris Lattner [Thu, 2 Aug 2007 03:55:37 +0000 (03:55 +0000)]
Increase the macro id cache to look up several recent entries, not just the last one.
This is important in insane cases like the one dannyb sent me recently:

#define F0(a) void a(){}
#define F1(a) F0(a##0) F0(a##1) F0(a##2) F0(a##3) F0(a##4) F0(a##5) F0(a##6) F0(a##7)
#define F2(a) F1(a##0) F1(a##1) F1(a##2) F1(a##3) F1(a##4) F1(a##5) F1(a##6) F1(a##7)
#define F3(a) F2(a##0) F2(a##1) F2(a##2) F2(a##3) F2(a##4) F2(a##5) F2(a##6) F2(a##7)
#define F4(a) F3(a##0) F3(a##1) F3(a##2) F3(a##3) F3(a##4) F3(a##5) F3(a##6) F3(a##7)
#define F5(a) F4(a##0) F4(a##1) F4(a##2) F4(a##3) F4(a##4) F4(a##5) F4(a##6) F4(a##7)
#define F6(a) F5(a##0) F5(a##1) F5(a##2) F5(a##3) F5(a##4) F5(a##5) F5(a##6) F5(a##7)
F6(f)

cpp is great.  :)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40715 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoTidy up Parser::ParseTypeofSpecifier()...implement FIXME and minor restructure.
Steve Naroff [Thu, 2 Aug 2007 02:53:48 +0000 (02:53 +0000)]
Tidy up Parser::ParseTypeofSpecifier()...implement FIXME and minor restructure.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40713 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoAdd a couple const modifiers.
Steve Naroff [Thu, 2 Aug 2007 00:19:14 +0000 (00:19 +0000)]
Add a couple const modifiers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40708 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoHack Expr::isConstantExpr() to allow for __builtin_types_compatible_p.
Steve Naroff [Thu, 2 Aug 2007 00:13:27 +0000 (00:13 +0000)]
Hack Expr::isConstantExpr() to allow for __builtin_types_compatible_p.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40705 91177308-0d34-0410-b5e6-96231b3b80d8

17 years ago- Finish hooking up support for __builtin_types_compatible_p().
Steve Naroff [Wed, 1 Aug 2007 23:45:51 +0000 (23:45 +0000)]
- Finish hooking up support for __builtin_types_compatible_p().
- Fix type printing code for recently added TypeOfExpr/TypeOfType.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40700 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoAdd AST/Sema support for __builtin_types_compatible_p (a GNU extension).
Steve Naroff [Wed, 1 Aug 2007 22:05:33 +0000 (22:05 +0000)]
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

17 years agoAdd comments to getTypeOfExpr/getTypeOfType.
Steve Naroff [Wed, 1 Aug 2007 18:02:17 +0000 (18:02 +0000)]
Add comments to getTypeOfExpr/getTypeOfType.
Also add instances of TypeOfExpr/TypeOfType to the Types vector (so we can keep track of them).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40677 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoTwo typeof() related changes...
Steve Naroff [Wed, 1 Aug 2007 17:20:42 +0000 (17:20 +0000)]
Two typeof() related changes...

- Changed the name of ASTContext::getTypeOfType(Expr*)->getTypeOfExpr().
- Remove FIXME for TypeOfExpr::getAsStringInternal(). This will work fine for printing the AST. It isn't ideal
for error diagnostics (since it's more natural to display the expressions type).

One "random" (or at least delayed:-) change...

- Changed all "ext_typecheck_*" diagnostics from EXTENSION->WARNING. Reason: Since -pedantic is now
off (by default), these diagnostics were never being emitted (which is bad). With this change, clang will
emit the warning all the time. The only downside (wrt GCC compatibility) is -pedantic-errors will not turn
this diagnostics into errors (a "feature" of making tagging them with EXTENSION). When/if this becomes
an issue, we can revisit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40676 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoupdate this to build with LLVM ToT
Chris Lattner [Wed, 1 Aug 2007 06:24:52 +0000 (06:24 +0000)]
update this to build with LLVM ToT

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40665 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoPrint floating point literal values better.
Chris Lattner [Wed, 1 Aug 2007 00:23:58 +0000 (00:23 +0000)]
Print floating point literal values better.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40659 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoTighten up Parser::ParseTypeofSpecifier().
Steve Naroff [Tue, 31 Jul 2007 23:56:32 +0000 (23:56 +0000)]
Tighten up Parser::ParseTypeofSpecifier().
Add some more tests to typeof.c. Also added a couple of missing "expect" attributes that caused the test to fail.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40656 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoremove more explicit accesses to the canonical type pointer.
Chris Lattner [Tue, 31 Jul 2007 21:33:24 +0000 (21:33 +0000)]
remove more explicit accesses to the canonical type pointer.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40653 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agosimplify some type checking code, don't explicitly access
Chris Lattner [Tue, 31 Jul 2007 21:27:01 +0000 (21:27 +0000)]
simplify some type checking code, don't explicitly access
canonical types.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40652 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agomove trivial type predicates inline.
Chris Lattner [Tue, 31 Jul 2007 21:13:58 +0000 (21:13 +0000)]
move trivial type predicates inline.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40651 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agosplit the rest of the type predicates into pure predicates:
Chris Lattner [Tue, 31 Jul 2007 19:29:30 +0000 (19:29 +0000)]
split the rest of the type predicates into pure predicates:
there is now an isXXXType and a getAsXXXType

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40646 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoadd internals manual to project
Chris Lattner [Tue, 31 Jul 2007 18:57:09 +0000 (18:57 +0000)]
add internals manual to project

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40645 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoOwen pointed out that this made no sense :)
Chris Lattner [Tue, 31 Jul 2007 18:54:50 +0000 (18:54 +0000)]
Owen pointed out that this made no sense :)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40644 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoadd two missing files to the xcode project.
Chris Lattner [Tue, 31 Jul 2007 18:43:04 +0000 (18:43 +0000)]
add two missing files to the xcode project.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40643 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agorename isReferenceType to follow the new scheme.
Chris Lattner [Tue, 31 Jul 2007 16:56:34 +0000 (16:56 +0000)]
rename isReferenceType to follow the new scheme.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40640 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agomake isPointerType() a pure predicate, rename the
Chris Lattner [Tue, 31 Jul 2007 16:53:04 +0000 (16:53 +0000)]
make isPointerType() a pure predicate, rename the
existing one to getAsPointerType()

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40639 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoupdate name
Chris Lattner [Tue, 31 Jul 2007 16:50:51 +0000 (16:50 +0000)]
update name

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40637 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoAdd parsing and AST support for GNU "typeof".
Steve Naroff [Tue, 31 Jul 2007 12:34:36 +0000 (12:34 +0000)]
Add parsing and AST support for GNU "typeof".
Many small changes to lot's of files.
Still some FIXME's, however the basic support is in place.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40631 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoOops, I committed the wrong file before. This expands the description of
Chris Lattner [Tue, 31 Jul 2007 06:37:39 +0000 (06:37 +0000)]
Oops, I committed the wrong file before.  This expands the description of
type.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40620 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoAdd a start at a clang internals manual, documenting some
Chris Lattner [Tue, 31 Jul 2007 05:42:17 +0000 (05:42 +0000)]
Add a start at a clang internals manual, documenting some
of the more subtle and interesting classes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40615 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoadd a link
Chris Lattner [Tue, 31 Jul 2007 04:52:37 +0000 (04:52 +0000)]
add a link

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40614 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoDon't use canonical type for sema here. In
Chris Lattner [Mon, 30 Jul 2007 18:53:26 +0000 (18:53 +0000)]
Don't use canonical type for sema here.  In

void func() {
typedef int foo;
foo *Y;
**Y; // error
}

we now get:
indirection requires pointer operand ('foo' invalid)
instead of:
indirection requires pointer operand ('int' invalid)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40597 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoUpgrade a comment...
Steve Naroff [Mon, 30 Jul 2007 03:52:55 +0000 (03:52 +0000)]
Upgrade a comment...

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40585 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoFinish up semantic analysis for vector components.
Steve Naroff [Mon, 30 Jul 2007 03:29:09 +0000 (03:29 +0000)]
Finish up semantic analysis for vector components.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40584 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoImplement pretty diagnostics when doing on-the-fly vector sizing (for vector componen...
Steve Naroff [Sun, 29 Jul 2007 16:33:31 +0000 (16:33 +0000)]
Implement pretty diagnostics when doing on-the-fly vector sizing (for vector component access).

For example, before this commit, the following diagnostics would be emitted...

ocu.c:49:12: error: incompatible types assigning 'float  __attribute__((ocu_vector_type(3)))' to 'float4'
    vec4_2 = vec4.rgb; // shorten
    ~~~~~~ ^ ~~~~~~~~
ocu.c:51:7: error: incompatible types assigning 'float  __attribute__((ocu_vector_type(2)))' to 'float'
    f = vec2.xx; // shorten
    ~ ^ ~~~~~~~

Now, the diagnostics look as you would expect...

ocu.c:49:12: error: incompatible types assigning 'float3' to 'float4'
    vec4_2 = vec4.rgb; // shorten
    ~~~~~~ ^ ~~~~~~~~
ocu.c:51:7: error: incompatible types assigning 'float2' to 'float'
    f = vec2.xx; // shorten
    ~ ^ ~~~~~~~

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40579 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoAdded a new expression, OCUVectorComponent.
Steve Naroff [Sat, 28 Jul 2007 23:10:27 +0000 (23:10 +0000)]
Added a new expression, OCUVectorComponent.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40577 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoImplement syntax/semantic analysis for OCU Vector Components.
Steve Naroff [Fri, 27 Jul 2007 22:15:19 +0000 (22:15 +0000)]
Implement syntax/semantic analysis for OCU Vector Components.
Next step, AST support...

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40568 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoAdd Type::isOCUVectorType().
Steve Naroff [Thu, 26 Jul 2007 18:32:01 +0000 (18:32 +0000)]
Add Type::isOCUVectorType().
Convert isFunctionType(), isStructureType(), and isUnionType() to the new API.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40541 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoFix the following bogus diagnostic...reported by Jeroen.
Steve Naroff [Thu, 26 Jul 2007 14:35:56 +0000 (14:35 +0000)]
Fix the following bogus diagnostic...reported by Jeroen.

#include <stdio.h>

int
main(void) {
        int test = 0;

        printf("Type is %s\n", (test >= 1 ? "short" : "char"));

        return (0);
}

It comes up with a diagnostic that's misleading upon first read.

t.c:7:36: error: incompatible operand types ('char *' and 'char *')
        printf("Type is %s\n", (test >= 1 ? "short" : "char"));
                                          ^ ~~~~~~~   ~~~~~~
1 diagnostic generated.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40526 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoadd another link.
Chris Lattner [Thu, 26 Jul 2007 06:11:49 +0000 (06:11 +0000)]
add another link.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40512 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agodon't expect to be able to reparse arbitrary system headers.
Chris Lattner [Thu, 26 Jul 2007 05:59:05 +0000 (05:59 +0000)]
don't expect to be able to reparse arbitrary system headers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40511 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoForgot a return stmt (oops).
Steve Naroff [Thu, 26 Jul 2007 03:18:02 +0000 (03:18 +0000)]
Forgot a return stmt (oops).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40509 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoVarious improvements to Sema::ParseMemberReferenceExpr().
Steve Naroff [Thu, 26 Jul 2007 03:11:44 +0000 (03:11 +0000)]
Various improvements to Sema::ParseMemberReferenceExpr().

- Added source range support to Diag's.
- Used the new type predicate API to remove dealing with the canonical
type explicitly.
- Added Type::isRecordType().
- Removed some casts.
- Removed a const qualifier from RecordType::getDecl().

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40508 91177308-0d34-0410-b5e6-96231b3b80d8

17 years ago- Fix commit in Parser.h (patch by Kevin Andre).
Steve Naroff [Wed, 25 Jul 2007 20:45:33 +0000 (20:45 +0000)]
- Fix commit in Parser.h (patch by Kevin Andre).
- Add comment and minor cleanup to yesterday's fix to ParseCallExpr().

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40492 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoFix a couple of bugs, add some new cool stuff.
Chris Lattner [Wed, 25 Jul 2007 00:24:17 +0000 (00:24 +0000)]
Fix a couple of bugs, add some new cool stuff.

1. Fix a todo in Parser::ParseTag, to recover better.  On code like
   that in test/Sema/decl-invalid.c it causes us to return a single
   error instead of multiple.
2. Fix an error in Sema::ParseDeclarator, where it would crash if the
   declarator didn't have an identifier.  Instead, diagnose the problem.
3. Start adding infrastructure to track the range of locations covered
   by a declspec or declarator.  This is mostly implemented for declspec,
   but could be improved, it is missing for declarator.

Thanks to Neil for pointing out this crash.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40482 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoFix Sema::ParseCallExpr()...it wasn't doing the default array/function promotions...
Steve Naroff [Tue, 24 Jul 2007 21:46:40 +0000 (21:46 +0000)]
Fix Sema::ParseCallExpr()...it wasn't doing the default array/function promotions on it's argument types.

This resulted in the following errors when compiling promote_types_in_proto.c test...

[dylan:~/llvm/tools/clang] admin% ../../Debug/bin/clang test/Parser/promote_types_in_proto.c
test/Parser/promote_types_in_proto.c:7:24: error: incompatible types passing 'char *[]' to function expecting 'char *const []'
        arrayPromotion(argv);
        ~~~~~~~~~~~~~~ ^~~~
test/Parser/promote_types_in_proto.c:8:27: error: incompatible types passing 'void (char *const [])' to function expecting 'void (char *const [])'
        functionPromotion(arrayPromotion);
        ~~~~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~
2 diagnostics generated.

When fixing this, noticed that both ParseCallExpr() and ParseReturnStmt() were prematurely comparing types for
equivalence. This is incorrect (since the expr. promotions haven't been done yet). To fix this, I moved the
check "down" to Sema::CheckAssignmentConstraints().

I also converted Type::isArrayType() to the modern API (since I needed it). Still more Type predicates to
convert.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40475 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoadd documentation skeleton
Chris Lattner [Tue, 24 Jul 2007 18:03:18 +0000 (18:03 +0000)]
add documentation skeleton

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40471 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoadd a bare bones web page
Chris Lattner [Tue, 24 Jul 2007 17:59:54 +0000 (17:59 +0000)]
add a bare bones web page

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40470 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoFix a comment, patch by Kevin Andre!
Chris Lattner [Tue, 24 Jul 2007 17:03:04 +0000 (17:03 +0000)]
Fix a comment, patch by Kevin Andre!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40466 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoimplement ast building and trivial semantic analysis of stmt exprs.
Chris Lattner [Tue, 24 Jul 2007 16:58:17 +0000 (16:58 +0000)]
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

17 years agoavoid std::string yet again.
Chris Lattner [Tue, 24 Jul 2007 06:59:01 +0000 (06:59 +0000)]
avoid std::string yet again.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40462 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoUse a smallstring instead of an std::string in FileChanged to avoid some malloc traffic.
Chris Lattner [Tue, 24 Jul 2007 06:57:14 +0000 (06:57 +0000)]
Use a smallstring instead of an std::string in FileChanged to avoid some malloc traffic.

This speeds up -E on xalancbmk by 2.4%

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40461 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agocheck in an experiment that didn't work out, to allow for future investigation.
Chris Lattner [Tue, 24 Jul 2007 06:43:46 +0000 (06:43 +0000)]
check in an experiment that didn't work out, to allow for future investigation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40460 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoAdd a cache to SourceManager to accellerate line # lookup. This is a
Chris Lattner [Tue, 24 Jul 2007 05:57:19 +0000 (05:57 +0000)]
Add a cache to SourceManager to accellerate line # lookup.  This is a
bottleneck for -E computation, because every token that starts a line needs
to determine *which* line it is on (so -E mode can insert the appropriate
vertical whitespace).  This optimization improves this common case where
it is striding through the line # table.

This speeds up -E on xalancbmk by 3.2%

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40459 91177308-0d34-0410-b5e6-96231b3b80d8

17 years agoFix two paste-avoidance bugs I introduced last night. Patch
Chris Lattner [Mon, 23 Jul 2007 23:21:34 +0000 (23:21 +0000)]
Fix two paste-avoidance bugs I introduced last night.  Patch
by Neil Booth.  This fixes Preprocessor/output_paste_avoid.c

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40454 91177308-0d34-0410-b5e6-96231b3b80d8