Commit Graph

39198 Commits

Author SHA1 Message Date
Richard Smith 87f5dc53b2 Add diagnostics for comma at end of enum and for extra semicolon at namespace
scope to -Wc++11-extensions. Move extra semicolon after member function
definition diagnostic out of -pedantic, since C++ allows a single semicolon
there. Keep it in -Wextra-semi, though, since it's still questionable.

llvm-svn: 160618
2012-07-23 05:45:25 +00:00
Douglas Gregor 6fa6942dda When we have an Objective-C object with non-trivial lifetime in a
structor class under ARC, that struct/class does not have a trivial
move constructor or move assignment operator. Fixes the rest of
<rdar://problem/11738725>.

llvm-svn: 160615
2012-07-23 04:23:39 +00:00
Richard Smith 505df2340a PR12917: Remove incorrect assumption that lambda mangling information cannot
change once it's been assigned. It can change in two ways:
 1) In a template instantiation, the context declaration should be the
    instantiated declaration, not the declaration in the template.
 2) If a lambda appears in the pattern of a variadic pack expansion, the
    mangling number will depend on the pack length.

llvm-svn: 160614
2012-07-22 23:45:10 +00:00
Francois Pichet f5b24e0136 Allow the parser to recover gracefully if a typename is used to introduce a decltype type.
In Microsoft mode, we emit a warning instead of an error.

This fixes a couple of errors when parsing the MSVC 11 RC headers with clang.

llvm-svn: 160613
2012-07-22 15:10:57 +00:00
Francois Pichet 0e2b84312f char16_t and char32_t are defined via typedef in MSVC 11 RC. So introduce a way to disable keywords under Microsoft mode.
llvm-svn: 160612
2012-07-22 11:32:41 +00:00
Dmitri Gribenko 565a680963 Comment AST nodes: add NumHTMLStartTagCommentBits member.
llvm-svn: 160600
2012-07-21 03:10:43 +00:00
Dmitri Gribenko 4c6d7a2ed2 Comment to HTML conversion: add more CSS classes to identify function arguments
by index.  This is useful if the user does not document all arguments, and we
can't find a particular argument by index via :nth-of-type() CSS selector.

llvm-svn: 160595
2012-07-21 01:47:43 +00:00
Chad Rosier d3957e57f6 Rename -fms-inline-asm to -fenable-experimental-ms-inline-asm.
llvm-svn: 160590
2012-07-20 23:12:26 +00:00
Tim Northover eb752d43c9 Add "long double" to permitted list of ARM complex homogeneous aggregates.
Under AAPCS, long double is the same as double, which means it should be
allowed as part of a homogeneous aggregate.

llvm-svn: 160586
2012-07-20 22:29:29 +00:00
Benjamin Kramer f473cd4b6a Remove unused private member variable uncovered by the recent changes to clang's -Wunused-private-field.
llvm-svn: 160584
2012-07-20 22:06:30 +00:00
Dmitri Gribenko f267c87e31 Fix c-index-test to compile as C89.
llvm-svn: 160582
2012-07-20 22:00:35 +00:00
Chad Rosier 3034ba167b Tidy up.
llvm-svn: 160581
2012-07-20 21:49:05 +00:00
Chad Rosier 7a96c77824 Add the mechanics for -fms-inline-asm. No easy way to test at this time.
llvm-svn: 160580
2012-07-20 21:44:43 +00:00
Dmitri Gribenko 5e4fe00e64 Add libclang APIs to walk comments ASTs and an API to convert a comment to an
HTML fragment.

For testing, c-index-test now has even more output:
* HTML rendering of a comment
* comment AST tree dump in S-expressions like Comment::dump(), but implemented
* with libclang APIs.

llvm-svn: 160577
2012-07-20 21:34:34 +00:00
Chad Rosier 8c9496a03c Revert accidental commit.
llvm-svn: 160574
2012-07-20 21:22:24 +00:00
Chad Rosier ed94324e70 Add a new flag, -fms-inline-asm, that enables the output of MS-style inline
assembly.  

By default, we don't emit IR for MS-style inline assembly (see r158833 as to 
why).  This is strictly for testing purposes and should not be enabled with the
expectation that things will work.  This is a temporary flag and will be removed
once MS-style inline assembly is fully supported.

llvm-svn: 160573
2012-07-20 21:20:33 +00:00
Aaron Ballman 9bca21ed25 No longer assuming the number of prototype arguments is always less than the number of formal parameters for a variadic function call.
llvm-svn: 160570
2012-07-20 20:40:35 +00:00
Dmitri Gribenko 66a00c765f Fix PR13411: Comment parsing: failed assertion on unterminated verbatim block.
The assertion was wrong in case we have a verbatim block without a closing
command.

Also add tests for closing command name in a verbatim block, since now it can
be empty in such cases.

llvm-svn: 160568
2012-07-20 20:18:53 +00:00
Jordan Rose 9dd82c1d94 Re-apply r160319 "Don't crash when emitting fixits following Unicode chars"
This time, make sure we don't try to print fixits with newline characters,
since they don't have a valid column width, and they don't look good anyway.

PR13417 (and originally <rdar://problem/11877454>)

llvm-svn: 160561
2012-07-20 18:50:51 +00:00
Jordan Rose 8c6c8a98b6 Add a reverse iterator to DeclStmt, and use it when building a CFG.
The CFG creates dummy DeclStmts with one Decl per statement, and it has
to do so from last to first in order to build the graph correctly.

llvm-svn: 160560
2012-07-20 18:50:48 +00:00
Eric Christopher ec21f68740 Don't need to specify the abi as it's the default.
rdar://11842763

llvm-svn: 160554
2012-07-20 17:42:31 +00:00
Fariborz Jahanian deb144ab51 Fixes an ObjC++ parse crash caused by delayed parsing
of c-functions nested in namespace in method implementations
by turning off its delayed parsing until a proper solution is 
figured out. pr13418

llvm-svn: 160552
2012-07-20 17:19:54 +00:00
Dmitri Gribenko af03ef7cce CommentBriefParser: coding style fix
llvm-svn: 160551
2012-07-20 17:02:25 +00:00
Dmitri Gribenko 77369eead6 CommentBriefParser: use \returns if we can't find the \brief or just a plain
paragraph.

llvm-svn: 160550
2012-07-20 17:01:34 +00:00
NAKAMURA Takumi e6c562c051 CMake: clang should depend on clang-headers, or bin/clang would not work better.
llvm-svn: 160549
2012-07-20 16:40:09 +00:00
Nico Weber cd8a546b6c Revert r160319, it caused PR13417. Add a test for PR13417.
llvm-svn: 160542
2012-07-20 06:44:52 +00:00
Nico Weber 9035951409 Let Expr::HasSideEffects() return false for NULL, bool literals, this, and nullptr.
Fixes PR13413, -Wunused-private-field now warns on unused fields initialized to NULL.

llvm-svn: 160541
2012-07-20 03:39:05 +00:00
Nico Weber 55a952bfcf Rename warn-unused-member.cpp to warn-unused-private-field.cpp to
make it match the flag it tests.

llvm-svn: 160536
2012-07-20 01:42:44 +00:00
Chandler Carruth 1649088ba1 Switch to the canonical pipe-based testing of clang output using
FileCheck.

This avoids copying files around needlessly during test runs.

llvm-svn: 160535
2012-07-20 00:49:53 +00:00
Chandler Carruth 1687e0ed35 Remove dos line endings. Please remember to configure your windows SVN
clients to default text files to 'eol-native'.

llvm-svn: 160534
2012-07-20 00:49:51 +00:00
Anna Zaks 3136cf9d5b [analyzer] Refactor VisitObjCMessage and VisitCallExpr to rely on the
same implementation for call evaluation.

llvm-svn: 160530
2012-07-19 23:38:13 +00:00
Eric Christopher 4bbb3c459e FileCheck-ize.
llvm-svn: 160528
2012-07-19 22:22:58 +00:00
Eric Christopher f8378ca2b1 Remove HasSynthBitfield and all callers/writers/etc. Also remove
previous ResetObjCLayout calls since this is now handled in Sema.

Part of rdar://11842763

llvm-svn: 160527
2012-07-19 22:22:55 +00:00
Eric Christopher 7457aaf8c9 Reset the layout of an ObjC class if we see an ivar in a category
or implementation since we've now got a different layout.

Fixes rdar://11842763

llvm-svn: 160526
2012-07-19 22:22:51 +00:00
Aaron Ballman 44475e2771 Removing a spurious comment, no functionality changes.
llvm-svn: 160522
2012-07-19 21:00:48 +00:00
Dmitri Gribenko a309c95d41 CommentDumper: print word-like arguments for block commands.
llvm-svn: 160519
2012-07-19 18:43:24 +00:00
Jordan Rose 3e0ec58c09 For varargs, diagnose passing ObjC objects by value like other non-POD types.
While we still want to consider this a hard error (non-POD variadic args are
normally a DefaultError warning), delaying the diagnostic allows us to give
better error messages, which also match the usual non-POD errors more closely.

In addition, this change improves the diagnostic messages for format string
argument type mismatches by passing down the type of the callee, so we can
say "variadic method" or "variadic function" appropriately.

<rdar://problem/11825593>

llvm-svn: 160517
2012-07-19 18:10:23 +00:00
Jordan Rose 96c49686b9 Capitalize "Objective-C" and "C++" in user-facing contexts.
No functionality change.

llvm-svn: 160516
2012-07-19 18:10:18 +00:00
Jordan Rose 58bbe4206f Don't crash checking a format string if one of the arguments is invalid.
Previously, we would ask for the SourceLocation of an argument even if
it were NULL (i.e. if Sema resulted in an ExprError trying to build it).

<rdar://problem/11890818>

llvm-svn: 160515
2012-07-19 18:10:08 +00:00
Argyrios Kyrtzidis ac4cdc8ef4 Add a test case for rdar://11806334.
Makes sure we don't overflow the stack.

llvm-svn: 160511
2012-07-19 16:08:28 +00:00
Ted Kremenek 6080d32194 Simplify UninitializedValues.cpp by removing logic to handle the previous (imprecise) representation
of '&&' and '||' in the CFG.  This is no longer needed, and greatly simplifies the code.

llvm-svn: 160494
2012-07-19 04:59:05 +00:00
Michael Han 7973250e33 Remove an unused header
llvm-svn: 160492
2012-07-19 04:10:19 +00:00
Bob Wilson 6a039161d7 Define __FINITE_MATH_ONLY__ based on -ffast-math and -ffinite-math-only.
This macro was being unconditionally set to zero, preceded by a FIXME comment.
This fixes <rdar://problem/11845441>.  Patch by Michael Gottesman!

llvm-svn: 160491
2012-07-19 03:52:53 +00:00
Aaron Ballman 24a1047c8c Relaxed enumeration constant naming rules for scoped enumerators so they no longer emit a diagnostic when the enumeration's name matches that of the class. Fixes PR13128.
llvm-svn: 160490
2012-07-19 03:12:23 +00:00
Richard Smith 18eff57031 Silence another GCC warning.
llvm-svn: 160488
2012-07-19 03:08:07 +00:00
NAKAMURA Takumi 9efaf227d1 Revert r160404, "Eliminating the GCC_CAST hack, take two.", for now.
It crashes mingw32-gcc-4.4.

llvm-svn: 160486
2012-07-19 02:27:55 +00:00
Richard Smith b1680655a6 Silence GCC warnings.
llvm-svn: 160485
2012-07-19 01:53:26 +00:00
Bob Wilson 25d3bfd895 Force the OS X version to 10.6 for old-style simulator builds.
The hack of recognizing a -D__IPHONE_OS_VERSION_MIN_REQUIRED option
in place of -mios-simulator-version-min leaves the Darwin version
unspecified.  It can be set separately with -mmacosx-version-min (which
makes no sense) or inferred to match the host version (which is unpredictable
and usually wrong).  This really needs to get cleaned up, but in the
meantime, force the OS X version to 10.6 so that the behavior is sane for
the iOS simulator.  Thanks for Argyrios for the patch.
<rdar://problem/11858187>

llvm-svn: 160484
2012-07-19 01:35:55 +00:00
Dmitri Gribenko e82ae819d3 CommentSema: add more inline commands to tables
llvm-svn: 160481
2012-07-19 00:21:03 +00:00
Dmitri Gribenko 7b2ca3e80b Fix ParagraphComment::isWhitespace(): a paragraph without a non-whitespace
TextComment node was considered whitespace even if it contained other child
nodes.

llvm-svn: 160474
2012-07-19 00:01:56 +00:00
Richard Smith 0bf93aa6b1 Fix OverloadCandidateSet::clear to not leak PartialDiagnostics, found by Samuel
Panzer. I've not been able to trigger a failure caused by this, so no test yet.
Also included is a small change from Paul Robinson to only consider the
FailureKind if the overload candidate did actually fail.

llvm-svn: 160470
2012-07-18 23:52:59 +00:00
Dmitri Gribenko c16cd2a67b Comment::dump(): show name of inline command
llvm-svn: 160467
2012-07-18 23:20:23 +00:00
Dmitri Gribenko e4a3997d70 Comment parsing: don't parse whitespace before \endverbatim as a separate line of whitespace.
llvm-svn: 160464
2012-07-18 23:01:58 +00:00
Aaron Ballman 462bb9fdf6 Rolling this change back because the fix doesn't fit the symptoms (even if it solves them).
llvm-svn: 160462
2012-07-18 22:38:11 +00:00
Jordan Rose 627b046c88 [analyzer] Combine all ObjC message CallEvents into ObjCMethodCall.
As pointed out by Anna, we only differentiate between explicit message sends

This also adds support for ObjCSubscriptExprs, which are basically the same
as properties in many ways. We were already checking these, but not emitting
nice messages for them.

This depends on the llvm::PointerIntPair change in r160456.

llvm-svn: 160461
2012-07-18 21:59:51 +00:00
Jordan Rose 9003d0d02f [analyzer] Rename addExtraInvalidatedRegions to get...Regions
Per Anna's comment that "add..." sounds like a method that modifies
the receiver, rather than its argument.

No functionality change.

llvm-svn: 160460
2012-07-18 21:59:46 +00:00
Jordan Rose 59e6ce922c [analyzer] Make CallEvent a value object.
We will need to be able to easily reconstruct a CallEvent from an ExplodedNode
for diagnostic purposes, and that's exactly what factory functions are for.
CallEvent objects are small enough (four pointers and a SourceLocation) that
returning them through the stack is fairly cheap. Clients who just need to use
existing CallEvents can continue to do so using const references.

This uses the same sort of "kind-field-dispatch" as SVal, though most of the
nastiness is contained in the DISPATCH and DISPATCH_ARG macros at the end of
the file. (We can't use a template for this because member-pointers to base
class methods don't call derived-class methods even when casting to the
derived class. We can't use variadic macros because they're a C99 feature.)

llvm-svn: 160459
2012-07-18 21:59:41 +00:00
Jordan Rose 074ebb3a6f [analyzer] Remove obsolete ObjCPropRef SVal kind.
ObjC properties are handled through their semantic form of ObjCMessageExprs
and their wrapper PseudoObjectExprs, and have been for quite a while. The
syntactic ObjCPropertyRefExprs do not appear in the CFG and are not visited
by ExprEngine.

No functionality change.

llvm-svn: 160458
2012-07-18 21:59:37 +00:00
Jordan Rose be25b07f67 [analyzer] Remove unused ExprEngine::VisitCXXTemporaryObjectExpr.
llvm-svn: 160457
2012-07-18 21:59:23 +00:00
Aaron Ballman 68777ac253 Fixing up a test case that was failing due to the lack of -std=c++11
llvm-svn: 160455
2012-07-18 21:56:43 +00:00
Dmitri Gribenko b03cc7e9f4 This fits into 80 columns without wrapping.
llvm-svn: 160453
2012-07-18 21:27:38 +00:00
Dmitri Gribenko 05c3c75581 Add caching for TextComment::isWhitespace(), ParagraphComment::isWhitespace().
llvm-svn: 160452
2012-07-18 20:54:32 +00:00
Benjamin Kramer e6f7008534 Remove trivial destructor from SVal.
This enables the faster SmallVector in clang and also allows clang's unused
variable warnings to be more effective. Fix the two instances that popped up.

The RetainCountChecker change actually changes functionality, it would be nice
if someone from the StaticAnalyzer folks could look at it.

llvm-svn: 160444
2012-07-18 19:08:44 +00:00
Dmitri Gribenko 761447cd98 On Darwin, the linker removes functions in CommentDumper.o (Comment::dump())
despite __attribute__(__used__).  As explained by Argyrios,
> .a archive files do some stripping of their own and they remove .o files that
> contain functions that are not referenced by any other .o file.

The fix is to use these functions from another .o file.

Thanks, Argyrios!

llvm-svn: 160437
2012-07-18 16:30:42 +00:00
Alexander Kornienko df36746d52 Reverted custom init hook from r160369.
llvm-svn: 160432
2012-07-18 12:24:51 +00:00
Ted Kremenek 46dcfc9431 Fix crash in RegionStoreManager::evalDerivedToBase() due to not handling references
(in uses of dynamic_cast<>).

Fixes <rdar://problem/11817693>.

llvm-svn: 160427
2012-07-18 05:57:33 +00:00
Ted Kremenek 3d6177306b Teach CFG construction about destructors resulting from references to array types. Fixes crash in <rdar://problem/11671507>.
llvm-svn: 160424
2012-07-18 04:57:57 +00:00
Richard Smith af136f8191 PR13381, part 2: when determining if a defaulted special member function should
be defined as deleted, take cv-qualifiers on class members into account when
looking up the copy or move constructor or assignment operator which will be
used for them.

llvm-svn: 160418
2012-07-18 03:51:16 +00:00
Richard Smith 1c6461ef63 PR13381: consider cv-qualifiers on a class member's type when determining which
constructor will be used for moving that object, in the computation of its
exception specification.

llvm-svn: 160417
2012-07-18 03:36:00 +00:00
Richard Smith 198223b7e6 PR13386: When matching up parameters between a function template declaration
and a function template instantiation, if there's a parameter pack in the
declaration and one at the same place in the instantiation, don't assume that
the pack wasn't expanded -- it may have expanded to nothing. Instead, go ahead
and check whether the parameter pack was expandable. We can do this as a
side-effect of the work we'd need to do anyway, to find how many parameters
were produced.

llvm-svn: 160416
2012-07-18 01:29:05 +00:00
Eli Friedman ea90a40339 Fix test so it works the same way on 32-bit and 64-bit.
llvm-svn: 160415
2012-07-18 01:03:11 +00:00
Dmitri Gribenko 3100519b33 CommentSema: \short is the same as \brief.
llvm-svn: 160414
2012-07-18 00:44:55 +00:00
Douglas Gregor a906ad2f9e When performing the deduced/actual argument type check for C++
[temp.deduct.call]p4 under Objective-C++ ARC, make sure to adjust the
qualifiers to introduce the implicit strong lifetime when
needed. Fixes <rdar://problem/11825671>.

llvm-svn: 160412
2012-07-18 00:14:59 +00:00
Joel Jones 682150364a More replacing of target-dependent intrinsics with target-indepdent
intrinsics.  The second instruction(s) to be handled are the vector versions 
of count set bits (ctpop).

The changes here are to clang so that it generates a target independent 
vector ctpop when it sees an ARM dependent vector bits set count.  The changes 
in llvm are to match the target independent vector ctpop and in 
VMCore/AutoUpgrade.cpp to update any existing bc files containing ARM 
dependent vector pop counts with target-independent ctpops.  There are also 
changes to an existing test case in llvm for ARM vector count instructions and 
to a test for the bitcode upgrade.

<rdar://problem/11892519>

There is deliberately no test for the change to clang, as so far as I know, no
consensus has been reached regarding how to test neon instructions in clang;
q.v. <rdar://problem/8762292>

llvm-svn: 160409
2012-07-18 00:01:03 +00:00
Douglas Gregor 951de307e4 Remove unnecessary spacing around Objective-C object literal code
completions. Fixes <rdar://problem/11889572>.

llvm-svn: 160407
2012-07-17 23:24:47 +00:00
Aaron Ballman 8f94ac6922 Adding a fixit for includes that cannot be found with angle brackets, but can be found with quoted strings instead. Implements PR13201.
llvm-svn: 160406
2012-07-17 23:19:16 +00:00
Douglas Gregor 4b12ba0ce6 Improve comment for TypeDecl::getTypeForDecl(), from Sean Silva!
llvm-svn: 160405
2012-07-17 23:09:36 +00:00
Douglas Gregor 6bdb8daa76 Eliminating the GCC_CAST hack, take two.
llvm-svn: 160404
2012-07-17 23:07:44 +00:00
Dmitri Gribenko 9fa677c5ce Comment AST nodes: rename Num*Bitfields to Num*Bits to be consistent with Stmt AST nodes.
llvm-svn: 160402
2012-07-17 22:43:26 +00:00
Douglas Gregor 9db5e14349 Reinstate the GCC_CAST hack; I apparently did not appease GCC with r160397.
llvm-svn: 160401
2012-07-17 22:32:15 +00:00
Dmitri Gribenko 82ea947018 Implement an optimization for finding the comment that occurs just after a
given declaration.

It is based on the observation that during parsing the comment that should be
attached to the decl is usually among the last two documentation comments
parsed.

llvm-svn: 160400
2012-07-17 22:01:09 +00:00
Eric Christopher 8b808c0c3d Robustify test in the face of no assertions.
llvm-svn: 160399
2012-07-17 21:52:07 +00:00
Douglas Gregor 0ea5a97dbb Try to eliminate GCC_CAST hack in a manner that should work for both
GCC and MSVC.

llvm-svn: 160397
2012-07-17 21:27:49 +00:00
Dmitri Gribenko c4eb9752d4 CommentBriefParser: use StringSwitch::Cases to group synonyms. Thanks Jordan!
llvm-svn: 160396
2012-07-17 21:21:55 +00:00
Douglas Gregor dd6006f365 Teach the ASTImporter how to handle anonymous structs/unions
better. Fixes <rdar://problem/11466212>; the test (and back-ported
version of this code) were committed to LLDB in r160186.

llvm-svn: 160395
2012-07-17 21:16:27 +00:00
Eli Friedman 4eafb6b77b Don't treat overflow in floating-point conversions as a hard error in constant evaluation. <rdar://problem/11874571>.
llvm-svn: 160394
2012-07-17 21:03:05 +00:00
Rafael Espindola 60a2bba976 Handle the case where the base type is not dependent, but the derived one is.
Fixes pr13353.cpp.

llvm-svn: 160393
2012-07-17 20:24:05 +00:00
Joao Matos 718a883c5f Fixed whitespace issue introduced in r160373.
llvm-svn: 160388
2012-07-17 19:17:58 +00:00
Dmitri Gribenko 831c1e0819 Minor cleanups and additions to the users manual. UsersManual.html now validates as HTML 4.01 Strict.
Patch by Jonathan Sauer!  (With minor edits from me.)

llvm-svn: 160386
2012-07-17 18:51:47 +00:00
Eric Christopher 0cd70b84e2 Fix regexp for this test to properly check.
Patch by Eli Bendersky.

llvm-svn: 160385
2012-07-17 18:40:46 +00:00
Dmitri Gribenko 3e242d6d3c CommentBriefParser: make \short should equivalent to \brief, per Doxygen manual.
llvm-svn: 160383
2012-07-17 18:35:14 +00:00
Fariborz Jahanian 268fec1e2e Issue warning when assigning out-of-range integer values to enums.
Due to performance cost, this is an opt-in option placed
under -Wassign-enum. // rdar://11824807

llvm-svn: 160382
2012-07-17 18:00:08 +00:00
Jordan Rose 63ffaa8c18 -Wobjc-literal-compare: don't warn when comparing against nil.
Checks against nil often appear as guards in macros, and comparing
Objective-C literals to nil has well-defined behavior (if tautological).

On OS X, 'nil' has not been typed as 'id' since 10.6 (possibly earlier),
so the warning was already not firing, but other runtimes continue to use
((id)0) or some variant. This change accepts comparisons to any null pointer;
to keep it simple, it looks through all casts (not just casts to 'id').

PR13276

llvm-svn: 160379
2012-07-17 17:46:48 +00:00
Jordan Rose ea70bf7154 Add -Wobjc-string-compare under -Wobjc-literal-compare.
Suggested by Ted, since string literal comparison is at least slightly more
sensible than comparison of runtime literals. (Ambiguous language on
developer.apple.com implies that strings are guaranteed to be uniqued within
a translation unit and possibly across a linked binary.)

llvm-svn: 160378
2012-07-17 17:46:44 +00:00
Jordan Rose 7660f78fb9 Now that -Wobjc-literal-compare is a warning, put the fixit on a note.
Recovering as if the user had actually called -isEqual: is a bit too far from
the semantics of the program as written, /even though/ it's probably what they
intended.

llvm-svn: 160377
2012-07-17 17:46:40 +00:00
Jordan Rose c4e9d56268 [analyzer] Remove stale result type lvalue code.
This code has been moved around multiple times, but seems to have been
obsolete ever since we started handled references like pointers.

llvm-svn: 160375
2012-07-17 17:27:10 +00:00
Joao Matos 2ce88ef9a7 [Windows] Abstract pure virtual method calls in the ABI. Fix the Windows ABI to forward to the correct function.
llvm-svn: 160373
2012-07-17 17:10:11 +00:00
Alexander Kornienko 11330dc726 Add a custom initialize hook for clang tools + minor fixes in CustomCompilationDatabase.h
llvm-svn: 160369
2012-07-17 16:11:17 +00:00
Rafael Espindola e3a14bb95b Merge visibility from previous decls before looking at visibility pragma. This
is a bit fuzzy, but matches gcc behavior and existing code bases seem to
depend on it.

llvm-svn: 160364
2012-07-17 15:14:47 +00:00
NAKAMURA Takumi 878f1445f9 test/Driver/crash-report.c: Remove "REQUIRES: shell". env(1) can be used also with gnuwin32.
llvm-svn: 160362
2012-07-17 12:00:24 +00:00
Daniel Jasper ef23e2053b Fix unit test dependency in Makefile and remove unneccessary dependency
again.

llvm-svn: 160358
2012-07-17 09:12:33 +00:00
Daniel Jasper 27c163b6ca Add missing dependency for unit test.
llvm-svn: 160356
2012-07-17 08:49:28 +00:00
Daniel Jasper 6389dd145d Finishing the move of RefactoringCallbacks and fixing the corresponding
buildbot failures.

llvm-svn: 160355
2012-07-17 08:37:03 +00:00
Simon Atanasyan 94a6d863a9 Revert commit r160308. We decide to move builtins selection to the backend.
llvm-svn: 160353
2012-07-17 08:15:06 +00:00
Daniel Jasper 1975e03494 Move RefactoringCallbacks to Tooling to avoid dependency from
ASTMatchers (lower level abstraction) to Tooling (higher level
abstraction).

llvm-svn: 160351
2012-07-17 08:03:01 +00:00
Alexey Samsonov 1ad8e98298 Fixup for r160345 - uintptr_t is not always unsigned
llvm-svn: 160349
2012-07-17 07:46:40 +00:00
Daniel Jasper 2b3c7d414b Make the isDerivedFrom matcher more generic.
It now accepts an arbitrary inner matcher but is fully backwards
compatible.

llvm-svn: 160348
2012-07-17 07:39:27 +00:00
Galina Kistanova a9151076a4 Fixed few warnings.
llvm-svn: 160345
2012-07-17 06:25:13 +00:00
NAKAMURA Takumi ed5bbe9020 [Win32] Rework crash-report since r145389.
- lib/Driver/Driver.cpp, tools/driver/driver.cpp: Exit status should not be propagated, although clang driver should catch exceptions.
  - test/Driver/crash-report.c: Add REQUIRES:shell for now.
    FIXME: setenv should work also on Lit.InternalShellRunner.
  - test/Driver/crash-report.c: Remove XFAIL.

Thanks to Chad, To point out the issue.

llvm-svn: 160343
2012-07-17 05:09:29 +00:00
NAKAMURA Takumi 78c0295fcf test/Driver/crash-report.c: Small tweaks. 1) Use %t instead %T for TMP. 2) Set all of $TMPDIR, $TEMP and $TMP, or a certain host might set $TEMP.
llvm-svn: 160342
2012-07-17 05:09:20 +00:00
Rafael Espindola f97c636812 Record visibility pragmas when we see a tag declaration. We might use it
to build a type before seeing the definition.

llvm-svn: 160339
2012-07-17 04:22:25 +00:00
Richard Smith b21dd02e61 Uninitialized variables: two little changes:
* Treat compound assignment as a use, at Jordy's request.
 * Always add compound assignments into the CFG, so we can correctly diagnose the use in 'return x += 1;'

llvm-svn: 160334
2012-07-17 01:27:33 +00:00
NAKAMURA Takumi b7fa0d58fa clang/test/Tooling/clang-ast-dump.cpp: Mark it as REQUIRES: asserts, for now.
llvm-svn: 160332
2012-07-17 00:33:36 +00:00
Dmitri Gribenko f290b0d137 Move clang_Cursor_getBriefCommentText implementation under `extern "C"'.
llvm-svn: 160331
2012-07-17 00:17:45 +00:00
Richard Smith 6376d1fd9c -Wuninitialized: Split the classification of DeclRefExprs as initialization or
use out of TransferFunctions, and compute it in advance rather than on-the-fly.

This allows us to handle compound assignments with DeclRefExprs on the RHS
correctly, and also makes it trivial to treat const& function parameters as not
initializing the argument. The patch also makes both of those changes.

llvm-svn: 160330
2012-07-17 00:06:14 +00:00
Jordan Rose 5089f3b398 [analyzer] Handle new-expressions with initializers for scalars.
<rdar://problem/11818967>

llvm-svn: 160328
2012-07-16 23:38:09 +00:00
Jordan Rose aa9f35a6b6 Weaken Unicode fixit test to work even if the character is printed escaped.
This should fix the failure on Windows.

llvm-svn: 160324
2012-07-16 22:18:33 +00:00
Dmitri Gribenko a0473ab8bc Fix BlockCommandComment::classof() to return true for objects of derived classes.
llvm-svn: 160323
2012-07-16 22:13:46 +00:00
Ted Kremenek a0d18e51f9 This test appears to fail on win32.
llvm-svn: 160322
2012-07-16 21:43:16 +00:00
Ted Kremenek 4abbade558 Add hack (provided by Jonathan Sauer) to fall back to assuming Xcode is installed in /Developer
when using Python < 2.7.0.  This is the case on Snow Leopard, where the tools are always
installed in /Developer.  This isn't a proper fix for really figuring out where Xcode
is installed, but should work to fix an obvious problem on Snow Leopard.

llvm-svn: 160321
2012-07-16 21:39:29 +00:00
Ted Kremenek cf74cef104 This test appears to be passing on win32.
llvm-svn: 160320
2012-07-16 21:17:01 +00:00
Jordan Rose fb12a53d5d Don't crash when emitting fixits following Unicode characters.
This code is very sensitive to the difference between "columns" as printed
and "bytes" (SourceManager columns). All variables are now named explicitly
and our assumptions are (hopefully) documented as both comment and assertion.

Whether parseable fixits should use byte offsets or Unicode character counts
is pending discussion on the mailing list; currently the implementation uses
bytes (and has no problems on lines containing multibyte characters).
This has been added to the user manual.

<rdar://problem/11877454>

llvm-svn: 160319
2012-07-16 20:52:12 +00:00
David Blaikie 1f4ff15c91 Simplify float comparison checks by using early return.
Found while investigating PR13330

llvm-svn: 160318
2012-07-16 20:47:22 +00:00
Ted Kremenek 816255dc39 Fix copy-paste mistake for CMake dependency.
llvm-svn: 160315
2012-07-16 20:22:15 +00:00
Anna Zaks 9b7d7140ef [analyzer] Make CmpRuns external-user friendly.
CmpRuns can be used for static analyzer bug report comparison. However,
we want to make sure external users do not rely on the way bugs are
represented (plist files). Make sure that we have a user
friendly/documented API for CmpRuns script.

llvm-svn: 160314
2012-07-16 20:21:42 +00:00
Ted Kremenek 42bff962b6 Looks like libTooling might also depend on ClangDiagnosticCommon.
llvm-svn: 160313
2012-07-16 19:44:15 +00:00
Ted Kremenek 25bdee6b5b Add libEdit dependency on ClangDiagnosticCommon. Hopefully this will unbreak the VS build.
llvm-svn: 160309
2012-07-16 18:53:42 +00:00
Simon Atanasyan a06d06b660 MIPS: Implement __builtin_mips_shll_qb builtin function overloading.
This function has two versions. The first one is used for a register operand.
The second one is used for an immediate number.

llvm-svn: 160308
2012-07-16 18:52:02 +00:00
David Blaikie 5a0956e98d Fix rejects-valid: explicit specialization of redeclared deleted function template.
Review by Richard Smith.

llvm-svn: 160306
2012-07-16 18:50:45 +00:00
Fariborz Jahanian 6c7dbf5858 modern objective-c translator: conditionally include
<string.h>. // rdar://11847319

llvm-svn: 160287
2012-07-16 16:21:45 +00:00
Aaron Ballman 1206a91155 Fixing an MSVC warning -- the compiler did not like the cast added to work around a g++ bug (it would claim to possibly emit incorrect code).
llvm-svn: 160281
2012-07-16 15:45:33 +00:00
Alexander Kornienko 277f6cf805 Fixing an obvious bug in a test.
llvm-svn: 160268
2012-07-16 13:31:37 +00:00
Alexander Kornienko f2f82550fd The new clang-ast-dump tool for selective AST dumping. Moved common command-line tool stuff to CommandLineClangTool
llvm-svn: 160265
2012-07-16 12:46:48 +00:00
Daniel Jasper b45e7e9191 Add two more missing parameters in diagnostics.
llvm-svn: 160264
2012-07-16 12:12:45 +00:00
Daniel Jasper 1c2f27c062 Fix diagnostic adding missing parameter.
llvm-svn: 160263
2012-07-16 11:51:49 +00:00
Daniel Jasper 6b5a4fcc07 Prevent unused-variable warning in optimized builds.
llvm-svn: 160257
2012-07-16 10:25:15 +00:00
Daniel Jasper 7e22282b68 Add refactoring callbacks to make common kinds of refactorings easy.
llvm-svn: 160255
2012-07-16 09:18:17 +00:00
Daniel Jasper 3e1a9cf3b8 Add correct parenthesis range to CXXConstructExprs inside
CXXFunctionalCastExprs.

llvm-svn: 160252
2012-07-16 08:05:07 +00:00
Ted Kremenek a8c2c10f16 Place checker build at alternate URL.
llvm-svn: 160247
2012-07-16 04:18:35 +00:00
Richard Smith 3beb930cfd More for PR11848: a pack expansion type isn't necessarily type-dependent (its
pattern might be an alias template which doesn't use its arguments). It's always
instantiation-dependent, though.

llvm-svn: 160246
2012-07-16 01:59:26 +00:00
Richard Smith 8093465a0b PR13365: Fix code which was trying to treat an array of DeducedTemplateArgument
as an array of its base class TemplateArgument. Switch the const
TemplateArgument* parameters of InstantiatingTemplate's constructors to
ArrayRef<TemplateArgument> to prevent this from happening again in the future.

llvm-svn: 160245
2012-07-16 01:09:10 +00:00
Richard Smith 68eea507fa Related to PR11848 and core-21989: switch ContainsUnexpandedParameterPack from
being a property of a canonical type to being a property of the fully-sugared
type. This should only make a difference in the case where an alias template
ignores one of its parameters, and that parameter is an unexpanded parameter
pack.

llvm-svn: 160244
2012-07-16 00:20:35 +00:00
Richard Smith 9db53d7d68 Revert change accidentally committed in r160240.
llvm-svn: 160241
2012-07-15 23:30:50 +00:00
Richard Smith 7dfc0240ea PR13368: Halve the instantiation depth of this test again. Apparently, FreeBSD
has a much lower default stack limit than the systems I have access to.

llvm-svn: 160240
2012-07-15 23:29:50 +00:00
Chandler Carruth cc8f2a6ab5 Update Clang to reflect the move of MDBuilder in r160237.
llvm-svn: 160238
2012-07-15 23:28:01 +00:00
David Chisnall d5ca836c01 Add test case for tweaks to clang driver.
llvm-svn: 160236
2012-07-15 21:18:01 +00:00
Daniel Jasper 84c763edbe Fix spelling of anyOf matcher and add missing test.
Patch by Sam Panzer!

llvm-svn: 160233
2012-07-15 19:57:12 +00:00
David Chisnall df3045f0e3 Enable new linker behaviour on FreeBSD.
llvm-svn: 160231
2012-07-15 12:53:06 +00:00
Rafael Espindola faf556b745 Without this patch clang warns on
struct __attribute__((visibility("hidden"))) zed {
};
struct __attribute__((visibility("hidden"))) zed;

Which is a bit silly and got a lot noisier now that we correctly handle
visibility pragmas. This patch fixes that and also has some extra quality
improvements:

* We now produce an error instead of a warning for

struct __attribute__((visibility("hidden"))) zed {
};
struct __attribute__((visibility("default"))) zed;

* The "after definition" warning now points to the new attribute that is
  ignored instead of pointing to the declaration.

llvm-svn: 160227
2012-07-15 01:33:40 +00:00
Rafael Espindola a5bba70c9c Make const the argument of getDefinition.
llvm-svn: 160226
2012-07-15 01:05:36 +00:00