summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex
Commit message (Collapse)AuthorAgeFilesLines
* Remove unused LangOpts private variable in HeaderSearch.Samuel Antao2016-04-271-2/+1
| | | | | | Was causing warnings during the build. llvm-svn: 267805
* [modules] When diagnosing a missing module import, suggest adding a #include ifRichard Smith2016-04-273-12/+114
| | | | | | | the current language doesn't have an import syntax and we can figure out a suitable file to include. llvm-svn: 267802
* [esan] EfficiencySanitizer driver flagsDerek Bruening2016-04-211-0/+2
| | | | | | | | | | | | | | | | Summary: Adds a framework to enable the instrumentation pass for the new EfficiencySanitizer ("esan") family of tools. Adds a flag for esan's cache fragmentation tool via -fsanitize=efficiency-cache-frag. Adds appropriate tests for the new flag. Reviewers: eugenis, vitalybuka, aizatsky, filcab Subscribers: filcab, kubabrecka, llvm-commits, zhaoqin, kcc Differential Revision: http://reviews.llvm.org/D19169 llvm-svn: 267059
* [modules] Make the tweak to avoid circular inclusion of emmintrin.h andRichard Smith2016-04-211-11/+4
| | | | | | | | | xmmintrin.h a bit more directed. If for whatever reason modules are enabled but we textually include one of these headers, don't deploy the special case for modules. To make this work cleanly, extend __building_module to be defined even when modules is disabled. llvm-svn: 266945
* Improve diagnostic for the case when a non-defined function-like macro is usedRichard Smith2016-04-161-4/+26
| | | | | | in a preprocessor constant expression. llvm-svn: 266495
* Revert 266186 as it breaks anything that includes type_traits on some platformsNemanja Ivanovic2016-04-151-11/+2
| | | | | | | | | | Since this patch provided support for the __float128 type but disabled it on all platforms by default, some platforms can't compile type_traits with -std=gnu++11 since there is a specialization with __float128. This reverts the patch until D19125 is approved (i.e. we know which platforms need this support enabled). llvm-svn: 266460
* Enable support for __float128 in ClangNemanja Ivanovic2016-04-131-2/+11
| | | | | | | | | | | | | | | | This patch corresponds to review: http://reviews.llvm.org/D15120 It adds support for the __float128 keyword, literals and a target feature to enable it. This support is disabled by default on all targets and any target that has support for this type is free to add it. Based on feedback that I've received from target maintainers, this appears to be the right thing for most targets. I have not heard from the maintainers of X86 which I believe supports this type. I will subsequently investigate the impact of enabling this on X86. llvm-svn: 266186
* [modules] Extend r266113 to cope with submodules.Richard Smith2016-04-121-1/+3
| | | | llvm-svn: 266116
* [modules] When an incompatible module file is explicitly provided for a module,Richard Smith2016-04-121-1/+4
| | | | | | | | and we fall back to textual inclusion, don't require the module as a whole to be marked available; it's OK if some other file in the same module is missing, just as it would be if the header were explicitly marked textual. llvm-svn: 266113
* Consolidate and improve the handling of built-in feature-like macrosAndy Gibbs2016-04-051-161/+208
| | | | | | | | | | | | | | | | | | Summary: The parsing logic has been separated out from the macro implementation logic, leading to a number of improvements: * Gracefully handle unexpected/invalid tokens, too few, too many and nested parameters * Provide consistent behaviour between all built-in feature-like macros * Simplify the implementation of macro logic * Fix __is_identifier to correctly return '0' for non-identifiers Reviewers: doug.gregor, rsmith Subscribers: rsmith, cfe-commits Differential Revision: http://reviews.llvm.org/D17149 llvm-svn: 265381
* AnnotateFunctions: Tweak for mingw.NAKAMURA Takumi2016-04-041-0/+2
| | | | | | | - Externalize the registry. - Update libdeps. llvm-svn: 265301
* Add a PragmaHandler Registry for plugins to add PragmaHandlers toJohn Brawn2016-04-041-0/+7
| | | | | | | | | | This allows plugins which add AST passes to also define pragmas to do things like only enable certain behaviour of the AST pass in files where a certain pragma is used. Differential Revision: http://reviews.llvm.org/D18319 llvm-svn: 265295
* Diagnose missing macro argument following charize operator.Andy Gibbs2016-04-011-2/+3
| | | | | | | For completeness, add a test-case for the equivalent stringize operator diagnostic too. llvm-svn: 265177
* [Lexer] Let the compiler infer string lengths. No functionality change intended.Benjamin Kramer2016-04-011-2/+2
| | | | llvm-svn: 265126
* [Lexer] Don't read out of bounds if a conflict marker is at the end of a fileBenjamin Kramer2016-04-011-1/+1
| | | | | | | | | | This can happen as we look for '<<<<' while scanning tokens but then expect '<<<<\n' to tell apart perforce from diff3 conflict markers. Just harden the pointer arithmetic. Found by libfuzzer + asan! llvm-svn: 265125
* [CrashReproducer] Add a module map callback for added headersBruno Cardoso Lopes2016-03-301-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current ModuleDependencyCollector has a AST listener to collect header files present in loaded modules, but this isn't enough to collect all headers needed in the crash reproducer. One of the reasons is that the AST writer doesn't write symbolic link header paths in the pcm modules, this makes the listeners on the reader only able to collect the real files. Since the module maps could contain submodules that use headers which are symbolic links, not collecting those forbid the reproducer scripts to regen the modules. For instance: usr/include/module.map: ... module pthread { header "pthread.h" export * module impl { header "pthread_impl.h" export * } } ... usr/include/pthread/pthread_impl.h usr/include/pthread_impl.h -> pthread/pthread_impl.h The AST dump for the module above: <SUBMODULE_HEADER abbrevid=6/> blob data = 'pthread_impl.h' <SUBMODULE_TOPHEADER abbrevid=7/> blob data = '/<path_to_sdk>/usr/include/pthread/pthread_impl.h' Note that we don't have "usr/include/pthread_impl.h" which is requested by the module.map in case we want to reconstruct the module in the reproducer. The reason the original symbolic link path isn't used is because the headers are kept by name and requested through the FileManager, which unique files and returns the real path only. To fix that, add a callback to be invoked everytime a header is added while parsing module maps and hook that up to the module dependecy collector. This callback is only registered when generating the reproducer. Differential Revision: http://reviews.llvm.org/D18585 rdar://problem/24499339 llvm-svn: 264971
* Add replacement = "xxx" to AvailabilityAttr.Manman Ren2016-03-211-0/+1
| | | | | | | | | | | | This commit adds a named argument to AvailabilityAttr, while r263652 adds an optional string argument to __attribute__((deprecated)). This was commited in r263687 and reverted in 263752 due to misaligned access. rdar://20588929 llvm-svn: 263958
* Revert r263687 for ubsan bot failure.Manman Ren2016-03-171-1/+0
| | | | llvm-svn: 263752
* Add an optional named argument (replacement = "xxx") to AvailabilityAttr.Manman Ren2016-03-171-0/+1
| | | | | | | | | | This commit adds a named argument to AvailabilityAttr, while r263652 adds an optional string argument to __attribute__((deprecated)). This enables the compiler to provide Fix-Its for deprecated declarations. rdar://20588929 llvm-svn: 263687
* Add an optional string argument to DeprecatedAttr for Fix-It.Manman Ren2016-03-161-0/+1
| | | | | | | | We only add this to __attribute__((deprecated)). Differential Revision: http://reviews.llvm.org/D17865 llvm-svn: 263652
* [modules] Don't diagnose non-modular includes from modular files that areRichard Smith2016-03-142-4/+9
| | | | | | implementation units of modules rather than interface units. llvm-svn: 263449
* Add has_feature objc_class_property.Manman Ren2016-03-101-0/+1
| | | | | | rdar://23891898 llvm-svn: 263171
* [Modules] Add stdatomic to the list of builtin headersBen Langmuir2016-03-091-0/+1
| | | | | | | | | | | | | Since it's provided by the compiler. This allows a system module map file to declare a module for it. No test change for cstd.m, since stdatomic.h doesn't function without a relatively complete stdint.h and stddef.h, which tests using this module don't provide. rdar://problem/24931246 llvm-svn: 263076
* [Modules] Modernize, use range-based loops.Davide Italiano2016-03-081-5/+2
| | | | llvm-svn: 262969
* [Modules] Don't swallow errors when parsing optional attributes.Davide Italiano2016-03-061-3/+8
| | | | | | Differential Revision: http://reviews.llvm.org/D17787 llvm-svn: 262789
* Update diagnostics now that hexadecimal literals look likely to be part of ↵Richard Smith2016-03-042-6/+13
| | | | | | C++17. llvm-svn: 262753
* SemaCXX: Support templates in availability attributesDuncan P. N. Exon Smith2016-02-261-0/+1
| | | | | | | | | | | | | | | | | | | If the availability context is `FunctionTemplateDecl`, we should look through it to the `FunctionDecl`. This prevents a diagnostic in the following case: class C __attribute__((unavailable)); template <class T> void foo(C&) __attribute__((unavailable)); This adds tests for availability in templates in many other cases, but that was the only case that failed before this patch. I added a feature `__has_feature(attribute_availability_in_templates)` so users can test for this. rdar://problem/24561029 llvm-svn: 262050
* Revert "Don't convert a char to a const char *"David Majnemer2016-02-241-1/+1
| | | | | | | | This reverts commit r261780. It turns out the original code was just fine. An overload for ltrim which takes char was added but the Doxygen docs haven't seemed to pick it up. llvm-svn: 261784
* Don't convert a char to a const char *David Majnemer2016-02-241-1/+1
| | | | | | This fixes PR26728. llvm-svn: 261780
* PR24667: fix quadratic runtime if textually-included modular headers define ↵Richard Smith2016-02-232-22/+52
| | | | | | large numbers of macros. llvm-svn: 261705
* Lex: Return "" when HeaderMap::lookupFilename failsDuncan P. N. Exon Smith2016-02-231-13/+24
| | | | | | | | | | | | Change getString() to return Optional<StringRef>, and change lookupFilename() to return an empty string if either one of the prefix and suffix can't be found. This is a more robust follow-up to r261461, but it's still not entirely satisfactory. Ideally we'd report that the header map is corrupt; perhaps something for a follow-up. llvm-svn: 261596
* Lex: Check for 0 buckets on header map constructionDuncan P. N. Exon Smith2016-02-221-5/+5
| | | | | | | | Switch to using `isPowerOf2_32()` to check whether the buckets are a power of two, and as a side benefit reject loading a header map with no buckets. This is a follow-up to r261448. llvm-svn: 261585
* Add has_feature attribute_availability_with_strict.Manman Ren2016-02-221-0/+1
| | | | | | rdar://23791325 llvm-svn: 261548
* Lex: Never overflow the file in HeaderMap::lookupFilename()Duncan P. N. Exon Smith2016-02-211-5/+11
| | | | | | | | | | | | | | | | If a header map file is corrupt, the strings in the string table may not be null-terminated. The logic here previously relied on `MemoryBuffer` always being null-terminated, but this isn't actually guaranteed by the class AFAICT. Moreover, we're seeing a lot of crash traces at calls to `strlen()` inside of `lookupFilename()`, so something is going wrong there. Instead, use `strnlen()` to get the length, and check for corruption. Also remove code paths that could call `StringRef(nullptr)`. r261459 made these rather obvious (although they'd been there all along). llvm-svn: 261461
* Lex: Change HeaderMapImpl::getString() to return StringRef, NFCDuncan P. N. Exon Smith2016-02-201-4/+4
| | | | llvm-svn: 261459
* Lex: Use dbgs() instead of fprintf() in HeaderMap::dump()Duncan P. N. Exon Smith2016-02-201-5/+5
| | | | | | | | | | This way it's easy to change HeaderMapImpl::getString() to return a StringRef. There's a slight change here, because I used `errs()` instead of `dbgs()`. But `dbgs()` is more appropriate for a dump method. llvm-svn: 261456
* Lex: Check whether the header map buffer has space for the bucketsDuncan P. N. Exon Smith2016-02-201-10/+10
| | | | | | | | | | | | | Check up front whether the header map buffer has space for all of its declared buckets. There was already a check in `getBucket()`, but it had UB (comparing pointers that were outside of objects in the error path) and was insufficient (only checking for a single byte of the relevant bucket). I fixed the check, moved it to `checkHeader()`, and left a fixed version behind as an assertion. llvm-svn: 261449
* Lex: Check buckets on header map constructionDuncan P. N. Exon Smith2016-02-201-4/+12
| | | | | | | | If the number of buckets is not a power of two, immediately recognize the header map as corrupt, rather than waiting for the first lookup. I converted the later check to an assert. llvm-svn: 261448
* Lex: Add some unit tests for corrupt header mapsDuncan P. N. Exon Smith2016-02-201-48/+28
| | | | | | | | | | | | Split the implementation of `HeaderMap` into `HeaderMapImpl` so that we can write unit tests that don't depend on the `FileManager`, and then write a few tests that cover the types of corrupt header maps already detected. This also moves type and constant definitions from HeaderMap.cpp to HeaderMapTypes.h so that the test can access them. llvm-svn: 261446
* [modules] Do less scanning of macro definition chains when computing the set ofRichard Smith2016-02-191-5/+20
| | | | | | | exported module macros outside local submodule visibility mode. Related to PR24667. llvm-svn: 261373
* [modules] Flatten -fmodule-name= and -fmodule-implementation-of= into a singleRichard Smith2016-02-194-41/+32
| | | | | | | | | | | | option. Previously these options could both be used to specify that you were compiling the implementation file of a module, with a different set of minor bugs in each case. This change removes -fmodule-implementation-of, and instead tracks a flag to determine whether we're currently building a module. -fmodule-name now behaves the same way that -fmodule-implementation-of previously did. llvm-svn: 261372
* Remove use of builtin comma operator.Richard Trieu2016-02-182-3/+7
| | | | | | Cleanup for upcoming Clang warning -Wcomma. No functionality change intended. llvm-svn: 261271
* [OpenCL] Added half type literal with suffix h.Anastasia Stulova2016-02-171-2/+12
| | | | | | | | | | | | | OpenCL Extension v1.2 s9.5 allows half precision floating point type literals with suffices h or H when cl_khr_fp16 is enabled. Example: half x = 1.0h; Patch by Liu Yaxun (Sam)! Differential Revision: http://reviews.llvm.org/D16865 llvm-svn: 261084
* Simplify users of StringRef::{l,r}trim (clang) (NFC)Vedant Kumar2016-02-161-1/+1
| | | | | | | r260925 introduced a version of the *trim methods which is preferable when trimming a single kind of character. Update all users in clang. llvm-svn: 260927
* Fix use after free.Benjamin Kramer2016-02-131-1/+1
| | | | | | Found by asan. llvm-svn: 260814
* Accept "-Weverything" in clang diagnistic pragmasSunil Srivastava2016-02-131-4/+13
| | | | | | Differential Revision: http://reviews.llvm.org/D15095 llvm-svn: 260788
* Fix remaining Clang-tidy readability-redundant-control-flow warnings; other ↵Eugene Zelenko2016-02-122-17/+4
| | | | | | | | minor fixes. Differential revision: http://reviews.llvm.org/D17218 llvm-svn: 260757
* PR26349: correctly check whether a digit sequence is empty in the presence ↵Richard Smith2016-02-091-6/+8
| | | | | | of digit separators. llvm-svn: 260307
* Simplify EnterTokenStream API to make it more robust for memory managementDavid Blaikie2016-02-093-16/+15
| | | | | | | | | | | | | | | While this won't help fix things like the bug that r260219 addressed, it seems like good tidy up to have anyway. (it might be nice if "makeArrayRef" always produced a MutableArrayRef & let it decay to an ArrayRef when needed - then I'd use that for the MutableArrayRefs in this patch) If we had std::dynarray I'd use that instead of unique_ptr+size_t, ideally (but then it'd have to be threaded down through the Preprocessor all the way - no idea how painful that would be) llvm-svn: 260246
* [OpenCL] Adding reserved operator logical xor for OpenCLAnastasia Stulova2016-02-031-0/+3
| | | | | | | | | | | | | | | | | | This patch adds the reserved operator ^^ when compiling for OpenCL (spec v1.1 s6.3.g), which results in a more meaningful error message. Patch by Neil Hickey! Review: http://reviews.llvm.org/D13280 M test/SemaOpenCL/unsupported.cl M include/clang/Basic/TokenKinds.def M include/clang/Basic/DiagnosticParseKinds.td M lib/Basic/OperatorPrecedence.cpp M lib/Lex/Lexer.cpp M lib/Parse/ParseExpr.cpp llvm-svn: 259651
OpenPOWER on IntegriCloud