]> granicus.if.org Git - clang/log
clang
12 years agoIsTailPaddedMemberArray uses a FieldDecl's
Sean Callanan [Fri, 4 May 2012 18:22:53 +0000 (18:22 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156186 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[PCH] Use DenseMap instead of std::map to keep track of SwitchCases.
Argyrios Kyrtzidis [Fri, 4 May 2012 18:17:30 +0000 (18:17 +0000)]
[PCH] Use DenseMap instead of std::map to keep track of SwitchCases.

Part of rdar://11353109.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156185 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer]Fixup r156134: Handle the case when FunctionDecl isn't avail.
Anna Zaks [Fri, 4 May 2012 17:37:16 +0000 (17:37 +0000)]
[analyzer]Fixup r156134: Handle the case when FunctionDecl isn't avail.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156183 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoMove Sema::RequireNonAbstractType() off of PartialDiagnostic.
Douglas Gregor [Fri, 4 May 2012 17:09:59 +0000 (17:09 +0000)]
Move Sema::RequireNonAbstractType() off of PartialDiagnostic.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156180 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoSwitch RequireLiteralType() off of PartialDiagnostic.
Douglas Gregor [Fri, 4 May 2012 16:48:41 +0000 (16:48 +0000)]
Switch RequireLiteralType() off of PartialDiagnostic.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156178 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoMove Sema::RequireCompleteType() and Sema::RequireCompleteExprType()
Douglas Gregor [Fri, 4 May 2012 16:32:21 +0000 (16:32 +0000)]
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>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156176 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoThread safety analysis: check for LOCKABLE attribute on base classes.
DeLesley Hutchins [Fri, 4 May 2012 16:28:38 +0000 (16:28 +0000)]
Thread safety analysis: check for LOCKABLE attribute on base classes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156175 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoStringRefize code because we're good even when we crash.
Chad Rosier [Fri, 4 May 2012 15:32:05 +0000 (15:32 +0000)]
StringRefize code because we're good even when we crash.
Patch by Jordy Rose.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156172 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd a predefine __WINT_UNSIGNED__, similar to __WCHAR_UNSIGNED__, and test them both...
James Molloy [Fri, 4 May 2012 11:23:40 +0000 (11:23 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156169 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix handling of wint_t - we can't assume wint_t is purely an integer promotion of...
James Molloy [Fri, 4 May 2012 10:55:22 +0000 (10:55 +0000)]
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156165 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix -Wlarge-by-value-copy option handling in the driver.
Jean-Daniel Dupas [Fri, 4 May 2012 08:08:37 +0000 (08:08 +0000)]
Fix -Wlarge-by-value-copy option handling in the driver.
CC1 supports only the joined format.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156161 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoThis patch adds a new Clang compiler flag "-gline-tables-only".
Alexey Samsonov [Fri, 4 May 2012 07:39:27 +0000 (07:39 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156160 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agotest/PCH/remap-file-from-pch.cpp: Fix expression for DOS pathsep.
NAKAMURA Takumi [Fri, 4 May 2012 03:42:28 +0000 (03:42 +0000)]
test/PCH/remap-file-from-pch.cpp: Fix expression for DOS pathsep.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156153 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRemove obsolete code for finding a fallback iOS SDK. <rdar://problem/11378535>
Bob Wilson [Fri, 4 May 2012 03:09:46 +0000 (03:09 +0000)]
Remove obsolete code for finding a fallback iOS SDK.  <rdar://problem/11378535>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156149 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoSkip checking for infinite for-loops if there are global or static variables
Richard Trieu [Fri, 4 May 2012 03:01:54 +0000 (03:01 +0000)]
Skip checking for infinite for-loops if there are global or static variables
in the conditional.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156148 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[PCH] Really, pinky swear, fix for PR12689
Argyrios Kyrtzidis [Fri, 4 May 2012 01:49:36 +0000 (01:49 +0000)]
[PCH] Really, pinky swear, fix for PR12689

rdar://11353109

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156145 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[libclang] Bring back BodyIndexer::TraverseCXXOperatorCallExpr which
Argyrios Kyrtzidis [Fri, 4 May 2012 01:00:38 +0000 (01:00 +0000)]
[libclang] Bring back BodyIndexer::TraverseCXXOperatorCallExpr which
was removed in r155969 to address a deficiency of RecursiveASTVisitor
prior to recent changes on it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156142 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoMake RecursiveASTVisitor fully data recursive on Stmts, with
Argyrios Kyrtzidis [Fri, 4 May 2012 01:00:35 +0000 (01:00 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156141 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] Assume pointer escapes when a callback is passed inside
Anna Zaks [Thu, 3 May 2012 23:50:33 +0000 (23:50 +0000)]
[analyzer] Assume pointer escapes when a callback is passed inside
a struct.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156135 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] Allow pointers escape through calls containing callback args.
Anna Zaks [Thu, 3 May 2012 23:50:28 +0000 (23:50 +0000)]
[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.)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156134 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix non-deterministic iteration order when walking the specializations
Chandler Carruth [Thu, 3 May 2012 23:49:05 +0000 (23:49 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156133 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd a test for r156092.
Bob Wilson [Thu, 3 May 2012 23:38:51 +0000 (23:38 +0000)]
Add a test for r156092.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156132 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoInline DenseMapInfo<clang::DeclarationName>::getHashValue() for a 0.4% speedup on...
Douglas Gregor [Thu, 3 May 2012 23:28:32 +0000 (23:28 +0000)]
Inline DenseMapInfo<clang::DeclarationName>::getHashValue() for a 0.4% speedup on <rdar://problem/11004361>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156129 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoobjc modern translator: fix up attribute for dynamic property in a category.
Fariborz Jahanian [Thu, 3 May 2012 23:19:33 +0000 (23:19 +0000)]
objc modern translator: fix up attribute for  dynamic property in a category.
// rdar://11095151

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156127 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoSplit DeclarationName::getFETokenInfoAsVoid() into hot/cold paths and
Douglas Gregor [Thu, 3 May 2012 23:18:44 +0000 (23:18 +0000)]
Split DeclarationName::getFETokenInfoAsVoid() into hot/cold paths and
(trivially) make DeclContext::lookup()'s const version inlinable. Good
for 0.3% on <rdar://problem/11004361>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156126 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agomodern objc translator: support for default property
Fariborz Jahanian [Thu, 3 May 2012 22:52:13 +0000 (22:52 +0000)]
modern objc translator: support for default property
synthesis translation. // rdar://11374235 - wip.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156125 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd support for full-width 128-bit integer literals.
Stephen Canon [Thu, 3 May 2012 22:49:43 +0000 (22:49 +0000)]
Add support for full-width 128-bit integer literals.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156123 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[driver - crash diagnostics] Convert the flags back to an array of strings and use
Chad Rosier [Thu, 3 May 2012 22:38:00 +0000 (22:38 +0000)]
[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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156117 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoUse the standard values for the __cplusplus macro, even when in GNU mode. GCC
Richard Smith [Thu, 3 May 2012 22:18:20 +0000 (22:18 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156113 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[PCH] When validating that the files coming from PCH did not change, also
Argyrios Kyrtzidis [Thu, 3 May 2012 21:50:39 +0000 (21:50 +0000)]
[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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156107 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agomodern objc translator: used size_t in couple
Fariborz Jahanian [Thu, 3 May 2012 21:44:12 +0000 (21:44 +0000)]
modern objc translator: used size_t in couple
of places. // rdar://11375908

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156106 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoUse array_lengthof instead of sizeof trickery.
Chad Rosier [Thu, 3 May 2012 21:25:34 +0000 (21:25 +0000)]
Use array_lengthof instead of sizeof trickery.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156104 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoDo not keep track of the set of visited Objective-C containers when
Douglas Gregor [Thu, 3 May 2012 21:25:24 +0000 (21:25 +0000)]
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>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156103 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agomodern objc translation. objc_getClass() and objc_getMetaClass()
Fariborz Jahanian [Thu, 3 May 2012 20:23:37 +0000 (20:23 +0000)]
modern objc translation.  objc_getClass() and objc_getMetaClass()
prototypes should both return  `struct objc_class *`.
// rdar://11375495

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156097 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[driver - crash diagnostics] Only write the failing command in the script.
Chad Rosier [Thu, 3 May 2012 20:17:15 +0000 (20:17 +0000)]
[driver - crash diagnostics] Only write the failing command in the script.
Part of rdar://11285725

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156096 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix typo and avoid layout issue with almost-but-not-quite-fixed-width fonts.
Richard Smith [Thu, 3 May 2012 20:10:41 +0000 (20:10 +0000)]
Fix typo and avoid layout issue with almost-but-not-quite-fixed-width fonts.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156095 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoMinor copy-edits to clang::fallthrough attribute documentation.
Richard Smith [Thu, 3 May 2012 20:05:46 +0000 (20:05 +0000)]
Minor copy-edits to clang::fallthrough attribute documentation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156094 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoCanonicalize loop.
Chad Rosier [Thu, 3 May 2012 19:50:25 +0000 (19:50 +0000)]
Canonicalize loop.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156093 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoDisable -Wformat-extra-args for arguments defined in system headers.
Bob Wilson [Thu, 3 May 2012 19:47:19 +0000 (19:47 +0000)]
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!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156092 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoSilence unused-variable warning when assertions are disabled.
Kaelyn Uhrain [Thu, 3 May 2012 19:46:38 +0000 (19:46 +0000)]
Silence unused-variable warning when assertions are disabled.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156091 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoHonour CLANG_BUILD_EXAMPLES correctly, by setting the directory's
Peter Collingbourne [Thu, 3 May 2012 19:11:45 +0000 (19:11 +0000)]
Honour CLANG_BUILD_EXAMPLES correctly, by setting the directory's
EXCLUDE_FROM_ALL property.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156090 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] When promoting constant integers in a comparison, use the larger width...
Jordy Rose [Thu, 3 May 2012 19:05:48 +0000 (19:05 +0000)]
[analyzer] When promoting constant integers in a comparison, use the larger width of the two to avoid truncation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156089 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRemove diagnostic groups and DefaultIgnore from notes.
Richard Smith [Thu, 3 May 2012 18:38:45 +0000 (18:38 +0000)]
Remove diagnostic groups and DefaultIgnore from notes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156087 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd -Wimplicit-fallthrough warning flag, which warns on fallthrough between
Richard Smith [Thu, 3 May 2012 18:27:39 +0000 (18:27 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156086 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] CString Checker: Do not split the path unless the user
Anna Zaks [Thu, 3 May 2012 18:21:28 +0000 (18:21 +0000)]
[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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156085 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix a couple of cases of (innocuous) unmarked fallthrough. At least one of these
Richard Smith [Thu, 3 May 2012 17:56:49 +0000 (17:56 +0000)]
Fix a couple of cases of (innocuous) unmarked fallthrough. At least one of these
was unintentional. Found by -Wimplicit-fallthrough, patch by Alexander Kornienko!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156082 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoIn StringLiteralParser::init, make sure we emit an error when
Argyrios Kyrtzidis [Thu, 3 May 2012 17:50:32 +0000 (17:50 +0000)]
In StringLiteralParser::init, make sure we emit an error when
failing to lex the string, as suggested by Eli.

Part of rdar://11305263.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156081 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[driver crash diagnostics] Remove more flags that reference absolute paths that
Chad Rosier [Thu, 3 May 2012 17:07:55 +0000 (17:07 +0000)]
[driver crash diagnostics] Remove more flags that reference absolute paths that
aren't necessary to reproduce the clang crash.
Part of rdar://11285725

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156079 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoobjective-c: warn for properties being default synthesized
Fariborz Jahanian [Thu, 3 May 2012 16:43:30 +0000 (16:43 +0000)]
objective-c: warn for properties being default synthesized
under -Wobjc-missing-property-synthesis which must be
opted-in. // rdar://11295716

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156078 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoCorrectly constify clang::CXXMemberCallExpr::getRecordDecl()
David Blaikie [Thu, 3 May 2012 16:25:49 +0000 (16:25 +0000)]
Correctly constify clang::CXXMemberCallExpr::getRecordDecl()

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156074 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoTest case Clang::Driver/debug-options-as.c depends on the integrated assembler. Turn...
Simon Atanasyan [Thu, 3 May 2012 13:57:00 +0000 (13:57 +0000)]
Test case Clang::Driver/debug-options-as.c depends on the integrated assembler. Turn it on explicitly on all platforms by the "-integrated-as" option.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156063 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] Equality ops are like relational ops in that the arguments shouldn't be...
Jordy Rose [Thu, 3 May 2012 07:34:01 +0000 (07:34 +0000)]
[analyzer] Equality ops are like relational ops in that the arguments shouldn't be converted to the result type. Fixes PR12206 and dupe PR12510.

This was probably the original intent of r133041 (also me, a year ago).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156062 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] Fix RUN line and general cleanup for additive folding tests.
Jordy Rose [Thu, 3 May 2012 07:33:56 +0000 (07:33 +0000)]
[analyzer] Fix RUN line and general cleanup for additive folding tests.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156061 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRip out old code for finding libraries in GCC's directories.
Bob Wilson [Thu, 3 May 2012 05:23:52 +0000 (05:23 +0000)]
Rip out old code for finding libraries in GCC's directories.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156058 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[PCH] Clear switch case IDs when deserializing a objc method body.
Argyrios Kyrtzidis [Thu, 3 May 2012 02:26:32 +0000 (02:26 +0000)]
[PCH] Clear switch case IDs when deserializing a objc method body.

Fixes rdar://11353109 & http://llvm.org/bugs/show_bug.cgi?id=12689

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156056 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] Conjure a symbol to ensure we can identify pointer arithmetic
Anna Zaks [Thu, 3 May 2012 02:13:56 +0000 (02:13 +0000)]
[analyzer] Conjure a symbol to ensure we can identify pointer arithmetic

We need to identify the value of ptr as
ElementRegion (result of pointer arithmetic) in the following code.
However, before this commit '(2-x)' evaluated to Unknown value, and as
the result, 'p + (2-x)' evaluated to Unknown value as well.

int *p = malloc(sizeof(int));
ptr = p + (2-x);

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156052 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] Do not assert on constructing SymSymExpr with diff types.
Anna Zaks [Thu, 3 May 2012 02:13:53 +0000 (02:13 +0000)]
[analyzer] Do not assert on constructing SymSymExpr with diff types.

The resulting type info is stored in the SymSymExpr, so no reason not to
support construction of expression with different subexpression types.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156051 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] Add a complexity bound on history tracking.
Anna Zaks [Thu, 3 May 2012 02:13:50 +0000 (02:13 +0000)]
[analyzer] Add a complexity bound on history tracking.

(Currently, this is only relevant for tainted data.)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156050 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] Revert the functional part of r155944.
Anna Zaks [Thu, 3 May 2012 02:13:46 +0000 (02:13 +0000)]
[analyzer] Revert the functional part of r155944.

The change resulted in multiple issues on the buildbot, so it's not
ready for prime time. Only enable history tracking for tainted
data(which is experimental) for now.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156049 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoMerge x86-64-abi-sret-vs-2word-struct-param.cpp into the generic
John McCall [Thu, 3 May 2012 01:34:46 +0000 (01:34 +0000)]
Merge x86-64-abi-sret-vs-2word-struct-param.cpp into the generic
x86_64-arguments.cpp test file and be sure to test the coerced
case as well.  Thanks to Wei-Ren Chen for bringing this test
to my attention.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156047 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix a note without a SourceLocation.
Richard Trieu [Thu, 3 May 2012 01:09:59 +0000 (01:09 +0000)]
Fix a note without a SourceLocation.

#define TEST int y; int x = y;
void foo() {
  TEST
}

-Wuninitialized gives this warning:
invalid-loc.cc:4:3: warning: variable 'y' is uninitialized when used here
      [-Wuninitialized]
  TEST
  ^~~~
invalid-loc.cc:2:29: note: expanded from macro 'TEST'
#define TEST int y; int x = y;
                            ^
note: initialize the variable 'y' to silence this warning
1 warning generated.

The second note lacks filename, line number, and code snippet.  This change
will remove the fixit and only point to variable declaration.

invalid-loc.cc:4:3: warning: variable 'y' is uninitialized when used here
      [-Wuninitialized]
  TEST
  ^~~~
invalid-loc.cc:2:29: note: expanded from macro 'TEST'
#define TEST int y; int x = y;
                            ^
invalid-loc.cc:4:3: note: variable 'y' is declared here
  TEST
  ^
invalid-loc.cc:2:14: note: expanded from macro 'TEST'
#define TEST int y; int x = y;
             ^
1 warning generated.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156045 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoIn StringLiteralParser::init(), fail gracefully if the string is
Argyrios Kyrtzidis [Thu, 3 May 2012 01:01:56 +0000 (01:01 +0000)]
In StringLiteralParser::init(), fail gracefully if the string is
not as we expect; it may be due to racing issue of a file coming from PCH
changing after the PCH is loaded.

rdar://11353109

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156043 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agomodern objective-c translator: Fix destructor def.
Fariborz Jahanian [Wed, 2 May 2012 23:53:46 +0000 (23:53 +0000)]
modern objective-c translator: Fix destructor def.
for __NSContainer_literal.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156035 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd commas to for loop warning to separate variable names.
Richard Trieu [Wed, 2 May 2012 22:48:45 +0000 (22:48 +0000)]
Add commas to for loop warning to separate variable names.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156033 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRevert most of r154844, which was disabled in r155975. Keep around the
Richard Smith [Wed, 2 May 2012 22:22:32 +0000 (22:22 +0000)]
Revert most of r154844, which was disabled in r155975. Keep around the
refactorings in that revision, and some of the subsequent bugfixes, which
seem to be relevant even without delayed exception specification parsing.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156031 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoThread safety analysis: additional support for smart pointers in lock expressions.
DeLesley Hutchins [Wed, 2 May 2012 22:18:42 +0000 (22:18 +0000)]
Thread safety analysis: additional support for smart pointers in lock expressions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156030 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix some doxycomments using \class instead of \brief.
David Blaikie [Wed, 2 May 2012 21:58:03 +0000 (21:58 +0000)]
Fix some doxycomments using \class instead of \brief.

Patches by Csaba Raduly (rcsaba@gmail.com)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156027 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[python] Add testcase for annotation cursor
Anders Waldenborg [Wed, 2 May 2012 21:28:34 +0000 (21:28 +0000)]
[python] Add testcase for annotation cursor

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156022 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[python] Add Cursor.enum_value wrapping clang_getEnumConstantDeclValue
Anders Waldenborg [Wed, 2 May 2012 20:57:33 +0000 (20:57 +0000)]
[python] Add Cursor.enum_value wrapping clang_getEnumConstantDeclValue

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156017 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoWalk the decls looking for the last one that has an attribute. We do have to walk
Rafael Espindola [Wed, 2 May 2012 20:36:57 +0000 (20:36 +0000)]
Walk the decls looking for the last one that has an attribute. We do have to walk
them, otherwise we cannot produce an error for both

struct HIDDEN test4; // canonical
struct test4;
struct DEFAULT test4;

and

struct test5; // canonical
struct HIDDEN test5;
struct DEFAULT test5;

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156016 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[python] Add testcase for enum with specified underlaying type
Anders Waldenborg [Wed, 2 May 2012 19:39:46 +0000 (19:39 +0000)]
[python] Add testcase for enum with specified underlaying type

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156009 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[python] Run tests for c++ with std=c++11
Anders Waldenborg [Wed, 2 May 2012 19:37:16 +0000 (19:37 +0000)]
[python] Run tests for c++ with std=c++11

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156008 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[python] Fix warning in c-code inside testcase
Anders Waldenborg [Wed, 2 May 2012 19:35:37 +0000 (19:35 +0000)]
[python] Fix warning in c-code inside testcase

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156007 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoThread Safety Analysis: fixed attribute handling for lock_returned attribute.
DeLesley Hutchins [Wed, 2 May 2012 17:38:37 +0000 (17:38 +0000)]
Thread Safety Analysis: fixed attribute handling for lock_returned attribute.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156005 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoModern objective-c translation: Fixing couple of bugs
Fariborz Jahanian [Wed, 2 May 2012 17:34:59 +0000 (17:34 +0000)]
Modern objective-c translation: Fixing couple of bugs
related to laying out ivar structs and accessing non-fragile-ivar
in more compilated cases. // rdar://11323187

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156004 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoReplace the StringSwitch in AttributeList::getKind() with a
Douglas Gregor [Wed, 2 May 2012 17:33:51 +0000 (17:33 +0000)]
Replace the StringSwitch in AttributeList::getKind() with a
TableGen-generated StringMatcher, for a 1.2% speedup in -fparse-only
time in <rdar://problem/11004361>. Thanks to Benjamin for pointing me
at StringMatcher!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156003 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoIntroduce the notion of 'ignored' attributes, so that all attributes
Douglas Gregor [Wed, 2 May 2012 16:18:45 +0000 (16:18 +0000)]
Introduce the notion of 'ignored' attributes, so that all attributes
we accept are not modeled somehow via Attr.td.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155998 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoIntroduce the notion of an attribute that has no direct representation
Douglas Gregor [Wed, 2 May 2012 15:56:52 +0000 (15:56 +0000)]
Introduce the notion of an attribute that has no direct representation
as an AST node, and fold a number of such attributes into Attr.td.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155995 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix same line doxycomments so they comment the adjacent field.
David Blaikie [Wed, 2 May 2012 15:24:47 +0000 (15:24 +0000)]
Fix same line doxycomments so they comment the adjacent field.

Without the '<' prefix in the doxycomment these comments were incorrectly
attached to the proceeding comment on the next line, rather than the
preceeding one.

Fixes PR12722

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155993 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoImplement the alternate spellings of attributes aligned (as "align")
Douglas Gregor [Wed, 2 May 2012 15:16:13 +0000 (15:16 +0000)]
Implement the alternate spellings of attributes aligned (as "align")
and const (as "__const") using tblgen, rather than explicitly hacking
them in.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155991 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoDriver: Turn the default value for -fmath-errno into a proper target hook and disable...
Benjamin Kramer [Wed, 2 May 2012 14:55:48 +0000 (14:55 +0000)]
Driver: Turn the default value for -fmath-errno into a proper target hook and disable it by default on more platforms.

For now -fno-math-errno is the default on BSD-derived platforms (Darwin,
DragonFlyBSD, FreeBSD, NetBSD, OpenBSD). If the default is not right for
your platform, please yell. I only verified the result with the default
compilers on Darwin and FreeBSD.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155990 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRevert my optimization to AttributeList::getKind() in r155987;
Douglas Gregor [Wed, 2 May 2012 14:50:50 +0000 (14:50 +0000)]
Revert my optimization to AttributeList::getKind() in r155987;
Benjamin has suggested a better approach.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155989 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoReplace a ConsumeAnyToken() call with ConsumeToken() when we know
Douglas Gregor [Wed, 2 May 2012 14:34:16 +0000 (14:34 +0000)]
Replace a ConsumeAnyToken() call with ConsumeToken() when we know
we're looking at a normal token. Tiny positive impact -fsyntax-only
time for <rdar://problem/11004361>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155988 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoReplace the StringSwitch in AttributeList::getKind(const
Douglas Gregor [Wed, 2 May 2012 14:24:30 +0000 (14:24 +0000)]
Replace the StringSwitch in AttributeList::getKind(const
IdentifierInfo *) with a static StringMap, improving -fsyntax-only
performance by 1% for the example in <rdar://problem/11004361>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155987 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix forwarding of -fpack-struct from driver to CC1, and add a test.
James Molloy [Wed, 2 May 2012 07:56:14 +0000 (07:56 +0000)]
Fix forwarding of -fpack-struct from driver to CC1, and add a test.

-fpack-struct's handling has changed in CC1 (one of only two flags that needed changing) because the driver treats "-fpack-struct" as a boolean flag, and CC1 (did) treat it as an option with a separated value.

This change causes -fpack-struct=X to be forwarded correctly to -fpack-struct=X instead of erroneously to "-fpack-struct X"

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155981 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoDon't try to instantiate std::list at an incomplete type; it's not
John McCall [Wed, 2 May 2012 05:44:20 +0000 (05:44 +0000)]
Don't try to instantiate std::list at an incomplete type;  it's not
allowed, and it'll blow up in unfortunate ways when using a proper
C++11 library.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155980 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix cmake. Remaining two ClangCC1Options deps.
Andrew Trick [Wed, 2 May 2012 05:31:31 +0000 (05:31 +0000)]
Fix cmake. Remaining two ClangCC1Options deps.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155977 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoDisable our non-standard delayed parsing of exception specifications. Delaying
Richard Smith [Wed, 2 May 2012 01:29:43 +0000 (01:29 +0000)]
Disable our non-standard delayed parsing of exception specifications. Delaying
the parsing of such things appears to be a conforming extension, but it breaks
libstdc++4.7's std::pair.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155975 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoSpeculatively fix windows cmake builders.
Andrew Trick [Wed, 2 May 2012 01:23:51 +0000 (01:23 +0000)]
Speculatively fix windows cmake builders.

Really just a wild stab in the dark.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155974 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRefine analyzer diagnostics by adding an expression "cone-of-influence" to reverse...
Ted Kremenek [Wed, 2 May 2012 00:31:29 +0000 (00:31 +0000)]
Refine analyzer diagnostics by adding an expression "cone-of-influence" to reverse track interesting
values through interesting expressions.  This allows us to map from interesting values in a caller
to interesting values in a caller, thus recovering some precision in diagnostics lost from IPA.

Fixes <rdar://problem/11327497>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155971 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoUnrevert r155951, reverted in r155962, with two changes:
Richard Smith [Wed, 2 May 2012 00:30:48 +0000 (00:30 +0000)]
Unrevert r155951, reverted in r155962, with two changes:
 * Work around build failures due to gcc 4.2 bugs.
 * Remove BodyIndexer::TraverseCXXOperatorCallExpr, which was not being called
   prior to this change, and whose presence disables a RecursiveASTVisitor
   stack space optimization after this change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155969 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] RetainRelease: Self assignment should not suppress a leak
Anna Zaks [Wed, 2 May 2012 00:15:40 +0000 (00:15 +0000)]
[analyzer] RetainRelease: Self assignment should not suppress a leak
warning.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155966 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoTry harder to recognize hidden tag type names in potential declarations instead
Kaelyn Uhrain [Wed, 2 May 2012 00:11:40 +0000 (00:11 +0000)]
Try harder to recognize hidden tag type names in potential declarations instead
of giving unhelpful errors about undeclared identifers and missing semicolons.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155965 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] Fix an assertion failure triggered by the analyzer buildbot.
Anna Zaks [Wed, 2 May 2012 00:05:23 +0000 (00:05 +0000)]
[analyzer] Fix an assertion failure triggered by the analyzer buildbot.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155964 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] Fix the 'ptr = ptr' false negative in the Malloc checker.
Anna Zaks [Wed, 2 May 2012 00:05:20 +0000 (00:05 +0000)]
[analyzer] Fix the 'ptr = ptr' false negative in the Malloc checker.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155963 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRevert "Fix RecursiveASTVisitor's data recursion to call the Traverse* functions...
Andrew Trick [Tue, 1 May 2012 23:47:36 +0000 (23:47 +0000)]
Revert "Fix RecursiveASTVisitor's data recursion to call the Traverse* functions if they"

FAIL: Clang :: Index/index-many-call-ops.cpp

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155962 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoEliminate Sema::CompareMethodParamsInBaseAndSuper() entirely, by
Douglas Gregor [Tue, 1 May 2012 23:37:00 +0000 (23:37 +0000)]
Eliminate Sema::CompareMethodParamsInBaseAndSuper() entirely, by
folding its one check into the normal path for checking overridden
Objective-C methods. Good for another 3.6% speedup on the test case in
<rdar://problem/11004361>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155961 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoThe semantic checking that verifies whether an Objective-C method
Douglas Gregor [Tue, 1 May 2012 23:07:34 +0000 (23:07 +0000)]
The semantic checking that verifies whether an Objective-C method
declared in a subclass has consistent parameter types with a method
having the same selector in a superclass performs a significant number
of lookups into the class hierarchy. In the example in
<rdar://problem/11004361>, we spend 4.7% of -fsyntax-only time in
these lookups.

Optimize away most of the calls to this routine
(Sema::CompareMethodParamsInBaseAndSuper) by first checking whether we
have ever seen *any* method with that selector (using the global
selector table). Since most selectors are unique, we can avoid the
cost of this name lookup in many cases, for a 3.3% speedup.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155958 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd a missing RequireCompleteType call when synthesizing properties. <rdar://problem...
Eli Friedman [Tue, 1 May 2012 22:26:06 +0000 (22:26 +0000)]
Add a missing RequireCompleteType call when synthesizing properties.  <rdar://problem/11333367>.

While I'm here, fix source locations for other diagnostics related to property synthesis.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155953 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoUtilize getLocStart()/getLocEnd() on my recent change.
Argyrios Kyrtzidis [Tue, 1 May 2012 22:19:11 +0000 (22:19 +0000)]
Utilize getLocStart()/getLocEnd() on my recent change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155952 91177308-0d34-0410-b5e6-96231b3b80d8