]> granicus.if.org Git - clang/log
clang
16 years agoimplement codegen for functions whose function body type don't match
Chris Lattner [Sun, 2 Dec 2007 06:27:33 +0000 (06:27 +0000)]
implement codegen for functions whose function body type don't match
their prototype.

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

16 years agomerge functions with multiple function decls if they have the same name.
Chris Lattner [Sun, 2 Dec 2007 05:56:05 +0000 (05:56 +0000)]
merge functions with multiple function decls if they have the same name.

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

16 years agoTeach clang the prototype for __builtin_alloca.
Chris Lattner [Sun, 2 Dec 2007 05:42:36 +0000 (05:42 +0000)]
Teach clang the prototype for __builtin_alloca.

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

16 years agoconvert the rest of the stderr users in codegen to use diagnostics.
Chris Lattner [Sun, 2 Dec 2007 01:49:16 +0000 (01:49 +0000)]
convert the rest of the stderr users in codegen to use diagnostics.

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

16 years agomove unsupported warning into a centralized place.
Chris Lattner [Sun, 2 Dec 2007 01:43:38 +0000 (01:43 +0000)]
move unsupported warning into a centralized place.

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

16 years agoWarn about unsupported codegen with the diags machinery, giving us:
Chris Lattner [Sun, 2 Dec 2007 01:40:18 +0000 (01:40 +0000)]
Warn about unsupported codegen with the diags machinery, giving us:

t.c:3322:5: warning: cannot codegen this yet
    __asm__ ("bswap   %0" : "+r" (_data));
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

instead of:

Unimplemented stmt!
(AsmStmt 0x80eaa0 <t.c:3331:5, line:3334:28>)

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

16 years agoregister clz and ctz builtins.
Chris Lattner [Sun, 2 Dec 2007 01:20:23 +0000 (01:20 +0000)]
register clz and ctz builtins.

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

16 years agofix a crash when the rewriter would scan off the beginning of the file.
Chris Lattner [Sun, 2 Dec 2007 01:13:47 +0000 (01:13 +0000)]
fix a crash when the rewriter would scan off the beginning of the file.

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

16 years agoadd support for custom client-specific diagnostics. As a testcase, make the
Chris Lattner [Sun, 2 Dec 2007 01:09:57 +0000 (01:09 +0000)]
add support for custom client-specific diagnostics.  As a testcase, make the
rewriter emit this error if it fails to rewrite an @encode:

t.m:17:9: error: rewriter could not replace sub-expression due to macros
    c = ENC(char *)[2] + 4;
        ^~~~~~~~~~~

... where ENC is: #define ENC @encode

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

16 years agoAdd support for __builtin_expect which is needed for assert,
Oliver Hunt [Sun, 2 Dec 2007 01:03:24 +0000 (01:03 +0000)]
Add support for __builtin_expect which is needed for assert,
among other things.

Also change a codegen warning to dump to stderr so it doesn't
mess with -emit-llvm output

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

16 years agoimprove VC++ compatibility, patch by Cédric Venet.
Chris Lattner [Sun, 2 Dec 2007 00:47:03 +0000 (00:47 +0000)]
improve VC++ compatibility, patch by Cédric Venet.

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

16 years agoSupport initalisers for more than just int-typed static variables.
Oliver Hunt [Sun, 2 Dec 2007 00:11:25 +0000 (00:11 +0000)]
Support initalisers for more than just int-typed static variables.

We now use the CodeGenModule logic for generating the constant
initialiser expression, so happily further initialiser fixes should
automatically work for statics as well.

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

16 years agoCompute side-effect for conditional expression.
Fariborz Jahanian [Sat, 1 Dec 2007 19:58:28 +0000 (19:58 +0000)]
Compute side-effect for conditional expression.

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

16 years agoAdd #include, patch by Cédric Venet
Chris Lattner [Sat, 1 Dec 2007 18:59:50 +0000 (18:59 +0000)]
Add #include, patch by Cédric Venet

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

16 years agoBetter match llvm-gcc's behavior for CodeGen naming of anonymous structs and unions.
Christopher Lamb [Sat, 1 Dec 2007 09:20:34 +0000 (09:20 +0000)]
Better match llvm-gcc's behavior for CodeGen naming of anonymous structs and unions.

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

16 years agoWhen generating the CodeGen type name of a struct, union, enum use the typedef
Christopher Lamb [Sat, 1 Dec 2007 09:08:41 +0000 (09:08 +0000)]
When generating the CodeGen type name of a struct, union, enum use the typedef
name if a tag type name is not available for the type. This matches how llvm-gcc
chooses CodeGen type names.

This means that "typedef struct {...} foo" now results in a CodeGen name of
"struct.foo" rather than "struct."

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

16 years agoTest commit
Seo Sanghyeon [Sat, 1 Dec 2007 08:06:07 +0000 (08:06 +0000)]
Test commit

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

16 years agomake the unused expression warning less noisy by not warning about comma exprs whose
Chris Lattner [Sat, 1 Dec 2007 06:07:34 +0000 (06:07 +0000)]
make the unused expression warning less noisy by not warning about comma exprs whose
LHS and RHS both have side effects.

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

16 years agosimplify some code, add support for functions without a proto
Chris Lattner [Sat, 1 Dec 2007 05:58:21 +0000 (05:58 +0000)]
simplify some code, add support for functions without a proto

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

16 years agofix a couple switch codegen problems Oliver reported.
Chris Lattner [Sat, 1 Dec 2007 05:27:33 +0000 (05:27 +0000)]
fix a couple switch codegen problems Oliver reported.

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

16 years agoFixed bug in the serialization of SelectorTable where we did not register the
Ted Kremenek [Sat, 1 Dec 2007 04:43:17 +0000 (04:43 +0000)]
Fixed bug in the serialization of SelectorTable where we did not register the
pointer of MultiKeywordSelectors.

Added optimization to the serialization of SelectorTable where we only serialize
out MultiKeywordSelectors that are ever referenced by an object other than the
SelectorTable.

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

16 years agostart partitioning the diagnostics into two classes: those
Chris Lattner [Fri, 30 Nov 2007 22:53:43 +0000 (22:53 +0000)]
start partitioning the diagnostics into two classes: those
that are builtin and those that are aren't.  This is a bunch
of API refactoring that will make this possible, but there is
no functionality change yet.

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

16 years agoString literals are always valid LValues.
Anders Carlsson [Fri, 30 Nov 2007 22:47:59 +0000 (22:47 +0000)]
String literals are always valid LValues.

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

16 years agoImplemented serialization of SelectorTable and Selectors.
Ted Kremenek [Fri, 30 Nov 2007 22:46:56 +0000 (22:46 +0000)]
Implemented serialization of SelectorTable and Selectors.
Modified serialization of IdentifierTable to self-register itself with
the Deserializer.

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

16 years agopass diagnostics into the rewrite test client.
Chris Lattner [Fri, 30 Nov 2007 22:25:36 +0000 (22:25 +0000)]
pass diagnostics into the rewrite test client.

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

16 years agoInitialize CurMethodDecl to 0.
Anders Carlsson [Fri, 30 Nov 2007 20:01:38 +0000 (20:01 +0000)]
Initialize CurMethodDecl to 0.

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

16 years agoGCC has an extension where the left hand side of the ? : operator can be omitted...
Anders Carlsson [Fri, 30 Nov 2007 19:04:31 +0000 (19:04 +0000)]
GCC has an extension where the left hand side of the ? : operator can be omitted. Handle this in a few more places.

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

16 years agoInitialize LaxVectorConversions.
Anders Carlsson [Fri, 30 Nov 2007 18:29:41 +0000 (18:29 +0000)]
Initialize LaxVectorConversions.

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

16 years agofix a bug handling typedefs in member expr codegen. Patch
Chris Lattner [Fri, 30 Nov 2007 18:02:19 +0000 (18:02 +0000)]
fix a bug handling typedefs in member expr codegen.  Patch
by Seo Sanghyeon

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

16 years agoFix a codegen crash on void ?: reported by Oliver
Chris Lattner [Fri, 30 Nov 2007 17:56:23 +0000 (17:56 +0000)]
Fix a codegen crash on void ?: reported by Oliver

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

16 years agoSupport fully general case expressions, patch by Sanghyeon Seo!
Chris Lattner [Fri, 30 Nov 2007 17:44:57 +0000 (17:44 +0000)]
Support fully general case expressions, patch by Sanghyeon Seo!

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

16 years agoDoh! Check in this long overdue test fix.
Christopher Lamb [Fri, 30 Nov 2007 06:35:48 +0000 (06:35 +0000)]
Doh! Check in this long overdue test fix.

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

16 years agoSupport lax vector conversions.
Anders Carlsson [Fri, 30 Nov 2007 04:21:22 +0000 (04:21 +0000)]
Support lax vector conversions.

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

16 years agoYesterday, I simplified how we stream top-level decls.
Steve Naroff [Thu, 29 Nov 2007 23:05:20 +0000 (23:05 +0000)]
Yesterday, I simplified how we stream top-level decls.

After a discussion with Ted, we both came to the conclusion that adding a "HandleTopLevelDeclaration" hook to ASConsumer is far more elegant. The default implementation of HandleTopLevelDeclaration will be responsible for iterating over the ScopedDecl (which has a chain of the decls:-).

TODO: Once Ted adds HandleTopLevelDeclaration, make sure TagDecls are chainged appropriately...

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

16 years agoAdded method "HandleTopLevelDeclaration" to ASTConsumer. This will eventually
Ted Kremenek [Thu, 29 Nov 2007 23:05:17 +0000 (23:05 +0000)]
Added method "HandleTopLevelDeclaration" to ASTConsumer. This will eventually
be the new hook that ASTStreamer calls to feed top-level Decls to
ASTConsumers.

The difference between "HandleTopLevelDeclaration" and "HandleTopLevelDecl" is
that "HandleTopLevelDecl" is currently called by ASTStreamer for every
top-level declaration, including those that appear within a Decl chain. Using
the new interface, ASTStreamer would only call HandleTopLevelDeclaration for
Decls that appear that the beginning of a Decl chain (i.e., a group of related
decls).

To preserve the behavior that all subclasses of ASTConsumer currently expect,
the default implementation of HandleTopLevelDeclaration simply calls
HandleTopLevelDecl, and for decl chains it calls HandleTopLevelDecl for each
Decl* in a chain of Decls.

The advantage of this interface is that some subclasses of ASTConsumer only
really want the Decl chain, and not each individual Decl passed to them. This
extra level of indirection allows subclasses to override the default behavior
if they so desire.

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

16 years agoUpdate the initializer's type, in addition to the decl, if we've changed the type...
Christopher Lamb [Thu, 29 Nov 2007 19:09:19 +0000 (19:09 +0000)]
Update the initializer's type, in addition to the decl, if we've changed the type of the decl based on it.

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

16 years agoAdded "complex.c" (a copy of test/Codegen/complex.) to the serialization
Ted Kremenek [Thu, 29 Nov 2007 19:05:51 +0000 (19:05 +0000)]
Added "complex.c" (a copy of test/Codegen/complex.) to the serialization
test suite.

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

16 years agoOnly serialize top-level decls that appear at the head of a decl chain.
Ted Kremenek [Thu, 29 Nov 2007 19:04:54 +0000 (19:04 +0000)]
Only serialize top-level decls that appear at the head of a decl chain.

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

16 years agoSupport floating point literals of the form "1e-16f" which specify an exponent but...
Christopher Lamb [Thu, 29 Nov 2007 06:06:27 +0000 (06:06 +0000)]
Support floating point literals of the form "1e-16f" which specify an exponent but no decimal point.

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

16 years agoEnhanced serialization testing by also pretty-printing CFGs constructed from ASTs
Ted Kremenek [Thu, 29 Nov 2007 01:24:25 +0000 (01:24 +0000)]
Enhanced serialization testing by also pretty-printing CFGs constructed from ASTs
both before and after serialization/deserialization. If the CFGs between the pre-
and post- serialized/deserialized ASTs differ, the serialization has failed.

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

16 years agoFixed test case to not expect a warning when one should not be emitted.
Ted Kremenek [Thu, 29 Nov 2007 01:03:21 +0000 (01:03 +0000)]
Fixed test case to not expect a warning when one should not be emitted.
Removed redundant test case.

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

16 years agoAdded test cases for -Wfloat-equal to test comparisons against literals that can be
Ted Kremenek [Thu, 29 Nov 2007 01:00:11 +0000 (01:00 +0000)]
Added test cases for -Wfloat-equal to test comparisons against literals that can be
represented exactly and inexactly by APFloats. For the former, we do not emit a
warning.

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

16 years agoEnhanced implementation of -Wfloat-equal to check for comparisons against
Ted Kremenek [Thu, 29 Nov 2007 00:59:04 +0000 (00:59 +0000)]
Enhanced implementation of -Wfloat-equal to check for comparisons against
floating-point literals that are represented exactly by the APFloat in
FloatingLiteral. For such literals, we do not emit a warning since such checks are
often performed in real code to see if a variable has changed from its original
value. This heuristic clearly can lead to false negatives, but the hope is it will
significantly reduce false positives to help make the compiler flag more useful.

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

16 years agoAdded "isExact" field to FloatingLiteral. This flag indicates whether or not
Ted Kremenek [Thu, 29 Nov 2007 00:56:49 +0000 (00:56 +0000)]
Added "isExact" field to FloatingLiteral.  This flag indicates whether or not
the APFloat representing the parsed literal can represent the literal value
exactly.  This is useful when performing various semantic checks on the code,
and issuing appropriate warnings to users.

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

16 years agoRemoved potential buffer overrun (spotted by Neil Booth) when NumericLiteralParser
Ted Kremenek [Thu, 29 Nov 2007 00:54:29 +0000 (00:54 +0000)]
Removed potential buffer overrun (spotted by Neil Booth) when NumericLiteralParser
converts a parsed literal into an APFloat. We are still performing a copy of the
string, which hopefully will be removed eventually for performance reasons. This
version now is at least safe.

Changed rounding in APFloat construction in NumericLiteralParser from rmTowardsZero
to rmNearestTiesToEven.

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

16 years agoSeveral fixes/simplifications surrounding how we stream top-level decl AST's.
Steve Naroff [Wed, 28 Nov 2007 22:54:11 +0000 (22:54 +0000)]
Several fixes/simplifications surrounding how we stream top-level decl AST's.

The following code...

typedef struct cssm_data {} CSSM_DATA, *CSSM_DATA_PTR;

struct Y { int A; };

struct X { int A; } D;

struct X E, F;

...now produces the following output...

> ../../Debug/bin/clang xx.c -ast-print
Read top-level tag decl: 'cssm_data'
typedef struct cssm_data CSSM_DATA;
typedef struct cssm_data *CSSM_DATA_PTR;
Read top-level tag decl: 'Y'
Read top-level tag decl: 'X'
Read top-level variable decl: 'D'
Read top-level variable decl: 'E'
Read top-level variable decl: 'F'

...which is much more accurate than the previous -ast-print output...

typedef struct cssm_data CSSM_DATA;
typedef struct cssm_data CSSM_DATA;
Read top-level variable decl: 'D'
Read top-level variable decl: 'E'
Read top-level variable decl: 'E'

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

16 years agoConverted AST Pretty-Printer to use iostreams instead of FILE*. This fixes
Ted Kremenek [Wed, 28 Nov 2007 21:32:21 +0000 (21:32 +0000)]
Converted AST Pretty-Printer to use iostreams instead of FILE*.  This fixes
a bug where the statement pretty-printer used iostreams but the AST printer
did not.  This was an issue when dumping ASTs to something other than stderr.

Updated SerializationTest to use the new iostreams interface for the AST printer.

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

16 years agoInlined test case to make it independent of the stmt_exprs test case in test/Sema.
Ted Kremenek [Wed, 28 Nov 2007 21:29:54 +0000 (21:29 +0000)]
Inlined test case to make it independent of the stmt_exprs test case in test/Sema.

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

16 years agoAdded the "Serialization" test directory to the set of tests executed.
Ted Kremenek [Wed, 28 Nov 2007 19:24:15 +0000 (19:24 +0000)]
Added the "Serialization" test directory to the set of tests executed.
Introduced a few line breaks to make the Makefile easier to read.

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

16 years agoAdded initial test case for testing serialization of ASTs. This test
Ted Kremenek [Wed, 28 Nov 2007 19:23:15 +0000 (19:23 +0000)]
Added initial test case for testing serialization of ASTs.  This test
case simply performs --test-pickling on the code found in Sema/stmt_exprs.c.

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

16 years agoModified --test-pickling to perform an actual cross-check of serialized ASTs:
Ted Kremenek [Wed, 28 Nov 2007 19:21:47 +0000 (19:21 +0000)]
Modified --test-pickling to perform an actual cross-check of serialized ASTs:

(1) Parsed ASTs are pretty-printed to a text file.
(2) The ASTs are serialized to disk.
(3) The ASTs are deserialized from disk.
(4) The deserialized ASTs are pretty-printed to a text file.
(5) The two pretty-printed files are compared. If they are different, the test
    fails.

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

16 years agoChanged TestRunner.sh to dump the output and generated script files in
Ted Kremenek [Wed, 28 Nov 2007 19:16:54 +0000 (19:16 +0000)]
Changed TestRunner.sh to dump the output and generated script files in
subdirectories mirroring where the test case file is located

For example, for the test case "Sema/stmt_exprs.c", instead of the files
"Output/stmt_exprs.c.out" and "Output/stmt_exprs.c.out.script" being created, the
files "Output/Sema/stmt_exprs.c.out" and "Output/Sema/stmt_exprs.c.out.script" are
created. This prevents any collisions from different test directories that have the
same file name for a test case, and also makes it clear where the test case was
drawn from.

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

16 years agoAdded missing "RUN:" to comment for test case file. This fixed a bug where the test
Ted Kremenek [Wed, 28 Nov 2007 19:05:11 +0000 (19:05 +0000)]
Added missing "RUN:" to comment for test case file. This fixed a bug where the test
case testing the frontend's support of statement expressions was not being
executed.

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

16 years agoFix a bug checking for 'int foo(void)' that didn't look through typedefs of void.
Chris Lattner [Wed, 28 Nov 2007 18:51:29 +0000 (18:51 +0000)]
Fix a bug checking for 'int foo(void)' that didn't look through typedefs of void.
Bug pointed out by Michael Zolda, thanks!

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

16 years agoFix typo in writable string test
Oliver Hunt [Wed, 28 Nov 2007 06:52:03 +0000 (06:52 +0000)]
Fix typo in writable string test

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

16 years agoAdding code gen tests for writable and shared string literals.
Oliver Hunt [Wed, 28 Nov 2007 06:27:12 +0000 (06:27 +0000)]
Adding code gen tests for writable and shared string literals.

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

16 years agoAdd correct types for the last remaining intrinsics.
Anders Carlsson [Wed, 28 Nov 2007 06:09:44 +0000 (06:09 +0000)]
Add correct types for the last remaining intrinsics.

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

16 years agoImplement support for -fwritable-strings and make the code generator
Chris Lattner [Wed, 28 Nov 2007 05:34:05 +0000 (05:34 +0000)]
Implement support for -fwritable-strings and make the code generator
merge string literals when it is not provided.

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

16 years agoAdd more intrinsics. We can now correctly parse both Carbon.h and Cocoa.h without...
Anders Carlsson [Wed, 28 Nov 2007 05:19:59 +0000 (05:19 +0000)]
Add more intrinsics. We can now correctly parse both Carbon.h and Cocoa.h without having to do -arch ppc.

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

16 years agofix compilation error noticed by Nuno Lopes
Chris Lattner [Wed, 28 Nov 2007 04:30:09 +0000 (04:30 +0000)]
fix compilation error noticed by Nuno Lopes

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

16 years agoMigrated static functions that print decls into a DeclPrinter class,
Ted Kremenek [Tue, 27 Nov 2007 21:46:50 +0000 (21:46 +0000)]
Migrated static functions that print decls into a DeclPrinter class,
which is now used (or subclasssed) by the ASTConsumers.  This new class
stores a FILE* that is used for writing, instead of just hardwiring output
to stderr (it defaults to stderr if no FILE* is provided).

Modified CreateASTPrinter() to accept a FILE* for printing.

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

16 years agoadd several cases that Expr::hasStaticStorage missed, pointed out by Oliver Hunt
Chris Lattner [Tue, 27 Nov 2007 21:35:27 +0000 (21:35 +0000)]
add several cases that Expr::hasStaticStorage missed, pointed out by Oliver Hunt

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

16 years agoSet loc earlier in CheckSingleInitializer to avoid emitting a
Chris Lattner [Tue, 27 Nov 2007 21:21:35 +0000 (21:21 +0000)]
Set loc earlier in CheckSingleInitializer to avoid emitting a
diagnostic without a location.  This produces:

simpleTest.c:2:18: error: initializer element is not constant
int *myPointer = &(myArray[2]);
                 ^~~~~~~~~~~~~

instead of:

error: initializer element is not constant

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

16 years agosizeof is defined by bitsin(char) not by units of 8 bits.
Chris Lattner [Tue, 27 Nov 2007 18:22:04 +0000 (18:22 +0000)]
sizeof is defined by bitsin(char) not by units of 8 bits.

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

16 years agoupdate to match change in mainline llvm.
Chris Lattner [Tue, 27 Nov 2007 18:20:52 +0000 (18:20 +0000)]
update to match change in mainline llvm.

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

16 years agoMove the null pointer constant check from Sema::CheckSingleInitializer/ActOnCallExpr...
Steve Naroff [Tue, 27 Nov 2007 17:58:44 +0000 (17:58 +0000)]
Move the null pointer constant check from Sema::CheckSingleInitializer/ActOnCallExpr/CheckMessageArgumentTypes/ActOnReturnStmt to Sema::CheckSingleAssignmentConstraints. This makes sure all null pointer assignments are considered compatible.

Thanks to Seo Sanghyeon for the bug, follow-through, and patch!

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

16 years agohandle __vector_size__ like vector_size
Chris Lattner [Tue, 27 Nov 2007 07:28:18 +0000 (07:28 +0000)]
handle __vector_size__ like vector_size

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

16 years agoAdd builtin type signature support for vector types. Add correct type signatures...
Anders Carlsson [Tue, 27 Nov 2007 07:22:09 +0000 (07:22 +0000)]
Add builtin type signature support for vector types. Add correct type signatures for a bunch of MMX builtins. We now parse all the intrinsics in mmintrin.h

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

16 years agoAdd comment to CheckVectorCast.h
Anders Carlsson [Tue, 27 Nov 2007 07:16:40 +0000 (07:16 +0000)]
Add comment to CheckVectorCast.h

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

16 years agotake an initial stab at setting function linkage right. Handle
Chris Lattner [Tue, 27 Nov 2007 06:46:51 +0000 (06:46 +0000)]
take an initial stab at setting function linkage right.  Handle
static and inline at least.

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

16 years agoReport errors for invalid casts from/to vectors.
Anders Carlsson [Tue, 27 Nov 2007 05:51:55 +0000 (05:51 +0000)]
Report errors for invalid casts from/to vectors.

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

16 years agoAdd more semantic analysis for inline asm statements.
Anders Carlsson [Tue, 27 Nov 2007 04:11:28 +0000 (04:11 +0000)]
Add more semantic analysis for inline asm statements.

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

16 years agoAdded optional pass-by-reference argument "isExact" to
Ted Kremenek [Mon, 26 Nov 2007 23:12:30 +0000 (23:12 +0000)]
Added optional pass-by-reference argument "isExact" to
NumericLiteralParser::GetFloatValue(). Upon method return, this flag has the value
true if the returned APFloat can exactly represent the number in the parsed text,
and false otherwise.

Modified the implementation of GetFloatValue() to parse literals using APFloat's
convertFromString method (which allows us to set the value of isExact).

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

16 years agoRemoved dependence on #including iostream.
Ted Kremenek [Mon, 26 Nov 2007 22:50:46 +0000 (22:50 +0000)]
Removed dependence on #including iostream.

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

16 years agoFixed #include of objc/objc.h so that it works on case-sensitive filesystems.
Ted Kremenek [Mon, 26 Nov 2007 22:49:09 +0000 (22:49 +0000)]
Fixed #include of objc/objc.h so that it works on case-sensitive filesystems.

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

16 years agoReverted changed to getTagDeclType() introduced in patch 44089:
Ted Kremenek [Mon, 26 Nov 2007 21:16:01 +0000 (21:16 +0000)]
Reverted changed to getTagDeclType() introduced in patch 44089:

http://llvm.org/viewvc/llvm-project?view=rev&revision=44089

"Decl" once again can no longer be NULL, so the NULL checks are not needed.

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

16 years agoFixed a rewrite bug in class synthesis (which I first thought was a rewrite API bug).
Fariborz Jahanian [Mon, 26 Nov 2007 20:59:57 +0000 (20:59 +0000)]
Fixed a rewrite bug in class synthesis (which I first thought was a rewrite API bug).

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

16 years agoRemoves link to status page till the info gets added. Someone put us on Reddit;...
Kevin [Mon, 26 Nov 2007 20:47:14 +0000 (20:47 +0000)]
Removes link to status page till the info gets added.  Someone put us on Reddit; Don't want it to look bad on the project. :)
http://programming.reddit.com/info/61f8g/comments/

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

16 years agoPatch to fix a regression caused by recent rewrite changes.
Fariborz Jahanian [Mon, 26 Nov 2007 19:52:57 +0000 (19:52 +0000)]
Patch to fix a regression caused by recent rewrite changes.
A potential API bug in ReplaceText pending (A FIXME is added).

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

16 years agoFixed StmtPrinter to handle GCC extension to the ternary operator "?:" where
Ted Kremenek [Mon, 26 Nov 2007 18:27:54 +0000 (18:27 +0000)]
Fixed StmtPrinter to handle GCC extension to the ternary operator "?:" where
the LHS subexpression can be NULL.  Patch provided by Nuno Lopes!

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

16 years agoFixed bug in CFG construction where we did not properly handle the GCC
Ted Kremenek [Mon, 26 Nov 2007 18:20:26 +0000 (18:20 +0000)]
Fixed bug in CFG construction where we did not properly handle the GCC
extension "?:" for the ternary operator, e.g.: x ?: y; This expression is
represented in the clang ASTs as a ConditionalOperator whose LHS expression is
NULL. Now we handle this special case, causing the block containing the
condition to be a predecessor to the block that "merges" the values of the
ternary operator.

Thanks to Nuno Lopes for identifying and diagnosing this bug!

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

16 years agoThe checking for the delimiters of expected error/warning messages was
Bill Wendling [Mon, 26 Nov 2007 08:26:20 +0000 (08:26 +0000)]
The checking for the delimiters of expected error/warning messages was
looking only for { and } instead of {{ and }}. Changed it to check for
this explicitly.

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

16 years agoFix sema support for the gnu ?: expression with a
Chris Lattner [Mon, 26 Nov 2007 01:40:58 +0000 (01:40 +0000)]
Fix sema support for the gnu ?: expression with a
missing middle expression, and fix a codegen bug where
we didn't correctly promote the condition to the right
result type.  This fixes PR1824.

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

16 years agothis works.
Chris Lattner [Mon, 26 Nov 2007 01:39:17 +0000 (01:39 +0000)]
this works.

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

16 years agosizeof() return size in bytes, not bits, patch by Nuno Lopes!
Chris Lattner [Sun, 25 Nov 2007 17:48:21 +0000 (17:48 +0000)]
sizeof() return size in bytes, not bits, patch by Nuno Lopes!

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

16 years agoMoved logic for -Wfloat-equal to SemaChecking.cpp.
Ted Kremenek [Sun, 25 Nov 2007 00:58:00 +0000 (00:58 +0000)]
Moved logic for -Wfloat-equal to SemaChecking.cpp.

Moved utility functions IgnoreParen and friends to be static inline functions
defined in SemaUtil.h.

Added SemaUtil.h to Xcode project.

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

16 years agoCheck that the clobber registers are valid.
Anders Carlsson [Sun, 25 Nov 2007 00:25:21 +0000 (00:25 +0000)]
Check that the clobber registers are valid.

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

16 years agoForgot some X86 registers
Anders Carlsson [Sun, 25 Nov 2007 00:23:10 +0000 (00:23 +0000)]
Forgot some X86 registers

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

16 years agoAdd tables for GCC register names and aliases. This will be used for inline asm
Anders Carlsson [Sat, 24 Nov 2007 23:38:12 +0000 (23:38 +0000)]
Add tables for GCC register names and aliases. This will be used for inline asm

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

16 years agoAdded more test cases for uninitialized values checker.
Ted Kremenek [Sat, 24 Nov 2007 23:06:58 +0000 (23:06 +0000)]
Added more test cases for uninitialized values checker.

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

16 years agoFixed bogus culling of uninitialized-values "taint" propagation during assignments.
Ted Kremenek [Sat, 24 Nov 2007 20:07:36 +0000 (20:07 +0000)]
Fixed bogus culling of uninitialized-values "taint" propagation during assignments.
We accidentally were throttling the propagation of uninitialized state across
assignments (e.g. x = y).  Thanks to Anders Carlsson for spotting this problem.

Added test cases to test suite to provide regression testing for the
uninitialized values analysis.

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

16 years agoMoved dead-stores test cast to a new test suite subdirectory: Analysis.
Ted Kremenek [Sat, 24 Nov 2007 19:49:35 +0000 (19:49 +0000)]
Moved dead-stores test cast to a new test suite subdirectory: Analysis.

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

16 years agoKeep track of whether the asm is volatile or not.
Anders Carlsson [Fri, 23 Nov 2007 23:12:25 +0000 (23:12 +0000)]
Keep track of whether the asm is volatile or not.

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

16 years agoimprove codegen for global variable initializers, implementing
Chris Lattner [Fri, 23 Nov 2007 22:07:55 +0000 (22:07 +0000)]
improve codegen for global variable initializers, implementing
test/CodeGen/global-with-initialiser.c

Patch by Oliver Hunt!

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

16 years agoCheck asm input and output expressions.
Anders Carlsson [Fri, 23 Nov 2007 19:43:50 +0000 (19:43 +0000)]
Check asm input and output expressions.

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

16 years agoFix PR1820, an incredibly subtle macro expansion bug that Neil discovered.
Chris Lattner [Fri, 23 Nov 2007 06:50:21 +0000 (06:50 +0000)]
Fix PR1820, an incredibly subtle macro expansion bug that Neil discovered.

Neil, please review this fix.

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

16 years agoStore output and input operands as well as clobber information in the AsmStmt. Ted...
Anders Carlsson [Thu, 22 Nov 2007 01:36:19 +0000 (01:36 +0000)]
Store output and input operands as well as clobber information in the AsmStmt. Ted, could you please review the serialization/deserialization code?

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

16 years agoGCC fails if there is a trailing colon but no clobbers.
Anders Carlsson [Wed, 21 Nov 2007 23:27:34 +0000 (23:27 +0000)]
GCC fails if there is a trailing colon but no clobbers.

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

16 years agoStore inline asm code in the AST.
Anders Carlsson [Tue, 20 Nov 2007 19:21:03 +0000 (19:21 +0000)]
Store inline asm code in the AST.

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

16 years agoAdd __builtin_abs
Anders Carlsson [Tue, 20 Nov 2007 19:05:17 +0000 (19:05 +0000)]
Add __builtin_abs

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