summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex
Commit message (Collapse)AuthorAgeFilesLines
* Change the driver's logic about Objective-C runtimes: abstract out aJohn McCall2011-07-061-1/+1
| | | | | | | | | | | | structure to hold inferred information, then propagate each invididual bit down to -cc1. Separate the bits of "supports weak" and "has a native ARC runtime"; make the latter a CodeGenOption. The tool chain is still driving this decision, because it's the place that has the required deployment target information on Darwin, but at least it's better-factored now. llvm-svn: 134453
* Replace an unreachable error path with an assertPeter Collingbourne2011-06-301-4/+1
| | | | | | | (SourceManager::createFileID cannot return an invalid file ID). Also update a comment to reflect this. llvm-svn: 134168
* Introduce a caching mechanism for macro expanded tokens.Argyrios Kyrtzidis2011-06-294-10/+53
| | | | | | | | | | | | | | | Previously macro expanded tokens were added to Preprocessor's bump allocator and never released, even after the TokenLexer that were lexing them was finished, thus they were wasting memory. A very "useful" boost library was causing clang to eat 1 GB just for the expanded macro tokens. Introduce a special cache that works like a stack; a TokenLexer can add the macro expanded tokens in the cache, and when it finishes, the tokens are removed from the end of the cache. Now consumed memory by expanded tokens for that library is ~ 1.5 MB. Part of rdar://9327049. llvm-svn: 134105
* Introduce Preprocessor::getTotalMemory() and use it in CIndex.cpp, no ↵Argyrios Kyrtzidis2011-06-291-0/+4
| | | | | | functionality change. llvm-svn: 134103
* Allow Lexer::getLocForEndOfToken to return the location just passed the ↵Argyrios Kyrtzidis2011-06-241-2/+10
| | | | | | | | | | macro instantiation if the location given points at the last token of the macro instantiation. Fixes rdar://9045701. llvm-svn: 133804
* Copy diagnostic pragmas to the preprocessed output, from Richard Osborne!Douglas Gregor2011-06-221-4/+13
| | | | llvm-svn: 133633
* Make more use of llvm::StringRef in various APIs. In particular, don'tJay Foad2011-06-212-11/+6
| | | | | | use the deprecated forms of llvm::StringMap::GetOrCreateValue(). llvm-svn: 133515
* Automatic Reference Counting.John McCall2011-06-151-0/+5
| | | | | | | | | | Language-design credit goes to a lot of people, but I particularly want to single out Blaine Garst and Patrick Beard for their contributions. Compiler implementation credit goes to Argyrios, Doug, Fariborz, and myself, in no particular order. llvm-svn: 133103
* revert r133003 and fix the bug properly: the issue was that ## in a tokenChris Lattner2011-06-141-5/+5
| | | | | | | | | | lexer is not a paste operator, it is a normal token. This fixes a conformance issue shown here: http://p99.gforge.inria.fr/c99-conformance/c99-conformance-clang-2.9.html and it defines away the crash from before. llvm-svn: 133005
* Fix a crash on the testcase in PR9981 / rdar://9486765.Chris Lattner2011-06-141-3/+4
| | | | llvm-svn: 133003
* Copy IsWarnIfUnused too when making a copy of a MacroInfo.Benjamin Kramer2011-06-031-0/+1
| | | | | | Found by valgrind. llvm-svn: 132540
* Disable MSVC warning about runtime stack overflow for DebugOverflowStack.Francois Pichet2011-05-251-0/+8
| | | | llvm-svn: 132059
* A StringRef-ication of the DiagnosticIDs API and internals.Argyrios Kyrtzidis2011-05-251-3/+2
| | | | | | | | | Patch by Matthieu Monrocq with tweaks by me to avoid StringRefs in the static diagnostic data structures, which resulted in a huge global-var-init function. Depends on llvm commit r132046. llvm-svn: 132047
* Make it possible for external tools to distinguish between paths that come ↵Nico Weber2011-05-241-1/+2
| | | | | | from -I and paths that come from -system. Patch from Paul Holden! llvm-svn: 131955
* Invoke the FileChanged callback before pushing the linemarker for a systemChris Lattner2011-05-221-5/+5
| | | | | | | | | | | | | | | | | | | | | | header. Getting it in the wrong order generated incorrect line markers in -E mode. In the testcase from PR9861 we used to generate: # 1 "test.c" 2 # 1 "./foobar.h" 1 # 0 "./foobar.h" # 0 "./foobar.h" 3 # 2 "test.c" 2 now we properly produce: # 1 "test.c" 2 # 1 "./foobar.h" 1 # 1 "./foobar.h" 3 # 2 "test.c" 2 This fixes PR9861. llvm-svn: 131871
* Audit and finish the implementation of C++0x nullptr, fixing twoDouglas Gregor2011-05-211-1/+1
| | | | | | | | | | | | | | minor issues along the way: - Non-type template parameters of type 'std::nullptr_t' were not permitted. - We didn't properly introduce built-in operators for nullptr ==, !=, <, <=, >=, or > as candidate functions . To my knowledge, there's only one (minor but annoying) part of nullptr that hasn't been implemented: catching a thrown 'nullptr' as a pointer or pointer-to-member, per C++0x [except.handle]p4. llvm-svn: 131813
* Only ignore extra tokens after #else if we skip it, otherwise warn. Fixes ↵Argyrios Kyrtzidis2011-05-211-1/+3
| | | | | | rdar://9475098. llvm-svn: 131788
* Revert r131672 until __underlying_type is properly implemented in theAlexis Hunt2011-05-191-1/+0
| | | | | | template case. llvm-svn: 131692
* Implement a __has_feature for __underlying_typeAlexis Hunt2011-05-191-0/+1
| | | | llvm-svn: 131672
* Fix a nasty bug where inside StringLiteralParser:Argyrios Kyrtzidis2011-05-171-1/+18
| | | | | | | | | | | | | | | | 1. We would assume that the length of the string literal token was at least 2 2. We would allocate a buffer with size length-2 And when the stars aligned (one of which would be an invalid source location due to stale PCH) The length would be 0 and we would try to allocate a 4GB buffer. Add checks for this corner case and a bunch of asserts. (We really really should have had an assert for 1.). Note that there's no test case since I couldn't get one (it was major PITA to reproduce), maybe later. llvm-svn: 131492
* Introduce __has_extension macroPeter Collingbourne2011-05-131-6/+41
| | | | | | | | | | | | | | | __has_extension is a function-like macro which takes the same set of feature identifiers as __has_feature. It evaluates to 1 if the feature is supported by Clang in the current language (either as a language extension or a standard language feature) or 0 if not. At the same time, add support for the C1X feature identifiers c_generic_selections (renamed from generic_selections) and c_static_assert, and document them. Patch by myself and Jean-Daniel Dupas. llvm-svn: 131308
* Implement the __is_trivially_copyable type traitAlexis Hunt2011-05-131-0/+1
| | | | llvm-svn: 131270
* enable __has_feature(is_standard_layout)Howard Hinnant2011-05-121-0/+1
| | | | llvm-svn: 131240
* Implement CWG1170, which makes access-control errors into templateDouglas Gregor2011-05-111-0/+1
| | | | | | | argument deduction failures. Only implemented in C++0x, since this is a significant change in behavior from C++98/03. llvm-svn: 131209
* Don't strlen() every file before parsing it.Eli Friedman2011-05-101-1/+2
| | | | llvm-svn: 131132
* Introduce a new libclang parsing flag,Douglas Gregor2011-05-062-4/+9
| | | | | | | | | | | | | CXTranslationUnit_NestedMacroInstantiations, which indicates whether we want to see "nested" macro instantiations (e.g., those that occur inside other macro instantiations) within the detailed preprocessing record. Many clients (e.g., those that only care about visible tokens) don't care about this information, and in code that uses preprocessor metaprogramming, this information can have a very high cost. Addresses <rdar://problem/9389320>. llvm-svn: 130990
* Implement support for C++0x alias templates.Richard Smith2011-05-051-0/+1
| | | | llvm-svn: 130953
* Introduce a new libclang API, clang_isFileMultipleIncludeGuarded(),Douglas Gregor2011-05-041-0/+15
| | | | | | | | which determines whether a particular file is actually a header that is intended to be guarded from multiple inclusions within the same translation unit. llvm-svn: 130808
* Fully implement delegating constructors!Alexis Hunt2011-05-011-0/+1
| | | | | | | | | | As far as I know, this implementation is complete but might be missing a few optimizations. Exceptions and virtual bases are handled correctly. Because I'm an optimist, the web page has appropriately been updated. If I'm wrong, feel free to downgrade its support categories. llvm-svn: 130642
* Use DirectoryLookup::getName() rather than getDir()->getName() in a context ↵Douglas Gregor2011-04-291-1/+1
| | | | | | where we don't know whether we have a normal directory llvm-svn: 130467
* Only call the MacroExpands callback when we're actually going toDouglas Gregor2011-04-281-2/+3
| | | | | | expand the macro, based on a patch by Ori Avtalion. Fixes PR9799. llvm-svn: 130402
* Silence more -Wnon-pod-memset given its current implementation. I may beChandler Carruth2011-04-281-1/+1
| | | | | | | able to revert these based on a patch I'm working on, but no reason for people to be spammed with warnings in the interim. llvm-svn: 130394
* Parsing/AST support for Structured Exception HandlingJohn Wiegley2011-04-282-9/+48
| | | | | | | | Patch authored by Sohail Somani. Provide parsing and AST support for Windows structured exception handling. llvm-svn: 130366
* If a null statement was preceded by an empty macro keep its instantiation ↵Argyrios Kyrtzidis2011-04-271-3/+4
| | | | | | | | source location in NullStmt. llvm-svn: 130289
* To be able to replay compilations we need to accurately remodel howManuel Klimek2011-04-266-34/+100
| | | | | | | | | includes get resolved, especially when they are found relatively to another include file. We also try to get it working for framework includes, but that part of the code is untested, as I don't have a code base that uses it. llvm-svn: 130246
* Implement basic __is_trivial type-trait support, enough to close PR9472.Chandler Carruth2011-04-231-0/+1
| | | | | | | | | | | | | | | | | | This introduces a few APIs on the AST to bundle up the standard-based logic so that programmatic clients have access to exactly the same behavior. There is only one serious FIXME here: checking for non-trivial move constructors and move assignment operators. Those bits need to be added to the declaration and accessors provided. This implementation should be enough for the uses of __is_trivial in libstdc++ 4.6's C++98 library implementation. Ideas for more thorough test cases or any edge cases missing would be appreciated. =D llvm-svn: 130057
* Sort the type traits in a few places where they weren't previouslyChandler Carruth2011-04-231-1/+1
| | | | | | sorted in order to prepare for adding some new ones. llvm-svn: 130056
* don't warn about empty macro arguments in c++'0x mode, since it sucked inChris Lattner2011-04-221-2/+2
| | | | | | the c99 preprocessor. Patch by Jonathan Sauer! llvm-svn: 130031
* Add __has_feature(cxx_range_for) check for C++11 range-based for loop.Richard Smith2011-04-151-0/+1
| | | | llvm-svn: 129573
* fix a bunch of comment typos found by codespell. Patch byChris Lattner2011-04-154-4/+4
| | | | | | Luis Felipe Strano Moraes! llvm-svn: 129559
* C1X: implement generic selectionsPeter Collingbourne2011-04-151-0/+1
| | | | | | | As an extension, generic selection support has been added for all supported languages. The syntax is the same as for C1X. llvm-svn: 129554
* Implement C++0x [lex.pptoken]p3's handling of <::.Richard Smith2011-04-141-0/+15
| | | | llvm-svn: 129525
* Eat the UTF-8 BOM at the beginning of a file since it's ignored anyhow.Eric Christopher2011-04-091-1/+14
| | | | | | | | Nom Nom Nom. Patch by Anton Korobeynikov! llvm-svn: 129174
* Fix getLocForEndOfToken to not double-count spurious internal characters John McCall2011-04-061-1/+1
| | | | | | | within a token, like trigraphs and escaped newlines. Patch by Marcin Kowalczyk! llvm-svn: 128978
* Add a __has_feature check for the 'availability' attributeDouglas Gregor2011-03-261-0/+1
| | | | llvm-svn: 128337
* we can now claim to fully support the override control feature in C++0x.Anders Carlsson2011-03-251-0/+1
| | | | llvm-svn: 128281
* Lexer: Add extremely limited support for -traditional-cpp, ignoring BCPLDaniel Dunbar2011-03-181-3/+5
| | | | | | comments. llvm-svn: 127910
* Having FileManager::getFile always open the file, brought much consternation ↵Argyrios Kyrtzidis2011-03-161-7/+8
| | | | | | | | | | | and leaking of file descriptors. Add 'openFile' bool to FileManager::getFile to specify whether we want to have the file opened or not, have it false by default, and enable it only in HeaderSearch.cpp where the open+fstat optimization matters. Fixes rdar://9139899. llvm-svn: 127748
* Add a 'RawPath' parameter to the PPCallbacks interface. This allowsChandler Carruth2011-03-166-36/+68
| | | | | | | | | | | | | | | clients to observe the exact path through which an #included file was located. This is very useful when trying to record and replay inclusion operations without it beind influenced by the aggressive caching done inside the FileManager to avoid redundant system calls and filesystem operations. The work to compute and return this is only done in the presence of callbacks, so it should have no effect on normal compilation. Patch by Manuel Klimek. llvm-svn: 127742
* Create __has_feature(cxx_noexcept) and mark it as working.Sebastian Redl2011-03-151-0/+1
| | | | | | | Find out that our C++0x status has only one field for noexcept expression and specification together, and that it was accidentally already marked as fully implemented. This completes noexcept specification work. llvm-svn: 127701
OpenPOWER on IntegriCloud