]> granicus.if.org Git - clang/log
clang
17 years agoAdded LabelLoc to GotoStmt to record the source location of the label token
Ted Kremenek [Thu, 6 Sep 2007 17:11:52 +0000 (17:11 +0000)]
Added LabelLoc to GotoStmt to record the source location of the label token
in the actual GotoStmt.

Fixed bug where GotoStmt::getSourceRange incorrectly used the target LabelStmt
to compute its extent.

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

17 years agoAdded libClangAnalysis
Ted Kremenek [Thu, 6 Sep 2007 15:58:13 +0000 (15:58 +0000)]
Added libClangAnalysis

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

17 years agoAdded an early implementation of Live-Variables analysis built on
Ted Kremenek [Thu, 6 Sep 2007 00:17:54 +0000 (00:17 +0000)]
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

17 years agoremove the FATAL classifier.
Chris Lattner [Thu, 6 Sep 2007 00:16:35 +0000 (00:16 +0000)]
remove the FATAL classifier.

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

17 years agoremove sorry.
Chris Lattner [Thu, 6 Sep 2007 00:14:09 +0000 (00:14 +0000)]
remove sorry.

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

17 years agoStart implementing Actions interface for ObjC classes, instance variables, and methods.
Steve Naroff [Wed, 5 Sep 2007 23:30:30 +0000 (23:30 +0000)]
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

17 years agoPatch for parsing objective-c style method calls.
Fariborz Jahanian [Wed, 5 Sep 2007 23:08:20 +0000 (23:08 +0000)]
Patch for parsing objective-c style method calls.

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

17 years agoMoved tracking of CFG block IDs into the CFG class.
Ted Kremenek [Wed, 5 Sep 2007 20:02:05 +0000 (20:02 +0000)]
Moved tracking of CFG block IDs into the CFG class.
Added CFG::getNumBlockIDs() to query the number of distinct block ids created.

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

17 years ago1. Fix parsing of method prototype involving c-style argument declarations.
Fariborz Jahanian [Wed, 5 Sep 2007 19:52:07 +0000 (19:52 +0000)]
1. Fix parsing of method prototype involving c-style argument declarations.
2. Fixes all allowable key-words used as selectors.
3. Template to do the messaging parse.
4. A test case for all allowable selector names.

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

17 years agoFixed a typo pointed out by Anders Calrsson.
Fariborz Jahanian [Tue, 4 Sep 2007 21:42:12 +0000 (21:42 +0000)]
Fixed a typo pointed out by Anders Calrsson.

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

17 years agoSimplified initializer semantic analysis by adding the following 2 methods:
Steve Naroff [Tue, 4 Sep 2007 21:13:33 +0000 (21:13 +0000)]
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

17 years agoPatch to parse objective-c's @compatibility_alias directive.
Fariborz Jahanian [Tue, 4 Sep 2007 19:26:51 +0000 (19:26 +0000)]
Patch to parse objective-c's @compatibility_alias directive.

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

17 years agoSet eol and mime type properties for VC8 build files
Hartmut Kaiser [Tue, 4 Sep 2007 19:15:17 +0000 (19:15 +0000)]
Set eol and mime type properties for VC8 build files

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

17 years agoUpdated VC8 project files.
Hartmut Kaiser [Tue, 4 Sep 2007 19:06:30 +0000 (19:06 +0000)]
Updated VC8 project files.

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

17 years agoUpdated calls to CreateGEP to new interface in LLVM mainline.
Ted Kremenek [Tue, 4 Sep 2007 17:20:08 +0000 (17:20 +0000)]
Updated calls to CreateGEP to new interface in LLVM mainline.

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

17 years agodisable this for now.
Chris Lattner [Tue, 4 Sep 2007 16:49:09 +0000 (16:49 +0000)]
disable this for now.

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

17 years agoMake sure initializer type promotions get propagated.
Steve Naroff [Tue, 4 Sep 2007 14:36:54 +0000 (14:36 +0000)]
Make sure initializer type promotions get propagated.

This fixes a recent regression with Codegen/mandel.c.

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

17 years agoupdates (?) to the vc++ files, patch by Hartmut Kaiser
Chris Lattner [Tue, 4 Sep 2007 02:46:31 +0000 (02:46 +0000)]
updates (?) to the vc++ files, patch by Hartmut Kaiser

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

17 years agosilence VC++ warnings, patch by Hartmut Kaiser
Chris Lattner [Tue, 4 Sep 2007 02:46:00 +0000 (02:46 +0000)]
silence VC++ warnings, patch by Hartmut Kaiser

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

17 years agoSilence VC++ warnings, patch by Hartmut Kaiser
Chris Lattner [Tue, 4 Sep 2007 02:45:27 +0000 (02:45 +0000)]
Silence VC++ warnings, patch by Hartmut Kaiser

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

17 years agoeliminate some VC++ warnings, patch contributed by Hartmut Kaiser
Chris Lattner [Tue, 4 Sep 2007 02:34:27 +0000 (02:34 +0000)]
eliminate some VC++ warnings, patch contributed by Hartmut Kaiser

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

17 years agoadd a VC++ solution file, contributed by Hartmut Kaiser
Chris Lattner [Tue, 4 Sep 2007 02:31:11 +0000 (02:31 +0000)]
add a VC++ solution file, contributed by Hartmut Kaiser

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

17 years agoMore fun with initializers!
Steve Naroff [Tue, 4 Sep 2007 02:20:04 +0000 (02:20 +0000)]
More fun with initializers!

- Fixed many bugs, enhanced test case considerably, added a diagnostic, etc.
- Refactored CheckInitList() into CheckVariableInitList()/CheckConstantInitList().
- Added CheckInitExpr().
- Support for multi-dimensional arrays looking good.

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

17 years agoVC++ doesn't define S_ISDIR
Chris Lattner [Mon, 3 Sep 2007 18:37:14 +0000 (18:37 +0000)]
VC++ doesn't define S_ISDIR

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

17 years agoAdd a method required by the VC++ STL, patch by Hartmut Kaiser!
Chris Lattner [Mon, 3 Sep 2007 18:31:57 +0000 (18:31 +0000)]
Add a method required by the VC++ STL, patch by Hartmut Kaiser!

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

17 years agoAdd #include required on win32.
Chris Lattner [Mon, 3 Sep 2007 18:30:32 +0000 (18:30 +0000)]
Add #include required on win32.

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

17 years agoEliminate some VC++ warnings, patch by Hartmut Kaiser!
Chris Lattner [Mon, 3 Sep 2007 18:28:41 +0000 (18:28 +0000)]
Eliminate some VC++ warnings, patch by Hartmut Kaiser!

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

17 years agoAdd #ifdefs to make the source portable to windows. Patch contributed
Chris Lattner [Mon, 3 Sep 2007 18:24:56 +0000 (18:24 +0000)]
Add #ifdefs to make the source portable to windows.  Patch contributed
by Hartmut Kaiser!

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

17 years agoinitial checkin of vc++ project files, contributed by
Chris Lattner [Mon, 3 Sep 2007 18:21:31 +0000 (18:21 +0000)]
initial checkin of vc++ project files, contributed by
Hartmut Kaiser!

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

17 years agoFinish getting "array-init.c" to work properly.
Steve Naroff [Mon, 3 Sep 2007 01:24:23 +0000 (01:24 +0000)]
Finish getting "array-init.c" to work properly.

Array scalar initialization is now is reasonable shape.

Next step, structure and array of structure initializers.

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

17 years agoMore progress on array initializers.
Steve Naroff [Sun, 2 Sep 2007 20:30:18 +0000 (20:30 +0000)]
More progress on array initializers.

- Added Expr::isConstantExpr().
- Added type checking for InitListExpr elements.
- Added diagnostic for trying to initialize a variable sized object.

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

17 years agoMore semantic analysis of initializers.
Steve Naroff [Sun, 2 Sep 2007 15:34:30 +0000 (15:34 +0000)]
More semantic analysis of initializers.

Added 2 errors and one warning, updated test case.

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

17 years agoStart implementing semantic analysis for C initializers.
Steve Naroff [Sun, 2 Sep 2007 02:04:30 +0000 (02:04 +0000)]
Start implementing semantic analysis for C initializers.

Step 1: Start instantiating InitListExpr's.
Step 2: Call newly added function Sema::CheckInitializer() from Sema::ParseDeclarator().
Step 3: Give InitListExpr's a preliminary type.
Step 4: Start emitting diagnostics for simple assignments.

Note:

As a result of step 1, the CodeGen/mandel.c test asserts "Unimplemented agg expr!", which is expected.

As a result of step 4, the test below now fails. This isn't expected and needs to be investigated (it appears type checking for C++ references is flawed in some way).

******************** TEST 'Sema/cxx-references.cpp' FAILED! ********************
Command:
 clang -fsyntax-only Sema/cxx-references.cpp
Output:
Sema/cxx-references.cpp:8:12: warning: incompatible pointer types assigning 'int &*' to 'int *'
  int *p = &r;
           ^~
Sema/cxx-references.cpp:10:20: error: incompatible types assigning 'int (int)' to 'int (&)(int)'
  int (&rg)(int) = g;
                   ^
Sema/cxx-references.cpp:13:18: error: incompatible types assigning 'int [3]' to 'int (&)[3]'
  int (&ra)[3] = a;
                 ^
Sema/cxx-references.cpp:16:14: error: incompatible types assigning 'int *' to 'int *&'
  int *& P = Q;
             ^
4 diagnostics generated.
******************** TEST 'Sema/cxx-references.cpp' FAILED! ********************

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

17 years agoFinish converting SwitchStmt AST to source ranges.
Steve Naroff [Sat, 1 Sep 2007 21:08:38 +0000 (21:08 +0000)]
Finish converting SwitchStmt AST to source ranges.
Move DumpSourceRange() to DumpStmt().

Now -parse-ast-dump will display source range info for all stmts/exprs.

One day we should implement the source range protocol for Decls.

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

17 years agoPatch to parse @implementation prologue, method definitions,
Fariborz Jahanian [Sat, 1 Sep 2007 00:26:16 +0000 (00:26 +0000)]
Patch to parse @implementation prologue, method definitions,
objc2's @synthesize and @dynamic.

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

17 years agoConvert more statments over to SourceRanges...
Steve Naroff [Fri, 31 Aug 2007 23:49:30 +0000 (23:49 +0000)]
Convert more statments over to SourceRanges...

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

17 years agoMove SourceRange protocol from Expr->Stmt.
Steve Naroff [Fri, 31 Aug 2007 23:28:33 +0000 (23:28 +0000)]
Move SourceRange protocol from Expr->Stmt.

Converted many of the statements over. Still a hanful left...

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

17 years agoadd stmtexpr support for aggregates
Chris Lattner [Fri, 31 Aug 2007 22:54:14 +0000 (22:54 +0000)]
add stmtexpr support for aggregates

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

17 years agoadd support for complex stmtexpr's
Chris Lattner [Fri, 31 Aug 2007 22:51:38 +0000 (22:51 +0000)]
add support for complex stmtexpr's

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

17 years agoGeneralize RValue to handle complex better, generalize EmitCompoundStmt to
Chris Lattner [Fri, 31 Aug 2007 22:49:20 +0000 (22:49 +0000)]
Generalize RValue to handle complex better, generalize EmitCompoundStmt to
support any sort of expr, add a new EmitAnyExpr routine.

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

17 years agoFixed missing '(' and ')' characters in (CFG) pretty-printing of
Ted Kremenek [Fri, 31 Aug 2007 22:47:06 +0000 (22:47 +0000)]
Fixed missing '(' and ')' characters in (CFG) pretty-printing of
statement expressions.

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

17 years agoAdded better pretty printing in CFGs for __builtin_choose_expr
Ted Kremenek [Fri, 31 Aug 2007 22:29:13 +0000 (22:29 +0000)]
Added better pretty printing in CFGs for __builtin_choose_expr

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

17 years agoFurther cleanups in CFG printing for comma expressions, statement expressions, and...
Ted Kremenek [Fri, 31 Aug 2007 22:26:13 +0000 (22:26 +0000)]
Further cleanups in CFG printing for comma expressions, statement expressions, and indirect gotos.

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

17 years agoimplement code generation for scalar stmt expressions.
Chris Lattner [Fri, 31 Aug 2007 22:09:40 +0000 (22:09 +0000)]
implement code generation for scalar stmt expressions.

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

17 years agoFix a bug/missing-feature Ted noticed: the 'unused' warning should not
Chris Lattner [Fri, 31 Aug 2007 21:49:55 +0000 (21:49 +0000)]
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

17 years agoCleanups for printing the terminators of CFGBlocks for "?", "||", and "&&" operators.
Ted Kremenek [Fri, 31 Aug 2007 21:49:40 +0000 (21:49 +0000)]
Cleanups for printing the terminators of CFGBlocks for "?", "||", and "&&" operators.

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

17 years agodiagnose extended uses of offsetof
Chris Lattner [Fri, 31 Aug 2007 21:49:13 +0000 (21:49 +0000)]
diagnose extended uses of offsetof

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

17 years agonew diag
Chris Lattner [Fri, 31 Aug 2007 21:48:38 +0000 (21:48 +0000)]
new diag

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

17 years agoAdded "PrinterHelper" interface (include/AST/PrinterHelper) that can
Ted Kremenek [Fri, 31 Aug 2007 21:30:12 +0000 (21:30 +0000)]
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

17 years agoAdded #ifndef/#endif statements to protect the header from multiple inclusion.
Ted Kremenek [Fri, 31 Aug 2007 17:53:25 +0000 (17:53 +0000)]
Added #ifndef/#endif statements to protect the header from multiple inclusion.

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

17 years agoRemoved Sema::VerifyConstantArrayType(). With the new Array/ConstantArray/VariableArr...
Steve Naroff [Fri, 31 Aug 2007 17:20:07 +0000 (17:20 +0000)]
Removed Sema::VerifyConstantArrayType(). With the new Array/ConstantArray/VariableArray nodes, this
routine was causing more trouble than it was worth. Anders/Chris noticed that it could return an error code
without emiting a diagnostic (which results in an silent invalid decl, which should *never* happen). In addition,
this routine didn't work well for typedefs and field decls. Lastly, it didn't consider that initializers aren't
in place yet.

Added Type::getAsConstantArrayType(), Type::getAsVariableArrayType(), Type::getAsVariablyModifiedType(),
and Type::isVariablyModifiedType();

Modified Sema::ParseDeclarator() and Sema::ParseField() to use the new predicates. Also added a FIXME for
the initializer omission. Also added a missing test for "static" @ file scope.

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

17 years agoAdded support for __builtin_choose_expr (ChooseExpr) in CFGs.
Ted Kremenek [Fri, 31 Aug 2007 17:03:41 +0000 (17:03 +0000)]
Added support for __builtin_choose_expr (ChooseExpr) in CFGs.

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

17 years agoAuthor: F. Jahanian
Fariborz Jahanian [Fri, 31 Aug 2007 16:11:31 +0000 (16:11 +0000)]
Author: F. Jahanian
Log:
Implement parsing of objective-c's new @property declaration.

Modified:
include/clang/Basic/DiagnosticKinds.def
include/clang/Parse/Parser.h
Parse/ParseObjc.cpp
Parse/Parser.cpp

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

17 years agodon't turn semantic errors into parse errors.
Chris Lattner [Fri, 31 Aug 2007 05:01:50 +0000 (05:01 +0000)]
don't turn semantic errors into parse errors.

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

17 years agofix some memory leaks when recovering.
Chris Lattner [Fri, 31 Aug 2007 04:58:34 +0000 (04:58 +0000)]
fix some memory leaks when recovering.

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

17 years agoAdd InitListExpr class.
Anders Carlsson [Fri, 31 Aug 2007 04:56:16 +0000 (04:56 +0000)]
Add InitListExpr class.

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

17 years agoadd actions for deleting expr/stmt nodes.
Chris Lattner [Fri, 31 Aug 2007 04:53:24 +0000 (04:53 +0000)]
add actions for deleting expr/stmt nodes.

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

17 years agoImplement codegen support for lowering "library builtins" like __builtin_isinf
Chris Lattner [Fri, 31 Aug 2007 04:44:06 +0000 (04:44 +0000)]
Implement codegen support for lowering "library builtins" like __builtin_isinf
to their corresponding library routines (e.g. isinf).  This allows us to handle
all the stuff in macos math.h, and other stuff as it's added to *Builtins.def.

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

17 years agoadd the ability to get the llvm function corresponding to a library builtin.
Chris Lattner [Fri, 31 Aug 2007 04:31:45 +0000 (04:31 +0000)]
add the ability to get the llvm function corresponding to a library builtin.

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

17 years agoadd some accessors for querying attributes of builtins. Add the new 'F' attribute.
Chris Lattner [Fri, 31 Aug 2007 03:44:20 +0000 (03:44 +0000)]
add some accessors for querying attributes of builtins.  Add the new 'F' attribute.

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

17 years agoSema::ParseCastExpr() missing call to UsualUnaryConversions().
Steve Naroff [Fri, 31 Aug 2007 00:32:44 +0000 (00:32 +0000)]
Sema::ParseCastExpr() missing call to UsualUnaryConversions().

The following case now works...

void empty(void * a ) {}

void test()
{
    unsigned char A[4];
    empty( (void *) A);
}

Thanks to Patrick Flannery for finding this...

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

17 years agoFinal phase of array cleanup (for now), removing a FIXME from yesterday.
Steve Naroff [Thu, 30 Aug 2007 22:35:45 +0000 (22:35 +0000)]
Final phase of array cleanup (for now), removing a FIXME from yesterday.

Moved several array constraints checks from Sema::VerifyConstantArrayType() to
Sema::GetTypeForDeclarator(). VerifyConstantArrayType() is now very simple, and
could be removed eventually.

Now, we get the following (correct) messages for BlockVarDecls:-)

[dylan:~/llvm/tools/clang] admin% ../../Debug/bin/clang x.c -pedantic
x.c:4:20: error: size of array has non-integer type 'float'
  int size_not_int[f];
                   ^
x.c:5:21: error: array size is negative
  int negative_size[1-2];
                    ^~~
x.c:6:17: warning: zero size arrays are an extension
  int zero_size[0];
                ^
3 diagnostics generated.

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

17 years agoMinor cleanups to pretty-printing for loops in CFGs.
Ted Kremenek [Thu, 30 Aug 2007 21:28:02 +0000 (21:28 +0000)]
Minor cleanups to pretty-printing for loops in CFGs.

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

17 years agoFixed a bug in constructing CFG blocks for case statement fall-through
Ted Kremenek [Thu, 30 Aug 2007 18:48:11 +0000 (18:48 +0000)]
Fixed a bug in constructing CFG blocks for case statement fall-through
introduced by moving "CaseStmt" pointers out of the list of statements
and into the explicit "label" associated with a CFGBlock.  --This
line, and those below, will be ignored--

M    AST/CFG.cpp

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

17 years agoDiff is self small & self explanatory...
Steve Naroff [Thu, 30 Aug 2007 18:45:57 +0000 (18:45 +0000)]
Diff is self small & self explanatory...

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

17 years agoFixed bug in CFG construction where we failed to handle loop bodies with
Ted Kremenek [Thu, 30 Aug 2007 18:39:40 +0000 (18:39 +0000)]
Fixed bug in CFG construction where we failed to handle loop bodies with
no statements (or just full of ';' statements).

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

17 years agoFixed bug in CFG construction involving use of labels and "empty"
Ted Kremenek [Thu, 30 Aug 2007 18:20:57 +0000 (18:20 +0000)]
Fixed bug in CFG construction involving use of labels and "empty"
blocks involving only ';' statements.  We now correctly handle the following:

void empty_label() { l1: ; }

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

17 years agoFix a comment.
Steve Naroff [Thu, 30 Aug 2007 18:14:25 +0000 (18:14 +0000)]
Fix a comment.

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

17 years agoFixed bug where the CFG would fail to build when an 'if' statement had
Ted Kremenek [Thu, 30 Aug 2007 18:13:31 +0000 (18:13 +0000)]
Fixed bug where the CFG would fail to build when an 'if' statement had
an empty then or else block (or contained only ';' statements).

For example, we now handle the following:

int empty_else() { if (0) { int a; } else ; }
int empty_then() { if (0) ; else { int a; } }

Thanks to Nico Weber for spotting this problem.

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

17 years agoPolish yesterday's Array/ConstantArray/VariableArray rewrite, removing a couple FIXME's.
Steve Naroff [Thu, 30 Aug 2007 18:10:14 +0000 (18:10 +0000)]
Polish yesterday's Array/ConstantArray/VariableArray rewrite, removing a couple FIXME's.

Refactored Array/VariableArray, moving SizeModifier/IndexTypeQuals back up to Array. These
attributes are not specific to VLA's. Most of them are specific to array parameter types.

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

17 years agoimplement pretty printing of offsetof
Chris Lattner [Thu, 30 Aug 2007 17:59:59 +0000 (17:59 +0000)]
implement pretty printing of offsetof

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

17 years agoa new testcase
Chris Lattner [Thu, 30 Aug 2007 17:51:09 +0000 (17:51 +0000)]
a new testcase

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

17 years agoimplement initial sema support for __builtin_offsetof
Chris Lattner [Thu, 30 Aug 2007 17:45:32 +0000 (17:45 +0000)]
implement initial sema support for __builtin_offsetof

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

17 years agoPass the location of the type.
Chris Lattner [Thu, 30 Aug 2007 17:08:45 +0000 (17:08 +0000)]
Pass the location of the type.

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

17 years agoFix 80 col violations.
Chris Lattner [Thu, 30 Aug 2007 17:08:17 +0000 (17:08 +0000)]
Fix 80 col violations.

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

17 years agoFixed bug for CaseStmt where the child_begin/child_end methods were not
Ted Kremenek [Thu, 30 Aug 2007 16:50:46 +0000 (16:50 +0000)]
Fixed bug for CaseStmt where the child_begin/child_end methods were not
including the expressions in the case statement itself (not the body of
the case).

This required moving SubStmt out of SwitchCase into CaseStmt and DefaultStmt
respectively.  getSubStmt() now is a virtual call for SwitchCase, but is
a direct (static) call for CaseStmt and DefaultStmt.

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

17 years agomake sure to parse postfix expression suffixes after builtin
Chris Lattner [Thu, 30 Aug 2007 15:52:49 +0000 (15:52 +0000)]
make sure to parse postfix expression suffixes after builtin
primary expressions.

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

17 years agoadd an action callback for __builtin_offsetof
Chris Lattner [Thu, 30 Aug 2007 15:51:11 +0000 (15:51 +0000)]
add an action callback for __builtin_offsetof

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

17 years ago-C mode doesn't return comments on "#" lines, so the diag checker doesn't pick them up.
Chris Lattner [Thu, 30 Aug 2007 06:38:49 +0000 (06:38 +0000)]
-C mode doesn't return comments on "#" lines, so the diag checker doesn't pick them up.
Test this the hard way.

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

17 years agoWhen relexing the file to find expected warnings/errors, make sure
Chris Lattner [Thu, 30 Aug 2007 06:34:23 +0000 (06:34 +0000)]
When relexing the file to find expected warnings/errors, make sure
to turn off all lexer-related warnings.

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

17 years agofix a bug that is causing CodeGen/complex.c to be grumpy.
Chris Lattner [Thu, 30 Aug 2007 06:19:11 +0000 (06:19 +0000)]
fix a bug that is causing CodeGen/complex.c to be grumpy.

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

17 years agoTeach the stmtdumper to dump location/range info when a SourceMgr is available.
Chris Lattner [Thu, 30 Aug 2007 06:17:34 +0000 (06:17 +0000)]
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

17 years agoFix a regression on test/Sema/unused-expr.c by fixing the type predicates
Chris Lattner [Thu, 30 Aug 2007 06:10:41 +0000 (06:10 +0000)]
Fix a regression on test/Sema/unused-expr.c by fixing the type predicates
to test for the right type class.

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

17 years agoconstify a method.
Chris Lattner [Thu, 30 Aug 2007 05:59:30 +0000 (05:59 +0000)]
constify a method.

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

17 years agoFix the following redefinition errors submitted by Keith Bauer...
Steve Naroff [Thu, 30 Aug 2007 01:06:46 +0000 (01:06 +0000)]
Fix the following redefinition errors submitted by Keith Bauer...

[dylan:~/llvm/tools/clang] admin% cat tentative_decls.c
// incorrectly generates redefinition error
extern int array[3];
int array[3];

// incorrectly generates a redefinition error
extern void nup(int a[3]);
void nup(int a[3]) {}

It turns out that this exposed a fairly major flaw in the type system,
array types were never getting uniqued! This is because all array types
contained an expression, which aren't unique.

To solve this, we now have 2 array types, ConstantArrayType and
VariableArrayType. ConstantArrayType's are unique, VAT's aren't.

This is a fairly extensive set of fundamental changes. Fortunately,
all the tests pass. Nevertheless, there may be some collateral damage:-)
If so, let me know!

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

17 years agoPrevious commit should have been:
Chris Lattner [Thu, 30 Aug 2007 01:00:35 +0000 (01:00 +0000)]
Previous commit should have been:
  Use Ted's child walking interface to allow the dumper to walk the tree
  in one place and only have node-specific callbacks worry about
  formatting the nodes (instead of formatting the nodes plus walking the
  tree).

This commit eliminates now default cases by letting them fall through with
the normal visitor stuff.

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

17 years agoelimiante some virtual calls.
Chris Lattner [Thu, 30 Aug 2007 00:53:54 +0000 (00:53 +0000)]
elimiante some virtual calls.

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

17 years agoAllow a SourceManager to optionally be passed into Stmt::dump
Chris Lattner [Thu, 30 Aug 2007 00:40:08 +0000 (00:40 +0000)]
Allow a SourceManager to optionally be passed into Stmt::dump

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

17 years agoAdded comments about -dump-cfg and -view-cfg modes for the clang driver.
Ted Kremenek [Wed, 29 Aug 2007 23:26:37 +0000 (23:26 +0000)]
Added comments about -dump-cfg and -view-cfg modes for the clang driver.

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

17 years agoAdded an (optional) explicit "Label" statement to CFGBlock. If a
Ted Kremenek [Wed, 29 Aug 2007 23:20:49 +0000 (23:20 +0000)]
Added an (optional) explicit "Label" statement to CFGBlock.  If a
block begins with a label or case statement, CFGBlock::getLabel() will
return the corresponding LabelStmt/CaseStmt/DefaultStmt.

LabelStmts and SwitchCases no longer appear within the "executable"
statements of a CFGBlock.

More cleanups on visualization/pretty-printing of CFGs (less verbose).

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

17 years agocleanup context-sensitive objc keyword recognition. Patch by Fariborz Jahanian.
Chris Lattner [Wed, 29 Aug 2007 22:54:08 +0000 (22:54 +0000)]
cleanup context-sensitive objc keyword recognition.  Patch by Fariborz Jahanian.

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

17 years agoSpaces not tabs.
Neil Booth [Wed, 29 Aug 2007 22:13:52 +0000 (22:13 +0000)]
Spaces not tabs.

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

17 years agoEnsure we diagnose long long literals in C90 mode.
Neil Booth [Wed, 29 Aug 2007 22:00:19 +0000 (22:00 +0000)]
Ensure we diagnose long long literals in C90 mode.

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

17 years agoAdded GraphTraits to source-level CFGs (CFG and CFGBlock) to allow
Ted Kremenek [Wed, 29 Aug 2007 21:56:09 +0000 (21:56 +0000)]
Added GraphTraits to source-level CFGs (CFG and CFGBlock) to allow
(LLVM-provided) graph algorithms such as DFS and graph visualization
to work effortless on source-level CFGs.

Further cleanup on pretty printing of CFGs.  CFGBlock::dump and
CFGBlock::print now take the parent CFG as an argument.  This allows
CFGBlocks to print their own appropriate label indicating whether or
not they are the Entry/Exit/IndirectGotoBlock without the CFG::print
routine doing it instead.

Added Graphviz visualization for CFGs: CFG::viewCFG.  This employs the
GraphTraits just implemented.

Added "-view-cfg" mode the to clang driver.  This is identical to
"-dump-cfg" except that it calls Graphviz to visualize the CFGs
instead of dumping them to the terminal.

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

17 years agoAdded checking (during parsing) of comparison of floating point values using == or !=.
Ted Kremenek [Wed, 29 Aug 2007 18:06:12 +0000 (18:06 +0000)]
Added checking (during parsing) of comparison of floating point values using == or !=.
This is the same functionality gcc provides via --Wfloat-equal.

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

17 years agoTeach Type::is[un]SignedIntegerType about enum decls. This allows the code generator
Chris Lattner [Wed, 29 Aug 2007 17:48:46 +0000 (17:48 +0000)]
Teach Type::is[un]SignedIntegerType about enum decls.  This allows the code generator
to emit signed comparisons when needed for enum decl references.  This implements
test/CodeGen/enum.c.  I think enums should be good now.

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

17 years agoImplement GCC-compatible layout and typing of enum constants and enum decl.
Chris Lattner [Wed, 29 Aug 2007 17:31:48 +0000 (17:31 +0000)]
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

17 years agoadd some accessors
Chris Lattner [Wed, 29 Aug 2007 17:23:37 +0000 (17:23 +0000)]
add some accessors

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

17 years agoFix a null dereference Neil ran into
Chris Lattner [Wed, 29 Aug 2007 16:03:41 +0000 (16:03 +0000)]
Fix a null dereference Neil ran into

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

17 years agoremove some ugly code now that implicit defs are being generated in this case, thanks...
Chris Lattner [Wed, 29 Aug 2007 06:38:44 +0000 (06:38 +0000)]
remove some ugly code now that implicit defs are being generated in this case, thanks Steve!

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