summaryrefslogtreecommitdiffstats
path: root/clang/clang.xcodeproj
Commit message (Collapse)AuthorAgeFilesLines
...
* Bug #:Steve Naroff2007-05-281-0/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Submitted by: Reviewed by: Refine Sema::ParseCallExpr() diags (range support, add types). Before: func-assign.c:27:11: warning: passing argument 1 from incompatible pointer type pintFunc(&FOO); ^ func-assign.c:28:12: error: incompatible type for argument 1 floatFunc(&FOO); ^ func-assign.c:29:12: error: too many arguments to function floatFunc(1,2,3); ^ After: func-assign.c:27:11: warning: passing incompatible pointer 'struct foo *' to function expecting 'int *' pintFunc(&FOO); ~~~~~~~~^~~~~ func-assign.c:28:12: error: passing incompatible type 'struct foo *' to function expecting 'float' floatFunc(&FOO); ~~~~~~~~~^~~~~ func-assign.c:29:12: error: too many arguments to function floatFunc(1,2,3); ~~~~~~~~~^ ~ llvm-svn: 39513
* implement full sema support for the GCC address-of-label extension.Chris Lattner2007-05-281-3/+3
| | | | llvm-svn: 39510
* Reorganize codegen files.Chris Lattner2007-05-281-27/+16
| | | | llvm-svn: 39504
* Bug #:Steve Naroff2007-05-271-1/+23
| | | | | | | | | | | | | | | | Submitted by: Reviewed by: - Added type checking to Sema::ParseReturnStmt (still under construction). - Improved Expr::isLvalue() and Expr::isModifiableLvalue() to return more info. Used the info in Sema::CheckAssignmentOperands() to produce more descriptive diagnostics. Added FIXME to other clients of isLvalue()/etc. - Added a SourceLocation slot to MemberExpr...changed the implementation of getSourceRange(). - Added getResultType() helper to FunctionDecl. - Changed many Diag calls to use the SourceRange support (now that it's a big hit...we better milk it:-). llvm-svn: 39501
* Initial scaffolding for an -emit-llvm mode. This requires the LLVM VMCoreChris Lattner2007-05-241-0/+32
| | | | | | library to be built for the driver to link. llvm-svn: 39495
* add ParseExprCXX.cpp to project.Chris Lattner2007-05-241-0/+4
| | | | llvm-svn: 39491
* implement printer support for C++ bool literalsChris Lattner2007-05-241-3/+1
| | | | llvm-svn: 39489
* Bug #:Steve Naroff2007-05-221-0/+3
| | | | | | | | | | | | | | | | | | | | | | | Submitted by: Reviewed by: One bug compiling "Carbon.h" on Leopard, one diagnostic tweak. - CheckIndirectionOperand wasn't operating on the canonical type (so it was complaining about typedef names). - The diagnostic was less than great. Here's what is was: [dylan:~/llvm/tools/clang] admin% ../../Debug/bin/clang t.c t.c:4:3: error: invalid argument type to unary expression 'int' *p; ^~ And here's what I changed it to... snaroff:clang naroff$ ../../Debug/bin/clang bug.c bug.c:5:3: error: indirection requires a pointer ('int' operand invalid) *p; ^~ llvm-svn: 39481
* Move ASTStreamer.h into "clang/Sema/ASTStreamer.h"Chris Lattner2007-05-211-4/+12
| | | | llvm-svn: 39478
* Split the AST library into two libraries: libast and libsema.Chris Lattner2007-05-211-28/+40
| | | | llvm-svn: 39477
* Implement Sema::ParseNumericConstant for integer constants in terms of APIntChris Lattner2007-05-211-23/+0
| | | | | | and correctly in terms of C99 6.4.4.1p5. llvm-svn: 39473
* Bug #:Steve Naroff2007-05-201-0/+23
| | | | | | | | | | | | | | | | Submitted by: Reviewed by: Fix two bugs... - Sema::CheckConditionalOperands(). Needed to move the check for null pointer constants up to the clause dealing with two pointers types. The previous code would never get executed. - Expr::isNullPointerConstant(). This predicate was much too naive...it should have had a FIXME (my bad). It now deals with "void *" cast expressions. It still has one major bug...it needs to evaluate the expression to correctly determine if it is a null pointer constant (e.g. 7-7 should pass). llvm-svn: 39464
* Use the new source ranges tracking feature to highlight the important piecesChris Lattner2007-05-191-24/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | of a subexpression when emitting a diagnostic. Consider this example: struct A { int X; }; void test1(void *P, int C) { return ((C*40) + *P) / 42+P; } void test2(struct A friendlystruct, int C) { return (C *40) + friendlystruct; } void test3(struct A friendlystruct, int C) { return friendlystruct + test2(friendlystruct , C); } clang now produces this output: t.c:4:18: error: invalid operands to binary expression ('int' and 'void') return ((C*40) + *P) / 42+P; ~~~~~~ ^ ~~ This shows the important pieces of a nested (and potentially very complex) expression. t.c:8:18: error: invalid operands to binary expression ('int' and 'struct A') return (C *40) + friendlystruct; ~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~ This shows that tabs in source files (after the 'C') and multichar tokens (friendlystruct) are handled correctly. t.c:12:25: error: invalid operands to binary expression ('struct A' and 'void') return friendlystruct + test2(friendlystruct ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~ This shows how multiline ranges are printed. Any part of the range that is not on the same line as the carat is just ignored. This also shows that trailing spaces on the line aren't highlighted. llvm-svn: 39459
* Bug #:Steve Naroff2007-05-181-1/+1
| | | | | | | | | Submitted by: Reviewed by: More tweaks to error diagnostics (adding types, using the new hooks on expr). Still more to do... llvm-svn: 39455
* Bug #:Steve Naroff2007-05-161-0/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Submitted by: Reviewed by: - Implement type checking for Sema::CheckConditionalOperands. - Fixed crasher in Sema::UsualUnaryConversion (incorrect use of cast<>). - Added a few diagnostics and started passing 2 args! (Thanks Chris!). Here's some diagnostic output that is much nicer than gcc... [dylan:~/llvm/tools/clang] admin% ../../Debug/bin/clang cond.c cond.c:12:14: error: used type 'struct foo' where arithmetic or pointer type is required result = s ? 1 : 2; ^ cond.c:13:14: error: incompatible operand types ('struct foo' and 'struct bar') result = a ? s : s2; ^ cond.c:14:14: warning: pointer type mismatch ('struct foo *' and 'struct bar *') result = a ? ps : ps2; ^ cond.c:14:10: warning: assignment makes integer from pointer without a cast result = a ? ps : ps2; ^ cond.c:15:14: error: incompatible operand types ('struct foo *' and 'struct foo') result = a ? ps : s; ^ cond.c:16:14: warning: pointer type mismatch ('void (*)(int)' and 'void (*)(int, int)') result = a ? func : func2; ^ cond.c:16:10: warning: assignment makes integer from pointer without a cast result = a ? func : func2; ^ 7 diagnostics generated. [dylan:~/llvm/tools/clang] admin% cc -c cond.c cond.c: In function 'main': cond.c:12: error: used struct type value where scalar is required cond.c:13: error: type mismatch in conditional expression cond.c:14: warning: pointer type mismatch in conditional expression cond.c:14: warning: assignment makes integer from pointer without a cast cond.c:15: error: type mismatch in conditional expression cond.c:16: warning: pointer type mismatch in conditional expression cond.c:16: warning: assignment makes integer from pointer without a cast llvm-svn: 39451
* Add support for inserting up to 10 strings in a diagnostic, with %0, %1, %2,Chris Lattner2007-05-161-24/+1
| | | | | | etc. llvm-svn: 39447
* Bug #:Steve Naroff2007-05-141-1/+1
| | | | | | | | | | | | | | | | | Submitted by: Reviewed by: Fixed a bug in Sema::CheckAddressOfOperand(). It was (incorrectly) using isModifiableLvalue() instead of isLvalue(). This motivated me to (finally) cleanup methods surrounding lsLvalue/isModifiableLvalue. Cleanup involved: - adding Expr::isLvalue(). - modified Expr::isModifiableLvalue() to use Expr::isLvalue(). - removed Type::isLvalue(), Type::isModifiableLvalue(), and QualType::isModifiableLvalue(). They were confusing...the respective logic is now a part of the Expr member functions... - also added some comments and spec references, since these methods are so central to expressions working properly. llvm-svn: 39443
* Bug #:Steve Naroff2007-05-021-1/+23
| | | | | | | | | | Submitted by: Reviewed by: - implement Type::functionTypesAreCompatible(). - fix bug in Sema::CheckAssignmentOperands(). Spec allows any pointer type to be assigned to _Bool. llvm-svn: 39428
* Remove the clang::SourceBuffer class, switch to the llvm::MemoryBuffer class.Chris Lattner2007-04-291-10/+0
| | | | llvm-svn: 39426
* Bug #:Steve Naroff2007-04-191-0/+2
| | | | | | | | | | | | | | Submitted by: Reviewed by: Continue working on type checking for unary operators. Added: - Two 3 private functions to Sema: CheckAddressOfOperand(), CheckIndirectionOperand(), and getDecl(). - Added Expr::isLvalue() - it was needed for CheckAddressOfOperand(). It will also be needed for ++/-- and the assignment operators. - Added a couple diagnostics for invalid lvalues (for & of). llvm-svn: 39408
* Diagnostics relating to computation of values should only be produced if anChris Lattner2007-04-101-2/+0
| | | | | | | | | | | expression is live. For example: #if 0 ? 124/0 : 42 should cause no error. This implements test/Preprocessor/expr_liveness.c llvm-svn: 39397
* Bug #:Steve Naroff2007-04-051-0/+2
| | | | | | | | | | | | | | | | | | | | | | Submitted by: Reviewed by: Fix "FIXME: does this lose qualifiers from the typedef??" in ASTContext::getTypedefType(). This change was fairly pervasive...nevertheless, here are the highlights: - Change the type of Type::CanonicalType to TypeRef (was "Type *"). - Change the implementation of TypeRef::getCanonicalType() to work for typedefs. - Make the implementation of Type::getCanonicalType private (only TypeRef should access). This will force clients to use TypeRef::getCanonicalType (the correct version of the function). Since TypeRef overloads "->", it was very easy to fall into this bug... - Changed many references of "Type *" to "TypeRef"...when the raw type pointer is required, use t.getTypePtr(). - Changed all the *Type classes to take a TypeRef. - Made the Type constructor protected (cleanup). - Removed function Expr::getType(). - Convert functions in SemaExpr to use the above support. This fixed the "const" bug I was originally investigating. I will follow this check-in up with a rename of TypeRef->QualType. I will also make sure the constructor does not default to 0 (which can lead to broken code...). llvm-svn: 39394
* Move LiteralSupport files to their alphabetic position.Chris Lattner2007-04-041-4/+2
| | | | llvm-svn: 39384
* Bug #:Steve Naroff2007-04-021-23/+3
| | | | | | | | | | | | | | Submitted by: Reviewed by: Add three new classes to Decl.h: BlockVarDecl, FileVarDecl, and ParmVarDecl. Made the constructor to VarDecl protected, to indicate it is "abstract". Reorganized the Decl::Kind enum to allow us to add ObjectDecls/TypeDecls with minimal breakage. In the process, realized the isa support for ObjectDecl was already broken (so the reorg paid for itself already:-) The range check should also be more efficient... llvm-svn: 39373
* Bug #:Steve Naroff2007-04-011-3/+23
| | | | | | | | | | | | Submitted by: Reviewed by: - Finished up incomplete type analysis for varibles (in Sema::ParseDeclarator()). - Added many spec refs, since this area is confusing (for top level decls in particular). - Added a FIXME to MergeVarDecl()...it needs to be taught about tentative definitions. As a result, we currently issue some bogus diagnostics. llvm-svn: 39372
* Bug #:Steve Naroff2007-03-091-0/+8
| | | | | | | | | | | | | Submitted by: Reviewed by: Moved numeric literal support from SemaExpr.cpp to LiteralSupport.[h,cpp] in Lex. This will allow it to be used by both Sema and Preprocessor (and should be the last major refactoring of this sub-system).. Over time, it will be reused by anyone implementing an actions module (i.e. any subclass of llvm::clang::Action. Minor changes to IntegerLiteral in Expr.h. More to come... llvm-svn: 39351
* Bug #:Steve Naroff2007-03-061-23/+3
| | | | | | | | | | | | | | | Submitted by: Reviewed by: More code to parse numeric constants. This checkin includes: - Feedback from Chris. - Support for parsing floating point constants. - Moved the code to "Sema". Changed API in Action. - More/better error diagnostics. At this point, the parsing support should be largely complete. Next step is to work on filling in sensible values (in IntegerLiteral/FloatLiteral). llvm-svn: 39349
* Bug #:Steve Naroff2007-03-031-3/+23
| | | | | | | | | | | | | Submitted by: Reviewed by: First phase of parsing IntegerConstants. At the moment, all processing is done in the Parser, not Sema. If necessary, this is easy to move. Next steps: - Convert well for strings to actual values (need to look @ APInt.h) - Design the API between the Parser and Sema. Sema shouldn't have to be concerned with any parsing issues... llvm-svn: 39348
* More changes to complete the dynamic type support for Stmt/Expr.Steve Naroff2007-02-271-0/+4
| | | | | | | | | | | | This set of changes includes: - convert ExprCXX.h and add to the Xcode project file. -- required adding CXXBoolLiteralExpr to StmtNodes.def. -- required adding visitor support (decl/defn). - make the class codes in StmtNodes.def explicit (to enable range checking). -- this required changing all clients of the STMT macro. - declare the instance data const. llvm-svn: 39344
* rename IntegerConstant->IntegerLiteralSteve Naroff2007-02-211-1/+4
| | | | | | | rename FloatingConstant->FloatingLiteral rename StringExpr->StringLiteral llvm-svn: 39341
* Add support for target-specific builtins, including detecting nonportabilityChris Lattner2007-01-291-0/+8
| | | | | | | | | | | | | | | | | of source code. For example: $ clang INPUTS/carbon_h.c -arch i386 -arch ppc prints: ... /usr/lib/gcc/i686-apple-darwin8/4.0.1/include/mmintrin.h:51:3: note: use of a target-specific builtin function, source is not 'portable' __builtin_ia32_emms (); ^ because carbon.h pulls in xmmintrin.h, and __builtin_ia32_emms isn't a builtin on ppc. Though clang now supports target-specific builtins, the full table isn't implemented yet. llvm-svn: 39328
* Add support for target-independent builtin functions (like __builtin_abs),Chris Lattner2007-01-281-0/+12
| | | | | | | | | | | | | | | | | | whose decl objects are lazily created the first time they are referenced. Builtin functions are described by the clang/AST/Builtins.def file, which makes it easy to add new ones. This is missing two important pieces: 1. Support for the rest of the gcc builtins. 2. Support for target-specific builtins (e.g. __builtin_ia32_emms). Just adding this builtins reduces the number of implicit function definitions by 6, reducing the # diagnostics from 550 to 544 when parsing carbon.h. I need to add all the i386-specific ones to eliminate several hundred more. ugh. llvm-svn: 39327
* Save the member list of a struct/union in the RecordDecl for the struct.Chris Lattner2007-01-251-1/+1
| | | | llvm-svn: 39297
* simplify structure body parsing code. Reorganize how tags are processed.Chris Lattner2007-01-231-1/+1
| | | | | | | | | | | | | | Diagnose redefintion of tag types, e.g.: t.c:7:8: error: redefinition of 'blah' struct blah {}; ^ t.c:1:8: error: previous definition is here struct blah { ^ 2 diagnostics generated. llvm-svn: 39286
* Formalize preprocessor callbacks together into a PPCallbacks structure, insteadChris Lattner2006-11-211-0/+4
| | | | | | | of having a loose collection of function pointers. This also allows clients to maintain state, and reduces the size of the Preprocessor.h interface. llvm-svn: 39203
* split the ParseFunctionDefinition action into two actions, one which isChris Lattner2006-11-211-1/+1
| | | | | | called before and one which is called after function definition parsing. llvm-svn: 39196
* build TypedefDecl objects when parsing typedefs.Chris Lattner2006-11-191-1/+1
| | | | | | Add a parsing fastpath for when we see typedef at the top-level. llvm-svn: 39182
* rearrange the type printing code so that we can do the horrible C "inside out"Chris Lattner2006-11-131-0/+4
| | | | | | | | | thing properly. This allows us to print types like: int (*A)[restrict static 4][6]; properly, in addition to representing them properly. :) llvm-svn: 39178
* Rename SemaDeclSpec.{h|cpp} back to DeclSpec.{h|cpp} now that the distinctionChris Lattner2006-11-111-4/+8
| | | | | | between sema and parse is clear. llvm-svn: 39167
* restructure code to build the framework for creating types from declarators.Chris Lattner2006-11-111-0/+8
| | | | llvm-svn: 39166
* introduce a new ASTContext class to hold long-lived ast nodes.Chris Lattner2006-11-101-0/+4
| | | | llvm-svn: 39161
* with xcode bugs worked around, I can actually add files to the project, wooChris Lattner2006-11-101-1/+9
| | | | llvm-svn: 39160
* move semantic analysis of statements to it's own file.Chris Lattner2006-11-101-1/+1
| | | | llvm-svn: 39156
* move ASTBuilder.h/cpp to be a private Sema.h/cpp files, not part of theChris Lattner2006-11-101-9/+9
| | | | | | interface exported by libast. llvm-svn: 39154
* move Type.h to libASTChris Lattner2006-11-091-4/+4
| | | | llvm-svn: 39152
* Change courses on how we do semantic analysis. Semantic analysisChris Lattner2006-11-091-0/+4
| | | | | | | | fundamentally requires having an AST around, so move all sema to the AST library. This is the first step, later steps will be needed to clean up libast. llvm-svn: 39150
* rename SemaDecl.cpp/h to SemaDeclSpec.cpp/hChris Lattner2006-11-081-8/+4
| | | | llvm-svn: 39149
* add Type.h to the projectChris Lattner2006-11-081-0/+4
| | | | llvm-svn: 39146
* implement trivial scope caching. This reduces malloc traffic in the commonChris Lattner2006-11-061-0/+4
| | | | | | | | | | | | | | | | | | | | | case, speeding up parsing of this contrived example: #define A {{}} #define B A A A A A A A A A A #define C B B B B B B B B B B #define D C C C C C C C C C C #define E D D D D D D D D D D #define F E E E E E E E E E E #define G F F F F F F F F F F #define H G G G G G G G G G G void foo() { H } from 7.478s to 4.321s. GCC requires 8.2s. llvm-svn: 39138
* Make Scope keep track of the kind of scope it is. Properly scope loop andChris Lattner2006-11-051-1/+1
| | | | | | | switch statements. Make break/continue check that they are inside of an appropriate control-flow construct. This implements Parser/bad-control.c. llvm-svn: 39136
OpenPOWER on IntegriCloud