]> granicus.if.org Git - clang/log
clang
13 years agoReinstate r126737, extending the generation of type-source location
Douglas Gregor [Tue, 1 Mar 2011 16:31:39 +0000 (16:31 +0000)]
Reinstate r126737, extending the generation of type-source location
information for qualifier type names throughout the parser to address
several problems.

The commit message from r126737:

Push nested-name-specifier source location information into elaborated
name types, e.g., "enum clang::NestedNameSpecifier::SpecifierKind".

Aside from the normal changes, this also required some tweaks to the
parser. Essentially, when we're looking at a type name (via
getTypeName()) specifically for the purpose of creating an annotation
token, we pass down the flag that asks for full type-source location
information to be stored within the returned type. That way, we retain
source-location information involving nested-name-specifiers rather
than trying to reconstruct that information later, long after it's
been lost in the parser.

With this change, test/Index/recursive-cxx-member-calls.cpp is showing
much improved results again, since that code has lots of
nested-name-specifiers.

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

13 years agoRevert r126737, the most recent nested-name-specifier location change, for buildbot...
Douglas Gregor [Tue, 1 Mar 2011 15:34:37 +0000 (15:34 +0000)]
Revert r126737, the most recent nested-name-specifier location change, for buildbot breakage.

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

13 years agoDisable more warnings so that it is safe to use
Rafael Espindola [Tue, 1 Mar 2011 05:25:27 +0000 (05:25 +0000)]
Disable more warnings so that it is safe to use
CC="clang -use-gold-plugin -emit-llvm"
CXX="clang++ -use-gold-plugin -emit-llvm"

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

13 years agoMove the bool-conversions behind the DiagRuntimeBehavior logic. It's
Chandler Carruth [Tue, 1 Mar 2011 03:29:37 +0000 (03:29 +0000)]
Move the bool-conversions behind the DiagRuntimeBehavior logic. It's
possible for these to show up due to metaprogramming both in unevaluated
contexts and compile-time dead branches.

Those aren't the bugs we're looking for.

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

13 years agoIn preparation for fixing PR 6884, rework CFGElement to have getAs<> return pointers...
Ted Kremenek [Tue, 1 Mar 2011 03:15:10 +0000 (03:15 +0000)]
In preparation for fixing PR 6884, rework CFGElement to have getAs<> return pointers instead of fresh CFGElements.

- Also, consoldiate getDtorKind() and getKind() into one "kind".
- Add empty getDestructorDecl() method to CFGImplicitDtor.

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

13 years agoPush nested-name-specifier source location information into elaborated
Douglas Gregor [Tue, 1 Mar 2011 03:11:17 +0000 (03:11 +0000)]
Push nested-name-specifier source location information into elaborated
name types, e.g., "enum clang::NestedNameSpecifier::SpecifierKind".

Aside from the normal changes, this also required some tweaks to the
parser. Essentially, when we're looking at a type name (via
getTypeName()) specifically for the purpose of creating an annotation
token, we pass down the flag that asks for full type-source location
information to be stored within the returned type. That way, we retain
source-location information involving nested-name-specifiers rather
than trying to reconstruct that information later, long after it's
been lost in the parser.

With this change, test/Index/recursive-cxx-member-calls.cpp is showing
much improved results again, since that code has lots of
nested-name-specifiers.

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

13 years ago[analyzer] Also make sure that the parameter is coming from the current stack frame.
Argyrios Kyrtzidis [Tue, 1 Mar 2011 01:59:41 +0000 (01:59 +0000)]
[analyzer] Also make sure that the parameter is coming from the current stack frame.

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

13 years ago[analyzer] Remove SVal::getAsVarDecl() and reason about MemRegions, not Decls. Sugges...
Argyrios Kyrtzidis [Tue, 1 Mar 2011 01:47:48 +0000 (01:47 +0000)]
[analyzer] Remove SVal::getAsVarDecl() and reason about MemRegions, not Decls. Suggestion by Ted!

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

13 years agoUse CharUnits for TypeAlign variable in LayoutWideBitField(). No change in
Ken Dyck [Tue, 1 Mar 2011 01:36:00 +0000 (01:36 +0000)]
Use CharUnits for TypeAlign variable in LayoutWideBitField(). No change in
functionality intended.

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

13 years agoPush nested-name-specifier source location information into
Douglas Gregor [Tue, 1 Mar 2011 01:34:45 +0000 (01:34 +0000)]
Push nested-name-specifier source location information into
DependentNameTypeLoc. Teach the recursive AST visitor and libclang how to
walk DependentNameTypeLoc nodes.

Also, teach libclang about TypedefDecl source ranges, so that we get
those. The massive churn in test/Index/recursive-cxx-member-calls.cpp
is a good thing: we're annotating a lot more of this test correctly
now.

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

13 years ago[analyzer] Move lib/StaticAnalyzer/Checkers/ExprEngine.cpp -> lib/StaticAnalyzer...
Argyrios Kyrtzidis [Tue, 1 Mar 2011 01:24:23 +0000 (01:24 +0000)]
[analyzer] Move lib/StaticAnalyzer/Checkers/ExprEngine.cpp -> lib/StaticAnalyzer/Core
and hope the wrath of the buildbots will not descend upon me.

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

13 years agoChange the return type of GetVirtualPointersSize() to CharUnits. No change
Ken Dyck [Tue, 1 Mar 2011 01:22:45 +0000 (01:22 +0000)]
Change the return type of GetVirtualPointersSize() to CharUnits. No change
in functionality intended.

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

13 years ago[analyzer] Rename CheckerV2 -> Checker.
Argyrios Kyrtzidis [Tue, 1 Mar 2011 01:16:21 +0000 (01:16 +0000)]
[analyzer] Rename CheckerV2 -> Checker.

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

13 years ago[analyzer] Remove Checker V1.
Argyrios Kyrtzidis [Tue, 1 Mar 2011 01:16:08 +0000 (01:16 +0000)]
[analyzer] Remove Checker V1.

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

13 years ago[analyzer] Remove checker V1 registration and running from ExprEngine.
Argyrios Kyrtzidis [Tue, 1 Mar 2011 01:16:03 +0000 (01:16 +0000)]
[analyzer] Remove checker V1 registration and running from ExprEngine.

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

13 years agoImproves the coding style in SValBuilder. This patch:
Zhanyong Wan [Tue, 1 Mar 2011 00:45:32 +0000 (00:45 +0000)]
Improves the coding style in SValBuilder.  This patch:

- renames evalCastNL and evalCastL to evalCastFromNonLoc and
  evalCastFromLoc (avoid abbreviations that aren't well known).

- makes all function parameter names start with a lower case letter
  for consistency and distinction from member variables.

- avoids abbreviations in function parameter names.

Reviewed by kremenek@apple.com.

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

13 years agoFix some regressions in the GCC testsuite due to bad souce-location
Douglas Gregor [Tue, 1 Mar 2011 00:34:57 +0000 (00:34 +0000)]
Fix some regressions in the GCC testsuite due to bad souce-location
information. Fixes <rdar://problem/9063643>.

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

13 years ago-fwrapv should turn off the inbounds markers from geps used for pointer
Chris Lattner [Tue, 1 Mar 2011 00:03:48 +0000 (00:03 +0000)]
-fwrapv should turn off the inbounds markers from geps used for pointer
arithmetic.  This is part of PR9256, it would be great if someone else
wired up -fno-strict-overflow in the driver to -fwrapv.

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

13 years agoRefactor the construction of nested-name-specifiers with
Douglas Gregor [Mon, 28 Feb 2011 23:58:31 +0000 (23:58 +0000)]
Refactor the construction of nested-name-specifiers with
source-location information into a NestedNameSpecifierLocBuilder
class, which lives within the AST library and centralize all knowledge
of the format of nested-name-specifier location information here.

No functionality change.

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

13 years agoDon't warn about "clang -use-gold-plugin -c ...". With this users can say
Rafael Espindola [Mon, 28 Feb 2011 23:29:45 +0000 (23:29 +0000)]
Don't warn about "clang -use-gold-plugin -c ...". With this users can say
CC="clang -use-gold-plugin" CFLAGS=-emit-llvm ../configure...
and not be hit with a warning for each .c file.

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

13 years agoTeach Sema::CheckTypenameType to use nested-name-specifiers with
Douglas Gregor [Mon, 28 Feb 2011 22:42:13 +0000 (22:42 +0000)]
Teach Sema::CheckTypenameType to use nested-name-specifiers with
source-location information. We don't actually preserve this
information in any of the resulting TypeLocs (yet), so it doesn't
matter.

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

13 years agoUse single code path to handle c++ structs and classes while generating debug info.
Devang Patel [Mon, 28 Feb 2011 22:32:45 +0000 (22:32 +0000)]
Use single code path to handle c++ structs and classes while generating debug info.

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

13 years ago[analyzer] Remove unused checker stuff from AnalysisConsumer and some unused headers.
Argyrios Kyrtzidis [Mon, 28 Feb 2011 22:30:38 +0000 (22:30 +0000)]
[analyzer] Remove unused checker stuff from AnalysisConsumer and some unused headers.

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

13 years agoPush nested-name-specifier location information into DeclRefExpr and
Douglas Gregor [Mon, 28 Feb 2011 21:54:11 +0000 (21:54 +0000)]
Push nested-name-specifier location information into DeclRefExpr and
MemberExpr, the last of the expressions with qualifiers!

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

13 years agoRevert r126678.
Fariborz Jahanian [Mon, 28 Feb 2011 21:19:34 +0000 (21:19 +0000)]
Revert r126678.

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

13 years agoPush nested-name-specifier source location information into
Douglas Gregor [Mon, 28 Feb 2011 20:01:57 +0000 (20:01 +0000)]
Push nested-name-specifier source location information into
UnresolvedLookupExpr and UnresolvedMemberExpr.

Also, improve the computation that checks whether the base of a member
expression (either unresolved or dependent-scoped) is implicit. The
previous check didn't cover all of the cases we use in our
representation, which threw off source-location information for these
expressions (which, in turn, caused some breakage in libclang's token
annotation).

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

13 years agoobjc IRGen for Next runtime message API.
Fariborz Jahanian [Mon, 28 Feb 2011 19:55:59 +0000 (19:55 +0000)]
objc IRGen for Next runtime message API.
The prototype for objc_msgSend() is technically variadic -
`id objc_msgSend(id, SEL, ...)`.
But all method calls should use a prototype that matches the method,
not the prototype for objc_msgSend itself().
// rdar://9048030

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

13 years ago[analyzer] Remove '-analyzer-check-objc-mem' flag, the nominee for best misnomer...
Argyrios Kyrtzidis [Mon, 28 Feb 2011 19:49:42 +0000 (19:49 +0000)]
[analyzer] Remove '-analyzer-check-objc-mem' flag, the nominee for best misnomer award.

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

13 years agoMove test/SemaObjC/method-arg-decay.m -> test/Analysis/method-arg-decay.m
Argyrios Kyrtzidis [Mon, 28 Feb 2011 19:49:21 +0000 (19:49 +0000)]
Move test/SemaObjC/method-arg-decay.m -> test/Analysis/method-arg-decay.m

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

13 years ago[analyzer] Run the ExprEngine depending on the CheckerManager having path-sensitive...
Argyrios Kyrtzidis [Mon, 28 Feb 2011 19:49:17 +0000 (19:49 +0000)]
[analyzer] Run the ExprEngine depending on the CheckerManager having path-sensitive checkers.

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

13 years ago[analyzer] The current UninitializedValuesChecker will go away, remove '-warn-uninit...
Argyrios Kyrtzidis [Mon, 28 Feb 2011 19:49:12 +0000 (19:49 +0000)]
[analyzer] The current UninitializedValuesChecker will go away, remove '-warn-uninit-values'.

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

13 years agoKill 18 month old #if 0'd code in StmtXML.cpp
Peter Collingbourne [Mon, 28 Feb 2011 19:42:30 +0000 (19:42 +0000)]
Kill 18 month old #if 0'd code in StmtXML.cpp

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

13 years agoRemove redundant friend declaration
Douglas Gregor [Mon, 28 Feb 2011 19:17:05 +0000 (19:17 +0000)]
Remove redundant friend declaration

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

13 years agoPush nested-name-specifier source location information into
Douglas Gregor [Mon, 28 Feb 2011 18:50:33 +0000 (18:50 +0000)]
Push nested-name-specifier source location information into
CXXDependentScopeMemberExpr, and clean up instantiation of
nested-name-specifiers with dependent template specialization types in
the process.

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

13 years ago[analyzer] Migrate NSErrorChecker and DereferenceChecker to CheckerV2.
Argyrios Kyrtzidis [Mon, 28 Feb 2011 17:36:18 +0000 (17:36 +0000)]
[analyzer] Migrate NSErrorChecker and DereferenceChecker to CheckerV2.

They cooperate in that NSErrorChecker listens for ImplicitNullDerefEvent events that
DereferenceChecker can dispatch.
ImplicitNullDerefEvent is when we dereferenced a location that may be null.

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

13 years ago[analyzer] Introduce "event" mechanism in CheckerManager.
Argyrios Kyrtzidis [Mon, 28 Feb 2011 17:36:09 +0000 (17:36 +0000)]
[analyzer] Introduce "event" mechanism in CheckerManager.

A checker can register as receiver/listener of "events" (basically it registers a callback
with a function getting called with an argument of the event type) and other checkers can
register as "dispatchers" and can pass an event object to all the listeners.
This allows cooperation amongst checkers but with very loose coupling.

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

13 years ago[analyzer] Run AST checkers for ObjCMethodDecls.
Argyrios Kyrtzidis [Mon, 28 Feb 2011 17:36:04 +0000 (17:36 +0000)]
[analyzer] Run AST checkers for ObjCMethodDecls.

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

13 years agoEliminate the last remains of TemplateSpecializationTypes with
Douglas Gregor [Mon, 28 Feb 2011 17:23:35 +0000 (17:23 +0000)]
Eliminate the last remains of TemplateSpecializationTypes with
dependent template names. There is still a lot of redundant code in
TreeTransform to cope with TemplateSpecializationTypes, which I'll
remove in stages.

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

13 years agoMake -fobjc-nonfragile-abi and -fgnu-runtime imply -fblocks (unless -fno-blocks is...
David Chisnall [Mon, 28 Feb 2011 17:11:43 +0000 (17:11 +0000)]
Make -fobjc-nonfragile-abi and -fgnu-runtime imply -fblocks (unless -fno-blocks is specified), because this combination of flags defines an Objective-C runtime that includes a blocks runtime.

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

13 years agoUnbreak CMake build
Douglas Gregor [Mon, 28 Feb 2011 14:32:11 +0000 (14:32 +0000)]
Unbreak CMake build

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

13 years agoFrom Vassil Vassilev:
Axel Naumann [Mon, 28 Feb 2011 11:22:50 +0000 (11:22 +0000)]
From Vassil Vassilev:
* Add default implementations (no-op) for ExternalASTSource's pure virtual functions. There are valid use cases that can live with these defaults.
* Move ExternalASTSource's out of line implementations into separate source file.
* Whitespace, forward decl, #include cleanup.

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

13 years agotest: Add the feature "shell". Frontend/dependency-gen.c would be executable with...
NAKAMURA Takumi [Mon, 28 Feb 2011 09:41:07 +0000 (09:41 +0000)]
test: Add the feature "shell". Frontend/dependency-gen.c would be executable with shell.

The feature "shell" is implemented in llvm/test.

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

13 years agoAdd a test case that would have caught the bug fixed in r126640.
Chandler Carruth [Mon, 28 Feb 2011 07:38:09 +0000 (07:38 +0000)]
Add a test case that would have caught the bug fixed in r126640.

I've only covered C++'s flags here, we should probably do something
similar for ObjC flags.

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

13 years agoFix a tiny goof in the Driver's logic which caused the explicit presence
Chandler Carruth [Mon, 28 Feb 2011 07:25:18 +0000 (07:25 +0000)]
Fix a tiny goof in the Driver's logic which caused the explicit presence
of -fexceptions to disably C++ exceptions. The correct code was in the
ObjC branch, this just mirrors that logic on the C++ side of things.
Thanks to John Wiegley for pointing this out.

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

13 years agoMake skipping of vardecls more precise: it's ok to skip a decl if the entire
Chris Lattner [Mon, 28 Feb 2011 07:22:44 +0000 (07:22 +0000)]
Make skipping of vardecls more precise: it's ok to skip a decl if the entire
compound stmt containing the decl is skipped.

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

13 years agomake switch constant folding a bit stronger, handling a missed case.
Chris Lattner [Mon, 28 Feb 2011 07:16:14 +0000 (07:16 +0000)]
make switch constant folding a bit stronger, handling a missed case.

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

13 years ago[PR9321] "make install" does not need install c-index-test. It is used for testing.
NAKAMURA Takumi [Mon, 28 Feb 2011 05:21:34 +0000 (05:21 +0000)]
[PR9321] "make install" does not need install c-index-test. It is used for testing.

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

13 years agoCMake: [PR9321] Don't install include/clang/**/*.td.
NAKAMURA Takumi [Mon, 28 Feb 2011 05:21:27 +0000 (05:21 +0000)]
CMake: [PR9321] Don't install include/clang/**/*.td.

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

13 years agoRename tok::eom to tok::eod.
Peter Collingbourne [Mon, 28 Feb 2011 02:37:51 +0000 (02:37 +0000)]
Rename tok::eom to tok::eod.

The previous name was inaccurate as this token in fact appears at
the end of every preprocessing directive, not just macro definitions.
No functionality change, except for a diagnostic tweak.

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

13 years agoAdd a -fcxx-exceptions flag to the frontend, which can be used to enable
Anders Carlsson [Mon, 28 Feb 2011 02:27:16 +0000 (02:27 +0000)]
Add a -fcxx-exceptions flag to the frontend, which can be used to enable
C++ exceptions, even when exceptions have been turned off using -fno-exceptions.
Make the -fobjc-exceptions flag do the same thing, but for Objective-C exceptions.

C++ and Objective-C exceptions can also be disabled using -fno-cxx-excptions and
-fno-objc-exceptions.

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

13 years agoFix CMake build.
Anders Carlsson [Mon, 28 Feb 2011 02:13:22 +0000 (02:13 +0000)]
Fix CMake build.

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

13 years agoRetry r126357. Use CharUnits for the Size and DataSize calculations when
Ken Dyck [Mon, 28 Feb 2011 02:01:38 +0000 (02:01 +0000)]
Retry r126357. Use CharUnits for the Size and DataSize calculations when
they are known to be exact multiples of the width of the char type. Add a
test case to CodeGen/union.c that would have caught the problem with the
previous attempt. No change in functionality intended.

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

13 years ago[analyzer] Introduce SVal::getAsVarDecl().
Argyrios Kyrtzidis [Mon, 28 Feb 2011 01:28:18 +0000 (01:28 +0000)]
[analyzer] Introduce SVal::getAsVarDecl().

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

13 years ago[analzyer] Migrate CallAndMessageChecker to CheckerV2.
Argyrios Kyrtzidis [Mon, 28 Feb 2011 01:28:13 +0000 (01:28 +0000)]
[analzyer] Migrate CallAndMessageChecker to CheckerV2.

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

13 years ago[analyzer] ExprEngine should not depend on checkers for not crashing.
Argyrios Kyrtzidis [Mon, 28 Feb 2011 01:28:08 +0000 (01:28 +0000)]
[analyzer] ExprEngine should not depend on checkers for not crashing.

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

13 years ago[analyzer] Migrate AdjustedReturnValueChecker to CheckerV2.
Argyrios Kyrtzidis [Mon, 28 Feb 2011 01:28:05 +0000 (01:28 +0000)]
[analyzer] Migrate AdjustedReturnValueChecker to CheckerV2.

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

13 years ago[analyzer] Migrate AttrNonNullChecker to CheckerV2.
Argyrios Kyrtzidis [Mon, 28 Feb 2011 01:28:01 +0000 (01:28 +0000)]
[analyzer] Migrate AttrNonNullChecker to CheckerV2.

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

13 years ago[analyzer] ExprEngine should not depend on checkers for not crashing.
Argyrios Kyrtzidis [Mon, 28 Feb 2011 01:27:57 +0000 (01:27 +0000)]
[analyzer] ExprEngine should not depend on checkers for not crashing.

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

13 years ago[analyzer] Migrate VLASizeChecker to CheckerV2.
Argyrios Kyrtzidis [Mon, 28 Feb 2011 01:27:54 +0000 (01:27 +0000)]
[analyzer] Migrate VLASizeChecker to CheckerV2.

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

13 years ago[analyzer] Migrate DivZeroChecker to CheckerV2.
Argyrios Kyrtzidis [Mon, 28 Feb 2011 01:27:50 +0000 (01:27 +0000)]
[analyzer] Migrate DivZeroChecker to CheckerV2.

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

13 years ago[analyzer] Migrate ReturnUndefChecker to CheckerV2.
Argyrios Kyrtzidis [Mon, 28 Feb 2011 01:27:46 +0000 (01:27 +0000)]
[analyzer] Migrate ReturnUndefChecker to CheckerV2.

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

13 years ago[analyzer] Migrate UndefinedArraySubscriptChecker to CheckerV2.
Argyrios Kyrtzidis [Mon, 28 Feb 2011 01:27:41 +0000 (01:27 +0000)]
[analyzer] Migrate UndefinedArraySubscriptChecker to CheckerV2.

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

13 years ago[analyzer] Migrate UndefinedAssignmentChecker to CheckerV2.
Argyrios Kyrtzidis [Mon, 28 Feb 2011 01:27:37 +0000 (01:27 +0000)]
[analyzer] Migrate UndefinedAssignmentChecker to CheckerV2.

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

13 years ago[analyzer] Migrate UndefBranchChecker to CheckerV2.
Argyrios Kyrtzidis [Mon, 28 Feb 2011 01:27:33 +0000 (01:27 +0000)]
[analyzer] Migrate UndefBranchChecker to CheckerV2.

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

13 years ago[analyzer] Migrate UndefCapturedBlockVarChecker to CheckerV2.
Argyrios Kyrtzidis [Mon, 28 Feb 2011 01:27:26 +0000 (01:27 +0000)]
[analyzer] Migrate UndefCapturedBlockVarChecker to CheckerV2.

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

13 years ago[analyzer] Migrate UndefResultChecker to CheckerV2.
Argyrios Kyrtzidis [Mon, 28 Feb 2011 01:27:22 +0000 (01:27 +0000)]
[analyzer] Migrate UndefResultChecker to CheckerV2.

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

13 years ago[analyzer] Migrate NoReturnFunctionChecker to CheckerV2.
Argyrios Kyrtzidis [Mon, 28 Feb 2011 01:27:17 +0000 (01:27 +0000)]
[analyzer] Migrate NoReturnFunctionChecker to CheckerV2.

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

13 years ago[analyzer] Move the DeadStores checker out of the 'core' package.
Argyrios Kyrtzidis [Mon, 28 Feb 2011 01:27:12 +0000 (01:27 +0000)]
[analyzer] Move the DeadStores checker out of the 'core' package.

-Now it gets enabled with '-analyzer-checker=DeadStores'.
-The driver passes the above flag by default.

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

13 years ago[analyzer] Migrate BuiltinFunctionChecker to CheckerV2.
Argyrios Kyrtzidis [Mon, 28 Feb 2011 01:27:07 +0000 (01:27 +0000)]
[analyzer] Migrate BuiltinFunctionChecker to CheckerV2.

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

13 years ago[analyzer] Migrate OSAtomicChecker to CheckerV2.
Argyrios Kyrtzidis [Mon, 28 Feb 2011 01:27:02 +0000 (01:27 +0000)]
[analyzer] Migrate OSAtomicChecker to CheckerV2.

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

13 years ago[analyzer] Migrate ArrayBoundCheckerV2 to CheckerV2.
Argyrios Kyrtzidis [Mon, 28 Feb 2011 01:26:57 +0000 (01:26 +0000)]
[analyzer] Migrate ArrayBoundCheckerV2 to CheckerV2.

Turns -analyzer-check-buffer-overflows into -analyzer-checker=core.experimental.Overflow

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

13 years ago[analyzer] Turn -analyzer-stats into -analyzer-checker=debug.Stats
Argyrios Kyrtzidis [Mon, 28 Feb 2011 01:26:50 +0000 (01:26 +0000)]
[analyzer] Turn -analyzer-stats into -analyzer-checker=debug.Stats

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

13 years ago[analyzer] Remove '-analyzer-experimental-checks' flag.
Argyrios Kyrtzidis [Mon, 28 Feb 2011 01:26:43 +0000 (01:26 +0000)]
[analyzer] Remove '-analyzer-experimental-checks' flag.

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

13 years ago[analyzer] Migrate MallocChecker to CheckerV2.
Argyrios Kyrtzidis [Mon, 28 Feb 2011 01:26:35 +0000 (01:26 +0000)]
[analyzer] Migrate MallocChecker to CheckerV2.

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

13 years ago[analyzer] Have CheckerManager::registerChecker return a pointer to the checker objec...
Argyrios Kyrtzidis [Mon, 28 Feb 2011 01:26:28 +0000 (01:26 +0000)]
[analyzer] Have CheckerManager::registerChecker return a pointer to the checker object and
only allow a checker to be registered once.

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

13 years agoremove a bogus assertion, add a comment.
Chris Lattner [Mon, 28 Feb 2011 01:06:02 +0000 (01:06 +0000)]
remove a bogus assertion, add a comment.

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

13 years agomake switch condition constant folding much more aggressive, handling
Chris Lattner [Mon, 28 Feb 2011 01:02:29 +0000 (01:02 +0000)]
make switch condition constant folding much more aggressive, handling
compound statements and break statements.  This implements enough to
handle PR9322 and rdar://6970405.

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

13 years agoFactor code out into a helper function, shouldUseExceptionTablesForObjCExceptions.
Anders Carlsson [Mon, 28 Feb 2011 00:44:51 +0000 (00:44 +0000)]
Factor code out into a helper function, shouldUseExceptionTablesForObjCExceptions.

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

13 years agofix my containsBreak predicate.
Chris Lattner [Mon, 28 Feb 2011 00:42:31 +0000 (00:42 +0000)]
fix my containsBreak predicate.

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

13 years agoAdd -fcxx-exceptions to all tests that use C++ exceptions.
Anders Carlsson [Mon, 28 Feb 2011 00:40:07 +0000 (00:40 +0000)]
Add -fcxx-exceptions to all tests that use C++ exceptions.

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

13 years agoGet rid of the areExceptionsEnabled() getter from LangOptions.
Anders Carlsson [Mon, 28 Feb 2011 00:33:03 +0000 (00:33 +0000)]
Get rid of the areExceptionsEnabled() getter from LangOptions.

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

13 years agoFirst tiny step to implementing PR9322: build infrastructure for only emitting the
Chris Lattner [Mon, 28 Feb 2011 00:22:07 +0000 (00:22 +0000)]
First tiny step to implementing PR9322: build infrastructure for only emitting the
live case of a switch statement when switching on a constant.  This is terribly
limited, but enough to handle the trivial example included.  Before we would
emit:

define void @test1(i32 %i) nounwind {
entry:
  %i.addr = alloca i32, align 4
  store i32 %i, i32* %i.addr, align 4
  switch i32 1, label %sw.epilog [
    i32 1, label %sw.bb
  ]

sw.bb:                                            ; preds = %entry
  %tmp = load i32* %i.addr, align 4
  %inc = add nsw i32 %tmp, 1
  store i32 %inc, i32* %i.addr, align 4
  br label %sw.epilog

sw.epilog:                                        ; preds = %sw.bb, %entry
  switch i32 0, label %sw.epilog3 [
    i32 1, label %sw.bb1
  ]

sw.bb1:                                           ; preds = %sw.epilog
  %tmp2 = load i32* %i.addr, align 4
  %add = add nsw i32 %tmp2, 2
  store i32 %add, i32* %i.addr, align 4
  br label %sw.epilog3

sw.epilog3:                                       ; preds = %sw.bb1, %sw.epilog
  ret void
}

now we emit:

define void @test1(i32 %i) nounwind {
entry:
  %i.addr = alloca i32, align 4
  store i32 %i, i32* %i.addr, align 4
  %tmp = load i32* %i.addr, align 4
  %inc = add nsw i32 %tmp, 1
  store i32 %inc, i32* %i.addr, align 4
  ret void
}

This improves -O0 compile time (less IR to generate and shove through the code
generator) and the clever linux kernel people found a way to fail to build if we
don't do this optimization.  This step isn't enough to handle the kernel case
though.

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

13 years agoAdd some helper methods that will be used in my next patch.
Chris Lattner [Mon, 28 Feb 2011 00:18:40 +0000 (00:18 +0000)]
Add some helper methods that will be used in my next patch.

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

13 years agotidy up
Chris Lattner [Mon, 28 Feb 2011 00:18:06 +0000 (00:18 +0000)]
tidy up

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

13 years agoadd a const version of this accessor.
Chris Lattner [Mon, 28 Feb 2011 00:17:41 +0000 (00:17 +0000)]
add a const version of this accessor.

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

13 years agoWhen we encounter a dependent template name within a
Douglas Gregor [Mon, 28 Feb 2011 00:04:36 +0000 (00:04 +0000)]
When we encounter a dependent template name within a
nested-name-specifier, e.g.,

  T::template apply<U>::

represent the dependent template name specialization as a
DependentTemplateSpecializationType, rather than a
TemplateSpecializationType with a dependent TemplateName.

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

13 years agoChange the interface to ConstantFoldsToSimpleInteger to not encode
Chris Lattner [Sun, 27 Feb 2011 23:02:32 +0000 (23:02 +0000)]
Change the interface to ConstantFoldsToSimpleInteger to not encode
a bool + success into one tri-state integer, simplifying things.

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

13 years agoEliminate a silly little Parse/Sema dance when parsing typename
Douglas Gregor [Sun, 27 Feb 2011 22:46:49 +0000 (22:46 +0000)]
Eliminate a silly little Parse/Sema dance when parsing typename
specifiers such as

  typename T::template apply<U>

Previously, we would turn T::template apply<U> into a
TemplateSpecializationType. Then, we'd reprocess that
TemplateSpecializationType and turn it into either a
TemplateSpecializationType wrapped in an ElaboratedType (when we could
resolve "apply" to a template declaration) or a
DependentTemplateSpecializationType. We now produce the same ASTs but
without generating the intermediate TemplateSpecializationType.

The end goal here is to avoid generating TemplateSpecializationTypes
with dependent template-names, ever. We're not there yet.

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

13 years agoFix an obvious typo.
Benjamin Kramer [Sun, 27 Feb 2011 18:07:41 +0000 (18:07 +0000)]
Fix an obvious typo.

GCC -Waddress warns about this but clang doesn't (PR9043).

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

13 years agoCMake: updated list of installable header files. PR9321.
Oscar Fuentes [Sun, 27 Feb 2011 13:33:31 +0000 (13:33 +0000)]
CMake: updated list of installable header files. PR9321.

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

13 years agoFix this test case for CMake builds after r126502, which sneakily changed the actual...
Frits van Bommel [Sun, 27 Feb 2011 01:17:12 +0000 (01:17 +0000)]
Fix this test case for CMake builds after r126502, which sneakily  changed the actual executable name to clang-<version>.

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

13 years agocc1: Fix stats printing by default when using -mllvm -stats.
Daniel Dunbar [Sat, 26 Feb 2011 23:17:25 +0000 (23:17 +0000)]
cc1: Fix stats printing by default when using -mllvm -stats.

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

13 years agoImplement delegating constructors partially.
Sean Hunt [Sat, 26 Feb 2011 19:13:13 +0000 (19:13 +0000)]
Implement delegating constructors partially.

This successfully performs constructor lookup and verifies that a
delegating initializer is the only initializer present.

This does not perform loop detection in the initialization, but it also
doesn't codegen delegating constructors at all, so this won't cause
runtime infinite loops yet.

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

13 years agoDon't assume that whoever is asking for a message send is going
John McCall [Sat, 26 Feb 2011 09:48:59 +0000 (09:48 +0000)]
Don't assume that whoever is asking for a message send is going
to give us a non-null return slot.

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

13 years agoZero-initialize the struct-return slot of an Objective-C message
John McCall [Sat, 26 Feb 2011 09:12:15 +0000 (09:12 +0000)]
Zero-initialize the struct-return slot of an Objective-C message
send before making the call.  Fixes rdar://problem/7854674

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

13 years agoA much-delayed response to Ken Dyck's review: make this somewhat more
John McCall [Sat, 26 Feb 2011 08:41:59 +0000 (08:41 +0000)]
A much-delayed response to Ken Dyck's review:  make this somewhat more
char-width agnostic.

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

13 years agoDon't crash during constant-evaluation of 1/(1/0). PR9262.
John McCall [Sat, 26 Feb 2011 08:27:17 +0000 (08:27 +0000)]
Don't crash during constant-evaluation of 1/(1/0).  PR9262.

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

13 years agoPretty up the emission of field l-values and use volatile and TBAA when
John McCall [Sat, 26 Feb 2011 08:07:02 +0000 (08:07 +0000)]
Pretty up the emission of field l-values and use volatile and TBAA when
loading references as part of that.  Use 'char' TBAA when accessing
(immediate!) fields of a may_alias struct;  fixes PR9307.

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

13 years agoProvide a bit saying that a builtin undergoes custom type-checking, then
John McCall [Sat, 26 Feb 2011 05:39:39 +0000 (05:39 +0000)]
Provide a bit saying that a builtin undergoes custom type-checking, then
don't let calls to such functions go down the normal type-checking path.
Test this out with __builtin_classify_type and __builtin_constant_p.

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

13 years agoFix objc rewriting bug casting to qualified objective-c pointetr.
Fariborz Jahanian [Sat, 26 Feb 2011 01:31:36 +0000 (01:31 +0000)]
Fix objc rewriting bug casting to qualified objective-c pointetr.
// rdar://9056351

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