summaryrefslogtreecommitdiffstats
path: root/clang/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* CodeGen: Optimize emssion of zeroinitialzied arraysDavid Majnemer2014-12-281-12/+24
| | | | | | | | | Create an ConstantAggregateZero upfront if we see that it is viable. This saves us from having to manually push_back each and every initializer and then looping back over them to determine if they are 'null'. llvm-svn: 224908
* Don't crash on surprising tokens in default parameter template lists.Nico Weber2014-12-282-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | Fixes this snippet from SLi's afl fuzzer output: class { i (x = <, enum This parsed i as a function, x as a paramter, and the stuff after < as a template list. This then called TryConsumeDeclarationSpecifier() which called TryAnnotateCXXScopeToken() without checking the preconditions of this function. Check them before calling, like all other callers of TryAnnotateCXXScopeToken() do. A more readable reproducer that causes the same crash is class { void i(int x = MyTemplateClass<int, union int>::foo()); }; The reduced version used an eof token as surprising token, but kw_int works just as well to repro and is easier to insert into a test file. llvm-svn: 224906
* Sema: Variable templates cannot be static bitfield membersDavid Majnemer2014-12-281-1/+1
| | | | | | | We correctly forbid variables but not variable templates. Diagnose this case instead of crashing. llvm-svn: 224905
* Parse: Don't crash when 'typename' shows up in an attributeDavid Majnemer2014-12-281-1/+2
| | | | | | | | | isDeclarationSpecifier performs error recovers which jostles the token stream. Specifically, TryAnnotateTypeOrScopeToken will end up consuming a typename token which will confuse the attribute parsing machinery as we no-longer have something identifier-like. llvm-svn: 224903
* Sema: Permit an atomic type to be initialized by the same atomic typeDavid Majnemer2014-12-281-1/+5
| | | | | | | | | We forgot a conversion step when initializing an atomic type with an rvalue of the same type. This fixes PR22043. llvm-svn: 224902
* Sema: Don't crash when an inject class name has a nested redefinitionDavid Majnemer2014-12-282-7/+9
| | | | | | | | | We expected the type of a TagDecl to be a TagType, not an InjectedClassNameType. Introduced a helper method, Type::getAsTagDecl, to abstract away the difference; redefine Type::getAsCXXRecordDecl to be in terms of it. llvm-svn: 224898
* Lex: Don't let annotation tokens get into macro expansionDavid Majnemer2014-12-281-1/+2
| | | | | | | | | | We'd let annotation tokens from '#pragma pack' and the like get inside a function-like macro. This would lead to terror and mayhem; stop the madness early. This fixes PR22037. llvm-svn: 224896
* Remove unneeded include of DeclCXX.h from libParse.Nico Weber2014-12-281-1/+0
| | | | llvm-svn: 224893
* Objective-C: Serialize "more than one decl" state of ObjCMethodList.Nico Weber2014-12-273-14/+34
| | | | | | | | | | | | | | | | | This fixes PR21587, what r221933 fixed for regular programs is now also fixed for decls coming from PCH files. Use another bit from the count/bits uint16_t for storing the "more than one decl" bit. This reduces the number of bits for the count from 14 to 13. The selector with the most overloads in Cocoa.h has ~55 overloads, so 13 bits should still be plenty. Since this changes the meaning of a serialized bit pattern, also increase clang::serialization::VERSION_MAJOR. Storing the "more than one decl" state of only the first overload isn't quite correct, but Sema::AreMultipleMethodsInGlobalPool() currently only looks at the state of the first overload so it's good enough for now. llvm-svn: 224892
* [x86] Also add the missing type casts on the returns in the shaChandler Carruth2014-12-271-6/+6
| | | | | | | intrinsic header file. Along with r224822, this should restore the build bots to passing. llvm-svn: 224883
* [x86] Add missing typecast to __v4si to sha intrinsic header file.Craig Topper2014-12-271-6/+6
| | | | llvm-svn: 224882
* Objective-C: Tweak unavailability warning.Nico Weber2014-12-271-1/+1
| | | | | | | Don't warn when a selector has an unavailable and an available variant, and the first also has an implementation. llvm-svn: 224881
* [x86] Add range checking to the constant argument of cmpps/pd/ss/sd builtinas.Craig Topper2014-12-271-4/+8
| | | | llvm-svn: 224880
* [x86] Add the (v)cmpps/pd/ss/sd builtins to match gcc. Use them in the sse ↵Craig Topper2014-12-273-50/+198
| | | | | | | | | | intrinsic files. This still lower to the same intrinsics as before. This is preparation for bounds checking the immediate on the avx version of the builtin so we don't pass illegal immediates into the backend. Since SSE uses a smaller size immediate its not possible to bounds check when using a shared builtin. Rather than creating a clang specific builtin for the different immediate, I decided (after consulting with Chandler) that it was better to match gcc. llvm-svn: 224879
* Fix formatting. NFC.Craig Topper2014-12-271-2/+2
| | | | llvm-svn: 224877
* Address review feedback on r221933.Nico Weber2014-12-275-95/+104
| | | | | | | | | | | Remove ObjCMethodList::Count, instead store a "has more than one decl" bit in the low bit of the ObjCMethodDecl pointer, using a PointerIntPair. Most of this patch is replacing ".Method" with ".getMethod()". No intended behavior change. llvm-svn: 224876
* WIPDavid Majnemer2014-12-261-16/+16
| | | | llvm-svn: 224843
* Initialize BackendConsumer::Context in constructor.Yaron Keren2014-12-251-1/+1
| | | | llvm-svn: 224836
* Initialize CodeGeneratorImpl::Ctx in constructor.Yaron Keren2014-12-251-1/+1
| | | | llvm-svn: 224835
* Add driver flags -ftrigraphs, -fno-trigraphs.Nico Weber2014-12-232-4/+7
| | | | | | | | | | | | | | | | | -trigraphs is now an alias for -ftrigraphs. -fno-trigraphs makes it possible to explicitly disable trigraphs, which couldn't be done before. clang -std=c++11 -fno-trigraphs now builds without GNU extensions, but with trigraphs disabled. Previously, trigraphs were only disabled in GNU modes or with -std=c++1z. Make the new -f flags the cc1 interface too. This requires changing -trigraphs to -ftrigraphs in a few cc1 tests. Related to PR21974. llvm-svn: 224790
* Debug Info: Pass the pointer size into createMemberPointerType().Adrian Prantl2014-12-231-2/+3
| | | | | | Paired commit with LLVM. llvm-svn: 224781
* This reverts commit r224668 and r224667.Rafael Espindola2014-12-232-21/+21
| | | | | | | | | | r224667 broke bootstrap on Fedora 20 X86_64 (at least). See pr22006 for the details. r224668 depends on r224667. llvm-svn: 224770
* Disable trigraphs in microsoft mode by default. Matches cl.exe.Nico Weber2014-12-221-9/+9
| | | | | | | | | | The default value of Opts.Trigraphs now no longer depends solely on the language input kind, so move the code out of setLangDefaults(). Also make sure that Opts.MSVCCompat is set before the Trigraph code runs. Related to PR21974. llvm-svn: 224719
* MS ABI: Make the string mangling code more conciseDavid Majnemer2014-12-221-36/+10
| | | | | | No functional change intended. llvm-svn: 224696
* Wrap to 80 columns. NfC.Nico Weber2014-12-221-10/+11
| | | | llvm-svn: 224695
* Reapply "Change -save-temps to emit unoptimized bitcode files."Bob Wilson2014-12-217-17/+76
| | | | | | | | | | | | | | | | | | | | | | | | This reapplies r224503 along with a fix for compiling Fortran by having the clang driver invoke gcc (see r224546, where it was reverted). I have added a testcase for that as well. Original commit message: It is often convenient to use -save-temps to collect the intermediate results of a compilation, e.g., when triaging a bug report. Besides the temporary files for preprocessed source and assembly code, this adds the unoptimized bitcode files as well. This adds a new BackendJobAction, which is mostly mechanical, to run after the CompileJobAction. When not using -save-temps, the BackendJobAction is combined into one job with the CompileJobAction, similar to the way the integrated assembler is handled. I've implemented this entirely as a driver change, so under the hood, it is just using -disable-llvm-optzns to get the unoptimized bitcode. Based in part on a patch by Steven Wu. rdar://problem/18909437 llvm-svn: 224688
* Frontend: Fix typo in comments.Logan Chien2014-12-201-2/+2
| | | | llvm-svn: 224680
* Fix a bunch of integer template argument problems in template type diffing.Richard Trieu2014-12-201-20/+10
| | | | | | | | | | | | | Reverts most of the changes from r168005. Since template arguments have proper conversions now, no extending of integers is needed. Further, since the integers are the correct size now, use APSInt::operator== instead of APSInt::hasSameValue since operator== will check the size and signness match. Prior to one comparison of APSInt's, check that both are valid. Previous, one could be uninitialized. Also changed APInt to APSInt in GetInt. This occassionally produced a sign flip, which will now be caught by operator==. llvm-svn: 224668
* Fix for PR21758Richard Trieu2014-12-202-1/+11
| | | | | | | | | When a non-type template argument expression needs a conversion to change it into the argument type, preserve that information by remaking the TemplateArgument with an expression that has those conversions. Also a small fix to template type diffing to handle the extra conversions in some cases. llvm-svn: 224667
* Removing an outdated FIXME; try block attributes are parsed with the rest of ↵Aaron Ballman2014-12-201-1/+0
| | | | | | the statement attributes (as per the standard), and function-try-blocks may not have attributes. NFC. llvm-svn: 224662
* Driver: hoist an assertionSaleem Abdulrasool2014-12-191-10/+4
| | | | | | | Remove an unnecessary conditional, hoisting the assertion. Minor style tweaks/reflowing. NFC. llvm-svn: 224654
* Driver: refactor a local variableSaleem Abdulrasool2014-12-191-10/+10
| | | | | | | Pull out a getToolChain() into a local variable to share the call across to all the uses. NFC. llvm-svn: 224653
* Don't drop attributes when checking explicit specializations.Nico Weber2014-12-191-6/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Consider a template class with attributes on a method, and an explicit specialization of that method: template <int> struct A { void foo() final; }; template <> void A<0>::foo() {} In this example, the attribute is `final`, but it might also be an __attribute__((visibility("foo"))), noreturn, inline, etc. clang's current behavior is to strip all attributes, which for some attributes is wrong (the snippet above allows a subclass of A<0> to override the final method, for example) and for others disagrees with gcc. So stop dropping attributes. r95845 added this code without a test case, and r176728 added the code for dropping attributes on parameters (with tests, but they still pass). As an additional wrinkle, do drop dllimport and dllexport, since that's how these two attributes work. (This is covered by existing tests.) Fixes PR21942. The approach is by Richard Smith, initial analysis and typing was done by me. With this, clang also matches GCC and EDG on all attributes Richard tested. llvm-svn: 224651
* Tweak the assert in ModuleBuilder from r224533 (PR21989)Hans Wennborg2014-12-191-2/+3
| | | | | | | Turns out there will be left-over deferred inline methods if there have been errors, because in that case HandleTopLevelDecl bails out early. llvm-svn: 224649
* DR1048: drop top-level cv-qualifiers when deducing the return type of aRichard Smith2014-12-192-3/+12
| | | | | | lambda-expression in C++11, to match the C++14 rules. llvm-svn: 224620
* Allow to disable all sanitizers with "-fno-sanitize=all" option.Alexey Samsonov2014-12-191-5/+14
| | | | | | | | | | | | | | | | | | | | | | Summary: This patch adds "all" sanitizer group. A shortcut "-fno-sanitize=all" can be used to disable all sanitizers for a given source file. "-fsanitize=all" option makes no sense, and will produce an error. This group can also be useful when we add "-fsanitize-recover=<list>" options (patch in http://reviews.llvm.org/D6302), as it would allow to conveniently enable/disable recovery for all specified sanitizers. Test Plan: regression test suite Reviewers: kcc, rsmith Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D6733 llvm-svn: 224596
* Added a fixit to remove empty parens from a C++11 attribute argument list ↵Aaron Ballman2014-12-191-2/+2
| | | | | | when we diagnose this as an error. llvm-svn: 224595
* Fix an address space id reset with array decay'sPekka Jaaskelainen2014-12-191-1/+2
| | | | | | | | | | implicit conversion. The issue was produced with OpenCL C code that called a function with a constant string literal argument. llvm-svn: 224592
* Attributes accepting an EnumArgument are allowed to pass a string literal, ↵Aaron Ballman2014-12-191-2/+8
| | | | | | | | or an identifier. VariadicEnumArguments now behave consistently instead of only accepting a string literal. This change affects the only attribute accepting a variadic enumeration: callable_when. llvm-svn: 224582
* [Sanitizer] Get rid of parseArgument helper function. NFC.Alexey Samsonov2014-12-191-54/+43
| | | | llvm-svn: 224564
* Fix layering violation, Lex shouldn't know about DeclDavid Majnemer2014-12-191-2/+2
| | | | llvm-svn: 224562
* PR21969: Improve diagnostics for a conversion function that has any pieces of aRichard Smith2014-12-192-5/+89
| | | | | | declared return type (including a trailing-return-type in C++14). llvm-svn: 224561
* Correct delayed typos in the operand to typeof expressions.Kaelyn Takata2014-12-191-2/+2
| | | | | | Fixes PR21947. llvm-svn: 224558
* Fix a typo.Adrian Prantl2014-12-191-1/+1
| | | | llvm-svn: 224557
* [c Sema]. Patch fixes pointer-bool-conversion warning on C codeFariborz Jahanian2014-12-181-2/+2
| | | | | | | | when source range is incorrect causing the warning to be issued when it should not because expression is in a macro. rdar://19256338 llvm-svn: 224549
* Revert "Change -save-temps to emit unoptimized bitcode files."Reid Kleckner2014-12-186-60/+16
| | | | | | | | | | This reverts commit r224503. It broke compilation of fortran through the Clang driver. Previously `clang -c t.f` would invoke `gcc t.f` and `clang -cc1as`, but now it tries to call `clang -cc1 t.f` which fails for obvious reasons. llvm-svn: 224546
* ModuleBuilder: assert that all deferred inline method defs get handledHans Wennborg2014-12-181-4/+7
| | | | | | | While we're here, also move the declaration of DeferredInlineMethodDefinitions closer to the other member vars and make it a SmallVector. NFC. llvm-svn: 224533
* Revert "Don't build invalid AST nodes during recovery"Reid Kleckner2014-12-181-1/+1
| | | | | | | | | | | This reverts commit r224451. It caused us to reject some valid existing code. This code appears to run in non-error cases as well as error cases. If the scope of a DependentScopeDeclRefExpr is still incomplete it probably means we still have more instantiation to do. llvm-svn: 224526
* [Objective-C]. Patch to unify code generation for ObjCMsgSend and ObjCBoxedExpr.Fariborz Jahanian2014-12-181-6/+2
| | | | | | Patch by Alex Denisov. NFC. llvm-svn: 224525
* Correction to -mfu=neon-vfpv4 to pass the correct backend feature nameRichard Barton2014-12-181-2/+2
| | | | | Change-Id: I4dbfe1d97670fc4e626368ef1f91fc008778dfca llvm-svn: 224523
OpenPOWER on IntegriCloud