]>
granicus.if.org Git - clang/log
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Chris Lattner [Thu, 19 Jul 2007 22:06:24 +0000 (22:06 +0000)]
implement size/alignment analysis for arrays and vectors. This gets carbon.h working again.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40068
91177308 -0d34-0410-b5e6-
96231b3b80d8
Steve Naroff [Thu, 19 Jul 2007 21:32:11 +0000 (21:32 +0000)]
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
Chris Lattner [Thu, 19 Jul 2007 16:11:58 +0000 (16:11 +0000)]
Fix a stringizing bug that Neil noticed. We should preprocess this:
#define t(x) #x
t(a
c)
to "a c", not "ac".
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40060
91177308 -0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Thu, 19 Jul 2007 05:13:51 +0000 (05:13 +0000)]
silence a warning by treating ocuvectors the same as vectors.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40037
91177308 -0d34-0410-b5e6-
96231b3b80d8
Steve Naroff [Thu, 19 Jul 2007 01:06:55 +0000 (01:06 +0000)]
Work towards fixing crasher with compound literals...
Before this commit, we crashed in ParseBinOp...
[dylan:~/llvm/tools/clang] admin% ../../Debug/bin/clang -parse-ast-check compound_literal.c
SemaExpr.cpp:1298: failed assertion `(rhs != 0) && "ParseBinOp(): missing right expression"'
With this commit, we still crash in the newly added action ParseCompoundLiteral (which is progress:-)
[dylan:~/llvm/tools/clang] admin% ../../Debug/bin/clang -parse-ast-check compound_literal.c
SemaExpr.cpp:478: failed assertion `(Op != 0) && "ParseCompoundLiteral(): missing expression"'
The crash go away once the actions return AST nodes. I will do this in a separate commit.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40032
91177308 -0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Thu, 19 Jul 2007 00:42:40 +0000 (00:42 +0000)]
Fix a crasher that Neil reported: Sema::GetTypeForDeclarator should never
return a null type. If there is an error parsing the type, pick a new type
for error recovery purposes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40029
91177308 -0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Thu, 19 Jul 2007 00:11:19 +0000 (00:11 +0000)]
Make sure to initialize an ivar, patch by Benoit Boissinot.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40027
91177308 -0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Thu, 19 Jul 2007 00:07:36 +0000 (00:07 +0000)]
Correctly respect C99 5.1.1.2p4 when searching for the first '(' of
a function-like macro invocation. Patch contributed by Neil Booth.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40026
91177308 -0d34-0410-b5e6-
96231b3b80d8