]> granicus.if.org Git - clang/log
clang
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

17 years agofix bogus warnings about potentially uninit vars Size and Align.
Chris Lattner [Mon, 23 Jul 2007 22:46:22 +0000 (22:46 +0000)]
fix bogus warnings about potentially uninit vars Size and Align.

Patch by Neil Booth!

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

17 years agoFix a scoping bug that apple gcc doesn't catch for some reason.
Chris Lattner [Mon, 23 Jul 2007 22:23:52 +0000 (22:23 +0000)]
Fix a scoping bug that apple gcc doesn't catch for some reason.

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

17 years agocorrectly verify that default and case are in a switchstmt,
Chris Lattner [Mon, 23 Jul 2007 17:05:23 +0000 (17:05 +0000)]
correctly verify that default and case are in a switchstmt,
this fixes test/Sema/switch.c.

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

17 years agoavoid creating std::strings in MoveToLine
Chris Lattner [Mon, 23 Jul 2007 06:31:11 +0000 (06:31 +0000)]
avoid creating std::strings in MoveToLine

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

17 years agoIn OutputString, avoid calling memcpy for really tiny strings.
Chris Lattner [Mon, 23 Jul 2007 06:23:07 +0000 (06:23 +0000)]
In OutputString, avoid calling memcpy for really tiny strings.
This speeds up -E on 447.dealII by 5.8%

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

17 years agoAvoid calling getSpelling at all for identifiers, which are
Chris Lattner [Mon, 23 Jul 2007 06:14:36 +0000 (06:14 +0000)]
Avoid calling getSpelling at all for identifiers, which are
trivial to handle and very very common.  This speeds up -E on
447.dealII by 2.5%

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

17 years agochange the concatenation avoidance algorithm to be partially table-driven
Chris Lattner [Mon, 23 Jul 2007 06:09:34 +0000 (06:09 +0000)]
change the concatenation avoidance algorithm to be partially table-driven
and avoid computing the spelling of tokens when not needed.  This speeds
up -E on 447.dealII by 2.2%

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

17 years agoIf a token doesn't need cleaning, we can get its first character
Chris Lattner [Mon, 23 Jul 2007 05:18:42 +0000 (05:18 +0000)]
If a token doesn't need cleaning, we can get its first character
without having to get the whole token.  This speeds up -E on
447.dealII by 1.8%

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

17 years agoA minor tweak to -E output, speeding up -E 1.5% on 447.dealII
Chris Lattner [Mon, 23 Jul 2007 05:14:05 +0000 (05:14 +0000)]
A minor tweak to -E output, speeding up -E 1.5% on 447.dealII

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

17 years agoimplement a missing feature in the #include handler, where
Chris Lattner [Mon, 23 Jul 2007 04:56:47 +0000 (04:56 +0000)]
implement a missing feature in the #include handler, where
it did not handle <xyz> headers coming from macro expansions.
This requires special treatment, as the include name is lexed
as multiple tokens, which require reassembly before processing.

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

17 years agorefactor the interface to Preprocessor::GetIncludeFilenameSpelling,
Chris Lattner [Mon, 23 Jul 2007 04:15:27 +0000 (04:15 +0000)]
refactor the interface to Preprocessor::GetIncludeFilenameSpelling,
no functionality changes.

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

17 years agofix a bug getting the spelling of an identifier token
Chris Lattner [Sun, 22 Jul 2007 22:50:09 +0000 (22:50 +0000)]
fix a bug getting the spelling of an identifier token
that required cleaning.  If the token required cleaning,
don't include the cleaned tokens in the returned length.

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

17 years agono need to avoid pasting >* It can't form ->*, because we know the previous
Chris Lattner [Sun, 22 Jul 2007 22:33:25 +0000 (22:33 +0000)]
no need to avoid pasting >*    It can't form ->*, because we know the previous
token was not -> and if the token before it was -, the - and > would avoid pasting.

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

17 years agoGCC doesn't set __STDC_VERSION__ usually. It never sets it in
Chris Lattner [Sun, 22 Jul 2007 22:11:35 +0000 (22:11 +0000)]
GCC doesn't set __STDC_VERSION__ usually.  It never sets it in
C++ mode, even gnu C++ mode.

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

17 years agoSwitch TargetInfo::getTargetDefines from using an std::map<std::string, ...> to using
Chris Lattner [Sun, 22 Jul 2007 20:11:46 +0000 (20:11 +0000)]
Switch TargetInfo::getTargetDefines from using an std::map<std::string, ...> to using
a llvm::StringMap.  This dramatically reduces the startup time of the preprocessor,
speeding up -Eonly on xalankbmk by 2.2%.

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

17 years agoChange hte lexer to start a start pointer to the underlying
Chris Lattner [Sun, 22 Jul 2007 18:44:36 +0000 (18:44 +0000)]
Change hte lexer to start a start pointer to the underlying
memorybuffer instead of a pointer to the memorybuffer itself.  This
reduces coupling and eliminates a pointer dereference on a hot path.
This speeds up -Eonly on 483.xalancbmk by 2.1%

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

17 years agosplit the slow path out of Lexer::getSourceLocation and do not let the
Chris Lattner [Sun, 22 Jul 2007 18:38:25 +0000 (18:38 +0000)]
split the slow path out of Lexer::getSourceLocation and do not let the
compiler inline it.  This speeds up -Eonly on 483.xalancbmk by about 1%

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

17 years agoImplement a simple cache in headersearch. This speeds up
Chris Lattner [Sun, 22 Jul 2007 07:28:00 +0000 (07:28 +0000)]
Implement a simple cache in headersearch.  This speeds up
preprocessing 483.xalancbmk by about 10%, reducing the number
of file lookup queries from 2139411 to 199466 (over 10x)

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

17 years agoRefactor switch analysis to make it possible to detect duplicate case values
Anders Carlsson [Sun, 22 Jul 2007 07:07:56 +0000 (07:07 +0000)]
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

17 years agoremove redundant test
Chris Lattner [Sun, 22 Jul 2007 06:40:36 +0000 (06:40 +0000)]
remove redundant test

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

17 years agoavoid a small bit of string traffic by not storing the ""'s around a string in CurFil...
Chris Lattner [Sun, 22 Jul 2007 06:38:50 +0000 (06:38 +0000)]
avoid a small bit of string traffic by not storing the ""'s around a string in CurFilename

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

17 years agoavoid recursion between SkipBCPLComment and SkipWhitespace. In cases like this:
Chris Lattner [Sun, 22 Jul 2007 06:29:05 +0000 (06:29 +0000)]
avoid recursion between SkipBCPLComment and SkipWhitespace.  In cases like this:

   // foo
   // bar
   // baz

we'd get two levels of call (bcpl & whitespace) for each line, leading to some
seriously deep stacks in some cases.

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

17 years agowhen running in -E mode on multiple files, there is no reason to accumulate
Chris Lattner [Sun, 22 Jul 2007 06:05:44 +0000 (06:05 +0000)]
when running in -E mode on multiple files, there is no reason to accumulate
fileid's and macroid's across files.  Clearing between files keeps the tables
smaller and slightly speeds up compilation.

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

17 years agoCatch goto's with a missing identifier, patch by Neil Booth.
Chris Lattner [Sun, 22 Jul 2007 04:13:33 +0000 (04:13 +0000)]
Catch goto's with a missing identifier, patch by Neil Booth.

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

17 years agoFix a really subtle bug in the macro expander caching code, where
Chris Lattner [Sun, 22 Jul 2007 01:16:55 +0000 (01:16 +0000)]
Fix a really subtle bug in the macro expander caching code, where
redefinition of a macro could cause invalid memory to be deleted.
Found preprocessing 253.perlbmk.

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

17 years agoFix a lexer bug where we incorrectly rejected
Chris Lattner [Sat, 21 Jul 2007 23:43:37 +0000 (23:43 +0000)]
Fix a lexer bug where we incorrectly rejected
int i = /*/ */ 1;

Thanks to Neil for pointing this out.

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

17 years agoMinor simplification to Expr::isLvalue().
Steve Naroff [Sat, 21 Jul 2007 13:32:03 +0000 (13:32 +0000)]
Minor simplification to Expr::isLvalue().

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

17 years agoAdd support for reusing macroid's with negative physical loc deltas. This
Chris Lattner [Sat, 21 Jul 2007 06:41:57 +0000 (06:41 +0000)]
Add support for reusing macroid's with negative physical loc deltas. This
keeps the MacroInfo table more compact.

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

17 years agoimplement getSourceRange for ImplicitCast
Chris Lattner [Sat, 21 Jul 2007 06:32:11 +0000 (06:32 +0000)]
implement getSourceRange for ImplicitCast

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

17 years agoReturn an exit code of 1 if errors occur, not an exit code equal to the # errors :)
Chris Lattner [Sat, 21 Jul 2007 05:40:53 +0000 (05:40 +0000)]
Return an exit code of 1 if errors occur, not an exit code equal to the # errors :)

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

17 years agominor simplifications
Chris Lattner [Sat, 21 Jul 2007 05:33:26 +0000 (05:33 +0000)]
minor simplifications

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

17 years agotestcase from neil
Chris Lattner [Sat, 21 Jul 2007 05:32:22 +0000 (05:32 +0000)]
testcase from neil

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

17 years agorecover from void argument types more nicely.
Chris Lattner [Sat, 21 Jul 2007 05:30:18 +0000 (05:30 +0000)]
recover from void argument types more nicely.

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

17 years agobetter wording for an error, suggested by Neil.
Chris Lattner [Sat, 21 Jul 2007 05:26:43 +0000 (05:26 +0000)]
better wording for an error, suggested by Neil.

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

17 years agoImplement code generation for __func__, __FUNCTION__ and __PRETTY_FUNCTION__
Anders Carlsson [Sat, 21 Jul 2007 05:21:51 +0000 (05:21 +0000)]
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

17 years agoimprove and simplify error recovery for calls, fix a crash when diagnosing
Chris Lattner [Sat, 21 Jul 2007 05:18:12 +0000 (05:18 +0000)]
improve and simplify error recovery for calls, fix a crash when diagnosing
invalid arguments.

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

17 years agofix a warning on some compilers
Chris Lattner [Sat, 21 Jul 2007 04:57:45 +0000 (04:57 +0000)]
fix a warning on some compilers

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

17 years agoadd an evil macro expansion perf test from Neil.
Chris Lattner [Sat, 21 Jul 2007 04:54:14 +0000 (04:54 +0000)]
add an evil macro expansion perf test from Neil.

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

17 years agoFix off-by-one error when emitting diagnostics. Also, make diagnostic
Chris Lattner [Sat, 21 Jul 2007 03:09:58 +0000 (03:09 +0000)]
Fix off-by-one error when emitting diagnostics.  Also, make diagnostic
a bit nicer for people who pass lots of extra arguments to calls by
selecting them all instead of just the first one:

arg-duplicate.c:13:13: error: too many arguments to function
  f3 (1, 1, 2, 3, 4);   // expected-error {{too many arguments to function}}
            ^~~~~~~

This implements test/Sema/arg-duplicate.c, thanks to Neil for pointing
out this crash.

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

17 years agomove some casts up to the entry of the function for clarity.
Chris Lattner [Sat, 21 Jul 2007 03:03:59 +0000 (03:03 +0000)]
move some casts up to the entry of the function for clarity.

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

17 years agoTwo fixes:
Chris Lattner [Sat, 21 Jul 2007 03:00:26 +0000 (03:00 +0000)]
Two fixes:
1) fix a crash on test/Sema/default.c by making
   sure that the switch scope is non-null.
2) if there is an error sema'ing a default or case stmt,
   make sure to return the substmt up, so that the error
   recovery code has more acurate info to continue with.

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

17 years agoFix a valgrind error noticed by Benoit Boissinot
Chris Lattner [Fri, 20 Jul 2007 18:48:28 +0000 (18:48 +0000)]
Fix a valgrind error noticed by Benoit Boissinot

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

17 years agoremove some old cruft
Chris Lattner [Fri, 20 Jul 2007 18:26:45 +0000 (18:26 +0000)]
remove some old cruft

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

17 years agofix a nasty bug Owen noticed in a gcc warning.
Chris Lattner [Fri, 20 Jul 2007 18:13:33 +0000 (18:13 +0000)]
fix a nasty bug Owen noticed in a gcc warning.

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

17 years agoimprove comments, implement a trivial single-entry cache in
Chris Lattner [Fri, 20 Jul 2007 18:00:12 +0000 (18:00 +0000)]
improve comments, implement a trivial single-entry cache in
SourceManager::getInstantiationLoc.  With this change, every token
expanded from a macro doesn't get its own MacroID.  :)

This reduces # macro IDs in carbon.h from 16805 to 9197

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

17 years agoUpdate project for LexerToken.h -> Token.h
Chris Lattner [Fri, 20 Jul 2007 17:01:09 +0000 (17:01 +0000)]
Update project for LexerToken.h -> Token.h

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

17 years agoAt one point there were going to be lexer and parser tokens.
Chris Lattner [Fri, 20 Jul 2007 16:59:19 +0000 (16:59 +0000)]
At one point there were going to be lexer and parser tokens.
Since that point is now long gone, we should rename LexerToken to
Token, as it is the only kind of token we have.

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

17 years agosimplify the lexer ctor to take a SLoc instead of a sloc and a redundant buffer*.
Chris Lattner [Fri, 20 Jul 2007 16:52:03 +0000 (16:52 +0000)]
simplify the lexer ctor to take a SLoc instead of a sloc and a redundant buffer*.

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

17 years agoReimplement SourceLocation. Instead of having a
Chris Lattner [Fri, 20 Jul 2007 16:37:10 +0000 (16:37 +0000)]
Reimplement SourceLocation.  Instead of having a
fileid/offset pair, it now contains a bit discriminating between
mapped locations and file locations.  This separates the tables for
macros and files in SourceManager, and allows better separation of
concepts in the rest of the compiler.  This allows us to have *many*
macro instantiations before running out of 'addressing space'.

This is also more efficient, because testing whether something is a
macro expansion is now a bit test instead of a table lookup (which
also used to require having a srcmgr around, now it doesn't).

This is fully functional, but there are several refinements and
optimizations left.

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