]> granicus.if.org Git - clang/log
clang
13 years agoFix the delegating constructors test to not rely on basic block names.
Sean Hunt [Wed, 4 May 2011 00:59:33 +0000 (00:59 +0000)]
Fix the delegating constructors test to not rely on basic block names.

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

13 years agoWhen tag lookup finds something ambiguous, and we're defining a new
Douglas Gregor [Wed, 4 May 2011 00:25:33 +0000 (00:25 +0000)]
When tag lookup finds something ambiguous, and we're defining a new
tag, filter out those ambiguous names that we found if they aren't
within the declaration context where this newly-defined tag will be
visible.

This is basically a hack, because we really need to fix the lookup of
tag declarations in this case to not find things it
shouldn't. However, it's better than what we had before, and it fixes
<rdar://problem/9168556>.

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

13 years agoFix a typo in a test.
Richard Trieu [Wed, 4 May 2011 00:16:24 +0000 (00:16 +0000)]
Fix a typo in a test.
CHEKC -> CHECK

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

13 years agoIntroduce a new libclang API, clang_isFileMultipleIncludeGuarded(),
Douglas Gregor [Wed, 4 May 2011 00:14:37 +0000 (00:14 +0000)]
Introduce a new libclang API, clang_isFileMultipleIncludeGuarded(),
which determines whether a particular file is actually a header that
is intended to be guarded from multiple inclusions within the same
translation unit.

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

13 years agoIntroduce ASTUnit::LoadFromCompilerInvocationAction that allows one to create an...
Argyrios Kyrtzidis [Tue, 3 May 2011 23:26:34 +0000 (23:26 +0000)]
Introduce ASTUnit::LoadFromCompilerInvocationAction that allows one to create an ASTUnit
from a CompilerInvocation along with an ASTFrontendAction to invoke, and without all the goo
about the precompiled preamble.

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

13 years agoEnsure that destructors are properly inovked when an exception leaves
Sean Hunt [Tue, 3 May 2011 23:05:34 +0000 (23:05 +0000)]
Ensure that destructors are properly inovked when an exception leaves
the body of a delegating constructor call.

This means that the delegating constructor implementation should be
complete and correct, though there are some rough edges (diagnostic
quality with the cycle detection and using a deleted destructor).

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

13 years agoOnly the first zero-length bitfield decides alignment of
Fariborz Jahanian [Tue, 3 May 2011 22:07:14 +0000 (22:07 +0000)]
Only the first zero-length bitfield decides alignment of
the followup data member in an ms_struct struct.
// rdar:// 8823265

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

13 years agoMove the AST modifications to after the cycle detection in
Sean Hunt [Tue, 3 May 2011 20:43:02 +0000 (20:43 +0000)]
Move the AST modifications to after the cycle detection in
lib/Sema/SemaDeclCXX.cpp to avoid getting stuck in an infinite loop. See
the comment for more explanation.

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

13 years agoExtend -Wnon-pod-memset to also encompass memcpy() and memmove(),
Douglas Gregor [Tue, 3 May 2011 20:37:33 +0000 (20:37 +0000)]
Extend -Wnon-pod-memset to also encompass memcpy() and memmove(),
checking both the source and the destination operands, renaming the
warning group to -Wnon-pod-memaccess and tweaking the diagnostic text
in the process.

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

13 years agoSilence warnings.
Devang Patel [Tue, 3 May 2011 20:22:16 +0000 (20:22 +0000)]
Silence warnings.

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

13 years agoFinish off rules for z-length bitfields in ms_struct
Fariborz Jahanian [Tue, 3 May 2011 20:21:04 +0000 (20:21 +0000)]
Finish off rules for z-length bitfields in ms_struct
structs. // rdar://8823265

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

13 years agoFix delegating constructors stylistic issues.
Sean Hunt [Tue, 3 May 2011 20:19:28 +0000 (20:19 +0000)]
Fix delegating constructors stylistic issues.

Material bugfixes to come this afternoon.

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

13 years agoSeparate the -Wnon-pod-memset warnings into two separate warnings:
Douglas Gregor [Tue, 3 May 2011 20:05:22 +0000 (20:05 +0000)]
Separate the -Wnon-pod-memset warnings into two separate warnings:
  - a default-on warning for pointers to dynamic classes (= classes with vtables)
  - a default-off warning for other non-POD types

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

13 years agoRemove unused but set variable.
Benjamin Kramer [Tue, 3 May 2011 18:46:17 +0000 (18:46 +0000)]
Remove unused but set variable.

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

13 years agoFix a double free when parsing malformed code. Fixes rdar://9173693.
Argyrios Kyrtzidis [Tue, 3 May 2011 18:45:38 +0000 (18:45 +0000)]
Fix a double free when parsing malformed code. Fixes rdar://9173693.

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

13 years agoWhen parsing a template friend declaration we dropped the template
Chandler Carruth [Tue, 3 May 2011 18:35:10 +0000 (18:35 +0000)]
When parsing a template friend declaration we dropped the template
parameters on the floor in certain cases:
class X {
  template <typename T> friend typename A<T>::Foo;
};

This was parsed as a *non* template friend declaration some how, and
received an ExtWarn. Fixing the parser to actually provide the template
parameters to the freestanding declaration parse triggers the code which
specifically looks for such constructs and hard errors on them.

Along the way, this prevents us from trying to instantiate constructs
like the above inside of a outer template. This is important as loosing
the template parameters means we don't have a well formed declaration
and template instantiation will be unable to rebuild the AST. That fixes
a crash in the GCC test suite.

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

13 years agoOnly check the use of memset() if we're refering to a C function named
Douglas Gregor [Tue, 3 May 2011 18:11:37 +0000 (18:11 +0000)]
Only check the use of memset() if we're refering to a C function named
'memset' with external linkage.

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

13 years agoAdd a few ARM coprocessor builtins. The llvm side of the commit contains the intrinsi...
Bruno Cardoso Lopes [Tue, 3 May 2011 17:29:43 +0000 (17:29 +0000)]
Add a few ARM coprocessor builtins. The llvm side of the commit contains the intrinsics and matching patterns.

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

13 years agoRemove several more rvalue references from swap arguments in libstdc++4.4.
Jeffrey Yasskin [Tue, 3 May 2011 17:28:13 +0000 (17:28 +0000)]
Remove several more rvalue references from swap arguments in libstdc++4.4.

unique_ptr and shared_ptr changes by Daniel Mierswa!

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

13 years agoRemoving strncpy() checking in CString checker for now. Some significant changes...
Lenny Maiorani [Tue, 3 May 2011 16:34:26 +0000 (16:34 +0000)]
Removing strncpy() checking in CString checker for now. Some significant changes need to be made to properly support modeling of it since it potentially leaves strings non-null terminated.

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

13 years agoUpdate metadata id number in string compare check.
Devang Patel [Tue, 3 May 2011 16:19:38 +0000 (16:19 +0000)]
Update metadata id number in string compare check.

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

13 years agoRevert r130750, "Make the mno flags match GCC. Patch by Alexander Best!", it breaks...
Daniel Dunbar [Tue, 3 May 2011 15:34:01 +0000 (15:34 +0000)]
Revert r130750, "Make the mno flags match GCC. Patch by Alexander Best!", it breaks tests.

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

13 years agoMake the mno flags match GCC. Patch by Alexander Best!
Michael J. Spencer [Tue, 3 May 2011 04:35:54 +0000 (04:35 +0000)]
Make the mno flags match GCC. Patch by Alexander Best!

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

13 years agoUse the canonical decl when generating the locations for USRs.
Ted Kremenek [Tue, 3 May 2011 01:33:35 +0000 (01:33 +0000)]
Use the canonical decl when generating the locations for USRs.

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

13 years agoAdded an assert to IntegerLiteral to ensure that the integer type passed in has the...
Richard Trieu [Mon, 2 May 2011 23:00:27 +0000 (23:00 +0000)]
Added an assert to IntegerLiteral to ensure that the integer type passed in has the same size as the APInt passed in.  Also, updated the comments around IntegerLiteral.

Changed the integer type that range-based for-loops used.  Switched to pointer difference type, which satisfies the new assert in IntegerLiteral.

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

13 years agoFunction with internal linkage name do not have mangled name.
Devang Patel [Mon, 2 May 2011 22:49:30 +0000 (22:49 +0000)]
Function with internal linkage name do not have mangled name.

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

13 years agoDo not try to get mangled name of block helpers. Apply a stopgap measure to fix Singl...
Devang Patel [Mon, 2 May 2011 22:37:48 +0000 (22:37 +0000)]
Do not try to get mangled name of block helpers. Apply a stopgap measure to fix SingleSource/UnitTests/block-copied-in-cxxobj compile time crash.

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

13 years agoTweak the retain/release checker to not stop tracking retained objects when calling...
Ted Kremenek [Mon, 2 May 2011 21:21:42 +0000 (21:21 +0000)]
Tweak the retain/release checker to not stop tracking retained objects when calling C++ methods.  This is a temporary solution to prune false positives until we have a general story using annotations.

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

13 years agoAdd the -mstackrealign option which just communicates the need to
Eric Christopher [Mon, 2 May 2011 21:18:22 +0000 (21:18 +0000)]
Add the -mstackrealign option which just communicates the need to
force align the stack to the backend.

Fixes rdar://9289631

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

13 years agoDriver/Darwin: Honor --sysroot= when invoking the linker, on Darwin.
Daniel Dunbar [Mon, 2 May 2011 21:03:47 +0000 (21:03 +0000)]
Driver/Darwin: Honor --sysroot= when invoking the linker, on Darwin.

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

13 years agoFixed test case asserts due to checkin of r130710.
Chad Rosier [Mon, 2 May 2011 20:39:21 +0000 (20:39 +0000)]
Fixed test case asserts due to checkin of r130710.

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

13 years agoEmit debug info for __destroy_helper_block_ and __copy_helper_block.
Devang Patel [Mon, 2 May 2011 20:37:08 +0000 (20:37 +0000)]
Emit debug info for __destroy_helper_block_ and __copy_helper_block.

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

13 years agoSkip extra copy from aggregate where it isn't necessary; rdar://problem/8139919 ...
Eli Friedman [Mon, 2 May 2011 20:24:29 +0000 (20:24 +0000)]
Skip extra copy from aggregate where it isn't necessary; rdar://problem/8139919 .  This shouldn't make much of a difference at -O3, but should substantially reduce the number of generated memcpy's at -O0.

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

13 years agoAugment retain/release checker to not warn about tracked objects passed as arguments...
Ted Kremenek [Mon, 2 May 2011 19:42:42 +0000 (19:42 +0000)]
Augment retain/release checker to not warn about tracked objects passed as arguments to C++ constructors.  This is a stop-gap measure for Objective-C++ code that uses smart pointers to manage reference counts.

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

13 years agoWhen using -std= flag added check to make sure language and standard are compatable
Chad Rosier [Mon, 2 May 2011 19:24:53 +0000 (19:24 +0000)]
When using -std= flag added check to make sure language and standard are compatable

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

13 years agoImplements strncasecmp() checker and simplifies some of the logic around creating...
Lenny Maiorani [Mon, 2 May 2011 19:05:49 +0000 (19:05 +0000)]
Implements strncasecmp() checker and simplifies some of the logic around creating substrings if necessary and calling the appropriate StringRef::compare/compare_lower().

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

13 years agoDon't abuse reinterpret cast to do something the API of PointerUnion
Chandler Carruth [Mon, 2 May 2011 18:54:36 +0000 (18:54 +0000)]
Don't abuse reinterpret cast to do something the API of PointerUnion
provides proper support for. This was caught by
-Wundefined-reinterpret-cast, and I think a reasonable case for it to
warn on.

Also use is<...> instead of dyn_cast<...> when the result isn't needed.

This whole thing should probably switch to using UsuallyTinyPtrVector.

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

13 years agoAdds a test for the command line parser when a quoted string is not closed by a quote.
Manuel Klimek [Mon, 2 May 2011 18:27:26 +0000 (18:27 +0000)]
Adds a test for the command line parser when a quoted string is not closed by a quote.

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

13 years agoAdd a warning for when reinterpret_cast leads to undefined behavior, patch by Richard...
Argyrios Kyrtzidis [Mon, 2 May 2011 18:21:19 +0000 (18:21 +0000)]
Add a warning for when reinterpret_cast leads to undefined behavior, patch by Richard Trieu!

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

13 years agoSwitch CallArgList from an std::pair to a new CallArg struct (which will eventually...
Eli Friedman [Mon, 2 May 2011 18:05:27 +0000 (18:05 +0000)]
Switch CallArgList from an std::pair to a new CallArg struct (which will eventually gain more members). Working towards modifying call emission to avoid unnecessary copies.

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

13 years agoSimplify code a bit by using CallArgList::add. No intended functionality change.
Eli Friedman [Mon, 2 May 2011 17:57:46 +0000 (17:57 +0000)]
Simplify code a bit by using CallArgList::add.  No intended functionality change.

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

13 years agoDisable CFI if not using the integrated assembler. We should probably do this only for
Rafael Espindola [Mon, 2 May 2011 17:43:32 +0000 (17:43 +0000)]
Disable CFI if not using the integrated assembler. We should probably do this only for
OS X, but it is probably not all that important.

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

13 years agoMore rule enforcement of zero bitfields for ms_struct.
Fariborz Jahanian [Mon, 2 May 2011 17:20:56 +0000 (17:20 +0000)]
More rule enforcement of zero bitfields for ms_struct.

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

13 years agolib/Frontend/InitHeaderSearch.cpp: Tweak AddPath() to accept "/foo/bar" (not "X:...
NAKAMURA Takumi [Mon, 2 May 2011 04:50:10 +0000 (04:50 +0000)]
lib/Frontend/InitHeaderSearch.cpp: Tweak AddPath() to accept "/foo/bar" (not "X:\foo\bar") with -isysroot. test/PCH/reloc.c can pass.

FIXME: We should consider better isysroot scheme on Win32 hosts.

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

13 years agotest/CodeGenCXX/vtable-debug-info.cpp: It does not crash on mingw.
NAKAMURA Takumi [Mon, 2 May 2011 04:50:00 +0000 (04:50 +0000)]
test/CodeGenCXX/vtable-debug-info.cpp: It does not crash on mingw.

FIXME: It would crash with -integrated-as. Implement -g on MCCOFF.

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

13 years agotest/CodeGenCXX/debug-info-namespace.cpp: Add explicit -fverbose-asm to cc1 to let...
NAKAMURA Takumi [Mon, 2 May 2011 04:49:53 +0000 (04:49 +0000)]
test/CodeGenCXX/debug-info-namespace.cpp: Add explicit -fverbose-asm to cc1 to let cygming pass.

This test seeks a verbose comment in output. By default, "-integrated-as" sets verbose-asm. Cygming is not ready for -integrated-as yet.

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

13 years agoRemove redeclaration of Invalid. The code that set this to true was updating an
Nick Lewycky [Mon, 2 May 2011 01:48:46 +0000 (01:48 +0000)]
Remove redeclaration of Invalid. The code that set this to true was updating an
Invalid that was never read from again, causing non-type-template-parms to be
marked valid when in fact they weren't.

This was caught by GCC 4.6's -Wunused-but-set-variable warning.

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

13 years agoRemove unused variable spotted by GCC.
Nick Lewycky [Mon, 2 May 2011 01:41:48 +0000 (01:41 +0000)]
Remove unused variable spotted by GCC.

Devang, can we remove this call entirely? If I try that, "make check" passes
but the call has a side-effect of ensuring that the block's context exists in
the debug info. getContextDescriptor() is used in a void context for that side-
effect elsewhere in this file. Please take a look!

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

13 years agoRemove unused variable, but keep function call with side-effect.
Nick Lewycky [Mon, 2 May 2011 01:07:19 +0000 (01:07 +0000)]
Remove unused variable, but keep function call with side-effect.

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

13 years agoI updated this constructor's interface, and didn't have to fix any
Chandler Carruth [Mon, 2 May 2011 01:06:57 +0000 (01:06 +0000)]
I updated this constructor's interface, and didn't have to fix any
callers. Shockingly enough, *there are none*!

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

13 years agoRemove dead variable caught by GCC.
Nick Lewycky [Mon, 2 May 2011 01:06:15 +0000 (01:06 +0000)]
Remove dead variable caught by GCC.

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

13 years agoNuke stale code for separately importing the qualifer -- it's just part
Chandler Carruth [Mon, 2 May 2011 01:01:54 +0000 (01:01 +0000)]
Nuke stale code for separately importing the qualifer -- it's just part
of the QualifierLoc, and that's all we need to import now.

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

13 years agoRemove dead variable, flagged by gcc's -Wunused-but-set-variable.
Nick Lewycky [Mon, 2 May 2011 00:46:56 +0000 (00:46 +0000)]
Remove dead variable, flagged by gcc's -Wunused-but-set-variable.

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

13 years agoRemove dead variable flagged by gcc's -Wunused-but-set-variable. No
Nick Lewycky [Mon, 2 May 2011 00:41:17 +0000 (00:41 +0000)]
Remove dead variable flagged by gcc's -Wunused-but-set-variable. No
functionality change.

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

13 years agoRemove a dead variable flagged by gcc's -Wunused-but-set-variable. No
Nick Lewycky [Mon, 2 May 2011 00:40:24 +0000 (00:40 +0000)]
Remove a dead variable flagged by gcc's -Wunused-but-set-variable. No
functionality change.

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

13 years agoRevise the representation of parameter scope data so that the
John McCall [Mon, 2 May 2011 00:30:12 +0000 (00:30 +0000)]
Revise the representation of parameter scope data so that the
scope depth overlaps with the ObjCDeclQualifier, dropping
memory usage back to previous levels.

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

13 years agoAdd an optional field attached to a DeclRefExpr which points back to the
Chandler Carruth [Sun, 1 May 2011 23:48:14 +0000 (23:48 +0000)]
Add an optional field attached to a DeclRefExpr which points back to the
Decl actually found via name lookup & overload resolution when that Decl
is different from the ValueDecl which is actually referenced by the
expression.

This can be used by AST consumers to correctly attribute references to
the spelling location of a using declaration, and otherwise gain insight
into the name resolution performed by Clang.

The public interface to DRE is kept as narrow as possible: we provide
a getFoundDecl() which always returns a NamedDecl, either the ValueDecl
referenced or the new, more precise NamedDecl if present. This way AST
clients can code against getFoundDecl without know when exactly the AST
has a split representation.

For an example of the data this provides consider:
% cat x.cc
namespace N1 {
  struct S {};
  void f(const S&);
}
void test(N1::S s) {
  f(s);
  using N1::f;
  f(s);
}

% ./bin/clang -fsyntax-only -Xclang -ast-dump x.cc
[...]
void test(N1::S s) (CompoundStmt 0x5b02010 <x.cc:5:20, line:9:1>
  (CallExpr 0x5b01df0 <line:6:3, col:6> 'void'
    (ImplicitCastExpr 0x5b01dd8 <col:3> 'void (*)(const struct N1::S &)' <FunctionToPointerDecay>
      (DeclRefExpr 0x5b01d80 <col:3> 'void (const struct N1::S &)' lvalue Function 0x5b01a20 'f' 'void (const struct N1::S &)'))
    (ImplicitCastExpr 0x5b01e20 <col:5> 'const struct N1::S' lvalue <NoOp>
      (DeclRefExpr 0x5b01d58 <col:5> 'N1::S':'struct N1::S' lvalue ParmVar 0x5b01b60 's' 'N1::S':'struct N1::S')))
  (DeclStmt 0x5b01ee0 <line:7:3, col:14>
    0x5b01e40 "UsingN1::;")
  (CallExpr 0x5b01fc8 <line:8:3, col:6> 'void'
    (ImplicitCastExpr 0x5b01fb0 <col:3> 'void (*)(const struct N1::S &)' <FunctionToPointerDecay>
      (DeclRefExpr 0x5b01f80 <col:3> 'void (const struct N1::S &)' lvalue Function 0x5b01a20 'f' 'void (const struct N1::S &)' (UsingShadow 0x5b01ea0 'f')))
    (ImplicitCastExpr 0x5b01ff8 <col:5> 'const struct N1::S' lvalue <NoOp>
      (DeclRefExpr 0x5b01f58 <col:5> 'N1::S':'struct N1::S' lvalue ParmVar 0x5b01b60 's' 'N1::S':'struct N1::S'))))

Now we can tell that the second call is 'using' (no pun intended) the using
declaration, and *which* using declaration it sees. Without this, we can
mistake calls that go through using declarations for ADL calls, and have no way
to attribute names looked up with using declarations to the appropriate
UsingDecl.

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

13 years agoStore a parameter index and function prototype depth in every
John McCall [Sun, 1 May 2011 22:35:37 +0000 (22:35 +0000)]
Store a parameter index and function prototype depth in every
parameter node and use this to correctly mangle parameter
references in function template signatures.

A follow-up patch will improve the storage usage of these
fields;  here I've just done the lazy thing.

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

13 years agoRemove the NameQualifier struct, which was just a wrapper around
Chandler Carruth [Sun, 1 May 2011 22:14:37 +0000 (22:14 +0000)]
Remove the NameQualifier struct, which was just a wrapper around
NestedNameSpecifierLoc. It predates when we had such an object.

Reference the NNSLoc directly in DREs, and embed it directly into the
MemberNameQualifier struct.

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

13 years agoSeveral cosmetic changes, no functionality changed.
Chandler Carruth [Sun, 1 May 2011 21:55:21 +0000 (21:55 +0000)]
Several cosmetic changes, no functionality changed.

Mostly trailing whitespace so that me editor nuking it doesn't muddy the
waters of subsequent commits that do change functionality.

Also nukes a stray statement that was harmless but redundant that
I introduced in r130666.

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

13 years agoMove the state bits in DeclRefExpr out of the pointer union and into
Chandler Carruth [Sun, 1 May 2011 21:29:53 +0000 (21:29 +0000)]
Move the state bits in DeclRefExpr out of the pointer union and into
a bitfield in the base class. DREs weren't using any bits here past the
normal Expr bits, so we have plenty of room. This makes the common case
of getting a Decl out of a DRE no longer need to do any masking etc.

Also, while here, clean up code to use the accessor methods rather than
directly poking these bits, and provide a nice comment for DREs that
includes the information previously attached to the bits going into the
pointer union.

No functionality changed here, but DREs should be a tad faster now.

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

13 years agoSwitch getAs to castAs (didn't know about this before!) and simplify
Chandler Carruth [Sun, 1 May 2011 21:29:41 +0000 (21:29 +0000)]
Switch getAs to castAs (didn't know about this before!) and simplify
some code.

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

13 years agoRemove a stale comment, it no longer applied after my cleanups.
Chandler Carruth [Sun, 1 May 2011 19:18:02 +0000 (19:18 +0000)]
Remove a stale comment, it no longer applied after my cleanups.

Also fix several misspellings in my comments. I cannot spell, and cannot
even be trusted to ask my editor how to spell apparently.

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

13 years agoFixed source range for extern linkage specification without braces.
Abramo Bagnara [Sun, 1 May 2011 16:25:54 +0000 (16:25 +0000)]
Fixed source range for extern linkage specification without braces.

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

13 years agoAdd r130624 back now that ELF has been fixed to work with -fno-dwarf2-cfi-asm.
Rafael Espindola [Sun, 1 May 2011 15:45:27 +0000 (15:45 +0000)]
Add r130624 back now that ELF has been fixed to work with -fno-dwarf2-cfi-asm.

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

13 years agoBased on the new information in the AST provided by r130628, write
Chandler Carruth [Sun, 1 May 2011 09:53:37 +0000 (09:53 +0000)]
Based on the new information in the AST provided by r130628, write
3 lines of code and improve a bunch of information in the libclang view
of the code.

Updates the two tests that exercise this with the new data, checking
that each new source location actually points back to the declared
template parameter.

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

13 years agoMove several more type traits' implementations into the AST. A few were
Chandler Carruth [Sun, 1 May 2011 09:29:58 +0000 (09:29 +0000)]
Move several more type traits' implementations into the AST. A few were
already present in the AST, and I added the ones that weren't.

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

13 years agoSwitch __is_scalar to use the isScalarType predicate rather than
Chandler Carruth [Sun, 1 May 2011 09:29:55 +0000 (09:29 +0000)]
Switch __is_scalar to use the isScalarType predicate rather than
duplicating its logic.

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

13 years agoHave the array type traits build an expression with type 'size_t'
Chandler Carruth [Sun, 1 May 2011 08:48:21 +0000 (08:48 +0000)]
Have the array type traits build an expression with type 'size_t'
instead of 'int'.

The Embarcadero spec says 'unsigned int', not 'int'. That's what
'size_t' is on Windows, but for Clang using a 'size_t' that can be
larger than int seems more appropriate.

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

13 years agoRemove an inapplicable and completely out of place comment. The type is in fact ...
Chandler Carruth [Sun, 1 May 2011 08:48:19 +0000 (08:48 +0000)]
Remove an inapplicable and completely out of place comment. The type is in fact 'bool'.

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

13 years agoRemove more dead code for emitting diagnostics. The callers of these
Chandler Carruth [Sun, 1 May 2011 08:41:10 +0000 (08:41 +0000)]
Remove more dead code for emitting diagnostics. The callers of these
functions already precluded dependent types from reaching them.

Also change one of the callers to not error when a trait is applied to
a dependent type. This is a perfectly reasonable pattern, and both Unary
and Binary type traits already support dependent types (by populating
the AST with a nonce value).

Remove the actual diagnostic, since these aren't errors.

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

13 years agoImprove traversing of BlockExprs in RecursiveASTVisitor.
Argyrios Kyrtzidis [Sun, 1 May 2011 08:06:46 +0000 (08:06 +0000)]
Improve traversing of BlockExprs in RecursiveASTVisitor.

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

13 years agoSimplify the flow of some of the array type trait code.
Chandler Carruth [Sun, 1 May 2011 07:49:26 +0000 (07:49 +0000)]
Simplify the flow of some of the array type trait code.

Completely remove a switch which selected between the same two types.

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

13 years agoConvert the expression trait evaluation to a static function and
Chandler Carruth [Sun, 1 May 2011 07:44:20 +0000 (07:44 +0000)]
Convert the expression trait evaluation to a static function and
a switch with any default case. This both warns when an enumerator is
missing and asserts if a value sneaks through despite the warning.

While in there fix a bunch of coding style issues with this code.

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

13 years agoRemove the default case from the unary type trait evaluation function,
Chandler Carruth [Sun, 1 May 2011 07:44:17 +0000 (07:44 +0000)]
Remove the default case from the unary type trait evaluation function,
adding an unreachable annotation. Remarkably this one was already
enumarting every trait.

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

13 years agoRemove a few more bogus returns when the switch covers all the
Chandler Carruth [Sun, 1 May 2011 07:23:23 +0000 (07:23 +0000)]
Remove a few more bogus returns when the switch covers all the
enumerators.

Also remove a default that led to llvm_unreachable to make another
switch warn if any enumerators fail to be covered.

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

13 years agoRemove another default and a *completely* bogus return from a switch
Chandler Carruth [Sun, 1 May 2011 07:23:20 +0000 (07:23 +0000)]
Remove another default and a *completely* bogus return from a switch
over type traits.

Add the missing trait from this switch that Clang's warning uncovered.

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

13 years agoMark that this function ends in a covering switch statement with every
Chandler Carruth [Sun, 1 May 2011 07:23:17 +0000 (07:23 +0000)]
Mark that this function ends in a covering switch statement with every
case returning a value.

Silences a GCC warning.

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

13 years agoRemove the type traits UTT_IsLvalueExpr and UTT_IsRvalueExpr.
Chandler Carruth [Sun, 1 May 2011 07:23:14 +0000 (07:23 +0000)]
Remove the type traits UTT_IsLvalueExpr and UTT_IsRvalueExpr.

As might be surmised from their names, these aren't type traits, they're
expression traits. Amazingly enough, they're expression traits that we
have, and fully implement. These "type" traits are even parsed from the
same tokens as the expression traits. Luckily, the parser only tried the
expression trait parsing for these tokens, so this was all just a pile
of dead code.

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

13 years agoFully implement delegating constructors!
Sean Hunt [Sun, 1 May 2011 07:04:31 +0000 (07:04 +0000)]
Fully implement delegating constructors!

As far as I know, this implementation is complete but might be missing a
few optimizations. Exceptions and virtual bases are handled correctly.

Because I'm an optimist, the web page has appropriately been updated. If
I'm wrong, feel free to downgrade its support categories.

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

13 years agoMore cleanup of the type traits implementation.
Chandler Carruth [Sun, 1 May 2011 06:51:22 +0000 (06:51 +0000)]
More cleanup of the type traits implementation.
1) Moved the completeness checking routine above the evaluation routine
   so the reader sees that we do in fact check for complete types when
   necessary.
2) Remove the FIXME comment about not doing this.
3) Make the arguments to the evaluate function agree in order with those
   to the completeness checking function.
4) Completely specify the enumerators for the completeness checking
   function rather than relying on a default.
5) Remove a check for the Borland language to only require complete
   types in a few places. Borland's own documentation doesn't agree with
   this: some of the previously unspecified traits *do* require
   a complete type, some don't.
6) Correctly split the traits which do not require complete types from
   those that do, clarifying comments and citations to the standard or
   other documentation where relevant.

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

13 years agoOrder the type traits according to the standard's listing of unary type
Chandler Carruth [Sun, 1 May 2011 06:11:07 +0000 (06:11 +0000)]
Order the type traits according to the standard's listing of unary type
traits where possible. For the rest, group them and add some
documentation regarding their origins.

No functionality change intended.

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

13 years agoBegin cleaning up type trait expression implementations and settling on
Chandler Carruth [Sun, 1 May 2011 06:11:03 +0000 (06:11 +0000)]
Begin cleaning up type trait expression implementations and settling on
a single pattern for implementing each.

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

13 years agoAdd a triple to this test, otherwise it fails under MSVC because wchar_t is unsigned...
Francois Pichet [Sun, 1 May 2011 04:32:34 +0000 (04:32 +0000)]
Add a triple to this test, otherwise it fails under MSVC because wchar_t is unsigned with the i686-pc-win32 triple.

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

13 years agoImprove the documentation for the two ObjCDeclQualifiers so that I
John McCall [Sun, 1 May 2011 03:04:29 +0000 (03:04 +0000)]
Improve the documentation for the two ObjCDeclQualifiers so that I
stop considering whether I can compress them. :)

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

13 years agoCompress some bits. Only matters for MSVC, or if we ever
John McCall [Sun, 1 May 2011 02:13:58 +0000 (02:13 +0000)]
Compress some bits.  Only matters for MSVC, or if we ever
devirtualize Decl (because bits can't get laid out in base
classes if the base is POD).

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

13 years agoSwitch the interface name for both TemplateTypeParmType and
Chandler Carruth [Sun, 1 May 2011 01:05:51 +0000 (01:05 +0000)]
Switch the interface name for both TemplateTypeParmType and
SubstTemplateTypeParmType to be 'getIdentifier' instead of 'getName' as
it returns an identifier. This makes them more consistent with the
NamedDecl interface.

Also, switch back to using this interface to acquire the indentifier in
TypePrinter.cpp. I missed this in r130628.

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

13 years agoRe-applies the patch first applied way back in r106099, with
Chandler Carruth [Sun, 1 May 2011 00:51:33 +0000 (00:51 +0000)]
Re-applies the patch first applied way back in r106099, with
accompanying fixes to make it work today.

The core of this patch is to provide a link from a TemplateTypeParmType
back to the TemplateTypeParmDecl node which declared it. This in turn
provides much more precise information about the type, where it came
from, and how it functions for AST consumers.

To make the patch work almost a year after its first attempt, it needed
serialization support, and it now retains the old getName() interface.
Finally, it requires us to not attempt to instantiate the type in an
unsupported friend decl -- specifically those coming from template
friend decls but which refer to a specific type through a dependent
name.

A cleaner representation of the last item would be to build
FriendTemplateDecl nodes for these, storing their template parameters
etc, and to perform proper instantation of them like any other template
declaration. They can still be flagged as unsupported for the purpose of
access checking, etc.

This passed an asserts-enabled bootstrap for me, and the reduced test
case mentioned in the original review thread no longer causes issues,
likely fixed at somewhere amidst the 24k revisions that have elapsed.

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

13 years agoRevert the previous patch while I figure out how to make llvm-gcc
Rafael Espindola [Sat, 30 Apr 2011 23:07:10 +0000 (23:07 +0000)]
Revert the previous patch while I figure out how to make llvm-gcc
less agressive about disabling cfi on linux :-(

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

13 years agoUpdate for cfi.
Rafael Espindola [Sat, 30 Apr 2011 22:30:24 +0000 (22:30 +0000)]
Update for cfi.

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

13 years agoRemove unused function.
Benjamin Kramer [Sat, 30 Apr 2011 19:55:59 +0000 (19:55 +0000)]
Remove unused function.

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

13 years agoRemove noisy semicolons.
Benjamin Kramer [Sat, 30 Apr 2011 19:55:55 +0000 (19:55 +0000)]
Remove noisy semicolons.

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

13 years agoPR9792: Make sure to use the right definition of wchar_t when the default
Eli Friedman [Sat, 30 Apr 2011 19:24:24 +0000 (19:24 +0000)]
PR9792: Make sure to use the right definition of wchar_t when the default
wchar_t is an unsigned type.

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

13 years agoSome small improvements to the builtin (-ffreestanding) stdint.h; in
Eli Friedman [Sat, 30 Apr 2011 19:02:59 +0000 (19:02 +0000)]
Some small improvements to the builtin (-ffreestanding) stdint.h; in
particular, make sure to handle WCHAR_MIN correctly.

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

13 years agoPass -fno-dwarf2-cfi-asm and use FileCheck.
Rafael Espindola [Sat, 30 Apr 2011 18:47:32 +0000 (18:47 +0000)]
Pass -fno-dwarf2-cfi-asm and use FileCheck.

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

13 years agoImplement -fno-dwarf2-cfi-asm.
Rafael Espindola [Sat, 30 Apr 2011 18:35:43 +0000 (18:35 +0000)]
Implement -fno-dwarf2-cfi-asm.

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

13 years agoWhen comparing parameters of reference-to-qualified type during
Douglas Gregor [Sat, 30 Apr 2011 17:07:52 +0000 (17:07 +0000)]
When comparing parameters of reference-to-qualified type during
partial ordering of function templates, use a simple superset
relationship rather than the convertibility-implying
isMoreQualifiedThan/compatibilyIncludes relationship. Fixes partial
ordering between references and address-space-qualified references.

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

13 years agoReplace a literal 8 with Context->getCharWidth() in
Ken Dyck [Sat, 30 Apr 2011 16:08:27 +0000 (16:08 +0000)]
Replace a literal 8 with Context->getCharWidth() in
SynthesizeByrefCopyDestroyHelper(). No change in functionality intended.

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

13 years agoMake type-traits reflect that Clang's vectors act like scalar types.
Chandler Carruth [Sat, 30 Apr 2011 10:46:26 +0000 (10:46 +0000)]
Make type-traits reflect that Clang's vectors act like scalar types.

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

13 years agoSwitch the type-trait like APIs on the AST to only check for incomplete
Chandler Carruth [Sat, 30 Apr 2011 10:31:50 +0000 (10:31 +0000)]
Switch the type-trait like APIs on the AST to only check for incomplete
types after looking through arrays. Arrays with an unknown bound seem to
be specifically allowed in the library type traits in C++0x, and GCC's
builtin __is_trivial returns 'true' for the type 'int[]'. Now Clang
agrees with GCC about __is_trivial here.

Also hardens these methods against dependent types by just returning false.

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