Nico Weber [Wed, 3 Oct 2012 06:12:27 +0000 (06:12 +0000)]
Replace a default: with an explicit list of cases. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165091
91177308-0d34-0410-b5e6-
96231b3b80d8
John McCall [Wed, 3 Oct 2012 04:57:59 +0000 (04:57 +0000)]
Update the block specification for some long-settled subleties.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165090
91177308-0d34-0410-b5e6-
96231b3b80d8
NAKAMURA Takumi [Wed, 3 Oct 2012 02:35:19 +0000 (02:35 +0000)]
InlineObjCInstanceMethod.m: Remove lines introduced in r165079. It broke some builds, on FreeBSD, Linux and Windows.
error: 'warning' diagnostics expected but not seen:
Line 94: types are incompatible
1 error generated.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165088
91177308-0d34-0410-b5e6-
96231b3b80d8
Argyrios Kyrtzidis [Wed, 3 Oct 2012 01:58:45 +0000 (01:58 +0000)]
[PCH] Fix serialization of an ImportDecl.
ImportDecl's module ID was not written out and the reader accepted as module ID
the serialized:
Record.push_back(!IdentifierLocs.empty());
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165087
91177308-0d34-0410-b5e6-
96231b3b80d8
Argyrios Kyrtzidis [Wed, 3 Oct 2012 01:58:42 +0000 (01:58 +0000)]
Set the file entry for a Module* that was created during deserialization
of a module file.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165086
91177308-0d34-0410-b5e6-
96231b3b80d8
Argyrios Kyrtzidis [Wed, 3 Oct 2012 01:58:39 +0000 (01:58 +0000)]
Add a FIXME.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165085
91177308-0d34-0410-b5e6-
96231b3b80d8
Argyrios Kyrtzidis [Wed, 3 Oct 2012 01:58:37 +0000 (01:58 +0000)]
Introduce ASTConsumer::HandleImplicitImportDecl() callback that is invoked
when an ImportDecl that was implicitly created due to an inclusion directive.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165084
91177308-0d34-0410-b5e6-
96231b3b80d8
Argyrios Kyrtzidis [Wed, 3 Oct 2012 01:58:28 +0000 (01:58 +0000)]
Some renames to use the 'visitor' nomenclature, no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165083
91177308-0d34-0410-b5e6-
96231b3b80d8
Michael Han [Wed, 3 Oct 2012 01:56:22 +0000 (01:56 +0000)]
Improve C++11 attribute parsing.
- General C++11 attributes were previously parsed and ignored. Now they are parsed and stored in AST.
- Add support to parse arguments of attributes that in 'gnu' namespace.
- Differentiate unknown attributes and known attributes that can't be applied to statements when emitting diagnostic.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165082
91177308-0d34-0410-b5e6-
96231b3b80d8
Jordan Rose [Wed, 3 Oct 2012 01:08:35 +0000 (01:08 +0000)]
[analyzer] Adjust the return type of an inlined devirtualized method call.
In C++, overriding virtual methods are allowed to specify a covariant
return type -- that is, if the return type of the base method is an
object pointer type (or reference type), the overriding method's return
type can be a pointer to a subclass of the original type. The analyzer
was failing to take this into account when devirtualizing a method call,
and anything that relied on the return value having the proper type later
would crash.
In Objective-C, overriding methods are allowed to specify ANY return type,
meaning we can NEVER be sure that devirtualizing will give us a "safe"
return value. Of course, a program that does this will most likely crash
at runtime, but the analyzer at least shouldn't crash.
The solution is to check and see if the function/method being inlined is
the function that static binding would have picked. If not, check that
the return value has the same type. If the types don't match, see if we
can fix it with a derived-to-base cast (the C++ case). If we can't,
return UnknownVal to avoid crashing later.
<rdar://problem/
12409977>
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165079
91177308-0d34-0410-b5e6-
96231b3b80d8
Jordan Rose [Wed, 3 Oct 2012 01:08:32 +0000 (01:08 +0000)]
[analyzer] Push evalDynamicCast and evalDerivedToBase up to Store.
These functions are store-agnostic, and would benefit from information in
DynamicTypeInfo but gain nothing from the store type.
No intended functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165078
91177308-0d34-0410-b5e6-
96231b3b80d8
Jordan Rose [Wed, 3 Oct 2012 01:08:28 +0000 (01:08 +0000)]
Teach getCXXRecordDeclForPointerType about references.
Then, rename it getPointeeCXXRecordDecl and give it a nice doc comment,
and actually use it.
No intended functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165077
91177308-0d34-0410-b5e6-
96231b3b80d8
Richard Trieu [Wed, 3 Oct 2012 00:41:36 +0000 (00:41 +0000)]
Change how the SelfReferenceChecker handles MemberExpr. Instead of treating
each one separately, process a stack of MemberExpr's as a single unit so that
static calls and member access will not be warned on.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165074
91177308-0d34-0410-b5e6-
96231b3b80d8
Chad Rosier [Tue, 2 Oct 2012 23:38:55 +0000 (23:38 +0000)]
Revert 165058, per Jim request. This requires further discussion.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165070
91177308-0d34-0410-b5e6-
96231b3b80d8
Alexander Kornienko [Tue, 2 Oct 2012 23:11:53 +0000 (23:11 +0000)]
Added a test for C++11 statement attributes serialization.
Summary: Uses [[clang::fallthrough]] attribute in a template function, and -Wimplicit-fallthrough to check the attribute presence in an instantiation.
Reviewers: rsmith
Reviewed By: rsmith
CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D55
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165068
91177308-0d34-0410-b5e6-
96231b3b80d8
Fariborz Jahanian [Tue, 2 Oct 2012 23:01:04 +0000 (23:01 +0000)]
[Doc parse]: SUpport for message in deprecated/unavailable
attribute going iinto XML document.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165066
91177308-0d34-0410-b5e6-
96231b3b80d8
Ted Kremenek [Tue, 2 Oct 2012 21:50:18 +0000 (21:50 +0000)]
Silence -Wunused-value warning.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165059
91177308-0d34-0410-b5e6-
96231b3b80d8
Chad Rosier [Tue, 2 Oct 2012 21:49:14 +0000 (21:49 +0000)]
[ms-inline asm] Rewrite the symbol references as wildcard MCParsedAsmOperands.
A Sema lookup is used to determine the size of the variable, which is in turn
used during wildcard matching.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165058
91177308-0d34-0410-b5e6-
96231b3b80d8
Argyrios Kyrtzidis [Tue, 2 Oct 2012 21:09:17 +0000 (21:09 +0000)]
[PCH/Module] Change the map of file-level DeclIDs to use a FileID
as key instead of a SLocEntry pointer. This allows the array of
file sorted declarations in a PCH/module to be deterministic.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165047
91177308-0d34-0410-b5e6-
96231b3b80d8
Argyrios Kyrtzidis [Tue, 2 Oct 2012 21:09:13 +0000 (21:09 +0000)]
[libclang] When indexing an AST file, only deserialize the file level
declarations of the current primary module.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165046
91177308-0d34-0410-b5e6-
96231b3b80d8
Chad Rosier [Tue, 2 Oct 2012 20:55:30 +0000 (20:55 +0000)]
[ms-inline asm] Fixup test case to be valid ms-style asm. Fix whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165045
91177308-0d34-0410-b5e6-
96231b3b80d8
Ted Kremenek [Tue, 2 Oct 2012 20:42:16 +0000 (20:42 +0000)]
Refactor clients of AnalyzerOptions::getBooleanOption() to have
an intermediate helper method to query and populate the Optional value.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165043
91177308-0d34-0410-b5e6-
96231b3b80d8
Ted Kremenek [Tue, 2 Oct 2012 20:31:56 +0000 (20:31 +0000)]
Tweak AnalyzerOptions::getOptionAsInteger() to populate the string
table, making it printable with the ConfigDump checker. Along the
way, fix a really serious bug where the value was getting parsed
from the string in code that was in an assert() call. This means
in a Release-Asserts build this code wouldn't work as expected.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165041
91177308-0d34-0410-b5e6-
96231b3b80d8
Ted Kremenek [Tue, 2 Oct 2012 20:31:52 +0000 (20:31 +0000)]
Change AnalyzerOptions::mayInlineCXXMemberFunction to default populate
the config string table. Also setup a test for dumping the analyzer
configuration for C++.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165040
91177308-0d34-0410-b5e6-
96231b3b80d8
Fariborz Jahanian [Tue, 2 Oct 2012 20:05:47 +0000 (20:05 +0000)]
[Doc parsing]: Add available and deprecated attribute info
to XML output. // rdar://
12378879
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165039
91177308-0d34-0410-b5e6-
96231b3b80d8
Chad Rosier [Tue, 2 Oct 2012 18:51:05 +0000 (18:51 +0000)]
[ms-inline asm] Enhance the isSimpleMSAsm() function to handle operands with pointer size
directives (e.g., dword ptr [eax]).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165031
91177308-0d34-0410-b5e6-
96231b3b80d8
Bill Wendling [Tue, 2 Oct 2012 18:07:59 +0000 (18:07 +0000)]
Fix test for r165028. It only generates that flag for source files now.
<rdar://problem/
12401423>
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165029
91177308-0d34-0410-b5e6-
96231b3b80d8
Bill Wendling [Tue, 2 Oct 2012 18:02:50 +0000 (18:02 +0000)]
During LTO, we call 'dsymutil' when we compile source files. This necessitates
clang specifying a temporary file that it later cleans up so that it can survive
the linking stage. However, when we compile object files during LTO we don't
call 'dsymutil'. That's done at a different stage (if at all). We rely upon the
linker to specify a unique name for the temporary file it generates.
<rdar://problem/
12401423>
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165028
91177308-0d34-0410-b5e6-
96231b3b80d8
Rafael Espindola [Tue, 2 Oct 2012 17:41:03 +0000 (17:41 +0000)]
Convert to FileCheck.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165026
91177308-0d34-0410-b5e6-
96231b3b80d8
Chad Rosier [Tue, 2 Oct 2012 16:41:12 +0000 (16:41 +0000)]
No need to call the InitializeAll* functions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165025
91177308-0d34-0410-b5e6-
96231b3b80d8
NAKAMURA Takumi [Tue, 2 Oct 2012 16:36:54 +0000 (16:36 +0000)]
FP_CONTRACT: Fix two tests for -Asserts.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165024
91177308-0d34-0410-b5e6-
96231b3b80d8
Argyrios Kyrtzidis [Tue, 2 Oct 2012 16:10:51 +0000 (16:10 +0000)]
[libclang] When indexing an AST file, only deserialize the preprocessing record
entities of the current primary module.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165023
91177308-0d34-0410-b5e6-
96231b3b80d8
Argyrios Kyrtzidis [Tue, 2 Oct 2012 16:10:46 +0000 (16:10 +0000)]
Add info in the preprocessing record whether an inclusion directive
resulted in an automatic module import.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165022
91177308-0d34-0410-b5e6-
96231b3b80d8
Argyrios Kyrtzidis [Tue, 2 Oct 2012 16:10:41 +0000 (16:10 +0000)]
[libclang] Even though we disable the preprocessing record during indexing,
make sure that it gets enabled for when a module needs to be created.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165021
91177308-0d34-0410-b5e6-
96231b3b80d8
Argyrios Kyrtzidis [Tue, 2 Oct 2012 16:10:38 +0000 (16:10 +0000)]
[libclang] Implement the importedASTFile indexing callback to provide
info about imported modules.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165020
91177308-0d34-0410-b5e6-
96231b3b80d8
Aaron Ballman [Tue, 2 Oct 2012 14:56:00 +0000 (14:56 +0000)]
Splitting this test case into two because the behavior for the calling convention code is target-specific.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165016
91177308-0d34-0410-b5e6-
96231b3b80d8
Aaron Ballman [Tue, 2 Oct 2012 14:26:08 +0000 (14:26 +0000)]
Allowing individual targets to determine whether a given calling convention is allowed or ignored with warning. This allows for correct name mangling for x64 targets on Windows, which in turn allows for linking against the Win32 APIs.
Fixes PR13782
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165015
91177308-0d34-0410-b5e6-
96231b3b80d8
Aaron Ballman [Tue, 2 Oct 2012 13:54:25 +0000 (13:54 +0000)]
Silencing an MSVC warning about */ being found outside of a comment.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165007
91177308-0d34-0410-b5e6-
96231b3b80d8
Axel Naumann [Tue, 2 Oct 2012 13:06:13 +0000 (13:06 +0000)]
Add redecls into their lexical DeclContext: this is what they assert on, and the merging should have set it correctly.
This is especially relevant for templatedDecls that might be injected (and thus have their DeclContext set to) somewhere completely different.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165005
91177308-0d34-0410-b5e6-
96231b3b80d8
Axel Naumann [Tue, 2 Oct 2012 12:26:36 +0000 (12:26 +0000)]
Enable programmatic provisioning of virtual module.map files (instead of writing out actual module.map files).
Opens up the wonders of clang::Modules to tools - though they remain as experimental as before.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165002
91177308-0d34-0410-b5e6-
96231b3b80d8
Axel Naumann [Tue, 2 Oct 2012 12:18:46 +0000 (12:18 +0000)]
Only those InterestingDecls that got added to the AST should be passed to the ASTConsumer.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165001
91177308-0d34-0410-b5e6-
96231b3b80d8
Benjamin Kramer [Tue, 2 Oct 2012 09:42:36 +0000 (09:42 +0000)]
-arch is a darwin-specific driver feature, use a triple instead in rewriter test.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164995
91177308-0d34-0410-b5e6-
96231b3b80d8
Benjamin Kramer [Tue, 2 Oct 2012 09:29:48 +0000 (09:29 +0000)]
Force triple in test to unbreak it on non-darwin platforms.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164994
91177308-0d34-0410-b5e6-
96231b3b80d8
Axel Naumann [Tue, 2 Oct 2012 09:09:43 +0000 (09:09 +0000)]
Merge pending instantiations instead of overwriting existing ones.
Check whether a pending instantiation needs to be instantiated (or whether an instantiation already exists).
Verify the size of the PendingInstantiations record (was only checking size of existing PendingInstantiations).
Migrate Obj-C++ part of redecl-merge into separate test, now that this is growing.
templates.mm: test that CodeGen has seen exactly one definition of template instantiations.
redecl-merge.m: use "@" specifier for expected-diagnostics.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164993
91177308-0d34-0410-b5e6-
96231b3b80d8
Bill Wendling [Tue, 2 Oct 2012 06:19:15 +0000 (06:19 +0000)]
Use an environment variable instead of what's in the make cmd goals.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164992
91177308-0d34-0410-b5e6-
96231b3b80d8
Ted Kremenek [Tue, 2 Oct 2012 05:36:02 +0000 (05:36 +0000)]
Tweak diagnostic text to indicate that __weak on a local variable is only allowed
for ARC. Fixes <rdar://problem/
12407705>
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164990
91177308-0d34-0410-b5e6-
96231b3b80d8
Lang Hames [Tue, 2 Oct 2012 04:45:10 +0000 (04:45 +0000)]
Add FP_CONTRACT support for clang.
Clang will now honor the FP_CONTRACT pragma and emit LLVM
fmuladd intrinsics for expressions of the form A * B + C (when they occur in a
single statement).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164989
91177308-0d34-0410-b5e6-
96231b3b80d8
Ted Kremenek [Tue, 2 Oct 2012 04:36:54 +0000 (04:36 +0000)]
Check if an IdentifierInfo* is null when the FunctionDecl isn't a simple C function.
Fixes <rdar://problem/
12355298>
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164988
91177308-0d34-0410-b5e6-
96231b3b80d8
Chandler Carruth [Tue, 2 Oct 2012 04:24:16 +0000 (04:24 +0000)]
Re-enable this test to reflect re-enabling the new SROA pass.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164987
91177308-0d34-0410-b5e6-
96231b3b80d8
Jordan Rose [Tue, 2 Oct 2012 01:49:54 +0000 (01:49 +0000)]
-Wformat: Don't check format strings in uninstantiated templates.
Also applies to -Wnonnull, -Wtype-safety, and -Wnon-pod-varargs.
All of these can be better checked at instantiation time.
This change does not actually affect regular CallExpr function calls,
since the checks there only happen after overload resolution.
However, it will affect Objective-C method calls.
<rdar://problem/
12373934>
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164984
91177308-0d34-0410-b5e6-
96231b3b80d8
NAKAMURA Takumi [Tue, 2 Oct 2012 00:11:53 +0000 (00:11 +0000)]
clang/test/Index: Fix two tests. Both %S and %t are expanded to absolute paths.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164982
91177308-0d34-0410-b5e6-
96231b3b80d8
Chad Rosier [Mon, 1 Oct 2012 23:45:59 +0000 (23:45 +0000)]
[ms-inline asm] Use the convertToMapAndConstraints() function in the front-end.
Rework the logic to account for the fact that we no longer create a MCInst.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164980
91177308-0d34-0410-b5e6-
96231b3b80d8
Michael Gottesman [Mon, 1 Oct 2012 23:39:44 +0000 (23:39 +0000)]
[clang-tests] Changed relative paths to absolute paths in run command for annotate-macro-args.m, get-cursor-macro-args.m, import_self.c.
This fixes make check-all failures when make -C is used to run the tests.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164978
91177308-0d34-0410-b5e6-
96231b3b80d8
Fariborz Jahanian [Mon, 1 Oct 2012 23:25:52 +0000 (23:25 +0000)]
Modern translator test. Breakup test into two and
skip the x86_64 version for mingw32 and win32.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164977
91177308-0d34-0410-b5e6-
96231b3b80d8
Fariborz Jahanian [Mon, 1 Oct 2012 21:21:50 +0000 (21:21 +0000)]
Rename a test I just added.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164971
91177308-0d34-0410-b5e6-
96231b3b80d8
Fariborz Jahanian [Mon, 1 Oct 2012 20:55:56 +0000 (20:55 +0000)]
objective-C modern translator. Test for producing both
32bit and 64bit version of modern translator.
// rdar://
12189793
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164970
91177308-0d34-0410-b5e6-
96231b3b80d8
Richard Smith [Mon, 1 Oct 2012 20:36:17 +0000 (20:36 +0000)]
Fix treatment of case which came up on std-proposals@: 'void' is permitted in core constant expressions, despite not being a literal type.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164968
91177308-0d34-0410-b5e6-
96231b3b80d8
Richard Smith [Mon, 1 Oct 2012 20:35:07 +0000 (20:35 +0000)]
PR13978: A 'decltype' DeclSpec has an expression representation, not a type
representation. Fix crash if it appears in the return type of a member function
definition.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164967
91177308-0d34-0410-b5e6-
96231b3b80d8
Anna Zaks [Mon, 1 Oct 2012 20:34:04 +0000 (20:34 +0000)]
Move isObjCSelf into Expr.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164966
91177308-0d34-0410-b5e6-
96231b3b80d8
Anna Zaks [Mon, 1 Oct 2012 20:33:58 +0000 (20:33 +0000)]
[analyzer] Address Jordan's review for r164868.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164965
91177308-0d34-0410-b5e6-
96231b3b80d8
Fariborz Jahanian [Mon, 1 Oct 2012 19:10:40 +0000 (19:10 +0000)]
Add xml test for availability to comment-xml-schema.c
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164961
91177308-0d34-0410-b5e6-
96231b3b80d8
Jordan Rose [Mon, 1 Oct 2012 19:07:22 +0000 (19:07 +0000)]
[analyzer] Allow ObjC ivar lvalues where the base is nil.
By analogy with C structs, this seems to be legal, if probably discouraged.
It's only if the ivar is read from or written to that there's a problem.
Running a program that gets the "address" of an instance variable does in
fact return the offset when the base "object" is nil.
This isn't a full revert because r164442 includes some diagnostic tweaks
as well; those have been kept.
This partially reverts r164442 /
08965091770c9b276c238bac2f716eaa4da2dca4.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164960
91177308-0d34-0410-b5e6-
96231b3b80d8
Jordan Rose [Mon, 1 Oct 2012 19:07:19 +0000 (19:07 +0000)]
[analyzer] Add a test for PR13927 "offsetof replacement flagged as null deref"
This seems to be legal according to C11 6.5.3.2.
No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164959
91177308-0d34-0410-b5e6-
96231b3b80d8
Jordan Rose [Mon, 1 Oct 2012 19:07:15 +0000 (19:07 +0000)]
Revert "[analyzer] Check that a member expr is valid even when the result is an lvalue."
The original intent of this commit was to catch potential null dereferences
early, but it breaks the common "home-grown offsetof" idiom (PR13927):
(((struct Foo *)0)->member - ((struct foo *)0))
As it turns out, this appears to be legal in C, per a footnote in
C11 6.5.3.2: "Thus, &*E is equivalent to E (even if E is a null pointer)".
In C++ this issue is still open:
http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#232
We'll just have to make sure we have good path notes in the future.
This reverts r164441 /
9be016dcd1ca3986873a7b66bd4bc027309ceb59.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164958
91177308-0d34-0410-b5e6-
96231b3b80d8
Fariborz Jahanian [Mon, 1 Oct 2012 18:42:25 +0000 (18:42 +0000)]
availability in structured documents. Takes
care of comments by Dimitri and Doug.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164957
91177308-0d34-0410-b5e6-
96231b3b80d8
Ted Kremenek [Mon, 1 Oct 2012 18:28:19 +0000 (18:28 +0000)]
Have AnalyzerOptions::getBooleanOption() stick the matching config
string in the config table so that it can be dumped as part of the
config dumper. Add a test to show that these options are sticking
and can be cross-checked using FileCheck.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164954
91177308-0d34-0410-b5e6-
96231b3b80d8
Ted Kremenek [Mon, 1 Oct 2012 18:28:14 +0000 (18:28 +0000)]
Add checker debug.ConfigDumper to dump the contents of the configuration table.
The format of this output is a WIP; largely I'm bringing it up now
for regression testing. We can evolve the output format over time.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164953
91177308-0d34-0410-b5e6-
96231b3b80d8
Jordan Rose [Mon, 1 Oct 2012 17:51:35 +0000 (17:51 +0000)]
Reapply "[analyzer] Handle inlined constructors for rvalue temporaries correctly."
This is related to but not blocked by <rdar://problem/
12137950>
("Return-by-value structs do not have associated regions")
This reverts r164875 /
3278d41e17749dbedb204a81ef373499f10251d7.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164952
91177308-0d34-0410-b5e6-
96231b3b80d8
Richard Trieu [Mon, 1 Oct 2012 17:39:51 +0000 (17:39 +0000)]
Cleaning up the self initialization checker.
-Allow Sema to do more processing on the initial Expr before checking it.
-Remove the special conditions in HandleExpr()
-Move the code so that only one call site is needed.
-Removed the function from Sema and only call it locally.
-Warn on potentially evaluated reference variables, not just casts to r-values.
-Update tests.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164951
91177308-0d34-0410-b5e6-
96231b3b80d8
Jordan Rose [Mon, 1 Oct 2012 16:53:40 +0000 (16:53 +0000)]
[analyzer] Make ProgramStateManager's SubEngine parameter optional.
It is possible and valid to have a state manager and associated objects
without having a SubEngine or checkers.
Patch by Olaf Krzikalla!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164947
91177308-0d34-0410-b5e6-
96231b3b80d8
Daniel Jasper [Mon, 1 Oct 2012 15:05:34 +0000 (15:05 +0000)]
Fix ASTMatchersTests in configurations where
"#include <initializer_list>" is unavailable for whatever reason.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164944
91177308-0d34-0410-b5e6-
96231b3b80d8
Daniel Jasper [Mon, 1 Oct 2012 13:40:41 +0000 (13:40 +0000)]
Add matchers for selected C++11 features.
Patch by Gábor Horváth.
Review: http://llvm-reviews.chandlerc.com/D46
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164943
91177308-0d34-0410-b5e6-
96231b3b80d8
Axel Naumann [Mon, 1 Oct 2012 09:51:27 +0000 (09:51 +0000)]
The Redeclarable part of named decls is read before their name.
Lookup can nevertheless find them due to the serialized lookup table.
For instance when reading a template decl's templatedDecl, it will search for existing decls that it could be a redeclaration of, and find the half-read template decl.
Thus there is no point in asserting the names of decls.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164932
91177308-0d34-0410-b5e6-
96231b3b80d8
Axel Naumann [Mon, 1 Oct 2012 09:18:00 +0000 (09:18 +0000)]
Also merge template redeclarations.
Don't require specializations (of existing and read template) to be unique.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164931
91177308-0d34-0410-b5e6-
96231b3b80d8
Nico Weber [Mon, 1 Oct 2012 08:44:54 +0000 (08:44 +0000)]
Mark two Clang tests as passing on ARM
Also move one of them from grep to FileCheck.
Patch from Joey Gouly <joey.gouly@arm.com>!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164929
91177308-0d34-0410-b5e6-
96231b3b80d8
Kostya Serebryany [Mon, 1 Oct 2012 08:39:00 +0000 (08:39 +0000)]
fix test/CodeGen/tbaa-for-vptr.cpp: don't hardcode the index of metadata
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164928
91177308-0d34-0410-b5e6-
96231b3b80d8
Axel Naumann [Mon, 1 Oct 2012 07:34:47 +0000 (07:34 +0000)]
Bring ASTReader and Writer into sync for the case where a canonical template specialization was written, which is non-canonical at the time of reading: force the reading of the ClassTemplateDecl if it was written.
The easiest way out is to store whether the decl was canonical at the time of writing.
Add test.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164927
91177308-0d34-0410-b5e6-
96231b3b80d8
Benjamin Kramer [Sun, 30 Sep 2012 12:43:37 +0000 (12:43 +0000)]
CodeGen: Copy tail padding when we're not dealing with a trivial copy assign or move assign operator.
This fixes a regression from r162254, the optimizer has problems reasoning
about the smaller memcpy as it's often not safe to widen a store but making it
smaller is.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164917
91177308-0d34-0410-b5e6-
96231b3b80d8
Bill Wendling [Sun, 30 Sep 2012 11:23:30 +0000 (11:23 +0000)]
Filter out tools and unittests which we don't want to build when we're building clang only.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164916
91177308-0d34-0410-b5e6-
96231b3b80d8
Bill Wendling [Sun, 30 Sep 2012 11:22:45 +0000 (11:22 +0000)]
Remove this hack in favor of another, better way of performing the same thing.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164915
91177308-0d34-0410-b5e6-
96231b3b80d8
Bob Wilson [Sun, 30 Sep 2012 00:58:28 +0000 (00:58 +0000)]
Specify a full target in an attempt to appease buildbots.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164908
91177308-0d34-0410-b5e6-
96231b3b80d8
Bob Wilson [Sat, 29 Sep 2012 23:52:58 +0000 (23:52 +0000)]
Add Clang support for iOS6.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164907
91177308-0d34-0410-b5e6-
96231b3b80d8
Bob Wilson [Sat, 29 Sep 2012 23:52:52 +0000 (23:52 +0000)]
Add ARM VFPv4 feature and enable it by default for Swift.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164906
91177308-0d34-0410-b5e6-
96231b3b80d8
Bob Wilson [Sat, 29 Sep 2012 23:52:50 +0000 (23:52 +0000)]
Add armv7s and some other arm variants supported by Mach-O files.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164905
91177308-0d34-0410-b5e6-
96231b3b80d8
Bob Wilson [Sat, 29 Sep 2012 23:52:48 +0000 (23:52 +0000)]
Add an FMA intrinsic for ARM Neon.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164904
91177308-0d34-0410-b5e6-
96231b3b80d8
Bob Wilson [Sat, 29 Sep 2012 22:08:54 +0000 (22:08 +0000)]
Whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164900
91177308-0d34-0410-b5e6-
96231b3b80d8
Daniel Jasper [Sat, 29 Sep 2012 15:55:18 +0000 (15:55 +0000)]
Fix refersToDeclaration()-matcher and add missing test case. This was
broken as of r164656 as TemplateArgument::getAsDecl() now asserts
instead of returning NULL for other template arugment kinds.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164896
91177308-0d34-0410-b5e6-
96231b3b80d8
Dmitri Gribenko [Sat, 29 Sep 2012 11:40:46 +0000 (11:40 +0000)]
Move the 'find macro by spelling' infrastructure to the Preprocessor class and
use it to suggest appropriate macro for __attribute__((deprecated)) in
-Wdocumentation-deprecated-sync.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164892
91177308-0d34-0410-b5e6-
96231b3b80d8
Dmitri Gribenko [Sat, 29 Sep 2012 08:27:37 +0000 (08:27 +0000)]
Comment XML schema: correct indentation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164889
91177308-0d34-0410-b5e6-
96231b3b80d8
NAKAMURA Takumi [Sat, 29 Sep 2012 02:00:04 +0000 (02:00 +0000)]
clang/test/CodeGen/tbaa-struct.cpp: Fix. Be aware of 32 bit pointer.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164879
91177308-0d34-0410-b5e6-
96231b3b80d8
Jordan Rose [Sat, 29 Sep 2012 01:36:51 +0000 (01:36 +0000)]
Revert "[analyzer] Create a temporary region for rvalue structs when accessing fields"
This reverts commit
6f61df3e7256413dcb99afb9673f4206e3c4992c.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164877
91177308-0d34-0410-b5e6-
96231b3b80d8
Jordan Rose [Sat, 29 Sep 2012 01:36:47 +0000 (01:36 +0000)]
Revert "[analyzer] Create a temp region when a method is called on a struct rvalue."
This reverts commit
0006ba445962621ed82ec84400a6b978205a3fbc.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164876
91177308-0d34-0410-b5e6-
96231b3b80d8
Jordan Rose [Sat, 29 Sep 2012 01:36:42 +0000 (01:36 +0000)]
Revert "[analyzer] Handle inlined constructors for rvalue temporaries correctly."
This reverts commit
580cd17f256259f39a382e967173f34d68e73859.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164875
91177308-0d34-0410-b5e6-
96231b3b80d8
Argyrios Kyrtzidis [Sat, 29 Sep 2012 01:06:10 +0000 (01:06 +0000)]
For PPCallbacks::InclusionDirective() add a parameter for the module, whenever
an inclusion directive was automatically turned into a module import, and
PPCallbacks::moduleImport() for an explicit module import.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164874
91177308-0d34-0410-b5e6-
96231b3b80d8
Argyrios Kyrtzidis [Sat, 29 Sep 2012 01:06:04 +0000 (01:06 +0000)]
In the Module class, add a reference to the corresponding AST file.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164873
91177308-0d34-0410-b5e6-
96231b3b80d8
Argyrios Kyrtzidis [Sat, 29 Sep 2012 01:06:01 +0000 (01:06 +0000)]
Add an assertion to make sure the implicitly imported module
is the same as the suggested one when looking up the include filename.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164872
91177308-0d34-0410-b5e6-
96231b3b80d8
Anna Zaks [Sat, 29 Sep 2012 00:20:40 +0000 (00:20 +0000)]
[analyzer] Do not visit ObjCMethodDecl twice in the AST checkers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164869
91177308-0d34-0410-b5e6-
96231b3b80d8
Anna Zaks [Sat, 29 Sep 2012 00:20:38 +0000 (00:20 +0000)]
[analyzer] Re-implement IvarInvalidationChecker so that it verifies that
the validation occurred.
The original implementation was pessimistic - we assumed that ivars
which escape are invalidated. This version is optimistic, it assumes
that the ivars will always be explicitly invalidated: either set to nil
or sent an invalidation message.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164868
91177308-0d34-0410-b5e6-
96231b3b80d8
Richard Smith [Fri, 28 Sep 2012 22:46:07 +0000 (22:46 +0000)]
PR13941: Mark all virtual functions as unnamed_addr. It's not possible to
observe their addresses (taking their address gives the vtable slot) so we are
free to merge their definitions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164864
91177308-0d34-0410-b5e6-
96231b3b80d8
Jordan Rose [Fri, 28 Sep 2012 22:42:04 +0000 (22:42 +0000)]
Use a custom DenseMapInfo for WeakObjectProfileTy.
We can't specialize the usual llvm::DenseMapInfo at the end of the file
because by that point the DenseMap in FunctionScopeInfo has already been
instantiated.
No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164862
91177308-0d34-0410-b5e6-
96231b3b80d8