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

36298 Коммитов

Автор SHA1 Сообщение Дата
Chris Lattner 2ad07f06c5 add internals manual to project
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40645 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-31 18:57:09 +00:00
Chris Lattner 33fc68a7c3 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
2007-07-31 18:54:50 +00:00
Chris Lattner b39eec4913 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
2007-07-31 18:43:04 +00:00
Chris Lattner a1d9fdea79 rename isReferenceType to follow the new scheme.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40640 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-31 16:56:34 +00:00
Chris Lattner befee48ff2 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
2007-07-31 16:53:04 +00:00
Chris Lattner 11406c1428 update name
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40637 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-31 16:50:51 +00:00
Steve Naroff d1861fd633 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
2007-07-31 12:34:36 +00:00
Chris Lattner 8a2bc625e8 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
2007-07-31 06:37:39 +00:00
Chris Lattner 86920d33ad 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
2007-07-31 05:42:17 +00:00
Chris Lattner 8993e90cd2 add a link
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40614 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-31 04:52:37 +00:00
Chris Lattner d51d890954 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
2007-07-30 18:53:26 +00:00
Steve Naroff fcac0fff87 Upgrade a comment...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40585 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-30 03:52:55 +00:00
Steve Naroff fec0b49c3f Finish up semantic analysis for vector components.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40584 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-30 03:29:09 +00:00
Steve Naroff bea0b34d99 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
2007-07-29 16:33:31 +00:00
Steve Naroff 31a458462c Added a new expression, OCUVectorComponent.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40577 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-28 23:10:27 +00:00
Steve Naroff e1b31fedbc 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
2007-07-27 22:15:19 +00:00
Steve Naroff 7064f5c95b 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
2007-07-26 18:32:01 +00:00
Steve Naroff 08f794b212 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
2007-07-26 14:35:56 +00:00
Chris Lattner 18cf0ffa74 add another link.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40512 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-26 06:11:49 +00:00
Chris Lattner eca996743d 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
2007-07-26 05:59:05 +00:00
Steve Naroff adc01856ec Forgot a return stmt (oops).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40509 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-26 03:18:02 +00:00
Steve Naroff dfa6aae5a1 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
2007-07-26 03:11:44 +00:00
Steve Naroff 82c7e6d821 - 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
2007-07-25 20:45:33 +00:00
Chris Lattner e80a59cc41 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
2007-07-25 00:24:17 +00:00
Steve Naroff 700204c74b 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
2007-07-24 21:46:40 +00:00
Chris Lattner 9572a5f5ea add documentation skeleton
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40471 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-24 18:03:18 +00:00
Chris Lattner 706c99a306 add a bare bones web page
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40470 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-24 17:59:54 +00:00
Chris Lattner 012cf46425 Fix a comment, patch by Kevin Andre!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40466 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-24 17:03:04 +00:00
Chris Lattner ab18c4c0ac implement ast building and trivial semantic analysis of stmt exprs.
This implements test/Sema/stmt_exprs.c



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40465 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-24 16:58:17 +00:00
Chris Lattner 5143196b90 avoid std::string yet again.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40462 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-24 06:59:01 +00:00
Chris Lattner d8e3083840 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
2007-07-24 06:57:14 +00:00
Chris Lattner 1cf12bfa80 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
2007-07-24 06:43:46 +00:00
Chris Lattner 5e36a7a89d 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
2007-07-24 05:57:19 +00:00
Chris Lattner b638a309b6 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
2007-07-23 23:21:34 +00:00
Chris Lattner dc0d73e649 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
2007-07-23 22:46:22 +00:00
Chris Lattner f11ccfcd7b 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
2007-07-23 22:23:52 +00:00
Chris Lattner 8a87e57beb 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
2007-07-23 17:05:23 +00:00
Chris Lattner f063721c4b avoid creating std::strings in MoveToLine
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40424 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-23 06:31:11 +00:00
Chris Lattner e225e378c6 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
2007-07-23 06:23:07 +00:00
Chris Lattner 2933f41ed5 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
2007-07-23 06:14:36 +00:00
Chris Lattner f0f2b29543 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
2007-07-23 06:09:34 +00:00
Chris Lattner b19f5e8415 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
2007-07-23 05:18:42 +00:00
Chris Lattner 822f940647 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
2007-07-23 05:14:05 +00:00
Chris Lattner 706ab50019 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
2007-07-23 04:56:47 +00:00
Chris Lattner f1c99acc54 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
2007-07-23 04:15:27 +00:00
Chris Lattner 0f67032078 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
2007-07-22 22:50:09 +00:00
Chris Lattner 349b42aed2 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
2007-07-22 22:33:25 +00:00
Chris Lattner 94fea5a956 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
2007-07-22 22:11:35 +00:00
Chris Lattner e36751b12c 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
2007-07-22 20:11:46 +00:00
Chris Lattner 448cec4c1c 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
2007-07-22 18:44:36 +00:00