]> granicus.if.org Git - clang/log
clang
12 years agoAdd missing cctype includes.
Joerg Sonnenberger [Fri, 10 Aug 2012 10:58:18 +0000 (10:58 +0000)]
Add missing cctype includes.

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

12 years agoDecrementing std::string::end is not portable, use array access instead.
Joerg Sonnenberger [Fri, 10 Aug 2012 10:57:52 +0000 (10:57 +0000)]
Decrementing std::string::end is not portable, use array access instead.

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

12 years agoFix a couple of pedantic gcc warnings.
Benjamin Kramer [Fri, 10 Aug 2012 10:06:13 +0000 (10:06 +0000)]
Fix a couple of pedantic gcc warnings.

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

12 years agoc-arcmt-test, c-index-test: Appease Cygwin, to link to libclang.a, not clang.dll.
NAKAMURA Takumi [Fri, 10 Aug 2012 06:10:58 +0000 (06:10 +0000)]
c-arcmt-test, c-index-test: Appease Cygwin, to link to libclang.a, not clang.dll.

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

12 years agoCheck access to friend declarations. There's a number of different
John McCall [Fri, 10 Aug 2012 03:15:35 +0000 (03:15 +0000)]
Check access to friend declarations.  There's a number of different
things going on here that were problematic:
  - We were missing the actual access check, or rather, it was suppressed
    on account of being a redeclaration lookup.
  - The access check would naturally happen during delay, which isn't
    appropriate in this case.
  - We weren't actually emitting dependent diagnostics associated with
    class templates, which was unfortunate.
  - Access was being propagated incorrectly for friend method declarations
    that couldn't be matched at parse-time.

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

12 years agoUpdate VerifyDiagnosticConsumer to only get directives during parsing.
Jordan Rose [Fri, 10 Aug 2012 01:06:16 +0000 (01:06 +0000)]
Update VerifyDiagnosticConsumer to only get directives during parsing.

The old behavior was to re-scan any files (like modules) where we may have
directives but won't actually be parsing during the -verify invocation.
Now, we keep the old behavior in Debug builds as a sanity check (though
modules are a known entity), and expect all legitimate directives to come
from comments seen by the preprocessor.

This also affects the ARC migration tool, which captures diagnostics in
order to filter some out. This change adds an explicit cleanup to
CaptureDiagnosticsConsumer in order to let its sub-consumer handle the
real end of diagnostics.

This was originally split into four patches, but the tests do not run
cleanly without all four, so I've combined them into one commit.

Patches by Andy Gibbs, with slight modifications from me.

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

12 years agoMake sure to call EndSourceFile even if we can't continue compiling.
Jordan Rose [Fri, 10 Aug 2012 01:06:08 +0000 (01:06 +0000)]
Make sure to call EndSourceFile even if we can't continue compiling.

Patch by Andy Gibbs!

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

12 years agoProvide isConst/Volatile on CXXMethodDecl.
David Blaikie [Fri, 10 Aug 2012 00:55:35 +0000 (00:55 +0000)]
Provide isConst/Volatile on CXXMethodDecl.

This also provides isConst/Volatile/Restrict on FunctionTypes to coalesce
the implementation with other callers (& update those other callers).

Patch contributed by Sam Panzer (panzer@google.com).

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

12 years ago[ms-inline asm] Use the new Inline Asm Non-Standard Dialect attribute.
Chad Rosier [Fri, 10 Aug 2012 00:00:34 +0000 (00:00 +0000)]
[ms-inline asm] Use the new Inline Asm Non-Standard Dialect attribute.

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

12 years ago[analyzer] Merge RegionStore's KillStruct and CopyLazyBindings: BindAggregate.
Jordan Rose [Thu, 9 Aug 2012 22:55:54 +0000 (22:55 +0000)]
[analyzer] Merge RegionStore's KillStruct and CopyLazyBindings: BindAggregate.

Both methods need to clear out existing bindings and provide a new default
binding. Originally KillStruct always provided UnknownVal as the default,
but it's allowed symbolic values for quite some time (for handling returned
structs in C).

No functionality change.

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

12 years ago[analyzer] Cluster bindings in RegionStore by base region.
Jordan Rose [Thu, 9 Aug 2012 22:55:51 +0000 (22:55 +0000)]
[analyzer] Cluster bindings in RegionStore by base region.

This should speed up activities that need to access bindings by cluster,
such as invalidation and dead-bindings cleaning. In some cases all we save
is the cost of building the region cluster map, but other times we can
actually avoid traversing the rest of the store.

In casual testing, this produced a speedup of nearly 10% analyzing SQLite,
with /less/ memory used.

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

12 years ago[analyzer] Cache the "concrete offset base" for regions with symbolic offsets.
Jordan Rose [Thu, 9 Aug 2012 22:55:37 +0000 (22:55 +0000)]
[analyzer] Cache the "concrete offset base" for regions with symbolic offsets.

This makes it faster to access and invalidate bindings with symbolic offsets
by only computing this information once.

No intended functionality change.

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

12 years ago[analyzer] Devirtualize StoreManager::evalDerivedToBase(SVal, CastExpr)
Jordan Rose [Thu, 9 Aug 2012 22:48:16 +0000 (22:48 +0000)]
[analyzer] Devirtualize StoreManager::evalDerivedToBase(SVal, CastExpr)

This was triggering -Woverloaded-virtual, but there's really no reason for
the cast version to be virtual anyway. It just calls through to the QualType
entry point.

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

12 years agoFollowup to r161546, to unbreak linking on Bitrig. Patch by David Hill.
Eli Friedman [Thu, 9 Aug 2012 22:42:04 +0000 (22:42 +0000)]
Followup to r161546, to unbreak linking on Bitrig.  Patch by David Hill.

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

12 years agoCMake: Add the new dependency from libSema to LLVM's libs.
Benjamin Kramer [Thu, 9 Aug 2012 22:33:50 +0000 (22:33 +0000)]
CMake: Add the new dependency from libSema to LLVM's libs.

Should fix the failures seen on some linux builders.

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

12 years ago[ms-inline asm] Fix comment.
Chad Rosier [Thu, 9 Aug 2012 21:28:05 +0000 (21:28 +0000)]
[ms-inline asm] Fix comment.

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

12 years ago[analyzer] A CXXBaseObjectRegion should correspond to a DIRECT base.
Jordan Rose [Thu, 9 Aug 2012 21:24:02 +0000 (21:24 +0000)]
[analyzer] A CXXBaseObjectRegion should correspond to a DIRECT base.

An ASTContext's RecordLayoutInfo can only be used to look up offsets of
direct base classes, and we need the offset to make non-symbolic bindings
in RegionStore. This change makes sure that we have one layer of
CXXBaseObjectRegion for each base we are casting through.

This was causing crashes on an internal buildbot.

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

12 years agoobjective-C: refactoring of objc's delayed parsing.
Fariborz Jahanian [Thu, 9 Aug 2012 21:12:39 +0000 (21:12 +0000)]
objective-C: refactoring of objc's delayed parsing.

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

12 years ago[ms-inline asm] Use StringRef here, per Jordan's suggestion.
Chad Rosier [Thu, 9 Aug 2012 21:06:32 +0000 (21:06 +0000)]
[ms-inline asm] Use StringRef here, per Jordan's suggestion.

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

12 years agoTemporarily revert r161612 while we figure out just what the semantics
Chandler Carruth [Thu, 9 Aug 2012 21:02:52 +0000 (21:02 +0000)]
Temporarily revert r161612 while we figure out just what the semantics
of PARALLEL_DIRS are. They apparantly aren't what either Nick, Eric, or
I thought. ;] Should let the bots make forward progress.

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

12 years ago[analyzer] Rename the function to better reflect what it actually does.
Anna Zaks [Thu, 9 Aug 2012 21:02:45 +0000 (21:02 +0000)]
[analyzer] Rename the function to better reflect what it actually does.

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

12 years ago[analyzer] Clarify the values in Dyn. Dispatch Bifurcation map.
Anna Zaks [Thu, 9 Aug 2012 21:02:41 +0000 (21:02 +0000)]
[analyzer] Clarify the values in Dyn. Dispatch Bifurcation map.

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

12 years ago[ms-inline asm] Simplify logic for empty asm statements.
Chad Rosier [Thu, 9 Aug 2012 20:52:43 +0000 (20:52 +0000)]
[ms-inline asm] Simplify logic for empty asm statements.

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

12 years ago[ms-inline asm] Instantiate the various parts to the AsmParser.
Chad Rosier [Thu, 9 Aug 2012 20:47:38 +0000 (20:47 +0000)]
[ms-inline asm] Instantiate the various parts to the AsmParser.

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

12 years agoMake all of the tools build in parallel. Missing this caused incremental
Chandler Carruth [Thu, 9 Aug 2012 20:40:24 +0000 (20:40 +0000)]
Make all of the tools build in parallel. Missing this caused incremental
rebuilds to serially link each tool, which is really really slow.

We still have to build libclang serially first because c-index-test
depends on it.

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

12 years agoRecurse into the extra tools repo the correct way from the Makefile
Chandler Carruth [Thu, 9 Aug 2012 20:21:38 +0000 (20:21 +0000)]
Recurse into the extra tools repo the correct way from the Makefile
build system. Thanks to Nick for pointing at the actual construct which
should be used here.

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

12 years agoIn 'delete []', the '[]' never starts a lambda. Update a FIXME with a standard refere...
Richard Smith [Thu, 9 Aug 2012 19:01:51 +0000 (19:01 +0000)]
In 'delete []', the '[]' never starts a lambda. Update a FIXME with a standard reference and add a test.

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

12 years ago[analyzer] Improve readability of the dyn. dispatch bifurcation patch
Anna Zaks [Thu, 9 Aug 2012 18:43:00 +0000 (18:43 +0000)]
[analyzer] Improve readability of the dyn. dispatch bifurcation patch
r161552.

As per Jordan's feedback.

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

12 years agoRemove absolute file path in test.
Dmitri Gribenko [Thu, 9 Aug 2012 18:35:49 +0000 (18:35 +0000)]
Remove absolute file path in test.

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

12 years agoComment to HTML and XML conversion: ignore commands that contain a declaration
Dmitri Gribenko [Thu, 9 Aug 2012 18:20:29 +0000 (18:20 +0000)]
Comment to HTML and XML conversion: ignore commands that contain a declaration
as their argument.  For example, \fn, \function, \typedef, \method, \class etc.

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

12 years agoFix the test case. Now it does not depend on the method used to pass vector arguments...
Simon Atanasyan [Thu, 9 Aug 2012 17:49:22 +0000 (17:49 +0000)]
Fix the test case. Now it does not depend on the method used to pass vector arguments to the function.
Reviewed by Anton Lokhmotov.

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

12 years agoComment to HTML and XML conversion: use CommandTraits to classify commands.
Dmitri Gribenko [Thu, 9 Aug 2012 17:33:20 +0000 (17:33 +0000)]
Comment to HTML and XML conversion: use CommandTraits to classify commands.

This also fixes a bug in comment to XML conversion: \result was just an
ordinary paragraph, not an alias for \returns.

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

12 years ago[ms-inline asm] Initialize targets and assembly printers/parsers.
Chad Rosier [Thu, 9 Aug 2012 17:33:11 +0000 (17:33 +0000)]
[ms-inline asm] Initialize targets and assembly printers/parsers.

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

12 years ago[ms-inline asm] Add various MC components to clang build to support MS-style inline...
Chad Rosier [Thu, 9 Aug 2012 17:17:01 +0000 (17:17 +0000)]
[ms-inline asm] Add various MC components to clang build to support MS-style inline assembly.

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

12 years agoobjective-C: minor refactoring in method
Fariborz Jahanian [Thu, 9 Aug 2012 17:15:00 +0000 (17:15 +0000)]
objective-C: minor refactoring in method
definition parsing logic.

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

12 years agoUnbreak the build.
Anna Zaks [Thu, 9 Aug 2012 02:57:02 +0000 (02:57 +0000)]
Unbreak the build.

Declaring "const Decl *Decl" is not a good idea.

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

12 years ago[analyzer] Cleanup of malloc checker.
Anna Zaks [Thu, 9 Aug 2012 00:42:24 +0000 (00:42 +0000)]
[analyzer] Cleanup of malloc checker.

Remove Escaped state, which is not really necessary. We can just stop
tracking the symbol instead of keeping it around and marking escaped.

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

12 years agoFix AAPCS ABI. I can't actually test this, but it restores the behavior from before...
Eli Friedman [Thu, 9 Aug 2012 00:31:40 +0000 (00:31 +0000)]
Fix AAPCS ABI.  I can't actually test this, but it restores the behavior from before r159168.  PR13562.

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

12 years ago[analyzer] Bifurcate the path with dynamic dispatch.
Anna Zaks [Thu, 9 Aug 2012 00:21:33 +0000 (00:21 +0000)]
[analyzer] Bifurcate the path with dynamic dispatch.

This is an initial (unoptimized) version. We split the path when
inlining ObjC instance methods. On one branch we always assume that the
type information for the given memory region is precise. On the other we
assume that we don't have the exact type info. It is important to check
since the class could be subclassed and the method can be overridden. If
we always inline we can loose coverage.

Had to refactor some of the call eval functions.

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

12 years agoAdd new file CommentCommandTraits.cpp to CMakeLists.txt.
Dmitri Gribenko [Thu, 9 Aug 2012 00:16:26 +0000 (00:16 +0000)]
Add new file CommentCommandTraits.cpp to CMakeLists.txt.

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

12 years agoAllow the Makefile build system to find the extra repo if it is checked
Chandler Carruth [Thu, 9 Aug 2012 00:05:27 +0000 (00:05 +0000)]
Allow the Makefile build system to find the extra repo if it is checked
out.

Unfortunately, the existing makefiles for the extra repo don't specify
the correct library dependencies. Fixing that next. If you're following
along, you'll get linker errors.

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

12 years agoComment parsing: extract TableGen'able pieces into new CommandTraits class.
Dmitri Gribenko [Thu, 9 Aug 2012 00:03:17 +0000 (00:03 +0000)]
Comment parsing: extract TableGen'able pieces into new CommandTraits class.

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

12 years agoclang support for Bitrig (an OpenBSD fork); patch by David Hill.
Eli Friedman [Wed, 8 Aug 2012 23:57:20 +0000 (23:57 +0000)]
clang support for Bitrig (an OpenBSD fork); patch by David Hill.

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

12 years agoMinor simplification for r161534.
Eli Friedman [Wed, 8 Aug 2012 23:53:27 +0000 (23:53 +0000)]
Minor simplification for r161534.

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

12 years agoobjective-C: refactor/simplify parsing of delayed
Fariborz Jahanian [Wed, 8 Aug 2012 23:41:08 +0000 (23:41 +0000)]
objective-C: refactor/simplify parsing of delayed
method/c-funcs defined in objc class implementation.
No intended functionality change.

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

12 years agoFix r161534 so it actually builds.
Eli Friedman [Wed, 8 Aug 2012 23:35:12 +0000 (23:35 +0000)]
Fix r161534 so it actually builds.

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

12 years agoPR13558: Fix typo 'compatiblity'. Thinking of the children. Apparently.
Richard Smith [Wed, 8 Aug 2012 23:32:13 +0000 (23:32 +0000)]
PR13558: Fix typo 'compatiblity'. Thinking of the children. Apparently.

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

12 years agoHandle deprecation diagnostics correctly for C struct fields and Objective-C properti...
Eli Friedman [Wed, 8 Aug 2012 23:04:35 +0000 (23:04 +0000)]
Handle deprecation diagnostics correctly for C struct fields and Objective-C properties/ivars. <rdar://problem/6642337>.

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

12 years agoComment XML: use xml:space="preserve" in Verbatim tags, so that XML tidy does
Dmitri Gribenko [Wed, 8 Aug 2012 22:10:24 +0000 (22:10 +0000)]
Comment XML: use xml:space="preserve" in Verbatim tags, so that XML tidy does
not compress spaces in verbatim content.

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

12 years agoUnify the codepaths for emitting deprecation warnings. The test changes are just...
Eli Friedman [Wed, 8 Aug 2012 21:52:41 +0000 (21:52 +0000)]
Unify the codepaths for emitting deprecation warnings.  The test changes are just to account for us emitting notes more consistently.

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

12 years agoAddress code review comments for Wstrncat-size warning (r161440).
Anna Zaks [Wed, 8 Aug 2012 21:42:23 +0000 (21:42 +0000)]
Address code review comments for Wstrncat-size warning (r161440).

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

12 years ago[ms-inline asm] Use more idiomatic logic. Thanks, Bill.
Chad Rosier [Wed, 8 Aug 2012 21:42:11 +0000 (21:42 +0000)]
[ms-inline asm] Use more idiomatic logic.  Thanks, Bill.

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

12 years agoImplicitly annotate __CFStringMakeConstantString with format_arg(1).
Jordan Rose [Wed, 8 Aug 2012 21:17:31 +0000 (21:17 +0000)]
Implicitly annotate __CFStringMakeConstantString with format_arg(1).

We handled the builtin version of this function in r157968, but the builtin
isn't used when compiling as -fno-constant-cfstrings.

This should complete <rdar://problem/6157200>.

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

12 years ago[ms-inline asm] Add basic codegen support for simple asm stmts. Currently,
Chad Rosier [Wed, 8 Aug 2012 21:15:52 +0000 (21:15 +0000)]
[ms-inline asm] Add basic codegen support for simple asm stmts.  Currently,
only machine specific clobbers are modeled.

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

12 years agoDon't add attributes for "#pragma pack" and friends to tag declarations which
Eli Friedman [Wed, 8 Aug 2012 21:08:34 +0000 (21:08 +0000)]
Don't add attributes for "#pragma pack" and friends to tag declarations which
are not definitions. This follows the behavior of both gcc and earlier
versions of clang. Regression from r156531.  <rdar://problem/12048621>.

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

12 years ago[ms-inline asm] Make sure IsSimple is correctly handled.
Chad Rosier [Wed, 8 Aug 2012 21:08:20 +0000 (21:08 +0000)]
[ms-inline asm] Make sure IsSimple is correctly handled.

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

12 years agoRemove extraneous comment.
Chad Rosier [Wed, 8 Aug 2012 20:38:22 +0000 (20:38 +0000)]
Remove extraneous comment.

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

12 years ago[ms-inline asm] Add a very simple test case. Basically, we're only testing for
Chad Rosier [Wed, 8 Aug 2012 20:37:31 +0000 (20:37 +0000)]
[ms-inline asm] Add a very simple test case.  Basically, we're only testing for
crashers at the moment (and coincidentally this case was causing a crash).

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

12 years ago[ms-inline asm] Refactor the logic to generate the AsmString into Sema. No
Chad Rosier [Wed, 8 Aug 2012 19:48:07 +0000 (19:48 +0000)]
[ms-inline asm] Refactor the logic to generate the AsmString into Sema.  No
functional change intended.

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

12 years agoWhitespace.
Chad Rosier [Wed, 8 Aug 2012 18:51:50 +0000 (18:51 +0000)]
Whitespace.

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

12 years agoWhitespace.
Chad Rosier [Wed, 8 Aug 2012 18:46:20 +0000 (18:46 +0000)]
Whitespace.

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

12 years ago[analyzer] Clean up the printing of FieldRegions for leaks.
Jordan Rose [Wed, 8 Aug 2012 18:23:36 +0000 (18:23 +0000)]
[analyzer] Clean up the printing of FieldRegions for leaks.

Unfortunately, generalized region printing is very difficult:
- ElementRegions are used both for casting and as actual elements.
- Accessing values through a pointer means going through an intermediate
  SymbolRegionValue; symbolic regions are untyped.
- Referring to implicitly-defined variables like 'this' and 'self' could be
  very confusing if they come from another stack frame.

We fall back to simply not printing the region name if we can't be sure it
will print well. This will allow us to improve in the future.

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

12 years ago[analyzer] Track malloc'd regions stored in structs.
Jordan Rose [Wed, 8 Aug 2012 18:23:31 +0000 (18:23 +0000)]
[analyzer] Track malloc'd regions stored in structs.

The main blocker on this (besides the previous commit) was that
ScanReachableSymbols was not looking through LazyCompoundVals.
Once that was fixed, it's easy enough to clear out malloc data on return,
just like we do when we bind to a global region.

<rdar://problem/10872635>

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

12 years ago[analyzer] Revamp RegionStore to distinguish regions with symbolic offsets.
Jordan Rose [Wed, 8 Aug 2012 18:23:27 +0000 (18:23 +0000)]
[analyzer] Revamp RegionStore to distinguish regions with symbolic offsets.

RegionStore currently uses a (Region, Offset) pair to describe the locations
of memory bindings. However, this representation breaks down when we have
regions like 'array[index]', where 'index' is unknown. We used to store this
as (SubRegion, 0); now we mark them specially as (SubRegion, SYMBOLIC).

Furthermore, ProgramState::scanReachableSymbols depended on the existence of
a sub-region map, but RegionStore's implementation doesn't provide for such
a thing. Moving the store-traversing logic of scanReachableSymbols into the
StoreManager allows us to eliminate the notion of SubRegionMap altogether.

This fixes some particularly awkward broken test cases, now in
array-struct-region.c.

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

12 years agoConstify CXXRecordDecl::isVirtuallyDerivedFrom.
Jordan Rose [Wed, 8 Aug 2012 18:23:20 +0000 (18:23 +0000)]
Constify CXXRecordDecl::isVirtuallyDerivedFrom.

No functionality change. A couple ugly const_casts because the ancestor
search code is used for other purposes as well.

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

12 years ago[ms-inline asm] Add support for detecting simple ms-style inline asm. Simple
Chad Rosier [Wed, 8 Aug 2012 18:22:06 +0000 (18:22 +0000)]
[ms-inline asm] Add support for detecting simple ms-style inline asm.  Simple
asm statements are those that don't reference variable names, function names,
and labels.

Add logic to generate a patched AsmString that will eventually be consumed by
the AsmParser.  No functional change at this point, so unfortunately no test
case.

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

12 years agoAdd the IsSimple/IsVolatile parameters to the MSAsmStmt constructor.
Chad Rosier [Wed, 8 Aug 2012 17:35:36 +0000 (17:35 +0000)]
Add the IsSimple/IsVolatile parameters to the MSAsmStmt constructor.

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

12 years agoImplement warning for integral null pointer constants other than the literal 0.
David Blaikie [Wed, 8 Aug 2012 17:33:31 +0000 (17:33 +0000)]
Implement warning for integral null pointer constants other than the literal 0.

This is effectively a warning for code that violates core issue 903 & thus will
become standard error in the future, hopefully. It catches strange null
pointers such as: '\0', 1 - 1, const int null = 0; etc...

There's currently a flaw in this warning (& the warning for 'false' as a null
pointer literal as well) where it doesn't trigger on comparisons (ptr == '\0'
for example). Fix to come in a future patch.

Also, due to this only being a warning, not an error, it triggers quite
frequently on gtest code which tests expressions for null-pointer-ness in a
SFINAE context (so it wouldn't be a problem if this was an error as in an
actual implementation of core issue 903). To workaround this for now, the
diagnostic does not fire in unevaluated contexts.

Review by Sean Silva and Richard Smith.

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

12 years agoobjc: Include all types when issuing warning under
Fariborz Jahanian [Wed, 8 Aug 2012 16:41:04 +0000 (16:41 +0000)]
objc: Include all types when issuing warning under
-Wdirect-ivar-access.

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

12 years agoAdd various MC components to clang build to support MS-style inline assembly.
Chad Rosier [Wed, 8 Aug 2012 16:27:29 +0000 (16:27 +0000)]
Add various MC components to clang build to support MS-style inline assembly.

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

12 years agoPreprocessor: fix __OPTIMIZE_SIZE__ and -Oz
Dylan Noblesmith [Wed, 8 Aug 2012 16:09:15 +0000 (16:09 +0000)]
Preprocessor: fix  __OPTIMIZE_SIZE__ and -Oz

Add some tests for __OPTIMIZE_SIZE__ and  __NO_INLINE__,
removing the superfluous copies in the target-specific
tests, since it's target-independent.

This uncovered a bug in the handling of -Oz: it would
attempt to store the value 2 in the 1-bit bitfield OptimizeSize,
leaving a value of 0 and never defining __OPTIMIZE_SIZE__.

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

12 years agoFrontend: further document __BYTE_ORDER__
Dylan Noblesmith [Wed, 8 Aug 2012 16:09:12 +0000 (16:09 +0000)]
Frontend: further document __BYTE_ORDER__

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

12 years agoRemove unused variables.
Benjamin Kramer [Wed, 8 Aug 2012 09:26:28 +0000 (09:26 +0000)]
Remove unused variables.

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

12 years agoRevert part of r161175 which was wrong for OpenBSD's PowerPC target.
Hans Wennborg [Wed, 8 Aug 2012 08:41:02 +0000 (08:41 +0000)]
Revert part of r161175 which was wrong for OpenBSD's PowerPC target.

Contributed by Brad Smith <brad@comstyle.com>

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

12 years agoImplement final piece of DR963 and also DR587:
Richard Smith [Wed, 8 Aug 2012 06:13:49 +0000 (06:13 +0000)]
Implement final piece of DR963 and also DR587:

A conditional operator between glvalues of types cv1 T and cv2 T produces a
glvalue if the expressions are of the same value kind and one of cv1 and cv2
is a subset of the other.

A conditional operator between two null pointer constants is permitted if one
of them is of type std::nullptr_t.

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

12 years agoclarify that the advantages of the BSD license apply to when you incorporate clang...
Chris Lattner [Wed, 8 Aug 2012 05:26:51 +0000 (05:26 +0000)]
clarify that the advantages of the BSD license apply to when you incorporate clang into proprietary code bases,
patch by Jonathan Sauer.

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

12 years agoGet rid of an early return in Sema::ActOnFields which doesn't make sense anymore.
Eli Friedman [Wed, 8 Aug 2012 04:39:56 +0000 (04:39 +0000)]
Get rid of an early return in Sema::ActOnFields which doesn't make sense anymore.
Fixes a crash (<rdar://problem/11067144>), and generally seems to improve
recovery in other cases.

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

12 years agoFix an assertion failure with a C++ constructor initializing a
Eli Friedman [Wed, 8 Aug 2012 03:51:37 +0000 (03:51 +0000)]
Fix an assertion failure with a C++ constructor initializing a
member of reference type in an anonymous struct.  PR13154.

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

12 years agoFix a -ast-dump crash.
Eli Friedman [Wed, 8 Aug 2012 03:47:15 +0000 (03:47 +0000)]
Fix a -ast-dump crash.

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

12 years agoobjc-arc: Make -Wdirect-ivar-access accessible to all
Fariborz Jahanian [Tue, 7 Aug 2012 23:48:10 +0000 (23:48 +0000)]
objc-arc: Make -Wdirect-ivar-access accessible to all
memory models, except when arc is accessing a weak
ivar (which is an error). // rdar://6505197

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

12 years agoWhitespace.
Chad Rosier [Tue, 7 Aug 2012 23:12:23 +0000 (23:12 +0000)]
Whitespace.

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

12 years agoWhen building a conditional operator where one operand is a throw-expression
Richard Smith [Tue, 7 Aug 2012 22:06:48 +0000 (22:06 +0000)]
When building a conditional operator where one operand is a throw-expression
and the other is a glvalue of class type, don't forget to copy-initialize a
temporary when performing the lvalue-to-rvalue conversion on the glvalue.
Strangely, DefaultLvalueConversions misses this part of the lvalue-to-rvalue
conversions.

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

12 years ago-Wunused-private-fields: Don't try to check unresolved initializer expressions
Richard Smith [Tue, 7 Aug 2012 21:30:42 +0000 (21:30 +0000)]
-Wunused-private-fields: Don't try to check unresolved initializer expressions
for side-effects. Instead, check for side-effects after performing
initialization. Doing so also removes some strange corner cases and differences
between in-class initialization and constructor initialization.

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

12 years agoobjc-arc: set nonlazybind attribute on objc_retain/
Fariborz Jahanian [Tue, 7 Aug 2012 21:30:31 +0000 (21:30 +0000)]
objc-arc: set nonlazybind attribute on objc_retain/
objc_release for performance for these most often
called APIs. // rdar://12040837

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

12 years agoRemove obsolete comment. Obsoleted by r116524 when Type hierarhy bitfield
Dmitri Gribenko [Tue, 7 Aug 2012 21:19:46 +0000 (21:19 +0000)]
Remove obsolete comment.  Obsoleted by r116524 when Type hierarhy bitfield
implementation was changed to a union of bitfields.

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

12 years agoFix capitalization of LibXml2 for CMake on case-sensitive file systems
Douglas Gregor [Tue, 7 Aug 2012 20:42:31 +0000 (20:42 +0000)]
Fix capitalization of LibXml2 for CMake on case-sensitive file systems

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

12 years agoDon't complain about -fobjc-link-runtime being unused with -fobjc-arc.
Bob Wilson [Tue, 7 Aug 2012 19:58:00 +0000 (19:58 +0000)]
Don't complain about -fobjc-link-runtime being unused with -fobjc-arc.

If you build with -fobjc-arc, then -fobjc-link-runtime is implied but we
don't need to warn about it being unused in that case.  rdar://12039965

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

12 years agoTeach ccc-analyze about -fobjc-legacy-dispatch and -mios-simulator-version-min
Ted Kremenek [Tue, 7 Aug 2012 19:27:08 +0000 (19:27 +0000)]
Teach ccc-analyze about -fobjc-legacy-dispatch and -mios-simulator-version-min

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

12 years agoComment AST: DeclInfo: add a special kind for enums.
Dmitri Gribenko [Tue, 7 Aug 2012 18:59:04 +0000 (18:59 +0000)]
Comment AST: DeclInfo: add a special kind for enums.
Comment XML: add a root node kind for enums.

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

12 years agoTurn on strncat-size warning implemented a while ago.
Anna Zaks [Tue, 7 Aug 2012 18:36:58 +0000 (18:36 +0000)]
Turn on strncat-size warning implemented a while ago.

Warns on anti-patterns/typos in the 'size' argument to strncat. The
correct size argument should look like the following:
 - strncat(dst, src, sizeof(dst) - strlen(dest) - 1);

We warn on:
 - sizeof(dst)
 - sizeof(src)
 - sizeof(dst) - strlen(dst)
 - sizeof(src) - anything

(This has been implemented in void Sema::CheckStrncatArguments().)

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

12 years agoc-index-test Makefile: fix build on Linux. Reviewed by Eric Christopher.
Dmitri Gribenko [Tue, 7 Aug 2012 18:36:33 +0000 (18:36 +0000)]
c-index-test Makefile: fix build on Linux.  Reviewed by Eric Christopher.

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

12 years agoComment.h: fix typo in comment
Dmitri Gribenko [Tue, 7 Aug 2012 18:20:04 +0000 (18:20 +0000)]
Comment.h: fix typo in comment

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

12 years agoComment AST: treat enumerators as "variables" in DeclInfo.
Dmitri Gribenko [Tue, 7 Aug 2012 18:12:22 +0000 (18:12 +0000)]
Comment AST: treat enumerators as "variables" in DeclInfo.

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

12 years agolibclang API for comment-to-xml conversion.
Dmitri Gribenko [Tue, 7 Aug 2012 17:54:38 +0000 (17:54 +0000)]
libclang API for comment-to-xml conversion.

The implementation also includes a Relax NG schema and tests for the schema
itself.  The schema is used in c-index-test to verify that XML documents we
produce are valid.  In order to do the validation, we add an optional libxml2
dependency for c-index-test.

Credits for CMake part go to Doug Gregor.  Credits for Autoconf part go to Eric
Christopher.  Thanks!

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

12 years agoobjective-c: Exclude -Wdirect-ivar-access for arc.
Fariborz Jahanian [Tue, 7 Aug 2012 16:38:44 +0000 (16:38 +0000)]
objective-c: Exclude -Wdirect-ivar-access for arc.
Allow direct ivar access in init and dealloc methods
in mrr. // rdar://650197

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

12 years agoProperly check length modfiers for %n in format strings.
Hans Wennborg [Tue, 7 Aug 2012 09:13:19 +0000 (09:13 +0000)]
Properly check length modfiers for %n in format strings.

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

12 years agoRemove ScanfArgType and bake that logic into ArgType.
Hans Wennborg [Tue, 7 Aug 2012 08:59:46 +0000 (08:59 +0000)]
Remove ScanfArgType and bake that logic into ArgType.

This is useful for example for %n in printf, which expects
a pointer to int with the same logic for checking as %d
would have in scanf.

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

12 years agoInitial support for recursing into the new clang-tools-extra repository
Chandler Carruth [Tue, 7 Aug 2012 08:37:42 +0000 (08:37 +0000)]
Initial support for recursing into the new clang-tools-extra repository
if checked out under clang/tools/extra.

This is mostly so folks other than me can start to test. Documentation,
details, and an announcement are still in the works.

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

12 years agoRename analyze_format_string::ArgTypeResult to ArgType
Hans Wennborg [Tue, 7 Aug 2012 08:11:26 +0000 (08:11 +0000)]
Rename analyze_format_string::ArgTypeResult to ArgType

Also remove redundant constructors and unused member functions.

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

12 years agoObjective-C pointer types don't have C-linkage, even though they are
Douglas Gregor [Tue, 7 Aug 2012 06:14:34 +0000 (06:14 +0000)]
Objective-C pointer types don't have C-linkage, even though they are
non-POD. Fixes <rdar://problem/12031870>.

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