summaryrefslogtreecommitdiffstats
path: root/clang
Commit message (Collapse)AuthorAgeFilesLines
...
* Recognize .lib files as linker input explicitlyEhsan Akhgari2014-09-101-0/+1
| | | | | | | | | | | | | | | | Summary: Currently, this is done implicitly in Driver::BuildInputs by considering any invalid input type as linker input. Test Plan: I don't think this behavior is observable for the reason stated above. Reviewers: hansw Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D5294 llvm-svn: 217522
* Add a test for an operator access decl.Nico Weber2014-09-101-1/+7
| | | | | | | | | | In Parser::ParseCXXClassMemberDeclaration(), it was possible to change isAccessDecl = NextToken().is(tok::kw_operator); to isAccessDecl = false; and no tests would fail. Now there's coverage for this. llvm-svn: 217519
* typoSanjay Patel2014-09-101-1/+1
| | | | llvm-svn: 217517
* [analyzer] Fix pthread lock tests so that the API comes from a system header.Jordan Rose2014-09-102-23/+45
| | | | | | | | ...and verify that a global mutex in user code can be used without warnings. Patch by Aleksei Sidorin! llvm-svn: 217515
* clang-format: Add option to allow short case labels on a single line.Daniel Jasper2014-09-104-6/+85
| | | | | | | | | | | | | | | | | | | | | | | | | | On a single line: switch (a) { case 1: x = 1; return; case 2: x = 2; return; default: break; } Not on a single line: switch (a) { case 1: x = 1; return; case 2: x = 2; return; default: break; } This partly addresses llvm.org/PR16535. In the long run, we probably want to lay these out in columns. llvm-svn: 217501
* CodeGen: Use a fixed alignment for vtables.Benjamin Kramer2014-09-102-0/+20
| | | | | | | | | | | | | | | Pointer-sized alignment is sufficient as we only ever read single values from the table. Otherwise we'd bump the alignment to 16 bytes in the backend if the vtable is larger than 16 bytes. This is great for structures that are accessed with vector instructions or copied around, but that's simply not the case for vtables. Shrinks the data segment of a Release x86_64 clang by 0.3%. The wins are larger for i386 and code bases that use vtables more often than we do. This matches the behavior of GCC 5. llvm-svn: 217495
* Revert over-eager unique_ptr conversion.Benjamin Kramer2014-09-101-6/+6
| | | | | | | This test wants to observe PPCallbacks after they have been moved into the preprocessor. That doesn't work if the pointer has been moved away. llvm-svn: 217481
* Unique_ptrify PPCallbacks ownership.Craig Topper2014-09-1018-45/+50
| | | | | | Unique_ptr creation stil needs to be moved earlier at some of the call sites. llvm-svn: 217474
* Don't crash on access decls with invalid scope specifier, PR20887.Nico Weber2014-09-102-0/+10
| | | | llvm-svn: 217472
* Objective-C. Under a special flag, -Wcstring-format-directive,Fariborz Jahanian2014-09-0912-11/+249
| | | | | | | | off by default, issue a warning if %s directive is used in certain CF/NS formatting APIs, to assist user in deprecating use of such %s in these APIs. rdar://18182443 llvm-svn: 217467
* Teach the analyzer that __builtin_assume_aligned returns its first argument.Jordan Rose2014-09-092-1/+31
| | | | | | Patch by Daniel Fahlgren! llvm-svn: 217461
* clang-format: [JS] Support regex literals with trailing escaped slash.Daniel Jasper2014-09-095-38/+71
| | | | | | | | | | | | | | | | | | Before: var regex = / a\//; int i; After: var regex = /a\//; int i; This required pushing the Lexer into its wrapper class and generating a new one in this specific case. Otherwise, the sequence get lexed as a //-comment. This is hacky, but I don't know a better way (short of supporting regex literals in the Lexer). Pushing the Lexer down seems to make all the call sites simpler. llvm-svn: 217444
* Tooling: Ignore file names in tooling::deduplicate.Benjamin Kramer2014-09-093-8/+26
| | | | | | | | | | | This was horribly broken due to how the sort predicate works. We would report a conflict for files with a replacement in the same position but different names if the length differed. Just ignore paths as this is often what the user wants. Files can occur with different names (due to symlinks or relative paths) and we don't ever want to do the same edit in one file twice. llvm-svn: 217439
* Allow empty statements in naked functions in addition to ASM statementsEhsan Akhgari2014-09-092-1/+10
| | | | | | | | | | | | Summary: This fixes PR20883. Test Plan: The patch includes an automated test. Reviewers: hansw Differential Revision: http://reviews.llvm.org/D5256 llvm-svn: 217413
* Fix PCHs that import more than one moduleBen Langmuir2014-09-083-1/+6
| | | | | | | We were passing < to std::unique, but it expects ==. Since the input is sorted, we were always trimming it to one entry. llvm-svn: 217402
* Report source location of returns_nonnull attribute in UBSan reports.Alexey Samsonov2014-09-081-9/+11
| | | | llvm-svn: 217400
* Implement nonnull-attribute sanitizerAlexey Samsonov2014-09-089-40/+108
| | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch implements a new UBSan check, which verifies that function arguments declared to be nonnull with __attribute__((nonnull)) are actually nonnull in runtime. To implement this check, we pass FunctionDecl to CodeGenFunction::EmitCallArgs (where applicable) and if function declaration has nonnull attribute specified for a certain formal parameter, we compare the corresponding RValue to null as soon as it's calculated. Test Plan: regression test suite Reviewers: rsmith Reviewed By: rsmith Subscribers: cfe-commits, rnk Differential Revision: http://reviews.llvm.org/D5082 llvm-svn: 217389
* Remove a parameter that has been unused since r188481. No behavior change.Nico Weber2014-09-082-4/+3
| | | | llvm-svn: 217386
* Make FileEntry::getName() valid across calls to FileManager::getFile()Ben Langmuir2014-09-082-4/+17
| | | | | | | | | Because we may change the name of a FileEntry inside getFile, the name returned by FileEntry::getName() could be destroyed. This was causing a use-after-free when searching the HeaderFileInfo on-disk hashtable for a module or pch. llvm-svn: 217385
* Add a comment for something that confused me.Nico Weber2014-09-081-0/+1
| | | | llvm-svn: 217384
* Handle constructors and destructors a bit more uniformly in CodeGen.Rafael Espindola2014-09-089-173/+161
| | | | | | | | | There were code paths that are duplicated for constructors and destructors just because we have both CXXCtorType and CXXDtorsTypes. This patch introduces an unified enum and reduces code deplication a bit. llvm-svn: 217383
* Add .clang-tidy configuration file to provide LLVM-optimized defaults for ↵Alexander Kornienko2014-09-081-0/+1
| | | | | | | | | | | | | | clang-tidy. Reviewers: chandlerc, djasper, alexfh Reviewed By: alexfh Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D5237 llvm-svn: 217366
* clang/test/CodeGen/builtin-assume*.c: Fixup for -Asserts.NAKAMURA Takumi2014-09-082-21/+22
| | | | llvm-svn: 217352
* Don't test really-large alignments for nowHal Finkel2014-09-081-1/+3
| | | | | | | | Temporarily comment out the test for really-large powers of two. This seems to be host-sensitive for some reason... trying to fix the clang-i386-freebsd builder. llvm-svn: 217351
* Add __builtin_assume and __builtin_assume_aligned using @llvm.assume.Hal Finkel2014-09-0715-12/+285
| | | | | | | | | | | This makes use of the recently-added @llvm.assume intrinsic to implement a __builtin_assume(bool) intrinsic (to provide additional information to the optimizer). This hooks up __assume in MS-compatibility mode to mirror __builtin_assume (the semantics have been intentionally kept compatible), and implements GCC's __builtin_assume_aligned as assume((p - o) & mask == 0). LLVM now contains special logic to deal with assumptions of this form. llvm-svn: 217349
* Adjust test/CodeGenCXX/pr12251.cppHal Finkel2014-09-071-3/+2
| | | | | | | | InstCombine just got a bit smarter about checking known bits of returned values, and because this test runs the optimizer, it requires an update. We should really rewrite this test to directly check the IR output from CodeGen. llvm-svn: 217347
* Avoid writing to the test directory as it may not be writable.David Blaikie2014-09-071-2/+2
| | | | llvm-svn: 217339
* Fix test to not write output to the test directory, as it may not be writable.David Blaikie2014-09-071-2/+2
| | | | llvm-svn: 217337
* Try to green test/Sema/format-strings.c on Win botsHans Wennborg2014-09-072-3/+7
| | | | llvm-svn: 217327
* MS format strings: parse the 'Z' printf conversion specifier (PR20808)Hans Wennborg2014-09-074-3/+26
| | | | llvm-svn: 217326
* Move x86-specific bits of warn-unused-local-typedef.cpp into their own file.Nico Weber2014-09-062-16/+17
| | | | | | | That way, most of the test can run everywhere. Also give the new file an x86 triple in addition to a REQUIRES line. llvm-svn: 217314
* Attempt to fix ARM bot. (The test references a typedef from x86 asm.)Nico Weber2014-09-061-0/+1
| | | | llvm-svn: 217313
* [x86] Clean up the x86 builtin specs to reflect r217310 in LLVM whichChandler Carruth2014-09-063-16/+16
| | | | | | | | | | | | | | | made the 8-bit masks actually 8-bit arguments to these intrinsics. These builtins are a mess. Many were missing the I qualifier which I added where obviously correct. Most aren't tested, but I've updated the relevant tests. I've tried to catch all the things that should become 'c' in this round. It's also frustrating because the set of these is really ad-hoc and doesn't really map that cleanly to the set supported by either GCC or LLVM. Oh well... llvm-svn: 217311
* Add error, recovery and fixit for "~A::A() {...}".Richard Smith2014-09-064-2/+44
| | | | llvm-svn: 217302
* Add -Wunused-local-typedef, a warning that finds unused local typedefs.Nico Weber2014-09-0625-12/+451
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The warning warns on TypedefNameDecls -- typedefs and C++11 using aliases -- that are !isReferenced(). Since the isReferenced() bit on TypedefNameDecls wasn't used for anything before this warning it wasn't always set correctly, so this patch also adds a few missing MarkAnyDeclReferenced() calls in various places for TypedefNameDecls. This is made a bit complicated due to local typedefs possibly being used only after their local scope has closed. Consider: template <class T> void template_fun(T t) { typename T::Foo s3foo; // YYY (void)s3foo; } void template_fun_user() { struct Local { typedef int Foo; // XXX } p; template_fun(p); } Here the typedef in XXX is only used at end-of-translation unit, when YYY in template_fun() gets instantiated. To handle this, typedefs that are unused when their scope exits are added to a set of potentially unused typedefs, and that set gets checked at end-of-TU. Typedefs that are still unused at that point then get warned on. There's also serialization code for this set, so that the warning works with precompiled headers and modules. For modules, the warning is emitted when the module is built, for precompiled headers each time the header gets used. Finally, consider a function using C++14 auto return types to return a local type defined in a header: auto f() { struct S { typedef int a; }; return S(); } Here, the typedef escapes its local scope and could be used by only some translation units including the header. To not warn on this, add a RecursiveASTVisitor that marks all delcs on local types returned from auto functions as referenced. (Except if it's a function with internal linkage, or the decls are private and the local type has no friends -- in these cases, it _is_ safe to warn.) Several of the included testcases (most of the interesting ones) were provided by Richard Smith. (gcc's spelling -Wunused-local-typedefs is supported as an alias for this warning.) llvm-svn: 217298
* Reword switch/goto diagnostics "protected scope" diagnostics. Making up a termRichard Smith2014-09-0621-104/+107
| | | | | | | | "protected scope" is very unhelpful here and actively confuses users. Instead, simply state the nature of the problem in the diagnostic: we cannot jump from here to there. The notes explain nicely why not. llvm-svn: 217293
* Fix r217275 to work without the need for standard headers being includedDavid Blaikie2014-09-052-4/+0
| | | | | | | | It seems (I guess) in ObjC that va_list is provided without the need for inclusions. I verified that with this change the test still crashes in the absence of the fix committed in r217275. llvm-svn: 217290
* Move the initialization of VAListTagName after InitializeSema()Ben Langmuir2014-09-055-2/+40
| | | | | | | | | | | | | | | | | | | | This innocuous statement to get the identifier info for __va_list_tag was causing an assertion failure: NextIsPrevious() && "decl became non-canonical unexpectedly" if the __va_list_tag identifier was found in a PCH in some circumstances, because it was looked up before the ASTReader had a Sema object to use to find existing decls to merge with. We could possibly move getting the identifier info even later, or make it lazy if we wanted to, but this seemed like the minimal change. Now why a PCH would have this identifier in the first place is a bit mysterious. This seems to be related to the global module index in some way, because when the test case is built without the global module index it will not emit an identifier for __va_list_tag into the PCH, but with the global module index it does. llvm-svn: 217275
* Separate the matchers by type and statically dispatch to the right list.Samuel Benzaquen2014-09-052-44/+88
| | | | | | | | | | | | | | | | | Summary: Separate the matchers by type and statically dispatch to the right list. For any node type that we support, it reduces the number of matchers we run it through. For node types we do not support, it makes match() a noop. This change improves our clang-tidy related benchmark by ~30%. Reviewers: klimek Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D5197 llvm-svn: 217274
* Require an x86 target for ms-inline-asm-return.cpp instead of XFAILReid Kleckner2014-09-051-1/+1
| | | | llvm-svn: 217272
* -frewrite-includes: Normalize line endings to match the main source fileReid Kleckner2014-09-051-52/+90
| | | | | | | | | | | | | | | | | | | | | | It is very common to include headers with DOS-style line endings, such as windows.h, from source files with Unix-style line endings. Previously, we would end up with mixed line endings and #endifs that appeared to be on the same line: #if 0 /* expanded by -frewrite-includes */ #include <windows.h>^M#endif /* expanded by -frewrite-includes */ Clang treats either of \r or \n as a line ending character, so this is purely a cosmetic issue. This has no automated test because most Unix tools on Windows will implictly convert CRLF to LF when reading files, making it very hard to detect line ending mismatches. FileCheck doesn't understand {{\r}} either. Fixes PR20552. llvm-svn: 217259
* [analyzer] Don't crash if malloc() has an unexpected function prototype.Jordan Rose2014-09-052-4/+21
| | | | | | Patch by Daniel Fahlgren! llvm-svn: 217258
* [ARMv8] Add support for 32-bit MIN/MAXNM and directed rounding.James Molloy2014-09-054-12/+153
| | | | | | | | This patch adds support for the 32bit numeric max/min and directed round-to-integral NEON intrinsics that were added as part of v8, along with unit tests. Patch by Graham Hunter! llvm-svn: 217242
* Mark ms-inline-asm as xfail on ARMRenato Golin2014-09-051-0/+1
| | | | llvm-svn: 217241
* clang-format: [JS] Format embedded function literals more efficently.Daniel Jasper2014-09-052-9/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Before: return { a: a, link: function() { f(); // }, link: function() { f(); // } }; After: return { a: a, link: function() { f(); // }, link: function() { f(); // } }; llvm-svn: 217238
* clang-format: [JS] JavaScript does not have the */&/&& madness.Daniel Jasper2014-09-052-0/+7
| | | | | | | | | | | | | Before: e&& e.SomeFunction(); After: e && e.SomeFunction(); Yeah, this might be useful for C++, too, but it is not such a frequent pattern there (plus the fix is much harder). llvm-svn: 217237
* clang-format: [JS] Better support for empty function literals.Daniel Jasper2014-09-052-0/+8
| | | | | | | | | | Before: SomeFunction(function(){}); After: SomeFunction(function() {}); llvm-svn: 217236
* clang-format: [JS] Fix indentation in dict literals.Daniel Jasper2014-09-052-2/+11
| | | | | | | | | | | | | | | | | | Before: return { 'finish': // a }; After: return { 'finish': // a }; llvm-svn: 217235
* clang/test/CXX/drs/dr5xx.cpp: Fix up assumption of thiscall. It affects not ↵NAKAMURA Takumi2014-09-051-2/+2
| | | | | | | | x64 but x86. Note, i686-cygwin doesn't use thiscall. llvm-svn: 217234
* Remove suppression of dr547 test and instead test that deduction succeeds if weRichard Smith2014-09-052-7/+15
| | | | | | | | use __thiscall. (This doesn't actually work for MSVC; they don't allow the __thiscall qualifier here, but it's sufficient to demonstrate that we do implement the intent of the DR.) llvm-svn: 217213
OpenPOWER on IntegriCloud