summaryrefslogtreecommitdiffstats
path: root/clang/lib/Rewrite/HTMLRewrite.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Simplify EnterTokenStream API to make it more robust for memory managementDavid Blaikie2016-02-091-1/+1
| | | | | | | | | | | | | | | While this won't help fix things like the bug that r260219 addressed, it seems like good tidy up to have anyway. (it might be nice if "makeArrayRef" always produced a MutableArrayRef & let it decay to an ArrayRef when needed - then I'd use that for the MutableArrayRefs in this patch) If we had std::dynarray I'd use that instead of unique_ptr+size_t, ideally (but then it'd have to be threaded down through the Preprocessor all the way - no idea how painful that would be) llvm-svn: 260246
* Make clang's rewrite engine a core featureAlp Toker2014-07-161-0/+582
| | | | | | | | | | | | | | | The rewrite facility's footprint is small so it's not worth going to these lengths to support disabling at configure time, particularly since key compiler features now depend on it. Meanwhile the Objective-C rewriters have been moved under the ENABLE_CLANG_ARCMT umbrella for now as they're comparatively heavy and still potentially worth excluding from lightweight builds. Tests are now passing with any combination of feature flags. The flags historically haven't been tested by LLVM's build servers so caveat emptor. llvm-svn: 213171
* Split library clangRewrite into clangRewriteCore and clangRewriteFrontend.Ted Kremenek2012-09-011-583/+0
| | | | | | | This is similar to how we divide up the StaticAnalyzer libraries to separate core functionality to what is clearly associated with Frontend actions. llvm-svn: 163050
* [analyzer] Add Prev/Next links to the HTML output.Jordan Rose2012-08-021-1/+2
| | | | llvm-svn: 161153
* Disable _Pragma during HTML macro rewriting to keep from crashing.Jordan Rose2012-06-081-1/+7
| | | | | | | | | | | | | | | | | | | The preprocessor's handling of diagnostic push/pops is stateful, so encountering pragmas during a re-parse causes problems. HTMLRewrite already filters out normal # directives including #pragma, so it's clear it's not expected to be interpreting pragmas in this mode. This fix adds a flag to Preprocessor to explicitly disable pragmas. The "right" fix might be to separate pragma lexing from pragma parsing so that we can throw away pragmas like we do preprocessor directives, but right now it's important to get the fix in. Note that this has nothing to do with the "hack" of re-using the input preprocessor in HTMLRewrite. Even if we someday copy the preprocessor instead of re-using it, the copy would (and should) include the diagnostic level tables and have the same problems. llvm-svn: 158214
* Unify naming of LangOptions variable/get function across the Clang stack ↵David Blaikie2012-03-111-2/+2
| | | | | | | | | | (Lex to AST). The member variable is always "LangOpts" and the member function is always "getLangOpts". Reviewed by Chris Lattner llvm-svn: 152536
* User-defined literals: reject string and character UDLs in all places where theRichard Smith2012-03-061-0/+1
| | | | | | | | | | grammar requires a string-literal and not a user-defined-string-literal. The two constructs are still represented by the same TokenKind, in order to prevent a combinatorial explosion of different kinds of token. A flag on Token tracks whether a ud-suffix is present, in order to prevent clients from needing to look at the token's spelling. llvm-svn: 152098
* Revert my patches which removed Diagnostic.h includes by moving some ↵Benjamin Kramer2012-02-071-1/+0
| | | | | | | | | | | | | | | | | | operator overloads out of line. This seems to negatively affect compile time onsome ObjC tests (which use a lot of partial diagnostics I assume). I have to come up with a way to keep them inline without including Diagnostic.h everywhere. Now adding a new diagnostic requires a full rebuild of e.g. the static analyzer which doesn't even use those diagnostics. This reverts commit 6496bd10dc3a6d5e3266348f08b6e35f8184bc99. This reverts commit 7af19b817ba964ac560b50c1ed6183235f699789. This reverts commit fdd15602a42bbe26185978ef1e17019f6d969aa7. This reverts commit 00bd44d5677783527d7517c1ffe45e4d75a0f56f. This reverts commit ef9b60ffed980864a8db26ad30344be429e58ff5. llvm-svn: 150006
* Basic: import SmallString<> into clang namespaceDylan Noblesmith2012-02-051-1/+1
| | | | | | | (I was going to fix the TODO about DenseMap too, but that would break self-host right now. See PR11922.) llvm-svn: 149799
* Remove Diagnostic.h include from Preprocessor.h.Benjamin Kramer2012-02-041-0/+1
| | | | | | | - Move the offending methods out of line and fix transitive includers. - This required changing an enum in the PPCallback API into an unsigned. llvm-svn: 149782
* Per PR 11814, use Monospace instead of Andale Mono.Ted Kremenek2012-01-201-1/+1
| | | | llvm-svn: 148567
* Remove unreachable code in Clang. (replace with llvm_unreachable where ↵David Blaikie2012-01-171-1/+0
| | | | | | appropriate or when GCC requires it) llvm-svn: 148292
* Introduce a pure virtual clone() method to DiagnosticConsumer, so thatDouglas Gregor2011-09-291-11/+0
| | | | | | | | | we have the ability to create a new, distict diagnostic consumer when we go off and build a module. This avoids the currently horribleness where the same diagnostic consumer sees diagnostics for multiple translation units (and multiple SourceManagers!) causing all sorts of havok. llvm-svn: 140743
* Rename DiagnosticInfo to Diagnostic as per issue 5397David Blaikie2011-09-261-1/+1
| | | | llvm-svn: 140493
* Rename IgnoringDiagClient to IgnoringDiagConsumer as per issue 5397David Blaikie2011-09-251-3/+3
| | | | llvm-svn: 140480
* Rename DiagnosticClient to DiagnosticConsumer as per issue 5397David Blaikie2011-09-251-1/+1
| | | | llvm-svn: 140479
* Rename Diagnostic to DiagnosticsEngine as per issue 5397David Blaikie2011-09-251-3/+3
| | | | llvm-svn: 140478
* Rename SourceLocation::getFileLocWithOffset -> getLocWithOffset.Argyrios Kyrtzidis2011-09-191-1/+1
| | | | | | It already works (and is useful with) macro locs as well. llvm-svn: 140057
* Add support for C++0x unicode string and character literals, from Craig Topper!Douglas Gregor2011-07-271-1/+8
| | | | llvm-svn: 136210
* Rename SourceManager::getInstantiationRange to getExpansionRange.Chandler Carruth2011-07-251-1/+1
| | | | llvm-svn: 135915
* Mechanically rename SourceManager::getInstantiationLoc andChandler Carruth2011-07-251-3/+3
| | | | | | | | FullSourceLoc::getInstantiationLoc to ...::getExpansionLoc. This is part of the API and documentation update from 'instantiation' as the term for macros to 'expansion'. llvm-svn: 135914
* remove unneeded llvm:: namespace qualifiers on some core types now that ↵Chris Lattner2011-07-231-2/+2
| | | | | | | | LLVM.h imports them into the clang namespace. llvm-svn: 135852
* Switch a comment in Rewrite from 'instantiation' to 'expansion'.Chandler Carruth2011-07-151-1/+1
| | | | llvm-svn: 135226
* Introduced raw_identifier token kind.Abramo Bagnara2010-12-221-11/+11
| | | | llvm-svn: 122394
* Refactoring of Diagnostic class.Argyrios Kyrtzidis2010-11-181-1/+2
| | | | | | | | | | | -Move the stuff of Diagnostic related to creating/querying diagnostic IDs into a new DiagnosticIDs class. -DiagnosticIDs can be shared among multiple Diagnostics for multiple translation units. -The rest of the state in Diagnostic object is considered related and tied to one translation unit. -Have Diagnostic point to the SourceManager that is related with. Diagnostic can now accept just a SourceLocation instead of a FullSourceLoc. -Reflect the changes to various interfaces. llvm-svn: 119730
* Fix crasher with IgnoringDiagClientDouglas Gregor2010-08-181-2/+1
| | | | llvm-svn: 111447
* make the token paste avoidance logic turn "..." into ".. ." instead of ". . ."Chris Lattner2010-04-141-1/+3
| | | | | | when avoiding paste. Patch by David Peixotto! llvm-svn: 101218
* Let SourceManager::getBufferData return StringRef instead of a pair of two ↵Benjamin Kramer2010-03-161-1/+1
| | | | | | const char*. llvm-svn: 98630
* Give SourceManager a Diagnostic object with which to report errors,Douglas Gregor2010-03-161-9/+3
| | | | | | and start simplifying the interfaces in SourceManager that can fail. llvm-svn: 98594
* Add some <cstdio> includes to unbreak the buildbotsDouglas Gregor2010-03-151-0/+1
| | | | llvm-svn: 98591
* Introduce a new BufferResult class to act as the return type ofDouglas Gregor2010-03-151-1/+11
| | | | | | | | | | | | | | 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
* Fix PR5633 by making the preprocessor handle the case where we canChris Lattner2009-11-301-2/+4
| | | | | | | | | | 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
* 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
* Remove tabs, and whitespace cleanups.Mike Stump2009-09-091-71/+71
| | | | llvm-svn: 81346
* 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-191-21/+18
| | | | | | | - 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
* Change Lexer::MeasureTokenLength to take a LangOptions reference.Chris Lattner2009-04-141-1/+1
| | | | | | | | | | | | | | | | | | 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
* 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
OpenPOWER on IntegriCloud