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

260 Коммитов

Автор SHA1 Сообщение Дата
Ted Kremenek 475d4aa5f0 Re-added UninitializedValues.cpp to the XCode project because the file was renamed.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42057 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-17 20:52:52 +00:00
Steve Naroff 37387c9328 - Refactored ObjcKeywordInfo into ObjcKeywordInfo, ObjcKeywordDecl, and ObjcKeywordMessage.
- Removed helper ObjcGetSelectorInfo(), moving the code directly into ObjcBuildMethodDeclaration().
- Many refinements to ParseObjCMessageExpression().
- Add ActOnMessageExpression().

Next step, finish the message actions and (finally) create/instantiate an ObjcMessageExpr AST.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42050 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-17 20:25:27 +00:00
Ted Kremenek d2aecc354d Added ASTConsumer.h to XCode project.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42030 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-17 16:09:32 +00:00
Steve Naroff 3f128ad269 Add support for ObjC keyword selectors.
- Add SelectorInfo/SelectorTable classes, modeled after IdentifierInfo/IdentifierTable.
- Add SelectorTable instance to ASTContext, created lazily through ASTContext::getSelectorInfo().
- Add SelectorInfo slot to ObjcMethodDecl.
- Add helper function to derive a SelectorInfo from ObjcKeywordInfo.

Misc: Got the Decl stats stuff up and running again...it was missing support for ObjC AST's.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42023 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-17 14:16:13 +00:00
Chris Lattner 580980b3d4 switch the llvm emitter to ASTConsumer interface.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42013 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-16 19:46:59 +00:00
Chris Lattner 8bd12b848b Initial checkin of rewriter interface. It is just stubbed out for now.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41990 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-15 22:21:22 +00:00
Steve Naroff 08d92e46d2 Start converting Action methods from Parse-prefix to ActOn-prefix.
The previous naming scheme was confusing, since it resulted in both the Parser and Action modules having methods with the same name. In addition, the Action module never does any parsing...



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41986 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-15 18:49:24 +00:00
Ted Kremenek a1dff2e503 Added several files to XCode project file...
Analysis/DataflowSolver.h
    Analysis/UnintializedValues.cpp
    include/clang/Analysis/CFGVarDeclVisitor.h
    include/clang/Analysis/DataflowValues.h
    include/clang/Analysis/UninitializedValues.h



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41974 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-14 23:13:28 +00:00
Steve Naroff 74216648a5 Several improvement to Sema::ParseRecordBody()...
- Adding a safer prologue. The previous prologue would accept a null and therefore assume we had an interface (which was incorrect).
- Fixed FieldDecl's classof method. This allowed me to simplify some unnecessary casting.
- When diagnosing errors, make sure the FieldDecl/EnclosingDecl are marked as invalid. In addition, don't delete the field...rather, add all fields to the enclosing decl. Memory management can/should be done elsewhere. This code was never "upgraded" to the recently added invalid decl strategy.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41964 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-14 22:20:54 +00:00
Fariborz Jahanian b04a02184c Patch to store ivars into interface class object.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41961 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-14 21:08:27 +00:00
Steve Naroff 9474504790 Move Decl::NextDeclarator (w/ setters/getters) down to ScopedDecl/FieldDecl.
Decl is now svelte:-)



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41935 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-13 23:52:58 +00:00
Fariborz Jahanian 7d6402f753 Patch for collecting ivars before running action on them.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41932 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-13 20:56:13 +00:00
Steve Naroff a9aa5e69d8 Add ASTContext::StringMap<char> to unique selector names.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41894 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-12 23:08:22 +00:00
Ted Kremenek 8b2d2fd023 Added files CFGStmtVisitor and DataflowStmtVisitor to XCode project.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41886 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-12 19:12:02 +00:00
Steve Naroff 4473921b66 - Add an ObjcIvarDecl AST node (a subclass of FieldDecl).
- Instantiate the node in Sema::ParseField(), based on the type of the TagDecl.
- Add Sema::ObjcAddInstanceVariable(), responsible for adorning/adding the ObjcIvarDecl.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41864 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-11 21:17:26 +00:00
Fariborz Jahanian 8a4010d40c Change ObjcMethodDecl class derivation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41860 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-11 18:45:55 +00:00
Steve Naroff 2bd42fadaf Some small tweaks to the recent Objc support...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41803 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-10 20:51:04 +00:00
Ted Kremenek 055c275fab Added "Dead Stores", a flow-sensitive checker that checks for stores
to variables that are no longer live.  This analysis is built on top
of CFGs and the LiveVariables analysis.

changes to driver:
 added driver option "-check-dead-stores" to run the analysis


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41754 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-06 23:00:42 +00:00
Ted Kremenek e4e633400b Added an early implementation of Live-Variables analysis built on
source-level CFGs.  This code may change significantly in the near
future as we explore different means to implement dataflow analyses.

Added a driver option, -dump-live-variables, to view the output of
live variable analysis.  This output is very ALPHA; it will be improved shortly.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41737 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-06 00:17:54 +00:00
Steve Naroff f28b264437 Start implementing Actions interface for ObjC classes, instance variables, and methods.
Lot's of small changes to the parser.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41732 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-05 23:30:30 +00:00
Steve Naroff 7cf8c44432 Simplified initializer semantic analysis by adding the following 2 methods:
- ArrayType::getBaseType(), and 
- ConstantArrayType::getMaximumElements().

Wanted to do this cleanup before adding structure support, which will add more complexity.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41715 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-04 21:13:33 +00:00
Chris Lattner 98414c1b7d Fix a bug/missing-feature Ted noticed: the 'unused' warning should not
warn about the last stmt in a stmtexpr, f.e. there should be no warning for:

int maxval_stmt_expr(int x, int y) {
  return ({int _a = x, _b = y; _a > _b ? _a : _b; });
}



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41655 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-31 21:49:55 +00:00
Ted Kremenek 42a509f6a4 Added "PrinterHelper" interface (include/AST/PrinterHelper) that can
be passed as an (optional) argument to StmtPrinter to customize
printing of AST nodes.

Used new PrinterHelper interface to enhance printing and visualization
of CFGs.  The CFGs now illustrate the semantic connectives between
statements and terminators, wheras in the previous printing certain
expressions would (visible) be printed multiple times to reflect which
expressions used the results of other expressions.

The end result is that the CFG is easier to read for flow of
expression values (following principles similar to the LLVM IR).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41651 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-31 21:30:12 +00:00
Chris Lattner e300c870f0 Teach the stmtdumper to dump location/range info when a SourceMgr is available.
For example, -parse-ast-dump now prints:

static inline int __inline_isinff(float __x)
(CompoundStmt 0x2409a20
  (ReturnStmt 0x2409a10
    (BinaryOperator 0x24099f0 'int' <///usr/include/architecture/i386/math.h:183:63, col:102> '=='
      (CallExpr 0x24098f0 'float' <col:63, col:82>
        (ImplicitCastExpr 0x24098e0 'float (*)(float)' <col:63>
          (DeclRefExpr 0x2409880 'float (float)' <col:63> Decl='__builtin_fabsf' 0x2409840))
        (DeclRefExpr 0x24098a0 'float' <col:79> Decl='__x' 0x2409810))
      (CallExpr 0x24099c0 'float' <col:87, col:102>
        (ImplicitCastExpr 0x2409870 'float (*)(void)' <col:87>
          (DeclRefExpr 0x2409980 'float (void)' <col:87> Decl='__builtin_inff' 0x2409940))))))

where it only prints filename/line# if it changes from the previous value.  We 
really need loc info on stmts though, like we have on exprs.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41602 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-30 06:17:34 +00:00
Chris Lattner b7f6e08613 Implement GCC-compatible layout and typing of enum constants and enum decl.
A small bit of codegen work is still pending.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41571 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-29 17:31:48 +00:00
Steve Naroff 26b8ff45ba Fix bogus warnings (noticed by Chris) with array-constraints.c.
Remove bogus type conversions in Sema::GetTypeForDeclarator(). This commit
only deals with the array types (DeclaratorCheck::Array), though the
rest of this routine should be reviewed. Given the complexity of C declarators,
I don't want to change the entire routine now (will discuss with Chris tomorrow).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41443 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-26 14:38:38 +00:00
Chris Lattner 5d66145eed add a new ImaginaryLiteral AST node that is used to
represent imaginary literals:

float _Complex A;
void foo() {
  A = 1.0iF;
}

generates:

  (BinaryOperator 0x2305ec0 '_Complex float' '='
    (DeclRefExpr 0x2305e60 '_Complex float' Decl='A' 0x2305cf0)
    (ImaginaryLiteral 0x2305f40 '_Complex float'
      (FloatingLiteral 0x2305ea0 'float' 1.000000))))



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41413 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-26 03:42:43 +00:00
Chris Lattner 8f08cb7d0b refactor enough of the top-level parsing logic to parse and
ignore 'namespace foo {}'



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41400 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-25 06:57:03 +00:00
Chris Lattner 1f1ded9629 Teach emit-llvm for scalars to properly handle compound assignment
operators in all their glory :)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41373 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-24 21:00:35 +00:00
Ted Kremenek a66622aaaa Added ExprCXX.cpp
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41370 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-24 20:24:16 +00:00
Chris Lattner 7f02f721d4 completely refactor codegen of scalar expressions out into its own CGExprScalar.cpp file.
This patch temporarily breaks compound assignment operators, but greatly simplifies many
things.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41355 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-24 05:35:26 +00:00
Chris Lattner 566b6ce741 rename two files.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41350 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-24 02:22:53 +00:00
Chris Lattner 6efc4d3659 detect and diagnose empty case ranges:
switch.c:16:8: warning: empty case range specified
  case 100 ... 99: ;  // expected-warning {{empty case range}}
       ^~~~~~~~~~



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41328 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-23 17:48:14 +00:00
Anders Carlsson 29b2cb1ff1 Parse ObjC @protocol expressions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41320 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-23 15:25:28 +00:00
Chris Lattner 09ff8124fc add cfg.h/cfg.cpp to the xcode project at Ted's request.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41253 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-21 21:44:59 +00:00
Chris Lattner 776c64990e minor nicities.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41244 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-21 18:51:13 +00:00
Anders Carlsson 5508518a27 Implement parsing and code generation of Objective-C string literals.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41238 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-21 17:43:55 +00:00
Chris Lattner b6ef18a2b0 Split complex arithmetic codegen out from aggregate codegen.
This means that we get rid of tons of intermediate allocas.  For
example:

void foo(double _Complex a, double _Complex b) {
   a = b+a+a;
}

this used to have 4 temporary allocas, now it has zero of them.
This also simplifies the individual visitor methods because they
now can all operate on real/imag pairs instead of having to 
load/store all over the place.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41217 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-21 05:54:00 +00:00
Chris Lattner c5598cbc4c Switch StmtVisitor from using dynamic to static dispatch. This makes it
significantly faster and actually reduces the amount of code in the system.
This also allows for future visitor changes.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41211 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-21 04:04:25 +00:00
Anders Carlsson c9e2091efc Implement code generation for constant CFStrings.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41206 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-21 00:21:21 +00:00
Chris Lattner 59907c4d8f initial support for checking format strings, patch by Ted Kremenek:
"I've coded up some support in clang to flag warnings for non-constant format strings used in calls to printf-like functions (all the functions listed in "man fprintf").  Non-constant format strings are a source of many security exploits in C/C++ programs, and I believe are currently detected by gcc using the flag -Wformat-nonliteral."



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41003 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-10 20:18:51 +00:00
Chris Lattner af6f528b2b New file, just a placeholder for now.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41002 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-10 20:13:28 +00:00
Chris Lattner 6000dace22 add a new AST dumper interface (E->dump()). This dumps out
the AST in a structural, non-pretty, form useful for understanding
the AST.  It isn't quite done yet, but is already somewhat useful.

For this example:

int test(short X, long long Y) {
  return X < ((100));
}

we get (with -parse-ast-dump):

int test(short X, long long Y)
(CompoundStmt 0x2905ce0
  (ReturnStmt 0x2905cd0
    (BinaryOperator 0x2905cb0 '<'
      (ImplicitCastExpr 0x2905ca0
        (DeclRefExpr 0x2905c20 Decl='X' 0x2905bb0))
      (ParenExpr 0x2905c80
        (ParenExpr 0x2905c60
          (IntegerLiteral 0x2905c40 100))))))




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40954 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-08 22:51:59 +00:00
Chris Lattner 94f05e3648 Implement codegen for __builtin_choose_expr. For example:
struct X { int A; };

void foo() {
  struct X s;
  int i;
  i = __builtin_choose_expr(0, s, i);
}

compiles to:

        %tmp = load i32* %i             ; <i32> [#uses=1]
        store i32 %tmp, i32* %i

wow :)



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40801 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-04 00:20:15 +00:00
Steve Naroff 441995e92e Add a test case to validate code gen for typeof/builtin_types_compatible.
This test case currently generates the following unexpected warnings (when compared with gcc).

[dylan:clang/test/Parser] admin% ../../../../Debug/bin/clang -parse-ast-check builtin_types_compatible.c
Warnings seen but not expected:
  Line 28: expression result unused
  Line 29: expression result unused
  Line 30: expression result unused
  Line 31: expression result unused
  Line 32: expression result unused
  Line 33: expression result unused



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40789 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-03 18:38:22 +00:00
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 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 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
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
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 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 9c68306275 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
2007-07-22 01:16:55 +00:00
Steve Naroff 731ec57bd3 Minor simplification to Expr::isLvalue().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40375 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-21 13:32:03 +00:00
Chris Lattner 60c3a1ba7a Update project for LexerToken.h -> Token.h
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40106 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-20 17:01:09 +00:00
Chris Lattner 464175bba1 initial layout support for structures and unions. This isn't actually
hooked up to anything, so it's not very useful yet.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40006 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-18 17:52:12 +00:00
Steve Naroff c80b4eefa2 Change DefaultFunctionArrayConversions and UsualUnaryConversions to return void. The caller
needs to query the expression for the type. Since both these functions guarantee the expression 
contains a valid type, removed old/vacuous asserts (from code calling both of these routines).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39930 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-16 21:54:35 +00:00
Chris Lattner 136f93a2b6 Make octal constant lexing use AdvanceToTokenCharacter to give more
accurate diagnostics.  For test/Lexer/comments.c we now emit:

int x = 000000080;  /* expected-error {{invalid digit}} */
               ^
constants.c:7:4: error: invalid digit '8' in octal constant
00080;             /* expected-error {{invalid digit}} */
   ^


The last line is due to an escaped newline.  The full line looks like:

int y = 0000\
00080;             /* expected-error {{invalid digit}} */


Previously, we emitted:
constants.c:4:9: error: invalid digit '8' in octal constant
int x = 000000080;  /* expected-error {{invalid digit}} */
        ^
constants.c:6:9: error: invalid digit '8' in octal constant
int y = 0000\
        ^

which isn't too bad, but the new way is better for the user,
regardless of whether there is an escaped newline or not.

All the other lexer-related diagnostics should switch over 
to using AdvanceToTokenCharacter where appropriate.  Help
wanted :).

This implements test/Lexer/constants.c.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39906 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-16 06:55:01 +00:00
Chris Lattner fa7c64562d "Someone typed "PtrToInt" where they meant "IntToPtr".
I've added a tests/CodeGen directory, and a test for this case that
used to fail and now passes."

Patch by Keith Bauer



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39794 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-13 03:25:53 +00:00
Steve Naroff c63b96ad70 Two changes...
- Teach all the integer/float predicates on Type about Vectors.
- Disallow bitwise compliment on float vectors. For example...

typedef float __attribute__(( vector_size(16) )) float4;

float4 float4_return()
{
    float4 xx;

    return ~xx;
}

...now emits the following diagnostic...

[administrators-powerbook59:~/llvm/tools/clang] admin% ../../Debug/bin/clang bug.c
bug.c:8:12: error: invalid argument type to unary expression 'float4'
    return ~xx;
           ^
1 diagnostic generated.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39791 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-12 21:46:55 +00:00
Reid Spencer 5f016e2cb5 Stage two of getting CFE top correct.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39734 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-11 17:01:13 +00:00