summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex
Commit message (Collapse)AuthorAgeFilesLines
...
* Teach the preprocessor how to handle module import declarations thatDouglas Gregor2011-11-301-9/+23
| | | | | | | involve submodules (e.g., importing std.vector), rather than always importing the top-level module. llvm-svn: 145478
* Switch the module-loading interfaces and parser from a simpleDouglas Gregor2011-11-302-10/+16
| | | | | | | top-level module name to a module path (e.g., std.vector). We're still missing a number of pieces for this actually to do something. llvm-svn: 145462
* Escape strings when printing module maps, for silly operating systemsDouglas Gregor2011-11-291-2/+31
| | | | | | that use \ as a separator. llvm-svn: 145439
* Switch on-demand module building over to use module maps, always. WhenDouglas Gregor2011-11-291-22/+32
| | | | | | | we infer the module map, we'll just print the module map to a temporary file and generate the module using that. llvm-svn: 145436
* Teach the module import mechanism how to rebuild modules expressed viaDouglas Gregor2011-11-291-0/+9
| | | | | | | module map, rather than assuming that there is an umbrella header. This allows us to automatically build umbrella-less modules. llvm-svn: 145415
* Expose the printing of module maps as part of the ModuleMap::ModuleDouglas Gregor2011-11-291-34/+36
| | | | | | interface. No functionality change. llvm-svn: 145411
* When attempting to load a module that is not in the module cache,Douglas Gregor2011-11-281-48/+27
| | | | | | | | return the module itself (in the module map) rather than returning the umbrella header used to build the module. While doing this, make sure that we're inferring modules for frameworks to build that module. llvm-svn: 145310
* Remove an assertion that is not valid if we cancel parsing.Argyrios Kyrtzidis2011-11-231-3/+0
| | | | llvm-svn: 145108
* Remove assert from hot code path and add a clarifying comment.Benjamin Kramer2011-11-221-4/+4
| | | | | | The assert wasn't adding much value but slowed down Release+Asserts builds. llvm-svn: 145082
* Lexer: Don't throw away the hard work SSE did to find a slash.Benjamin Kramer2011-11-221-5/+12
| | | | | | We can reuse the information and avoid looping over all the bytes again. llvm-svn: 145070
* implement __has_feature(address_sanitizer); also use ↵Kostya Serebryany2011-11-221-0/+1
| | | | | | LangOpts.AddressSanitizer instead of CodeGenOpts.AddressSanitizer llvm-svn: 145054
* Allow preprocessor callbacks to recover from a "file not found" error,Douglas Gregor2011-11-202-6/+26
| | | | | | from Jason Haslam! llvm-svn: 145012
* When making a suggestion regarding which module to load rather thanDouglas Gregor2011-11-172-15/+19
| | | | | | | preprocess/parse a header, report back with an actual module (which may be a submodule) rather than just the name of the module. llvm-svn: 144925
* Add the notion of "framework" modules to module maps. FrameworkDouglas Gregor2011-11-171-9/+49
| | | | | | | modules (obviously) describe frameworks, and understand the header layout of frameworks. llvm-svn: 144921
* Actually free memory for the module mapsDouglas Gregor2011-11-171-0/+15
| | | | llvm-svn: 144880
* When we're loading a framework header, first try to turn the frameworkDouglas Gregor2011-11-172-6/+70
| | | | | | | | | into a module. This module can either be loaded from a module map in the framework directory (which isn't quite working yet) or inferred from an umbrella header (which does work, and replaces the existing hack). llvm-svn: 144877
* A module with an umbrella header assumes that all of the headers inDouglas Gregor2011-11-161-0/+40
| | | | | | | | the umbrella header's directory and its subdirectories are part of the module (that's why it's an umbrella). Make sure that these headers are considered to be part of the module for lookup purposes. llvm-svn: 144859
* Add support for building a module from a module map to the -cc1Douglas Gregor2011-11-161-0/+40
| | | | | | | interface. This is currently limited to modules with umbrella headers. llvm-svn: 144736
* Fix a regression in wide character codegen. See PR11369.Nico Weber2011-11-141-2/+2
| | | | llvm-svn: 144521
* Silence unused variable warning.Benjamin Kramer2011-11-131-2/+2
| | | | llvm-svn: 144500
* Implement a minor optimization when loading module maps to satisfy aDouglas Gregor2011-11-121-14/+22
| | | | | | | | module import: don't re-check for a loaded module unless we've actually loaded a new module map file. Already-loaded module map files aren't interesting. llvm-svn: 144435
* When searching for a module, speculatively load module maps to see ifDouglas Gregor2011-11-121-40/+75
| | | | | | | | the module is described in one of the module maps in a search path or in a subdirectory off the search path that has the same name as the module we're looking for. llvm-svn: 144433
* Teach the search for modules to consider modules described by a moduleDouglas Gregor2011-11-112-1/+19
| | | | | | | | | | | | | | map, so long as they have an umbrella header. This makes it possible to introduce a module map + umbrella header for a given set of headers, to turn it into a module. There are two major deficiencies here: first, we don't go hunting for module map files when we just see a module import (so we won't know about the modules described therein). Second, we don't yet have a way to build modules that don't have umbrella headers, or have incomplete umbrella headers. llvm-svn: 144424
* Wire up the mapping from header files mentioned in module maps over toDouglas Gregor2011-11-112-3/+22
| | | | | | | the corresponding (top-level) modules. This isn't actually useful yet, because we don't yet have a way to build modules out of module maps. llvm-svn: 144410
* Resolve the header files named in module map "header" and "umbrella"Douglas Gregor2011-11-111-6/+70
| | | | | | declarations to actual files. llvm-svn: 144408
* Introduce basic support for parsing module map files.Douglas Gregor2011-11-113-1/+598
| | | | | | | | | | | | | | Module map files provide a way to map between headers and modules, so that we can layer a module system on top of existing headers without changing those headers at all. This commit introduces the module map file parser and the module map that it generates, and wires up the module map file parser so that we'll automatically find module map files as part of header search. Note that we don't yet use the information stored in the module map. llvm-svn: 144402
* I predict that HeaderSearch will need the ability to generateDouglas Gregor2011-11-111-2/+3
| | | | | | diagnostics in the future. Make it so. llvm-svn: 144347
* Fix one last place where we weren't writing into a string literal consistently.Eli Friedman2011-11-051-2/+14
| | | | llvm-svn: 143769
* Use native endianness for writing out character escapes to the result buffer ↵Eli Friedman2011-11-021-20/+32
| | | | | | for string literal parsing. No functional change on little-endian architectures; should fix test failures on PPC. llvm-svn: 143585
* Perform proper conversion for strings encoded in the source file as UTF-8. ↵Eli Friedman2011-11-011-11/+44
| | | | | | | | | | (For now, we are assuming the source character set is always UTF-8; this can be easily extended if necessary.) Tests will be coming up in a subsequent commit. Patch by Seth Cantrell. llvm-svn: 143416
* Add __has_feature(cxx_raw_string_literals) andDouglas Gregor2011-11-011-2/+2
| | | | | | __has_feature(cxx_unicode_literals), from Michel Morin! llvm-svn: 143412
* Add __has_feature(cxx_defaulted_functions) for querying "defaultedDouglas Gregor2011-11-011-0/+1
| | | | | | functions", from Michel Morin! llvm-svn: 143411
* Make the loading of information attached to an IdentifierInfo from anDouglas Gregor2011-10-273-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | AST file more lazy, so that we don't eagerly load that information for all known identifiers each time a new AST file is loaded. The eager reloading made some sense in the context of precompiled headers, since very few identifiers were defined before PCH load time. With modules, however, a huge amount of code can get parsed before we see an @import, so laziness becomes important here. The approach taken to make this information lazy is fairly simple: when we load a new AST file, we mark all of the existing identifiers as being out-of-date. Whenever we want to access information that may come from an AST (e.g., whether the identifier has a macro definition, or what top-level declarations have that name), we check the out-of-date bit and, if it's set, ask the AST reader to update the IdentifierInfo from the AST files. The update is a merge, and we now take care to merge declarations before/after imports with declarations from multiple imports. The results of this optimization are fairly dramatic. On a small application that brings in 14 non-trivial modules, this takes modules from being > 3x slower than a "perfect" PCH file down to 30% slower for a full rebuild. A partial rebuild (where the PCH file or modules can be re-used) is down to 7% slower. Making the PCH file just a little imperfect (e.g., adding two smallish modules used by a bunch of .m files that aren't in the PCH file) tips the scales in favor of the modules approach, with 24% faster partial rebuilds. This is just a first step; the lazy scheme could possibly be improved by adding versioning, so we don't search into modules we already searched. Moreover, we'll need similar lazy schemes for all of the other lookup data structures, such as DeclContexts. llvm-svn: 143100
* [PCH] When visiting preprocessed entities, make it possible to avoid ↵Argyrios Kyrtzidis2011-10-251-16/+89
| | | | | | | | | | | | | | | deserializing preprocessed entities that are #included in the range that we are interested. This is useful when we are interested in preprocessed entities of a specific file, e.g when we are annotating tokens. There is also an optimization where we cache the last result of PreprocessingRecord::getPreprocessedEntitiesInRange and we re-use it if there is a call with the same range as before. rdar://10313365 llvm-svn: 142887
* Add a __has_feature check for arc_cf_code_audited.John McCall2011-10-181-0/+1
| | | | llvm-svn: 142423
* Argyrios says this change is required for safety under PTH.John McCall2011-10-181-1/+1
| | | | | | Me, I believe him. llvm-svn: 142327
* Fix several bugs with #pragma clang arc_cf_code_audited and macros.John McCall2011-10-181-2/+5
| | | | llvm-svn: 142324
* Move about 20 random diagnostics under -W flags. Patch by Ahmed Charles!Ted Kremenek2011-10-171-2/+2
| | | | llvm-svn: 142284
* For modules, all macros that aren't include guards are implicitlyDouglas Gregor2011-10-173-4/+61
| | | | | | | public. Add a __private_macro__ directive to hide a macro, similar to the __module_private__ declaration specifier. llvm-svn: 142188
* -Wc++98-compat warnings for the lexer.Richard Smith2011-10-154-8/+28
| | | | | | | | This also adds a -Wc++98-compat-pedantic for warning on constructs which would be diagnosed by -std=c++98 -pedantic (that is, it warns even on C++11 features which we enable by default, with no warning, in C++98 mode). llvm-svn: 142034
* Add c_alignas and cxx_alignas featuresPeter Collingbourne2011-10-141-0/+3
| | | | llvm-svn: 142020
* Add a preprocessor callback that is invoked every time the 'defined'Douglas Gregor2011-10-141-0/+4
| | | | | | operator is seen, from Jason Haslam! llvm-svn: 141926
* Implement built-in macro '__has_warning', which allows one to query if a ↵Ted Kremenek2011-10-121-0/+69
| | | | | | warning flag is valid. Fixes <rdar://problem/10263428>. llvm-svn: 141802
* We do parse hexfloats in C++11; make it actually work.Douglas Gregor2011-10-122-5/+1
| | | | llvm-svn: 141798
* Handle the case where preprocessor entities are not received in order,Argyrios Kyrtzidis2011-10-121-5/+25
| | | | | | fixes http://llvm.org/PR11120 llvm-svn: 141788
* Handle Perforce-style conflict markers like normal conflict markers. PerforceRichard Smith2011-10-121-24/+38
| | | | | | | swaps over the <<<< and >>>> markers, and uses shorter markers than traditional tools. llvm-svn: 141751
* Add a -Wc++0x-compat warning for C++11 keywords used as identifiers when inRichard Smith2011-10-111-0/+11
| | | | | | C++98 mode. Only the first occurrence of each keyword will produce a warning. llvm-svn: 141700
* For the FileChanged Preprocessor callback, when exiting a file, pass its FileID.Argyrios Kyrtzidis2011-10-111-1/+5
| | | | llvm-svn: 141681
* A couple random preprocessor changes that got ported from C99 to C++11.Eli Friedman2011-10-101-2/+4
| | | | llvm-svn: 141596
* Fixed exapnsion range for # and ##.Abramo Bagnara2011-10-036-19/+39
| | | | llvm-svn: 141012
OpenPOWER on IntegriCloud