]> granicus.if.org Git - clang/log
clang
13 years agoAdd a LangOptions::areExceptionsEnabled and start using it.
Anders Carlsson [Sun, 20 Feb 2011 00:20:27 +0000 (00:20 +0000)]
Add a LangOptions::areExceptionsEnabled and start using it.

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

13 years agoAdd a new ObjCExceptions member variable to LangOptions. This controls whether Object...
Anders Carlsson [Sat, 19 Feb 2011 23:53:54 +0000 (23:53 +0000)]
Add a new ObjCExceptions member variable to LangOptions. This controls whether Objective-C exceptions are enabled or not (they are by default).

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

13 years agoRe-instate r125819 and r125820 with no functionality change
Peter Collingbourne [Sat, 19 Feb 2011 23:03:58 +0000 (23:03 +0000)]
Re-instate r125819 and r125820 with no functionality change

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

13 years agoFix PR9253, allowing attribute(aligned) to reduce the alignment of
Chris Lattner [Sat, 19 Feb 2011 22:55:41 +0000 (22:55 +0000)]
Fix PR9253, allowing attribute(aligned) to reduce the alignment of
a typedef.

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

13 years agoDon't produce "comparison is always (true|false)" warnings when the
Douglas Gregor [Sat, 19 Feb 2011 22:34:59 +0000 (22:34 +0000)]
Don't produce "comparison is always (true|false)" warnings when the
comparison itself is a constant expression. Fixes PR7536.

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

13 years agoimplement a tiny amount of codegen support for gnu array range
Chris Lattner [Sat, 19 Feb 2011 22:28:58 +0000 (22:28 +0000)]
implement a tiny amount of codegen support for gnu array range
designators: allowing codegen when the element initializer is a
constant or something else without a side effect.  This unblocks
enough to let process.c in the linux kernel build, PR9257.

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

13 years agoIn addition to in-class member functions marked with the "used"
Douglas Gregor [Sat, 19 Feb 2011 21:54:50 +0000 (21:54 +0000)]
In addition to in-class member functions marked with the "used"
attribute, we also care about those with the "constructor"
attribute. Fixes PR6521.

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

13 years agoThere's no need to return early if we encounter a try/throw and exceptions are disabled.
Anders Carlsson [Sat, 19 Feb 2011 21:53:09 +0000 (21:53 +0000)]
There's no need to return early if we encounter a try/throw and exceptions are disabled.

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

13 years agoRevert 125820 and 125819 to fix PR9266.
Rafael Espindola [Sat, 19 Feb 2011 21:39:31 +0000 (21:39 +0000)]
Revert 125820 and 125819 to fix PR9266.

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

13 years agoFix some add_dependencies.
Oscar Fuentes [Sat, 19 Feb 2011 21:38:48 +0000 (21:38 +0000)]
Fix some add_dependencies.

The syntax is (add_dependencies target-name depend-target1 ...).

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

13 years agoHandle the resolution of a reference to a function template (which
Douglas Gregor [Sat, 19 Feb 2011 21:32:49 +0000 (21:32 +0000)]
Handle the resolution of a reference to a function template (which
includes explicitly-specified template arguments) to a function
template specialization in cases where no deduction is performed or
deduction fails. Patch by Faisal Vali, fixes PR7505!

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

13 years agoReimplement Token::isAnnotation() using TokenKinds.def. No functionality change.
Peter Collingbourne [Sat, 19 Feb 2011 20:06:59 +0000 (20:06 +0000)]
Reimplement Token::isAnnotation() using TokenKinds.def.  No functionality change.

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

13 years agoDisallow try/catch/throw when exceptions are disabled.
Anders Carlsson [Sat, 19 Feb 2011 19:26:44 +0000 (19:26 +0000)]
Disallow try/catch/throw when exceptions are disabled.

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

13 years agoThe member classes of a current instantiation aren't necessarily a
Douglas Gregor [Sat, 19 Feb 2011 19:24:40 +0000 (19:24 +0000)]
The member classes of a current instantiation aren't necessarily a
current instantiation, even though we have a RecordDecl describing
them. Fixes PR9255.

Amusingly, I've had this patch sitting around for a month or two
because it was "obviously" wrong, but hadn't gotten around to writing
a test case to submit the fix :)

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

13 years agoPass -fexceptions to all tests that use try/catch/throw.
Anders Carlsson [Sat, 19 Feb 2011 19:23:03 +0000 (19:23 +0000)]
Pass -fexceptions to all tests that use try/catch/throw.

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

13 years agoTeach the virtual-functions-without-virtual-destructor warning to only
Douglas Gregor [Sat, 19 Feb 2011 19:14:36 +0000 (19:14 +0000)]
Teach the virtual-functions-without-virtual-destructor warning to only
warn about polymorphic classes (which have virtual functions) rather
than dynamic classes (which are polymorphic or have virtual bases).

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

13 years agoRemove the Fix-It for "main must return 'int'", which is not always
Douglas Gregor [Sat, 19 Feb 2011 19:04:23 +0000 (19:04 +0000)]
Remove the Fix-It for "main must return 'int'", which is not always
correct and is not worth fixing. Fixes PR8396.

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

13 years agoExpand use of CharUnits for alignments further. No change in functionality
Ken Dyck [Sat, 19 Feb 2011 18:58:07 +0000 (18:58 +0000)]
Expand use of CharUnits for alignments further. No change in functionality
intended.

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

13 years agoRevert all of my commits that devirtualized the Decl hierarchy, which
Douglas Gregor [Sat, 19 Feb 2011 18:51:44 +0000 (18:51 +0000)]
Revert all of my commits that devirtualized the Decl hierarchy, which
lead to a serious slowdown (4%) on parsing of Cocoa.h. This memory
optimization should be revisited later, when we have time to look at
the generated code.

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

13 years agoUse PARSE_ARGUMENTS to clean up add_clang_unittest's calling convention.
Jeffrey Yasskin [Sat, 19 Feb 2011 18:06:01 +0000 (18:06 +0000)]
Use PARSE_ARGUMENTS to clean up add_clang_unittest's calling convention.

It would be nice to propagate this into the other functions to replace
LLVM_LINK_COMPONENTS and friends, but I don't plan to do that.

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

13 years ago[analyzer] '-analyzer-check-objc-mem' can go through the llvm/clang codebase without...
Argyrios Kyrtzidis [Sat, 19 Feb 2011 08:03:21 +0000 (08:03 +0000)]
[analyzer] '-analyzer-check-objc-mem' can go through the llvm/clang codebase without crashing; enable it for C++.

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

13 years ago[analyzer] Fix crash when analyzing C++ code.
Argyrios Kyrtzidis [Sat, 19 Feb 2011 08:03:18 +0000 (08:03 +0000)]
[analyzer] Fix crash when analyzing C++ code.

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

13 years agoRemove support and mc from the clang unittests' dependencies because they're not
Jeffrey Yasskin [Sat, 19 Feb 2011 06:07:17 +0000 (06:07 +0000)]
Remove support and mc from the clang unittests' dependencies because they're not
needed or provided by the libraries under test.

The next step is to import http://www.itk.org/Wiki/CMakeMacroParseArguments to
make the empty string parameter unnecessary.

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

13 years agoDriver/Darwin: Support -Wl, with -Xarch_. This doesn't work naturally because of
Daniel Dunbar [Sat, 19 Feb 2011 05:33:51 +0000 (05:33 +0000)]
Driver/Darwin: Support -Wl, with -Xarch_. This doesn't work naturally because of
the special way we model "linker input" arguments.

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

13 years agoUse PointerUnion::getAddrOf instead of messing with PointerUnion & reinterpret_cast.
Argyrios Kyrtzidis [Sat, 19 Feb 2011 04:02:34 +0000 (04:02 +0000)]
Use PointerUnion::getAddrOf instead of messing with PointerUnion & reinterpret_cast.

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

13 years agoChange 'StoreRef' back to 'Store' in GRState, shrinking the size of GRState back...
Ted Kremenek [Sat, 19 Feb 2011 03:56:19 +0000 (03:56 +0000)]
Change 'StoreRef' back to 'Store' in GRState, shrinking the size of GRState back by one pointer.

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

13 years agoFix a -Wuninitialized warning; it's actually a false positive,
John McCall [Sat, 19 Feb 2011 03:13:26 +0000 (03:13 +0000)]
Fix a -Wuninitialized warning;  it's actually a false positive,
but it's not reasonable for the diagnostic to figure that out.
Pointed out by Benjamin Kramer.

Also clarify the logic here.

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

13 years agoWarn about code that uses variables and functions with internal linkage
John McCall [Sat, 19 Feb 2011 02:53:41 +0000 (02:53 +0000)]
Warn about code that uses variables and functions with internal linkage
without defining them.  This should be an error, but I'm paranoid about
"uses" that end up not actually requiring a definition.  I'll revisit later.

Also, teach IR generation to not set internal linkage on variable
declarations, just for safety's sake.  Doing so produces an invalid module
if the variable is not ultimately defined.

Also, fix several places in the test suite where we were using internal
functions without definitions.

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

13 years ago[analyzer] Fix crash when analyzing C++ code.
Argyrios Kyrtzidis [Sat, 19 Feb 2011 01:59:41 +0000 (01:59 +0000)]
[analyzer] Fix crash when analyzing C++ code.

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

13 years agoAdd 'StoreRef' smart pointer to allow more fine-grain memory lifetime control of...
Ted Kremenek [Sat, 19 Feb 2011 01:59:33 +0000 (01:59 +0000)]
Add 'StoreRef' smart pointer to allow more fine-grain memory lifetime control of Store objects.

This yields a minor memory reduction (for larger functions) on Sqlite at the cost of slightly
higher memory usage on some functions because of the increased size of GRState (which can be optimized).

I expect the real memory savings from this enhancement will come when we aggressively
canabilize more of the ExplodedGraph.

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

13 years ago[analyzer] Fix crash when analyzing C++ code.
Argyrios Kyrtzidis [Sat, 19 Feb 2011 01:08:41 +0000 (01:08 +0000)]
[analyzer] Fix crash when analyzing C++ code.

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

13 years ago[analyzer] Disable a test until inlining CXXConstructExprs is fully investigated.
Argyrios Kyrtzidis [Sat, 19 Feb 2011 01:08:37 +0000 (01:08 +0000)]
[analyzer] Disable a test until inlining CXXConstructExprs is fully investigated.

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

13 years agoImprove bool and char integral template argument printing in
Chandler Carruth [Sat, 19 Feb 2011 00:21:00 +0000 (00:21 +0000)]
Improve bool and char integral template argument printing in
diagnostics, resolving PR9227.

Patch originally by Mihai Rusu and Stephen Hines with some minimal style
tweaks from me.

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

13 years agoFix a missed case in the NULL operand to conditional operator
Chandler Carruth [Sat, 19 Feb 2011 00:13:59 +0000 (00:13 +0000)]
Fix a missed case in the NULL operand to conditional operator
diagnostics.

Patch by Stephen Hines.

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

13 years agoUpdate the test error messages to match the update I made to the actual
Chandler Carruth [Sat, 19 Feb 2011 00:12:23 +0000 (00:12 +0000)]
Update the test error messages to match the update I made to the actual
messages.

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

13 years agoFix PR8767, improve diagnostic wording when allocating an object of an
Chandler Carruth [Fri, 18 Feb 2011 23:59:51 +0000 (23:59 +0000)]
Fix PR8767, improve diagnostic wording when allocating an object of an
abstract class type.

Patch by Stephen Hines, with a wording tweak from Doug applied by me.

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

13 years agoInitial steps to improve diagnostics when there is a NULL and
Chandler Carruth [Fri, 18 Feb 2011 23:54:50 +0000 (23:54 +0000)]
Initial steps to improve diagnostics when there is a NULL and
a non-pointer on the two sides of a conditional expression.

Patch by Stephen Hines and Mihai Rusu.

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

13 years agoCheck for NULL child expressions before visiting them, as the first
Chandler Carruth [Fri, 18 Feb 2011 23:42:00 +0000 (23:42 +0000)]
Check for NULL child expressions before visiting them, as the first
thing the visit does is dyn_cast<>, which leads to a nasty segfault.

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

13 years agoWhen code-completing a case statement for a switch on a value of
Douglas Gregor [Fri, 18 Feb 2011 23:30:37 +0000 (23:30 +0000)]
When code-completing a case statement for a switch on a value of
enumeration type, prioritize the enumeration constants and don't
provide completions for any other expressions. Fixes <rdar://problem/7283668>.

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

13 years agoStart using enums from DIBuilder.
Devang Patel [Fri, 18 Feb 2011 23:29:22 +0000 (23:29 +0000)]
Start using enums from DIBuilder.

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

13 years agoMore correct fix for CMake breakage I was seeing, my buildbots use
Daniel Dunbar [Fri, 18 Feb 2011 22:55:32 +0000 (22:55 +0000)]
More correct fix for CMake breakage I was seeing, my buildbots use
LLVM_INCLUDE_TESTS:=OFF, which may no longer be necessary for all I know.

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

13 years agoUpdate text for where to file analyzer bugs.
Ted Kremenek [Fri, 18 Feb 2011 22:42:04 +0000 (22:42 +0000)]
Update text for where to file analyzer bugs.

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

13 years agoTest case for // rdar://8850818
Fariborz Jahanian [Fri, 18 Feb 2011 22:37:54 +0000 (22:37 +0000)]
Test case for // rdar://8850818

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

13 years agoIf -fno-builtin is passed, tell TargetLibraryInfo to
Chris Lattner [Fri, 18 Feb 2011 22:34:47 +0000 (22:34 +0000)]
If -fno-builtin is passed, tell TargetLibraryInfo to
turn off all builtin optimizations.

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

13 years agoSelector::getIdentifierInfoForSlot() can return NULL values, a fact
Douglas Gregor [Fri, 18 Feb 2011 22:29:55 +0000 (22:29 +0000)]
Selector::getIdentifierInfoForSlot() can return NULL values, a fact
that was ignored in a few places (most notably, code
completion). Introduce Selector::getNameForSlot() for the common case
where we only care about the name. Audit all uses of
getIdentifierInfoForSlot(), switching many over to getNameForSlot(),
fixing a few crashers.

Fixed <rdar://problem/8939352>, a code-completion crasher.

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

13 years agoUnbreak CMake build on MSVC9, chapuni please check.
Daniel Dunbar [Fri, 18 Feb 2011 22:24:23 +0000 (22:24 +0000)]
Unbreak CMake build on MSVC9, chapuni please check.

Without this I get:
--
-- Generating done
CMake Error: Unknown Target referenced : check.deps
CMake Error: Target: check-all depends on unknown target: check.deps
--

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

13 years agoinstall a TargetLibraryInfo configured with the appropriate
Chris Lattner [Fri, 18 Feb 2011 22:20:38 +0000 (22:20 +0000)]
install a TargetLibraryInfo configured with the appropriate
target triple.  This would be a decent place to add -fno-builtin
info for example.

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

13 years ago[analyzer] Fix crash when analyzing C++ code.
Argyrios Kyrtzidis [Fri, 18 Feb 2011 21:24:56 +0000 (21:24 +0000)]
[analyzer] Fix crash when analyzing C++ code.

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

13 years agofix rdar://9024687, a crash on invalid that we used to silently ignore.
Chris Lattner [Fri, 18 Feb 2011 21:16:39 +0000 (21:16 +0000)]
fix rdar://9024687, a crash on invalid that we used to silently ignore.

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

13 years ago[analyzer] Fix a crash when analyzing C++ code.
Argyrios Kyrtzidis [Fri, 18 Feb 2011 20:55:19 +0000 (20:55 +0000)]
[analyzer] Fix a crash when analyzing C++ code.

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

13 years agoIntroduce ASTContext::getLogicalOperationType() to return bool or int, depending...
Argyrios Kyrtzidis [Fri, 18 Feb 2011 20:55:15 +0000 (20:55 +0000)]
Introduce ASTContext::getLogicalOperationType() to return bool or int, depending on language.
No functionality change.

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

13 years agoObjective-c armv7 API for atomic properties of
Fariborz Jahanian [Fri, 18 Feb 2011 19:15:13 +0000 (19:15 +0000)]
Objective-c armv7 API for atomic properties of
scalar types. // rdar://7761305

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

13 years agoaccept and ignore a few things for better OpenBSD compatibility,
Chris Lattner [Fri, 18 Feb 2011 17:05:55 +0000 (17:05 +0000)]
accept and ignore a few things for better OpenBSD compatibility,
patch by Amit Kulkarni!

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

13 years ago[Heikki Kultala] This patch contains the ABI changes for the TCE target.
NAKAMURA Takumi [Fri, 18 Feb 2011 08:44:38 +0000 (08:44 +0000)]
[Heikki Kultala] This patch contains the ABI changes for the TCE target.

TCE target has some too strict alignment rules (that the HW really does not require, but which caused problems elsewhere) for data types and an ABI change was decided.

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

13 years agowe now support __label__
Chris Lattner [Fri, 18 Feb 2011 04:12:08 +0000 (04:12 +0000)]
we now support __label__

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

13 years agoImplement C++0x [expr.static.cast]p9, which permits explicitly casting
Douglas Gregor [Fri, 18 Feb 2011 03:01:41 +0000 (03:01 +0000)]
Implement C++0x [expr.static.cast]p9, which permits explicitly casting
a scoped enumeration type to an integral or floating type,
properly. There was an over-eager assertion, and it was missing the
floating-point case.

Fixes PR9107/<rdar://problem/8937402>.

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

13 years agoThe flags we're supposed to write into a byref struct are *not* the
John McCall [Fri, 18 Feb 2011 02:58:31 +0000 (02:58 +0000)]
The flags we're supposed to write into a byref struct are *not* the
_Block_object_* flags;  it's just BLOCK_HAS_COPY_DISPOSE or not.

Also, we don't need to chase forwarding pointers prior to calling
_Block_object_dispose;  _Block_object_dispose in fact already does
this.

rdar://problem/9006315

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

13 years agoWhen building a qualified reference to a member of an anonymous struct
Douglas Gregor [Fri, 18 Feb 2011 02:44:58 +0000 (02:44 +0000)]
When building a qualified reference to a member of an anonymous struct
or union, place the qualifier on the outermost member reference
expression, which actually contains the entity name.

Fixes PR9188/<rdar://problem/8990184>.

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

13 years agoFix assertion failure on -Warray-bounds for 32-bit builds of Clang.
Ted Kremenek [Fri, 18 Feb 2011 02:27:00 +0000 (02:27 +0000)]
Fix assertion failure on -Warray-bounds for 32-bit builds of Clang.

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

13 years agoMove CompilerInstance::LLVMContext and LLVMContext ownership to CodeGenAction
Peter Collingbourne [Fri, 18 Feb 2011 02:25:12 +0000 (02:25 +0000)]
Move CompilerInstance::LLVMContext and LLVMContext ownership to CodeGenAction

This removes the final dependency edge from any lib outside of CodeGen
to core.  As a result we can, and do, trim the dependency on core
from libclang, PrintFunctionNames, the unit tests and c-index-test.
While at it, review and trim other unneeded dependencies.

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

13 years agoMove TargetInfo::adjustInlineAsmType to TargetCodeGenInfo
Peter Collingbourne [Fri, 18 Feb 2011 02:24:56 +0000 (02:24 +0000)]
Move TargetInfo::adjustInlineAsmType to TargetCodeGenInfo

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

13 years agoWhen we're creating an expression for an integral template argument of
Douglas Gregor [Fri, 18 Feb 2011 02:12:44 +0000 (02:12 +0000)]
When we're creating an expression for an integral template argument of
enumeration type, we were generating an integer literal implicitly
casted to the appropriate enumeration type. However, later checks on
that expression would strip the implicit cast.

This commit tweaks the lame hack, by creating an explicit cast instead
of an implicit cast. The right answer is to introduce a
SubstNonTypeTemplateParmExpr expression that acts like the substituted
result. I'll investigate that soon.

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

13 years agoimplement basic support for __label__. I wouldn't be shocked if there are
Chris Lattner [Fri, 18 Feb 2011 02:08:43 +0000 (02:08 +0000)]
implement basic support for __label__.  I wouldn't be shocked if there are
bugs from other clients that don't expect to see a LabelDecl in a DeclStmt,
but if so they should be easy to fix.

This implements most of PR3429 and rdar://8287027

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

13 years agorename test
Chris Lattner [Fri, 18 Feb 2011 02:05:32 +0000 (02:05 +0000)]
rename test

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

13 years agoHandle UsingDecl in CFGRecStmtDeclVisitor.
Argyrios Kyrtzidis [Fri, 18 Feb 2011 01:44:17 +0000 (01:44 +0000)]
Handle UsingDecl in CFGRecStmtDeclVisitor.

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

13 years agoSwitch labels over to using normal name lookup, instead of their
Chris Lattner [Fri, 18 Feb 2011 01:27:55 +0000 (01:27 +0000)]
Switch labels over to using normal name lookup, instead of their
own weird little DenseMap.  Hey look, we now emit unused label
warnings deterministically, amazing.

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

13 years agoUnbreak the MSVC build
Francois Pichet [Fri, 18 Feb 2011 01:25:16 +0000 (01:25 +0000)]
Unbreak the MSVC build
std::make_pair is unreliable under MSVC 2010.

Ref: http://stackoverflow.com/questions/2691680/why-does-visual-studio-2010-throw-this-error-with-boost-1-42-0

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

13 years agobreak testcase over multiple lines to make it easier to read.
Chris Lattner [Fri, 18 Feb 2011 01:25:14 +0000 (01:25 +0000)]
break testcase over multiple lines to make it easier to read.

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

13 years agohandle labeldecls.
Chris Lattner [Fri, 18 Feb 2011 00:52:55 +0000 (00:52 +0000)]
handle labeldecls.

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

13 years agomake block bodies handle undefined labels just like functions.
Chris Lattner [Thu, 17 Feb 2011 23:58:47 +0000 (23:58 +0000)]
make block bodies handle undefined labels just like functions.

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

13 years agoimprove support for big endian targets, fixing PR8171, patch
Chris Lattner [Thu, 17 Feb 2011 22:09:58 +0000 (22:09 +0000)]
improve support for big endian targets, fixing PR8171, patch
by Heikki Kultala!

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

13 years agoCMake: updated source file list.
Oscar Fuentes [Thu, 17 Feb 2011 22:07:39 +0000 (22:07 +0000)]
CMake: updated source file list.

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

13 years agoAdd -Warray-bounds test showing how the warning currently interoperates with macros.
Ted Kremenek [Thu, 17 Feb 2011 21:40:51 +0000 (21:40 +0000)]
Add -Warray-bounds test showing how the warning currently interoperates with macros.

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

13 years ago[analyzer] Use the new registration mechanism for the debugging info "checks".
Argyrios Kyrtzidis [Thu, 17 Feb 2011 21:39:39 +0000 (21:39 +0000)]
[analyzer] Use the new registration mechanism for the debugging info "checks".

The relative checker package is 'debug':

'-dump-live-variables' is replaced by '-analyzer-checker=debug.DumpLiveVars'
'-cfg-view' is replaced by '-analyzer-checker=debug.ViewCFG'
'-cfg-dump' is replaced by '-analyzer-checker=debug.DumpCFG'

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

13 years ago[analyzer] Use the new registration mechanism on the non-path-sensitive-checkers:
Argyrios Kyrtzidis [Thu, 17 Feb 2011 21:39:33 +0000 (21:39 +0000)]
[analyzer] Use the new registration mechanism on the non-path-sensitive-checkers:

  DeadStoresChecker
  ObjCMethSigsChecker
  ObjCUnusedIvarsChecker
  SizeofPointerChecker
  ObjCDeallocChecker
  SecuritySyntaxChecker

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

13 years ago[analyzer]
Argyrios Kyrtzidis [Thu, 17 Feb 2011 21:39:24 +0000 (21:39 +0000)]
[analyzer]
-Introduce CheckerV2, a set of templates for convenient declaration & registration of checkers.
 Currently useful just for checkers working on the AST not the path-sensitive ones.
-Enhance CheckerManager to actually collect the checkers and turn it into the entry point for
 running the checkers.
-Use the new mechanism for the LLVMConventionsChecker.

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

13 years ago[analyzer] Pass CheckerManager to the registration functions.
Argyrios Kyrtzidis [Thu, 17 Feb 2011 21:39:17 +0000 (21:39 +0000)]
[analyzer] Pass CheckerManager to the registration functions.

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

13 years agoEnhance the array bounds checking to work for several other constructs,
Chandler Carruth [Thu, 17 Feb 2011 21:10:52 +0000 (21:10 +0000)]
Enhance the array bounds checking to work for several other constructs,
especially C++ code, and generally expand the test coverage.

Logic adapted from a patch by Kaelyn Uhrain <rikka@google.com> and
another Googler.

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

13 years agoClean up the style of this function to match the conventions in the rest
Chandler Carruth [Thu, 17 Feb 2011 20:55:08 +0000 (20:55 +0000)]
Clean up the style of this function to match the conventions in the rest
of Clang, and reflows the code a bit to make it easier to read.

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

13 years agoadd a fixme
Chris Lattner [Thu, 17 Feb 2011 20:54:00 +0000 (20:54 +0000)]
add a fixme

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

13 years agoStep #2/N of __label__ support: keep pushing LabelDecl forward,
Chris Lattner [Thu, 17 Feb 2011 20:34:02 +0000 (20:34 +0000)]
Step #2/N of __label__ support: keep pushing LabelDecl forward,
making them be template instantiated in a more normal way and
make them handle attributes like other decls.

This fixes the used/unused label handling stuff, making it use
the same infrastructure as other decls.

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

13 years agoInline LocalInstantiationScope::getInstantiationOf into its one
Chris Lattner [Thu, 17 Feb 2011 19:47:42 +0000 (19:47 +0000)]
Inline LocalInstantiationScope::getInstantiationOf into its one
client, making room for future hacking.

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

13 years agoremove some defensive code: LocalInstantiationScope::getInstantiationOf
Chris Lattner [Thu, 17 Feb 2011 19:38:27 +0000 (19:38 +0000)]
remove some defensive code: LocalInstantiationScope::getInstantiationOf
and findInstantiationOf can never return null, even on invalid code.

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

13 years agoremove some dead overloads.
Chris Lattner [Thu, 17 Feb 2011 19:37:28 +0000 (19:37 +0000)]
remove some dead overloads.

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

13 years agoEliminate the internal command-line option for viewing inheritance in C++ classes...
Douglas Gregor [Thu, 17 Feb 2011 19:04:40 +0000 (19:04 +0000)]
Eliminate the internal command-line option for viewing inheritance in C++ classes, since it's only really worked for the trivial cases anyway due to lame pseudo-parsing of the class name. The viewInheritance() function is still available for use in the debugger, where this is far more useful

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

13 years agoRemove the "conditional save" hashtables from IR generation.
John McCall [Thu, 17 Feb 2011 19:02:56 +0000 (19:02 +0000)]
Remove the "conditional save" hashtables from IR generation.

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

13 years agoThe internal -fdump-record-layouts flag already dumps the layout when it was computed...
Douglas Gregor [Thu, 17 Feb 2011 18:59:06 +0000 (18:59 +0000)]
The internal -fdump-record-layouts flag already dumps the layout when it was computed; no need to do so again at the end of the translation unit

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

13 years agoWhen building StaticAnalyzer/Frontend add -I "<Checkers build dir>" to allow Checkers...
Argyrios Kyrtzidis [Thu, 17 Feb 2011 18:40:33 +0000 (18:40 +0000)]
When building StaticAnalyzer/Frontend add -I "<Checkers build dir>" to allow Checkers.inc to be
included without '..', thus being compatible with build systems of *BSDs.

Patch by Joerg Sonnenberger!

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

13 years agoReplace a FIXME with a comment describing why we did what we did
Douglas Gregor [Thu, 17 Feb 2011 18:32:37 +0000 (18:32 +0000)]
Replace a FIXME with a comment describing why we did what we did

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

13 years agoRemove the last virtual member function from the Decl hierarchy,
Douglas Gregor [Thu, 17 Feb 2011 18:14:32 +0000 (18:14 +0000)]
Remove the last virtual member function from the Decl hierarchy,
reducing the size of all declarations by one pointer. For a 64-bit
Clang parsing Cocoa.h, this saves ~630k of memory (about 3.5% of
ASTContext's memory usage for this header).

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

13 years agoDevirtualize TagDecl::completeDefinition().
Douglas Gregor [Thu, 17 Feb 2011 18:06:05 +0000 (18:06 +0000)]
Devirtualize TagDecl::completeDefinition().

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

13 years agoDevirtualize DeclaratorDecl::getInnerLocStart() and TagDecl::getInnerLocStart().
Douglas Gregor [Thu, 17 Feb 2011 17:39:40 +0000 (17:39 +0000)]
Devirtualize DeclaratorDecl::getInnerLocStart() and TagDecl::getInnerLocStart().

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

13 years agoImprove diagnostics on missing property decl.
Fariborz Jahanian [Thu, 17 Feb 2011 17:30:05 +0000 (17:30 +0000)]
Improve diagnostics on missing property decl.

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

13 years agoDevirtualize NamedDecl::getNameForDiagnostic().
Douglas Gregor [Thu, 17 Feb 2011 17:23:19 +0000 (17:23 +0000)]
Devirtualize NamedDecl::getNameForDiagnostic().

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

13 years agoDevirtualize RedeclarableTemplateDecl::newCommon().
Douglas Gregor [Thu, 17 Feb 2011 17:10:20 +0000 (17:10 +0000)]
Devirtualize RedeclarableTemplateDecl::newCommon().

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

13 years agoImplement a sub-group of -Wconversion: -Wliteral-conversion. This
Chandler Carruth [Thu, 17 Feb 2011 11:05:49 +0000 (11:05 +0000)]
Implement a sub-group of -Wconversion: -Wliteral-conversion. This
specifically targets literals which are implicitly converted, a those
are more often unintended and trivial to fix. This can be especially
helpful for diagnosing what makes 'const int x = 1e6' not an ICE.

Original patch authored by Jim Meehan with contributions from other
Googlers and a few cleanups from myself.

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

13 years agoChange the representation of GNU ?: expressions to use a different expression
John McCall [Thu, 17 Feb 2011 10:25:35 +0000 (10:25 +0000)]
Change the representation of GNU ?: expressions to use a different expression
class and to bind the shared value using OpaqueValueExpr.  This fixes an
unnoticed problem with deserialization of these expressions where the
deserialized form would lose the vital pointer-equality trait;  or rather,
it fixes it because this patch also does the right thing for deserializing
OVEs.

Change OVEs to not be a "temporary object" in the sense that copy elision is
permitted.

This new representation is not totally unawkward to work with, but I think
that's really part and parcel with the semantics we're modelling here.  In
particular, it's much easier to fix things like the copy elision bug and to
make the CFG look right.

I've tried to update the analyzer to deal with this in at least some
obvious cases, and I think we get a much better CFG out, but the printing
of OpaqueValueExprs probably needs some work.

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

13 years agolib/Frontend/InitHeaderSearch.cpp: Add mingw-w64's include paths.
NAKAMURA Takumi [Thu, 17 Feb 2011 08:51:47 +0000 (08:51 +0000)]
lib/Frontend/InitHeaderSearch.cpp: Add mingw-w64's include paths.

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

13 years agoTriple::MinGW64 is deprecated and removed. We can use Triple::MinGW32 instead.
NAKAMURA Takumi [Thu, 17 Feb 2011 08:51:38 +0000 (08:51 +0000)]
Triple::MinGW64 is deprecated and removed. We can use Triple::MinGW32 instead.

No one uses *-mingw64. mingw-w64 is represented as {i686|x86_64}-w64-mingw32.

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

13 years agoFix whitespace.
NAKAMURA Takumi [Thu, 17 Feb 2011 08:50:50 +0000 (08:50 +0000)]
Fix whitespace.

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