summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex
Commit message (Collapse)AuthorAgeFilesLines
* Enhance Lexer::makeFileCharRange to check for ranges inside a macro argumentArgyrios Kyrtzidis2012-01-201-11/+61
| | | | | | | expansion, in which case it returns a file range in the location where the argument was spelled. llvm-svn: 148551
* Introduce Lexer::getSourceText() that returns a string for the sourceArgyrios Kyrtzidis2012-01-191-0/+42
| | | | | | that the given source range encompasses. llvm-svn: 148481
* Introduce Lexer::makeFileCharRange() that accepts a token source rangeArgyrios Kyrtzidis2012-01-191-0/+29
| | | | | | and returns a character range with file locations. llvm-svn: 148480
* For Lexer's isAt[Start/End]OfMacroExpansion add an out parameter for the macroArgyrios Kyrtzidis2012-01-191-15/+21
| | | | | | | | | start/end location. It is commonly needed after calling the function; with this way we avoid recalculating it. llvm-svn: 148479
* Refactor: Pull getImmediateMacroName() out of DiagnosticRenderer andAnna Zaks2012-01-181-0/+21
| | | | | | into Lexer and Preprocessor; making it widely available. llvm-svn: 148410
* stop claiming unicode escape sequences are too long in strings, because they ↵Seth Cantrell2012-01-181-2/+0
| | | | | | never are llvm-svn: 148391
* Improves support for Unicode in character literalsSeth Cantrell2012-01-181-64/+115
| | | | | | | | | | | | | | | | | | | | Updates ProcessUCNExcape() for C++. C++11 allows UCNs in character and string literals that represent control characters and basic source characters. Also C++03 allows UCNs that refer to surrogate codepoints. UTF-8 sequences in character literals are now handled as single c-chars. Added error for multiple characters in Unicode character literals. Added errors for when a the execution charset encoding of a c-char cannot be represented as a single code unit in the associated character type. Note that for the purposes of this error the asso- ciated character type for a narrow character literal is char, not int, even though in C narrow character literals have type int. llvm-svn: 148389
* Remove unreachable code in Clang. (replace with llvm_unreachable where ↵David Blaikie2012-01-176-10/+0
| | | | | | appropriate or when GCC requires it) llvm-svn: 148292
* Some improvements to the handling of C11 atomic types:David Chisnall2012-01-161-0/+4
| | | | | | | | | | | | | | | | | | - Add atomic-to/from-nonatomic cast types - Emit atomic operations for arithmetic on atomic types - Emit non-atomic stores for initialisation of atomic types, but atomic stores and loads for every other store / load - Add a __atomic_init() intrinsic which does a non-atomic store to an _Atomic() type. This is needed for the corresponding C11 stdatomic.h function. - Enables the relevant __has_feature() checks. The feature isn't 100% complete yet, but it's done enough that we want people testing it. Still to do: - Make the arithmetic operations on atomic types (e.g. Atomic(int) foo = 1; foo++;) use the correct LLVM intrinsic if one exists, not a loop with a cmpxchg. - Add a signal fence builtin - Properly set the fenv state in atomic operations on floating point values - Correctly handle things like _Atomic(_Complex double) which are too large for an atomic cmpxchg on some platforms (this requires working out what 'correctly' means in this context) - Fix the many remaining corner cases llvm-svn: 148242
* Two variables had been added for an assert, but their values wereChandler Carruth2012-01-151-3/+3
| | | | | | | | | | re-computed rather than the variables be re-used just after the assert. Just use the variables since we have them already. Fixes an unused variable warning. Also fix an 80-column violation. llvm-svn: 148212
* When inferring a module for a framework, first determine whether thatDouglas Gregor2012-01-131-3/+44
| | | | | | | | | | | | | framework is actually a subframework within a top-level framework. If so, only infer a module for the top-level framework and then dig out the appropriate submodule. This helps us cope with an amusing subframeworks anti-pattern, where one uses -F <framework>/Frameworks to get direct include access to the subframeworks of a framework (which otherwise would not be permitted). llvm-svn: 148148
* Don't infer a submodule for a framework's private header, at least for now.Douglas Gregor2012-01-131-14/+1
| | | | llvm-svn: 148117
* Revert previous commit. Something has gone wonky with my local configurationDouglas Gregor2012-01-131-1/+0
| | | | llvm-svn: 148084
* When inferring a module map for a framework, add the 'private'Douglas Gregor2012-01-131-0/+1
| | | | | | | requirement to headers under PrivateHeaders. We don't want to build them as part of the module (yet). llvm-svn: 148082
* When inferring a submodule ID during module creation, look up theDouglas Gregor2012-01-061-5/+16
| | | | | | | | | | include stack to find the first file that is known to be part of the module. This copes with situations where the module map doesn't completely specify all of the headers that are involved in the module, which can come up when there are very strange #include_next chains (e.g., with weird compiler/stdlib headers like stdarg.h or float.h). llvm-svn: 147662
* Fix a memory leak of PragmaNamespaces, rdar://10611796.Argyrios Kyrtzidis2012-01-061-1/+3
| | | | llvm-svn: 147635
* When loading an AST file, set SourceManager::MainFileID to the main file of ↵Argyrios Kyrtzidis2012-01-051-12/+16
| | | | | | | | the AST file, as suggested by Tom Honermann. llvm-svn: 147612
* If we already have a definition for a top-level module that we deserialized ↵Douglas Gregor2012-01-051-0/+13
| | | | | | from a module file, don't bother parsing a new definition llvm-svn: 147574
* Store the submodules of a module in source order, as they are storedDouglas Gregor2012-01-041-25/+11
| | | | | | | | in the module map. This provides a bit more predictability for the user, as well as eliminating the need to sort the submodules when serializing them. llvm-svn: 147564
* Add __has_feature(modules) to indicate when modules are available (inDouglas Gregor2012-01-041-1/+2
| | | | | | | | | any language variant), and restrict __has_feature(objc_modules) to mean that we also have the Objective-C @import syntax. I anticipate __has_feature(cxx_modules) and/or __has_feature(c_modules) for when we nail down the module syntax for C/C++. llvm-svn: 147548
* Don't treat 'import' as a contextual keyword when we're in a caching lexer, ↵Douglas Gregor2012-01-042-11/+20
| | | | | | or when modules are disabled. llvm-svn: 147524
* Add __has_feature(objc_modules)Douglas Gregor2012-01-031-0/+1
| | | | llvm-svn: 147482
* Re-uglify #public and #private to #__public_macro and #__private_macro.Douglas Gregor2012-01-031-6/+6
| | | | llvm-svn: 147469
* Eliminate the uglified keyword __import_module__ for importingDouglas Gregor2012-01-032-14/+9
| | | | | | | | | | | | | modules. This leaves us without an explicit syntax for importing modules in C/C++, because such a syntax needs to be discussed first. In Objective-C/Objective-C++, the @import syntax is used to import modules. Note that, under -fmodules, C/C++ programs can import modules via the #include mechanism when a module map is in place for that header. This allows us to work with modules in C/C++ without committing to a syntax. llvm-svn: 147467
* Under -fmodules, accept #public <macroname> and #private <macroname>Douglas Gregor2012-01-031-11/+16
| | | | | | | to make a macro public (the default for headers) or private, respectively. llvm-svn: 147455
* Introduce a non-uglified syntax for module imports in Objective-C:Douglas Gregor2012-01-031-5/+11
| | | | | | @import identifier [. identifier]* ; llvm-svn: 147452
* Add a "Modules" language option, which subsumes the previousDouglas Gregor2012-01-032-3/+2
| | | | | | "AutoModuleImport" preprocessor option and is tied to -fmodules. llvm-svn: 147448
* Added a missing case for -Wdisabled-macro-expansion.Abramo Bagnara2012-01-021-1/+3
| | | | llvm-svn: 147433
* Added -Wdisabled-macro-expansion warning.Abramo Bagnara2012-01-011-2/+5
| | | | llvm-svn: 147418
* Implement support for module requirements, which indicate the languageDouglas Gregor2011-12-313-18/+150
| | | | | | | | | features needed for a particular module to be available. This allows mixed-language modules, where certain headers only work under some language variants (e.g., in C++, std.tuple might only be available in C++11 mode). llvm-svn: 147387
* Mass rename C1x references to C11. The name hasn't proliferated like "C++0x" ↵Benjamin Kramer2011-12-231-5/+5
| | | | | | | | so this patch is surprisingly small. Also drop -Wc1x-extensions in favor of -Wc11-extensions. I don't think we need to keep this around for compatibility. llvm-svn: 147221
* Remove spurious, but now legal, typenameDouglas Gregor2011-12-231-1/+1
| | | | llvm-svn: 147208
* When building a module with an umbrella header, warn about any headersDouglas Gregor2011-12-231-0/+67
| | | | | | | | found within that umbrella directory that were not actually included by the umbrella header. They should either be referenced in the module map or included by the umbrella header. llvm-svn: 147207
* remove unneeded config.h includesDylan Noblesmith2011-12-221-1/+1
| | | | llvm-svn: 147195
* In Lexer::getCharAndSizeSlow[NoWarn] if we come up againstArgyrios Kyrtzidis2011-12-221-12/+10
| | | | | | | | | | \<newline><newline> don't consume the second newline. Thanks to David Blaikie for pointing out the crash! llvm-svn: 147138
* In Lexer::getCharAndSizeSlow[NoWarn] make sure we don't go over the end of ↵Argyrios Kyrtzidis2011-12-211-0/+7
| | | | | | | | | | the buffer when the end of the buffer is immediately after an escaped newline. Fixes http://llvm.org/PR10153. llvm-svn: 147091
* Update the CMake build for r146959's new files.Chandler Carruth2011-12-201-0/+1
| | | | llvm-svn: 146967
* Unweaken vtables as per ↵David Blaikie2011-12-203-0/+18
| | | | | | http://llvm.org/docs/CodingStandards.html#ll_virtual_anch llvm-svn: 146959
* Detect when mapping a #include/#import over to a submodule ends upDouglas Gregor2011-12-201-3/+4
| | | | | | | | | | | | | hitting a submodule that was never actually created, e.g., because that header wasn't parsed. In such cases, complain (because the module's umbrella headers don't cover everything) and fall back to including the header. Later, we'll add a warning at module-build time to catch all such cases. However, this fallback is important to eliminate assertions in the ASTWriter when this happens. llvm-svn: 146933
* [PCH] Fix bug where we failed to update an identifier for a single tokenArgyrios Kyrtzidis2011-12-171-0/+5
| | | | | | | | macro expansion. rdar://10588825 llvm-svn: 146818
* Don't allow #include (and its friends #import, #include_next andRichard Smith2011-12-161-2/+18
| | | | | | | | #__include_macros) in the arguments of a function-style macro. Directives in the arguments of such macros have undefined behaviour, and GCC does not correctly support these cases. In some situations, this can lead to better diagnostics. llvm-svn: 146765
* Set umbrella directory correctly when we infer a framework moduleDouglas Gregor2011-12-121-1/+1
| | | | llvm-svn: 146451
* Don't mark include guard macros as implicitly private. This isn'tDouglas Gregor2011-12-121-21/+1
| | | | | | | actually a terribly good heuristic, and the world is too horrible for it to work. llvm-svn: 146393
* When performing subframework header lookup, don't search forDouglas Gregor2011-12-091-3/+7
| | | | | | | ".framework/" in the path name, because it could be ".framework\" on Windows. This whole function needs to be rewritten with PathV2. llvm-svn: 146261
* Implement the notion of umbrella directories, which implicity coverDouglas Gregor2011-12-091-67/+33
| | | | | | | | | | | | | all of the headers below that particular directory. Use umbrella directories as a clean way to deal with (1) directories/frameworks that don't have an umbrella header, but don't want to enumerate all of their headers, and (2) PrivateHeaders, which we never want to enumerate and want to keep separate from the main umbrella header. This also eliminates a little more of the "magic" for private headers, and frameworks in general. llvm-svn: 146235
* Move a free function from the Frontend library into the Lex library asChandler Carruth2011-12-091-0/+23
| | | | | | | | part of HeaderSearch. This function just normalizes filenames for use inside of a synthetic include directive, but it is used in both the Frontend and Serialization libraries so it needs a common home. llvm-svn: 146227
* Implement umbrella directories for modules, which are similar toDouglas Gregor2011-12-081-10/+73
| | | | | | | | | | | | | | | umbrella headers in the sense that all of the headers within that directory (and eventually its subdirectories) are considered to be part of the module with that umbrella directory. However, unlike umbrella headers, which are expected to include all of the headers within their subdirectories, Clang will automatically include all of the headers it finds in the named subdirectory. The intent here is to allow a module map to trivially turn a subdirectory into a module, where the module's structure can mimic the directory structure. llvm-svn: 146165
* Tweak the syntax of umbrella headers, so that "umbrella" is treated asDouglas Gregor2011-12-081-101/+36
| | | | | | | | | | | a modifier for a header declarartion, e.g., umbrella header "headername" Collapse the umbrella-handling code in the parser into the header-handling code, so we don't duplicate the header-search logic. llvm-svn: 146159
* Within the module representation, generalize the notion of an umbrellaDouglas Gregor2011-12-081-7/+7
| | | | | | | | | | header to also support umbrella directories. The umbrella directory for an umbrella header is the directory in which the umbrella header resides. No functionality change yet, but it's coming. llvm-svn: 146158
* Keep track of import dependencies between submodules within the moduleDouglas Gregor2011-12-082-20/+24
| | | | | | | that's currently being built. This is important for supporting transitive dependencies ("export *" in the module map) completely. llvm-svn: 146156
OpenPOWER on IntegriCloud