]> granicus.if.org Git - clang/log
clang
12 years agoA little more elaborate test for r148243
Fariborz Jahanian [Mon, 16 Jan 2012 18:07:45 +0000 (18:07 +0000)]
A little more elaborate test for r148243

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

12 years agoPatch for r148243 which was left behind.
Fariborz Jahanian [Mon, 16 Jan 2012 17:52:22 +0000 (17:52 +0000)]
Patch for r148243 which was left behind.

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

12 years agoFixes a crash during constant folding of a switch and case
Fariborz Jahanian [Mon, 16 Jan 2012 17:35:57 +0000 (17:35 +0000)]
Fixes a crash during constant folding of a switch and case
statement which has an unscoped case inside it.
Patch by Aaron Ballman

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

12 years agoSome improvements to the handling of C11 atomic types:
David Chisnall [Mon, 16 Jan 2012 17:27:18 +0000 (17:27 +0000)]
Some improvements to the handling of C11 atomic types:

- Add atomic-to/from-nonatomic cast types
- Emit atomic operations for arithmetic on atomic types
- Emit non-atomic stores for initialisation of atomic types, but atomic stores and loads for every other store / load
- Add a __atomic_init() intrinsic which does a non-atomic store to an _Atomic() type.  This is needed for the corresponding C11 stdatomic.h function.
- Enables the relevant __has_feature() checks.  The feature isn't 100% complete yet, but it's done enough that we want people testing it.

Still to do:

- Make the arithmetic operations on atomic types (e.g. Atomic(int) foo = 1; foo++;) use the correct LLVM intrinsic if one exists, not a loop with a cmpxchg.
- Add a signal fence builtin
- Properly set the fenv state in atomic operations on floating point values
- Correctly handle things like _Atomic(_Complex double) which are too large for an atomic cmpxchg on some platforms (this requires working out what 'correctly' means in this context)
- Fix the many remaining corner cases

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

12 years agoRefactor variables unused under non-assert builds.
David Blaikie [Mon, 16 Jan 2012 05:16:03 +0000 (05:16 +0000)]
Refactor variables unused under non-assert builds.

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

12 years agoNow that deserializing a definition of a C++ class/Objective-C
Douglas Gregor [Sun, 15 Jan 2012 18:17:48 +0000 (18:17 +0000)]
Now that deserializing a definition of a C++ class/Objective-C
class/Objective-C protocol suffices get all of the redeclarations of
that declaration wired to the definition, we no longer need to record
the identity of the definition in every declaration. Instead, just
record a bit to indicate whether a particular declaration is the
definition.

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

12 years agoWhen deserializing the definition of a C++ class/ObjC class/ObjC
Douglas Gregor [Sun, 15 Jan 2012 18:08:05 +0000 (18:08 +0000)]
When deserializing the definition of a C++ class/ObjC class/ObjC
protocol, record the definition pointer in the canonical declaration
for that entity, and then propagate that definition pointer from the
canonical declaration to all other deserialized declarations. This
approach works well even when deserializing declarations that didn't
know about the original definition, which can occur with modules.

A nice bonus from this definition-deserialization approach is that we
no longer need update records when a definition is added, because the
redeclaration chains ensure that the if any declaration is loaded, the
definition will also get loaded.

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

12 years agoCompletely re-implement (de-)serialization of redeclaration
Douglas Gregor [Sun, 15 Jan 2012 16:58:34 +0000 (16:58 +0000)]
Completely re-implement (de-)serialization of redeclaration
chains, again. The prior implementation was very linked-list oriented, and
the list-splicing logic was both fairly convoluted (when loading from
multiple modules) and failed to preserve a reasonable ordering for the
redeclaration chains.

This new implementation uses a simpler strategy, where we store the
ordered redeclaration chains in an array-like structure (indexed based
on the first declaration), and use that ordering to add individual
deserialized declarations to the end of the existing chain. That way,
the chain mimics the ordering from its modules, and a bug somewhere is
far less likely to result in a broken linked list.

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

12 years agoTweak markup.
Benjamin Kramer [Sun, 15 Jan 2012 16:42:14 +0000 (16:42 +0000)]
Tweak markup.

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

12 years agoadded descriptions of vector extensions, info about vector literals and vector operat...
Anton Yartsev [Sun, 15 Jan 2012 16:22:24 +0000 (16:22 +0000)]
added descriptions of vector extensions, info about vector literals and vector operations.

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

12 years agoFix ALL the markup.
Benjamin Kramer [Sun, 15 Jan 2012 15:26:07 +0000 (15:26 +0000)]
Fix ALL the markup.

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

12 years agoTwo variables had been added for an assert, but their values were
Chandler Carruth [Sun, 15 Jan 2012 09:03:45 +0000 (09:03 +0000)]
Two variables had been added for an assert, but their values were
re-computed rather than the variables be re-used just after the assert.
Just use the variables since we have them already. Fixes an unused
variable warning.

Also fix an 80-column violation.

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

12 years agodecltype(e) is type-dependent if e is instantiation-dependent. Scary but true.
Richard Smith [Sun, 15 Jan 2012 06:24:57 +0000 (06:24 +0000)]
decltype(e) is type-dependent if e is instantiation-dependent. Scary but true.
Don't consider decltype(e) for an instantiation-dependent, but not
type-dependent, e to be non-type-dependent but canonical(!).

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

12 years agoPedantic diagnostic correction: in C++, we have integral constant expressions,
Richard Smith [Sun, 15 Jan 2012 03:51:30 +0000 (03:51 +0000)]
Pedantic diagnostic correction: in C++, we have integral constant expressions,
not integer constant expressions. In passing, fix the 'folding is an extension'
diagnostic to not claim we're accepting the code, since that's not true in
-pedantic-errors mode, and add this diagnostic to -Wgnu.

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

12 years agoconstexpr: casts to void* are allowed in constant expressions, don't set the
Richard Smith [Sun, 15 Jan 2012 03:25:41 +0000 (03:25 +0000)]
constexpr: casts to void* are allowed in constant expressions, don't set the
designator invalid. (Since we can't read the value of such a pointer, this only
affects the quality of diagnostics.)

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

12 years agoChange linkage computation so it doesn't depend on FunctionDecl::isExternC or VarDecl...
Eli Friedman [Sun, 15 Jan 2012 01:23:58 +0000 (01:23 +0000)]
Change linkage computation so it doesn't depend on FunctionDecl::isExternC or VarDecl::isExternC, and instead queries what it actually cares about: whether the given declaration is inside an extern "C" context.  Fundamentally, figuring out whether a function/variable uses C linkage requires knowing the linkage, and the logic in FunctionDecl::isExternC and VarDecl::isExternC was getting it wrong.  Given that, fix FunctionDecl::isExternC and VarDecl::isExternC to use much simpler implementations that depend on the fixed linkage computation.

Fixes a regression to test/SemaCXX/linkage.cpp caused by a new warning exposing the fact that the internal state was wrong.

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

12 years agoUse a smaller vector than SmallVector.
Benjamin Kramer [Sat, 14 Jan 2012 21:05:10 +0000 (21:05 +0000)]
Use a smaller vector than SmallVector.

Shrinks OverloadCandidate from 208 to 168 bytes.

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

12 years agoClear ImplicitConversionSequence the obvious way which turns out to be less fragile.
Benjamin Kramer [Sat, 14 Jan 2012 20:16:52 +0000 (20:16 +0000)]
Clear ImplicitConversionSequence the obvious way which turns out to be less fragile.

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

12 years agoGive OverloadCandidateSet the responsibility for destroying the implicit conversion...
Benjamin Kramer [Sat, 14 Jan 2012 19:31:39 +0000 (19:31 +0000)]
Give OverloadCandidateSet the responsibility for destroying the implicit conversion sequences so we don't get double frees when the vector reallocates.

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

12 years agoobjc: disallow __block attribute on method params.
Fariborz Jahanian [Sat, 14 Jan 2012 18:44:35 +0000 (18:44 +0000)]
objc: disallow __block attribute on method params.

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

12 years agoReorder initializers, make use of the whole array.
Benjamin Kramer [Sat, 14 Jan 2012 17:59:15 +0000 (17:59 +0000)]
Reorder initializers, make use of the whole array.

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

12 years agoMove the inline array to the end.
Benjamin Kramer [Sat, 14 Jan 2012 17:23:10 +0000 (17:23 +0000)]
Move the inline array to the end.

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

12 years agoDestroy OverloadCandidates before taking away the underlying memory.
Benjamin Kramer [Sat, 14 Jan 2012 17:10:59 +0000 (17:10 +0000)]
Destroy OverloadCandidates before taking away the underlying memory.

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

12 years agoReplace a using declararion with a typedef in the hope of satisfying GCC
Douglas Gregor [Sat, 14 Jan 2012 16:48:12 +0000 (16:48 +0000)]
Replace a using declararion with a typedef in the hope of satisfying GCC

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

12 years agoDe-virtualize getPreviousDecl() and getMostRecentDecl() when we know
Douglas Gregor [Sat, 14 Jan 2012 16:38:05 +0000 (16:38 +0000)]
De-virtualize getPreviousDecl() and getMostRecentDecl() when we know
we have a redeclarable type, and only use the new virtual versions
(getPreviousDeclImpl() and getMostRecentDeclImpl()) when we don't have
that type information. This keeps us from penalizing users with strict
type information (and is the moral equivalent of a "final" method).

Plus, settle on the names getPreviousDecl() and getMostRecentDecl()
throughout.

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

12 years agoPool allocate ImplicitConversionSequences.
Benjamin Kramer [Sat, 14 Jan 2012 16:32:05 +0000 (16:32 +0000)]
Pool allocate ImplicitConversionSequences.

To avoid malloc thrashing give OverloadCandidateSet an inline capacity for conversion sequences.
We use the fact that OverloadCandidates never outlive the OverloadCandidateSet and have a fixed
amount of conversion sequences.

This eliminates the oversized SmallVector from OverloadCandidate shrinking it from 752 to 208 bytes.

On the test case from the "Why is CLANG++ so freaking slow" thread on llvmdev this avoids one gig
of vector reallocation (including memcpy) which translates into 5-10% speedup on Lion/x86_64.

Overload candidate computation is still the biggest malloc contributor when compiling templated
c++ code.

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

12 years agoOverloadCandidateSet: Stop exposing SmallVector internals
Benjamin Kramer [Sat, 14 Jan 2012 16:31:55 +0000 (16:31 +0000)]
OverloadCandidateSet: Stop exposing SmallVector internals

Replace push_back with addCandidate which will let us make use of the fixed size of
the conversion sequence vector soon.

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

12 years agoIntroduce Decl::getPreviousDecl() and Decl::getMostRecentDecl(),
Douglas Gregor [Sat, 14 Jan 2012 15:55:47 +0000 (15:55 +0000)]
Introduce Decl::getPreviousDecl() and Decl::getMostRecentDecl(),
virtual functions that provide previous/most recent redeclaration
information for any declaration. Use this to eliminate the redundant,
less efficient getPreviousDecl() functions.

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

12 years agoRevert accidental commit
Douglas Gregor [Sat, 14 Jan 2012 15:31:52 +0000 (15:31 +0000)]
Revert accidental commit

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

12 years agoAdd a FIXME for mutation of the common pointer of a RedeclarableTemplateDecl. It...
Douglas Gregor [Sat, 14 Jan 2012 15:30:55 +0000 (15:30 +0000)]
Add a FIXME for mutation of the common pointer of a RedeclarableTemplateDecl. It is not clear that it's worth delaying the allocation of said pointer

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

12 years agoReimplement RedeclarableTemplateDecl in terms of
Douglas Gregor [Sat, 14 Jan 2012 15:13:49 +0000 (15:13 +0000)]
Reimplement RedeclarableTemplateDecl in terms of
Redeclarable<RedeclarableTemplateDecl>, eliminating a bunch of
redeclaration-chain logic both in RedeclarableTemplateDecl and
especially in its (de-)serialization.

As part of this, eliminate the RedeclarableTemplate<> class template,
which was an abstraction that didn't actually save anything.

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

12 years agoRemove a redundant word.
Zhongxing Xu [Sat, 14 Jan 2012 09:08:15 +0000 (09:08 +0000)]
Remove a redundant word.

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

12 years agoconstexpr irgen: Add irgen support for APValue::Struct, APValue::Union,
Richard Smith [Sat, 14 Jan 2012 04:30:29 +0000 (04:30 +0000)]
constexpr irgen: Add irgen support for APValue::Struct, APValue::Union,
APValue::Array and APValue::MemberPointer. All APValue values can now be emitted
as constants.

Add new CGCXXABI entry point for emitting an APValue MemberPointer. The other
entrypoints dealing with constant member pointers are no longer necessary and
will be removed in a later change.

Switch codegen from using EvaluateAsRValue/EvaluateAsLValue to
VarDecl::evaluateValue. This performs caching and deals with the nasty cases in
C++11 where a non-const object's initializer can refer indirectly to
previously-initialized fields within the same object.

Building the intermediate APValue object incurs a measurable performance hit on
pathological testcases with huge initializer lists, so we continue to build IR
directly from the Expr nodes for array and record types outside of C++11.

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

12 years ago[analyzer] Taint: add system and popen as undesirable sinks for taint
Anna Zaks [Sat, 14 Jan 2012 02:48:40 +0000 (02:48 +0000)]
[analyzer] Taint: add system and popen as undesirable sinks for taint
data.

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

12 years ago[libclang] If CXIndexOpt_IndexFunctionLocalSymbols is enabled, also
Argyrios Kyrtzidis [Sat, 14 Jan 2012 02:05:51 +0000 (02:05 +0000)]
[libclang] If CXIndexOpt_IndexFunctionLocalSymbols is enabled, also
index parameters.

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

12 years agoRemember if a type has its visibility set explicitly or implicitly.
Rafael Espindola [Sat, 14 Jan 2012 00:30:36 +0000 (00:30 +0000)]
Remember if a type has its visibility set explicitly or implicitly.
With that, centralize the way we merge visibility, always preferring explicit over
implicit and then picking the most restrictive one.
Fixes pr10113 and pr11690.

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

12 years agoFix 80-column violation.
Chad Rosier [Sat, 14 Jan 2012 00:30:11 +0000 (00:30 +0000)]
Fix 80-column violation.

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

12 years ago[libclang] Add CXIndexOpt_IndexFunctionLocalSymbols indexing option to indicate
Argyrios Kyrtzidis [Sat, 14 Jan 2012 00:11:49 +0000 (00:11 +0000)]
[libclang] Add CXIndexOpt_IndexFunctionLocalSymbols indexing option to indicate
that one wants indexing callbacks for function-local symbols as well.

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

12 years ago(Implicit) parameters deserialized as part of a function type must not
Douglas Gregor [Fri, 13 Jan 2012 23:49:34 +0000 (23:49 +0000)]
(Implicit) parameters deserialized as part of a function type must not
get added to the identifier chains as part of deserialization, because
they should not be visible to name lookup.

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

12 years agoProgress towards making isUsed() reflect whether a declaration is odr-used; don't...
Eli Friedman [Fri, 13 Jan 2012 23:41:25 +0000 (23:41 +0000)]
Progress towards making isUsed() reflect whether a declaration is odr-used; don't set isUsed for local variables which are referenced in unevaluated contexts.  Make other code use isReferenced() (which basically indicates that a declaration isn't dead) where appropriate.

I was forced to change test/SemaCXX/linkage.cpp because we aren't actually modeling extern "C" in the AST the way that testcase expects; we were not printing a warning only because we skipped the relevant check.  Someone who actually understands the semantics here should fix that.

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

12 years agoFix a silly mistake in ComplexExprEvaluator::ZeroInitialization. <rdar://problem...
Eli Friedman [Fri, 13 Jan 2012 23:34:56 +0000 (23:34 +0000)]
Fix a silly mistake in ComplexExprEvaluator::ZeroInitialization.  <rdar://problem/10691092>.

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

12 years agoConvert SemaTemplate*.cpp to pass a callback object to CorrectTypo.
Kaelyn Uhrain [Fri, 13 Jan 2012 23:10:36 +0000 (23:10 +0000)]
Convert SemaTemplate*.cpp to pass a callback object to CorrectTypo.

The change to SemaTemplateVariadic.cpp improves the typo correction
results in certain situations, while the change to SemaTemplate.cpp
does not change existing behavior.

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

12 years agoMake sure to consider non-DeclContext scopes properly when finding
Douglas Gregor [Fri, 13 Jan 2012 23:06:53 +0000 (23:06 +0000)]
Make sure to consider non-DeclContext scopes properly when finding
multiple name lookup results in C/Objective-C. Fixes a regression a
caused in r147533, found by Enea Zaffanella!

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

12 years agoWhen inferring a module for a framework, first determine whether that
Douglas Gregor [Fri, 13 Jan 2012 22:31:52 +0000 (22:31 +0000)]
When inferring a module for a framework, first determine whether that
framework is actually a subframework within a top-level framework. If
so, only infer a module for the top-level framework and then dig out
the appropriate submodule.

This helps us cope with an amusing subframeworks anti-pattern, where
one uses -F <framework>/Frameworks to get direct include access to the
subframeworks of a framework (which otherwise would not be
permitted).

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

12 years agoMove identification of memory setting and copying functions (memset,
Anna Zaks [Fri, 13 Jan 2012 21:52:01 +0000 (21:52 +0000)]
Move identification of memory setting and copying functions (memset,
memcmp, strncmp,..) out of Sema and into FunctionDecl so that the logic
could be reused in the analyzer.

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

12 years agoRevert r148138; it's causing test failures.
Eli Friedman [Fri, 13 Jan 2012 21:33:06 +0000 (21:33 +0000)]
Revert r148138; it's causing test failures.

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

12 years agoConvert SemaExprMember.cpp to pass a callback object to CorrectTypo,
Kaelyn Uhrain [Fri, 13 Jan 2012 21:28:55 +0000 (21:28 +0000)]
Convert SemaExprMember.cpp to pass a callback object to CorrectTypo,
improving the typo correction results in certain situations.

This is also the first typo correction callback conversion to affect
an existing unit test. :)

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

12 years agoremove assertions in the Hexagon backend specific clang driver
Sebastian Pop [Fri, 13 Jan 2012 20:37:10 +0000 (20:37 +0000)]
remove assertions in the Hexagon backend specific clang driver

Patch from Jyotsna Verma:

I have made the changes to remove assertions in the Hexagon backend
specific clang driver. Instead of asserting on invalid arch name, it has
been modified to use the default value.

I have changed the implementation of the CPU flag validation for the
Hexagon backend. Earlier, the clang driver performed the check and
asserted on invalid inputs. In the new implementation, the driver passes
the last CPU flag (or sets to "v4" if not specified) to the compiler (and
also to the assembler and linker which perform their own check) instead of
asserting on incorrect values. This patch changes the setCPU function for
the Hexagon backend in clang/lib/Basic/Targets.cpp which causes the
compiler to error out on incorrect CPU flag values.

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

12 years agorename -ccc-host-triple into -target
Sebastian Pop [Fri, 13 Jan 2012 20:37:02 +0000 (20:37 +0000)]
rename -ccc-host-triple into -target

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

12 years agorename DefaultHostTriple into DefaultTargetTriple
Sebastian Pop [Fri, 13 Jan 2012 20:36:46 +0000 (20:36 +0000)]
rename DefaultHostTriple into DefaultTargetTriple

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

12 years agoRefactor for clarity.
Richard Smith [Fri, 13 Jan 2012 19:34:55 +0000 (19:34 +0000)]
Refactor for clarity.

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

12 years agoReinstate test case accidentally reverted by r148028
Douglas Gregor [Fri, 13 Jan 2012 16:56:26 +0000 (16:56 +0000)]
Reinstate test case accidentally reverted by r148028

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

12 years agoDon't infer a submodule for a framework's private header, at least for now.
Douglas Gregor [Fri, 13 Jan 2012 16:54:27 +0000 (16:54 +0000)]
Don't infer a submodule for a framework's private header, at least for now.

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

12 years agoRemove --hash-style from link command on Android.
Evgeniy Stepanov [Fri, 13 Jan 2012 09:30:38 +0000 (09:30 +0000)]
Remove --hash-style from link command on Android.

Gnu hash is not supported by the Android loader.

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

12 years agoCodeInit was replaced by StringInit.
Jakob Stoklund Olesen [Fri, 13 Jan 2012 04:57:47 +0000 (04:57 +0000)]
CodeInit was replaced by StringInit.

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

12 years agoPR11754: Reject non-static constexpr member functions in classes with virtual
Richard Smith [Fri, 13 Jan 2012 04:54:00 +0000 (04:54 +0000)]
PR11754: Reject non-static constexpr member functions in classes with virtual
base classes.

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

12 years agoA base subobject type doesn't make sense for unions; don't try to compute it. Based...
Eli Friedman [Fri, 13 Jan 2012 03:58:31 +0000 (03:58 +0000)]
A base subobject type doesn't make sense for unions; don't try to compute it.  Based on patch by Yin Ma.  Fixes PR11751.

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

12 years agoconstexpr is allowed on static member functions of non-literal classes. Per report...
Eli Friedman [Fri, 13 Jan 2012 02:31:53 +0000 (02:31 +0000)]
constexpr is allowed on static member functions of non-literal classes.  Per report on cfe-dev.

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

12 years agoA few minor improvements to error recovery trying to access member of a function...
Eli Friedman [Fri, 13 Jan 2012 02:20:01 +0000 (02:20 +0000)]
A few minor improvements to error recovery trying to access member of a function.  In particular, this restores the cool error recovery for the example from http://blog.llvm.org/2010/04/amazing-feats-of-clang-error-recovery.html , which regressed a few months back.

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

12 years agoDon't crash while trying to diagnose a function declared at block scope with an
Richard Smith [Fri, 13 Jan 2012 02:14:39 +0000 (02:14 +0000)]
Don't crash while trying to diagnose a function declared at block scope with an
incomplete return type.

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

12 years agoFix up the calls to CorrectTypo in Sema*ObjC.cpp to use callback
Kaelyn Uhrain [Fri, 13 Jan 2012 01:32:50 +0000 (01:32 +0000)]
Fix up the calls to CorrectTypo in Sema*ObjC.cpp to use callback
objects, and add a basic CorrectionCandidateCallback template class
to simplify the fixups.

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

12 years agoRevert previous commit. Something has gone wonky with my local configuration
Douglas Gregor [Fri, 13 Jan 2012 01:24:11 +0000 (01:24 +0000)]
Revert previous commit. Something has gone wonky with my local configuration

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

12 years agoWhen inferring a module map for a framework, add the 'private'
Douglas Gregor [Fri, 13 Jan 2012 01:20:43 +0000 (01:20 +0000)]
When inferring a module map for a framework, add the 'private'
requirement to headers under PrivateHeaders. We don't want to build
them as part of the module (yet).

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

12 years ago[analyzer] Unwrap the pointers when ignoring the const cast.
Anna Zaks [Fri, 13 Jan 2012 00:56:55 +0000 (00:56 +0000)]
[analyzer] Unwrap the pointers when ignoring the const cast.

radar://10686991

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

12 years ago[analyzer] Taint: when looking up a binding, provide the type.
Anna Zaks [Fri, 13 Jan 2012 00:56:51 +0000 (00:56 +0000)]
[analyzer] Taint: when looking up a binding, provide the type.

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

12 years ago[analyzer] RegionStoreManager::getBinding() should not crash when
Anna Zaks [Fri, 13 Jan 2012 00:56:48 +0000 (00:56 +0000)]
[analyzer] RegionStoreManager::getBinding() should not crash when
looking up value at a CodeTextRegion even when the type is not provided.

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

12 years ago[analyzer] Fix a typo in a warning message.
Anna Zaks [Fri, 13 Jan 2012 00:56:44 +0000 (00:56 +0000)]
[analyzer] Fix a typo in a warning message.

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

12 years agoobjc parsing. Fixes a crash when parsing array initialization
Fariborz Jahanian [Fri, 13 Jan 2012 00:14:12 +0000 (00:14 +0000)]
objc parsing. Fixes a crash when parsing array initialization
inside a class implementation with parse errors. // rdar://10633434

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

12 years agoImprove 0-argument -Wvexing-parse diagnostic by adding notes with fix-its:
Richard Smith [Thu, 12 Jan 2012 23:53:29 +0000 (23:53 +0000)]
Improve 0-argument -Wvexing-parse diagnostic by adding notes with fix-its:

 - If the declarator is at the start of a line, and the previous line contained
   another declarator and ended with a comma, then that comma was probably a
   typo for a semicolon:

   int n = 0, m = 1, l = 2, // k = 5;
   myImportantFunctionCall(); // oops!

 - If removing the parentheses would correctly initialize the object, then
   produce a note suggesting that fix.

 - Otherwise, if there is a simple initializer we can suggest which performs
   value-initialization, then provide a note suggesting a correction to that
   initializer.

Sema::Declarator now tracks the location of the comma prior to the declarator in
the declaration, if there is one, to facilitate providing the note. The code to
determine an appropriate initializer from the -Wuninitialized warning has been
factored out to allow use in both that and -Wvexing-parse.

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

12 years agoRecommit r148056 with fixes to deal with weirdness with bitfields in unions.
Eli Friedman [Thu, 12 Jan 2012 23:48:56 +0000 (23:48 +0000)]
Recommit r148056 with fixes to deal with weirdness with bitfields in unions.

Original message: Make sure adding a field to a struct never reduces its size.  PR11745.

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

12 years agoRevert r148056 while I investigate failures.
Eli Friedman [Thu, 12 Jan 2012 23:27:03 +0000 (23:27 +0000)]
Revert r148056 while I investigate failures.

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

12 years agoRevert accidental commit.
Eli Friedman [Thu, 12 Jan 2012 22:43:19 +0000 (22:43 +0000)]
Revert accidental commit.

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

12 years agoMake sure adding a field to a struct never reduces its size. PR11745.
Eli Friedman [Thu, 12 Jan 2012 22:41:25 +0000 (22:41 +0000)]
Make sure adding a field to a struct never reduces its size.  PR11745.

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

12 years agoAdjust set of default checkers.
Ted Kremenek [Thu, 12 Jan 2012 22:41:10 +0000 (22:41 +0000)]
Adjust set of default checkers.

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

12 years agoIf an ObjCMessageExpr is implicit, there are no source locations for the
Argyrios Kyrtzidis [Thu, 12 Jan 2012 22:34:19 +0000 (22:34 +0000)]
If an ObjCMessageExpr is implicit, there are no source locations for the
selector identifiers.

It was difficult to form a test case for it unfortunately.

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

12 years agoConvert SemaCXXScopeSpec.cpp to pass a callback object to CorrectTypo,
Kaelyn Uhrain [Thu, 12 Jan 2012 22:32:39 +0000 (22:32 +0000)]
Convert SemaCXXScopeSpec.cpp to pass a callback object to CorrectTypo,
improvng the typo correction results in certain situations.

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

12 years agoobjc: do not warn when converting to a const id qualfied by its
Fariborz Jahanian [Thu, 12 Jan 2012 22:12:08 +0000 (22:12 +0000)]
objc: do not warn when converting to a const id qualfied by its
list of protools. // rdar://10669694

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

12 years agoRevert 148045 to fix the bots.
Rafael Espindola [Thu, 12 Jan 2012 21:17:34 +0000 (21:17 +0000)]
Revert 148045 to fix the bots.

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

12 years agoAdd a SONAME to the libclang library.
Rafael Espindola [Thu, 12 Jan 2012 21:04:54 +0000 (21:04 +0000)]
Add a SONAME to the libclang library.
Patch by Sylvestre Ledru.

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

12 years agoConvert SemaInit.cpp to pass a callback object to CorrectTypo.
Kaelyn Uhrain [Thu, 12 Jan 2012 19:27:05 +0000 (19:27 +0000)]
Convert SemaInit.cpp to pass a callback object to CorrectTypo.

And once again improve the typo correction results in certain
situations just by moving the existing checks on the correction.

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

12 years ago[analyzer] fix inlining's handling of mapping actual to formal arguments and limit...
Ted Kremenek [Thu, 12 Jan 2012 19:25:46 +0000 (19:25 +0000)]
[analyzer] fix inlining's handling of mapping actual to formal arguments and limit the call stack depth.  The analyzer can now accurately simulate factorial for limited depths.

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

12 years agoconstexpr: initialization of a union from an empty initializer-list should
Richard Smith [Thu, 12 Jan 2012 18:54:33 +0000 (18:54 +0000)]
constexpr: initialization of a union from an empty initializer-list should
zero-initialize the first union member. Also fix a bug where initializing an
array of types compatible with wchar_t from a wide string literal failed in C,
and fortify the C++ tests in this area. This part can't be tested without a code
change to enable array evaluation in C (where an existing test fails).

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

12 years agoscanf: parse the 'm' length modifier, and check that the right arguments
Hans Wennborg [Thu, 12 Jan 2012 17:11:12 +0000 (17:11 +0000)]
scanf: parse the 'm' length modifier, and check that the right arguments
are used with that and the 'a' length modifier.

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

12 years agoIn Objective-C++, actually compute the base type of a member access
Douglas Gregor [Thu, 12 Jan 2012 16:11:24 +0000 (16:11 +0000)]
In Objective-C++, actually compute the base type of a member access
expression for an Objective-C object or pointer type, so that we don't
attempt to treat the member name as a template. Fixes
<rdar://problem/10672501>.

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

12 years agoscanf analysis: the 'a' length modifier is valid with a scanlist
Hans Wennborg [Thu, 12 Jan 2012 15:07:16 +0000 (15:07 +0000)]
scanf analysis: the 'a' length modifier is valid with a scanlist

Before r148025 we (accidentally) didn't check whether a length modifier is
appropriate for a scanlist, but now we do.

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

12 years agoscanf analysis: don't bail out after successful parse of scanlist
Hans Wennborg [Thu, 12 Jan 2012 14:44:54 +0000 (14:44 +0000)]
scanf analysis: don't bail out after successful parse of scanlist

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

12 years agotest/Driver/debug-options*.c: Tweak r147819 to split out another cc1as-sensitive...
NAKAMURA Takumi [Thu, 12 Jan 2012 06:15:01 +0000 (06:15 +0000)]
test/Driver/debug-options*.c: Tweak r147819 to split out another cc1as-sensitive test. gcc driver is invoked for assembling on cygming.

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

12 years agoRevert accidentally-committed file in r148020.
Richard Smith [Thu, 12 Jan 2012 06:10:09 +0000 (06:10 +0000)]
Revert accidentally-committed file in r148020.

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

12 years agoAllow constant-folding of references which were formed in a manner not permitted
Richard Smith [Thu, 12 Jan 2012 06:08:57 +0000 (06:08 +0000)]
Allow constant-folding of references which were formed in a manner not permitted
in a constant expression, for compatibility with g++.

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

12 years agoAdd IsImplicit field in ObjCMessageExpr that is true when the message
Argyrios Kyrtzidis [Thu, 12 Jan 2012 02:34:39 +0000 (02:34 +0000)]
Add IsImplicit field in ObjCMessageExpr that is true when the message
was constructed, e.g. for a property access.

This allows the selector identifier locations machinery for ObjCMessageExpr
to function correctly, in that there are not real locations to handle/report for
such a message.

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

12 years ago[arcmt] The migrator tests for the buildbot in http://lab.llvm.org:8011/builders...
Argyrios Kyrtzidis [Thu, 12 Jan 2012 02:34:32 +0000 (02:34 +0000)]
[arcmt] The migrator tests for the buildbot in http://lab.llvm.org:8011/builders/clang-native-mingw32-win7/
are messed up, XFAIL does not help. Waiting until DISABLE is supported..

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

12 years ago[analyzer] Rename Store::Retrieve() -> getBinding().
Anna Zaks [Thu, 12 Jan 2012 02:22:40 +0000 (02:22 +0000)]
[analyzer] Rename Store::Retrieve() -> getBinding().

+ all the other Retrieve..() methods + a comment for ElementRegion.

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

12 years ago[analyzer] Add taint transfer by strcpy & others (part 1).
Anna Zaks [Thu, 12 Jan 2012 02:22:34 +0000 (02:22 +0000)]
[analyzer] Add taint transfer by strcpy & others (part 1).

To simplify the process:
Refactor taint generation checker to simplify passing the
information on which arguments need to be tainted from pre to post
visit.

Todo: We need to factor out the code that sema is using to identify the
string and memcpy functions and use it here and in the CString checker.

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

12 years agoFix test case committed in r147986.
Akira Hatanaka [Thu, 12 Jan 2012 01:27:24 +0000 (01:27 +0000)]
Fix test case committed in r147986.

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

12 years agoFormatting.
Eric Christopher [Thu, 12 Jan 2012 01:26:58 +0000 (01:26 +0000)]
Formatting.

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

12 years agoFormatting.
Eric Christopher [Thu, 12 Jan 2012 01:26:51 +0000 (01:26 +0000)]
Formatting.

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

12 years agoTake into account the pointer to an aggregate that is passed as a hidden
Akira Hatanaka [Thu, 12 Jan 2012 01:10:09 +0000 (01:10 +0000)]
Take into account the pointer to an aggregate that is passed as a hidden
argument when Offset is initialized.

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

12 years agoCall CodeGenTypes::ConvertType to get LLVM::Type*.
Akira Hatanaka [Thu, 12 Jan 2012 00:52:17 +0000 (00:52 +0000)]
Call CodeGenTypes::ConvertType to get LLVM::Type*.
Remove function MipsABIInfo::GetFloatingPointTy.

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

12 years agoFix some edge cases with C++ casts and placeholder expressions.
Eli Friedman [Thu, 12 Jan 2012 00:44:34 +0000 (00:44 +0000)]
Fix some edge cases with C++ casts and placeholder expressions.

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

12 years agoobjective-c: fixes a regression in looking up names
Fariborz Jahanian [Thu, 12 Jan 2012 00:18:35 +0000 (00:18 +0000)]
objective-c: fixes a regression in looking up names
in class extensions and categories by recent refactoring
of objc class ASTs. // rdar://1066654

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