Commit Graph

18643 Commits

Author SHA1 Message Date
Richard Smith d943fc3429 Remove some unreachable (and wrong) code and replace it with an assertion.
llvm-svn: 183206
2013-06-04 04:45:03 +00:00
Aaron Ballman 5d041beb4e Adding support for MSVC #pragma detect_mismatch functionality by emitting a FAILIFMISMATCH linker command into the object file.
llvm-svn: 183178
2013-06-04 02:07:14 +00:00
David Blaikie 6df859d859 Bound member function diagnostic - suggest no-args calls and note overload candidates
Still missing cases for templates, but this is a step in the right
direction. Also omits suggestions that would be ambiguous (eg: void
func(int = 0); + void func(float = 0); func;)

llvm-svn: 183173
2013-06-04 00:28:46 +00:00
Bob Wilson 1710d59553 Do not report -Wasm-operand-widths for ARM output operands. <rdar://14050337>
We're getting reports of this warning getting triggered in cases where it
is not adding any value. There is no asm operand modifier that you can use
to silence it, and there's really nothing wrong with having an LDRB, for
example, with a "char" output.

llvm-svn: 183172
2013-06-03 23:57:13 +00:00
Jordan Rose 5e2b3a30a0 [analyzer] Enable the new edge algorithm by default.
...but don't yet migrate over the existing plist tests. Some of these
would be trivial to migrate; others could use a bit of inspection first.
In any case, though, the new edge algorithm seems to have proven itself,
and we'd like more coverage (and more usage) of it going forwards.

llvm-svn: 183165
2013-06-03 23:00:19 +00:00
Jordan Rose 7ce598aeee [analyzer; new edges] Omit subexpression back-edges that span multiple lines.
A.1 -> A -> B
becomes
A.1 -> B

This only applies if there's an edge from a subexpression to its parent
expression, and that is immediately followed by another edge from the
parent expression to a subsequent expression. Normally this is useful for
bringing the edges back to the left side of the code, but when the
subexpression is on a different line the backedge ends up looking strange,
and may even obscure code. In these cases, it's better to just continue
to the next top-level statement.

llvm-svn: 183164
2013-06-03 23:00:09 +00:00
Jordan Rose 5f16849b34 [analyzer; new edges] Don't eliminate subexpr edge cycles if the line is long.
Specifically, if the line is over 80 characters, or if the top-level
statement spans mulitple lines, we should preserve sub-expression edges
even if they form a simple cycle as described in the last commit, because
it's harder to infer what's going on than it is for shorter lines.

llvm-svn: 183163
2013-06-03 23:00:05 +00:00
Jordan Rose 8c54b44fb3 [analyzer; new edges] Eliminate "cycle edges" for a single subexpression.
Generating context arrows can result in quite a few arrows surrounding a
relatively simple expression, often containing only a single path note.

|
1 +--2---+
v/       v
auto m = new m // 3 (the path note)
|\       |
5 +--4---+
v

Note also that 5 and 1 are two ends of the "same" arrow, i.e. they go from
event to event. 3 is not an arrow but the path note itself.

Now, if we see a pair of edges like 2 and 4---where 4 is the reverse of 2
and there is optionally a single path note between them---we will
eliminate /both/ edges. Anything more complicated will be left as is
(more edges involved, an inlined call, etc).

The next commit will refine this to preserve the arrows in a larger
expression, so that we don't lose all context.

llvm-svn: 183162
2013-06-03 23:00:00 +00:00
Jordan Rose b60b844265 [analyzer; new edges] Extra test case.
llvm-svn: 183161
2013-06-03 22:59:56 +00:00
Jordan Rose 06e800727e [analyzer; new edges] Improve enclosing contexts for logical expressions.
The old edge builder didn't have a notion of nested statement contexts,
so there was no special treatment of a logical operator inside an if
(or inside another logical operator). The new edge builder always tries
to establish the full context up to the top-level statement, so it's
important to know how much context has been established already rather
than just checking the innermost context.

This restores some of the old behavior for the old edge generation:
the context of a logical operator's non-controlling expression is the
subexpression in the old edge algorithm, but the entire operator
expression in the new algorithm.

llvm-svn: 183160
2013-06-03 22:59:53 +00:00
Jordan Rose b1db073dac [analyzer; new edges] Include context for edges to sub-expressions.
The current edge-generation algorithm sometimes creates edges from a
top-level statement A to a sub-expression B.1 that's not at the start of B.
This creates a "swoosh" effect where the arrow is drawn on top of the
text at the start of B. In these cases, the results are clearer if we see
an edge from A to B, then another one from B to B.1.

Admittedly, this does create a /lot/ of arrows, some of which merely hop
into a subexpression and then out again for a single note. The next commit
will eliminate these if the subexpression is simple enough.

This updates and reuses some of the infrastructure from the old edge-
generation algorithm to find the "enclosing statement" context for a
given expression. One change in particular marks the context of the
LHS or RHS of a logical binary operator (&&, ||) as the entire operator
expression, rather than the subexpression itself. This matches our behavior
for ?:, and allows us to handle nested context information.

<rdar://problem/13902816>

llvm-svn: 183159
2013-06-03 22:59:48 +00:00
Jordan Rose 5250b873bb CFG: In a DeclStmt, skip anything that's not a VarDecl.
Neither the compiler nor the analyzer are doing anything with non-VarDecl
decls in the CFG, and having them there creates extra nodes in the
analyzer's path diagnostics. Simplify the CFG (and the path edges) by
simply leaving them out. We can always add interesting decls back in when
they become relevant.

Note that this only affects decls declared in a DeclStmt, and then only
those that appear within a function body.

llvm-svn: 183157
2013-06-03 22:59:41 +00:00
David Blaikie 778627a010 UnresolvedMemberExpr should have an expr location of the member (not the base)
This matches the behavior of MemberExpr and makes diagnostics such as
"reference to non-static member function must be called" more legible in
the case that the base & member are split over multiple lines (prior to
this change the diagnostic would point to the base, not the member -
making it very unclear in chained multi-line builder-style calls)

llvm-svn: 183149
2013-06-03 19:46:44 +00:00
Richard Smith d3bc151fb4 Convert some Unicode whitespace to ASCII whitespace.
llvm-svn: 183116
2013-06-03 17:00:25 +00:00
Richard Smith 2d18790b3a Do not walk through member-accesses on bitfields when looking for the object
which is lifetime-extended by a reference binding. An additional temporary is
created for such a bitfield access (although we have no explicit AST
representation for it).

llvm-svn: 183095
2013-06-03 07:13:35 +00:00
Richard Smith 844010455d Refactor constant expression evaluation to associate the complete object of a
materialized temporary with the corresponding MaterializeTemporaryExpr. This is
groundwork for providing C++11's guaranteed static initialization for global
references bound to lifetime-extended temporaries (if the initialization is a
constant expression).

In passing, fix a couple of bugs where some evaluation failures didn't trigger
diagnostics, and a rejects-valid where potential constant expression testing
would assume that it knew the dynamic type of *this and would reject programs
which relied on it being some derived type.

llvm-svn: 183093
2013-06-03 05:03:02 +00:00
Richard Smith 2fcb73984a Fix a couple of bugs where jump diagnostics would not notice that a variable
has an initializer.

llvm-svn: 183092
2013-06-03 01:05:37 +00:00
Richard Smith f3fabd2cb5 Fix handling of pointers-to-members and comma expressions when
lifetime-extending temporaries in reference bindings.

llvm-svn: 183089
2013-06-03 00:17:11 +00:00
David Majnemer a9d4f77eb9 Allow paren casted throw statements inside of ternary expressions
clang would incorrectly not allow the following:

int x = true ? (throw 1) : 2;

The problem exists because we don't see beyond the parens.
This, in turn, causes us to believe that we are choosing between void
and int which we diagnose as an error.

Instead, allow clang to see the 'throw' inside the parens.

llvm-svn: 183085
2013-06-02 08:40:42 +00:00
David Majnemer 3fbb763a92 Properly consider the range of enum for range comparisons in C mode
In some cases, clang applies the C++ rules for computing the range of a
value when said value is an enum.

Instead, apply C semantics when in C mode.

llvm-svn: 183084
2013-06-02 08:11:22 +00:00
Richard Smith 2bcde3a74c PR12848: When emitting a local variable declared 'constexpr', always initialize it with a store or a memcpy, not by emitting the initializer expression. This is not required for correctness, but more closely aligns with people's expectations, and is cheap (since we've already evaluated the initializer).
llvm-svn: 183082
2013-06-02 00:09:52 +00:00
Anna Zaks a4bc5e1201 [analyzer] Malloc checker should only escape the receiver when “[O init..]” is called.
Jordan has pointed out that it is valuable to warn in cases when the arguments to init escape.
For example, NSData initWithBytes id not going to free the memory.

llvm-svn: 183062
2013-05-31 23:47:32 +00:00
Anna Zaks 737926ba6c [analyzer] Fix a false positive reported on rare strange code, which happens to be in JSONKit
llvm-svn: 183055
2013-05-31 22:39:13 +00:00
Fariborz Jahanian deac9ac546 Objective-C: Fixes an ivar lookup bug where
'ivar' was used inside a record/union used 
as argument to __typeof. // rdar14037151 pr5984

llvm-svn: 183048
2013-05-31 21:51:12 +00:00
David Majnemer 36bc703e03 Put the PR16167 tests together
llvm-svn: 183046
2013-05-31 21:29:50 +00:00
Ed Schouten c7e82bd4e3 Add support for optimized (non-generic) atomic libcalls.
For integer types of sizes 1, 2, 4 and 8, libcompiler-rt (and libgcc)
provide atomic functions that pass parameters by value and return
results directly.

libgcc and libcompiler-rt only provide optimized libcalls for
__atomic_fetch_*, as generic libcalls on non-integer types would make
little sense. This means that we can finally make __atomic_fetch_* work
on architectures for which we don't provide these operations as builtins
(e.g. ARM).

This should fix the dreaded "cannot compile this atomic library call
yet" error that would pop up once every while.

llvm-svn: 183033
2013-05-31 19:27:59 +00:00
Ed Schouten 8c23472265 Slightly extend matching for atomic loads.
Also add the "=" to the matched pattern, to see whether we actually save
the loaded value.

llvm-svn: 183029
2013-05-31 19:18:14 +00:00
Benjamin Kramer 4d5bae1679 Testcase for r183015.
I hate svn add.

llvm-svn: 183019
2013-05-31 17:01:30 +00:00
Ted Kremenek 7c6b4084dd [analyzer; new edges] add simplifySimpleBranches() to reduce edges for branches.
In many cases, the edge from the "if" to the condition, followed by an edge from the branch condition to the target code, is uninteresting.

In such cases, we should fold the two edges into one from the "if" to the target.

This also applies to loops.

Implements <rdar://problem/14034763>.

llvm-svn: 183018
2013-05-31 16:56:54 +00:00
Daniel Jasper ab8128b01d Fix test error caused by r183008.
llvm-svn: 183010
2013-05-31 15:15:41 +00:00
Ted Kremenek 263595f4f3 [analyzer; new edges] in splitBranchConditionEdges() do not check that predecessor edge has source in the same lexical scope as the target branch.
Fixes <rdar://problem/14031292>.

llvm-svn: 182987
2013-05-31 06:11:17 +00:00
Richard Smith 72752e88ef Fix handling of braced-init-list as reference initializer within aggregate
initialization. Previously we would incorrectly require an extra set of braces
around such initializers.

llvm-svn: 182983
2013-05-31 02:56:17 +00:00
Argyrios Kyrtzidis 794671dc2f [PCH] Fix crash with valid code, related to anonymous field initializers.
In a certain code-path we were not deserializing an anonymous field initializer correctly,
leading to a crash when trying to IRGen it.

This is a simpler version of a patch by Yunzhong Gao!

llvm-svn: 182974
2013-05-30 23:59:46 +00:00
Richard Smith e6ca47586d Walk over MaterializeTemporaryExpr when reverting an initializer to its
syntactic form in template instantiation. Previously, this blocked the
reversion and we ended up losing inner CXXBindTemporaryExprs (and thus
forgetting to call destructors!).

llvm-svn: 182969
2013-05-30 22:40:16 +00:00
Fariborz Jahanian 42f89384f5 Objective-C: Implements gcc's -Wselector option
which diagnoses type mismatches of identical 
selectors declared in classes throughout.
// rdar://14007194

llvm-svn: 182964
2013-05-30 21:48:58 +00:00
Jordan Rose ca0ecb61e1 Revert "[analyzer; alternate edges] don't add an edge incoming from the start of a function"
...and make this work correctly in the current codebase.

After living on this for a while, it turns out to look very strange for
inlined functions that have only a single statement, and somewhat strange
for inlined functions in general (since they are still conceptually in the
middle of the path, and there is a function-entry path note).

It's worth noting that this only affects inlined functions; in the new
arrow generation algorithm, the top-level function still starts at the
first real statement in the function body, not the enclosing CompoundStmt.

This reverts r182078 / dbfa950abe0e55b173286a306ee620eff5f72ea.

llvm-svn: 182963
2013-05-30 21:30:17 +00:00
Rafael Espindola 503276be05 Fix PR16060.
The testcase in PR16060 points out that while template arguments can
show that a type is not externally visible, the standards still says
they have external linkage.

In terms of our implementation, it means that we should merge just the
isExternallyVisible bit, not the formal linkage.

llvm-svn: 182962
2013-05-30 21:23:15 +00:00
Argyrios Kyrtzidis 0f6d5ca0bf Fix potential infinite loop when iterating over redeclarations of an ObjMethodDecl, resulting from invalid code.
Check for invalid decls in ObjCMethodDecl::getNextRedeclaration(); otherwise if we start from an invalid redeclaration
of an @implementation we would move to the @interface and not reach the original declaration again.

Fixes rdar://14024851

llvm-svn: 182951
2013-05-30 18:53:21 +00:00
Jordan Rose 278d9de314 [analyzer] Don't crash if a block's signature just has the return type.
It is okay to declare a block without an argument list: ^ {} or ^void {}.
In these cases, the BlockDecl's signature-as-written will just contain
the return type, rather than the entire function type. It is unclear if
this is intentional, but the analyzer shouldn't crash because of it.

<rdar://problem/14018351>

llvm-svn: 182948
2013-05-30 18:14:27 +00:00
Adrian Prantl 4c9a38a47a Do not reuse the debug location of the return value's store if there is autorelease code to be emitted between store and return instructions. This is analoguous to what we do for lexical scope cleanups.
rdar://problem/13977888

llvm-svn: 182947
2013-05-30 18:12:23 +00:00
Aaron Ballman ed0ae1d70b Microsoft has a language extension which allows union members to be
references.  What's more, they use this language extension in their
ATL header files (which come as part of MFC and the Win32 SDK).  This patch implements support for the Microsoft extension, and addresses PR13737.

llvm-svn: 182936
2013-05-30 16:20:00 +00:00
Aaron Ballman 194a79e152 Switching the tests to use size_t instead of unsigned int to hopefully appease the Linux x64 build bot (take 2, forgot this test case).
llvm-svn: 182907
2013-05-30 02:17:14 +00:00
Aaron Ballman 12354641fe Switching the tests to use size_t instead of unsigned int to hopefully appease the Linux x64 build bot.
llvm-svn: 182906
2013-05-30 02:02:23 +00:00
Aaron Ballman 324fbeeba7 Add support to fallback on operator new when a placement operator new[] is called for which there is no valid declaration. This fallback only happens in Microsoft compatibility mode. This patch addresses PR13164, and improves support for the WDK.
llvm-svn: 182905
2013-05-30 01:55:39 +00:00
Jordan Rose 543bdd1237 [analyzer; new edges] In for(;;), use the ForStmt itself for loop notes.
Most loop notes (like "entering loop body") are attached to the condition
expression guarding a loop or its equivalent. For loops may not have a
condition expression, though. Rather than crashing, just use the entire
ForStmt as the location. This is probably the best we can do.

<rdar://problem/14016063>

llvm-svn: 182904
2013-05-30 01:05:58 +00:00
Argyrios Kyrtzidis 55fb21efbb [libclang] When indexing a @synthesize, don't consider that it defines a getter/setter if one is already defined by the user.
Fixes rdar://13925258

llvm-svn: 182895
2013-05-29 23:58:31 +00:00
Ted Kremenek e3dc7f74be Split off casts to void* for -Wint-to-pointer-cast to subgroup -Wint-to-void-pointer-cast.
This change is motivated from user feedback that some APIs use
void* as an opaque "context" object that may not really be a pointer.
Such users want an ability to turn off the warning for casts
to void* while preserving the warning for other cases.

Implements <rdar://problem/14016721>.

llvm-svn: 182884
2013-05-29 21:50:46 +00:00
David Majnemer 970f30e248 Add another test case for r182814.
llvm-svn: 182882
2013-05-29 21:09:52 +00:00
Jordan Rose 1bd1927a14 [analyzer] Accept references to variables declared "extern void" (C only).
In C, 'void' is treated like any other incomplete type, and though it is
never completed, you can cast the address of a void-typed variable to do
something useful. (In C++ it's illegal to declare a variable with void type.)

Previously we asserted on this code; now we just treat it like any other
incomplete type.

And speaking of incomplete types, we don't know their extent. Actually
check that in TypedValueRegion::getExtent, though that's not being used
by any checkers that are on by default.

llvm-svn: 182880
2013-05-29 20:50:34 +00:00
Argyrios Kyrtzidis 345d05fbbe [libclang] For "@import .." code-completion results, associate a CXCursor_ModuleImportDecl cursor instead of CXCursor_NotImplemented.
llvm-svn: 182871
2013-05-29 18:50:15 +00:00
Reid Kleckner d8cbeec178 [ms-cxxabi] Implement MSVC virtual base adjustment
While we can't yet emit vbtables, this allows us to find virtual bases
of objects constructed in other TUs.

This make iostream hello world work, since basic_ostream virtually
inherits from basic_ios.

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

llvm-svn: 182870
2013-05-29 18:02:47 +00:00
Reid Kleckner e0acd7d50d [ms-cxxabi] Fix r182865 to have an actual Itanium-style key function
Peter pointed out that C::f() is not a key function.  C's key function
is actually C::~C().

llvm-svn: 182866
2013-05-29 16:51:17 +00:00
Reid Kleckner 5d7f298155 [ms-cxxabi] There are no key functions in the Microsoft C++ ABI
MSVC's class data is always comdat, so clang's should always be
linkonce_odr in LLVM IR.

Reviewers: pcc

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

llvm-svn: 182865
2013-05-29 16:18:30 +00:00
Rafael Espindola 7dcb52eed7 Add a testcase from pr16059.
It was fixed back in r182750, but this is a nice testcase to have.

llvm-svn: 182818
2013-05-29 03:10:01 +00:00
David Majnemer 0ffa331789 Disallow extern decls of type void in C++ mode
C++ and C differ with respect to the handling of extern void
declarations. Enforce the C++ behavior in C++ mode.

llvm-svn: 182814
2013-05-29 00:56:45 +00:00
Fariborz Jahanian 7325c27468 Objective-C [qoi]: Improve on diagnostic when a method used
in an @selector expression has no implementation.
// rdar://14002507

llvm-svn: 182812
2013-05-28 23:49:32 +00:00
Anna Zaks 5416ab0156 [analyzer] Use the expression’s type instead of region’s type in ArrayToPointer decay evaluation
This gives slightly better precision, specifically, in cases where a non-typed region represents the array
or when the type is a non-array type, which can happen when an array is a result of a reinterpret_cast.

llvm-svn: 182810
2013-05-28 23:24:01 +00:00
Anna Zaks 6477e97af7 [analyzer] Re-enable reasoning about CK_LValueBitCast
It’s important for us to reason about the cast as it is used in std::addressof. The reason we did not
handle the cast previously was a crash on a test case (see commit r157478). The crash was in
processing array to pointer decay when the region type was not an array. Address the issue, by
just returning an unknown in that case.

llvm-svn: 182808
2013-05-28 22:32:08 +00:00
Fariborz Jahanian 615de765ab Patch to issue error when target of MacOS and iOS
does not support large load/store of atomic objects.
// rdar://13973577

llvm-svn: 182781
2013-05-28 17:37:39 +00:00
Anna Zaks bac964e14f [analyzer] Use a more generic MemRegion.getAsOffset to evaluate bin operators on MemRegions
In addition to enabling more code reuse, this suppresses some false positives by allowing us to
compare an element region to its base. See the ptr-arith.cpp test cases for an example.

llvm-svn: 182780
2013-05-28 17:31:43 +00:00
Rafael Espindola eee0a3abff Fix a crash when we were trying to compute the linkage too early.
llvm-svn: 182773
2013-05-28 14:09:46 +00:00
NAKAMURA Takumi ad3af1ae4d clang/test/Driver/dyld-prefix.c: Exclude MSYS bash.
llvm-svn: 182769
2013-05-28 12:18:56 +00:00
Jakob Stoklund Olesen 02dc6a1451 Build correct coercion types in SparcV9ABIInfo.
The coercion type serves two purposes:

 1. Pad structs to a multiple of 64 bits, so they are passed
    'left-aligned' in registers.

 2. Expose aligned floating point elements as first-level elements, so
    the code generator knows to pass them in floating point registers.

We also compute the InReg flag which indicates that the struct contains
aligned 32-bit floats. This flag is used by the code generator to pick
the right registers.

llvm-svn: 182753
2013-05-28 04:57:37 +00:00
Rafael Espindola e6190db8db Propagate VisibleNoLinkage down to class members.
Fixes PR16114.

llvm-svn: 182750
2013-05-28 02:22:10 +00:00
Jakob Stoklund Olesen d28ab7e802 Add a SparcV9ABIInfo class for handling the standard SPARC v9 ABI.
- All integer arguments smaller than 64 bits are extended.
- Large structs are passed indirectly, not using 'byval'.
- Structs up to 32 bytes in size are returned in registers.

Some things are not implemented yet:

- EmitVAArg can be implemented in terms of the va_arg instruction.
- When structs are passed in registers, float members require special
  handling because they are passed in the floating point registers.
- Structs are left-aligned when passed in registers. This may require
  padding.

llvm-svn: 182745
2013-05-27 21:48:25 +00:00
Peter Collingbourne 9d9e1fc479 Driver: implement --dyld-prefix option.
This option is used to select a dynamic loader prefix to be used
at runtime. Currently this is implemented for the Linux toolchain.

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

llvm-svn: 182744
2013-05-27 21:40:20 +00:00
Rafael Espindola 111bb2ef8d Fix the linkage of local types in inline VisibleNoLinkage functions.
We were handling only local types in inline External functions before.

llvm-svn: 182737
2013-05-27 14:50:21 +00:00
Sergey Matveev 1814e9eae3 Add -fsanitize=leak to driver options.
If -fsanitize=leak is specified, link the program with the
LeakSanitizer runtime. Ignore this option when -fsanitize=address is specified,
because AddressSanitizer has this functionality built in.

llvm-svn: 182729
2013-05-27 11:17:01 +00:00
Richard Smith b7df8a7014 Tests and status for DR51-99.
llvm-svn: 182720
2013-05-26 22:03:53 +00:00
Rafael Espindola 50df3a02be Fix linkage computation for derived types in inline functions.
John noticed that the fix for pr15930 (r181981) didn't handle indirect
uses of local types. For example, a pointer to local struct, or a
function that returns it.

One way to implement this would be to recursively look for local
types. This would look a lot like the linkage computation itself for
types.

To avoid code duplication and utilize the existing linkage cache, this
patch just makes the computation of "type with no linkage but
externally visible because it is from an inline function"  part of the
linkage computation itself.

llvm-svn: 182711
2013-05-25 17:16:20 +00:00
Argyrios Kyrtzidis 977026c5f5 [Preprocessor] Prevent expansion of y in x ## y when x is empty
When x is empty, x ## is suppressed, and when y gets expanded, the fact that it follows ## is not
available in the macro expansion result. The macro definition can be checked instead, the ## will
be available there regardless of what x expands to.

Fixes http://llvm.org/PR12767

Patch by Harald van Dijk!

llvm-svn: 182699
2013-05-25 01:35:18 +00:00
Nico Weber 9eea764a1f Warn on va_start() when called with a reference parameter.
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1905.pdf 18.7p3
explicitly calls this (and some other things) out as undefined.

Also move 2 other existing warnings behind the new -Wvarargs flag.

llvm-svn: 182694
2013-05-24 23:31:57 +00:00
Jordan Rose 14cce0561c [analyzer] Fix test for r182677.
llvm-svn: 182678
2013-05-24 21:49:58 +00:00
Jordan Rose 56138268b0 [analyzer] Treat analyzer-synthesized function bodies like implicit bodies.
When generating path notes, implicit function bodies are shown at the call
site, so that, say, copying a POD type in C++ doesn't jump you to a header
file. This is especially important when the synthesized function itself
calls another function (or block), in which case we should try to jump the
user around as little as possible.

By checking whether a called function has a body in the AST, we can tell
if the analyzer synthesized the body, and if we should therefore collapse
the call down to the call site like a true implicitly-defined function.

<rdar://problem/13978414>

llvm-svn: 182677
2013-05-24 21:43:11 +00:00
Jordan Rose 7291666cd9 [analyzer; new edges] Properly set location after exiting an inlined call.
The new edge algorithm would keep track of the previous location in each
location context, so that it could draw arrows coming in and out of each
inlined call. However, it tried to access the location of the call before
it was actually set (at the CallEnter node). This only affected
unterminated calls at the end of a path; calls with visible exit nodes
already had a valid location.

This patch ditches the location context map, since we're processing the
nodes in order anyway, and just unconditionally updates the PrevLoc
variable after popping out of an inlined call.

<rdar://problem/13983470>

llvm-svn: 182676
2013-05-24 21:43:05 +00:00
David Blaikie 22c460a051 PR16091: Error when attempting to emit debug info for undeduced auto return types
Perhaps we should just suppress this, rather than erroring, but since we
have the infrastructure for it I figured I'd use it - if this is
determined to be not the right thing we should probably remove that
infrastructure entirely. I guess it's lying around from the early days
of implementing debug info support.

llvm-svn: 182673
2013-05-24 21:24:35 +00:00
Diego Novillo 5f2b1ce21e [PATCH] Generate cold attribute for functions marked __atribute__((cold))
This removes a FIXME in CodeGenModule::SetLLVMFunctionAttributesForDefinition.
When a function is declared cold we can now generate the IR attribute in
addition to marking the function to be optimized for size.

I tried adding a separate CHECK in the existing test, but it was
failing.  I suppose CHECK matches one line exactly once?  This would be
a problem if the attributes are listed in a different order, though they
seem to be sorted.

llvm-svn: 182666
2013-05-24 20:18:15 +00:00
Chad Rosier b9aff1edb3 [ms-inline asm] Don't diagnose an empty lookup for inline assmebly. This happen
for labels in inline assembly that aren't in the lookup tables.  E.g.,

  __asm {
   a:
   jmp a
  }

rdar://13983623

llvm-svn: 182659
2013-05-24 18:32:55 +00:00
Rafael Espindola 6f6f3c4e38 Fix printing CXXTemporaryObjectExpr with default args.
Patch by Will Wilson.

llvm-svn: 182651
2013-05-24 16:11:44 +00:00
Aaron Ballman ef50ee9ebd Suffixing #pragma comment(lib) library names with .lib if necessary. This matches MSVC behavior, as well as allows us to properly link libraries such as the ones provided by the MSDN examples.
llvm-svn: 182647
2013-05-24 15:06:56 +00:00
Evgeniy Stepanov 758b5071d1 Add -lrt to sanitizer link arguments.
Sanitizer runtime intercepts functions from librt. Not doing this will fail
if the librt dependency is not present at program startup (ex. comes from a
dlopen()ed library).

llvm-svn: 182645
2013-05-24 14:28:03 +00:00
Argyrios Kyrtzidis 1811021ff9 User correct case for 'FileCheck'.
llvm-svn: 182632
2013-05-24 05:54:31 +00:00
Argyrios Kyrtzidis dc9fdaf217 [modules] If we hit a failure while loading a PCH/module, abort parsing instead of trying to continue in an invalid state.
Also don't let libclang create a PCH with such an error.

Fixes rdar://13953768

llvm-svn: 182629
2013-05-24 05:44:08 +00:00
Richard Smith cd09065ec3 Fix crash-on-invalid if list-initialization works, but we bail out when
building the resulting expression because it invokes a deleted constructor.

llvm-svn: 182624
2013-05-23 23:20:04 +00:00
Richard Smith be93c00ab3 Fix assert on temporary std::initializer_list.
llvm-svn: 182615
2013-05-23 21:54:14 +00:00
Ted Kremenek abfcca30d8 [analyzer; alternate edges] Add a new test case file to regression test the new arrows algorithm.
This essentially combines the tests in plist-output.m and plist-alternate-output.m.

llvm-svn: 182612
2013-05-23 21:33:12 +00:00
Richard Smith 1d209d075b Fix bitcode desynchronization when loading a PCH containing a class template
specialization with modules enabled. Just don't merge them at all for now;
we'll revisit this when support for template merging is added.

In passing, make Decl::dump() a little safer to use with PCH/modules, by making
it not deserialize any additional declarations. From a debugger you can call
decls_begin() or similar first if you want to dump all child decls.

llvm-svn: 182544
2013-05-23 01:49:11 +00:00
Richard Smith a23ab514c2 PR14772: Support constant expression evaluation for _Atomic types.
* Treat _Atomic(T) as a literal type if T is a literal type.
 * Evaluate expressions of this type properly.
 * Fix a lurking bug where we built completely bogus ASTs for converting to
   _Atomic types in C++ in some cases, caught by the tests for this change.

llvm-svn: 182541
2013-05-23 00:30:41 +00:00
Aaron Ballman 317a77f1c7 Adding in parsing and the start of semantic support for __sptr and __uptr pointer type qualifiers. This patch also fixes the correlated __ptr32 and __ptr64 pointer qualifiers so that they are truly type attributes instead of declaration attributes.
For more information about __sptr and __uptr, see MSDN: http://msdn.microsoft.com/en-us/library/aa983399.aspx

Patch reviewed by Richard Smith.

llvm-svn: 182535
2013-05-22 23:25:32 +00:00
Adrian Prantl ef6fca5536 Bugfix for r181629:
- The return type should be a pointer to the class type.
- Make the condition more specific.

rdar://problem/13359718

llvm-svn: 182504
2013-05-22 19:10:15 +00:00
Jordan Rose 1bfe9c787f [analyzer] Don't crash if a block doesn't have a type signature.
Currently, blocks instantiated in templates lose their "signature as
written"; it's not clear if this is intentional. Change the analyzer's
use of BlockDecl::getSignatureAsWritten to check whether or not the
signature is actually there.

<rdar://problem/13954714>

llvm-svn: 182497
2013-05-22 18:09:44 +00:00
Justin Holewinski 9f3bfeb3b6 [NVPTX] Add entire list of supported builtins
llvm-svn: 182468
2013-05-22 12:58:29 +00:00
Anna Zaks 2f74ff1b3c [analyzer] Do not assert on reports ending in calls within macros.
The crash is triggered by the newly added option (-analyzer-config report-in-main-source-file=true) introduced in r182058.

Note, ideally, we’d like to report the issue within the main source file here as well.
For now, just do not crash.

llvm-svn: 182445
2013-05-22 01:54:34 +00:00
Richard Smith eebe125f77 Fix crash-on-invalid: only use TransformAddressOfOperand when transforming the
operand of a unary address-of expression, not for *all* expressions!

llvm-svn: 182436
2013-05-21 23:29:46 +00:00
Richard Smith f9a458047a PR16090: C++1y: treat undeduced 'auto' as a literal type, so that constexpr
function templates can use it as a return type.

llvm-svn: 182433
2013-05-21 22:29:20 +00:00
Richard Smith f44d2a8a3e PR16094: I should have known Obj-C init-capture disambiguation couldn't be
*that* easy...

Try a bit harder to disambiguate. This is mostly straightforward, but for
=-style initializers, we actually need to know where an expression ends:

  [foo = bar baz]

is a message send, whereas

  [foo = bar + baz]

is a lambda-introducer. Handle this by parsing the expression eagerly, and
replacing it with an annotation token. By chance, we use the *exact same*
parsing rules in both cases (except that we need to assume we're inside a
message send for the parse, to turn off various forms of inapplicable
error recovery).

llvm-svn: 182432
2013-05-21 22:21:19 +00:00
Fariborz Jahanian 6f829e34b3 Objective-C arc: don't count use of __weak
variables when they are used in such unevaluated 
contexts as __typeof, etc. // rdar://13942025

llvm-svn: 182423
2013-05-21 21:20:26 +00:00
Richard Smith ccc1181105 Refactor places which perform contextual implicit conversions to go through a
common function. The C++1y contextual implicit conversion rules themselves are
not yet implemented, however.

This also fixes a subtle bug where template instantiation context notes were
dropped for diagnostics coming from conversions for integral constant
expressions -- we were implicitly slicing a SemaDiagnosticBuilder into a
DiagnosticBuilder when producing these diagnostics, and losing their context
notes in the process.

llvm-svn: 182406
2013-05-21 19:05:48 +00:00
Daniel Jasper 2a250b8b49 Let clang-format move the cursor appropriately.
With this patch, clang-format will try to keep the cursor at the
original code position in editor integrations (implemented for emacs and
vim). This means, after formatting, clang-format will try to keep the
cursor on the same character of the same token.

llvm-svn: 182373
2013-05-21 12:21:39 +00:00
Richard Smith b39b9d5735 In -ast-dump, only dump comments when dumping the actual Decl to which they
attach, rather than merging all comments on the declaration chain. This gives a
more faithful dump, and has the side benefit of unbreaking uses of dump() from
within AST deserialization (where the redeclaration chain may not be sane).

llvm-svn: 182350
2013-05-21 05:24:00 +00:00
Fariborz Jahanian 04eb8abba9 doc. parsing. HeaderDoc documentaton allows use of
@class command on an @interface declaration. Turn off
the warning for this case. // rdar://13927330

llvm-svn: 182334
2013-05-20 23:40:39 +00:00
David Blaikie f121b9302e PR14606: Debug Info for namespace aliases/DW_TAG_imported_module
This resolves the last of the PR14606 failures in the GDB 7.5 test
suite. (but there are still unresolved issues in the imported_decl case
- we need to implement optional/lazy decls for functions & variables
like we already do for types)

llvm-svn: 182329
2013-05-20 22:50:41 +00:00
Reid Kleckner 52d598e242 Warn on and drop dllimport attrs from variable definitions
AsmPrinter::EmitLinkage() does not handle dllimport linkage.  The LLVM
verifier should also be fixed to reject this.

llvm-svn: 182320
2013-05-20 21:53:29 +00:00
Fariborz Jahanian 0ebf87959f Objective-C [qoi]: When an class conforms to multiple
protocols that declare the same property of incompatible
types, issue a warning when class implementation synthesizes 
the property. // rdar://13075400

llvm-svn: 182316
2013-05-20 21:20:24 +00:00
Peter Collingbourne b289fe64c1 [ms-cxxabi] Look up operator delete() at every virtual dtor declaration.
While the C++ standard requires that this lookup take place only at the
definition point of a virtual destructor (C++11 [class.dtor]p12), the
Microsoft ABI may require the compiler to emit a deleting destructor
for any virtual destructor declared in the TU, including ones without
a body, requiring an operator delete() lookup for every virtual
destructor declaration.  The result of the lookup should be the same
no matter which declaration is used (except in weird corner cases).

This change will cause us to reject some valid TUs in Microsoft ABI
mode, e.g.:

struct A {
  void operator delete(void *);
};

struct B {
  void operator delete(void *);
};

struct C : A, B {
  virtual ~C();
};

As Richard points out, every virtual function declared in a TU
(including this virtual destructor) is odr-used, so it must be defined
in any program which declares it, or the program is ill formed, no
diagnostic required.  Because we know that any definition of this
destructor will cause the lookup to fail, the compiler can choose to
issue a diagnostic here.

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

llvm-svn: 182270
2013-05-20 14:12:25 +00:00
Douglas Gregor 5cad45bc89 Add arm_neon.h to the builtin intrinsics module map.
Fixes <rdar://problem/13933913>.

llvm-svn: 182268
2013-05-20 14:07:18 +00:00
Reid Kleckner b144d36693 Implement __declspec(selectany) under -fms-extensions
selectany only applies to externally visible global variables.  It has
the effect of making the data weak_odr.

The MSDN docs suggest that unused definitions can only be dropped at
linktime, so Clang uses weak instead of linkonce.  MSVC optimizes away
references to constant selectany data, so it must assume that there is
only one definition, hence weak_odr.

Reviewers: espindola

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

llvm-svn: 182266
2013-05-20 14:02:37 +00:00
Douglas Gregor 4b5f4cbaf2 Fix broken test
llvm-svn: 182264
2013-05-20 13:54:38 +00:00
Douglas Gregor f4e76b864f Add -Wincomplete-module, which detects when a header is included from a module but isn't itself part of a module.
llvm-svn: 182263
2013-05-20 13:49:41 +00:00
David Blaikie bd4837665b Revert "Revert "Debug Info: Using declarations/DW_TAG_imported_declaration of variables, types, and functions.""
This reverts commit r181947 (git d2990ce56a16050cac0d7937ec9919ff54c6df62 )

This addresses one of the two issues identified in r181947, ensuring
that types imported via using declarations only result in a declaration
being emitted for the type, not a definition. The second issue (emitting
using declarations that are unused) is hopefully an acceptable increase
as the real fix for this would be a bit difficult (probably at best we
could record which using directives were involved in lookups - but may
not have been the result of the lookup).

This also ensures that DW_TAG_imported_declarations (& directives) are
not emitted in line-tables-only mode as well as ensuring that typedefs
only require/emit declarations (rather than definitions) for referenced
types.

llvm-svn: 182231
2013-05-20 04:58:53 +00:00
Jakob Stoklund Olesen 826df14d72 OpenBSD/sparc64 uses long long for int64_t and intmax_t.
Other operating systems, including FreeBSD and NetBSD, use long.

llvm-svn: 182215
2013-05-19 17:53:37 +00:00
Richard Smith 10bb5b90ed Tests and status for core issues 1-50.
llvm-svn: 182207
2013-05-19 07:22:38 +00:00
Alexander Kornienko 006b5c89ce Clang-format: allow -style="{yaml/json}" on command line
Summary: + improved handling of default style and predefined styles.

Reviewers: djasper, klimek

Reviewed By: klimek

CC: cfe-commits

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

llvm-svn: 182205
2013-05-19 00:53:30 +00:00
Chandler Carruth 0d4b9e61de Fix a logic bug in the handling of -fmath-errno in the driver. We would
imply -fno-math-errno if the user passed -fno-fast-math OR -ffast-math,
regardless of in which order and regardless of the tool chain default.

I've fixed this to follow the logic:

1) If the last dominating flag is -fno-math-errno, -ffast-math, or
   -Ofast, then do not use math-errno.
2) If the last dominating flag is an explicit -fmath-errno, do use
   math-errno.
3) Otherwise, use the toolchain default.

This, for example, allows the flag sequence
'-ffast-math ... -fno-fast-math' with no mention of '-fmath-errno' or
'-fno-math-errno' to preserve the toolchain default. Most notably, this
should prevent users trying to disable fast-math optimizations on Darwin
and BSD platforms from simultaneously enabling (pointless) -fmath-errno.

I've enhanced the tests (after more reorganization) to cover this and
other weird permutations of flags and targets.

llvm-svn: 182203
2013-05-18 20:47:36 +00:00
Chandler Carruth 40746dfe8f Slight reorganization of the fast-math tests which test for errno
setting. Consolidate the collection of tests that enable -fmath-errno
and share a single CHECK line for simplicity.

llvm-svn: 182202
2013-05-18 20:27:06 +00:00
Rafael Espindola b6ed153155 Handle local enum types too.
Thanks to John McCall for pointing this out.

llvm-svn: 182182
2013-05-18 00:33:28 +00:00
Adrian Prantl 6e785ec019 ObjC Debug Info: Emit the correct method names for accessors for
properties declared in a protocol.

rdar://problem/13798000

llvm-svn: 182176
2013-05-17 23:49:10 +00:00
DeLesley Hutchins b682431775 Thread safety analysis: add two new attributes to the thread safety analysis:
assert_exclusive_lock and assert_shared_lock.  These attributes are used to
mark functions that dynamically check (i.e. assert) that a lock is held.

llvm-svn: 182170
2013-05-17 23:02:59 +00:00
Rafael Espindola 94c2fea6db Use the awesome CHECK-DAG!
llvm-svn: 182167
2013-05-17 22:33:49 +00:00
Anna Zaks 6334579623 [analyzer] Address Jordan's review comments for r182058
llvm-svn: 182156
2013-05-17 20:51:16 +00:00
Dmitri Gribenko 62770bea4b libclang: add a function to check whether a member function is pure virtual
Patch by Seth Fowler.

llvm-svn: 182139
2013-05-17 18:38:35 +00:00
Fariborz Jahanian 858885578d Objective-C parsing. Error recovery when category implementation
declaration is illegally protocol qualified. // rdar://13920026

llvm-svn: 182136
2013-05-17 17:58:11 +00:00
Fariborz Jahanian 3caab6cf6d Objective-C++ (and c++) Sema: Patch fixes a sema crash when gnu’s ?: extension
is used for Objective-C++’s dictionary subscripting. This is done by filtering
out all placeholder types before check on lowering of the
common expression is done. // rdar://1374918.
Reviewed by John McCall.

llvm-svn: 182120
2013-05-17 16:29:36 +00:00
Richard Smith 1239d84f77 Use 'c++' not 'cxx' in these diagnostic group names for consistency.
llvm-svn: 182075
2013-05-17 03:11:25 +00:00
Richard Smith 4c163a093f PR15757: When we instantiate an inheriting constructor template, also
instantiate the inherited constructor template and mark that as the constructor
which the instantiated specialization is inheriting. This fixes a
crash-on-valid when trying to compute the exception specification of a
specialization of the inheriting constructor.

llvm-svn: 182072
2013-05-17 02:19:35 +00:00
Jordan Rose fbe4d85035 [analyzer] Don't inline ~shared_ptr.
The analyzer can't see the reference count for shared_ptr, so it doesn't
know whether a given destruction is going to delete the referenced object.
This leads to spurious leak and use-after-free warnings.

For now, just ban destructors named '~shared_ptr', which catches
std::shared_ptr, std::tr1::shared_ptr, and boost::shared_ptr.

PR15987

llvm-svn: 182071
2013-05-17 02:16:49 +00:00
Richard Smith adaa015900 AST dumping: if a declaration has an uncomputed or uninstantiated exception specification, include that in the dump.
llvm-svn: 182070
2013-05-17 02:09:46 +00:00
Anna Zaks c5e2eca042 [analyzer] Add an option to use the last location in the main source file as the report location.
Previously, we’ve used the last location of the analyzer issue path as the location of the
report. This might not provide the best user experience, when one analyzer a source
file and the issue appears in the header. Introduce an option to use the last location
of the path that is in the main source file as the report location.

New option can be enabled with -analyzer-config report-in-main-source-file=true.

llvm-svn: 182058
2013-05-16 22:30:45 +00:00
Richard Smith a3ee78df28 Since we're counting number of steps, switch to turing machines which maximize
#steps not #1s, and use a more traditional step count where the 'halt' step is
not counted.

llvm-svn: 182057
2013-05-16 22:18:32 +00:00
Richard Smith 2414a6997b Add testcase omitted from r181998.
llvm-svn: 182043
2013-05-16 19:52:25 +00:00
Fariborz Jahanian 39d1c42f30 Objective-C arc: Diagnose when user attempts to
synthesize a property getter method that overrides
a method definition named 'retain' and the like.
Fixes // rdar://13885083

llvm-svn: 182039
2013-05-16 19:08:44 +00:00
David Fang 072d47b67f fix PR 15726: ptrdiff_t should be int on PowerPC Darwin
llvm-svn: 182029
2013-05-16 17:51:48 +00:00
Enea Zaffanella cf51a8ac3f Let CodeGenFunction::EmitVarDecl query the semantic storage class info.
Added testcase corresponding to PR15991.

llvm-svn: 181998
2013-05-16 11:27:56 +00:00
NAKAMURA Takumi 267b446324 clang/test/Modules/self-import-header/test.m: Add explicit -target.
Clang has an issue between mingw/include/float.h and clang/Headers/float.h with cyclic include_next.
For now, it should work to suppress #include_next in clang/float.h with an explicit target.
(It may work with -U__MINGW32__, though.)

llvm-svn: 181988
2013-05-16 06:59:30 +00:00
Richard Smith ba71c08523 First pass of semantic analysis for init-captures: check the initializer, build
a FieldDecl from it, and propagate both into the closure type and the
LambdaExpr.

You can't do much useful with them yet -- you can't use them within the body
of the lambda, because we don't have a representation for "the this of the
lambda, not the this of the enclosing context". We also don't have support or a
representation for a nested capture of an init-capture yet, which was intended
to work despite not being allowed by the current standard wording.

llvm-svn: 181985
2013-05-16 06:20:58 +00:00
Rafael Espindola c1b38a29e7 Fix pr15930.
In the case of inline functions, we have to special case local types
when they are used as template arguments to make sure the template
instantiations are still uniqued in case the function itself is inlined.

llvm-svn: 181981
2013-05-16 04:30:21 +00:00
Richard Trieu b48e62fb45 Check a pointer is not null before attempting to use it. This prevents a
crash on an explicit specialization of a member function in a class scope.

llvm-svn: 181971
2013-05-16 02:14:08 +00:00
Richard Trieu 388a33f3a3 Return QualType() when a too large array is attempting to be created. This
prevents further errors and some overflows in size calculations.
One overflow was previously triggering an assert.

llvm-svn: 181970
2013-05-16 01:46:09 +00:00
Eric Christopher 2ec1211c87 Add a test to verify that -flimit-debug-info is working in some way.
llvm-svn: 181963
2013-05-16 00:45:20 +00:00
Eric Christopher c65920b203 Fix comment.
llvm-svn: 181962
2013-05-16 00:45:18 +00:00
Eric Christopher a45ae1f1f1 Remove xfail'd test. This method of limiting debug info isn't
going to go anywhere.

llvm-svn: 181961
2013-05-16 00:45:15 +00:00
Adrian Prantl 5e5ff6e170 Set the debug location for landing pad code to the canonical EH location.
It used to point to the first call that caused the landing pad to
be generated.

rdar://problem/13888152

llvm-svn: 181958
2013-05-16 00:41:29 +00:00
David Blaikie db35281468 Revert "Debug Info: Using declarations/DW_TAG_imported_declaration of variables, types, and functions."
This reverts commit r181393 (git 3923d6a87fe7b2c91cc4a7dbd90c4ec7e2316bcd).

This seems to be emitting too much extra debug info for two (known)
reasons:
* full class definitions are emitted when only declarations are expected
* unused using declarations still produce DW_TAG_imported_declarations

llvm-svn: 181947
2013-05-15 23:46:19 +00:00
Fariborz Jahanian 0b11ef2ef0 Objective-C: More cases of -Wsign-conversion not
working on new Objective-C array subscripting
syntax. // rdar://13855682

llvm-svn: 181940
2013-05-15 22:25:03 +00:00
Fariborz Jahanian 2cb4a957c6 Objective-C: patch to issue the conversion
warning when property-dot syntax is used
with -Wsign-conversion. // rdar://13855394

llvm-svn: 181914
2013-05-15 19:03:04 +00:00
Fariborz Jahanian 478536b1c1 improve of note message and minor refactoring of my last
patch (r181847).

llvm-svn: 181896
2013-05-15 15:27:35 +00:00
Daniel Jasper 9dc096c8e6 Fix test breakage caused by change in clang-format.
llvm-svn: 181888
2013-05-15 14:27:33 +00:00
Hans Wennborg 8f62c5ca22 Better diagnostics for string initialization.
This commit improves Clang's diagnostics for string initialization.
Where it would previously say:

  /tmp/a.c:3:9: error: array initializer must be an initializer list
  wchar_t s[] = "Hi";
          ^
  /tmp/a.c:4:6: error: array initializer must be an initializer list or string literal
  char t[] = L"Hi";
       ^

It will now say

  /tmp/a.c:3:9: error: initializing wide char array with non-wide string literal
  wchar_t s[] = "Hi";
          ^
  /tmp/a.c:4:6: error: initializing char array with wide string literal
  char t[] = L"Hi";
       ^

As a bonus, it also fixes the fact that Clang would previously reject
this valid C11 code:

  char16_t s[] = u"hi";
  char32_t t[] = U"hi";

because it would only recognize the built-in types for char16_t and
char32_t, which do not exist in C.

llvm-svn: 181880
2013-05-15 11:03:04 +00:00
Daniel Jasper d2ae41a7c6 Remove diagnostics from clang-format.
We only ever implemented one and that one is not actually all that
helpful (e.g. gets incorrectly triggered by macros).

llvm-svn: 181871
2013-05-15 08:14:19 +00:00
David Blaikie 7d17010db5 Use only explicit bool conversion operator
The most common (non-buggy) case are where such objects are used as
return expressions in bool-returning functions or as boolean function
arguments. In those cases I've used (& added if necessary) a named
function to provide the equivalent (or sometimes negative, depending on
convenient wording) test.

DiagnosticBuilder kept its implicit conversion operator owing to the
prevalent use of it in return statements.

One bug was found in ExprConstant.cpp involving a comparison of two
PointerUnions (PointerUnion did not previously have an operator==, so
instead both operands were converted to bool & then compared). A test
is included in test/SemaCXX/constant-expression-cxx1y.cpp for the fix
(adding operator== to PointerUnion in LLVM).

llvm-svn: 181869
2013-05-15 07:37:26 +00:00