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

63 Коммитов

Автор SHA1 Сообщение Дата
Chris Lattner 2b2453a7d8 this massive patch introduces a simple new abstraction: it makes
"FileID" a concept that is now enforced by the compiler's type checker
instead of yet-another-random-unsigned floating around.

This is an important distinction from the "FileID" currently tracked by
SourceLocation.  *That* FileID may refer to the start of a file or to a
chunk within it.  The new FileID *only* refers to the file (and its 
#include stack and eventually #line data), it cannot refer to a chunk.

FileID is a completely opaque datatype to all clients, only SourceManager
is allowed to poke and prod it.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62407 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-17 06:22:33 +00:00
Chris Lattner 99bd46c018 make the -rewrite-test a bit more interesting: it now
wraps comments in <i> tags.  Extend rewrite tokens to support
this minimal functionality.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57409 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-12 06:09:52 +00:00
Chris Lattner cff9cc95de start implementing a token rewriter. At this point, it just reads in a file
and lets a client iterate over it. 



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57407 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-12 05:44:03 +00:00
Chris Lattner 7a02344d9b add a disclaimer
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57038 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-03 23:31:37 +00:00
Chris Lattner b5cd09a2bf add a new Rewriter::getRewritenText method that returns the text for a range
that includes any edits in the range.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57037 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-03 23:31:16 +00:00
Nico Weber 7b802b7d94 add missing class declaration
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54841 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-16 12:36:27 +00:00
Ted Kremenek f6f593fae2 In a report-XXXXX.html, make the title include the name of the file with the bug. Patch by Jean-Daniel Dupas!
http://lists.cs.uiuc.edu/pipermail/cfe-dev/2008-July/002166.html



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53184 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-07 18:31:05 +00:00
Seo Sanghyeon fe5042e287 Fix warnings
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53141 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-05 02:01:25 +00:00
Anton Korobeynikov 525204a7ca Update to follow recent LLVM changes
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51689 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-29 17:42:01 +00:00
Chris Lattner 3d2e8c7b70 Fix rewrite rope to keep the leaf list up-to-date as it erases leaves
from the rope.  rdar://5952468


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51651 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-28 18:45:56 +00:00
Steve Naroff 2c33a16437 This fixes a VC++ build failure.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51528 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-24 00:16:40 +00:00
Chris Lattner 0d3ab3f121 add some assertions to catch bad things before they die
somewhere deep in rewrite rope.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51515 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-23 23:10:58 +00:00
Chris Lattner c66d0aa934 fix a rewriter crash on zero length files.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50126 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-23 03:21:50 +00:00
Ted Kremenek 7414dc0573 html::EscapeText (using the Rewriter) now replaces tabs by default.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49982 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-20 01:02:33 +00:00
Ted Kremenek fb58609c5b Provide a version of html::HighlightMacros that takes a Preprocessor&.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49896 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-18 05:34:33 +00:00
Ted Kremenek 339b9c2775 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49875 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-17 22:31:54 +00:00
Chris Lattner 9402b57a0d Make HighlightRange correctly handle multi-line ranges. This causes us to
correctly handle multi-line comments.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49827 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-16 23:06:45 +00:00
Chris Lattner 5ef3e2c45f add a new HighlightRange API, it doesn't handle multiline ranges
yet, but it will soon...


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49825 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-16 22:45:51 +00:00
Chris Lattner c54d50a418 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49779 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-16 06:32:08 +00:00
Chris Lattner 3245a0a1c7 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 :).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49778 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-16 06:11:58 +00:00
Chris Lattner 735271479a 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49774 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-16 04:33:23 +00:00
Chris Lattner 6837e38d43 make a method public.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49770 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-16 04:28:52 +00:00
Chris Lattner b9bc3eca21 speed up -emit-html in a release build by 6.5% by avoiding std::string.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49764 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-16 03:46:57 +00:00
Chris Lattner 5618d88b93 Add a bunch of comments, move RewriteRope::MakeRopeString out of line.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49689 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-14 21:41:00 +00:00
Chris Lattner 5fd3e2673a move a ton of code out of line, from RewriteRope.h -> RewriteRope.cpp
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49664 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-14 17:54:23 +00:00
Chris Lattner e5cd857f7e remove ifdefs
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49651 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-14 17:12:49 +00:00
Chris Lattner febe719596 Change the RewriteRope::Chunks data structure from an std::list into
a nice shiny B+ Tree variant.  This fixes the last of the known algorithmic
issues with the rewriter, allowing a significant speedup.  For example,
-emit-html on Ted's 500K .i file speeds up from 26.8s -> 0.64s in a 
debug build (41x!) and 5.475s -> 0.132s (41x!) in an optimized build.

This code is functional but needs to be cleaned up, ifdefs removed, better
commented, and moved to a .cpp file.  I plan to do this tomorrow.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49635 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-14 07:17:29 +00:00
Chris Lattner 9e979557ee Default argument cleanups and minor improvements, patch by
Doug Gregor!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49598 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-12 23:52:44 +00:00
Chris Lattner 8100d74951 move the DeltaTree implementation out of line, remove debugging printfs etc.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49591 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-12 22:00:40 +00:00
Chris Lattner 77257889f5 remove ifdefs
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49587 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-12 20:34:05 +00:00
Chris Lattner 5c9dc5ac75 Do an initial hack at replacing one of the incredibly inefficient
(but simple!) datastructures in the rewriter with a more complex but
more efficient one.

This replaces the Deltas vector with a specialized BTree that makes
delta lookups much more efficient.  This speeds up -emit-html on a 500K
.i file from 157.154 to 27.127 seconds on my machine (5.8x).

While this code is functional, it isn't very pretty, I have much 
refactoring planned for it, and will remove the USE_VECTOR ifdef.
Stay tuned.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49586 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-12 20:28:24 +00:00
Ted Kremenek fa5be36172 Don't expand tabs in EscapeText, but rather expand them when writing out
the HTML file.  This should reduce the amount of memory pressure on the
rewriter for files that have a lot of tabs.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49406 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-08 22:37:58 +00:00
Chris Lattner 19bf719a2b don't dereference hte end iterator when inserting at end of buffer.
Patch by Cédric Venet!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49259 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-06 04:36:15 +00:00
Ted Kremenek 053ef593fa Add html::EscapeText for std::string; use this function to escape text in message bubbles.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48884 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-27 17:15:29 +00:00
Ted Kremenek 1ab09f52be Minor speed tweak per Chris's suggestion: use &S[0] instead of S.c_str().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48544 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-19 16:32:34 +00:00
Ted Kremenek 4cefe486dc Integrated some of Chris's comments; check for an empty string in InsertStrXXX()
before descending into the bowels of the Rewriter.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48541 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-19 08:00:50 +00:00
Ted Kremenek ad0a203130 Moved generation of html header/footer with builtin CSS to the rewriter library.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48537 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-19 06:14:37 +00:00
Ted Kremenek 329f0f5df1 Added InsertStrXXX/InsertCStrXXX methods to the Rewriter to provide a simpler
interface to the rewriter when clients have NULL terminated strings or std::string.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48532 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-19 05:06:49 +00:00
Ted Kremenek f830997de6 More cleanups to HTML rewriter API: remove the InsertTag method; was too complicated
and clients can achieve a cleaner design just by inserting tags directly.  Reserve
the "html" namespace for meta-level operations (e.g., escaping text, etc.)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48524 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-19 01:30:02 +00:00
Ted Kremenek 1b3188cfc2 More HTML rewriter cleanups. Preliminary CSS support in code pretty-printing.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48518 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-18 23:55:46 +00:00
Ted Kremenek b485cd1e0a Some cleanups to the HTMLRewrite API. Added support for printing out line
numbers (more work to be done on aesthetics).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48512 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-18 23:08:51 +00:00
Ted Kremenek c22efea6f9 Modified "InsertTag" (HTML rewriter) to have an optional "OutermostTag" flag to
indicate whether or not the new tag should be the outermost tag at the specified
location (in the case that other tags have been inserted at the same spot).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48506 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-18 21:26:34 +00:00
Ted Kremenek 6a34083e9f Added the beginning of a set of rewriter functions for pretty-printing source
code as HTML.  Added a new driver option "--emit-html" to dump the source
of the main input file as HTML.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48505 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-18 21:19:49 +00:00
Ted Kremenek 886c8db545 Added variant of "InsertText" in the Rewriter to support inserting text both
*before* and after a specific location.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48504 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-18 21:17:59 +00:00
Ted Kremenek 4c535ace52 Added method "getSourceMgr" to class Rewriter.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48496 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-18 19:43:13 +00:00
Chris Lattner 87cf5ac1b0 Add some missing #includes for GCC mainline, patch by Shantonu Sen!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48153 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-10 17:04:53 +00:00
Chris Lattner aadaf78d65 add some helper methods for removing and replacing text, this makes the
rewriter more robust.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46622 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-31 19:51:04 +00:00
Chris Lattner dcbc5b0b07 Make rewriter::inserttext return a bool to indicate if it failed.
Add a RewriteTest::ReplaceStmt method to factor the 'checking for
rewrite failed + emitting diagnostic if so' code.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46619 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-31 19:37:57 +00:00
Chris Lattner 0bc735ffcf Don't attribute in file headers anymore. See llvmdev for the
discussion of this change.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45410 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-29 19:59:25 +00:00
Chris Lattner fab21b6d73 add a getAtOffset() member to simplify some code.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43905 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-08 20:51:02 +00:00