summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex
Commit message (Collapse)AuthorAgeFilesLines
...
* Lex and ignore Microsoft's #pragma warning(...)Reid Kleckner2013-09-131-1/+131
| | | | | | | | | | | | | | | | | Summary: This fixes PR17145 and avoids unknown pragma warnings. This change does not attempt to map MSVC warning numbers to clang warning flags. Perhaps in the future we will implement a mapping for some common subset of Microsoft warnings, but for now we don't. Reviewers: rsmith CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1652 llvm-svn: 190726
* Simplify code with the in place path::native. No functionality change.Benjamin Kramer2013-09-111-4/+2
| | | | llvm-svn: 190515
* Support for modular module-map-filesDaniel Jasper2013-09-111-2/+57
| | | | | | | | | | | | | | | | | | | This patch is the first step to make module-map-files modular (instead of requiring a single "module.map"-file per include directory). This step adds a new "extern module" declaration that enables module-map-files to reference one another along with a very basic implementation. The next steps are: * Combine this with the use-declaration (from http://llvm-reviews.chandlerc.com/D1546) in order to only load module map files required for a specific compilation. * Add an additional flag to start with a specific module-map-file (instead of requiring there to be at least one "module.map"). Review: http://llvm-reviews.chandlerc.com/D1637 llvm-svn: 190497
* Use new UnicodeCharSet interface.Alexander Kornienko2013-08-292-21/+41
| | | | | | | | | | | | | | Summary: This is a Clang part of http://llvm-reviews.chandlerc.com/D1534 Reviewers: jordan_rose, klimek, rsmith Reviewed By: rsmith CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1535 llvm-svn: 189583
* Fix "//" comments with -traditional-cpp in C++.Eli Friedman2013-08-281-2/+4
| | | | | | | | | Apparently, gcc's -traditional-cpp behaves slightly differently in C++ mode; specifically, it discards "//" comments. Match gcc's behavior. <rdar://problem/14808126> llvm-svn: 189515
* Use pop_back_val() instead of both back() and pop_back().Robert Wilhelm2013-08-231-4/+2
| | | | | | No functionality change intended. llvm-svn: 189112
* Respect -Wnewline-eof even in C++11 mode.Jordan Rose2013-08-231-4/+22
| | | | | | | | | | | If the user has requested this warning, we should emit it, even if it's not an extension in the current language mode. However, being an extension is more important, so prefer the pedantic warning or the pedantic-compatibility warning if those are enabled. <rdar://problem/12922063> llvm-svn: 189110
* Split isFromMainFile into two functions.Eli Friedman2013-08-221-1/+1
| | | | | | | | | Basically, isInMainFile considers line markers, and isWrittenInMainFile doesn't. Distinguishing between the two is useful when dealing with files which are preprocessed files or rewritten with -frewrite-includes (so we don't, for example, print useless warnings). llvm-svn: 188968
* Revert r188863 which could propose wrong fixits for multibyte character ↵Nick Lewycky2013-08-211-9/+3
| | | | | | literals. llvm-svn: 188918
* Issue fixits replacing invalid character literals with the equivalent \xNNNick Lewycky2013-08-211-3/+9
| | | | | | escape code. llvm-svn: 188863
* No functionality change. Adjust a bunch of formatting issues in this code andNick Lewycky2013-08-211-20/+20
| | | | | | fix a typo in a comment. llvm-svn: 188857
* ObjectiveC migrator: More work towardsFariborz Jahanian2013-08-201-2/+3
| | | | | | insertion of ObjC audit pragmas. llvm-svn: 188733
* Use isCharInSet from llvm/Support/UnicodeCharRanges.h, added a test for ↵Alexander Kornienko2013-08-091-89/+1
| | | | | | | | | | | | | | | | double-width characters in FixIt-hints. Summary: This is a follow-up to r187837. Reviewers: gribozavr, jordan_rose Reviewed By: jordan_rose CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1306 llvm-svn: 188056
* DataFlowSanitizer; Clang changes.Peter Collingbourne2013-08-071-0/+1
| | | | | | | | | | | | | DataFlowSanitizer is a generalised dynamic data flow analysis. Unlike other Sanitizer tools, this tool is not designed to detect a specific class of bugs on its own. Instead, it provides a generic dynamic data flow analysis framework to be used by clients to help detect application-specific issues within their own code. Differential Revision: http://llvm-reviews.chandlerc.com/D966 llvm-svn: 187925
* Add option to disable module loading.Daniel Jasper2013-08-052-10/+13
| | | | | | | This patch was created by Lawrence Crowl and reviewed in: http://llvm-reviews.chandlerc.com/D963 llvm-svn: 187738
* Use llvm::sys::fs::UniqueID for windows and unix.Rafael Espindola2013-08-011-28/+36
| | | | | | | | | | | | | | | | | | | This unifies the unix and windows versions of FileManager::UniqueDirContainer and FileManager::UniqueFileContainer by using UniqueID. We cannot just replace "struct stat" with llvm::sys::fs::file_status, since we want to be able to construct fake ones, and file_status has different members on unix and windows. What the patch does is: * Record only the information that clang is actually using. * Use llvm::sys::fs::status instead of stat and fstat. * Use llvm::sys::fs::UniqueID * Delete the old windows versions of UniqueDirContainer and UniqueFileContainer since the "unix" one now works on windows too. llvm-svn: 187619
* Support for Thread Safety Analysis in CDavid Blaikie2013-07-291-0/+1
| | | | | | Patch by Ethan Jackson. llvm-svn: 187365
* Reduce stack frame size by avoiding a large token vector on an error path.Bob Wilson2013-07-271-1/+1
| | | | | | | | | | | | | | | | | Beginning with svn r186971, we noticed an internal test started to fail when using clang built with LTO. After much investigation, it turns out that there are no blatant bugs here, we are just running out of stack space and crashing. Preprocessor::ReadFunctionLikeMacroArgs already has one vector of 64 Tokens, and r186971 added another. When built with LTO, that function is inlined into Preprocessor::HandleMacroExpandedIdentifier, which for our internal test is invoked in a deep recursive cycle. I'm leaving the original 64 Token vector alone on the assumption that it is important for performance, but the new FixedArgTokens vector is only used on an error path, so it should be OK if it requires additional heap storage. It would be even better if we could avoid the deep recursion, but I think this change is a good thing to do regardless. <rdar://problem/14540345> llvm-svn: 187315
* Fix GNU ObjC ABI for a message returning a struct.Eli Friedman2013-07-261-0/+1
| | | | | | | | | This allows the ObjFW runtime to correctly implement message forwarding for messages which return a struct. Patch by Jonathan Schleifer. llvm-svn: 187174
* Partially revert r186903.Eli Friedman2013-07-261-1/+1
| | | | | | | | It turns out that Plum Hall depends on us not emitting an error on integer literals which fit into long long, but fit into unsigned long long. So C99 conformance requires not conforming to C99. :) llvm-svn: 187172
* Rename feature test for lambda init-captures from cxx_generalized_capture toRichard Smith2013-07-241-2/+2
| | | | | | | | cxx_init_capture. "generalized" is neither descriptive nor future-proof. No compatibility problems expected, since we've never advertised having this feature. llvm-svn: 187058
* Update documentation to match current C++1y feature set.Richard Smith2013-07-241-2/+2
| | | | llvm-svn: 187055
* Add new diagnostic messages when too many arguments are presented to aRichard Trieu2013-07-231-16/+191
| | | | | | | | | | | | | function-like macro. Clang will attempt to correct the arguments by detecting braced initializer lists: 1) If possible, suggest parentheses around arguments containing braced lists which will give the proper number of arguments. 2) If a braced list is detected at the start of a macro argument, it cannot be corrected by parentheses. Instead, just point out the location of these braced lists. llvm-svn: 186971
* C++1y literal suffix support:Richard Smith2013-07-232-11/+69
| | | | | | | * Allow ns, us, ms, s, min, h as numeric ud-suffixes * Allow s as string ud-suffix llvm-svn: 186933
* Integers which are too large should be an error.Eli Friedman2013-07-232-6/+6
| | | | | | | | Switch some warnings over to errors which should never have been warnings in the first place. (Also, a minor fix to the preprocessor rules for integer literals while I'm here.) llvm-svn: 186903
* Added preproc callback for pragma directives.Enea Zaffanella2013-07-202-5/+9
| | | | llvm-svn: 186770
* Add SourceRange to PPCallbacks::Defined callback.John Thompson2013-07-192-10/+16
| | | | llvm-svn: 186707
* Add condition expression result to if and elif callbacks.John Thompson2013-07-182-4/+8
| | | | llvm-svn: 186547
* Don't give # and ## special treatment when in -traditional-cpp mode. Patch byRichard Smith2013-07-091-0/+12
| | | | | | Austin Seipp! llvm-svn: 185896
* Generalize hack allowing 'const' in __has_attribute (etc) to allow any tokenRichard Smith2013-07-091-3/+1
| | | | | | | with identifier info. This covers most identifier-like entities (other than the ISO646 keywords). llvm-svn: 185895
* Use SmallVectorImpl& for function arguments instead of SmallVector.Craig Topper2013-07-051-1/+1
| | | | llvm-svn: 185715
* Lex: Cleanup whitespace in PragmaRegionHandlerDavid Majnemer2013-06-301-22/+22
| | | | llvm-svn: 185280
* Use the multiple argument form of path::append.Benjamin Kramer2013-06-281-10/+5
| | | | llvm-svn: 185164
* Match MSVC's handling of commas during macro argument expansionReid Kleckner2013-06-262-1/+14
| | | | | | | | | | | | This allows clang to parse the type_traits header in Visual Studio 2012, which is included widely in practice. This is a rework of r163022 by João Matos. The original patch broke preprocessing of gtest headers, which this patch addresses. Patch by Will Wilson! llvm-svn: 184968
* [Modules] If a module map resides in a system header directory, treat it as ↵Douglas Gregor2013-06-212-26/+35
| | | | | | | | | a system module. This prevents -pedantic from causing warnings in the system headers used to create modules. Fixes <rdar://problem/14201171>. llvm-svn: 184560
* This patch adds new private headers to the module map. PrivateLawrence Crowl2013-06-205-57/+110
| | | | | | | headers may be included from within the module, but not from outside the module. llvm-svn: 184471
* Make sure the assembler-with-cpp hack for "#" works with multiple "#"s inEli Friedman2013-06-181-0/+2
| | | | | | succession. Fixes PR16363. llvm-svn: 184240
* PR16339: Don't produce a diagnostic pointing at the whitespace between a '#if'Richard Smith2013-06-161-1/+2
| | | | | | | | and a '!defined(X)' if we find a broken header guard. This is suboptimal; we should point the diagnostic at the 'X' token not the 'if' token, but it fixes the crash. llvm-svn: 184054
* Introducing -Wheader-guard, a warning that checks header guards actually workRichard Trieu2013-06-122-5/+36
| | | | | | | | properly. This warning checks that the #ifndef and #define directives at the beginning of a header refer to the same macro name. Includes a fix-it hint to correct the header guard. llvm-svn: 183867
* Include Path.h instead of PathV2.h.Rafael Espindola2013-06-112-2/+2
| | | | | | I am about to move PathV2.h to Path.h. llvm-svn: 183795
* [Preprocessor] Prevent expansion of y in x ## y when x is emptyArgyrios Kyrtzidis2013-05-251-7/+13
| | | | | | | | | | | | When x is empty, x ## is suppressed, and when y gets expanded, the fact that it follows ## is not available in the macro expansion result. The macro definition can be checked instead, the ## will be available there regardless of what x expands to. Fixes http://llvm.org/PR12767 Patch by Harald van Dijk! llvm-svn: 182699
* Replace Count{Leading,Trailing}Zeros_{32,64} with count{Leading,Trailing}Zeros.Michael J. Spencer2013-05-241-1/+1
| | | | llvm-svn: 182675
* [modules] If we hit a failure while loading a PCH/module, abort parsing ↵Argyrios Kyrtzidis2013-05-242-0/+20
| | | | | | | | | | instead of trying to continue in an invalid state. Also don't let libclang create a PCH with such an error. Fixes rdar://13953768 llvm-svn: 182629
* Add -Wincomplete-module, which detects when a header is included from a ↵Douglas Gregor2013-05-201-1/+29
| | | | | | module but isn't itself part of a module. llvm-svn: 182263
* [Lexer] Improve Lexer::getSourceText() when the given range deals with ↵Argyrios Kyrtzidis2013-05-161-33/+24
| | | | | | | | function macro arguments. This is a modified version of a patch by Manuel Klimek. llvm-svn: 182055
* Use only explicit bool conversion operatorDavid Blaikie2013-05-153-3/+3
| | | | | | | | | | | | | | | | | | | The most common (non-buggy) case are where such objects are used as return expressions in bool-returning functions or as boolean function arguments. In those cases I've used (& added if necessary) a named function to provide the equivalent (or sometimes negative, depending on convenient wording) test. DiagnosticBuilder kept its implicit conversion operator owing to the prevalent use of it in return statements. One bug was found in ExprConstant.cpp involving a comparison of two PointerUnions (PointerUnion did not previously have an operator==, so instead both operands were converted to bool & then compared). A test is included in test/SemaCXX/constant-expression-cxx1y.cpp for the fix (adding operator== to PointerUnion in LLVM). llvm-svn: 181869
* C++1y: provide full 'auto' return type deduction for lambda expressions. ThisRichard Smith2013-05-121-1/+1
| | | | | | completes the implementation of N3638. llvm-svn: 181669
* [Modules] Make r180934 more efficient by only loading top-level module maps ↵Douglas Gregor2013-05-102-2/+15
| | | | | | in system header directories. llvm-svn: 181643
* Typo and misc comment fix.Richard Smith2013-05-101-2/+4
| | | | llvm-svn: 181583
* [PCH] Remove the ASTReaderListener::ReadHeaderFileInfo callback.Argyrios Kyrtzidis2013-05-081-7/+0
| | | | | | | | This made sense in pre-module era, before merging of HeaderFileInfos was introduced. Final part of rdar://13840148. llvm-svn: 181490
OpenPOWER on IntegriCloud