summaryrefslogtreecommitdiffstats
path: root/clang/lib/Rewrite
Commit message (Collapse)AuthorAgeFilesLines
...
* Introduce a new BufferResult class to act as the return type ofDouglas Gregor2010-03-152-2/+22
| | | | | | | | | | | | | | SourceManager's getBuffer() (and similar) operations. This abstract can be used to force callers to cope with errors in getBuffer(), such as missing files and changed files. Fix a bunch of callers to use the new interface. Add some very basic checks for file consistency (file size, modification time) into ContentCache::getBuffer(), although these checks don't help much until we've updated the main callers (e.g., SourceManager::getSpelling()). llvm-svn: 98585
* Allow users to set CPPFLAGS and CXXFLAGS on the make command line.Jeffrey Yasskin2010-03-121-1/+1
| | | | | Tested: make CPPFLAGS=-m64 CXXFLAGS=-m64 -j8 && (cd tools/clang;make test) llvm-svn: 98399
* Some clean up of replacement text API no longer needed byFariborz Jahanian2010-02-051-3/+2
| | | | | | my recent changes. llvm-svn: 95391
* Fixes a rewrite bug rewriting nested ivars reference.Fariborz Jahanian2010-01-281-2/+3
| | | | | | (Radar 7583971). llvm-svn: 94724
* -fno-rtti is now the default.Chris Lattner2010-01-241-1/+0
| | | | llvm-svn: 94379
* reduce redundant are'sChris Lattner2010-01-201-1/+1
| | | | llvm-svn: 94009
* Fix typo: rename Rewriter::getRewritenText() -> Rewriter::getRewrittenText().Ted Kremenek2010-01-071-2/+2
| | | | llvm-svn: 92922
* Fix PR5633 by making the preprocessor handle the case where we canChris Lattner2009-11-302-3/+6
| | | | | | | | | | stat a file but where mmaping it fails. In this case, we emit an error like: t.c:1:10: fatal error: error opening file '../../foo.h' instead of "cannot find file". llvm-svn: 90110
* Be more careful with anonymous namespaces, since Clang diagnoses the ↵Douglas Gregor2009-11-171-19/+9
| | | | | | ambiguity here llvm-svn: 89054
* Make html::{SyntaxHighlight,HighlightMacros} take a const Preprocessor.Daniel Dunbar2009-11-051-16/+21
| | | | | | | | | This is conceptually correct, but adds a huge hack to HighlightMacros which is in fact doing all sorts of mutation to the Preprocessor. See FIXME. Chris, please review. llvm-svn: 86107
* Kill PreprocessorFactory, which was both morally repugnant and totally unused.Daniel Dunbar2009-11-041-7/+0
| | | | llvm-svn: 86076
* Call 'clear()' in ~RopePieceBTreeLeaf(), decrementing the referenceTed Kremenek2009-10-201-0/+1
| | | | | | | | counts of the bufffers referened by the RopePieces in RopePieceBTreeLeaf. This (I believe) corrently fixes the leak I meant to fix in r84601 (which ended up causing an overrelease). llvm-svn: 84615
* Revert 84601. Looks like it was causing failures on some systems.Ted Kremenek2009-10-201-2/+3
| | | | llvm-svn: 84610
* Fix a reference count imbalance in RewriteRope::MakeRopeString().Ted Kremenek2009-10-201-3/+2
| | | | | | | This was causing a ton of memory to be leaked when using HTML diagnostics with the static analyzer (on large files with many errors). llvm-svn: 84601
* Installation of Clang libraries and headers, from Axel Naumann!Douglas Gregor2009-10-081-3/+0
| | | | llvm-svn: 83582
* Remove tabs, and whitespace cleanups.Mike Stump2009-09-095-248/+248
| | | | llvm-svn: 81346
* Don't install Clang libraries.Douglas Gregor2009-08-231-0/+3
| | | | llvm-svn: 79824
* Remove now unnecessary helper methods.Daniel Dunbar2009-08-191-2/+2
| | | | llvm-svn: 79460
* Convert parts of Rewriter to StringRef based API.Daniel Dunbar2009-08-192-37/+32
| | | | | | | - Please accept my sincere apologies for the gratuitous elimination of code duplication, manual string length counting, unnecessary strlen calls, etc. llvm-svn: 79448
* Use raw_svector_ostream for string concatenation.Daniel Dunbar2009-08-191-7/+9
| | | | llvm-svn: 79444
* adjust indentation.Zhongxing Xu2009-08-171-15/+15
| | | | llvm-svn: 79236
* Patch by Stefan Bühler: Escape text in macro expansion when emitting HTML ↵Ted Kremenek2009-07-211-1/+1
| | | | | | | | in the HTMLRewriter. This fixes PR 4602. llvm-svn: 76647
* Lexically order files in CMakeLists.txt files.Ted Kremenek2009-07-151-1/+1
| | | | llvm-svn: 75832
* Key decisions about 'bool' vs '_Bool' to be based on a new flag in langoptions.Chris Lattner2009-06-301-1/+1
| | | | | | | | | | | | This is simple enough, but then I thought it would be nice to make PrintingPolicy get a LangOptions so that various things can key off "bool" and "C++" independently. This spiraled out of control. There are many fixme's, but I think things are slightly better than they were before. One thing that can be improved: CFG should probably have an ASTContext pointer in it, which would simplify its clients. llvm-svn: 74493
* Fix for PR2386: distinguish between insertion and replacements in the Eli Friedman2009-05-181-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | delta tree. The issue is roughly a conflict in ReplaceText between two kinds of uses. One, it should be possible to replace a replacement: for example, the ObjC rewriter calls ReplaceStmt for an expression, then replaces the resulting expression with another expression. Two, it should be possible to replace text that already has text inserted before it: for example, the HTML rewriter inserts a bunch of tags at the beginning of the line, then tries to escape the first character on the line. This patch distinguishes the two cases by storing the deltas separately; essentially, replacements and insertions no longer interfere with each other. Another possibility would be to add some sort of flag to ReplaceText, but this seems a bit more intuitive and flexible. There are a few downsides to the current solution: one is that there isn't any way to remove/replace an insertion without touching additional surrounding text; if such an operation turns out to be useful, an additional method or flag can be added. Another is that an insertion and replacing a string of length zero are distinct operations; I'm not sure how to resolve this, or whether it will be confusing in practice. This is relatively sensitive code, so please test and tell me if anything breaks. llvm-svn: 72000
* Change Lexer::MeasureTokenLength to take a LangOptions reference.Chris Lattner2009-04-142-4/+4
| | | | | | | | | | | | | | | | | | This allows it to accurately measure tokens, so that we get: t.cpp:8:13: error: unknown type name 'X' static foo::X P; ~~~~~^ instead of the woefully inferior: t.cpp:8:13: error: unknown type name 'X' static foo::X P; ~~~~ ^ Most of this is just plumbing to push the reference around. llvm-svn: 69099
* Build system changes to use TableGen to generate the variousDouglas Gregor2009-03-161-1/+1
| | | | | | | | | | | | | | | | | | diagnostics. This builds on the patch that Sebastian committed and then revert. Major differences are: - We don't remove or use the current ".def" files. Instead, for now, we just make sure that we're building the ".inc" files. - Fixed CMake makefiles to run TableGen and build the ".inc" files when needed. Tested with both the Xcode and Makefile generators provided by CMake, so it should be solid. - Fixed normal makefiles to handle out-of-source builds that involve the ".inc" files. I'll send a separate patch to the list with Sebastian's changes that eliminate the use of the .def files. llvm-svn: 67058
* fix PR3798 by ignoring all diagnostics generated while repreprocessing a ↵Chris Lattner2009-03-131-0/+22
| | | | | | file in rewrite macros. llvm-svn: 66961
* Adjust HTML diagnostics CSS to not use "smaller" for font size and instead useTed Kremenek2009-03-101-2/+2
| | | | | | specific point sizes. llvm-svn: 66523
* Tighten message bubble height.Ted Kremenek2009-03-031-2/+3
| | | | | | Make bubble number decoration look more like circles than ovals. llvm-svn: 65921
* Adjust CSS to make message bubble numbers less gaudy.Ted Kremenek2009-03-021-4/+3
| | | | llvm-svn: 65903
* Adjust HTML message bubbles to utilize information from ↵Ted Kremenek2009-03-021-3/+8
| | | | | | PathDiagnosticPiece::Kind. llvm-svn: 65891
* Update HTML diagnostics to honor the different between 'event' and ↵Ted Kremenek2009-03-021-2/+3
| | | | | | 'control-flow' diagnostics. llvm-svn: 65877
* Introduce code modification hints into the diagnostics system. When weDouglas Gregor2009-02-261-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | know how to recover from an error, we can attach a hint to the diagnostic that states how to modify the code, which can be one of: - Insert some new code (a text string) at a particular source location - Remove the code within a given range - Replace the code within a given range with some new code (a text string) Right now, we use these hints to annotate diagnostic information. For example, if one uses the '>>' in a template argument in C++98, as in this code: template<int I> class B { }; B<1000 >> 2> *b1; we'll warn that the behavior will change in C++0x. The fix is to insert parenthese, so we use code insertion annotations to illustrate where the parentheses go: test.cpp:10:10: warning: use of right-shift operator ('>>') in template argument will require parentheses in C++0x B<1000 >> 2> *b1; ^ ( ) Use of these annotations is partially implemented for HTML diagnostics, but it's not (yet) producing valid HTML, which may be related to PR2386, so it has been #if 0'd out. In this future, we could consider hooking this mechanism up to the rewriter to actually try to fix these problems during compilation (or, after a compilation whose only errors have fixes). For now, however, I suggest that we use these code modification hints whenever we can, so that we get better diagnostics now and will have better coverage when we find better ways to use this information. This also fixes PR3410 by placing the complaint about missing tokens just after the previous token (rather than at the location of the next token). llvm-svn: 65570
* Fix PR3635 by handling ## magicallyChris Lattner2009-02-241-0/+5
| | | | llvm-svn: 65374
* simplify this code and make it use highlight range. ThisChris Lattner2009-02-171-19/+8
| | | | | | | | | | | | | makes -emit-html do nice things for code like: #define FOO(X) y int FOO(4 ); highlighting the FOO instance as well as the ) on the next line properly. llvm-svn: 64710
* fix a fixme in -emit-html output: highlight the entire range of a macroChris Lattner2009-02-151-17/+21
| | | | | | | instantiation, which highlights the arguments of a function like macro as well as its identifier. llvm-svn: 64607
* Fix rdar://6562329, a static analyzer crash Ted noticed on Chris Lattner2009-02-131-13/+45
| | | | | | | | | | | | | | wine sources. This was happening because HighlightMacros was calling EnterMainFile multiple times on the same preprocessor object and getting an assert due to the new #line stuff (the file in question was bison output with #line directives). The fix for this is to not reenter the file. Instead, relex the tokens in raw mode, swizzle them a bit and repreprocess the token stream. An added bonus of this is that rewrite macros will now hilight the macro definition as well as its uses. Woo. llvm-svn: 64480
* make "floating macro bubble" output of -emit-html much prettier: Chris Lattner2009-02-131-1/+14
| | | | | | | | only insert spaces between tokens if the code had them or if they are actually required to avoid pasting. This reuses the same logic as -E mode. llvm-svn: 64421
* rename getFullFilePos -> getFileOffset.Chris Lattner2009-01-271-4/+4
| | | | llvm-svn: 63097
* This change refactors some of the low-level lexer interfaces a bit.Chris Lattner2009-01-261-2/+3
| | | | | | | | | | | | | Token now has a class of kinds for "literals", which include numeric constants, strings, etc. These tokens can optionally have a pointer to the start of the token in the lexer buffer. This makes it faster to get spelling and do other gymnastics, because we don't have to go through source locations. This change is performance neutral, but will make other changes more feasible down the road. llvm-svn: 63028
* Check in the long promised SourceLocation rewrite. This lays theChris Lattner2009-01-262-3/+2
| | | | | | | | | | ground work for implementing #line, and fixes the "out of macro ID's" problem. There is nothing particularly tricky about the code, other than the very performance sensitive SourceManager::getFileID() method. llvm-svn: 62978
* Rename SourceManager::getCanonicalFileID -> getFileID. There isChris Lattner2009-01-191-2/+2
| | | | | | no longer such thing as a non-canonical FileID. llvm-svn: 62499
* add a simplified lexer ctor that sets up the lexer to raw-lex anChris Lattner2009-01-172-9/+3
| | | | | | entire file. llvm-svn: 62414
* this massive patch introduces a simple new abstraction: it makesChris Lattner2009-01-173-50/+50
| | | | | | | | | | | | | | | "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. llvm-svn: 62407
* more SourceLocation lexicon change: instead of referring to theChris Lattner2009-01-161-5/+5
| | | | | | "logical" location, refer to the "instantiation" location. llvm-svn: 62316
* CMake: Builds and installs clang binary and libs (no docs yet). ItOscar Fuentes2008-10-261-0/+9
| | | | | | must be under the `tools' subdirectory of the LLVM *source* tree. llvm-svn: 58180
* make the -rewrite-test a bit more interesting: it now Chris Lattner2008-10-121-3/+50
| | | | | | | wraps comments in <i> tags. Extend rewrite tokens to support this minimal functionality. llvm-svn: 57409
* start implementing a token rewriter. At this point, it just reads in a fileChris Lattner2008-10-121-0/+53
| | | | | | and lets a client iterate over it. llvm-svn: 57407
* Change how raw lexers are handled: instead of creating them and thenChris Lattner2008-10-121-4/+4
| | | | | | | | | | | using LexRawToken, create one and use LexFromRawLexer. This avoids twiddling the RawLexer flag around and simplifies some code (even speeding raw lexing up a tiny bit). This change also improves the token paster to use a Lexer on the stack instead of new/deleting it. llvm-svn: 57393
OpenPOWER on IntegriCloud