summaryrefslogtreecommitdiffstats
path: root/clang/test
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix default image name to 'a.exe' on Windows, instead 'a.out'.Yaron Keren2015-01-041-1/+1
| | | | | | This applies to mingw as clang-cl already has its own logic for the filename. llvm-svn: 225134
* Crash less enthusiasticially on _Atomic or __restrict__ on invalid types.Nico Weber2015-01-041-4/+8
| | | | | | | | | | Many places in Sema cannot handle isNull() types. This is fine, because in most places the type building code recovers by falling back to IntTy. In GetFullTypeForDeclarator(), this is done at the end of the getNumTypeObjects() loop body. This function calls BuildQualifiedType() before this fallback is done though, so it explicitly needs to check for isNull() types. llvm-svn: 225124
* AST: Remove overzealous assertion from IsModifiableDavid Majnemer2015-01-041-0/+3
| | | | | | It's reasonable to ask if an l-value with class type is modifiable. llvm-svn: 225121
* Parse: __attribute__((keyword)) shouldn't errorDavid Majnemer2015-01-032-2/+2
| | | | | | | Weird constructs like __attribute__((inline)) or __attibute__((typename)) should result in warnings, not errors. llvm-svn: 225118
* Volatile reads are side-effecting operations, but in the general case of ↵Aaron Ballman2015-01-031-3/+4
| | | | | | | | | | | access through a volatile-qualified type, we're not certain of the underlying object's side-effects on access. Treat volatile accesses as "maybe" instead of "definite" side effects for the purposes of warning on evaluations in an unevaluated context. No longer diagnose on idiomatic code like: int * volatile v; (void)sizeof(*v); llvm-svn: 225116
* Remove -Werror from test.Rafael Espindola2015-01-031-2/+2
| | | | | | | It is not needed since we FileCheck for the warning and -Werror itself can end up unused. llvm-svn: 225102
* Really don't warn about -flto/fno-lto :-(Rafael Espindola2015-01-031-0/+1
| | | | | | This should fix the last bots. llvm-svn: 225100
* Don't warn on unused -fno-lto.Rafael Espindola2015-01-021-0/+3
| | | | | | | It is somewhat common for CFLAGS to be used with .s files. We were already ignoring -flto. This patch just does the same for -fno-lto. llvm-svn: 225093
* DebugInfo: Provide a less subtle way to set the debug location of simple ret ↵David Blaikie2015-01-021-5/+0
| | | | | | | | instructions un-XFAILing the test XFAIL'd in r225086 after it regressed in r225083. llvm-svn: 225090
* Temporarily XFAIL fallout from r225083 while investigating.David Blaikie2015-01-021-0/+5
| | | | | | | | | | | | Between this behavior and that fixed by r225083/r225000, I'll take the latter over the former for now, but I'm immediately working on understanding/addressing this behavior too. (the fact that the code change in r225083 caused this change in behavior is a bit troubling anyway - given that it looks & claims to be just a preformance thing) llvm-svn: 225086
* DebugInfo: Fix cases where location failed to be updated after r225000David Blaikie2015-01-021-0/+10
| | | | | | | | | | | | | The optimization (that appears to have been here since the earliest implementation (r50848) & has become more complicated over the years) to avoid recreating the debugloc if it would be the same was out of date because ApplyDebugLocation was not re-updating the CurLoc/PrevLoc. This optimization doesn't look terribly beneficial/necessary, so I'm removing it - if it turns up in benchmarks, I'm happy to reconsider/reimplement this with justification, but for now it just seems to add complexity/problems. llvm-svn: 225083
* Instantiation of a CXXMethodDecl may fail when the parameter type cannot be ↵Nick Lewycky2015-01-021-0/+13
| | | | | | | | | | | | instantiated. Do not crash in this case. Fixes PR22040! The FIXME in the test is caused by TemplateDeclInstantiator::VisitCXXRecordDecl returning a nullptr instead of creating an invalid decl. This is a common pattern across all of TemplateDeclInstantiator, so I'm not comfortable changing it. The reason it's not invalid in the class template is due to support for an MSVC extension, see r137573. llvm-svn: 225071
* CodeGen: Don't crash when a lambda uses a local constexpr variableDavid Majnemer2015-01-011-2/+10
| | | | | | | | | | | The DeclRefExpr might be for a variable initialized by a constant expression which hasn't been ODR used. Emit the initializer for the variable instead of trying to capture the variable itself. This fixes PR22071. llvm-svn: 225060
* XFAIL test on win32 due to missing __complex supportDavid Blaikie2014-12-311-0/+2
| | | | llvm-svn: 225051
* Handle PPC64 return type (signext i32 rather than plain i32) in test caseDavid Blaikie2014-12-311-1/+1
| | | | llvm-svn: 225021
* Reapply "DebugInfo: Generalize debug info location handling"David Blaikie2014-12-303-11/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Originally committed in r224385 and reverted in r224441 due to concerns this change might've introduced a crash. Turns out this change fixes the crash introduced by one of my earlier more specific location handling changes (those specific fixes are reverted by this patch, in favor of the more general solution). Recommitted in r224941 and reverted in r224970 after it caused a crash when building compiler-rt. Looks to be due to this change zeroing out the debug location when emitting default arguments (which were meant to inherit their outer expression's location) thus creating call instructions without locations - these create problems for inlining and must not be created. That is fixed and tested in this version of the change. Original commit message: This is a more scalable (fixed in mostly one place, rather than many places that will need constant improvement/maintenance) solution to several commits I've made recently to increase source fidelity for subexpressions. This resetting had to be done at the DebugLoc level (not the SourceLocation level) to preserve scoping information (if the resetting was done with CGDebugInfo::EmitLocation, it would've caused the tail end of an expression's codegen to end up in a potentially different scope than the start, even though it was at the same source location). The drawback to this is that it might leave CGDebugInfo out of sync. Ideally CGDebugInfo shouldn't have a duplicate sense of the current SourceLocation, but for now it seems it does... - I don't think I'm going to tackle removing that just now. I expect this'll probably cause some more buildbot fallout & I'll investigate that as it comes up. Also these sort of improvements might be starting to show a weakness/bug in LLVM's line table handling: we don't correctly emit is_stmt for statements, we just put it on every line table entry. This means one statement split over multiple lines appears as multiple 'statements' and two statements on one line (without column info) are treated as one statement. I don't think we have any IR representation of statements that would help us distinguish these cases and identify the beginning of each statement - so that might be something we need to add (possibly to the lexical scope chain - a scope for each statement). This does cause some problems for GDB and possibly other DWARF consumers. llvm-svn: 225000
* Driver: use the canonical library prefix on WindowsSaleem Abdulrasool2014-12-301-5/+5
| | | | | | | | Unlike Unices, Windows does not use a library prefix. Use the traditional naming scheme even for Windows itanium environments. This makes the builtins behave more like the sanitisers as well. llvm-svn: 224996
* Don't crash on an invalid trailing return type on a function before a '...'Nico Weber2014-12-301-0/+4
| | | | | | | | | | | | clang tries to produce a helpful diagnostic for the traiilng '...', but the code that r216778 added for this doesn't expect an invalid trailing return type. Add code to explicitly handle this. Having explicit code for this but not for other things looks a bit strange, but trailing return types are special in that they have a separate existence bit in addition to the type (see r158348). llvm-svn: 224974
* Revert "DebugInfo: Generalize debug info location handling"David Blaikie2014-12-293-18/+11
| | | | | | | | | Asserting when building compiler-rt when using a GCC host compiler. Reverting while I investigate. This reverts commit r224941. llvm-svn: 224970
* Parse: Recover more gracefully from extra :: tokens before a {David Majnemer2014-12-291-0/+2
| | | | | | | Instead of crashing, recover by eating the extra trailing scope qualifier. This means we will treat 'struct A:: {' as 'struct A {'. llvm-svn: 224966
* PR22051: Missing debug location on calls in dtor thunks in Windows.David Blaikie2014-12-291-0/+22
| | | | llvm-svn: 224963
* Crash even less on malformed attributes in an incorrect location.Nico Weber2014-12-291-4/+4
| | | | | | | | | | | This is a follow-up to r224915. This adds a bit more line noise to the tests added in that revision to make sure the parser is ready for a toplevel decl after each incorrect line. Use this to move the tests up to where they belong. This uncovered that the early return was missing a call to ActOnTagDefinitionError(), so add that. (Also fixes at least one of the crashes on SLi's bot.) llvm-svn: 224958
* Parse: Ignore '::' in 'struct :: {'David Majnemer2014-12-291-1/+0
| | | | | | | Let's pretend that we didn't see the '::' instead of go on believing that we've got some anonymous, but globally qualified, struct. llvm-svn: 224945
* Reapply "DebugInfo: Generalize debug info location handling"David Blaikie2014-12-293-11/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Originally committed in r224385 and reverted in r224441 due to concerns this change might've introduced a crash. Turns out this change fixes the crash introduced by one of my earlier more specific location handling changes (those specific fixes are reverted by this patch, in favor of the more general solution). Original commit message: This is a more scalable (fixed in mostly one place, rather than many places that will need constant improvement/maintenance) solution to several commits I've made recently to increase source fidelity for subexpressions. This resetting had to be done at the DebugLoc level (not the SourceLocation level) to preserve scoping information (if the resetting was done with CGDebugInfo::EmitLocation, it would've caused the tail end of an expression's codegen to end up in a potentially different scope than the start, even though it was at the same source location). The drawback to this is that it might leave CGDebugInfo out of sync. Ideally CGDebugInfo shouldn't have a duplicate sense of the current SourceLocation, but for now it seems it does... - I don't think I'm going to tackle removing that just now. I expect this'll probably cause some more buildbot fallout & I'll investigate that as it comes up. Also these sort of improvements might be starting to show a weakness/bug in LLVM's line table handling: we don't correctly emit is_stmt for statements, we just put it on every line table entry. This means one statement split over multiple lines appears as multiple 'statements' and two statements on one line (without column info) are treated as one statement. I don't think we have any IR representation of statements that would help us distinguish these cases and identify the beginning of each statement - so that might be something we need to add (possibly to the lexical scope chain - a scope for each statement). This does cause some problems for GDB and possibly other DWARF consumers. llvm-svn: 224941
* [multilib] Teach Clang's code about multilib by threadingChandler Carruth2014-12-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | a CLANG_LIBDIR_SUFFIX down from the build system and using that as part of the default resource dir computation. Without this, essentially nothing that uses the clang driver works when building clang with a libdir suffix. This is probably the single biggest missing piece of support for multilib as without this people could hack clang to end up installed in the correct location, but it would then fail to find its own basic resources. I know of at least one distro that has some variation on this patch to hack around this; hopefully they'll be able to use the libdir suffix functionality directly as the rest of these bits land. This required fixing a copy of the code to compute Clang's resource directory that is buried inside of the frontend (!!!). It had bitrotted significantly relative to the driver code. I've made it essentially a clone of the driver code in order to keep tests (which use cc1 heavily) passing. This copy should probably just be removed and the frontend taught to always rely on an explicit resource directory from the driver, but that is a much more invasive change for another day. I've also updated one test which actually encoded the resource directory in its checked output to tolerate multilib suffixes. Note that this relies on a prior LLVM commit to add a stub to the autoconf build system for this variable. llvm-svn: 224924
* Sema: Permit array l-values in asm output operandsDavid Majnemer2014-12-291-0/+4
| | | | | | | | GCC permits array l-values in asm output operands even though they aren't modifiable l-values. We used to permit it but this behavior regressed in r224916. llvm-svn: 224918
* Sema: Only permit permit modifiable l-values as asm output paramsDavid Majnemer2014-12-291-0/+10
| | | | | | | | | | Functions are l-values in C++ but shouldn't be available as output parameters in inline assembly. Neither should overloaded function l-values. This fixes PR21949. llvm-svn: 224916
* Don't crash on malformed attributes in an incorrect location.Nico Weber2014-12-291-0/+4
| | | | | | | | | | | | | | | | | | r168626 added nicer diagnostics for attributes in the wrong places, such as after the `final` on a class. To do this, it added code that did high-level pattern matching for e.g. 'final' 'alignas' '(' and then skipped until the closing ')'. If it saw that, it then went down the regular class parsing path and then called MaybeParseCXX11Attributes() to parse the attribute after the 'final' using real attribute parsing code. On invalid attributes, the real attribute parsing code could eat more tokens than the pattern matching code and for example skip past the '{' starting the class, which would then lead to an assert. To prevent this, check for a good state after calling MaybeParseCXX11Attributes() (which morphed into CheckMisplacedCXX11Attribute() in r175575) and bail out if things look bleak. Found by SLi's afl bot. llvm-svn: 224915
* Sema: Don't crash when solitary :: token appears before { in struct defDavid Majnemer2014-12-291-0/+3
| | | | | | | | hasDeclaratorForAnonDecl, getDeclaratorForAnonDecl and getTypedefNameForAnonDecl are expected to handle the case where NamedDeclOrQualifier holds the wrong type or nothing at all. llvm-svn: 224912
* Sema: Forbid inconsistent constraint alternativesDavid Majnemer2014-12-291-0/+7
| | | | | | Verify that asm constraints have the same number of alternatives llvm-svn: 224911
* SemaCXX: Don't crash when annotation tokens show up before the tag nameDavid Majnemer2014-12-291-4/+11
| | | | | | | | Clang has a hack to accept definitions of structs with tag names which have the same name as intrinsics. However, this hack didn't guard against annotation tokens showing up in the token stream. llvm-svn: 224909
* Don't crash on surprising tokens in default parameter template lists.Nico Weber2014-12-281-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | 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-0/+6
| | | | | | | 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-282-1/+3
| | | | | | | | | 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-0/+4
| | | | | | | | | 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-281-0/+6
| | | | | | | | | 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-0/+5
| | | | | | | | | | 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
* Objective-C: Serialize "more than one decl" state of ObjCMethodList.Nico Weber2014-12-271-0/+23
| | | | | | | | | | | | | | | | | 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
* Objective-C: Tweak unavailability warning.Nico Weber2014-12-271-4/+17
| | | | | | | 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-0/+20
| | | | llvm-svn: 224880
* [x86] Add the (v)cmpps/pd/ss/sd builtins to match gcc. Use them in the sse ↵Craig Topper2014-12-271-0/+288
| | | | | | | | | | 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
* Add more feature flags to the x86 instrinsic test.Craig Topper2014-12-271-0/+27
| | | | llvm-svn: 224878
* Make the test from r224873 actually pass.Nico Weber2014-12-271-2/+4
| | | | | | | The behavior looks incorrect to me, but the test is supposed to document current behavior for now. llvm-svn: 224875
* Add more test coverage for the Objective-C deprected selector warning.Nico Weber2014-12-271-0/+11
| | | | | | | I broke this case in a local patch I'm writing, and there was no test to stop me. Now there is. llvm-svn: 224873
* Adjust the rest of the tests due to r224849.David Majnemer2014-12-261-2/+2
| | | | llvm-svn: 224865
* Update tests due to r224849David Majnemer2014-12-262-2/+2
| | | | | | Inferring nuw caused some clang tests to change their output. llvm-svn: 224851
* clang-cl: Various changes to /Zc: handling.Nico Weber2014-12-232-6/+59
| | | | | | | | | | | | | | | * /Zc:trigraphs and /Zc:trigraphs- are now honored * /Zc:strictStrings is now honored * /Zc:auto is now honored/ignored (clang does the Right Thing for this already) Also add a dedicated test for the various /Zc: flags. clang-cl doesn't always agree with cl.exe on the default values for /Zc flags. For example, I think clang always behaves as if /Zc:inline is passed, and warns if the user explicitly passes /Zc:inline- Fixes PR21974. llvm-svn: 224791
* Add driver flags -ftrigraphs, -fno-trigraphs.Nico Weber2014-12-2310-20/+30
| | | | | | | | | | | | | | | | | -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
* Remove unused test input.Nico Weber2014-12-231-5/+0
| | | | llvm-svn: 224784
* Debug Info: Pass the pointer size into createMemberPointerType().Adrian Prantl2014-12-231-1/+1
| | | | | | Paired commit with LLVM. llvm-svn: 224781
OpenPOWER on IntegriCloud