Commit Graph

35110 Commits

Author SHA1 Message Date
Samuel Benzaquen f10662923a Add matcher for ExprWithCleanups.
Summary: Add matcher for ExprWithCleanups.

Reviewers: klimek

CC: cfe-commits, klimek

Differential Revision: http://llvm-reviews.chandlerc.com/D3248

llvm-svn: 205420
2014-04-02 13:12:14 +00:00
Samuel Benzaquen 2019cea863 Add support for named values in the parser.
Summary:
Add support for named values in the parser.
This allows injection of arbitrary constants using a custom Sema object.
Completions are not supported right now.

Will be used by clang_query to support the 'let' command.
Usage example:
  clang_query> let unique_ptr recordDecl(hasName("unique_ptr"))
  clang_query> match varDecl(hasType(unique_ptr))

Reviewers: klimek, pcc

CC: cfe-commits, klimek

Differential Revision: http://llvm-reviews.chandlerc.com/D3229

llvm-svn: 205419
2014-04-02 13:11:45 +00:00
David Blaikie abe1a398e3 Render anonymous entities as '(anonymous <thing>)' (and lambdas as '(lambda at ... )')
For namespaces, this is consistent with mangling and GCC's debug info
behavior. For structs, GCC uses <anonymous struct> but we prefer
consistency between all anonymous entities but don't want to confuse
them with template arguments, etc, so we'll just go with parens in all
cases.

llvm-svn: 205398
2014-04-02 05:58:29 +00:00
David Blaikie 5ee3d0080a Add the location of Decls to ast dump.
While investigating some debug info issues, Eric and I came across a
particular template case where the location of a decl was quite
different from the range of the same decl. It might've been rather
helpful if the dumper had actually showed us this.

llvm-svn: 205396
2014-04-02 05:48:29 +00:00
Reid Kleckner 5e8edbac4f Fix type mismatch assertion related to inalloca and PR19287
Augment the test case from r205217 to catch this related bug.

Fixes the Windows self-host which was failing on VariantValue.cpp.

llvm-svn: 205378
2014-04-02 00:16:53 +00:00
Eric Christopher 885c41b28c Partially revert r204517 and fix a different way:
We don't want to encourage the code to emit a lexical block for
a function that needs one in order for the line table to change,
we need to grab the line information from the body of the pattern
that we were instantiated from, this code should do that.

Modify the test case to ensure that we're still looking in the
right place for all of the scopes and also that we haven't
created a lexical block where we didn't need one.

llvm-svn: 205368
2014-04-01 22:25:28 +00:00
Aaron Ballman e044904301 Updating the capability attribute diagnostics to be more capability-neutral. Instead of using terminology such as "lock", "unlock" and "locked", the new terminology is "acquire", "release" and "held". Additionally, the capability attribute's name argument is now reported as part of the diagnostic, instead of hard coding as "mutex."
llvm-svn: 205359
2014-04-01 21:43:23 +00:00
Fariborz Jahanian 287e79a263 Objective-C modern translator. Fix declaration of
__NSConstantStringImpl's length field to accomodate
window's 64bit LLP64 mode. // rdar://16489050

llvm-svn: 205353
2014-04-01 19:32:35 +00:00
Richard Smith 911517848d Simplify FunctionDecl::getMinRequiredArguments().
llvm-svn: 205351
2014-04-01 19:18:16 +00:00
Richard Smith f97ad226dc Fix self-referential comment.
llvm-svn: 205340
2014-04-01 18:33:50 +00:00
Adrian Prantl efb8805161 Debug info: fix a crash when emitting IndirectFieldDecls, which were
previously not handled at all.
rdar://problem/16348575

llvm-svn: 205331
2014-04-01 17:52:06 +00:00
Jordan Rose 17f4160859 [analyzer] Extract a helper for finding the target region for a C++ constructor.
No functionality change.

Patch by Alex McCarthy!

llvm-svn: 205328
2014-04-01 16:40:06 +00:00
Jordan Rose a78de33494 [analyzer] Remove incorrect workaround for unimplemented temporary destructors.
If we're trying to get the zero element region of something that's not a region,
we should be returning UnknownVal, which is what ProgramState::getLValue will
do for us.

Patch by Alex McCarthy!

llvm-svn: 205327
2014-04-01 16:39:59 +00:00
Jordan Rose 398fb00e1e [analyzer] Fix a CFG printing bug.
Also, add several destructor-related tests. Most of them don't work yet, but it's
good to have them recorded.

Patch by Alex McCarthy!

llvm-svn: 205326
2014-04-01 16:39:33 +00:00
Alexey Samsonov bdfa6c2517 Add support for dynamic ASan runtime (on Linux) to Clang driver.
Based on http://llvm-reviews.chandlerc.com/D3043 by Yuri Gribov!

llvm-svn: 205310
2014-04-01 13:31:10 +00:00
Daniel Jasper e1e4319ab7 clang-format: Support configurable list of foreach-macros.
This fixes llvm.org/PR17242.

Patch by Brian Green, thank you!

llvm-svn: 205307
2014-04-01 12:55:11 +00:00
Tim Northover b17f9a4609 ARM64: add a few bits of polynomial intrinsic codegen.
llvm-svn: 205303
2014-04-01 12:23:08 +00:00
Tim Northover 74b2def0c5 ARM64: add missing ldN/stN intrinsics and enable tests.
llvm-svn: 205296
2014-04-01 10:37:47 +00:00
Ted Kremenek 8d265c2633 Add defensive check that argument may be null in call to compareConversionFunctions() on incorrect code.
I'm looking into getting a reduced test case, but it's not
immediately available.

Fixes <rdar://problem/16344806>

llvm-svn: 205285
2014-04-01 07:23:18 +00:00
David Majnemer 2e1e0491b7 MS ABI: Support mangling of return-types deducing to local types
The MS ABI forces us into catch-22 when it comes to functions which
return types which are local:

 - A function is mangled with it's return type.
 - A type is mangled with it's surrounding context.

Avoid this by mangling auto and decltype(autp) directly into the
function's return type.  Using this mangling has the double advantage of
being compatible with the C++ standard without crashing the compiler.

N.B. For the curious, the MSVC mangling leads to collisions amongst
template functions and either crashes when faced with local types or is
otherwise incapable of returning them.

llvm-svn: 205282
2014-04-01 05:29:46 +00:00
Adrian Prantl 6cdce9ed10 Adapt CGDebugInfo to interface changes in DIBuilder/DIImportedEntity.
The Decl field in a DIImportedEntity is now a DIRef.
Paired commit with LLVM.

llvm-svn: 205278
2014-04-01 03:41:01 +00:00
Jordan Rose 3a176ed16d [analyzer] Lock checker: Allow pthread_mutex_init to reinitialize a destroyed lock.
Patch by Daniel Fahlgren!

llvm-svn: 205276
2014-04-01 03:40:53 +00:00
Jordan Rose 7fcaa14a82 [analyzer] Lock checker: make sure locks aren't used after being destroyed.
Patch by Daniel Fahlgren!

llvm-svn: 205275
2014-04-01 03:40:47 +00:00
Jordan Rose 0696bb4cef [analyzer] Add double-unlock detection to PthreadLockChecker.
We've decided to punt on supporting recursive locks for now; the common case
is non-recursive.

Patch by Daniel Fahlgren!

llvm-svn: 205274
2014-04-01 03:40:38 +00:00
Bob Wilson fc6297f314 Disable this-return optimizations when targeting iOS 5 and earlier.
Clang implements the part of the ARM ABI saying that certain functions
(e.g., constructors and destructors) return "this", but Apple's version of
gcc and llvm-gcc did not. The libstdc++ dylib on iOS 5 was built with
llvm-gcc, which means that clang cannot safely assume that code from the C++
runtime will correctly follow the ABI. It is also possible to run into this
problem when linking with other libraries built with gcc or llvm-gcc. Even
though there is no way to reliably detect that situation, it is most likely
to come up when targeting older versions of iOS. Disabling the optimization
for any code targeting iOS 5 solves the libstdc++ problem and has a reasonably
good chance of fixing the issue for other older libraries as well.
<rdar://problem/16377159>

llvm-svn: 205272
2014-04-01 01:38:16 +00:00
David Majnemer 10befcf993 MS ABI: Simplify MangleByte further
It turns out that the ranges where the '?' <letter> manglings occur are
identical to the ranges of ASCII characters OR'd with 0x80.

Thanks to Richard Smith for the insight!

No functional change.

llvm-svn: 205270
2014-04-01 00:05:57 +00:00
David Blaikie 24bbfed221 Warn when requesting compress-debug-sections and zlib is not available
Another shot in the dark, since I do have zlib installed. Will be
watching the bots for fallout.

llvm-svn: 205265
2014-03-31 23:29:38 +00:00
Paul Robinson f067435026 Implement the 'optnone' attribute, which suppresses most optimizations
on a function.

llvm-svn: 205255
2014-03-31 22:29:15 +00:00
David Majnemer e49c4b6ff2 MS ABI: Simplify endian swapping code
No functionality change.

llvm-svn: 205250
2014-03-31 21:46:05 +00:00
Aaron Ballman fdd783a501 Unify __declspec attribute argument parsing with the common attribute argument parsing code.
This removes a diagnostic that is no longer required (the semantic engine now properly handles attribute syntax so __declspec and __attribute__ spellings no longer get mismatched). This caused several testcases to need updating for a slightly different wording.

llvm-svn: 205234
2014-03-31 18:18:43 +00:00
Aaron Ballman b8e203939e Introduced an attribute syntax-neutral method for parsing attribute arguments that is currently being used by GNU and C++-style attributes. This allows C++11 attributes with argument lists to be handled properly, fixing the "deprecated", "type_visibility", and capability-related attributes with arguments.
llvm-svn: 205226
2014-03-31 17:32:39 +00:00
David Majnemer 4b293ebbaa MS ABI: mangleStringLiteral shouldn't rely on the host's endianness
No test case is needed, the one in-tree is sufficient.  The build-bot
never emailed me because something else had upset it.

llvm-svn: 205225
2014-03-31 17:18:53 +00:00
David Majnemer 49e5b123d7 MS ABI: Document the '\xc1' to '\xda' manglings
No functionality change.

llvm-svn: 205223
2014-03-31 17:09:09 +00:00
David Majnemer 32b57b0a4c MS ABI: Use the proper type for inalloca args
Summary:
The definition of a type later in a translation unit may change it's
type from {}* to (%struct.foo*)*.  Earlier function definitions may use
the former while more recent definitions might use the later.  This is
fine until they interact with one another (like one calling the other).
In these cases, a bitcast is needed because the inalloca must match the
function call but the store to the lvalue which initializes the argument
slot has to match the rvalue's type.

This technique is along the same lines with what the other,
non-inalloca, codepaths perform.

This fixes PR19287.

Reviewers: rnk

CC: cfe-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D3224

llvm-svn: 205217
2014-03-31 16:12:47 +00:00
Tim Northover 0c68faa455 ARM64: enable aarch64-neon-intrinsics.c test
This adds support for the various NEON intrinsics used by
aarch64-neon-intrinsics.c (originally written for AArch64) and enables the
test.

My implementations are designed to be semantically correct, the actual code
quality looks like its a wash between the two backends, and is frequently
different (hence the large number of CHECK changes).

llvm-svn: 205210
2014-03-31 15:47:09 +00:00
Aaron Ballman 759c71d621 Post-commit review coding style change: renaming HasAttribute to hasAttribute. No functional changes.
llvm-svn: 205201
2014-03-31 15:26:40 +00:00
Nico Rieck 8ca0bfc57f Sema: Require external linkage for dll attributes
llvm-svn: 205198
2014-03-31 14:56:58 +00:00
Nico Rieck 82f0b06749 Sema: Check dll attributes on redeclarations
A redeclaration may not add dllimport or dllexport attributes. dllexport is
sticky and can be omitted on redeclarations while dllimport cannot.

llvm-svn: 205197
2014-03-31 14:56:15 +00:00
Daniel Jasper 240dfda352 clang-format: Solve issues found and fixed by clang-tidy.
llvm-svn: 205193
2014-03-31 14:23:49 +00:00
Aaron Ballman 2fbf99429a Reapplying r204952 a second time.
Clean up the __has_attribute implementation without modifying its behavior. 

Replaces the tablegen-driven AttrSpellings.inc, which lived in the lexing layer with AttrHasAttributeImpl.inc, which lives in the basic layer. Updates the preprocessor to call through to this new functionality which can take additional information into account (such as scopes and syntaxes).

Expose the ability for parts of the compiler to ask whether an attribute is supported for a given spelling (including scope), syntax, triple and language options.

llvm-svn: 205181
2014-03-31 13:14:44 +00:00
Timur Iskhodzhanov 9ae7d3bd5f Slightly improve the readability of MicrosoftVTableContext::computeVTablePaths(). No functionality changes.
llvm-svn: 205178
2014-03-31 11:01:51 +00:00
Alexey Volkov ae43aae96a Added _rdtsc intrinsics by Robert Khasanov
Differential Revision: http://llvm-reviews.chandlerc.com/D3212

llvm-svn: 205172
2014-03-31 08:08:46 +00:00
Dmitri Gribenko f461da5306 Remove unused variable
llvm-svn: 205169
2014-03-31 07:52:35 +00:00
Tim Northover 6166ec21be ARM64: remove currently trivial switch statement
llvm-svn: 205167
2014-03-31 07:20:13 +00:00
Alexey Bataev d48bcd8a46 [OPENMP] Implemented 'copyin' clause
llvm-svn: 205164
2014-03-31 03:36:38 +00:00
Tim Northover 65f582f432 RTTI: refactor the uniqueness question into CGCXXABI.
This also brings the code into closer conformance with usual LLVM
coding style and other surrounding conventions.

llvm-svn: 205158
2014-03-30 17:32:48 +00:00
David Majnemer 981c306e4a MS ABI: Correct typo in mangleStringLiteral
No functionality change.

llvm-svn: 205156
2014-03-30 16:38:02 +00:00
David Majnemer 8265decf46 MS ABI: Simplify mangleTemplateArgs
No functionality change.

llvm-svn: 205154
2014-03-30 16:30:54 +00:00
Hal Finkel ecdb454aa7 [PowerPC] Make -pg generate calls to _mcount not mcount
At least on REL6 (Linux/glibc 2.12), the proper symbol for generating gprof
data is _mcount, not mcount. Prior to this change, compiling with -pg would
generate linking errors (because of unresolved references to mcount), after
this change -pg seems at least minimally functional.

llvm-svn: 205144
2014-03-30 13:00:06 +00:00
David Majnemer ee4f4025c3 Sema: Implement DR317
Summary:
Declaring a function as inline after it has been defined is in violation
of [dcl.fct.spec]p4.  The program would get a strong definition instead
of getting a function with linkonce_odr linkage.

Reviewers: rsmith

CC: cfe-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D3220

llvm-svn: 205129
2014-03-30 06:44:54 +00:00