Commit Graph

37696 Commits

Author SHA1 Message Date
Richard Smith ce52ca178d Remove DiagGroups from notes, and add a TableGen assertion to catch them.
llvm-svn: 156192
2012-05-04 19:05:50 +00:00
Argyrios Kyrtzidis b721b682fe Add more comments for Lexer::makeFileCharRange.
llvm-svn: 156188
2012-05-04 18:33:19 +00:00
Douglas Gregor 93a586fa90 Synchronize the representations of DeclarationName and Selector so
that bridging between the two is free. Saves ~4k of code size,
although I don't see any measurable performance difference
(unfortunately).

llvm-svn: 156187
2012-05-04 18:24:37 +00:00
Sean Callanan 06a48a62b3 IsTailPaddedMemberArray uses a FieldDecl's
getTypeSourceInfo() without checking for NULL.
FieldDecls may have NULL TypeSourceInfo, and in
fact some FieldDecls generated by Clang -- and
all FieldDecls generated by LLDB -- have no
TypeSourceInfo.

This patch makes IsTailPaddedMemberArray check
for NULL.

llvm-svn: 156186
2012-05-04 18:22:53 +00:00
Argyrios Kyrtzidis 566e40775b [PCH] Use DenseMap instead of std::map to keep track of SwitchCases.
Part of rdar://11353109.

llvm-svn: 156185
2012-05-04 18:17:30 +00:00
Anna Zaks 63509fbacc [analyzer]Fixup r156134: Handle the case when FunctionDecl isn't avail.
llvm-svn: 156183
2012-05-04 17:37:16 +00:00
Douglas Gregor ae29842706 Move Sema::RequireNonAbstractType() off of PartialDiagnostic.
llvm-svn: 156180
2012-05-04 17:09:59 +00:00
Douglas Gregor a6c5abb754 Switch RequireLiteralType() off of PartialDiagnostic.
llvm-svn: 156178
2012-05-04 16:48:41 +00:00
Douglas Gregor 7bfb2d026e Move Sema::RequireCompleteType() and Sema::RequireCompleteExprType()
off PartialDiagnostic. PartialDiagnostic is rather heavyweight for
something that is in the critical path and is rarely used. So, switch
over to an abstract-class-based callback mechanism that delays most of
the work until a diagnostic is actually produced. Good for ~11k code
size reduction in the compiler and 1% speedup in -fsyntax-only on the
code in <rdar://problem/11004361>.

llvm-svn: 156176
2012-05-04 16:32:21 +00:00
DeLesley Hutchins 5ff430ce06 Thread safety analysis: check for LOCKABLE attribute on base classes.
llvm-svn: 156175
2012-05-04 16:28:38 +00:00
Chad Rosier aaec1338b1 StringRefize code because we're good even when we crash.
Patch by Jordy Rose.

llvm-svn: 156172
2012-05-04 15:32:05 +00:00
James Molloy 222f27858f Add a predefine __WINT_UNSIGNED__, similar to __WCHAR_UNSIGNED__, and test them both for ARM and X86.
Use this to fully fix Sema/format-strings.c for non-x86 platforms.

Reviewed by Chandler on IRC.

llvm-svn: 156169
2012-05-04 11:23:40 +00:00
James Molloy 3636554b63 Fix handling of wint_t - we can't assume wint_t is purely an integer promotion of wchar_t - they may differ in signedness.
Teach ASTContext about WIntType, and have it taken from TargetInfo like WCharType. Should fix test/Sema/format-strings.c for ARM, with the exception of one subtest which will fail if wint_t and wchar_t are the same size and wint_t is signed, wchar_t is unsigned.

There'll be a followup commit to fix that.

Reviewed by Chandler and Hans at http://llvm.org/reviews/r/8

llvm-svn: 156165
2012-05-04 10:55:22 +00:00
Jean-Daniel Dupas 73d801cd8a Fix -Wlarge-by-value-copy option handling in the driver.
CC1 supports only the joined format.

llvm-svn: 156161
2012-05-04 08:08:37 +00:00
Alexey Samsonov 74a3868dbb This patch adds a new Clang compiler flag "-gline-tables-only".
It reduces the amount of emitted debug information:
1) DIEs in .debug_info have types DW_TAG_compile_unit, DW_TAG_subprogram,
DW_TAG_inlined_subroutine (for opt builds) and DW_TAG_lexical_block only.
2) .debug_str contains only function names.
3) No debug data for types/namespaces/variables is emitted.
4) The data in .debug_line is enough to produce valid stack traces with
function names and line numbers.

Reviewed by Eric Christopher.

llvm-svn: 156160
2012-05-04 07:39:27 +00:00
NAKAMURA Takumi dcb0e394a9 test/PCH/remap-file-from-pch.cpp: Fix expression for DOS pathsep.
llvm-svn: 156153
2012-05-04 03:42:28 +00:00
Bob Wilson e64bd84ec7 Remove obsolete code for finding a fallback iOS SDK. <rdar://problem/11378535>
llvm-svn: 156149
2012-05-04 03:09:46 +00:00
Richard Trieu 0030f1dbc1 Skip checking for infinite for-loops if there are global or static variables
in the conditional.

llvm-svn: 156148
2012-05-04 03:01:54 +00:00
Argyrios Kyrtzidis 0f7d7ab968 [PCH] Really, pinky swear, fix for PR12689
rdar://11353109

llvm-svn: 156145
2012-05-04 01:49:36 +00:00
Argyrios Kyrtzidis 90c337a23c [libclang] Bring back BodyIndexer::TraverseCXXOperatorCallExpr which
was removed in r155969 to address a deficiency of RecursiveASTVisitor
prior to recent changes on it.

llvm-svn: 156142
2012-05-04 01:00:38 +00:00
Argyrios Kyrtzidis 6c57a4703d Make RecursiveASTVisitor fully data recursive on Stmts, with
minimal disruption on its clients.

Unlike the previous data-recursive scheme, Traverse*Stmt methods are
always getting called. The base methods of RecursiveASTVisitor will enqueue
the sub-statements instead of calling TraverseStmt on them.

Clients that override a Traverse*Stmt method and call TraverseStmt will
still function as function-recursive traversal; if a client wants to
enqueue a sub-statement in its override method it can do it like this:

[inside the override method]
StmtQueueAction StmtQueue(*this);
StmtQueue.queue(Stmt->getSubStmt());

Should address rdar://11179167.

llvm-svn: 156141
2012-05-04 01:00:35 +00:00
Anna Zaks 6ccfcf346d [analyzer] Assume pointer escapes when a callback is passed inside
a struct.

llvm-svn: 156135
2012-05-03 23:50:33 +00:00
Anna Zaks 228f9c7b68 [analyzer] Allow pointers escape through calls containing callback args.
(Since we don't have a generic pointer escape callback, modify
ExprEngineCallAndReturn as well as the malloc checker.)

llvm-svn: 156134
2012-05-03 23:50:28 +00:00
Chandler Carruth b41171b70b Fix non-deterministic iteration order when walking the specializations
of templates by using the newly introduce FoldingSetVector. This
preserves insertion order for all iteration of specializations.

I've also included a somewhat terrifying testcase that rapidly builds up
a large number of functions. This is enough that any system with ASLR
will have non-deterministic debug information generated for the test
case without the fix here as the debug information is generated in part
by walking these specializations.

llvm-svn: 156133
2012-05-03 23:49:05 +00:00
Bob Wilson e31772fc44 Add a test for r156092.
llvm-svn: 156132
2012-05-03 23:38:51 +00:00
Douglas Gregor 1798cd797b Inline DenseMapInfo<clang::DeclarationName>::getHashValue() for a 0.4% speedup on <rdar://problem/11004361>
llvm-svn: 156129
2012-05-03 23:28:32 +00:00
Fariborz Jahanian e9863b5c8e objc modern translator: fix up attribute for dynamic property in a category.
// rdar://11095151

llvm-svn: 156127
2012-05-03 23:19:33 +00:00
Douglas Gregor 0da530562a Split DeclarationName::getFETokenInfoAsVoid() into hot/cold paths and
(trivially) make DeclContext::lookup()'s const version inlinable. Good
for 0.3% on <rdar://problem/11004361>.

llvm-svn: 156126
2012-05-03 23:18:44 +00:00
Fariborz Jahanian f687e7b2ff modern objc translator: support for default property
synthesis translation. // rdar://11374235 - wip.

llvm-svn: 156125
2012-05-03 22:52:13 +00:00
Stephen Canon fdc6c1a461 Add support for full-width 128-bit integer literals.
llvm-svn: 156123
2012-05-03 22:49:43 +00:00
Chad Rosier dcef562557 [driver - crash diagnostics] Convert the flags back to an array of strings and use
array_lengthof.  Also, append the new filename with correct preprocessed suffix.
Last part of rdar://11285725

llvm-svn: 156117
2012-05-03 22:38:00 +00:00
Richard Smith d106a98fe9 Use the standard values for the __cplusplus macro, even when in GNU mode. GCC
dropped its prior behavior of always defining __cplusplus to 1 in GNU mode in
version 4.7.

llvm-svn: 156113
2012-05-03 22:18:20 +00:00
Argyrios Kyrtzidis 6eec06d0d4 [PCH] When validating that the files coming from PCH did not change, also
validate that we didn't override the contents of any of such files.

If this is detected, emit a diagnostic error and recover gracefully
by using the contents of the original file that the PCH was built from.

Part of rdar://11305263

llvm-svn: 156107
2012-05-03 21:50:39 +00:00
Fariborz Jahanian 2e7f638b23 modern objc translator: used size_t in couple
of places. // rdar://11375908

llvm-svn: 156106
2012-05-03 21:44:12 +00:00
Chad Rosier 45cf50f7b6 Use array_lengthof instead of sizeof trickery.
llvm-svn: 156104
2012-05-03 21:25:34 +00:00
Douglas Gregor cf4ac44377 Do not keep track of the set of visited Objective-C containers when
performing the search for overridden methods. We very rarely see the
same container twice, and in those rare cases we still have the
fallback of the second SmallPtrSet to eliminate duplicates. Good for
~1.5% -fsyntax-only speedup on the code in <rdar://problem/11004361>.

llvm-svn: 156103
2012-05-03 21:25:24 +00:00
Fariborz Jahanian 3dc3669858 modern objc translation. objc_getClass() and objc_getMetaClass()
prototypes should both return  `struct objc_class *`.
// rdar://11375495

llvm-svn: 156097
2012-05-03 20:23:37 +00:00
Chad Rosier 1c5add6c5b [driver - crash diagnostics] Only write the failing command in the script.
Part of rdar://11285725

llvm-svn: 156096
2012-05-03 20:17:15 +00:00
Richard Smith 33c1cf9205 Fix typo and avoid layout issue with almost-but-not-quite-fixed-width fonts.
llvm-svn: 156095
2012-05-03 20:10:41 +00:00
Richard Smith dcfde13648 Minor copy-edits to clang::fallthrough attribute documentation.
llvm-svn: 156094
2012-05-03 20:05:46 +00:00
Chad Rosier cb600e2422 Canonicalize loop.
llvm-svn: 156093
2012-05-03 19:50:25 +00:00
Bob Wilson 23cd434202 Disable -Wformat-extra-args for arguments defined in system headers.
Some of the NSAssert macros in OS X 10.7 are implemented in a way that
adds extra arguments that trigger the -Wformat-extra-args warning.
Earlier versions of clang failed to detect those -Wformat issues, but now
that clang is reporting those problems, we need to quiet them since there's
nothing to be done to fix them.  <rdar://problem/11317765>

I don't know how to write a testcase for this.  Suggestions welcome.
Patch by Ted Kremenek!

llvm-svn: 156092
2012-05-03 19:47:19 +00:00
Kaelyn Uhrain 29a8eebc94 Silence unused-variable warning when assertions are disabled.
llvm-svn: 156091
2012-05-03 19:46:38 +00:00
Peter Collingbourne 9251b7d873 Honour CLANG_BUILD_EXAMPLES correctly, by setting the directory's
EXCLUDE_FROM_ALL property.

llvm-svn: 156090
2012-05-03 19:11:45 +00:00
Jordy Rose 1d4660bc51 [analyzer] When promoting constant integers in a comparison, use the larger width of the two to avoid truncation.
llvm-svn: 156089
2012-05-03 19:05:48 +00:00
Richard Smith be179ecb7c Remove diagnostic groups and DefaultIgnore from notes.
llvm-svn: 156087
2012-05-03 18:38:45 +00:00
Richard Smith 84837d5b5a Add -Wimplicit-fallthrough warning flag, which warns on fallthrough between
cases in switch statements. Also add a [[clang::fallthrough]] attribute, which
can be used to suppress the warning in the case of intentional fallthrough.

Patch by Alexander Kornienko!

The handling of C++11 attribute namespaces in this patch is temporary, and will
be replaced with a cleaner mechanism in a subsequent patch.

llvm-svn: 156086
2012-05-03 18:27:39 +00:00
Anna Zaks b3b56bb960 [analyzer] CString Checker: Do not split the path unless the user
specifically checks for equality to null.

Enforcing this general practice, which keeps the analyzer less
noisy, in the CString Checker. This change suppresses "Assigned value is
garbage or undefined" warning in the added test case.

llvm-svn: 156085
2012-05-03 18:21:28 +00:00
Richard Smith 3bddb62daa Fix a couple of cases of (innocuous) unmarked fallthrough. At least one of these
was unintentional. Found by -Wimplicit-fallthrough, patch by Alexander Kornienko!

llvm-svn: 156082
2012-05-03 17:56:49 +00:00
Argyrios Kyrtzidis 9933e3ac88 In StringLiteralParser::init, make sure we emit an error when
failing to lex the string, as suggested by Eli.

Part of rdar://11305263.

llvm-svn: 156081
2012-05-03 17:50:32 +00:00