summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex
Commit message (Collapse)AuthorAgeFilesLines
...
* Add explicit attributes to mark functions as having had theirJohn McCall2011-09-303-0/+72
| | | | | | | | | | | CoreFoundation object-transfer properties audited, and add a #pragma to cause them to be automatically applied to functions in a particular span of code. This has to be implemented largely in the preprocessor because of the requirement that the region be entirely contained in a single file; that's hard to impose from the parser without registering for a ton of callbacks. llvm-svn: 140846
* Introduce a callback to PPCallbacks for lines skipped by the preprocessor.Argyrios Kyrtzidis2011-09-271-3/+10
| | | | | | Patch by Jason Haslam! llvm-svn: 140612
* When parsing a character literal, extract the characters from theDouglas Gregor2011-09-271-1/+1
| | | | | | | | buffer as an 'unsigned char', so that integer promotion doesn't sign-extend character values > 127 into oblivion. Fixes <rdar://problem/10188919>. llvm-svn: 140608
* Properly initialize Preprocessor::CurLexerKind to avoid use of uninitialized ↵Zhongxing Xu2011-09-261-2/+2
| | | | | | variable. llvm-svn: 140514
* Rename Diagnostic to DiagnosticsEngine as per issue 5397David Blaikie2011-09-255-9/+12
| | | | llvm-svn: 140478
* Fix missing includes for llvm_unreachableDavid Blaikie2011-09-233-0/+3
| | | | llvm-svn: 140368
* Switch assert(0/false) llvm_unreachable.David Blaikie2011-09-234-4/+4
| | | | llvm-svn: 140367
* Do manual binary search for preprocessing entities because their end locationsArgyrios Kyrtzidis2011-09-221-5/+23
| | | | | | may be unordered and MSVC's debug-mode doesn't like it. llvm-svn: 140337
* ArrayRef-ifying MacroArgs::create's arguments argument.David Blaikie2011-09-223-16/+19
| | | | llvm-svn: 140288
* Simplify the last character check.David Blaikie2011-09-221-1/+1
| | | | llvm-svn: 140287
* More MSVC9 unbreaking.Benjamin Kramer2011-09-211-2/+8
| | | | llvm-svn: 140256
* [libclang] When pointing at a macro expansion inside a macro argument,Argyrios Kyrtzidis2011-09-201-3/+3
| | | | | | return a cursor for the inner macro. llvm-svn: 140207
* The location of the name in MacroDefinition is the beginning of its range,Argyrios Kyrtzidis2011-09-201-3/+1
| | | | | | don't store an extra location for it. llvm-svn: 140190
* Fix gcc build.Argyrios Kyrtzidis2011-09-191-1/+2
| | | | llvm-svn: 140073
* Introduce local_begin()/local_end() methods in PreprocessingRecord whichArgyrios Kyrtzidis2011-09-191-12/+0
| | | | | | return iterators for local, non-loaded, preprocessed entities. llvm-svn: 140062
* Introduce PreprocessingRecord::getPreprocessedEntitiesInRange()Argyrios Kyrtzidis2011-09-192-7/+113
| | | | | | | | | | which will do a binary search and return a pair of iterators for preprocessed entities in the given source range. Source ranges of preprocessed entities are stored twice currently in the PCH/Module file but this will be fixed in a subsequent commit. llvm-svn: 140058
* Rename SourceLocation::getFileLocWithOffset -> getLocWithOffset.Argyrios Kyrtzidis2011-09-196-17/+17
| | | | | | It already works (and is useful with) macro locs as well. llvm-svn: 140057
* Rename LangOptions::Microsoft to LangOptions::MicrosoftExt to make it clear ↵Francois Pichet2011-09-175-10/+10
| | | | | | | | that this flag must be used only for Microsoft extensions and not emulation; to avoid confusion with the new LangOptions::MicrosoftMode flag. Many of the code now under LangOptions::MicrosoftExt will eventually be moved under the LangOptions::MicrosoftMode flag. llvm-svn: 139987
* When we load header file information from the external source (i.e.,Douglas Gregor2011-09-171-8/+28
| | | | | | | | the AST reader), merge that header file information with whatever header file information we already have. Otherwise, we might forget something we already knew (e.g., that the header was #import'd already). llvm-svn: 139979
* Tweak the module auto-import heuristics a bitDouglas Gregor2011-09-161-1/+2
| | | | llvm-svn: 139887
* Add an experimental flag -fauto-module-import that automatically turnsDouglas Gregor2011-09-155-15/+55
| | | | | | | #include or #import direcctives of framework headers into module imports of the corresponding framework module. llvm-svn: 139860
* [PCH] Overhaul how preprocessed entities are [de]serialized.Argyrios Kyrtzidis2011-09-151-26/+38
| | | | | | | | | | | | | -Use an array of offsets for all preprocessed entities -Get rid of the separate array of offsets for just macro definitions; for references to macro definitions use an index inside the preprocessed entities array. -Deserialize each preprocessed entity lazily, at first request; not in bulk. Paves the way for binary searching of preprocessed entities that will offer efficiency and will simplify things on the libclang side a lot. llvm-svn: 139809
* For modules, use a hash of the compiler version, language options, andDouglas Gregor2011-09-131-3/+12
| | | | | | | | | target triple to separate modules built under different conditions. The hash is used to create a subdirectory in the module cache path where other invocations of the compiler (with the same version, language options, etc.) can find the precompiled modules. llvm-svn: 139662
* When an import statement fails to find a module in the module cache,Douglas Gregor2011-09-121-3/+37
| | | | | | | | | but there is a corresponding umbrella header in a framework, build the module on-the-fly so it can be immediately loaded at the import statement. This is very much proof-of-concept code, with details to be fleshed out over time. llvm-svn: 139558
* Introduce a cc1-level option to provide the path to the module cache,Douglas Gregor2011-09-121-0/+10
| | | | | | | | where the compiler will look for module files. Eliminates the egregious hack where we looked into the header search paths for modules. llvm-svn: 139538
* [libclang] Fix annotation and getting a "macro expansion" cursorArgyrios Kyrtzidis2011-09-081-4/+5
| | | | | | for a builtin macro expansion. llvm-svn: 139298
* Allow C++0x enumerations with a fixed underlying type inDouglas Gregor2011-09-081-0/+1
| | | | | | | Objective-C. The @encode'ing of such an enumeration type is the same as its underlying type. <rdar://problem/5276348>. llvm-svn: 139297
* Implement the Objective-C 'instancetype' type, which is an alias ofDouglas Gregor2011-09-081-0/+1
| | | | | | | | | | 'id' that can be used (only!) via a contextual keyword as the result type of an Objective-C message send. 'instancetype' then gives the method a related result type, which we have already been inferring for a variety of methods (new, alloc, init, self, retain). Addresses <rdar://problem/9267640>. llvm-svn: 139275
* Optimize the preprocessor's handling of the __import_module__Douglas Gregor2011-09-073-17/+42
| | | | | | | | | | | | keyword. We now handle this keyword in HandleIdentifier, making a note for ourselves when we've seen the __import_module__ keyword so that the next lexed token can trigger a module import (if needed). This greatly simplifies Preprocessor::Lex(), and completely erases the 5.5% -Eonly slowdown Argiris noted when I originally implemented __import_module__. Big thanks to Argiris for noting that horrible regression! llvm-svn: 139265
* Advertise support for cxx_range_for as an extension in C++98 mode. Patch by ↵Richard Smith2011-09-061-0/+1
| | | | | | | | Jean-Daniel Dupas! Also provide a modicum of test coverage for ranged for in C++98. llvm-svn: 139149
* Speed up BCPL comment lexing by looking aggressively for newlines and then ↵Benjamin Kramer2011-09-051-9/+24
| | | | | | | | scannig backwards to see if the newline is escaped. 3% speedup in preprocessing all of clang with -Eonly. Also includes a small testcase for coverage. llvm-svn: 139116
* Use the Lexer's definition of whitespace here.Benjamin Kramer2011-09-051-3/+2
| | | | llvm-svn: 139115
* Use const_cast to avoid warnings.Benjamin Kramer2011-09-041-1/+1
| | | | llvm-svn: 139104
* Add test case for defaulted copy and move structure validation.Sebastian Redl2011-09-041-1/+1
| | | | | | | | Fix bug this uncovered. Address minor comments from Doug. Enable cxx_implicit_moves feature. llvm-svn: 139101
* Handle a code-completion token being passed to the macro stringify operator.Argyrios Kyrtzidis2011-09-041-0/+2
| | | | | | Fixes http://llvm.org/PR10826. llvm-svn: 139087
* Support code-completion for C++ inline methods and ObjC buffering methods.Argyrios Kyrtzidis2011-09-047-89/+130
| | | | | | | | | | | | | | Previously we would cut off the source file buffer at the code-completion point; this impeded code-completion inside C++ inline methods and, recently, with buffering ObjC methods. Have the code-completion inserted into the source buffer so that it can be buffered along with a method body. When we actually hit the code-completion point the cut-off lexing or parsing. Fixes rdar://10056932&8319466 llvm-svn: 139086
* Fix Lexer::ComputePreamble when MaxLines parameter is non-zero.Argyrios Kyrtzidis2011-09-041-3/+18
| | | | | | | | The function was only counting lines that included tokens and not empty lines, but MaxLines (mainly initiated to the line where the code-completion point resides) is a count of overall lines (even empty ones). llvm-svn: 139085
* Allow the preprocessor to be constructed without performing target-Douglas Gregor2011-09-011-53/+69
| | | | | | | | and language-specific initialization. Use this to allow ASTUnit to create a preprocessor object *before* loading the AST file. No actual functionality change. llvm-svn: 138983
* Don't try keeping a 'LeadingEmptyMacroLoc' in NullStmt. This failsArgyrios Kyrtzidis2011-09-011-1/+0
| | | | | | in the face of buffering C++/ObjC method bodies. llvm-svn: 138972
* Teach ASTContext and Preprocessor to hold on to references to the sameDouglas Gregor2011-09-011-1/+1
| | | | | | | | | LangOptions, rather than making distinct copies of LangOptions. Granted, LangOptions doesn't actually get modified, but this will eventually make it easier to construct ASTContext and Preprocessor before we know all of the LangOptions. llvm-svn: 138959
* Modules hide macro definitions by default, so that silly things likeDouglas Gregor2011-09-012-0/+36
| | | | | | | | | | | include guards don't show up as macro definitions in every translation unit that imports a module. Macro definitions can, however, be exported with the intentionally-ugly #__export_macro__ directive. Implement this feature by not even bothering to serialize non-exported macros to a module, because clients of that module need not (should not) know that these macros even exist. llvm-svn: 138943
* Make sure to initialize field. Hopefully this will fix some test failures ↵Eli Friedman2011-08-311-0/+1
| | | | | | on Windows. llvm-svn: 138880
* Switch __import__ over to __import_module__, so we don't conflict withDouglas Gregor2011-08-311-5/+5
| | | | | | | | existing practice with Python extension modules. Not that Python extension modules should be using a double-underscored identifier anyway, but... llvm-svn: 138870
* Change err_pp_file_not_found back to an Error; when it's a Warning, we ↵Eli Friedman2011-08-302-2/+4
| | | | | | | | suppress it in system headers. And it is not a good idea to suppress it in system headers. (This was originally changed in r134996 to implement -MG.) Fixes <rdar://10041960>. And also brings down the number of warnings without a flag by one :) llvm-svn: 138842
* Allow C99 hexfloats in C++0x mode. This change resolves the standardsDouglas Gregor2011-08-301-4/+2
| | | | | | | | | collision between C99 hexfloats and C++0x user-defined literals by giving C99 hexfloats precedence. Also, warning about user-defined literals that conflict with hexfloats and those that have names that are reserved by the implementation. Fixes <rdar://problem/9940194>. llvm-svn: 138839
* Add and document __has_feature values for the remaining C++0xDouglas Gregor2011-08-291-0/+11
| | | | | | | features, so clients can check for the availability of these features even before we get around to implementing them. llvm-svn: 138741
* Take an entirely different approach to handling the "parsing" ofDouglas Gregor2011-08-271-7/+3
| | | | | | | | | __import__ within the preprocessor, since the prior one foolishly assumed that Preprocessor::Lex() was re-entrant. We now handle __import__ at the top level (only), after macro expansion. This should fix the buildbot failures. llvm-svn: 138704
* Introduce support for a simple module import declaration, whichDouglas Gregor2011-08-262-4/+35
| | | | | | | | | | | | | | | | | | | | | | loads the named module. The syntax itself is intentionally hideous and will be replaced at some later point with something more palatable. For now, we're focusing on the semantics: - Module imports are handled first by the preprocessor (to get macro definitions) and then the same tokens are also handled by the parser (to get declarations). If both happen (as in normal compilation), the second one is redundant, because we currently have no way to hide macros or declarations when loading a module. Chris gets credit for this mad-but-workable scheme. - The Preprocessor now holds on to a reference to a module loader, which is responsible for loading named modules. CompilerInstance is the only important module loader: it now knows how to create and wire up an AST reader on demand to actually perform the module load. - We search for modules in the include path, using the module name with the suffix ".pcm" (precompiled module) for the file name. This is a temporary hack; we hope to improve the situation in the future. llvm-svn: 138679
* Make Lexer::ComputePreamble accept a LangOptions parameter, otherwise it may beArgyrios Kyrtzidis2011-08-251-3/+3
| | | | | | out-of-sync how a file is compiled. Patch by Matthias Kleine! llvm-svn: 138580
* Silence 'may be used uninitialized' warnings.Argyrios Kyrtzidis2011-08-241-2/+2
| | | | llvm-svn: 138475
OpenPOWER on IntegriCloud