summaryrefslogtreecommitdiffstats
path: root/clang
Commit message (Collapse)AuthorAgeFilesLines
* [AVX512] Add FP unpack intrinsicsAdam Nemet2015-01-142-0/+61
| | | | | | | | | | | These are implemented with __builtin_shufflevector just like AVX. We have some tests on the LLVM side to assert that these shufflevectors do indeed generate the corresponding unpck instruction. Part of <rdar://problem/17688758> llvm-svn: 225922
* Insert random noops to increase security against ROP attacks (clang)JF Bastien2015-01-146-1/+19
| | | | | | | | | | | | | | | | | | | | A pass that adds random noops to X86 binaries to introduce diversity with the goal of increasing security against most return-oriented programming attacks. Command line options: -noop-insertion // Enable noop insertion. -noop-insertion-percentage=X // X% of assembly instructions will have a noop prepended (default: 50%, requires -noop-insertion) -max-noops-per-instruction=X // Randomly generate X noops per instruction. ie. roll the dice X times with probability set above (default: 1). This doesn't guarantee X noop instructions. In addition, the following 'quick switch' in clang enables basic diversity using default settings (currently: noop insertion and schedule randomization; it is intended to be extended in the future). -fdiversify This is the clang part of the patch. llvm part: D3392 http://reviews.llvm.org/D3393 Patch by Stephen Crane (@rinon) llvm-svn: 225910
* Update HelpText for -fsanitize= option.Alexey Samsonov2015-01-141-3/+2
| | | | | | | There are too many available sanitizers now - redirect to user manual instead of listing them all. llvm-svn: 225894
* Update for move in llvm.Eric Christopher2015-01-141-1/+1
| | | | llvm-svn: 225892
* Look through sugar when determining whether a type is a scoped enumerationRichard Smith2015-01-142-1/+9
| | | | | | type. Patch by Stephan Bergmann! llvm-svn: 225889
* Sema: An extern declaration can't be a redeclaration of a parameterDavid Majnemer2015-01-143-2/+11
| | | | | | | | | | | | In the following: void f(int x) { extern int x; } The second declaration of 'x' shouldn't be considered a redeclaration of the parameter. This is a different approach to r225780. llvm-svn: 225875
* Sink a parameter into the callee since it's always the same expression in ↵David Blaikie2015-01-142-9/+7
| | | | | | terms of another parameter llvm-svn: 225856
* DebugInfo: Correct the location of EH cleanup for blocksDavid Blaikie2015-01-132-0/+18
| | | | | | | | | | | | | | | | | | | | | | | This was previously piggybacking on whatever happened to be the last location set on CGDebugInfo/DIBuilder, which was wrong (it was often the current location, such as the 'fn()' call site, not the end of the block). With my improvements to set/unset the location in a scoped manner (r225000) this went from a bad quality situation, to a crash. Fixing this goes part-way to unblocking the recommit of r225000. It's likely that any call to CodeGenFunction::StartFunction without the CurEHLocation set represents a similar bug or risk of a bug. Perhaps there are some callers that know they won't generate EH cleanups, but I'm not sure. I considered a generic catch-fix in StartFunction (just fallback to the GlobalDecl's location) but that seemed like it'd mask bugs where the EH location shouldn't be the same as the decl's location (& indeed by not using that stop-gap I found this bug). We'll see how long I can hold out on the generic catch-all. I might eventually be able to add an assertion in. llvm-svn: 225845
* clang-format: [Java] Detect `native` keyword.Nico Weber2015-01-133-1/+5
| | | | | | | | | | Before: public native<X> Foo foo(); After: public native <X> Foo foo(); llvm-svn: 225839
* Add [extern_c] attribute to _Builtin_intrinsics moduleBen Langmuir2015-01-131-1/+1
| | | | | | This allows users to import this module inside an extern "C" {} block. llvm-svn: 225835
* Mention FreeBSD support.Roman Divacky2015-01-131-0/+1
| | | | llvm-svn: 225834
* When attribute 'optnone' appears on the same declaration with aPaul Robinson2015-01-134-32/+30
| | | | | | | | | | | | conflicting attribute, warn about the conflict and pick a "winning" attribute to preserve, instead of emitting an error. This matches the behavior when the conflicting attributes are on different declarations. Along the way I discovered that conflicts involving __forceinline were reported as 'always_inline' (alternate spelling, same attribute) so fixed that up to report the attribute as spelled in the source. llvm-svn: 225813
* Inherit attributes when infering a framework moduleBen Langmuir2015-01-135-27/+52
| | | | | | | | | | If a module map contains framework module * [extern_c] {} We will now infer [extern_c] on the inferred framework modules (we already inferred [system] as a special case). llvm-svn: 225803
* Handle [extern_c] attribute in module printerBen Langmuir2015-01-131-2/+5
| | | | | | | I'm not sure why we have OS.indent(Indent+2) for the system attribute, but presumably we want the same behaviour for all attributes... llvm-svn: 225802
* Remove unused method canInferFrameworkModuleBen Langmuir2015-01-132-40/+0
| | | | llvm-svn: 225801
* [mips] Fix va_arg() for pointer types on big-endian N32.Daniel Sanders2015-01-133-6/+61
| | | | | | | | | | | | | | | | | | | | | Summary: The Mips ABI's treat pointers in the same way as integers. They are sign-extended to 32-bit for O32, and 64-bit for N32/N64. This doesn't matter for O32 and N64 where pointers are already the correct width but it does matter for big-endian N32, where pointers are 32-bit and need promoting. The caller side is already passing pointers correctly. This patch corrects the callee. Reviewers: vmedic, atanasyan Reviewed By: atanasyan Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D6812 llvm-svn: 225782
* Revert "Sema: An extern declaration can't be a redeclaration of a parameter"David Majnemer2015-01-132-6/+4
| | | | | | | This reverts commit r225780, we can't compile line 181 in sanitizer_platform_limits_posix.cc with this commit. llvm-svn: 225781
* Sema: An extern declaration can't be a redeclaration of a parameterDavid Majnemer2015-01-132-4/+6
| | | | | | | | | | In the following: void f(int x) { extern int x; } The second declaration of 'x' shouldn't be considered a redeclaration of the parameter. llvm-svn: 225780
* Update clang-format.el to use xml output and patch in the returned chunks.Manuel Klimek2015-01-131-46/+86
| | | | | | | | | This leads to better undo behavior and avoids window content jumping around. Patch by Johann Klähn. llvm-svn: 225777
* Parse: Switch to using EOF tokens for late parsed attributesDavid Majnemer2015-01-131-12/+15
| | | | | | | | | The EOF token injection technique is preferable to using isBeforeInTranslationUnit to determine whether or not additional cleanup is needed. I don't have an example off-hand that requires it but it is nicer nonetheless. llvm-svn: 225776
* Parse: Don't crash when default argument in typedef consists of sole '='David Majnemer2015-01-132-2/+8
| | | | | | | | We'd crash trying to make the SourceRange for the tokens we'd like to highlight. Don't assume there is more than one token makes up the default argument. llvm-svn: 225774
* Parse: Don't crash if missing an initializer expressionDavid Majnemer2015-01-132-1/+6
| | | | llvm-svn: 225768
* Parse: use the EOF token method to lex inline method bodiesDavid Majnemer2015-01-132-22/+25
| | | | | | | | Mark the end of the method body with an EOF token, collect it once we expect to be done with method body parsing. No functionality change intended. llvm-svn: 225765
* Parse: Further simplify ParseLexedMethodDeclarationDavid Majnemer2015-01-133-46/+33
| | | | | | | No functionality change intended, just moving code around to make it simpler. llvm-svn: 225763
* Mark vtable used on explicit destructor definitions.Nico Weber2015-01-132-1/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are two things in a C++ program that need to read the vtable pointer: Constructors and destructors. (A few other operations -- virtual calls, dynamic cast, rtti -- read the vtable pointer off a this pointer, but for this they don't need the vtable symbol.) Implicit constructors and destructors and explicit constructors already marked the vtable as used, but explicit destructors didn't. Note that the only thing sema's "mark a class's vtable used" does is to mark all final overriders of the class as referenced, it does _not_ cause emission of the vtable itself. This is done on demand by codegen, independent of sema, since sema might emit functions that are not referenced. (The exception are vtables that are forced via key functions -- these are forced onto codegen by sema.) This bug went unnoticed for years because it doesn't have observable effects (yet -- I want to change this in PR20337, which is why I noticed this). r213109 made it so that _calls_ to constructors don't mark the vtable used. Currently, _calls_ to destructors still mark the vtable used. If that wasn't the case, this program would tickle the problem: test.h: template <typename T> struct B { int* p; virtual ~B() { delete p; } virtual void f() {} }; struct __attribute__((visibility("default"))) C { C(); B<int> m; }; test2.cc: #include "test.h" int main() { C* c = new C; delete c; } test3.cc: #include "test.h" C::C() {} # This bin/clang++ binary doesn't MarkVTableUsed() for virtual dtor calls: $ bin/clang++ -shared test3.cc -std=c++11 -O2 -fvisibility=hidden \ -fvisibility-inlines-hidden -o libtest3.dylib $ bin/clang++ test2.cc -std=c++11 -O2 -fvisibility=hidden \ -fvisibility-inlines-hidden libtest3.dylib Undefined symbols for architecture x86_64: "B<int>::f()", referenced from: vtable for B<int> in test2-af8f4f.o ld: symbol(s) not found for architecture x86_64 What's happening here is that there's a copy of B's vtable hidden in libtest3.dylib, because C's constructor caused an implicit instantiation of that (and implicit constructors generate vtables). test2.cc calls C's destructDr, which destroys the B<int> member, which wants to overwrite the vtable back to B (think of B as the base of a class hierarchy, and of hierarchical destruction -- maybe we shouldn't do the vtable writing in destructors of final classes), but there's nothing in test2.cc that marks B's vtable used. So codegen writes out the vtable, but since it wasn't marked used, sema didn't mark all the virtual functions (in particular f()) as used. Note that this change makes us reject programs we didn't reject before (see the included Sema test case), but both gcc and cl also reject this code, and clang used to reject it before r213109. llvm-svn: 225761
* [OPENMP] Consider global named register variables as threadprivate by default.Alexey Bataev2015-01-133-4/+10
| | | | | | Register are thread-local by default, so we have to consider them as threadprivate. llvm-svn: 225759
* Extend the self move warning to record types.Richard Trieu2015-01-135-86/+116
| | | | | | | Move the logic for checking self moves into SemaChecking and add that function to Sema since it is now used in multiple places. llvm-svn: 225756
* If we don't find a matching ) for a ( in an exception specification, keep ↵Richard Smith2015-01-132-9/+12
| | | | | | the tokens around so we can diagnose an error rather than silently discarding them. llvm-svn: 225755
* PR22208: On FreeBSD systems, __STDC_MB_MIGHT_NEQ_WC__ is expected to be definedRichard Smith2015-01-132-0/+8
| | | | | | | | | | | even though every basic source character literal has the same numerical value as a narrow or wide character literal. It appears that the FreeBSD folks are trying to use this macro to mean something other than what the relevant standards say it means, but their usage is conforming, so put up with it. llvm-svn: 225751
* Simplify a test. No behavior change.Nico Weber2015-01-131-5/+3
| | | | | | | | | | Templates don't have key functions (cf computeKeyFunction() in RecordLayoutBuilder.cpp), so don't have something that looks like one. Also, instead of a vcall to force generation of the vtable, just construct the object. This is how the repro on PR5557 (what the test is for) worked too. llvm-svn: 225741
* Reimplement -fsanitize-recover family of flags.Alexey Samsonov2015-01-1214-86/+227
| | | | | | | | | | | | | | | | | | | | | | | | Introduce the following -fsanitize-recover flags: - -fsanitize-recover=<list>: Enable recovery for selected checks or group of checks. It is forbidden to explicitly list unrecoverable sanitizers here (that is, "address", "unreachable", "return"). - -fno-sanitize-recover=<list>: Disable recovery for selected checks or group of checks. - -f(no-)?sanitize-recover is now a synonym for -f(no-)?sanitize-recover=undefined,integer and will soon be deprecated. These flags are parsed left to right, and mask of "recoverable" sanitizer is updated accordingly, much like what we do for -fsanitize= flags. -fsanitize= and -fsanitize-recover= flag families are independent. CodeGen change: If there is a single UBSan handler function, responsible for implementing multiple checks, which have different recoverable setting, then we emit two handler calls instead of one: the first one for the set of "unrecoverable" checks, another one - for set of "recoverable" checks. If all checks implemented by a handler have the same recoverability setting, then the generated code will be the same. llvm-svn: 225719
* [patch][pr19848] Produce explicit comdats in clang.Rafael Espindola2015-01-1214-84/+100
| | | | | | | | | | | | | | | | | | | | | | | | The llvm IR until recently had no support for comdats. This was a problem when targeting C++ on ELF/COFF as just using weak linkage would cause quite a bit of dead bits to remain on the executable (unless -ffunction-sections, -fdata-sections and --gc-sections were used). To fix the problem, llvm's codegen will just assume that any weak or linkonce that is not in an explicit comdat should be output in one with the same name as the global. This unfortunately breaks cases like pr19848 where a weak symbol is not xpected to be part of any comdat. Now that we have explicit comdats in the IR, we can finally get both cases right. This first patch just makes clang give explicit comdats to GlobalValues where t is allowed to. A followup patch to llvm will then stop implicitly producing comdats. llvm-svn: 225705
* Wrap to 80 columns. No behavior change.Nico Weber2015-01-122-5/+6
| | | | llvm-svn: 225703
* Don't use a doc comment in a function body.Nico Weber2015-01-121-3/+3
| | | | llvm-svn: 225701
* reverting due to build bot failureNathan Sidwell2015-01-122-22/+30
| | | | llvm-svn: 225684
* Fix typo Block.h vs Blocks.hBen Langmuir2015-01-121-1/+1
| | | | | | Thanks for Jeremy for noticing! llvm-svn: 225666
* [PowerPC]To provide better compatibility with gcc I added the __bool keyword ↵Bill Seurer2015-01-124-0/+21
| | | | | | | | | | | | | | | | | to the Alitivec support in clang. __bool is functionally identical to using bool when declaring vector types. For example: vector bool char v_bc; vector __bool char v___bc; clang already supported vector/__vector and pixel/__pixel but was missing __bool. http://llvm.org/bugs/show_bug.cgi?id=19220 For reference: https://gcc.gnu.org/onlinedocs/gcc-4.9.2/gcc/PowerPC-AltiVec_002fVSX-Built-in-Functions.html http://reviews.llvm.org/D6882 llvm-svn: 225664
* Fix bogus 'method is unavailable' errors with modulesBen Langmuir2015-01-127-3/+54
| | | | | | | | This just tweaks the fix from r224892 (which handled PCHs) to work with modules, where we will serialize each method individually and hence the hasMoreThanOneDecl bit needs to be updated as we add the methods. llvm-svn: 225659
* [mips] Explain why we need to always clobber for MIPS inline asm. NFC.Toma Tabacu2015-01-121-0/+21
| | | | llvm-svn: 225632
* Fix assertion in BreakableBlockComment (http://llvm.org/PR21916).Alexander Kornienko2015-01-123-1/+18
| | | | | | | | | | | | Reviewers: djasper Reviewed By: djasper Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D6894 llvm-svn: 225628
* Suppress clang/test/Driver/rewrite-map-in-diagnostics.c on win32 for now. ↵NAKAMURA Takumi2015-01-121-0/+3
| | | | | | This doesn't fail on "env clang". Investigating. llvm-svn: 225626
* clang-format: Improve format of lambdas in ctor initializers.Daniel Jasper2015-01-122-0/+5
| | | | | | | | | | | | | | | | Before: Constructor() : Constructor([] { // comment int i; }) {} After: Constructor() : Constructor([] { // comment int i; }) {} llvm-svn: 225625
* Rename RefersToCapturedVariable to RefersToEnclosingVariableOrCapture, NFCAlexey Bataev2015-01-1217-61/+68
| | | | llvm-svn: 225624
* clang-format: Fix formatting of inline asm.Daniel Jasper2015-01-122-4/+8
| | | | | | | | | Specifically, adjust the leading "__asm {" and trailing "}" while still leaving the assembly inside it alone. This fixes llvm.org/PR22190. llvm-svn: 225623
* Parse: Get rid of cxx_exceptspec_end, use EOF insteadDavid Majnemer2015-01-123-4/+7
| | | | | | | | Similar to r225619, use a special EOF token to mark the end of the exception specification instead of cxx_exceptspec_end. Use the current scope as the marker. llvm-svn: 225622
* Parse: Just a small tidy-up in ParseLexedMethodDeclarationDavid Majnemer2015-01-121-5/+7
| | | | | | No functional change intended, just tidy up the parse flow. llvm-svn: 225620
* Parse: Get rid of tok::cxx_defaultarg_end, use EOF insteadDavid Majnemer2015-01-124-9/+9
| | | | | | | I added setEofData/getEofData to solve this sort of problem back in r224505. Use the Param's decl to tell us if this is *our* EOF token. llvm-svn: 225619
* Parse: It's cleaner to handle cxx_defaultarg_end in SkipUntil directlyDavid Majnemer2015-01-124-13/+11
| | | | llvm-svn: 225616
* Parse: Don't let BalancedDelimiterTracker consume cxx_defaultarg_endDavid Majnemer2015-01-122-1/+6
| | | | | | | | It is not correct to let it consume the cxx_defaultarg_end token. I'm starting to wonder if it makes more sense to stop SkipUntil from consuming such tokens. llvm-svn: 225615
* Driver: include rewrite maps in the diagnosticsSaleem Abdulrasool2015-01-122-0/+14
| | | | | | | | The rewrite map files are not copied, and so cannot be tracked as temporary files. Add them explicitly to the list of files that we request from the user to be attached to bug reports. llvm-svn: 225614
OpenPOWER on IntegriCloud