]> granicus.if.org Git - clang/log
clang
13 years agoTeach this test to cope with Windows suffixes so that msys builds can
Chandler Carruth [Sat, 1 Oct 2011 02:08:56 +0000 (02:08 +0000)]
Teach this test to cope with Windows suffixes so that msys builds can
run it.

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

13 years agoCorrect my failure at writing proper regex's for FileCheck. Thanks Nick.
Chandler Carruth [Sat, 1 Oct 2011 01:46:47 +0000 (01:46 +0000)]
Correct my failure at writing proper regex's for FileCheck. Thanks Nick.

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

13 years agoAllow for both 'lib' and 'lib32', as both seem to be in evidence. I've
Chandler Carruth [Sat, 1 Oct 2011 01:26:40 +0000 (01:26 +0000)]
Allow for both 'lib' and 'lib32', as both seem to be in evidence. I've
left a FIXME to go track down more distros and see if 'lib' is ever the
64-bit half.

This should hopefully appease the build bots.

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

13 years agoThere might be an 'ld' without any path prefix.
Chandler Carruth [Sat, 1 Oct 2011 01:03:45 +0000 (01:03 +0000)]
There might be an 'ld' without any path prefix.

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

13 years agoAllow the results of cf_returns_not_retained function
John McCall [Sat, 1 Oct 2011 01:01:08 +0000 (01:01 +0000)]
Allow the results of cf_returns_not_retained function
calls, or calls to audited functions without an explicit
return attribute, to be casted without a bridge cast.
Tie this mechanism in with the existing exceptions to
the cast restrictions.  State those restrictions more
correctly and generalize.

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

13 years agoTweak the interface for analyzing the CF conventions for a name
John McCall [Sat, 1 Oct 2011 00:48:56 +0000 (00:48 +0000)]
Tweak the interface for analyzing the CF conventions for a name
to take a FunctionDecl* instead of an llvm::StringRef.  Eventually
we might push more logic in there, like using slightly different
conventions for C++ methods.

Also, fix a bug where 'copy' and 'create' were being caught in
non-camel-cased strings.  We want copyFoo and CopyFoo and XCopy
but not Xcopy or xcopy.

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

13 years agoAdd a test that ensures we get the basic multilib '-L' flags to 'ld'
Chandler Carruth [Sat, 1 Oct 2011 00:37:39 +0000 (00:37 +0000)]
Add a test that ensures we get the basic multilib '-L' flags to 'ld'
invocations on Linux.

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

13 years agoRevert r140604: "Let -B work for ld paths on Linux."
Chandler Carruth [Sat, 1 Oct 2011 00:37:35 +0000 (00:37 +0000)]
Revert r140604: "Let -B work for ld paths on Linux."

This patch may do what it describes, it may not. It's hard to tell as
its completely unclear what this is supposed to do. There are also no
test cases. More importantly, this seems to have broken lots of linker
invocations on multilib Linux systems.

The manual pages for 'ld' on Linux mention translating a '=' at the
beginning of the path into a *configure time* sysroot prefix (this is,
I believe, distinct from the --sysroot flag which 'ld' also can
support). I tested this with a normal binutils 'ld', a binutils 'ld'
with the sysroot flag enabled, and gold with the sysroot flag enabled,
and all of them try to open the path '=/lib/../lib32', No translation
occurs.

I think at the very least inserting an '=' needs to be conditioned on
some indication that it is supported and desired. I'm also curious to
see what toolchain and whan environment cause it to actually make
a difference.

I'm going to add a test case for basic sanity of Linux 'ld' invocations
from Clang in a follow-up commit that would have caught this.

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

13 years agoEnable -Wstrlcpy-strlcat-size by default.
Ted Kremenek [Fri, 30 Sep 2011 22:52:22 +0000 (22:52 +0000)]
Enable -Wstrlcpy-strlcat-size by default.

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

13 years agoMark a TagDecl when it is free standing (e.g. "struct foo;")
Argyrios Kyrtzidis [Fri, 30 Sep 2011 22:11:31 +0000 (22:11 +0000)]
Mark a TagDecl when it is free standing (e.g. "struct foo;")

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

13 years agoRevert my --working-directory option, which wasn't well thought through.
Daniel Dunbar [Fri, 30 Sep 2011 21:33:09 +0000 (21:33 +0000)]
Revert my --working-directory option, which wasn't well thought through.

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

13 years agoAdd a section detailing the steps required to add an expression or
Douglas Gregor [Fri, 30 Sep 2011 21:32:37 +0000 (21:32 +0000)]
Add a section detailing the steps required to add an expression or
statement to Clang.

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

13 years agoobjc arc: allow objc_returns_inner_pointer on methods that return
Fariborz Jahanian [Fri, 30 Sep 2011 20:50:23 +0000 (20:50 +0000)]
objc arc: allow objc_returns_inner_pointer on  methods that return
a reference type, since inner reference is much like an inner pointer.
// rdar://10139365

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

13 years agoFix compiler warning about && in ||.
Benjamin Kramer [Fri, 30 Sep 2011 20:32:22 +0000 (20:32 +0000)]
Fix compiler warning about && in ||.

This time the warning found an actual bug, we don't want to handle
force_align_arg_pointer differently than __force_align_arg_pointer__.

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

13 years agoInstall a copy of the libc++ headers with clang. <rdar://problem/10096516>
Bob Wilson [Fri, 30 Sep 2011 20:24:28 +0000 (20:24 +0000)]
Install a copy of the libc++ headers with clang.  <rdar://problem/10096516>

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

13 years agoSupport dllimport and dllexport on x86-64 Windows. PR10978. Patch by Ruben Van...
Eli Friedman [Fri, 30 Sep 2011 18:53:25 +0000 (18:53 +0000)]
Support dllimport and dllexport on x86-64 Windows.  PR10978.  Patch by Ruben Van Boxem.

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

13 years agoobjc gc: assigning to an objc object struct member through an ivar
Fariborz Jahanian [Fri, 30 Sep 2011 18:23:36 +0000 (18:23 +0000)]
objc gc: assigning to an objc object struct member through an ivar
pointer to this struct must go through the none ivar writer barrier.

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

13 years agoMinor cleanup.
Eli Friedman [Fri, 30 Sep 2011 18:19:16 +0000 (18:19 +0000)]
Minor cleanup.

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

13 years ago[libclang] Introduce CXCursor_CXXAccessSpecifier for C++'s public:/private:/protected...
Argyrios Kyrtzidis [Fri, 30 Sep 2011 17:58:23 +0000 (17:58 +0000)]
[libclang] Introduce CXCursor_CXXAccessSpecifier for C++'s public:/private:/protected: specifiers.

Patch by Paolo Capriotti!

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

13 years agoRemove the conditional that avoided passing the Objective-C runtime specification...
David Chisnall [Fri, 30 Sep 2011 13:32:35 +0000 (13:32 +0000)]
Remove the conditional that avoided passing the Objective-C runtime specification flags to cc1.  This fixes PR10369 (__builtin_NSStringMakeConstantString() selecting the wrong runtime in C / C++ code and crashing, although it doesn't fix the problem that instantiating the Mac runtime for non-Darwin targets was crashing.)

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

13 years agoFix a bug in the token caching for inline constructors in C++11, and improve error...
Sebastian Redl [Fri, 30 Sep 2011 08:32:17 +0000 (08:32 +0000)]
Fix a bug in the token caching for inline constructors in C++11, and improve error recovery in both dialects. This should fix the GCC test suite failures as well.

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

13 years agoAdd explicit attributes to mark functions as having had their
John McCall [Fri, 30 Sep 2011 05:12:12 +0000 (05:12 +0000)]
Add explicit attributes to mark functions as having had their
CoreFoundation object-transfer properties audited, and add a #pragma
to cause them to be automatically applied to functions in a particular
span of code.  This has to be implemented largely in the preprocessor
because of the requirement that the region be entirely contained in
a single file;  that's hard to impose from the parser without registering
for a ton of callbacks.

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

13 years agoFix crash when analyzing C++ code involving constant enums and switch statements...
Ted Kremenek [Fri, 30 Sep 2011 03:51:54 +0000 (03:51 +0000)]
Fix crash when analyzing C++ code involving constant enums and switch statements (<rdar://problem/10202899>).

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

13 years ago[analyzer] Fix a bug in RetainReleaseChecker diagnostics. It gives more precise error...
Anna Zaks [Fri, 30 Sep 2011 02:19:19 +0000 (02:19 +0000)]
[analyzer] Fix a bug in RetainReleaseChecker diagnostics. It gives more precise error message on the modified test case (and prevents duplicate diagnostics when we purge at block granularity).

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

13 years ago[analyzer] Add -analyzer-purge option which can take on multiple values, remove ...
Anna Zaks [Fri, 30 Sep 2011 02:03:00 +0000 (02:03 +0000)]
[analyzer] Add -analyzer-purge option which can take on multiple values, remove -analyzer-purge=none. (Small refactor as well: move the work of constructing AnalysisManager from the callers to the class itself.)

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

13 years agoSome fixes for MS-style asm parsing: specifically, add some error checking, and handl...
Eli Friedman [Fri, 30 Sep 2011 01:13:51 +0000 (01:13 +0000)]
Some fixes for MS-style asm parsing: specifically, add some error checking, and handle asm comments using semicolons correctly.  (The comments are actually surprisingly tricky.)

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

13 years agoconstexpr functions are implicitly const. More tests to follow.
Richard Smith [Fri, 30 Sep 2011 00:45:47 +0000 (00:45 +0000)]
constexpr functions are implicitly const. More tests to follow.

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

13 years agoFix typo.
Richard Smith [Fri, 30 Sep 2011 00:35:43 +0000 (00:35 +0000)]
Fix typo.

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

13 years agoSuggest adding 'constexpr' if the GNU extension for in-class initializers for static...
Richard Smith [Fri, 30 Sep 2011 00:33:19 +0000 (00:33 +0000)]
Suggest adding 'constexpr' if the GNU extension for in-class initializers for static const float members is used in C++11 mode.

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

13 years agoMark the ExtWarn for in-class initialization of static const float members as a GNU...
Richard Smith [Thu, 29 Sep 2011 23:18:34 +0000 (23:18 +0000)]
Mark the ExtWarn for in-class initialization of static const float members as a GNU extension. Don't extend the scope of this extension to all literal types in C++0x mode.

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

13 years agoMinor refactoring. Enumerators may inherit the deprecated/unavailable
Fariborz Jahanian [Thu, 29 Sep 2011 22:45:21 +0000 (22:45 +0000)]
Minor refactoring. Enumerators may inherit the deprecated/unavailable
attributes from the enumeration type.
// rdar://10201690

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

13 years agoPR11040: CheckICE should not allow an lvalue bitcast as part of an integer constant...
Eli Friedman [Thu, 29 Sep 2011 21:49:34 +0000 (21:49 +0000)]
PR11040: CheckICE should not allow an lvalue bitcast as part of an integer constant expression.

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

13 years agoIn C++0x, static const volatile data members cannot be initialized in-class.
Richard Smith [Thu, 29 Sep 2011 21:28:14 +0000 (21:28 +0000)]
In C++0x, static const volatile data members cannot be initialized in-class.

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

13 years agoPR11000: Fix crash on invalid.
Richard Smith [Thu, 29 Sep 2011 19:42:27 +0000 (19:42 +0000)]
PR11000: Fix crash on invalid.

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

13 years agoconstexpr: semantic checking for constexpr variables.
Richard Smith [Thu, 29 Sep 2011 19:11:37 +0000 (19:11 +0000)]
constexpr: semantic checking for constexpr variables.

We had an extension which allowed const static class members of floating-point type to have in-class initializers, 'as a C++0x extension'. However, C++0x does not allow this. The extension has been kept, and extended to all literal types in C++0x mode (with a fixit to add the 'constexpr' specifier).

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

13 years agoc - Enumerators may inherit the deprecated/unavailable
Fariborz Jahanian [Thu, 29 Sep 2011 18:40:01 +0000 (18:40 +0000)]
c - Enumerators may inherit the deprecated/unavailable
attributes from the enumeration type.
// rdar://10201690

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

13 years agoAdd more comments to several checker callback functions.
Anna Zaks [Thu, 29 Sep 2011 18:08:22 +0000 (18:08 +0000)]
Add more comments to several checker callback functions.

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

13 years agoAdd support for alignment-specifiers in C1X and C++11, remove
Peter Collingbourne [Thu, 29 Sep 2011 18:04:28 +0000 (18:04 +0000)]
Add support for alignment-specifiers in C1X and C++11, remove
support for the C++0x draft [[align]] attribute and add the C1X
standard header file stdalign.h

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

13 years agoAdd a warning group for warnings about using C1X features as extensions
Peter Collingbourne [Thu, 29 Sep 2011 18:04:12 +0000 (18:04 +0000)]
Add a warning group for warnings about using C1X features as extensions

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

13 years agoAdd support for parsing an attribute-specifier-seq containing multiple
Peter Collingbourne [Thu, 29 Sep 2011 18:04:05 +0000 (18:04 +0000)]
Add support for parsing an attribute-specifier-seq containing multiple
attribute-specifiers

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

13 years agoAdd support for parsing the optional attribute-specifier-seq at the
Peter Collingbourne [Thu, 29 Sep 2011 18:03:57 +0000 (18:03 +0000)]
Add support for parsing the optional attribute-specifier-seq at the
end of a decl-specifier-seq

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

13 years agoDriver: use correct search paths for multilib
Peter Collingbourne [Thu, 29 Sep 2011 13:42:24 +0000 (13:42 +0000)]
Driver: use correct search paths for multilib

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

13 years agoAdd an ns_bridged attribute, used to specify that a
John McCall [Thu, 29 Sep 2011 07:17:38 +0000 (07:17 +0000)]
Add an ns_bridged attribute, used to specify that a
pointer to the annotated struct type can be used as an
Objective-C object pointer.  If an argument is given, the
type is actually "toll-free bridged" to the specific type
named there, rather than just to 'id'.

For now, we cannot rely on all types being so annotated,
and we'll always have to have exceptions for things like
CFTypeRef (aka const void*), but this is clearly a good
foundation for improving toolage in this area.

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

13 years agoLike IBOutletCollection, it only makes sense to apply the IBOutlet annotation to...
Ted Kremenek [Thu, 29 Sep 2011 07:02:25 +0000 (07:02 +0000)]
Like IBOutletCollection, it only makes sense to apply the IBOutlet annotation to Objective-C object types.  Fixes <rdar://problem/10142685>.

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

13 years agoDo not warn about empty format strings when there are no data arguments. Fixes ...
Ted Kremenek [Thu, 29 Sep 2011 05:52:16 +0000 (05:52 +0000)]
Do not warn about empty format strings when there are no data arguments.  Fixes <rdar://problem/9473155>.

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

13 years agoUnnecessary else
David Blaikie [Thu, 29 Sep 2011 04:06:47 +0000 (04:06 +0000)]
Unnecessary else

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

13 years agoBasic/Diagnostic: Kill off a few unnecessary functions now that refactoring is done...
Daniel Dunbar [Thu, 29 Sep 2011 02:03:01 +0000 (02:03 +0000)]
Basic/Diagnostic: Kill off a few unnecessary functions now that refactoring is done, and add a note that the new setDiagnosticGroup{...} methods only operate on the current diagnostic state.

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

13 years agoBasic/Diagnostics: Rewrite DiagnosticIDs::getDiagnosticLevel completely to be straigh...
Daniel Dunbar [Thu, 29 Sep 2011 01:58:05 +0000 (01:58 +0000)]
Basic/Diagnostics: Rewrite DiagnosticIDs::getDiagnosticLevel completely to be straighter line code, use the new DiagnosticMappingInfo flags, and eliminate the odd MAP_WARNING_NO_WERROR and friend mappings.
 - This fixes a host of obscure bugs with regards to how warning mapping options composed with one another, and I believe makes the code substantially easier to read and reason about.

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

13 years agoBasic/Diagnostics: Add three explicit bits to DiagnosticMappingInfo to track "no...
Daniel Dunbar [Thu, 29 Sep 2011 01:52:06 +0000 (01:52 +0000)]
Basic/Diagnostics: Add three explicit bits to DiagnosticMappingInfo to track "no-warning-as-error", "no-error-as-fatal", and "show-in-system-header", and update DiagnosticsEngine::setDiagnosticGroup{WarningAsError,ErrorAsFatal} and GetDefaultDiagMappingInfo to set them appropriately.
 - No actual functionality change for now, we still also use the diag::Mapping::{MAP_WARNING_NO_ERROR,MAP_ERROR_NO_FATAL,MAP_WARNING_SHOW_IN_SYSTEM_HEADER} for a little while longer.

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

13 years agoBasic/Diagnostics: Add a DiagnosticIDs::getDiagnosticsInGroup method, and use
Daniel Dunbar [Thu, 29 Sep 2011 01:47:16 +0000 (01:47 +0000)]
Basic/Diagnostics: Add a DiagnosticIDs::getDiagnosticsInGroup method, and use
that in DiagnosticEngine instead of the convoluted calling into DiagnosticIDs
which then calls back into the DiagnosticsEngine.

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

13 years agoBasic/Diagnostic: Add a DiagSate::getOrAddMappingInfo method.
Daniel Dunbar [Thu, 29 Sep 2011 01:42:25 +0000 (01:42 +0000)]
Basic/Diagnostic: Add a DiagSate::getOrAddMappingInfo method.
 - Also, spell const_iterator as const_iterator.

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

13 years agotests: Add some more tests for warning mappings.
Daniel Dunbar [Thu, 29 Sep 2011 01:37:40 +0000 (01:37 +0000)]
tests: Add some more tests for warning mappings.

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

13 years agoBasic/Diagnostics: Move setDiagnosticMapping() to using DiagnosticMappingInfo
Daniel Dunbar [Thu, 29 Sep 2011 01:34:47 +0000 (01:34 +0000)]
Basic/Diagnostics: Move setDiagnosticMapping() to using DiagnosticMappingInfo
and eliminate setDiagnosticMappingInternal.

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

13 years agoBasic/Diagnostics: Add a DiagnosticMappingInfo helper class, and switch to
Daniel Dunbar [Thu, 29 Sep 2011 01:30:00 +0000 (01:30 +0000)]
Basic/Diagnostics: Add a DiagnosticMappingInfo helper class, and switch to
storing mappings with that instead of straying some magic constants about the
source.

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

13 years agoBasic/Diagnostics: Eliminate getDiagnosticMappingInfo method, which wasn't worth...
Daniel Dunbar [Thu, 29 Sep 2011 01:25:14 +0000 (01:25 +0000)]
Basic/Diagnostics: Eliminate getDiagnosticMappingInfo method, which wasn't worth methodizing.

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

13 years agoBasic/Diagnostic: Eliminate the extra "mapping" out-parameter now that I killed the...
Daniel Dunbar [Thu, 29 Sep 2011 01:20:28 +0000 (01:20 +0000)]
Basic/Diagnostic: Eliminate the extra "mapping" out-parameter now that I killed the sole client.

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

13 years agoBasic/Diagnostics: Add an isDefaultMappingAsError method, and switch TextDiagnosticPr...
Daniel Dunbar [Thu, 29 Sep 2011 01:01:08 +0000 (01:01 +0000)]
Basic/Diagnostics: Add an isDefaultMappingAsError method, and switch TextDiagnosticPrinter to use that instead of extracting the current mapping via getDiagnosticLevel, which fixes one class of corner cases w.r.t. printing the "-Werror" diagnostic option marker.
 - The TextDiagnosticPrinter code is still fragile as it is just "reverse engineering" what the diagnostic engine is doing. Not my current priority to fix though.

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

13 years agoFix 80-col viola.
Daniel Dunbar [Thu, 29 Sep 2011 00:53:50 +0000 (00:53 +0000)]
Fix 80-col viola.

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

13 years agoAttempt to fix unit tests
Douglas Gregor [Thu, 29 Sep 2011 00:53:49 +0000 (00:53 +0000)]
Attempt to fix unit tests

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

13 years agoBasic/Diagnostic: Factor out
Daniel Dunbar [Thu, 29 Sep 2011 00:53:47 +0000 (00:53 +0000)]
Basic/Diagnostic: Factor out
DiagnosticsEngine::setDiagnosticGroup{ErrorAsFatal,WarningAsError} methods which
more accurately model the correct API -- no internal change to the diagnostics
engine yet though.
 - Also, stop honoring -Werror=everything (etc.) as a valid (but oddly behaved) option.

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

13 years agoIntroduce an opt-in warning when a module is being implicitly built
Douglas Gregor [Thu, 29 Sep 2011 00:52:27 +0000 (00:52 +0000)]
Introduce an opt-in warning when a module is being implicitly built
from sources.

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

13 years agoIntroduce a pure virtual clone() method to DiagnosticConsumer, so that
Douglas Gregor [Thu, 29 Sep 2011 00:38:00 +0000 (00:38 +0000)]
Introduce a pure virtual clone() method to DiagnosticConsumer, so that
we have the ability to create a new, distict diagnostic consumer when
we go off and build a module. This avoids the currently horribleness
where the same diagnostic consumer sees diagnostics for multiple
translation units (and multiple SourceManagers!) causing all sorts of havok.

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

13 years agoBasic/Diagnostics: Split out the default warning "no-Werror" and
Daniel Dunbar [Thu, 29 Sep 2011 00:34:06 +0000 (00:34 +0000)]
Basic/Diagnostics: Split out the default warning "no-Werror" and
"show-in-system-header" bits, which is part of teasing them apart from the
diagnostic mapping kind.

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

13 years agoChange "Regions" to be "LexicalBlocks" since that's what they
Eric Christopher [Thu, 29 Sep 2011 00:00:45 +0000 (00:00 +0000)]
Change "Regions" to be "LexicalBlocks" since that's what they
correspond to.

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

13 years agoRename EmitStopPoint in CGDebugInfo to EmitLocation. "stop points" don't
Eric Christopher [Thu, 29 Sep 2011 00:00:41 +0000 (00:00 +0000)]
Rename EmitStopPoint in CGDebugInfo to EmitLocation. "stop points" don't
exist anymore.

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

13 years agoReorder functions in the file.
Eric Christopher [Thu, 29 Sep 2011 00:00:37 +0000 (00:00 +0000)]
Reorder functions in the file.

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

13 years agoCall UpdateLineDirectiveRegion every time we want to emit a stop
Eric Christopher [Thu, 29 Sep 2011 00:00:35 +0000 (00:00 +0000)]
Call UpdateLineDirectiveRegion every time we want to emit a stop
point in the code. Ensures that we don't miss any places and the
check is reasonably cheap.

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

13 years agoUpdate comment.
Eric Christopher [Thu, 29 Sep 2011 00:00:31 +0000 (00:00 +0000)]
Update comment.

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

13 years ago[driver] Add basic support for escaping XML characters in CC_LOG_DIAGNOSTICS
Chad Rosier [Wed, 28 Sep 2011 23:05:07 +0000 (23:05 +0000)]
[driver] Add basic support for escaping XML characters in CC_LOG_DIAGNOSTICS
strings.
rdar://9696709

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

13 years agoobjc arc: Diagnose block pointer type mismatch when
Fariborz Jahanian [Wed, 28 Sep 2011 21:52:05 +0000 (21:52 +0000)]
objc arc: Diagnose block pointer type mismatch when
some arguments types are ns_consumed and some otherwise
matching types are not. This is objc side of
// rdar://10187884

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

13 years agoCheck for empty predecessors for walking them.
Ted Kremenek [Wed, 28 Sep 2011 21:20:00 +0000 (21:20 +0000)]
Check for empty predecessors for walking them.

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

13 years agoobjc++ arc: Diagnose block pointer type mismatch when
Fariborz Jahanian [Wed, 28 Sep 2011 20:22:05 +0000 (20:22 +0000)]
objc++ arc: Diagnose block pointer type mismatch when
some arguments types are ns_consumed and some otherwise
matching types are not. This fixes the objc++ side only *auch*.
// rdar://10187884

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

13 years agoFix typo. string-convervion -> string-conversion
Richard Trieu [Wed, 28 Sep 2011 20:13:42 +0000 (20:13 +0000)]
Fix typo.  string-convervion -> string-conversion

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

13 years agoTweak -Wobjc-missing-super-calls to not warning about missing [super dealloc] when...
Ted Kremenek [Wed, 28 Sep 2011 19:32:29 +0000 (19:32 +0000)]
Tweak -Wobjc-missing-super-calls to not warning about missing [super dealloc] when in GC-only mode, and to not warning about missing [super finalize] when not using GC.

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

13 years agoFor __weak/__strong/etc. ownership attributes, don't macro expand them in diagnostics.
Argyrios Kyrtzidis [Wed, 28 Sep 2011 18:35:06 +0000 (18:35 +0000)]
For __weak/__strong/etc. ownership attributes, don't macro expand them in diagnostics.

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

13 years agoFix a typo spotted by Jonathan Sauer.
Chandler Carruth [Wed, 28 Sep 2011 18:17:30 +0000 (18:17 +0000)]
Fix a typo spotted by Jonathan Sauer.

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

13 years agoIntroduce non-const Decl::getParentFunctionOrMethod.
Argyrios Kyrtzidis [Wed, 28 Sep 2011 18:14:24 +0000 (18:14 +0000)]
Introduce non-const Decl::getParentFunctionOrMethod.

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

13 years ago[libclang] Introduce clang_Range_isNull.
Argyrios Kyrtzidis [Wed, 28 Sep 2011 18:14:21 +0000 (18:14 +0000)]
[libclang] Introduce clang_Range_isNull.

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

13 years agoInstall c-index-test also on CMake build, following up r140681.
NAKAMURA Takumi [Wed, 28 Sep 2011 10:50:23 +0000 (10:50 +0000)]
Install c-index-test also on CMake build, following up r140681.

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

13 years agoAttempt to silence the GCC -Wreturn-type warning...
Chandler Carruth [Wed, 28 Sep 2011 10:49:06 +0000 (10:49 +0000)]
Attempt to silence the GCC -Wreturn-type warning...

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

13 years agoGenerate tests for all of the x86 SIMD instruction feature set
Chandler Carruth [Wed, 28 Sep 2011 10:36:46 +0000 (10:36 +0000)]
Generate tests for all of the x86 SIMD instruction feature set
predefines based on the output of GCC as well as the CPU predefines.

Invert tests for __AVX__, Clang's AVX feature is hard coded off still.

Switch Atom from 'SSE3' to 'SSSE3'. This matches GCC's behavior, Intel's
documentation, and ICC's documentation (such as I could dig up).

Switch Athlon and Geode to enable 3dnowa rather than just 3dnow and
nothing (resp.).

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

13 years agoAdd a little banner to this test. This lets my scripts more easily
Chandler Carruth [Wed, 28 Sep 2011 10:17:41 +0000 (10:17 +0000)]
Add a little banner to this test. This lets my scripts more easily
automate the process of updating and generating these tests.

If anyone is really interested, I can check my scripts for generating
this test in, but its a horrible pile of shell... Not sure its really
worth it.

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

13 years agoFix a think-o on my part that got enshrined in a FIXME by setting up the
Chandler Carruth [Wed, 28 Sep 2011 09:54:11 +0000 (09:54 +0000)]
Fix a think-o on my part that got enshrined in a FIXME by setting up the
__tune_...__ define as well.

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

13 years agoMove some of the defines down to more natural locations, consolidating
Chandler Carruth [Wed, 28 Sep 2011 09:54:07 +0000 (09:54 +0000)]
Move some of the defines down to more natural locations, consolidating
the target identifying macros at the top, including subtarget macros.

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

13 years agoTeach Clang to reject 32-bit only CPUs when compiling in 64-bit mode.
Chandler Carruth [Wed, 28 Sep 2011 09:45:08 +0000 (09:45 +0000)]
Teach Clang to reject 32-bit only CPUs when compiling in 64-bit mode.
Add 64-bit preprocessor macro tests.

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

13 years agoSimplify the control flow for predefined macro selection by using
Chandler Carruth [Wed, 28 Sep 2011 09:45:05 +0000 (09:45 +0000)]
Simplify the control flow for predefined macro selection by using
fallthrough now that we're working with a switch. Also remove a dubious
"feature" regarding k6 processors and 3dnow and leave a fixme... Not
that anyone is likely to care about correct tuning for k6 processors
with and w/o 3dnow...

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

13 years agoSwitch the X86TargetInfo object from a string representation of the
Chandler Carruth [Wed, 28 Sep 2011 08:55:37 +0000 (08:55 +0000)]
Switch the X86TargetInfo object from a string representation of the
selected CPU model to the enumeration. This parses the string
representation once using a StringSwitch on SetCPU. It returns an error
for strings which are not recognized (yay!). Finally it replaces
ridiculous if-chains with switches that cover all enumerators.

The last change required adding several missing entries to the features
function. These were obvious on inspection. Yay for a pattern that gives
warnings when we miss one.

No new test cases yet, as I want to get the 64-bit errors working first.
I'll then start fleshing out the testing more. Currently I'm primarily
testing on Linux, but I'm hoping check whether there are interesting
differences on darwin before long...

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

13 years agoIntroduce an enumeration for the x86 CPUs recognized by Clang. I've
Chandler Carruth [Wed, 28 Sep 2011 08:55:34 +0000 (08:55 +0000)]
Introduce an enumeration for the x86 CPUs recognized by Clang. I've
tried to give these nice doxyments, but if I've gotten any of my history
wrong, please chime in.

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

13 years agoClean up a bit of the uses of CPU in the TargetInfo classes. This makes
Chandler Carruth [Wed, 28 Sep 2011 05:56:05 +0000 (05:56 +0000)]
Clean up a bit of the uses of CPU in the TargetInfo classes. This makes
it an error if a CPU is provided for a target that doesn't implement
logic handling CPU settings, to match the ABI settings. It also removes
the CPU parameter from the getDefaultFeatures method. This parameter was
always filled in with the same value as setCPU was called with, and at
this point every single target implementation that referenced the CPU
within this function has needed to store the CPU via setCPU anyways in
order to implement other interface points.

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

13 years agoDriver: Fix two bad typos that were breaking the buildbots.
Benjamin Kramer [Wed, 28 Sep 2011 05:33:02 +0000 (05:33 +0000)]
Driver: Fix two bad typos that were breaking the buildbots.

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

13 years agoInstall c-index-test as part of install-clang-c Makefile rule.
Ted Kremenek [Wed, 28 Sep 2011 04:39:41 +0000 (04:39 +0000)]
Install c-index-test as part of install-clang-c Makefile rule.

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

13 years agoBegin fixing Clang's predefined macros for various architectures. This
Chandler Carruth [Wed, 28 Sep 2011 02:59:25 +0000 (02:59 +0000)]
Begin fixing Clang's predefined macros for various architectures. This
is *very* much a WIP that I'll be refining over the next several
commits, but I need to get this checkpoint in place for sanity.

This also adds a much more comprehensive test for architecture macros,
which is roughly generated by inspecting the behavior of a trunk build
of GCC. It still requires some massaging, but eventually I'll even check
in the script that generates these so that others can use it to append
more tests for more architectures, etc.

Next up is a bunch of simplification of the Targets.cpp code, followed
by a lot more test cases once we can reject invalid architectures.

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

13 years agoIntroduce Decl::getParentFunctionOrMethod which if the decl is defined inside
Argyrios Kyrtzidis [Wed, 28 Sep 2011 02:45:33 +0000 (02:45 +0000)]
Introduce Decl::getParentFunctionOrMethod which if the decl is defined inside
a function/method/block it returns the corresponding DeclContext, otherwise it returns null.

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

13 years ago[driver] If no OSX or iOS target has been specified and we're compiling for
Chad Rosier [Wed, 28 Sep 2011 00:46:32 +0000 (00:46 +0000)]
[driver] If no OSX or iOS target has been specified and we're compiling for
armv7, go ahead as assume we're targeting iOS.
rdar://10147774

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

13 years agoPR11002: Make sure we emit sentinel warnings with a valid source location. (Ideally...
Eli Friedman [Tue, 27 Sep 2011 23:46:37 +0000 (23:46 +0000)]
PR11002: Make sure we emit sentinel warnings with a valid source location.  (Ideally, we want to use the location returned by getLocForEndOfToken, but that is not always successful.)

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

13 years agoInclude prefix with default synthesized ivars.
Ted Kremenek [Tue, 27 Sep 2011 23:39:40 +0000 (23:39 +0000)]
Include prefix with default synthesized ivars.

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

13 years agoOnly print _Bool as 'bool' when 'bool' is defined as an object-like
Douglas Gregor [Tue, 27 Sep 2011 23:30:47 +0000 (23:30 +0000)]
Only print _Bool as 'bool' when 'bool' is defined as an object-like
macro whose only replacement token is '_Bool'.

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

13 years agoRemove the egregious hack that made Objective-C++ ARC work with older
Douglas Gregor [Tue, 27 Sep 2011 22:48:19 +0000 (22:48 +0000)]
Remove the egregious hack that made Objective-C++ ARC work with older
versions of libc++. Newer versions of libc++ know how to deal with ARC
properly. Fixes <rdar://problem/10062179>.

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

13 years agoWhen 'bool' is not a built-in type but is defined as a macro, print
Douglas Gregor [Tue, 27 Sep 2011 22:38:19 +0000 (22:38 +0000)]
When 'bool' is not a built-in type but is defined as a macro, print
'bool' rather than '_Bool' within types, to make things a bit more
readable. Fixes <rdar://problem/10063263>.

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

13 years agoobjcetive-c-arc: When overriding a method, its ns_consumed patameter
Fariborz Jahanian [Tue, 27 Sep 2011 22:35:36 +0000 (22:35 +0000)]
objcetive-c-arc: When overriding a method, its ns_consumed patameter
attribute must match its overriden method. Same also for
ns_returns_retained/not_retained on the result type.
This is one half of // rdar://10187884

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