summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex
Commit message (Collapse)AuthorAgeFilesLines
...
* [Preprocessor] Pass TranslationUnitKind to the preprocessor and if it is ↵Argyrios Kyrtzidis2014-03-072-6/+12
| | | | | | | | | | TU_Prefix avoid warning for unused macros. rdar://15034698 llvm-svn: 203213
* Add dependencies from imported modules with -MDBen Langmuir2014-03-071-1/+2
| | | | | | | | Add module dependencies to the dependency files created by -MD/-MMD/etc. by attaching an ASTReaderListener that will call into the dependency file generator when a module input file is seen in the serialized AST. llvm-svn: 203208
* Remove a dead store, add a FIXME for another.Richard Smith2014-03-061-0/+1
| | | | llvm-svn: 203169
* Fix use-after-free detected by ASan bootstrap.Richard Smith2014-03-061-2/+7
| | | | llvm-svn: 203140
* If a #include finds a file relative to the current file, don't forget to checkRichard Smith2014-03-052-24/+55
| | | | | | whether it's part of a module. llvm-svn: 203005
* [C++11] Switch from LLVM_STATIC_ASSERT to static_assert now that weChandler Carruth2014-03-021-2/+2
| | | | | | require host toolchains which support this. llvm-svn: 202640
* [C++11] Replace llvm::tie with std::tie.Benjamin Kramer2014-03-022-2/+2
| | | | llvm-svn: 202639
* Add [extern_c] attribute for modules, allowing a C module to be imported ↵Richard Smith2014-03-021-2/+14
| | | | | | within an extern "C" block in C++ code. llvm-svn: 202615
* If a module A exports a macro M, and a module B imports that macro and #undef'sRichard Smith2014-03-012-6/+6
| | | | | | | | | | | | | | it, importers of B should not see the macro. This is complicated by the fact that A's macro could also be visible through a different path. The rules (as hashed out on cfe-commits) are included as a documentation update in this change. With this, the number of regressions in libc++'s testsuite when modules are enabled drops from 47 to 7. Those remaining 7 are also macro-related, and are due to remaining bugs in this change (in particular, the handling of submodules is imperfect). llvm-svn: 202560
* Reapply fixed "Honour 'use-external-names' in FileManager"Ben Langmuir2014-02-281-0/+1
| | | | | | | | | | | | | | | | Was r202442 There were two issues with the original patch that have now been fixed. 1. We were memset'ing over a FileEntry in a test case. After adding a std::string to FileEntry, this still happened to not break for me. 2. I didn't pass the FileManager into the new compiler instance in compileModule. This was hidden in some cases by the fact I didn't clear the module cache in the test. Also, I changed the copy constructor for FileEntry, which was memcpy'ing in a (now) unsafe way. llvm-svn: 202539
* Fix a minor bug in lexing pp-numbers with digit separators: if a pp-number ↵Richard Smith2014-02-281-0/+1
| | | | | | contains "'e+", the pp-number ends between the 'e' and the '+'. llvm-svn: 202533
* Revert "Honour 'use-external-names' in FileManager"Ben Langmuir2014-02-271-1/+0
| | | | | | Revert r202442, which broke the buildbots. llvm-svn: 202443
* Honour 'use-external-names' in FileManagerBen Langmuir2014-02-271-0/+1
| | | | | | | | Pass through the externally-visible names that we got from the VFS down to FileManager, and test that this is the name showing up in __FILE__, diagnostics, and debug information. llvm-svn: 202442
* [CMake] Use LINK_LIBS instead of target_link_libraries().NAKAMURA Takumi2014-02-261-2/+1
| | | | llvm-svn: 202238
* If the first token in a macro that appears at the start of a line expands toRichard Smith2014-02-241-0/+1
| | | | | | | nothing, be sure to inform the *next* token expanded from the macro that it is now at the start of a line. Patch by Harald van Dijk! llvm-svn: 202068
* Use a more conventional logical op instead of bitwise andAlp Toker2014-02-241-1/+1
| | | | llvm-svn: 202006
* [CMake] Get rid of explicit dependencies to include/clang/*.inc and ↵NAKAMURA Takumi2014-02-211-6/+0
| | | | | | | | | | | | | | | | | | | introduce CLANG_TABLEGEN_TARGETS. This does; - clang_tablegen() adds each tblgen'd target to global property CLANG_TABLEGEN_TARGETS as list. - List of targets is added to LLVM_COMMON_DEPENDS. - all clang libraries and targets depend on generated headers. You might wonder this would be regression, but in fact, this is little loss. - Almost all of clang libraries depend on tblgen'd files and clang-tblgen. - clang-tblgen may cause short stall-out but doesn't cause unconditional rebuild. - Each library's dependencies to tblgen'd files might vary along headers' structure. It made hard to track and update *really optimal* dependencies. Each dependency to intrinsics_gen and ClangSACheckers is left as DEPENDS. llvm-svn: 201842
* Recommit virtual file systemBen Langmuir2014-02-201-2/+2
| | | | | | | | | | | Previously reverted in r201755 due to causing an assertion failure. I've removed the offending assertion, and taught the CompilerInstance to create a default virtual file system inside createFileManager. In the future, we should be able to reach into the CompilerInvocation to customize this behaviour without breaking clients that don't care. llvm-svn: 201818
* Reverting the virtual file system implementation, because it triggers an ↵Juergen Ributzka2014-02-201-2/+2
| | | | | | | | | | assertion in our internal build bots. This reverts commits 201618, 201635, 201636, 201639, 201685, 201691, and 201696. llvm-svn: 201755
* Use llvm::DeleteContainerSeconds when possibleReid Kleckner2014-02-191-3/+1
| | | | llvm-svn: 201739
* Initial implementation of virtual file systemBen Langmuir2014-02-191-2/+2
| | | | | | | | | | | | This adds the minimum virtual file system support to start migrating FileManager onto the VFS. Originally discussed here: http://lists.cs.uiuc.edu/pipermail/cfe-dev/2014-February/035188.html Differential Revision: http://llvm-reviews.chandlerc.com/D2745 llvm-svn: 201618
* Fix false positives in -Wmsvc-include by continuing header searchReid Kleckner2014-02-181-9/+44
| | | | | | | | | | | This makes Clang and LLVM -Wmsvc-include clean. I believe the correct behavior here is to avoid updating the cache when we find the header via MSVC's search rules. Differential Revision: http://llvm-reviews.chandlerc.com/D2733 llvm-svn: 201615
* Fix a non-error diagnostic that had an err_ name. Also move it from Warning toRichard Smith2014-02-181-5/+4
| | | | | | ExtWarn, since it's an extension. llvm-svn: 201540
* PR18855: Add support for UCNs and UTF-8 encoding within ud-suffixes.Richard Smith2014-02-173-114/+157
| | | | llvm-svn: 201532
* If the headermap maps the filename to a framework include ("Foo.h" -> ↵Argyrios Kyrtzidis2014-02-142-11/+47
| | | | | | | | | | | | | | "Foo/Foo.h"), continue header lookup using the framework include as filename. This allows us to conveniently treat #import "Foo.h" as an implicit module import if we can resolve "Foo/Foo.h" as such. rdar://16042979 llvm-svn: 201419
* MS ABI: Implement #pragma vtordisp() and clang-cl /vdNReid Kleckner2014-02-122-23/+26
| | | | | | | | | | | | | | | | | These features are new in VS 2013 and are necessary in order to layout std::ostream correctly. Currently we have an ABI incompatibility when self-hosting with the 2013 stdlib in our convertible_fwd_ostream wrapper in gtest. This change adds another implicit attribute, MSVtorDispAttr, because implicit attributes are currently the best way to make sure the information stays on class templates through instantiation. Reviewers: majnemer Differential Revision: http://llvm-reviews.chandlerc.com/D2746 llvm-svn: 201274
* Fix the range for Malayam UCNs in C99.Joey Gouly2014-02-051-1/+1
| | | | llvm-svn: 200845
* Clean up whitespace checksJustin Bogner2014-02-041-11/+5
| | | | | | | | | | | | | In TokenLexer::ExpandFunctionArguments(), CurTok.hasLeadingSpace() is checked in multiple locations, each time subtly differently. Checking it early, when the token is seen, and using NextTokGetsSpace exclusively after that makes the code simpler. No change in behaviour is intended. Patch by Harald van Dijk! llvm-svn: 200788
* Fix whitespace handling in empty macro expansionsJustin Bogner2014-02-041-2/+6
| | | | | | | | | | | | | When a macro expansion does not result in any tokens, and the macro name is preceded by whitespace, the whitespace should be passed to the first token that follows the macro expansion. Similarly when a macro expansion ends with a placemarker token, and that placemarker token is preceded by whitespace. This worked already for top-level macro expansions, but is now extended to also work for nested macro expansions. Patch by Harald van Dijk! llvm-svn: 200787
* Fix whitespace handling in empty macro argumentsJustin Bogner2014-02-041-18/+13
| | | | | | | | | | | | | When a function-like macro definition ends with one of the macro's parameters, and the argument is empty, any whitespace before the parameter name in the macro definition needs to be preserved. Promoting the existing NextTokGetsSpace to a preserved bit-field and checking it at the end of the macro expansion allows it to be moved to the first token following the macro expansion result. Patch by Harald van Dijk! llvm-svn: 200786
* Fix whitespace handling in ## operatorJustin Bogner2014-02-041-13/+16
| | | | | | | | | | | | | | | | | In x ## y, where x and y are regular tokens, whitespace between x and ## is ignored, and whitespace between ## and y is also ignored. When either x or y is a function argument, whitespace was preserved, but it should not be. This patch removes the checks for whitespace before ## and before y, and in the special case where x is an empty macro argument and y is a regular token, actively removes whitespace before y. One existing test is affected by that change, but as clang's output now matches the standard's requirements and that of GCC, I've tweaked the testcase. Patch by Harald van Dijk! llvm-svn: 200785
* Track the currently-being-built submodule inside the preprocessor (rather thanRichard Smith2014-01-313-23/+23
| | | | | | | just storing a flag indicating if there was one), and include it in the 'end of module' annotation. No functionality change. llvm-svn: 200573
* Revert "Fix assertion failures on annot_* tokens in clang -E"Ben Langmuir2014-01-301-6/+3
| | | | | | | This is causing a failure in the msan buildbot that I am having trouble reproducing. Reverting until I can figure out what went wrong. llvm-svn: 200492
* Fix assertion failures on annot_* tokens in clang -EBen Langmuir2014-01-301-3/+6
| | | | | | | In particular, #pragma clang __debug, and #include implicitly changed into @import were causing assertion failures. llvm-svn: 200475
* Remove dead code; MacroDirective's IsHidden flag is always false.Richard Smith2014-01-271-4/+1
| | | | llvm-svn: 200265
* Enforce safe usage of DiagnosticsEngine::getCustomDiagID()Alp Toker2014-01-261-1/+1
| | | | | | | | | | | | | | | | Replace the last incorrect uses and templatize the function to require a compile-time constant string preventing further misuse. The diagnostic formatter expects well-formed input and has undefined behaviour with arbitrary input or crafted user strings in source files. Accepting user input would also have caused unbounded generation of new diagnostic IDs which can be problematic in long-running sessions or language bindings. This completes the work to fix several incorrect callers that passed user input or raw messages to the diagnostics engine where a constant format string was expected. llvm-svn: 200132
* Fix cxx_variable_templates feature check and documentationAlp Toker2014-01-151-1/+1
| | | | | | | | | | This C++ feature has been marked complete since r191549, but the documentation claimed it wasn't supported at all and the extension check misreported it as being available in C. No regression test; this was a short-lived typo. llvm-svn: 199292
* Rename language option MicrosoftMode to MSVCCompatAlp Toker2014-01-143-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | There's been long-standing confusion over the role of these two options. This commit makes the necessary changes to differentiate them clearly, following up from r198936. MicrosoftExt (aka. fms-extensions): Enable largely unobjectionable Microsoft language extensions to ease portability. This mode, also supported by gcc, is used for building software like FreeBSD and Linux kernel extensions that share code with Windows drivers. MSVCCompat (aka. -fms-compatibility, formerly MicrosoftMode): Turn on a special mode supporting 'heinous' extensions for drop-in compatibility with the Microsoft Visual C++ product. Standards-compilant C and C++ code isn't guaranteed to work in this mode. Implies MicrosoftExt. Note that full -fms-compatibility mode is currently enabled by default on the Windows target, which may need tuning to serve as a reasonable default. See cfe-commits for the full discourse, thread 'r198497 - Move MS predefined type_info out of InitializePredefinedMacros' No change in behaviour. llvm-svn: 199209
* __has_attribute now understands target-specific attributes. So when you ask ↵Aaron Ballman2014-01-091-2/+2
| | | | | | whether an ARM target has the "interrupt" attribute, it will return true for ARM and MSP430 targets, and false for others. llvm-svn: 198897
* Sort all the #include lines with LLVM's utils/sort_includes.py whichChandler Carruth2014-01-075-6/+6
| | | | | | | encodes the canonical rules for LLVM's style. I noticed this had drifted quite a bit when cleaning up LLVM, so wanted to clean up Clang as well. llvm-svn: 198686
* Switch over more of the parser to err_expectedAlp Toker2013-12-301-2/+2
| | | | | | | Includes a fix for a missing highlight range caused by a ',' typo in the PP diagnostics. llvm-svn: 198252
* Cleanup: Switch the preprocessor to err_pp_expected_afterAlp Toker2013-12-302-6/+9
| | | | | | | | | | This is approaching consistency but the PP and Parse categories they still have slightly different wording: def err_pp_expected_after : Error<"missing %1 after %0">; def err_expected_after : Error<"expected %1 after %0">; llvm-svn: 198189
* Silence compile warning by removing unused SourceMgr memberWill Wilson2013-12-271-3/+2
| | | | llvm-svn: 198083
* Implement MSVC header search algorithm in MicrosoftMode.Will Wilson2013-12-272-68/+87
| | | | | | Follows algorithm described here: http://msdn.microsoft.com/en-us/library/36k2cdd4.aspx llvm-svn: 198082
* Support and use token kinds as diagnostic argumentsAlp Toker2013-12-242-5/+5
| | | | | | | | | | | | | | | | | | | Introduce proper facilities to render token spellings using the diagnostic formatter. Replaces most of the hard-coded diagnostic messages related to expected tokens, which all shared the same semantics but had to be multiply defined due to variations in token order or quote marks. The associated parser changes are largely mechanical but they expose commonality in whole chunks of the parser that can now be factored away. This commit uses C++11 typed enums along with a speculative legacy fallback until the transition is complete. Requires corresponding changes in LLVM r197895. llvm-svn: 197972
* Use this one little trick to prevent optimizers from removing anRichard Trieu2013-12-211-2/+3
| | | | | | intentional stack overflow. llvm-svn: 197849
* Enable layering check in unavailable modules.Daniel Jasper2013-12-202-83/+106
| | | | | | | | | | | | | | | If a header file belonging to a certain module is not found on the filesystem, that header gets marked as unavailable. Now, the layering warning (-fmodules-decluse) should still warn about headers of this module being wrongfully included. Currently, headers belonging to those modules are just treated as not belonging to modules at all which means they can be included freely from everywhere. To implement this (somewhat) cleanly, I have moved most of the layering checks into the ModuleMap. This will also help with showing FixIts later. llvm-svn: 197805
* Fix comment typo.Will Wilson2013-12-191-1/+1
| | | | llvm-svn: 197695
* Modules: Don't warn upon missing headers while reading the module map.Daniel Jasper2013-12-172-31/+26
| | | | | | | | | | | | | | | Instead, mark the module as unavailable so that clang errors as soon as someone tries to build this module. This works towards the long-term goal of not stat'ing the header files at all while reading the module map and instead read them only when the module is being built (there is a corresponding FIXME in parseHeaderDecl()). However, it seems non-trivial to get there and this unblock us and moves us into the right direction. Also changed the implementation to reuse the same DiagnosticsEngine. llvm-svn: 197485
* Revert "Modules: Make missing headers in a module.map a warning not an error."Daniel Jasper2013-12-162-11/+18
| | | | | | This was committed accidentally. llvm-svn: 197389
OpenPOWER on IntegriCloud