]> granicus.if.org Git - clang/log
clang
14 years agoDereferencing NULL pointers is such poor form.
Douglas Gregor [Mon, 16 Aug 2010 16:46:30 +0000 (16:46 +0000)]
Dereferencing NULL pointers is such poor form.

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

14 years agosupport for vec_add, vec_adds, vec_and, vec_andc with bool arguments
Anton Yartsev [Mon, 16 Aug 2010 16:22:12 +0000 (16:22 +0000)]
support for vec_add, vec_adds, vec_and, vec_andc with bool arguments

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

14 years agoWhen caching global completion results, keep track of the simplified
Douglas Gregor [Mon, 16 Aug 2010 16:18:59 +0000 (16:18 +0000)]
When caching global completion results, keep track of the simplified
type class, so that we can adjust priorities appropriately when the
preferred type for the context and the actual type of the completion
are similar.

This gets us one step closer to parity of the cached completion
results with the non-cached completion results.

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

14 years agoFixed typo in conj, conjf, conjl signature.
Abramo Bagnara [Mon, 16 Aug 2010 15:57:05 +0000 (15:57 +0000)]
Fixed typo in conj, conjf, conjl signature.

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

14 years agoModel the effects of strcpy() and stpcpy() in CStringChecker. Other changes:
Jordy Rose [Mon, 16 Aug 2010 07:51:42 +0000 (07:51 +0000)]
Model the effects of strcpy() and stpcpy() in CStringChecker. Other changes:
- Fix memcpy() and friends to actually invalidate the destination buffer.
- Emit a different message for out-of-bounds buffer accesses if the buffer is being written to.
- When conjuring symbols, let ValueManager figure out the type.

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

14 years agoError out if reinterpret_casting between member pointers of two different
Charles Davis [Mon, 16 Aug 2010 05:30:44 +0000 (05:30 +0000)]
Error out if reinterpret_casting between member pointers of two different
sizes.

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

14 years agoErr on incomplete class types in member pointers when compiling for the
Charles Davis [Mon, 16 Aug 2010 04:01:50 +0000 (04:01 +0000)]
Err on incomplete class types in member pointers when compiling for the
Microsoft C++ ABI, for now.

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

14 years agoImplement support for member pointers under the Microsoft C++ ABI in the
Charles Davis [Mon, 16 Aug 2010 03:33:14 +0000 (03:33 +0000)]
Implement support for member pointers under the Microsoft C++ ABI in the
AST library.

This also adds infrastructure for supporting multiple C++ ABIs in the AST.

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

14 years ago- Allow making ElementRegions with complex offsets (expressions or symbols) for the...
Jordy Rose [Mon, 16 Aug 2010 01:15:17 +0000 (01:15 +0000)]
- Allow making ElementRegions with complex offsets (expressions or symbols) for the purpose of bounds-checking.
- Rewrite GRState::AssumeInBound to actually do that checking, and to use the normal constraint path.
- Remove ConstraintManager::AssumeInBound.
- Teach RegionStore and FlatStore to ignore those regions for now.

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

14 years agoPass some things to the linker that gcc passes. -r is the only one of these that...
David Chisnall [Sun, 15 Aug 2010 22:58:12 +0000 (22:58 +0000)]
Pass some things to the linker that gcc passes.  -r is the only one of these that I'm sure about, but the others seem to be listed on FreeBSD by gcc -dumpspecs, so I hope they're right.  Apparently -r is also not passed on GNU/Linux (and should be), but I can't see where the toolchain definition for this platform live.

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

14 years agoMove GRState's bind* methods out of its header file -- they're too big for inlining...
Jordy Rose [Sun, 15 Aug 2010 22:19:33 +0000 (22:19 +0000)]
Move GRState's bind* methods out of its header file -- they're too big for inlining now.

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

14 years agoCall the base class in StmtProfiler::VisitOverloadExpr.
Argyrios Kyrtzidis [Sun, 15 Aug 2010 20:53:20 +0000 (20:53 +0000)]
Call the base class in StmtProfiler::VisitOverloadExpr.

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

14 years agoOpen AST/PCH files in binary mode.
Benjamin Kramer [Sun, 15 Aug 2010 16:54:31 +0000 (16:54 +0000)]
Open AST/PCH files in binary mode.

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

14 years agoMake the FixItOptions object required instead of optional.
Nick Lewycky [Sun, 15 Aug 2010 16:47:39 +0000 (16:47 +0000)]
Make the FixItOptions object required instead of optional.

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

14 years agoStoreManager::RemoveDeadBindings() can take a Store instead of an entire GRState...
Zhongxing Xu [Sun, 15 Aug 2010 12:45:09 +0000 (12:45 +0000)]
StoreManager::RemoveDeadBindings() can take a Store instead of an entire GRState now.

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

14 years agoRemove ATTRIBUTE_UNUSED from the common pattern of disallowing copying.
Argyrios Kyrtzidis [Sun, 15 Aug 2010 10:17:39 +0000 (10:17 +0000)]
Remove ATTRIBUTE_UNUSED from the common pattern of disallowing copying.

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

14 years agoDon't warn for the common pattern of disallowing copying:
Argyrios Kyrtzidis [Sun, 15 Aug 2010 10:17:33 +0000 (10:17 +0000)]
Don't warn for the common pattern of disallowing copying:

class S {
  S(const S&); // DO NOT IMPLEMENT
  void operator=(const S&); // DO NOT IMPLEMENT
};

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

14 years agoRemove redundant method.
Zhongxing Xu [Sun, 15 Aug 2010 10:08:38 +0000 (10:08 +0000)]
Remove redundant method.

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

14 years agoImplement MallocChecker::EvalDeadSymbols() with the new API. This time we
Zhongxing Xu [Sun, 15 Aug 2010 08:19:57 +0000 (08:19 +0000)]
Implement MallocChecker::EvalDeadSymbols() with the new API. This time we
iterate over symbols being tracked, instead of symbols being dead.

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

14 years agoExtend the code-completion caching infrastructure to include global
Douglas Gregor [Sun, 15 Aug 2010 06:18:01 +0000 (06:18 +0000)]
Extend the code-completion caching infrastructure to include global
declarations (in addition to macros). Each kind of declaration maps to
a certain set of completion contexts, and the ASTUnit completion logic
introduces the completion strings for those declarations if the actual
code-completion occurs in one of the contexts where it matters.

There are a few new code-completion-context kinds. Without these,
certain completions (e.g., after "using namespace") would need to
suppress all global completions, which would be unfortunate.

Note that we don't get the priorities right for global completions,
because we don't have enough type information. We'll need a way to
compare types in an ASTContext-agnostic way before this can be
implemented.

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

14 years agoUse Enumerators.data() instead of &Enumerators[0] to fix a potential
Eli Friedman [Sun, 15 Aug 2010 02:27:09 +0000 (02:27 +0000)]
Use Enumerators.data() instead of &Enumerators[0] to fix a potential
assertion failure.

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

14 years agoRemove dead code, caught by unused function warnings.
Argyrios Kyrtzidis [Sun, 15 Aug 2010 01:15:58 +0000 (01:15 +0000)]
Remove dead code, caught by unused function warnings.

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

14 years agoDependentTypeOfExprType and DependentDecltypeType are not seen by client code.
Argyrios Kyrtzidis [Sun, 15 Aug 2010 01:15:44 +0000 (01:15 +0000)]
DependentTypeOfExprType and DependentDecltypeType are not seen by client code.

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

14 years agoCall the correct base class in StmtProfiler::VisitUnresolvedLookupExpr.
Argyrios Kyrtzidis [Sun, 15 Aug 2010 01:15:38 +0000 (01:15 +0000)]
Call the correct base class in StmtProfiler::VisitUnresolvedLookupExpr.

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

14 years agoSome refactoring on StmtPrinter to avoid unused function warnings.
Argyrios Kyrtzidis [Sun, 15 Aug 2010 01:15:33 +0000 (01:15 +0000)]
Some refactoring on StmtPrinter to avoid unused function warnings.

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

14 years agoAdd ATTRIBUTE_UNUSED to methods not supposed to be used.
Argyrios Kyrtzidis [Sun, 15 Aug 2010 01:15:27 +0000 (01:15 +0000)]
Add ATTRIBUTE_UNUSED to methods not supposed to be used.

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

14 years agoCommit improved version of 111026 & 111027.
Argyrios Kyrtzidis [Sun, 15 Aug 2010 01:15:20 +0000 (01:15 +0000)]
Commit improved version of 111026 & 111027.

Unused warnings for functions:
-static functions
-functions in anonymous namespace
-class methods in anonymous namespace
-class method specializations in anonymous namespace
-function specializations in anonymous namespace

Unused warnings for variables:
-static variables
-variables in anonymous namespace
-static data members in anonymous namespace
-static data members specializations in anonymous namespace

Reveals lots of opportunities for dead code removal in llvm codebase that will
interest my esteemed colleagues.

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

14 years agoExplicitly handle every case in the switch in RTTIBuilder::BuildTypeInfo.
Eli Friedman [Sun, 15 Aug 2010 00:24:31 +0000 (00:24 +0000)]
Explicitly handle every case in the switch in RTTIBuilder::BuildTypeInfo.

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

14 years agoRemember that FixItOptions* is optional and don't crash when it's not provided.
Nick Lewycky [Sat, 14 Aug 2010 23:03:19 +0000 (23:03 +0000)]
Remember that FixItOptions* is optional and don't crash when it's not provided.

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

14 years agoUpdate CStringChecker to take advantage of the new metadata symbols and region change...
Jordy Rose [Sat, 14 Aug 2010 21:02:52 +0000 (21:02 +0000)]
Update CStringChecker to take advantage of the new metadata symbols and region change callback. Now does basic tracking of string length for general regions. Currently this is still only used for modeling strlen().

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

14 years agoPR7884: Fix the implementations of __real__ and __imag__ on real floats.
Eli Friedman [Sat, 14 Aug 2010 20:52:13 +0000 (20:52 +0000)]
PR7884: Fix the implementations of __real__ and __imag__ on real floats.

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

14 years agoAdd a test for alloca region extents.
Jordy Rose [Sat, 14 Aug 2010 20:46:10 +0000 (20:46 +0000)]
Add a test for alloca region extents.

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

14 years agoAdd a callback for when region changes occur. Still somewhat of a work-in-progress...
Jordy Rose [Sat, 14 Aug 2010 20:44:32 +0000 (20:44 +0000)]
Add a callback for when region changes occur. Still somewhat of a work-in-progress, but working! Effect on clients: all changes to a store now go through GRState.

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

14 years agoAnother metadata symbol change (missed a file)
Jordy Rose [Sat, 14 Aug 2010 20:22:12 +0000 (20:22 +0000)]
Another metadata symbol change (missed a file)

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

14 years agoAdd a new metadata symbol type for checkers to use. Metadata symbols must be associat...
Jordy Rose [Sat, 14 Aug 2010 20:18:45 +0000 (20:18 +0000)]
Add a new metadata symbol type for checkers to use. Metadata symbols must be associated with a region and will be collected if the region dies or its checker fails to mark it as in use.

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

14 years agoMore cleanup enabling.
John McCall [Sat, 14 Aug 2010 07:46:19 +0000 (07:46 +0000)]
More cleanup enabling.

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

14 years agoPR3344: Downgrade "too many braces around scalar initializer" to a warning.
Eli Friedman [Sat, 14 Aug 2010 03:14:53 +0000 (03:14 +0000)]
PR3344: Downgrade "too many braces around scalar initializer" to a warning.

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

14 years agoAlways recurse into sub-cursors when annotating tokens, as this information is used...
Ted Kremenek [Sat, 14 Aug 2010 02:50:46 +0000 (02:50 +0000)]
Always recurse into sub-cursors when annotating tokens, as this information is used for annotating macro arguments.  This finishes up <rdar://problem/8044584>.

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

14 years agoDriver: Increase flags to hold all necessary bits.
Daniel Dunbar [Sat, 14 Aug 2010 02:19:45 +0000 (02:19 +0000)]
Driver: Increase flags to hold all necessary bits.

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

14 years agoAs a heuristic, annotate tokens (via clang_annotateTokens) that are the arguments...
Ted Kremenek [Sat, 14 Aug 2010 01:14:06 +0000 (01:14 +0000)]
As a heuristic, annotate tokens (via clang_annotateTokens) that are the arguments of a macro instantiation using the closest cursor with the same spelling location.  Because macro arguments can get token pasted in any arbitrary order, we use the annotation map to paper over the token -> cursor annotations during our post-processing stage.  This fixes most of <rdar://problem/8044584>, but still doesn't work for assert().

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

14 years agoImplement caching of code-completion results for macro definitions
Douglas Gregor [Fri, 13 Aug 2010 22:48:40 +0000 (22:48 +0000)]
Implement caching of code-completion results for macro definitions
when the CXTranslationUnit_CacheCompletionResults option is given to
clang_parseTranslationUnit(). Essentially, we compute code-completion
results for macro definitions after we have parsed the file, then
store an ASTContext-agnostic version of those results (completion
string, cursor kind, priority, and active contexts) in the
ASTUnit. When performing code completion in that ASTUnit, we splice
the macro definition results into the results provided by the actual
code-completion (which has had macros turned off) before libclang gets
those results. We use completion context information to only splice in
those results that make sense for that context.

With a completion involving all of the macros from Cocoa.h and a few other
system libraries (totally ~8500 macro definitions) living in a
precompiled header, we get about a 9% performance improvement from
code completion, since we no longer have to deserialize all of the
macro definitions from the precompiled header.

Note that macro definitions are merely the canary; the cache is
designed to also support other top-level declarations, which should be
a bigger performance win. That optimization will be next.

Note also that there is no mechanism for determining when to throw
away the cache and recompute its contents.

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

14 years agoSketch out a framework for delaying the activation of a cleanup.
John McCall [Fri, 13 Aug 2010 21:20:51 +0000 (21:20 +0000)]
Sketch out a framework for delaying the activation of a cleanup.
Not yet complete or used.

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

14 years agoRevert 111026 & 111027, build breakage.
Argyrios Kyrtzidis [Fri, 13 Aug 2010 20:13:06 +0000 (20:13 +0000)]
Revert 111026 & 111027, build breakage.

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

14 years agoThe unused warnings extravaganza continues. Warn for:
Argyrios Kyrtzidis [Fri, 13 Aug 2010 18:42:40 +0000 (18:42 +0000)]
The unused warnings extravaganza continues. Warn for:

-static variables
-variables in anonymous namespace (fixes rdar://7794535)
-static data members in anonymous namespace
-static data members specializations in anonymous namespace

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

14 years agoExpand the unused warnings for functions. Warn for:
Argyrios Kyrtzidis [Fri, 13 Aug 2010 18:42:29 +0000 (18:42 +0000)]
Expand the unused warnings for functions. Warn for:

-static function declarations
-functions in anonymous namespace
-class methods in anonymous namespace
-class method specializations in anonymous namespace
-function specializations in anonymous namespace

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

14 years agoChange Sema's UnusedStaticFuncs to UnusedFileScopedDecls to allow also keeping track...
Argyrios Kyrtzidis [Fri, 13 Aug 2010 18:42:17 +0000 (18:42 +0000)]
Change Sema's UnusedStaticFuncs to UnusedFileScopedDecls to allow also keeping track of unused file scoped variables.

    This is only preparation, currently only static function definitions are tracked, as before.

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

14 years agoWhen issuing warning for future conflict resolution,
Fariborz Jahanian [Fri, 13 Aug 2010 18:09:39 +0000 (18:09 +0000)]
When issuing warning for future conflict resolution,
(nonfragile-abi2), do not consider 'ivar' access
in class methods. Also, improve on diagnostics.
Radar 8304561.

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

14 years agoAdd a new cc1 option -fix-what-you-can which when combined with the fix-it mode
Nick Lewycky [Fri, 13 Aug 2010 17:31:00 +0000 (17:31 +0000)]
Add a new cc1 option -fix-what-you-can which when combined with the fix-it mode
will apply all fixes even when there were other errors in the file.

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

14 years agoAdd an options parameter to clang_saveTranslationUnit, because we'll want it later
Douglas Gregor [Fri, 13 Aug 2010 15:35:05 +0000 (15:35 +0000)]
Add an options parameter to clang_saveTranslationUnit, because we'll want it later

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

14 years agoFixed NNS insertion in MemberPointerType.
Abramo Bagnara [Fri, 13 Aug 2010 12:56:25 +0000 (12:56 +0000)]
Fixed NNS insertion in MemberPointerType.

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

14 years agoProperly give unique-external linkage to members of member templates
John McCall [Fri, 13 Aug 2010 08:35:10 +0000 (08:35 +0000)]
Properly give unique-external linkage to members of member templates
instantiated with unique-external parameters.

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

14 years agoFix the help text on -Wwrite-strings.
John McCall [Fri, 13 Aug 2010 07:05:45 +0000 (07:05 +0000)]
Fix the help text on -Wwrite-strings.

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

14 years agoWork around a crash when checking access to injected class names
John McCall [Fri, 13 Aug 2010 07:02:08 +0000 (07:02 +0000)]
Work around a crash when checking access to injected class names
qua templates.  The current fix suppresses the access check entirely
in this case;  to do better, we'd need to be able to say that a
particular lookup result came from a particular injected class name,
which is not easy to do with the current representation of LookupResult.
This is on my known-problems list.

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

14 years agoImplement clang_saveTranslationUnit(), which saves a translation unit
Douglas Gregor [Fri, 13 Aug 2010 05:36:37 +0000 (05:36 +0000)]
Implement clang_saveTranslationUnit(), which saves a translation unit
into a PCH/AST file.

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

14 years agoDriver/OptParser: Add a NoForward flag to prevent forwarding certain options to
Daniel Dunbar [Fri, 13 Aug 2010 04:44:20 +0000 (04:44 +0000)]
Driver/OptParser: Add a NoForward flag to prevent forwarding certain options to
GCC.
 - Mark -Xclang and -mlinker-version= with it for now, although I am sure there
   are more.

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

14 years agoTeach ASTUnit to hold on to the Sema object and ASTConsumer that are
Douglas Gregor [Fri, 13 Aug 2010 03:15:25 +0000 (03:15 +0000)]
Teach ASTUnit to hold on to the Sema object and ASTConsumer that are
used when parsing (or re-parsing) a file. Also, when loading a
precompiled header into ASTUnit, create a Sema object that holds onto
semantic-analysis information.

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

14 years agoMake two methods have compatible signatures with the methods they override.
John McCall [Fri, 13 Aug 2010 03:01:11 +0000 (03:01 +0000)]
Make two methods have compatible signatures with the methods they override.

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

14 years agoPerform access control when template lookup finds a class template.
John McCall [Fri, 13 Aug 2010 02:23:42 +0000 (02:23 +0000)]
Perform access control when template lookup finds a class template.
This is *really* hacky.

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

14 years agoZap unused UnaryOperator::OffsetOf.
Eli Friedman [Fri, 13 Aug 2010 01:36:11 +0000 (01:36 +0000)]
Zap unused UnaryOperator::OffsetOf.

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

14 years agoThe Sema object will get destroyed before all of the others anyway. We don't need...
Douglas Gregor [Fri, 13 Aug 2010 00:52:31 +0000 (00:52 +0000)]
The Sema object will get destroyed before all of the others anyway. We don't need to force it

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

14 years agoInstead of modifying the ObjC AST to not modify existing declarations, teach chained...
Sebastian Redl [Fri, 13 Aug 2010 00:28:03 +0000 (00:28 +0000)]
Instead of modifying the ObjC AST to not modify existing declarations, teach chained PCH to overwrite declarations from earlier PCH files in dependent ones. Tell Sema to note when it changes AST nodes so that they have to be reserialized. Finally, the ObjCProtocolDecls created in forward decls, like the ObjCInterfaceDecls in @class forward decls, are not lexically part of the decl context; only the definition is.

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

14 years agoMake use of __func__ in a block actually refer to
Fariborz Jahanian [Fri, 13 Aug 2010 00:19:55 +0000 (00:19 +0000)]
Make use of __func__ in a block actually refer to
block's helper function. Fixes radar 7860965.

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

14 years agoJust disable the hidden-visibility optimization for now by hiding it behind
John McCall [Thu, 12 Aug 2010 23:36:15 +0000 (23:36 +0000)]
Just disable the hidden-visibility optimization for now by hiding it behind
a -cc1 option.  The Darwin linker complains about mixed visibility when linking
gcc-built objects with clang-built objects, and the optimization isn't really
that valuable.  Platforms with less ornery linkers can feel free to enable this.

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

14 years agoTeach CompilerInstance to create and hold on to the Sema object used
Douglas Gregor [Thu, 12 Aug 2010 23:31:19 +0000 (23:31 +0000)]
Teach CompilerInstance to create and hold on to the Sema object used
for parsing, so that it can persist beyond the lifetime of the parsing
call.

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

14 years agoSmall changes to UnreachableCodeChecker
Tom Care [Thu, 12 Aug 2010 23:01:06 +0000 (23:01 +0000)]
Small changes to UnreachableCodeChecker
- Added detection of Empty CFGBlocks (artificial blocks)
- Relaxed an assertion based on an incorrect assumption until further investigation

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

14 years agoAdd a ParseAST overload that takes a Sema object, so that the caller
Douglas Gregor [Thu, 12 Aug 2010 22:51:45 +0000 (22:51 +0000)]
Add a ParseAST overload that takes a Sema object, so that the caller
can create (and hold on to) the Sema object. Also, move Sema-related
initialization/finalization with its various consumers and external
sources into the Sema constructor and destructor, rather than placing
it in ParseAST.

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

14 years agoImproved IdempotentOperationChecker false positives and false negatives.
Tom Care [Thu, 12 Aug 2010 22:45:47 +0000 (22:45 +0000)]
Improved IdempotentOperationChecker false positives and false negatives.
- Unfinished analysis may still report valid warnings if the path was completely analyzed
- New 'CanVary' heuristic to recursively determine if a subexpression has a varying element
- Updated test cases, including one known bug
- Exposed GRCoreEngine through GRExprEngine

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

14 years agoTypo.
Fariborz Jahanian [Thu, 12 Aug 2010 22:33:42 +0000 (22:33 +0000)]
Typo.

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

14 years agoPatch to issue warning when colllection expresion's type
Fariborz Jahanian [Thu, 12 Aug 2010 22:25:42 +0000 (22:25 +0000)]
Patch to issue warning when colllection expresion's type
does not implement 'countByEnumeratingWithState' API.
Implements radar 7634669.

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

14 years agoImplement -Wcast-align. The initial design of this diagnostic diverges
John McCall [Thu, 12 Aug 2010 21:44:57 +0000 (21:44 +0000)]
Implement -Wcast-align.  The initial design of this diagnostic diverges
from GCC's in that we warn on *any* increase in alignment requirements, not
just those that are enforced by hardware.  Please let us know if this causes
major problems for you (which it shouldn't, since it's an optional warning).

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

14 years agoFixing the build isn't good enough; back out r110956 and r110953.
John McCall [Thu, 12 Aug 2010 21:39:05 +0000 (21:39 +0000)]
Fixing the build isn't good enough;  back out r110956 and r110953.

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

14 years agodgregor should write code that compiles.
John McCall [Thu, 12 Aug 2010 21:23:27 +0000 (21:23 +0000)]
dgregor should write code that compiles.

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

14 years agoUpdate Xcode project
Douglas Gregor [Thu, 12 Aug 2010 20:53:33 +0000 (20:53 +0000)]
Update Xcode project

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

14 years agoAdd a ParseAST overload that takes a Sema object, so that the caller
Douglas Gregor [Thu, 12 Aug 2010 20:50:39 +0000 (20:50 +0000)]
Add a ParseAST overload that takes a Sema object, so that the caller
can create (and hold on to) the Sema object. Also, move Sema-related
initialization/finalization with its various consumers and external
sources into the Sema constructor and destructor, rather than placing
it in ParseAST.

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

14 years agoFixes block type matching bug. Radar 8302845.
Fariborz Jahanian [Thu, 12 Aug 2010 20:46:12 +0000 (20:46 +0000)]
Fixes block type matching bug. Radar 8302845.

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

14 years agoMove Sema's headers into include/clang/Sema, renaming a few along the way.
Douglas Gregor [Thu, 12 Aug 2010 20:07:10 +0000 (20:07 +0000)]
Move Sema's headers into include/clang/Sema, renaming a few along the way.

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

14 years agoRevert r110936; this fails on clang-i686-darwin10 too.
Dan Gohman [Thu, 12 Aug 2010 18:57:17 +0000 (18:57 +0000)]
Revert r110936; this fails on clang-i686-darwin10 too.

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

14 years agofirst test commit
Anton Yartsev [Thu, 12 Aug 2010 18:51:55 +0000 (18:51 +0000)]
first test commit

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

14 years agoDowngrade error about nonnull attribute bbeing applied to a function without point...
Douglas Gregor [Thu, 12 Aug 2010 18:48:43 +0000 (18:48 +0000)]
Downgrade  error about nonnull attribute bbeing applied to a function without point arguments to a warning

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

14 years agoMake this test darwin only.
Devang Patel [Thu, 12 Aug 2010 17:42:42 +0000 (17:42 +0000)]
Make this test darwin only.

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

14 years agoDon't emit end-of-file diagnostics like "unterminated conditional" or
Douglas Gregor [Thu, 12 Aug 2010 17:04:55 +0000 (17:04 +0000)]
Don't emit end-of-file diagnostics like "unterminated conditional" or
"unterminated string" when we're performing code completion.

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

14 years agoTemporarily disable this failing test, until it can be properly
Dan Gohman [Thu, 12 Aug 2010 15:19:46 +0000 (15:19 +0000)]
Temporarily disable this failing test, until it can be properly
investigated.

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

14 years agoAdd a comment.
Argyrios Kyrtzidis [Thu, 12 Aug 2010 12:31:25 +0000 (12:31 +0000)]
Add a comment.

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

14 years agoAdded locations and type source info for DeclarationName inside UsingDecl.
Abramo Bagnara [Thu, 12 Aug 2010 11:46:03 +0000 (11:46 +0000)]
Added locations and type source info for DeclarationName inside UsingDecl.

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

14 years agoRemove OwnershipAttr::Kind, since it's essentially redundant with attr::Kind the...
Jordy Rose [Thu, 12 Aug 2010 08:54:03 +0000 (08:54 +0000)]
Remove OwnershipAttr::Kind, since it's essentially redundant with attr::Kind the way it's being used. Also fix isa<OwnershipAttr> support, break more-than-80-char lines, and other miscellaneous ownership attr cleanup.

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

14 years agoTest for rdar://problem/8073696.
John McCall [Thu, 12 Aug 2010 07:31:42 +0000 (07:31 +0000)]
Test for rdar://problem/8073696.

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

14 years agoHandle the obvious case for diagnosing redeclarations of extern "C" functions.
John McCall [Thu, 12 Aug 2010 07:09:11 +0000 (07:09 +0000)]
Handle the obvious case for diagnosing redeclarations of extern "C" functions.

Fixes PR7859.

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

14 years agoActually use reduced set of checkers in EvalAssume.
Jordy Rose [Thu, 12 Aug 2010 04:05:07 +0000 (04:05 +0000)]
Actually use reduced set of checkers in EvalAssume.

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

14 years agoFrontend: Move the bulk of the cc1_main() processing into
Daniel Dunbar [Thu, 12 Aug 2010 02:53:12 +0000 (02:53 +0000)]
Frontend: Move the bulk of the cc1_main() processing into
ExecuteCompilerInvocation in libFrontend.

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

14 years agoclang -cc1: Move real diagnostics client initialization to earlier.
Daniel Dunbar [Thu, 12 Aug 2010 02:53:07 +0000 (02:53 +0000)]
clang -cc1: Move real diagnostics client initialization to earlier.

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

14 years agoBail out of MaybeBindToTemporary if the record type is invalid. Test case
John McCall [Thu, 12 Aug 2010 02:40:37 +0000 (02:40 +0000)]
Bail out of MaybeBindToTemporary if the record type is invalid.  Test case
is 8.5MB, sorry.

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

14 years agoImplement RTTI generation for Objective C types. Fixes PR7864.
John McCall [Thu, 12 Aug 2010 02:17:33 +0000 (02:17 +0000)]
Implement RTTI generation for Objective C types.  Fixes PR7864.

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

14 years agoFix a crash on invalid when declaring an implicit member of a class with an
John McCall [Thu, 12 Aug 2010 00:57:17 +0000 (00:57 +0000)]
Fix a crash on invalid when declaring an implicit member of a class with an
invalid destructor.

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

14 years agoDriver: Use the compile time linker version as the default for -mlinker-version,
Daniel Dunbar [Thu, 12 Aug 2010 00:05:12 +0000 (00:05 +0000)]
Driver: Use the compile time linker version as the default for -mlinker-version,
if detected.
 - This is a hack, we really want the linker version at execution time, but we
   don't have any infrastructure for getting that. Yet.

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

14 years agoEmit debug info for static const class member.
Devang Patel [Thu, 12 Aug 2010 00:02:44 +0000 (00:02 +0000)]
Emit debug info for static const class member.

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

14 years agoupdate test to reflect r110876 change.
Devang Patel [Thu, 12 Aug 2010 00:00:41 +0000 (00:00 +0000)]
update test to reflect r110876 change.

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

14 years agoDon't try to implicitly declare special members of an invalid class.
John McCall [Wed, 11 Aug 2010 23:52:36 +0000 (23:52 +0000)]
Don't try to implicitly declare special members of an invalid class.
Fixes a crash in a rather large and difficult-to-reduce test case.

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

14 years agoFix a bug where child statements could not be identified as being in a CFGBlock in...
Tom Care [Wed, 11 Aug 2010 23:36:58 +0000 (23:36 +0000)]
Fix a bug where child statements could not be identified as being in a CFGBlock in CFGStmtMap::getBlock.

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

14 years agoSwitch on PCH for C++. C++ fans all over the world rejoice.
Argyrios Kyrtzidis [Wed, 11 Aug 2010 23:27:58 +0000 (23:27 +0000)]
Switch on PCH for C++. C++ fans all over the world rejoice.

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

14 years agoDriver/Darwin: Pass -demangle when linking, if the linker supports it.
Daniel Dunbar [Wed, 11 Aug 2010 23:07:50 +0000 (23:07 +0000)]
Driver/Darwin: Pass -demangle when linking, if the linker supports it.

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