]> granicus.if.org Git - clang/log
clang
12 years agoChange AnalyzerOptions::mayInlineCXXMemberFunction to default populate
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

12 years ago[Doc parsing]: Add available and deprecated attribute info
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

12 years ago[ms-inline asm] Enhance the isSimpleMSAsm() function to handle operands with pointer...
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

12 years agoFix test for r165028. It only generates that flag for source files now.
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

12 years agoDuring LTO, we call 'dsymutil' when we compile source files. This necessitates
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

12 years agoConvert to FileCheck.
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

12 years agoNo need to call the InitializeAll* functions.
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

12 years agoFP_CONTRACT: Fix two tests for -Asserts.
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

12 years ago[libclang] When indexing an AST file, only deserialize the preprocessing record
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

12 years agoAdd info in the preprocessing record whether an inclusion directive
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

12 years ago[libclang] Even though we disable the preprocessing record during indexing,
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

12 years ago[libclang] Implement the importedASTFile indexing callback to provide
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

12 years agoSplitting this test case into two because the behavior for the calling convention...
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

12 years agoAllowing individual targets to determine whether a given calling convention is allowe...
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

12 years agoSilencing an MSVC warning about */ being found outside of a comment.
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

12 years agoAdd redecls into their lexical DeclContext: this is what they assert on, and the...
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

12 years agoEnable programmatic provisioning of virtual module.map files (instead of writing...
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

12 years agoOnly those InterestingDecls that got added to the AST should be passed to the ASTCons...
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

12 years ago-arch is a darwin-specific driver feature, use a triple instead in rewriter test.
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

12 years agoForce triple in test to unbreak it on non-darwin platforms.
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

12 years agoMerge pending instantiations instead of overwriting existing ones.
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

12 years agoUse an environment variable instead of what's in the make cmd goals.
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

12 years agoTweak diagnostic text to indicate that __weak on a local variable is only allowed
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

12 years agoAdd FP_CONTRACT support for clang.
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

12 years agoCheck if an IdentifierInfo* is null when the FunctionDecl isn't a simple C function.
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

12 years agoRe-enable this test to reflect re-enabling the new SROA pass.
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

12 years ago-Wformat: Don't check format strings in uninstantiated templates.
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

12 years agoclang/test/Index: Fix two tests. Both %S and %t are expanded to absolute paths.
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

12 years ago[ms-inline asm] Use the convertToMapAndConstraints() function in the front-end.
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

12 years ago[clang-tests] Changed relative paths to absolute paths in run command for annotate...
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

12 years agoModern translator test. Breakup test into two and
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

12 years agoRename a test I just added.
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

12 years agoobjective-C modern translator. Test for producing both
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

12 years agoFix treatment of case which came up on std-proposals@: 'void' is permitted in core...
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

12 years agoPR13978: A 'decltype' DeclSpec has an expression representation, not a type
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

12 years agoMove isObjCSelf into Expr.
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

12 years ago[analyzer] Address Jordan's review for r164868.
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

12 years agoAdd xml test for availability to comment-xml-schema.c
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

12 years ago[analyzer] Allow ObjC ivar lvalues where the base is nil.
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

12 years ago[analyzer] Add a test for PR13927 "offsetof replacement flagged as null deref"
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

12 years agoRevert "[analyzer] Check that a member expr is valid even when the result is an lvalue."
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

12 years agoavailability in structured documents. Takes
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

12 years agoHave AnalyzerOptions::getBooleanOption() stick the matching config
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

12 years agoAdd checker debug.ConfigDumper to dump the contents of the configuration table.
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

12 years agoReapply "[analyzer] Handle inlined constructors for rvalue temporaries correctly."
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

12 years agoCleaning up the self initialization checker.
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

12 years ago[analyzer] Make ProgramStateManager's SubEngine parameter optional.
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

12 years agoFix ASTMatchersTests in configurations where
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

12 years agoAdd matchers for selected C++11 features.
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

12 years agoThe Redeclarable part of named decls is read before their name.
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

12 years agoAlso merge template redeclarations.
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

12 years agoMark two Clang tests as passing on ARM
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

12 years agofix test/CodeGen/tbaa-for-vptr.cpp: don't hardcode the index of metadata
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

12 years agoBring ASTReader and Writer into sync for the case where a canonical template speciali...
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

12 years agoCodeGen: Copy tail padding when we're not dealing with a trivial copy assign or move...
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

12 years agoFilter out tools and unittests which we don't want to build when we're building clang...
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

12 years agoRemove this hack in favor of another, better way of performing the same thing.
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

12 years agoSpecify a full target in an attempt to appease buildbots.
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

12 years agoAdd Clang support for iOS6.
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

12 years agoAdd ARM VFPv4 feature and enable it by default for Swift.
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

12 years agoAdd armv7s and some other arm variants supported by Mach-O files.
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

12 years agoAdd an FMA intrinsic for ARM Neon.
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

12 years agoWhitespace.
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

12 years agoFix refersToDeclaration()-matcher and add missing test case. This was
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

12 years agoMove the 'find macro by spelling' infrastructure to the Preprocessor class and
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

12 years agoComment XML schema: correct indentation.
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

12 years agoclang/test/CodeGen/tbaa-struct.cpp: Fix. Be aware of 32 bit pointer.
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

12 years agoRevert "[analyzer] Create a temporary region for rvalue structs when accessing fields"
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

12 years agoRevert "[analyzer] Create a temp region when a method is called on a struct rvalue."
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

12 years agoRevert "[analyzer] Handle inlined constructors for rvalue temporaries correctly."
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

12 years agoFor PPCallbacks::InclusionDirective() add a parameter for the module, whenever
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

12 years agoIn the Module class, add a reference to the corresponding AST file.
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

12 years agoAdd an assertion to make sure the implicitly imported module
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

12 years ago[analyzer] Do not visit ObjCMethodDecl twice in the AST checkers.
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

12 years ago[analyzer] Re-implement IvarInvalidationChecker so that it verifies that
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

12 years agoPR13941: Mark all virtual functions as unnamed_addr. It's not possible to
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

12 years agoUse a custom DenseMapInfo for WeakObjectProfileTy.
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

12 years ago[Doc parsing] Add availability information to generated Comment XML.
Fariborz Jahanian [Fri, 28 Sep 2012 22:35:49 +0000 (22:35 +0000)]
[Doc parsing] Add availability information to generated Comment XML.
(I still need to add a test once I figure it out).
Reviewed off-line by Doug. // rdar://12378879

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

12 years agoFix buildbots by not using a template from another namespace.
Jordan Rose [Fri, 28 Sep 2012 22:29:02 +0000 (22:29 +0000)]
Fix buildbots by not using a template from another namespace.

No need to specialize BeforeThanCompare for a comparator that's only
going to be used once.

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

12 years agoCompatibility macro detection for the -Wimplicit-fallthrough diagnostic.
Alexander Kornienko [Fri, 28 Sep 2012 22:24:03 +0000 (22:24 +0000)]
Compatibility macro detection for the -Wimplicit-fallthrough diagnostic.

Summary:
When issuing a diagnostic message for the -Wimplicit-fallthrough diagnostics, always try to find the latest macro, defined at the point of fallthrough, which is immediately expanded to "[[clang::fallthrough]]", and use it's name instead of the actual sequence.

Known issues:
  * uses PP.getSpelling() to compare macro definition with a string (anyone can suggest a convenient way to fill a token array, or maybe lex it in runtime?);
  * this can be generalized and used in other similar cases, any ideas where it should reside then?

Reviewers: doug.gregor, rsmith

Reviewed By: rsmith

CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D50

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

12 years ago-Wreceiver-is-weak: rephrase warning text and add a suggestion Note.
Jordan Rose [Fri, 28 Sep 2012 22:21:42 +0000 (22:21 +0000)]
-Wreceiver-is-weak: rephrase warning text and add a suggestion Note.

New output:
  warning: weak property may be unpredictably set to nil
  note: property declared here
  note: assign the value to a strong variable to keep the object alive
        during use

<rdar://problem/12277204>

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

12 years agoPull ScopeInfo implementation into its own file.
Jordan Rose [Fri, 28 Sep 2012 22:21:39 +0000 (22:21 +0000)]
Pull ScopeInfo implementation into its own file.

The infrastructure for -Warc-repeated-use-of-weak got a little too heavy
to leave sitting at the top of Sema.cpp.

No functionality change.

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

12 years ago-Warc-repeated-use-of-weak: check ivars and variables as well.
Jordan Rose [Fri, 28 Sep 2012 22:21:35 +0000 (22:21 +0000)]
-Warc-repeated-use-of-weak: check ivars and variables as well.

Like properties, loading from a weak ivar twice in the same function can
give you inconsistent results if the object is deallocated between the
two loads. It is safer to assign to a strong local variable and use that.

Second half of <rdar://problem/12280249>.

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

12 years agoAdd a warning (off by default) for repeated use of the same weak property.
Jordan Rose [Fri, 28 Sep 2012 22:21:30 +0000 (22:21 +0000)]
Add a warning (off by default) for repeated use of the same weak property.

The motivating example:

if (self.weakProp)
  use(self.weakProp);

As with any non-atomic test-then-use, it is possible a weak property to be
non-nil at the 'if', but be deallocated by the time it is used. The correct
way to write this example is as follows:

id tmp = self.weakProp;
if (tmp)
  use(tmp);

The warning is controlled by -Warc-repeated-use-of-receiver, and uses the
property name and base to determine if the same property on the same object
is being accessed multiple times. In cases where the base is more
complicated than just a single Decl (e.g. 'foo.bar.weakProp'), it picks a
Decl for some degree of uniquing and reports the problem under a subflag,
-Warc-maybe-repeated-use-of-receiver. This gives a way to tune the
aggressiveness of the warning for a particular project.

The warning is not on by default because it is not flow-sensitive and thus
may have a higher-than-acceptable rate of false positives, though it is
less noisy than -Wreceiver-is-weak. On the other hand, it will not warn
about some cases that may be legitimate issues that -Wreceiver-is-weak
will catch, and it does not attempt to reason about methods returning weak
values.

Even though this is not a real "analysis-based" check I've put the bug
emission code in AnalysisBasedWarnings for two reasons: (1) to run on
every kind of code body (function, method, block, or lambda), and (2) to
suggest that it may be enhanced by flow-sensitive analysis in the future.

The second (smaller) half of this work is to extend it to weak locals
and weak ivars. This should use most of the same infrastructure.

Part of <rdar://problem/12280249>

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

12 years agoAdd basic support for adding !tbaa.struct metadata on llvm.memcpy calls for
Dan Gohman [Fri, 28 Sep 2012 21:58:29 +0000 (21:58 +0000)]
Add basic support for adding !tbaa.struct metadata on llvm.memcpy calls for
struct assignment.

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

12 years agoWhen processing an InitListExpr and skipping the initialization of an invalid
Richard Smith [Fri, 28 Sep 2012 21:23:50 +0000 (21:23 +0000)]
When processing an InitListExpr and skipping the initialization of an invalid
record, skip at least one element from the InitListExpr to avoid an infinite
loop if we're initializing an array of unknown bound.

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

12 years agoUpdate template type diffing to handle qualifiers. Differing qualifiers will
Richard Trieu [Fri, 28 Sep 2012 20:32:51 +0000 (20:32 +0000)]
Update template type diffing to handle qualifiers.  Differing qualifiers will
now be printed with highlighting.

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

12 years agoAllow __builtin_bswap32/64 in constant expressions, like gcc does. Patch by Tijl...
Richard Smith [Fri, 28 Sep 2012 20:20:52 +0000 (20:20 +0000)]
Allow __builtin_bswap32/64 in constant expressions, like gcc does. Patch by Tijl Coosemans!

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

12 years agoClean up part of template type diffing. Moved repeated code to separate
Richard Trieu [Fri, 28 Sep 2012 19:51:57 +0000 (19:51 +0000)]
Clean up part of template type diffing.  Moved repeated code to separate
functions.  Reworked one of the conditionals.  No functional changes.

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

12 years agoModern objcective-C translator. When doing rewriting, Do not
Fariborz Jahanian [Fri, 28 Sep 2012 19:05:17 +0000 (19:05 +0000)]
Modern objcective-C translator. When doing rewriting, Do not
use the integrated pre-processor, preprocess in objective-c++ mode.
// rdar://12189793.

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

12 years ago[analyzer] Handle inlined constructors for rvalue temporaries correctly.
Jordan Rose [Fri, 28 Sep 2012 17:15:25 +0000 (17:15 +0000)]
[analyzer] Handle inlined constructors for rvalue temporaries correctly.

Previously the analyzer treated all inlined constructors like lvalues,
setting the value of the CXXConstructExpr to the newly-constructed
region. However, some CXXConstructExprs behave like rvalues -- in
particular, the implicit copy constructor into a pass-by-value argument.
In this case, we want only the /contents/ of a temporary object to be
passed, so that we can use the same "copy each argument into the
parameter region" algorithm that we use for scalar arguments.

This may change when we start modeling destructors of temporaries,
but for now this is the last part of <rdar://problem/12137950>.

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

12 years ago[analyzer] Create a temp region when a method is called on a struct rvalue.
Jordan Rose [Fri, 28 Sep 2012 17:15:21 +0000 (17:15 +0000)]
[analyzer] Create a temp region when a method is called on a struct rvalue.

An rvalue has no address, but calling a C++ member function requires a
'this' pointer. This commit makes the analyzer create a temporary region
in which to store the struct rvalue and use as a 'this' pointer whenever
a member function is called on an rvalue, which is essentially what
CodeGen does.

More of <rdar://problem/12137950>. The last part is tracking down the
C++ FIXME in array-struct-region.cpp.

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

12 years ago[analyzer] Create a temporary region for rvalue structs when accessing fields
Jordan Rose [Fri, 28 Sep 2012 17:15:12 +0000 (17:15 +0000)]
[analyzer] Create a temporary region for rvalue structs when accessing fields

Struct rvalues are represented in the analyzer by CompoundVals,
LazyCompoundVals, or plain ConjuredSymbols -- none of which have associated
regions. If the entire structure is going to persist, this is not a
problem -- either the rvalue will be assigned to an existing region, or
a MaterializeTemporaryExpr will be present to create a temporary region.
However, if we just need a field from the struct, we need to create the
temporary region ourselves.

This is inspired by the way CodeGen handles calls to temporaries;
support for that in the analyzer is coming next.

Part of <rdar://problem/12137950>

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

12 years agoAvoid malloc thrashing in the uninitialized value analysis.
Benjamin Kramer [Fri, 28 Sep 2012 16:44:29 +0000 (16:44 +0000)]
Avoid malloc thrashing in the uninitialized value analysis.

- The size of the packed vector is often small, save mallocs using SmallBitVector.
- Copying SmallBitVectors is also cheap, remove a level of indirection.

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

12 years agoSet Diag.ErrorOccurred even if a DiagnosticConsumer does not want it in
Daniel Jasper [Fri, 28 Sep 2012 15:45:07 +0000 (15:45 +0000)]
Set Diag.ErrorOccurred even if a DiagnosticConsumer does not want it in
diagnostic count.

If a DiagnosticConsumer sub-class overwrites IncludeInDiagnosticCounts,
this should change diagnostic counts. However, it currently also
influences Diag.ErrorOccurred, which in turn influences the behavior of
parsing and semantic analysis (in a way that can make it crash).

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

12 years agoFix a regression from r164656.
Eli Friedman [Thu, 27 Sep 2012 22:13:33 +0000 (22:13 +0000)]
Fix a regression from r164656.

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

12 years ago[analyzer] Address Jordan's code review for r164790.
Anna Zaks [Thu, 27 Sep 2012 21:57:17 +0000 (21:57 +0000)]
[analyzer] Address Jordan's code review for r164790.

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

12 years ago[analyzer] IvarInvalidation: track synthesized ivars and allow escape
Anna Zaks [Thu, 27 Sep 2012 21:57:14 +0000 (21:57 +0000)]
[analyzer] IvarInvalidation: track synthesized ivars and allow escape
through property getters.

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

12 years agoUnbreak cmake build
Anna Zaks [Thu, 27 Sep 2012 20:32:46 +0000 (20:32 +0000)]
Unbreak cmake build
(fixup for r164790)

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

12 years ago[analyzer] Add an experimental ObjC direct ivar assignment checker.
Anna Zaks [Thu, 27 Sep 2012 19:45:15 +0000 (19:45 +0000)]
[analyzer] Add an experimental ObjC direct ivar assignment checker.

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