summaryrefslogtreecommitdiffstats
path: root/clang/test
Commit message (Collapse)AuthorAgeFilesLines
...
* PR21909: Don't try (and crash) to generate debug info for explicit ↵David Blaikie2014-12-161-0/+8
| | | | | | instantiations of explicit specializations. llvm-svn: 224394
* DR1684: a constexpr member function need not be a member of a literal class ↵Richard Smith2014-12-166-15/+14
| | | | | | type. llvm-svn: 224388
* Try typo correction on all initialization arguments and be lessKaelyn Takata2014-12-161-0/+4
| | | | | | | | | pessimistic about when to do so. This also fixes PR21905 as the initialization argument was no longer viewed as being type dependent due to the TypoExpr being type-cast. llvm-svn: 224386
* DebugInfo: Generalize debug info location handlingDavid Blaikie2014-12-162-11/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: 224385
* Look at whether TransformTypos returned a different Expr instead of looking ↵Nick Lewycky2014-12-161-0/+13
| | | | | | | | at the number of uncorrected typos before and after. Correcting one typo may produce an expression with another TypoExpr in it, leading to matching counts even though a typo was corrected. Fixes PR21925! llvm-svn: 224380
* Fix handling of invalid -O options.Rafael Espindola2014-12-161-3/+4
| | | | | | | | We were checking the value after truncating it to a bitfield. Thanks to Yunzhong Gao for noticing it. llvm-svn: 224378
* Add a new flag, -fspell-checking-limit=<number> to control how many times ↵Nick Lewycky2014-12-163-375/+356
| | | | | | | | we'll do spell checking. Note that spell checking will change the produced AST, so we don't automatically change this value when someone sets -ferror-limit=. With this, merge test typo-correction-pt2.cpp into typo-correction.cpp. Remove Sema::UnqualifiedTyposCorrected, a cache of corrected typos. It would only cache typo corrections that didn't provide ValidateCandidate of which there were few left, and it had a bug when we had the same identifier spelled wrong twice. See the last two tests in typo-correction.cpp for cases this fires. llvm-svn: 224375
* Move -Wkeyword-macro into -pedantic, remove -Wreserved-id-macro.Nico Weber2014-12-162-14/+14
| | | | | | | | | | | | | | | | | | | As discussed on the post-commit review thread for r224012, -Wkeyword-macro fires mostly on headers trying to set up portable defines and doesn't find much bad stuff in practice. But [macro.names]p2 does disallow defining or undefining keywords, override and final, and alignas, so keep the warning but move it into -pedantic. -Wreserved-id-macro warns on #define __need_size_t which is more or less public api for glibc headers. Since this warning isn't motivated by a standard, remove it. (See also r223114 for a previous follow-up to r224012.) llvm-svn: 224371
* Put static local variables of inline functions in the function comdat.Rafael Espindola2014-12-161-6/+3
| | | | | | | | | | | | | | | | | | | | | | | | The variable (and the GV) is only ever used if the function is. Putting it in the function's comdat make it easier for the linker to discard them. The motivating example is struct S { static const int x; }; // const int S::x = 42; inline const int *f() { static const int y = S::x; return &y; } const int *g() { return f(); } With S::x commented out, _ZZ1fvE1y is a variable with a guard variable that is initialized by f. With S::x present, _ZZ1fvE1y is a constant. llvm-svn: 224369
* Consider calls from implict host device functions as valid in SemaCUDA.Jacques Pienaar2014-12-162-4/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | In SemaCUDA all implicit functions were considered host device, this led to errors such as the following code snippet failing to compile: struct Copyable { const Copyable& operator=(const Copyable& x) { return *this; } }; struct Simple { Copyable b; }; void foo() { Simple a, b; a = b; } Above the implicit copy assignment operator was inferred as host device but there was only a host assignment copy defined which is an error in device compilation mode. Differential Revision: http://reviews.llvm.org/D6565 llvm-svn: 224358
* [OPENMP] Bugfix for processing of global variables in OpenMP regions.Alexey Bataev2014-12-162-3/+155
| | | | | | | | Currently, if global variable is marked as a private OpenMP variable, the compiler crashes in debug version or generates incorrect code in release version. It happens because in the OpenMP region the original global variable is used instead of the generated private copy. It happens because currently globals variables are not captured in the OpenMP region. This patch adds capturing of global variables iff private copy of the global variable must be used in the OpenMP region. Differential Revision: http://reviews.llvm.org/D6259 llvm-svn: 224323
* Sema: Don't crash converting to bool from _AtomicDavid Majnemer2014-12-161-0/+4
| | | | | | | | | | | Turning our _Atomic L-value into an R-value removes its _Atomic-ness. However, we didn't update our 'FromType' which made ScalarTypeToBooleanCastKind think we were trying to pass it a non-scalar. This fixes PR21836. llvm-svn: 224322
* Improve handling of value dependent expressions in ↵Nick Lewycky2014-12-161-0/+41
| | | | | | __attribute__((enable_if)), both in the condition expression and at the call site. Fixes PR20988! llvm-svn: 224320
* AST: Fix the linkage of static vars in fn template specializationsDavid Majnemer2014-12-161-0/+19
| | | | | | | | | | | | We that static variables in function template specializations were externally visible. The manglers assumed that externally visible static variables were numbered in Sema. We would end up mangling static variables in the same specialization with the same mangling number which would give all of them the same name. This fixes PR21904. llvm-svn: 224316
* Sema: Check value dependent casts when possibleDavid Majnemer2014-12-161-0/+3
| | | | | | | | | | We know that const_cast<char *>((void)Something) is ill-formed, even if 'Something' is dependent because you can't cast from void to a pointer type. This fixes PR21845. llvm-svn: 224299
* Diagnose function template definitions inside functionsReid Kleckner2014-12-152-1/+14
| | | | | | | | | | | | | | | The parser can only be tricked into parsing a function template definition by inserting a typename keyword before the function template declaration. This used to make us crash, and now it's fixed. While here, remove an unneeded boolean parameter from ParseDeclGroup. This boolean always corresponded to non-typedef declarators at file scope. ParseDeclGroup already has precise diagnostics for the function definition typedef case, so we can let that through. Fixes PR21839. llvm-svn: 224287
* Handle errors in lambda prototype instantiation correctlyReid Kleckner2014-12-151-0/+14
| | | | | | | | | | | | Previously we would attempt to build a TypeSourceInfo for a null type, and then we would forget to pop the function scope before returning an error. Reviewers: rsmith Differential Revision: http://reviews.llvm.org/D6665 llvm-svn: 224271
* Sema: Cleanup and improve string-plus-char checking.Daniel Marjamaki2014-12-151-0/+15
| | | | | | Patch by Anders Rönnholm llvm-svn: 224268
* Update this testcase for the new metadata assembler syntax.Adrian Prantl2014-12-151-1/+1
| | | | llvm-svn: 224262
* IR: Make metadata typeless in assembly, clang sideDuncan P. N. Exon Smith2014-12-15119-838/+838
| | | | | | Match LLVM changes from r224257. llvm-svn: 224259
* Warn when attribute 'optnone' conflicts with attributes on aPaul Robinson2014-12-151-0/+18
| | | | | | different declaration of the same function. llvm-svn: 224256
* Sema: Don't diagnose string + int if the int is value dependentDavid Majnemer2014-12-151-0/+5
| | | | | | | | | | | Don't send a value dependent expression into the expression evaluator, HandleSizeof would crash. Making HandleSizeof handle dependent types would noisily warn about the operation even if everything turns out OK after instantiation. This fixes PR21848. llvm-svn: 224240
* Preprocessor: Recover instead of mutating a token in ExpandBuiltinMacroDavid Majnemer2014-12-151-1/+8
| | | | | | | | | | | We would CreateString on arbitrary garbage instead of just skipping to the end of the builtin macro. Eventually, this would cause us to crash because we would end up replacing the contents of a character token with a numeric literal. This fixes PR21825. llvm-svn: 224238
* Sema: Don't leave switch stack inconsistent when recoveringDavid Majnemer2014-12-151-0/+9
| | | | | | | | | We would exit Sema::ActOnFinishSwitchStmt early if we didn't have a body. This would leave an extra SwitchStmt on the SwitchStack. This fixes PR21841. llvm-svn: 224237
* Test for 'omp for' (for r224233).Alexander Musman2014-12-151-0/+91
| | | | llvm-svn: 224234
* Parse: Don't reorder tokens using ConsumeTokenDavid Majnemer2014-12-151-0/+5
| | | | | | | | | ConsumeToken doesn't work with special tokens. Instead, just use PP.Lex to eat the token. This fixes PR21817. llvm-svn: 224232
* Fixed test/CodeGen/atomic_ops.c for compatibility with hexagon targetAlexey Bataev2014-12-151-3/+3
| | | | llvm-svn: 224231
* Bugfix for Codegen of atomic load/store/other ops.Alexey Bataev2014-12-152-7/+476
| | | | | | | Currently clang fires assertions on x86-64 on any atomic operations for long double operands. Patch fixes codegen for such operations. Differential Revision: http://reviews.llvm.org/D6499 llvm-svn: 224230
* MSVC: A wide string literal from L#macro_arg in a macroAlexey Bataev2014-12-151-0/+11
| | | | | | | | Clang should form a wide string literal from L#macro_arg in a function-like macro in -fms-compatibility mode. Fix for http://llvm.org/PR9984. Differential Revision: http://reviews.llvm.org/D6604 llvm-svn: 224228
* DebugInfo: More accurate line information for placement new.David Blaikie2014-12-141-3/+5
| | | | | | | | | | | This actually came up as a break in UBSan tests (look for a follow-up commit to this one to see the UBSan test fallout) when I tried a broader fix to location information. I have some other ideas about how to do that broader change & will keep looking into it. llvm-svn: 224221
* CodeGen: Compound literals with funny types shouldn't crashDavid Majnemer2014-12-142-2/+15
| | | | | | | | | | | | | | | | | CodeGen assumed that a compound literal with array type should have a corresponding LLVM IR array type. We had two bugs in this area: - Zero sized arrays in compound literals would lead to the creation of an opaque type. This is unnecessary, we should just create an array type with a bound of zero. - Funny record types (like unions) lead to exotic IR types for compound literals. In this case, CodeGen must be prepared to deal with the possibility that it might not have an array IR type. This fixes PR21912. llvm-svn: 224219
* AST: Limit zero-sized constexpr behavior to array typesDavid Majnemer2014-12-141-1/+2
| | | | | | | Restricting this "extension" to array types maximizes our standards conformance while not miscompiling real-world programs. llvm-svn: 224215
* Lex: Don't crash if both conflict markers are on the same lineDavid Majnemer2014-12-141-0/+2
| | | | | | | | | | We would check if the terminator marker is on a newline. However, the logic would end up out-of-bounds if the terminator marker immediately follows the start marker. This fixes PR21820. llvm-svn: 224210
* If a non-template constructor instantiated to X(X),John McCall2014-12-141-1/+49
| | | | | | | | | | | | | | | | | | | | | | | ignore it during overload resolution when initializing X from a value of type cv X. Previously, our rule here only ignored specializations of constructor templates. That's probably because the standard says that constructors are outright ill-formed if their first parameter is literally X and they're callable with one argument. However, Clang only enforces that prohibition against non-implicit instantiations; I'm not sure why, but it seems to be deliberate. Given that, the most sensible thing to do is to just ignore the "illegal" constructor regardless of where it came from. Also, stop ignoring such constructors silently: print a note explaining why they're being ignored. Fixes <rdar://19199836>. llvm-svn: 224205
* Sema: attribute((annotate)) must have at least one argumentDavid Majnemer2014-12-141-0/+1
| | | | | | | | | | Sema::handleAnnotateAttr expects that some basic validation is done on the given AttributeList. However, ProcessAccessDeclAttributeList called it directly. Instead, pass the list to ProcessDeclAttribute. This fixes PR21847. llvm-svn: 224204
* clang-cl: Fix handling of the /volatile flag (PR21893)Hans Wennborg2014-12-131-1/+2
| | | | | | | | The /volatile:iso flag is our default behaviour, so it can be ignored. Parse /volatile:ms as unsupported. llvm-svn: 224202
* clang-cl: ignore /cgthreads (PR21894)Hans Wennborg2014-12-131-0/+2
| | | | llvm-svn: 224201
* clang-cl: Make /Gd ignored instead of unsupportedHans Wennborg2014-12-131-0/+1
| | | | | | | /Gd is the default calling convention setting, so we don't need to take any action. llvm-svn: 224200
* clang-cl: Add unsupported /Gv option (PR21892)Hans Wennborg2014-12-131-0/+1
| | | | | | We don't currently support any of the calling convention options. llvm-svn: 224199
* Parse: MS property members cannot have an in-class initializerDavid Majnemer2014-12-131-0/+1
| | | | | | | | | We would crash trying to treat a property member as a field. These shoudl be forbidden anyway, reject programs which contain them. This fixes PR21840. llvm-svn: 224193
* Sema: Constexpr functions must have return statements which have an exprDavid Majnemer2014-12-131-0/+5
| | | | | | | | | | | | | | | clang lets programmers be pretty cavalier when it comes to void return statements in functions which have non-void return types. However, we cannot be so forgiving in constexpr functions: evaluation will go off the rails very quickly. Instead, keep the return statement in the AST but mark the function as invalid. Doing so gives us nice diagnostics while making constexpr evaluation halt. This fixes PR21859. llvm-svn: 224189
* Pretty print support for template arg enum constantsWill Wilson2014-12-132-1/+25
| | | | llvm-svn: 224184
* Fix two small bugs in typo correction. One assertion failure building member ↵Nick Lewycky2014-12-131-0/+24
| | | | | | | | expressions because the lookup finds a different name than the original, fixed by updating the LookupResult's name with the name of the found decl. Second is that we also diagnose delayed typo exprs in the index of an array subscript expression. The testcase shows a third bug with a FIXME in it. llvm-svn: 224183
* Implement feedback on r224172 in PR21899Reid Kleckner2014-12-131-14/+5
| | | | | | Based on suggestions from Kaelyn. llvm-svn: 224173
* Typo correction: Ignore temporary binding exprs after overload resolutionReid Kleckner2014-12-131-0/+20
| | | | | | | | Transformation of a CallExpr doesn't always result in a new CallExpr. Fixes PR21899. llvm-svn: 224172
* Implement the __builtin_call_with_static_chain GNU extension.Peter Collingbourne2014-12-123-0/+65
| | | | | | | | | | | | | | | | The extension has the following syntax: __builtin_call_with_static_chain(Call, Chain) where Call must be a function call expression and Chain must be of pointer type This extension performs a function call Call with a static chain pointer Chain passed to the callee in a designated register. This is useful for calling foreign language functions whose ABI uses static chain pointers (e.g. to implement closures). Differential Revision: http://reviews.llvm.org/D6332 llvm-svn: 224167
* Frontend: Canonicalize to native paths when dumping module dependenciesJustin Bogner2014-12-121-5/+5
| | | | | | | | | | | | Mixed path separators (ie, both / and \\) can mess up the sort order of the VFS map when dumping module dependencies, as was recently exposed by r224055 and papered over in r224145. Instead, we should simply use native paths for consistency. This also adds a TODO to add handling of .. in paths. There was some code for this before r224055, but it was untested and probably broken. llvm-svn: 224164
* Allow module deps to be printed in an arbitrary orderReid Kleckner2014-12-121-5/+5
| | | | | | | The order is different between Windows and Unix for reasons unknown, but the compiler output appears to still be determinstic. llvm-svn: 224145
* Fix the issue of mangling of local anonymous unions (Itanium C++ ABI):Evgeny Astigeevich2014-12-121-0/+42
| | | | | | | | | | | | | | | | | | | | | | A discriminator is used for the first occurrence of a name. inline int f1 () { static union { int a; long int b; }; static union { int c; double d; }; return a+c; } The name of the second union is mangled as _ZZ2f1vE1c_0 instead of _ZZ2f1vE1c. Differential Revision: http://reviews.llvm.org/D6295 llvm-svn: 224131
* CodeGen: Loads/stores to allocas for atomic ops shouldn't be volatileDavid Majnemer2014-12-121-0/+32
| | | | | | | | | Don't inherit the volatile-ness of the input pointer to the volatile operation for memory allocated on the side. This fixes PR17306. llvm-svn: 224110
OpenPOWER on IntegriCloud