summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex
Commit message (Collapse)AuthorAgeFilesLines
* 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
* Fix my earlier commit to work with escaped newlines and leave breadcrumbsJohn McCall2011-03-082-11/+48
| | | | | | | in case we want to make a world where we can check intermediate instantiations for this kind of breadcrumb. llvm-svn: 127221
* Add an API call to retrieve the spelling data of a token from its ↵John McCall2011-03-081-0/+10
| | | | | | SourceLocation. llvm-svn: 127216
* Provide an attribute, objc_method_family, to allow the inferred familyJohn McCall2011-03-021-0/+1
| | | | | | | | | | of an Objective-C method to be overridden on a case-by-case basis. This is a higher-level tool than ns_returns_retained &c.; it lets users specify that not only does a method have different retain/release semantics, but that it semantically acts differently than one might assume from its name. This in turn is quite useful to static analysis. llvm-svn: 126839
* Rename tok::eom to tok::eod.Peter Collingbourne2011-02-289-91/+91
| | | | | | | | The previous name was inaccurate as this token in fact appears at the end of every preprocessing directive, not just macro definitions. No functionality change, except for a diagnostic tweak. llvm-svn: 126631
* Reimplement __pragma support using a TokenLexerPeter Collingbourne2011-02-222-36/+30
| | | | llvm-svn: 126221
* Make TokenLexer capable of storing preprocessor directive tokensPeter Collingbourne2011-02-223-4/+12
| | | | llvm-svn: 126220
* Turn on __has_feature(cxx_auto_type). The feature is now fully implemented.Richard Smith2011-02-201-1/+1
| | | | llvm-svn: 126078
* Warn for missing terminating " or ' instead of error for gcc compatibility. ↵Argyrios Kyrtzidis2011-02-151-2/+2
| | | | | | Fixed rdar://8914293. llvm-svn: 125616
* Move support for "#pragma STDC FP_CONTRACT" to Parser; add Sema actionsPeter Collingbourne2011-02-141-15/+0
| | | | llvm-svn: 125474
* Make LexOnOffSwitch a Preprocessor member functionPeter Collingbourne2011-02-141-35/+35
| | | | llvm-svn: 125473
* Add CMake dependencies so that LLVM_USED_LIBS order doesn't matter.Jeffrey Yasskin2011-02-111-0/+2
| | | | | | | I also sorted the tools/driver dependencies since their order no longer matters. llvm-svn: 125417
* Implement two related optimizations that make de-serialization ofDouglas Gregor2011-02-101-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | AST/PCH files more lazy: - Don't preload all of the file source-location entries when reading the AST file. Instead, load them lazily, when needed. - Only look up header-search information (whether a header was already #import'd, how many times it's been included, etc.) when it's needed by the preprocessor, rather than pre-populating it. Previously, we would pre-load all of the file source-location entries, which also populated the header-search information structure. This was a relatively minor performance issue, since we would end up stat()'ing all of the headers stored within a AST/PCH file when the AST/PCH file was loaded. In the normal PCH use case, the stat()s were cached, so the cost--of preloading ~860 source-location entries in the Cocoa.h case---was relatively low. However, the recent optimization that replaced stat+open with open+fstat turned this into a major problem, since the preloading of source-location entries would now end up opening those files. Worse, those files wouldn't be closed until the file manager was destroyed, so just opening a Cocoa.h PCH file would hold on to ~860 file descriptors, and it was easy to blow through the process's limit on the number of open file descriptors. By eliminating the preloading of these files, we neither open nor stat the headers stored in the PCH/AST file until they're actually needed for something. Concretely, we went from *** HeaderSearch Stats: 835 files tracked. 364 #import/#pragma once files. 823 included exactly once. 6 max times a file is included. 3 #include/#include_next/#import. 0 #includes skipped due to the multi-include optimization. 1 framework lookups. 0 subframework lookups. *** Source Manager Stats: 835 files mapped, 3 mem buffers mapped. 37460 SLocEntry's allocated, 11215575B of Sloc address space used. 62 bytes of files mapped, 0 files with line #'s computed. with a trivial program that uses a chained PCH including a Cocoa PCH to *** HeaderSearch Stats: 4 files tracked. 1 #import/#pragma once files. 3 included exactly once. 2 max times a file is included. 3 #include/#include_next/#import. 0 #includes skipped due to the multi-include optimization. 1 framework lookups. 0 subframework lookups. *** Source Manager Stats: 3 files mapped, 3 mem buffers mapped. 37460 SLocEntry's allocated, 11215575B of Sloc address space used. 62 bytes of files mapped, 0 files with line #'s computed. for the same program. llvm-svn: 125286
* CMake: LLVM_NO_RTTI must be obsolete now!NAKAMURA Takumi2011-02-101-2/+0
| | | | llvm-svn: 125275
* Lexer: add CUDA kernel call tokensPeter Collingbourne2011-02-091-0/+8
| | | | llvm-svn: 125218
* Add a __has_feature check for default template arguments in functionDouglas Gregor2011-02-051-0/+1
| | | | | | templates, a C++0x feature. llvm-svn: 124973
* Add __has_feature() for each of the type traitsDouglas Gregor2011-02-031-0/+19
| | | | llvm-svn: 124820
* Harden Lexer::GetBeginningOfToken() against bogus source locations andDouglas Gregor2011-01-311-0/+6
| | | | | | the disappearance/alteration of files. llvm-svn: 124616
OpenPOWER on IntegriCloud