summaryrefslogtreecommitdiffstats
path: root/clang
Commit message (Collapse)AuthorAgeFilesLines
* [modules] Add ability to specify module name to module file mapping (reapply)Boris Kolpackov2017-08-3116-49/+208
| | | | | | | | | | | | | | | | | | | | Extend the -fmodule-file option to support the [<name>=]<file> value format. If the name is omitted, then the old semantics is preserved (the module file is loaded whether needed or not). If the name is specified, then the mapping is treated as just another prebuilt module search mechanism, similar to -fprebuilt-module-path, and the module file is only loaded if actually used (e.g., via import). With one exception: this mapping also overrides module file references embedded in other modules (which can be useful if module files are moved/renamed as often happens during remote compilation). This override semantics requires some extra work: we now store the module name in addition to the file name in the serialized AST representation. Reviewed By: rsmith Differential Revision: https://reviews.llvm.org/D35020 llvm-svn: 312220
* Remove accidental newline.Nico Weber2017-08-311-1/+0
| | | | llvm-svn: 312218
* Fix path regex in test to match on WindowsBoris Kolpackov2017-08-311-1/+1
| | | | llvm-svn: 312217
* Suppress -Wdelete-non-virtual-dtor warnings about classes defined in system ↵Nico Weber2017-08-312-0/+17
| | | | | | | | | | | | | | | | headers. r312167 made it so that we emit Wdelete-non-virtual-dtor from delete statements that are in system headers (e.g. std::unique_ptr). That works great on Linux and macOS, but on Windows there are non-final classes that are defined in system headers that have virtual methods but non-virtual destructors and yet get deleted through a base class pointer (e.g. ATL::CAccessToken::CRevert). So paddle back a bit and don't emit the warning if it's about a class defined in a system header. https://reviews.llvm.org/D37324 llvm-svn: 312216
* Fix the test fix from r312181Hans Wennborg2017-08-303-5/+5
| | | | llvm-svn: 312193
* [cxx_status] Update to describe current status a bit better.Richard Smith2017-08-301-4/+5
| | | | llvm-svn: 312191
* [Sema] Make SpecialMemberDecl a PointerIntPair so we can stash it in a ↵Benjamin Kramer2017-08-301-2/+3
| | | | | | | | | SmallPtrSet. We have enough spare bits in the alignment of CXXRecordDecl. No functionality change intended. llvm-svn: 312186
* [SanitizeCoverage] Enable stack-depth coverage for -fsanitize=fuzzerMatt Morehouse2017-08-301-1/+5
| | | | | | | | | | | | | | | | | | Summary: - Don't sanitize __sancov_lowest_stack. - Don't instrument leaf functions. - Add CoverageStackDepth to Fuzzer and FuzzerNoLink. - Only enable on Linux. Reviewers: vitalybuka, kcc, george.karpenkov Reviewed By: kcc Subscribers: kubamracek, cfe-commits, llvm-commits, hiraditya Differential Revision: https://reviews.llvm.org/D37156 llvm-svn: 312185
* Fix tests for ARM targetsDouglas Yung2017-08-303-3/+3
| | | | | | | | | | Tests fail on ARM targets due to ABI name between define and void. Added reg ex to skip. Patch by Glenn Howe (and expanded on by Douglas Yung)! Differential Revision: https://reviews.llvm.org/D33410 llvm-svn: 312181
* Test-case golfing.Adrian Prantl2017-08-301-33/+17
| | | | llvm-svn: 312175
* [CodeGen][x86_64] Enable 'force_align_arg_pointer' attribute at x86_64Erich Keane2017-08-303-1/+20
| | | | | | | | | | | | | This attribute is useful in OS development when we jump from 32 to 64 bit code and expect that 64bit function forces correct stack alignment. Related discussion: http://lists.llvm.org/pipermail/cfe-dev/2017-June/054358.html Patch By: anatol.pomozov (anatol.pomozov@gmail.com) Differential Revision:https://reviews.llvm.org/D36272 llvm-svn: 312173
* Let -Wdelete-non-virtual-dtor fire in system headers too.Nico Weber2017-08-304-16/+49
| | | | | | | | | | | | | Makes the warning useful again in a std::unique_ptr world, PR28460. Also make the warning not fire in unevaluated contexts, since system libraries (e.g. libc++) do do that. This would've been a good change before we started emitting this warning in system headers too, but "normal" code seems to be less template-heavy, so we didn't notice until now. https://reviews.llvm.org/D37235 llvm-svn: 312167
* docs: typo fixHans Wennborg2017-08-301-4/+3
| | | | llvm-svn: 312149
* Adapt testcases to LLVM change r312144 in DIGlobalVariableExpressionAdrian Prantl2017-08-309-33/+33
| | | | llvm-svn: 312148
* [X86] Implement broadcastf32x2 and broadcasti32x2 intrinsics using ↵Craig Topper2017-08-305-65/+72
| | | | | | | | | | __builtin_shufflevector instead builtins This patch implements the broadcastf32x2/broadcasti32x2 intrinsics using __builtin_shufflevector. Differential Revision: https://reviews.llvm.org/D37287 llvm-svn: 312135
* Avoid 'size_t' typedef in the unittest ObjC codeAlex Lorenz2017-08-301-3/+3
| | | | | | | This should fix http://bb.pgr.jp/builders/test-clang-msc-x64-on-i686-linux-RA llvm-svn: 312133
* Recommit r312127: [refactor] AST selection tree should contain syntacticAlex Lorenz2017-08-303-1/+162
| | | | | | | | | | | | | | | | form of PseudoObjectExpr The new commit adjusts unittest test code compilation options so that the Objective-C code in the unittest can be parsed on non-macOS platforms. Original message: The AST selection finder now constructs a selection tree that contains only the syntactic form of PseudoObjectExpr. This form of selection tree is more meaningful when doing downstream analysis as we're interested in the syntactic features of the AST and the correct lexical parent relation. llvm-svn: 312132
* Revert r312127 as the ObjC unittest code fails to compile on LinuxAlex Lorenz2017-08-302-158/+0
| | | | llvm-svn: 312131
* [refactor] AST selection tree should contain syntactic formAlex Lorenz2017-08-302-0/+158
| | | | | | | | | | | of PseudoObjectExpr The AST selection finder now constructs a selection tree that contains only the syntactic form of PseudoObjectExpr. This form of selection tree is more meaningful when doing downstream analysis as we're interested in the syntactic features of the AST and the correct lexical parent relation. llvm-svn: 312127
* clang-format: Add preprocessor directive indentationKrasimir Georgiev2017-08-309-7/+332
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This is an implementation for [bug 17362](https://bugs.llvm.org/attachment.cgi?bugid=17362) which adds support for indenting preprocessor statements inside if/ifdef/endif. This takes previous work from fmauch (https://github.com/fmauch/clang/tree/preprocessor_indent) and makes it into a full feature. The context of this patch is that I'm a VMware intern, and I implemented this because VMware needs the feature. As such, some decisions were made based on what VMware wants, and I would appreciate suggestions on expanding this if necessary to use-cases other people may want. This adds a new enum config option, `IndentPPDirectives`. Values are: * `PPDIS_None` (in config: `None`): ``` #if FOO #if BAR #include <foo> #endif #endif ``` * `PPDIS_AfterHash` (in config: `AfterHash`): ``` #if FOO # if BAR # include <foo> # endif #endif ``` This is meant to work whether spaces or tabs are used for indentation. Preprocessor indentation is independent of indentation for non-preprocessor lines. Preprocessor indentation also attempts to ignore include guards with the checks: 1. Include guards cover the entire file 2. Include guards don't have `#else` 3. Include guards begin with ``` #ifndef <var> #define <var> ``` This patch allows `UnwrappedLineParser::PPBranchLevel` to be decremented to -1 (the initial value is -1) so the variable can be used for indent tracking. Defects: * This patch does not handle the case where there's code between the `#ifndef` and `#define` but all other conditions hold. This is because when the #define line is parsed, `UnwrappedLineParser::Lines` doesn't hold the previous code line yet, so we can't detect it. This is out of the scope of this patch. * This patch does not handle cases where legitimate lines may be outside an include guard. Examples are `#pragma once` and `#pragma GCC diagnostic`, or anything else that does not change the meaning of the file if it's included multiple times. * This does not detect when there is a single non-preprocessor line in front of an include-guard-like structure where other conditions hold because `ScopedLineState` hides the line. * Preprocessor indentation throws off `TokenAnnotator::setCommentLineLevels` so the indentation of comments immediately before indented preprocessor lines is toggled on each run. Fixing this issue appears to be a major change and too much complexity for this patch. Contributed by @euhlmann! Reviewers: djasper, klimek, krasimir Reviewed By: djasper, krasimir Subscribers: krasimir, mzeren-vmw, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D35955 llvm-svn: 312125
* Driver: out-of-line static analyzer flag handling (NFC)Saleem Abdulrasool2017-08-301-72/+74
| | | | | | | | Extract the analyzer flag handling into its own function to reduce the overall complexity of the construction of the clang compiler arguments. NFC. llvm-svn: 312124
* [refactor] Examine the whole range for ObjC @implementation declsAlex Lorenz2017-08-302-2/+35
| | | | | | when computing the AST selection llvm-svn: 312121
* Revert r312105 [modules] Add ability to specify module name to module file ↵Victor Leschuk2017-08-3016-208/+49
| | | | | | | | mapping Looks like it breaks win10 builder. llvm-svn: 312112
* Add test case that was broken by r311970.Martin Bohme2017-08-301-0/+16
| | | | | | | | | See also discussion here: https://reviews.llvm.org/rL301963 As far as I can tell, this discussion was never resolved. llvm-svn: 312109
* Revert "Improve constant expression evaluation of arrays of unknown bound."Martin Bohme2017-08-304-97/+27
| | | | | | | | This reverts commit r311970. Breaks internal tests. llvm-svn: 312108
* [docs] Regenerate command line options referenceBoris Kolpackov2017-08-301-4/+53
| | | | llvm-svn: 312106
* [modules] Add ability to specify module name to module file mappingBoris Kolpackov2017-08-3016-49/+208
| | | | | | | | | | | | | | | | | | | | Extend the -fmodule-file option to support the [<name>=]<file> value format. If the name is omitted, then the old semantics is preserved (the module file is loaded whether needed or not). If the name is specified, then the mapping is treated as just another prebuilt module search mechanism, similar to -fprebuilt-module-path, and the module file is only loaded if actually used (e.g., via import). With one exception: this mapping also overrides module file references embedded in other modules (which can be useful if module files are moved/renamed as often happens during remote compilation). This override semantics requires some extra work: we now store the module name in addition to the file name in the serialized AST representation. Reviewed By: rsmith Differential Revision: https://reviews.llvm.org/D35020 llvm-svn: 312105
* Give a better error if auto deduction fails due to inconsistent element ↵Richard Smith2017-08-303-26/+77
| | | | | | types in a braced initializer list. llvm-svn: 312085
* Driver: refactor SSP argument handling (NFC)Saleem Abdulrasool2017-08-291-48/+59
| | | | | | | | Out-of-line the SSP argument handling for the sake of readability. Pass along some state information to avoid re-computing the command line flags. llvm-svn: 312084
* Driver: refactor OpenCL argument forwardingSaleem Abdulrasool2017-08-291-38/+26
| | | | | | | | | | | Extract the argument forwarding for OpenCL arguments. Make this more data driven as we are just repeating the argument name and spelling. This costs a slight bit more memory due to the string duplication, but makes it easier to follow. It should be possible to forward the internal string representation from the TableGen data to avoid this. But, this makes the code simpler to follow for now. llvm-svn: 312083
* Driver: reuse existing `D` variable (NFC)Saleem Abdulrasool2017-08-291-10/+9
| | | | | | | Change the rest of the function to use the `D` variable for the driver instance. NFC. llvm-svn: 312082
* Driver: hoist a local variable (NFC)Saleem Abdulrasool2017-08-291-32/+27
| | | | | | | Hoist the `getToolChain().getTriple()` to a variable rather than re-fetching it every time. NFC. llvm-svn: 312081
* PR10147: When substituting a template template argument, substitute in the mostRichard Smith2017-08-294-9/+34
| | | | | | | recent (non-friend) declaration to pick up the right set of default template arguments. llvm-svn: 312049
* Restore clang_rt library name on i686-android.Evgeniy Stepanov2017-08-292-0/+16
| | | | | | | | | | | | | | | | | Summary: Recent changes canonicalized clang_rt library names to refer to "i386" on all x86 targets. Android historically uses i686. This change adds a special case to keep i686 in all clang_rt libraries when targeting Android. Reviewers: hans, mgorny, beanz Subscribers: srhines, cfe-commits, llvm-commits Differential Revision: https://reviews.llvm.org/D37278 llvm-svn: 312048
* Revert "[SanitizeCoverage] Enable stack-depth coverage for -fsanitize=fuzzer"Matt Morehouse2017-08-291-5/+1
| | | | | | This reverts r312026 due to bot breakage. llvm-svn: 312047
* Re-enable stack depth instrumentation on Windows.Matt Morehouse2017-08-291-2/+2
| | | | | | | Specified tls_model attribute properly. Should compile on Windows now. llvm-svn: 312037
* Disable stack depth tracking on Windows.Matt Morehouse2017-08-291-2/+2
| | | | | | Windows doesn't support the tls_model attribute. llvm-svn: 312032
* Minimal runtime for UBSan.Evgeniy Stepanov2017-08-2910-25/+141
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: An implementation of ubsan runtime library suitable for use in production. Minimal attack surface. * No stack traces. * Definitely no C++ demangling. * No UBSAN_OPTIONS=log_file=/path (very suid-unfriendly). And no UBSAN_OPTIONS in general. * as simple as possible Minimal CPU and RAM overhead. * Source locations unnecessary in the presence of (split) debug info. * Values and types (as in A+B overflows T) can be reconstructed from register/stack dumps, once you know what type of error you are looking at. * above two items save 3% binary size. When UBSan is used with -ftrap-function=abort, sometimes it is hard to reason about failures. This library replaces abort with a slightly more informative message without much extra overhead. Since ubsan interface in not stable, this code must reside in compiler-rt. Reviewers: pcc, kcc Subscribers: srhines, mgorny, aprantl, krytarowski, llvm-commits Differential Revision: https://reviews.llvm.org/D36810 llvm-svn: 312029
* [SanitizeCoverage] Enable stack-depth coverage for -fsanitize=fuzzerMatt Morehouse2017-08-291-1/+5
| | | | | | | | | | | | | | | | | | Summary: - Don't sanitize __sancov_lowest_stack. - Don't instrument leaf functions. - Add CoverageStackDepth to Fuzzer and FuzzerNoLink. - Disable stack depth tracking on Mac. Reviewers: vitalybuka, kcc, george.karpenkov Reviewed By: kcc Subscribers: kubamracek, cfe-commits, llvm-commits, hiraditya Differential Revision: https://reviews.llvm.org/D37156 llvm-svn: 312026
* [OPENMP] Capture global variables in all target executable regions.Alexey Bataev2017-08-292-3/+17
| | | | | | | | Capturing of the global variables occurs only in target regions. Patch fixes it and allows capturing of globals in all target executable directives. llvm-svn: 312024
* [Bash-autocomplete] Refactor autocomplete code into own functionYuka Takahashi2017-08-292-43/+55
| | | | | | | | | | | | | | Summary: We wrote many codes in HandleImediateArgs, so I've refactored it into handleAutocompletions. Reviewers: v.g.vassilev, teemperor Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D37249 llvm-svn: 312018
* [ms] Fix vbtable index for covariant overrides of vbase methodsReid Kleckner2017-08-292-4/+21
| | | | | | | | | | | | | | | Overriding a method from a virtual base with a covariant return type consumes a slot from the vftable in the virtual base. This can make it impossible to implement certain diamond inheritance hierarchies, but we have to follow along for compatibility in the simple cases. This patch only affects our vtable dumper and member pointer function mangling, since all other callers of getMethodVFTableLocation seem to recompute VBTableIndex instead of using the one in the method location. Patch by David Majnemer llvm-svn: 312017
* [modules-ts] Omit submodule semantics for TS modulesBoris Kolpackov2017-08-292-4/+24
| | | | | | | | | | | | If a TS module name has more than one component (e.g., foo.bar) then we erroneously activated the submodule semantics when encountering a module declaration in the module implementation unit (e.g., 'module foo.bar;'). Reviewed By: rsmith Differential Revision: https://reviews.llvm.org/D35678 llvm-svn: 312007
* [clang-format] Refactor likely xml a bit, NFCKrasimir Georgiev2017-08-291-6/+8
| | | | llvm-svn: 312000
* [clang-format] Do not format likely xmlKrasimir Georgiev2017-08-293-3/+27
| | | | | | | | | | | | | | | | | Summary: This patch detects the leading '<' in likely xml files and stops formatting in that case. A recent use of a Qt xml file with a .ts extension triggered this: http://doc.qt.io/qt-4.8/linguist-ts-file-format.html Reviewers: djasper Reviewed By: djasper Subscribers: sammccall, cfe-commits, klimek Differential Revision: https://reviews.llvm.org/D37136 llvm-svn: 311999
* [clang-format] Fixed typedef enum brace wrappingKrasimir Georgiev2017-08-292-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Bug: https://bugs.llvm.org/show_bug.cgi?id=34016 - **Typedef enum part** **Problem:** Clang format does not allow the flag **BraceWrapping.AfterEnum** control the case when our **enum** is preceded by **typedef** keyword (what is common in C language). **Patch description:** Added case to the **"AfterEnum"** flag when our enum does not start a line - is preceded by **typedef** keyword. **After fix:** **CONFIG:** ``` BreakBeforeBraces: Custom BraceWrapping: { AfterClass: true, AfterControlStatement: true, AfterEnum: true, AfterFunction: true, AfterNamespace: false, AfterStruct: true, AfterUnion: true, BeforeCatch: true, BeforeElse: true } ``` **BEFORE:** ``` typedef enum { a, b, c } SomeEnum; ``` **AFTER:** ``` typedef enum { a, b, c } SomeEnum; ``` Contributed by @PriMee! Reviewers: krasimir, djasper Reviewed By: djasper Subscribers: cfe-commits, klimek Differential Revision: https://reviews.llvm.org/D37143 llvm-svn: 311998
* [modules] Add test for using declaration in classes.Raphael Isemann2017-08-291-0/+34
| | | | | | | | | | | | | | | | | Summary: This adds a test that checks if the using declaration in classes still works as intended with modules. The motivation for this is that we tried to add a shortcut to `removeDecl` that would skip the removal of declarations from the lookup table if they are hidden. This optimization passed the clang test suite but actually broke the using declaration in combination with -fmodules-local-submodule-visibility. In this mode we hide all decls from other modules such as by chance the parent method, in which case don't remove the parent method from the lookup table and get ambiguous lookup errors. After this patch we now correctly see if this behavior is broken by a patch like this in the test suite. Reviewers: v.g.vassilev Reviewed By: v.g.vassilev Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D37180 llvm-svn: 311991
* [libclang]: Honor LIBCLANG_NOTHREADS for clang_parseTranslationUnit*Erik Verbruggen2017-08-291-0/+6
| | | | | | | | | | | | | | | | | Looks like this one was forgotten for clang_parseTranslationUnit*, as LIBCLANG_NOTHREADS is checked for/in: clang_saveTranslationUnit() clang_reparseTranslationUnit() clang_codeCompleteAt() clang_indexTranslationUnit() clang_indexSourceFile() Patch by Nikolai Kosjar! Differential Revision: https://reviews.llvm.org/D36821 llvm-svn: 311990
* clang-format: [JS] simplify template string wrapping.Martin Probst2017-08-292-36/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Previously, clang-format would try to wrap template string substitutions by indenting relative to the openening `${`. This helped with indenting structured strings, such as strings containing HTML, as the substitutions would be aligned according to the structure of the string. However it turns out that the overwhelming majority of template string + substitution usages are for substitutions into non-structured strings, e.g. URLs or just plain messages. For these situations, clang-format would often produce very ugly indents, in particular for strings containing no line breaks: return `<a href='http://google3/${file}?l=${row}'>${file}</a>(${ row },${ col }): `; This change makes clang-format indent template string substitutions as if they were string concatenation operations. It wraps +4 on overlong lines and keeps all operands on the same line: return `<a href='http://google3/${file}?l=${row}'>${file}</a>(${ row},${col}): `; While this breaks some lexical continuity between the `${` and `row}` here, the overall effects are still a huge improvement, and users can still manually break the string using `+` if desired. Reviewers: djasper Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D37142 llvm-svn: 311988
* Use class to pass information about executable nameSerge Pavlov2017-08-298-48/+172
| | | | | | | | | | | | | Information about clang executable name components, such as target and driver mode, was passes in std::pair. With this change it is passed in a special structure. It improves readability and makes access to this information more convenient. NFC. Differential Revision: https://reviews.llvm.org/D36057 llvm-svn: 311981
OpenPOWER on IntegriCloud