Commit Graph

4640 Commits

Author SHA1 Message Date
Ted Kremenek a3d02636ef Use HTML5 doctype when generating HTML.
llvm-svn: 49888
2008-04-18 03:37:38 +00:00
Ted Kremenek 89e6a9b98c Added null check.
llvm-svn: 49887
2008-04-18 02:24:50 +00:00
Ted Kremenek a821e087de Updated CSS colors. Patch by Cedric Venet!
llvm-svn: 49886
2008-04-18 02:12:39 +00:00
Ted Kremenek 217e9bff2b Added test cases to test for reference count leaks.
llvm-svn: 49885
2008-04-18 02:00:02 +00:00
Ted Kremenek cffe635699 Simplified internal logic of BugReporter, consolidating EmitWarning and
EmitPathWarning into one method.  We now properly handle emitting warnings
without a PathDiagnosticClient when the warning does not involve a particular
statement.

llvm-svn: 49884
2008-04-18 01:56:37 +00:00
Fariborz Jahanian d83bdd3841 Fixed a bug in categories and properties.
llvm-svn: 49883
2008-04-18 00:30:47 +00:00
Fariborz Jahanian ffe97a3925 Initial work for property implementation declarations.
Mostly semantic checking in this patch. This is on going
and incomplete.

llvm-svn: 49882
2008-04-18 00:19:30 +00:00
Steve Naroff be89ba0c38 Update VC++ project files.
llvm-svn: 49881
2008-04-17 23:51:38 +00:00
Ted Kremenek 69049c272f Modified BugReport::getEndPath() to handle the case where end path is at
the exit block of the CFG.

llvm-svn: 49880
2008-04-17 23:44:37 +00:00
Ted Kremenek cc0951bde1 Hook up reporting reference count memory leaks to the BugReporter mechanism.
llvm-svn: 49879
2008-04-17 23:43:50 +00:00
Chris Lattner 54349c5f4d Fix a problem noticed by Nuno, where we wouldn't escape characters in
macro expansions.

llvm-svn: 49877
2008-04-17 23:03:14 +00:00
Ted Kremenek f42f3fb47d class Preprocessor: Now owns the "predefines" char*; it deletes [] it in its dstor.
clang.cpp: InitializePreprocessor now makes a copy of the contents of PredefinesBuffer and
  passes it to the preprocessor object.
  
clang.cpp: DriverPreprocessorFactory now calls "InitializePreprocessor" instead of this being done in main().

html::HighlightMacros() now takes a PreprocessorFactory, allowing it to conjure up a new
Preprocessor to highlight macros.

class HTMLDiagnostics now takes a PreprocessorFactory* that it can use for html::HighlightMacros().
Updated clients of HTMLDiagnostics to use this new interface.

llvm-svn: 49875
2008-04-17 22:31:54 +00:00
Chris Lattner 7c7e9b3bbe Handle text escaping (e.g. & -> &) last, to avoid interactions between 'replace' operations and insert operations. This fixes a problem with "&;&" on line 666 of the gcc.c example I sent out.
llvm-svn: 49874
2008-04-17 22:24:51 +00:00
Ted Kremenek 306492d8cb Generate the Preprocessor using a local PreprocessorFactory object.
While this adds no extra functionality now, we will soon pass the
PreprocessorFactory object to some ASTConsumers.

llvm-svn: 49873
2008-04-17 21:38:34 +00:00
Chris Lattner 6929bd8047 don't give macros a background
llvm-svn: 49871
2008-04-17 21:32:46 +00:00
Chris Lattner f219126107 Make sure popup is on top over other spans. wrap long line.
llvm-svn: 49870
2008-04-17 21:28:41 +00:00
Ted Kremenek 219bab3be9 Added "PreprocessorFactory", an interface for lazily creating Preprocessor objects on-demand.
llvm-svn: 49868
2008-04-17 21:23:07 +00:00
Ted Kremenek c2c08caf9c Add support in HTML macro expansion for hovering over a macro and automatically
expanding its definition.  This is a pure CSS solution.

Tested on IE7, Firefox 3b4, and Safari 3.1.

Patch by Cedric Venet!

llvm-svn: 49865
2008-04-17 19:57:27 +00:00
Ted Kremenek aabc986766 Temporarily disable macro expansion in the HTML output of HTMLDiagnostics to
avoid corrupting Preprocessor state.  Working on a fix.

llvm-svn: 49864
2008-04-17 18:39:57 +00:00
Ted Kremenek 8bb90b8152 HAve HTMLDiagnostics use html::HighlightRange to highlight message ranges.
llvm-svn: 49863
2008-04-17 18:37:23 +00:00
Fariborz Jahanian 8e36cddde0 Added property decl support for protocols.
Added assertion if unexpected property decls are found where they don't belong.
Consolidated property decl. printing by using a helper function.

llvm-svn: 49862
2008-04-17 18:25:18 +00:00
Ted Kremenek a506fec90a Added transfer function support for ReturnStmt to support detecting leaks
involving objects that are returned but have an excessive reference count.

llvm-svn: 49861
2008-04-17 18:12:53 +00:00
Nate Begeman 36c49278b5 Allow redirecting text diagnostic printer output to any llvm::OStream, rather
than hard coding llvm::cerr.

llvm-svn: 49860
2008-04-17 18:06:57 +00:00
Argyrios Kyrtzidis 6d05303342 Use TranslationUnitDecl as DeclContext of builtin functions.
llvm-svn: 49856
2008-04-17 14:47:13 +00:00
Argyrios Kyrtzidis c3b69ae815 Addition of TranslationUnitDecl to the AST:
-Added TranslationUnitDecl class to serve as top declaration context
-ASTContext gets a TUDecl member and a getTranslationUnitDecl() function
-All ScopedDecls get the TUDecl as DeclContext when declared at global scope

llvm-svn: 49855
2008-04-17 14:40:12 +00:00
Argyrios Kyrtzidis fc2f058230 Fix MSVC compiler error: "initialization of 'VD' is skipped by 'case' label"
llvm-svn: 49853
2008-04-17 13:52:22 +00:00
Chris Lattner f1c70d79b8 insert macro expansions into floating divs. For now, they are always displayed,
but we want some javascript or something toggle their display.

llvm-svn: 49836
2008-04-17 00:40:45 +00:00
Chris Lattner 775fdd3618 correctly hilight multi-line macro definitions and other
preprocessor directives.

llvm-svn: 49828
2008-04-16 23:21:17 +00:00
Chris Lattner 10dbbb0c5a Make HighlightRange correctly handle multi-line ranges. This causes us to
correctly handle multi-line comments.

llvm-svn: 49827
2008-04-16 23:06:45 +00:00
Ted Kremenek 9c375158a0 Handle ReturnStmts by dispatching to "EvalReturn" in the transfer function object.
llvm-svn: 49826
2008-04-16 23:05:51 +00:00
Chris Lattner 8e3006a4e3 add a new HighlightRange API, it doesn't handle multiline ranges
yet, but it will soon...

llvm-svn: 49825
2008-04-16 22:45:51 +00:00
Ted Kremenek cbf4c6134e CF ref. count checker: Register memory leaks at the end of a path.
llvm-svn: 49824
2008-04-16 22:32:20 +00:00
Ted Kremenek 86051690ea Bug fix in GREndPathNodeBuilderImpl: Use the specified state to construct
a node, not the state of the predecessor.

llvm-svn: 49823
2008-04-16 22:30:40 +00:00
Fariborz Jahanian 549e83caa0 New AST class for property implementation declarations.
llvm-svn: 49821
2008-04-16 22:00:24 +00:00
Fariborz Jahanian d634dfae0f Fixed a comment.
llvm-svn: 49819
2008-04-16 21:11:25 +00:00
Ted Kremenek c1f9a28e4d Added CFGBlock::getTerminatorCondition() to get the Expr* of the condition a block's terminator.
Refactored LiveVariables to use getTerminatorCondition() in VisitTerminator().

Bug fix: CFG now computes Block-level expression numbers using information
from block terminators.  This fixes <rdar://problem/5868189>.

llvm-svn: 49818
2008-04-16 21:10:48 +00:00
Fariborz Jahanian 9d981eb9ae This patch adds support for declaraing properties in categories,
just as they are declared in objc classes.

llvm-svn: 49817
2008-04-16 21:08:45 +00:00
Chris Lattner e9786c3199 reenable highlighting of (the first line of) comments
llvm-svn: 49816
2008-04-16 20:54:51 +00:00
Chris Lattner 0bb0e7ee8a switch from relexing with the preprocessor to do syntax highlighting to relexing
with the Lexer.  This is cheaper and gives us some advantages.  For now we start
highlighting preprocessor directives (which need improvement), and disable 
comments.  Comments to be restored later.

llvm-svn: 49815
2008-04-16 20:51:51 +00:00
Ted Kremenek b47c742002 Add extra test cases to test "escaping" for the reference count checker.
llvm-svn: 49812
2008-04-16 20:41:27 +00:00
Ted Kremenek 7145489c37 Small tweaks to EvalStore: pass an "RVal" instead of "LVal" for the TargetLV to
represent possible stores to "Unknown."

llvm-svn: 49811
2008-04-16 20:40:59 +00:00
Ted Kremenek 7d28c2c681 Update XCode project (added GRTransferFuncs.cpp).
llvm-svn: 49806
2008-04-16 18:39:47 +00:00
Ted Kremenek 673b5c1e42 Add missing file.
llvm-svn: 49805
2008-04-16 18:39:25 +00:00
Ted Kremenek 90c7cb6810 Hook up "EvalStore" from GRTransferFuncs to GRExprEngine.
llvm-svn: 49804
2008-04-16 18:39:06 +00:00
Ted Kremenek 2044a5183d Take first step to migrating handling of "stores" to values from GRExprEngine
to the plug-in GRTransferFuncs object.

llvm-svn: 49801
2008-04-16 18:21:25 +00:00
Ted Kremenek ed30e8da56 LiveVariables now updates the liveness state of block-level expressions that
are referenced by CFGBlock terminators.

llvm-svn: 49798
2008-04-16 17:07:59 +00:00
Ted Kremenek 2e4d0ecaa3 Added fixme.
llvm-svn: 49797
2008-04-16 16:53:18 +00:00
Ted Kremenek f2e6fcf3bf Hook up HTMLDiagnostics to use Chris's new syntax highlighting. --html-diags
currently doesn't pass in the Preprocessor from the driver, so we don't get
syntax highlighting when we create HTMLDiagnostics in that way.

llvm-svn: 49796
2008-04-16 16:39:56 +00:00
Ted Kremenek 08e562d3c8 In ExplodedGraphImpl::Trim, prioritize for paths that don't span loops by using
two worklists: for nodes whose locations are block edges with loop terminators
and another for nodes with all other locations.  We only dequeue from the loop
worklist when the other is empty.  Exploration of the graph is still in
reverse-BFS.

llvm-svn: 49791
2008-04-16 15:51:26 +00:00
Chris Lattner 03b8fcc247 Take a stab at highlighting #defines and #includes. This doesn't work yet.
llvm-svn: 49781
2008-04-16 06:53:09 +00:00
Chris Lattner 5e69a2dd9a Syntax highlight keywords. I assume someone else will pick less appaling colors.
llvm-svn: 49780
2008-04-16 06:35:07 +00:00
Chris Lattner a5a75e7a10 split syntax highlighting of macros from keywords and comments,
allowing us to use a cheaper means to highlight keywords and making
it so that comments won't foul up macro expansions.

Start highlighting macro expansions.

llvm-svn: 49779
2008-04-16 06:32:08 +00:00
Chris Lattner 060d8aa2ed Add a mode of hackily syntax highlighting comments. This has a number of
problems, including the fact that it doesn't work well with multi-line 
comments due to Ted's crazy table.  However, that could be fixed, and it
does work with single-line ones :).

llvm-svn: 49778
2008-04-16 06:11:58 +00:00
Chris Lattner dffe0f7db5 Add -o support for -emit-html, make it not produce a file on an error.
llvm-svn: 49777
2008-04-16 05:21:09 +00:00
Ted Kremenek 088d12e741 Remove "--html-test" driver option and its corresponding code; all of this
functionality has been migrated into "--emit-html" and "--html-diags".

llvm-svn: 49776
2008-04-16 04:38:45 +00:00
Chris Lattner c326f7e860 Switch AddLineNumbers to hack on a rewritebuffer instead of on a
rewriter, getting sourcelocations out of the picture.

llvm-svn: 49775
2008-04-16 04:37:29 +00:00
Chris Lattner e7d696ec7f In html::EscapeText, instead of going through the rewriter with
a SourceLocation to get a RewriteBuffer, poke the RewriteBuffer
with an offset directly.  THis is no faster, but results in 
cleaner code.

llvm-svn: 49774
2008-04-16 04:33:23 +00:00
Ted Kremenek b65a67d7b6 Remove uses of "Selector&" and "const Selector&", since Selector is just an
immutable smart pointer (we don't need to pass references, just pass Selector).

llvm-svn: 49773
2008-04-16 04:30:16 +00:00
Ted Kremenek bba6a4b367 Update CF reference count checker test case to illustrate the use of
toll-free bridging.

llvm-svn: 49772
2008-04-16 04:29:21 +00:00
Ted Kremenek 8cb96e92a1 Implemented toll-free bridging support for CF Reference count checker.
llvm-svn: 49771
2008-04-16 04:28:53 +00:00
Chris Lattner a776f953d7 make a method public.
llvm-svn: 49770
2008-04-16 04:28:52 +00:00
Chris Lattner 05e5310ad8 switch AddLineNumber to use a SmallString instead of sstream. This
speeds up -emit-html on ted's testcase by 29% (.138 -> 0.107s) in a
release build.

llvm-svn: 49767
2008-04-16 04:11:35 +00:00
Chris Lattner e4dd37ce0a speed up -emit-html in a release build by 6.5% by avoiding std::string.
llvm-svn: 49764
2008-04-16 03:46:57 +00:00
Ted Kremenek e556f9e39c Simplify some code.
llvm-svn: 49763
2008-04-16 02:59:55 +00:00
Ted Kremenek 748c7ce4ba Added initial boilerplate to support toll-free bridging in the ref-count checker.
llvm-svn: 49756
2008-04-15 23:44:31 +00:00
Ted Kremenek 667cacb2ff Added some comments to GRExprEngine. Reorder some of the method definitions
to start logically organizing them.

Added initial plug-in transfer function support for Objective-C message expressions.

llvm-svn: 49752
2008-04-15 23:06:53 +00:00
Ted Kremenek 32b1537cc2 Revert my previous patch.
llvm-svn: 49751
2008-04-15 23:06:05 +00:00
Ted Kremenek 3af355c900 Remove dispatch to "VisitParmVarDecl".
llvm-svn: 49750
2008-04-15 23:03:58 +00:00
Ted Kremenek 6204498aad Change "VisitBlockVarDecl" to "VisitVarDecl". UninitializedValues now works
as before r49748 (where BlockVarDecl was removed).

llvm-svn: 49749
2008-04-15 23:02:18 +00:00
Steve Naroff 08899ff85d Remove FileVarDecl and BlockVarDecl. They are replaced by VarDecl::isBlockVarDecl() and VarDecl::isFileVarDecl().
This is a fairly mechanical/large change. As a result, I avoided making any changes/simplifications that weren't directly related. I did break two Analysis tests. I also have a couple FIXME's in UninitializedValues.cpp. Ted, can you take a look? If the bug isn't obvious, I am happy to dig in and fix it (since I broke it).

llvm-svn: 49748
2008-04-15 22:42:06 +00:00
Ted Kremenek 7d6219f501 For HTML diagnostics, output more information about a bug report.
llvm-svn: 49742
2008-04-15 21:25:08 +00:00
Ted Kremenek 43445b3081 Added "summary table" to generated index.html page that allows one to
toggle which bug reports are displayed in the report table.

llvm-svn: 49738
2008-04-15 20:47:02 +00:00
Ted Kremenek 15d8f4cc27 Added test case illustrating the use of '&'.
llvm-svn: 49735
2008-04-15 18:37:29 +00:00
Ted Kremenek 82ff6d65bc Fix bug in terminator processing for uninitialized-values: simply ignore the terminator, don't reprocess it.
LiveVariables analysis now does a flow-insensitive analysis to determine what variables have their address taken; these variables are now always treated as being live.

The DataflowSolver now uses "SetTopValue()" when getting the initial value for the entry/exit block.

llvm-svn: 49734
2008-04-15 18:35:30 +00:00
Argyrios Kyrtzidis 45887902b6 Fix a compiler error on MSVC (variable name 'E' clash).
llvm-svn: 49727
2008-04-15 16:30:10 +00:00
Chris Lattner 3e142b2585 finish commenting RewriteRope
llvm-svn: 49712
2008-04-15 06:37:11 +00:00
Ted Kremenek 6d41b82ea4 Improve dead store diagnostic.
llvm-svn: 49711
2008-04-15 05:31:00 +00:00
Ted Kremenek 2ecc9d42f7 Bug fix in VisitChildren: Only visit the last statement in a StmtExpr and the RHS of a comma expression, as the other Stmts will be visited elsewhere in a CFGBlock.
llvm-svn: 49710
2008-04-15 05:11:28 +00:00
Ted Kremenek 8adeebb274 Added initial support into the flow-sensitive dataflow solver to visit the Block-level expression
in a block's terminator.  This expression is visited within a block, but it is accessed by the
terminator.  This is important to observe because for live-variables analysis the block-level
expression is live between the terminator and where the expression occurs in the block.  So far
this hasn't been an issue to not observe this because the block-level expression used in the
terminator is always the last one in the block, and we have never queried the liveness information
about this point (but before the terminator).

llvm-svn: 49709
2008-04-15 04:39:08 +00:00
Ted Kremenek 66279073f7 Bug fix in dead stores: don't always check the liveness of the first decl
in a DeclStmt.

llvm-svn: 49708
2008-04-15 04:11:48 +00:00
Ted Kremenek cd76f95dd0 ++/-- makes a variable live since it is used; thus the liveness state is
"Alive" as opposed to staying the same.

llvm-svn: 49707
2008-04-15 04:08:54 +00:00
Ted Kremenek 044eb055af Handle "__private_extern__" storage class when printing FunctionDecls.
llvm-svn: 49706
2008-04-15 03:57:09 +00:00
Ted Kremenek f4212bdbc3 Bug fix in LiveVariables: Operators ++/-- may kill a value, but the variable
is still live.

llvm-svn: 49705
2008-04-15 03:47:30 +00:00
Chris Lattner 52bc4ac84f Fix a corner case that ted hit in -emit-html, rdar://5863212
llvm-svn: 49703
2008-04-15 02:26:21 +00:00
Fariborz Jahanian 0152a1a5db New AST representation for each objc2's property declaration.
llvm-svn: 49699
2008-04-14 23:36:35 +00:00
Steve Naroff c5e5b38a8f Remove bogus token...
llvm-svn: 49695
2008-04-14 22:53:48 +00:00
Chris Lattner 492530d2df simplify the implementation of the insert/split operation to return
the new RHS directly instead of indirecting through the 'InsertResult'
struct.  This eliminates InsertResult.

llvm-svn: 49694
2008-04-14 22:10:58 +00:00
Steve Naroff a8f0d12e81 Rename a file and update the Xcode project.
llvm-svn: 49693
2008-04-14 22:05:54 +00:00
Steve Naroff 1dc53ef494 Rename RewriteTest->RewriteObjC.
llvm-svn: 49692
2008-04-14 22:03:09 +00:00
Chris Lattner e58408d8db Add a bunch of comments, move RewriteRope::MakeRopeString out of line.
llvm-svn: 49689
2008-04-14 21:41:00 +00:00
Steve Naroff 4fff2a08aa Fix comment.
llvm-svn: 49688
2008-04-14 21:39:16 +00:00
Ted Kremenek d61ed3b6cb Use isFromMainFile instead of comparing FileIDs directly.
llvm-svn: 49687
2008-04-14 21:24:13 +00:00
Ted Kremenek f6aad13242 Fix regression in Diagnostic that caused it to not register the number
of errors.

llvm-svn: 49686
2008-04-14 21:21:38 +00:00
Ted Kremenek 9569e57a50 Use SourceManager::isFromMainFile()
llvm-svn: 49685
2008-04-14 21:14:41 +00:00
Ted Kremenek 13ad6e1234 Convert over to new SourceManager::isFromMainFile() instead of doing direct
FileID comparison (fixes insidious corner case with chunks).

llvm-svn: 49684
2008-04-14 21:14:03 +00:00
Ted Kremenek bb2b224159 HTMLDiagnostics now uses the new "getCanonicalID()", "isFromMainFileID()" methods from
SourceManager when doing HTML pretty-printing.  This resolves an insidious bug when
presenting error reports that only occurred in large source files.

llvm-svn: 49683
2008-04-14 21:06:04 +00:00
Ted Kremenek 17acadebb4 Added "getCanonicalID()", "isFromSameFile", and "isFromMainFile" to compare
the files of different SourceLocations.  These methods correctly handle the
case where a file may have multiple FileIDs due to it being large enough
to be spread across several chunks.

llvm-svn: 49682
2008-04-14 21:04:18 +00:00
Chris Lattner dc217191d1 fix more uninit ivars, who wrote this junk? :)
llvm-svn: 49679
2008-04-14 20:07:03 +00:00
Chris Lattner ca94e4263b Fix an assertion ted was hitting, due to an uninitialized variable.
llvm-svn: 49678
2008-04-14 20:05:32 +00:00
Ted Kremenek 193f185902 Only increment the number of diagnostics when the DiagnosticClient used
is the one attached to the Diagnostic object.

llvm-svn: 49677
2008-04-14 19:56:12 +00:00