]> granicus.if.org Git - clang/log
clang
11 years agoFileCheck'ize test/SemaCXX/qualified-names-print.cpp and merge it to other
Dmitri Gribenko [Thu, 24 Jan 2013 23:21:11 +0000 (23:21 +0000)]
FileCheck'ize test/SemaCXX/qualified-names-print.cpp and merge it to other
-ast-print tests

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

11 years ago[analyzer] Add "-analyzer-config mode=[deep|shallow] ".
Anna Zaks [Thu, 24 Jan 2013 23:15:34 +0000 (23:15 +0000)]
[analyzer] Add "-analyzer-config mode=[deep|shallow] ".

The idea is to introduce a higher level "user mode" option for
different use scenarios. For example, if one wants to run the analyzer
for a small project each time the code is built, they would use
the "shallow" mode.

The user mode option will influence the default settings for the
lower-level analyzer options. For now, this just influences the ipa
modes, but we plan to find more optimal settings for them.

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

11 years ago[analyzer] Replace "-analyzer-ipa" with "-analyzer-config ipa".
Anna Zaks [Thu, 24 Jan 2013 23:15:30 +0000 (23:15 +0000)]
[analyzer] Replace "-analyzer-ipa" with "-analyzer-config ipa".

The idea is to eventually place all analyzer options under
"analyzer-config". In addition, this lays the ground for introduction of
a high-level analyzer mode option, which will influence the
default setting for IPAMode.

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

11 years ago[analyzer] refactor: access IPAMode through the accessor.
Anna Zaks [Thu, 24 Jan 2013 23:15:25 +0000 (23:15 +0000)]
[analyzer] refactor: access IPAMode through the accessor.

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

11 years agoscan-build: Add a --keep-empty option for better testing.
Jordan Rose [Thu, 24 Jan 2013 23:07:59 +0000 (23:07 +0000)]
scan-build: Add a --keep-empty option for better testing.

SATestBuild expects to compare output directories for each invocation of
scan-build that it runs, but scan-build clears out empty directories by
default. We were coincidentally not getting that behavior until r173294.

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

11 years agoFileCheck-ify some debug info scope related tests.
David Blaikie [Thu, 24 Jan 2013 22:47:48 +0000 (22:47 +0000)]
FileCheck-ify some debug info scope related tests.

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

11 years agoremoved duplicated comment.
Fariborz Jahanian [Thu, 24 Jan 2013 22:26:55 +0000 (22:26 +0000)]
removed duplicated comment.

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

11 years agoPatch to check for integer overflow. It has been
Fariborz Jahanian [Thu, 24 Jan 2013 22:11:45 +0000 (22:11 +0000)]
Patch to check for integer overflow. It has been
commented on and approved by Richard Smith.

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

11 years agoMove 'convertUTF8Sequence' helper into the C++ section of the header file.
Jordan Rose [Thu, 24 Jan 2013 21:48:50 +0000 (21:48 +0000)]
Move 'convertUTF8Sequence' helper into the C++ section of the header file.

It's annotated as "inline", but ConvertUTF.c should still be able to compile
as C89.

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

11 years ago[mips] Do not emit i32 padding if target ABI is O32. This was causing backend
Akira Hatanaka [Thu, 24 Jan 2013 21:47:33 +0000 (21:47 +0000)]
[mips] Do not emit i32 padding if target ABI is O32. This was causing backend
to pass floating point arguments to be passed in integer registers.

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

11 years agoTest fix-it ranges for Unicode characters.
Jordan Rose [Thu, 24 Jan 2013 21:19:51 +0000 (21:19 +0000)]
Test fix-it ranges for Unicode characters.

Also, remove stray -fdiagnostics-parseable-fixits from ucn-pp-identifier.

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

11 years agoAdd a fixit for \U1234 -> \u1234.
Jordan Rose [Thu, 24 Jan 2013 20:50:52 +0000 (20:50 +0000)]
Add a fixit for \U1234 -> \u1234.

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

11 years agoAs an extension, treat Unicode whitespace characters as whitespace.
Jordan Rose [Thu, 24 Jan 2013 20:50:50 +0000 (20:50 +0000)]
As an extension, treat Unicode whitespace characters as whitespace.

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

11 years agoHandle universal character names and Unicode characters outside of literals.
Jordan Rose [Thu, 24 Jan 2013 20:50:46 +0000 (20:50 +0000)]
Handle universal character names and Unicode characters outside of literals.

This is a missing piece for C99 conformance.

This patch handles UCNs by adding a '\\' case to LexTokenInternal and
LexIdentifier -- if we see a backslash, we tentatively try to read in a UCN.
If the UCN is not syntactically well-formed, we fall back to the old
treatment: a backslash followed by an identifier beginning with 'u' (or 'U').

Because the spelling of an identifier with UCNs still has the UCN in it, we
need to convert that to UTF-8 in Preprocessor::LookUpIdentifierInfo.

Of course, valid code that does *not* use UCNs will see only a very minimal
performance hit (checks after each identifier for non-ASCII characters,
checks when converting raw_identifiers to identifiers that they do not
contain UCNs, and checks when getting the spelling of an identifier that it
does not contain a UCN).

This patch also adds basic support for actual UTF-8 in the source. This is
treated almost exactly the same as UCNs except that we consider stray
Unicode characters to be mistakes and offer a fixit to remove them.

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

11 years agoUnify diagnostics for \x, \u, and \U without any following hex digits.
Jordan Rose [Thu, 24 Jan 2013 20:50:13 +0000 (20:50 +0000)]
Unify diagnostics for \x, \u, and \U without any following hex digits.

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

11 years agoFail these tests in a way that doesn't cause unexpected successes, per Daniel's
Chad Rosier [Thu, 24 Jan 2013 20:46:39 +0000 (20:46 +0000)]
Fail these tests in a way that doesn't cause unexpected successes, per Daniel's
suggestion.

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

11 years agoTemporarily XFAIL this test; the compiler will segfault if the target-specific
Chad Rosier [Thu, 24 Jan 2013 20:33:35 +0000 (20:33 +0000)]
Temporarily XFAIL this test; the compiler will segfault if the target-specific
parser is not included in the compiler. Thanks to Renato for discovering the
underlying issue.

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

11 years ago[ms-inline asm] Add an error when trying to compile MS-style inline assembly
Chad Rosier [Thu, 24 Jan 2013 20:24:34 +0000 (20:24 +0000)]
[ms-inline asm] Add an error when trying to compile MS-style inline assembly
for an unsupported architecture.
rdar://13063988

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

11 years ago[driver] Associate a JobAction with each result file. This enables the driver
Chad Rosier [Thu, 24 Jan 2013 19:14:47 +0000 (19:14 +0000)]
[driver] Associate a JobAction with each result file.  This enables the driver
to delete result files for only those commands that fail.
Part of rdar://12984531

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

11 years agoPR14922: when printing an attribute, use the real syntax of the attribute (GNU, C...
Michael Han [Thu, 24 Jan 2013 16:46:58 +0000 (16:46 +0000)]
PR14922: when printing an attribute, use the real syntax of the attribute (GNU, C++11, MS Declspec) instead of hardcoded GNU syntax.

Introduce a spelling index to Attr class, which is an index into the attribute spelling list of an attribute defined in Attr.td.
This index will determine the actual spelling used by an attribute, as it incorporates both the syntax and naming of the attribute.
When constructing an attribute AST node, the spelling index is computed based on attribute kind, scope (if it's a C++11 attribute), and
name, then passed to Attr that will use the index to print itself.

Thanks to Richard Smith for the idea and review.

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

11 years agoFix a non-conformant OpenCL test case.
Joey Gouly [Thu, 24 Jan 2013 15:24:54 +0000 (15:24 +0000)]
Fix a non-conformant OpenCL test case.
Program scope variables must be declared in the constant address space
and are required to be initialized.

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

11 years agoProperly remove this test file, that I copied over to test/SemaOpenCL in r173352.
Joey Gouly [Thu, 24 Jan 2013 15:19:51 +0000 (15:19 +0000)]
Properly remove this test file, that I copied over to test/SemaOpenCL in r173352.

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

11 years agoFix an OpenCL test case that was OpenCL conformant.
Joey Gouly [Thu, 24 Jan 2013 15:14:22 +0000 (15:14 +0000)]
Fix an OpenCL test case that was OpenCL conformant.
It had program scope variables that were not in the constant address space,
make them to be function scope variables instead.
Also move the test to the SemaOpenCL directory.

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

11 years agoclang/GlobalModuleIndex: Don't open the same file twice. Use raw_fd_ostream(fd, ...
NAKAMURA Takumi [Thu, 24 Jan 2013 08:20:11 +0000 (08:20 +0000)]
clang/GlobalModuleIndex: Don't open the same file twice. Use raw_fd_ostream(fd, ...) instead.

FIXME: PathV2::unique_file() is assumed to open the file with binary mode on win32.

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

11 years agoclang/test/Modules/global_index.m: XFAILing on win32 when investigating for now.
NAKAMURA Takumi [Thu, 24 Jan 2013 07:04:14 +0000 (07:04 +0000)]
clang/test/Modules/global_index.m: XFAILing on win32 when investigating for now.

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

11 years agoGive warn_redecl_library_builtin a flag name: -Wincompatible-library-redeclaration.
Nick Lewycky [Thu, 24 Jan 2013 03:43:15 +0000 (03:43 +0000)]
Give warn_redecl_library_builtin a flag name: -Wincompatible-library-redeclaration.

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

11 years agoStart checking nonnull (as well as format and argument_with_type_tag) on
Nick Lewycky [Thu, 24 Jan 2013 02:03:08 +0000 (02:03 +0000)]
Start checking nonnull (as well as format and argument_with_type_tag) on
overloaded binary operators.

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

11 years agoFix some wonky formatting, remove spurious emacs major mode marker. No
Nick Lewycky [Thu, 24 Jan 2013 01:12:16 +0000 (01:12 +0000)]
Fix some wonky formatting, remove spurious emacs major mode marker. No
functionality change!

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

11 years agoMicro cleanup: use an array of const char, rather than an array of char, as the
Richard Smith [Wed, 23 Jan 2013 23:38:20 +0000 (23:38 +0000)]
Micro cleanup: use an array of const char, rather than an array of char, as the
type of the string literal implicitly used for a raw user-defined literal call.
No test; this has no semantic impact.

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

11 years agoDon't check lines beginning with '#', since they could contain a path with the unexpe...
Bill Wendling [Wed, 23 Jan 2013 23:07:21 +0000 (23:07 +0000)]
Don't check lines beginning with '#', since they could contain a path with the unexpected word in them.

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

11 years agoDon't check lines beginning with '#', since they could contain a path with the unexpe...
Bill Wendling [Wed, 23 Jan 2013 23:06:28 +0000 (23:06 +0000)]
Don't check lines beginning with '#', since they could contain a path with the unexpected word in them.

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

11 years agoThe diagnostic is now a warning instead of an error. Also don't check lines beginning...
Bill Wendling [Wed, 23 Jan 2013 23:04:29 +0000 (23:04 +0000)]
The diagnostic is now a warning instead of an error. Also don't check lines beginning with '#', since they could contain a path with the unexpected word in them.

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

11 years agoFix for case-sensitive file systems. Ugh
Douglas Gregor [Wed, 23 Jan 2013 22:45:24 +0000 (22:45 +0000)]
Fix for case-sensitive file systems. Ugh

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

11 years agoImplement the writer side of the global module index.
Douglas Gregor [Wed, 23 Jan 2013 22:38:11 +0000 (22:38 +0000)]
Implement the writer side of the global module index.

The global module index is a "global" index for all of the module
files within a particular subdirectory in the module cache, which
keeps track of all of the "interesting" identifiers and selectors
known in each of the module files. One can perform a fast lookup in
the index to determine which module files will have more information
about entities with a particular name/selector. This information can
help eliminate redundant lookups into module files (a serious
performance problem) and help with creating auto-import/auto-include
Fix-Its.

The global module index is created or updated at the end of a
translation unit that has triggered a (re)build of a module by
scraping all of the .pcm files out of the module cache subdirectory,
so it catches everything. As with module rebuilds, we use the file
system's atomicity to synchronize.

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

11 years agoAdd a test case for 'analyzer_noreturn' on category methods.
Ted Kremenek [Wed, 23 Jan 2013 21:29:13 +0000 (21:29 +0000)]
Add a test case for 'analyzer_noreturn' on category methods.

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

11 years agoAlways process an index.html file if we have HTML output. Patch by Justin Bogner.
Ted Kremenek [Wed, 23 Jan 2013 21:22:14 +0000 (21:22 +0000)]
Always process an index.html file if we have HTML output.  Patch by Justin Bogner.

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

11 years agoAdd missing null check. Not sure why my tests passed before.
Ted Kremenek [Wed, 23 Jan 2013 21:12:49 +0000 (21:12 +0000)]
Add missing null check.  Not sure why my tests passed before.

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

11 years agoHonor attribute 'analyzer_noreturn' on Objective-C methods.
Ted Kremenek [Wed, 23 Jan 2013 21:00:27 +0000 (21:00 +0000)]
Honor attribute 'analyzer_noreturn' on Objective-C methods.

This isn't likely a full solution, but it catches the common cases
and can be refined over time.

Fixes <rdar://problem/11634353>.

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

11 years agoAdd extra indent for nested calls inside if's.
Daniel Jasper [Wed, 23 Jan 2013 20:41:06 +0000 (20:41 +0000)]
Add extra indent for nested calls inside if's.

Before:
if (aaaaaaaaaa(
    aaaaaaaaaa)) {}

After:
if (aaaaaaaaaa(
        aaaaaaaaaa)) {}

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

11 years agoImplement -Wvla correctly
Dmitri Gribenko [Wed, 23 Jan 2013 20:02:51 +0000 (20:02 +0000)]
Implement -Wvla correctly

GCC implements -Wvla as "warn on every VLA" (this is useful to find every VLA,
for example, if they are forbidden by coding guidelines).  Currently Clang
implements -Wvla as "warn on VLA when it is an extension".

The attached patch makes our behavior match GCC.  The existing vla extwarn is
moved under -Wvla-extension and is still included into -Wgnu.

This fixes PR5953.

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

11 years agoFactor the trait for lookup into the on-based hash table of
Douglas Gregor [Wed, 23 Jan 2013 18:53:14 +0000 (18:53 +0000)]
Factor the trait for lookup into the on-based hash table of
identifiers into two parts: the part that involves dealing with the
key (which can be re-used) and the ASTReader-specific part that
creates the IdentifierInfos. While I'm at it, StringRef'ify this code,
which was using pair<const char*, unsigned>. No functionality change.

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

11 years agodocs: clear up ambiguity
Sean Silva [Wed, 23 Jan 2013 18:28:48 +0000 (18:28 +0000)]
docs: clear up ambiguity

Anybody using clang is a "developer".

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

11 years ago[PCH] Temporarily disable the "ambiguous macro" warning that is currently bogus with...
Argyrios Kyrtzidis [Wed, 23 Jan 2013 18:21:56 +0000 (18:21 +0000)]
[PCH] Temporarily disable the "ambiguous macro" warning that is currently bogus with a PCH
that redefined a macro without undef'ing it first.

Proper reconstruction of the macro info history from modules will properly fix this in subsequent commits.

rdar://13016031

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

11 years agoDocumentation: add a note that -cc1 options are not guaranteed to be stable
Dmitri Gribenko [Wed, 23 Jan 2013 18:02:28 +0000 (18:02 +0000)]
Documentation: add a note that -cc1 options are not guaranteed to be stable

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

11 years agolibclang: change return type of getCursorDecl() to 'const Decl *'
Dmitri Gribenko [Wed, 23 Jan 2013 17:25:27 +0000 (17:25 +0000)]
libclang: change return type of getCursorDecl() to 'const Decl *'

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

11 years agoUse 'const Decl *' throughout code completion in Sema
Dmitri Gribenko [Wed, 23 Jan 2013 17:21:11 +0000 (17:21 +0000)]
Use 'const Decl *' throughout code completion in Sema

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

11 years agoAdd constness for NestedNameSpecifier::Create parameter
Dmitri Gribenko [Wed, 23 Jan 2013 17:06:56 +0000 (17:06 +0000)]
Add constness for NestedNameSpecifier::Create parameter

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

11 years agoDon't try to align builder-type continuations on assignments.
Daniel Jasper [Wed, 23 Jan 2013 16:58:21 +0000 (16:58 +0000)]
Don't try to align builder-type continuations on assignments.

Before:
int aaaa = aaaaa().aaaaa() // force break
           .aaaaa();
After:
int aaaa = aaaaa().aaaaa() // force break
    .aaaaa();

The other indent is just wrong and confusing.

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

11 years agoConstify some getters in RedeclarableTemplateDecl
Dmitri Gribenko [Wed, 23 Jan 2013 16:52:57 +0000 (16:52 +0000)]
Constify some getters in RedeclarableTemplateDecl

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

11 years agoRemove uneeded casts
Dmitri Gribenko [Wed, 23 Jan 2013 15:56:07 +0000 (15:56 +0000)]
Remove uneeded casts

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

11 years agoDon't try to do a hanging ident after assignments.
Daniel Jasper [Wed, 23 Jan 2013 15:55:19 +0000 (15:55 +0000)]
Don't try to do a hanging ident after assignments.

Before:
bool aaaa = aaaaaaaaaaa(
                aaaaaaaaaaaaaaaaa);

After:
bool aaaa = aaaaaaaaaaa(
    aaaaaaaaaaaaaaaaa);

The other indentation was a nice attempt but doesn't work in many cases.
Not sure what the right long term solution is as the "After: " is still
not nice. We either need to figure out what to do in the cases where it
"doesn't work" or come up with a third solution, e.g. falling back to:

bool aaaa =
    aaaaaaaaaaa(
        aaaaaaaaaaaaaaaaa);

which should always work and nicely highlight the structure.

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

11 years agoFix handling of macro definitions.
Manuel Klimek [Wed, 23 Jan 2013 14:37:36 +0000 (14:37 +0000)]
Fix handling of macro definitions.

Now correctly formats:
 #define A (1)

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

11 years agoFixes layouting regression and invalid-read.
Manuel Klimek [Wed, 23 Jan 2013 14:08:21 +0000 (14:08 +0000)]
Fixes layouting regression and invalid-read.

Layouting would prevent breaking before + in
a[b + c] = d;
Regression detected by code review.

Also fixes an invalid-read found by the valgrind bot.

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

11 years agoFix the formatting of pointer/reference types in range-based for loops.
Daniel Jasper [Wed, 23 Jan 2013 12:58:14 +0000 (12:58 +0000)]
Fix the formatting of pointer/reference types in range-based for loops.

Before: for (int & a : Values) {}
After:  for (int &a : Values) {}

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

11 years agoRemoving the penalty for breaking after "=".
Daniel Jasper [Wed, 23 Jan 2013 12:27:43 +0000 (12:27 +0000)]
Removing the penalty for breaking after "=".

Having seen more cases, this actually was not a good thing to do in the
first place. We can still improve on what we do now, but breaking after
the "=" is good in many cases.

Before:
aaaaaaaaaaaaa = aa->aaaaaaaaaaaaaaaaaaaa(
                    aaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaa));

After:
aaaaaaaaaaaaa =
    aa->aaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaa));

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

11 years agoFix another regression for pointer types.
Daniel Jasper [Wed, 23 Jan 2013 12:10:53 +0000 (12:10 +0000)]
Fix another regression for pointer types.

Before: if (int * a = &b) ...
After:  if (int *a = &b) ...

Also changed all the existing tests to test the expressions in question
both in a declaration and in an expression context.

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

11 years agoAdd a new LangOpt NativeHalfType. This option allows for native half/fp16
Joey Gouly [Wed, 23 Jan 2013 11:56:20 +0000 (11:56 +0000)]
Add a new LangOpt NativeHalfType. This option allows for native half/fp16
operations (as opposed to storage only half/fp16).

Also add some semantic checks for OpenCL half types.

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

11 years agoFix regression in formatting pointer types.
Daniel Jasper [Wed, 23 Jan 2013 11:15:14 +0000 (11:15 +0000)]
Fix regression in formatting pointer types.

We will need a more principled solution, but we should not leave this
unfixed until we come up with one.

Before: void f() { int * a; }
After:  void f() { int *a; }

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

11 years agoFixes incorrect handling of the declaration context stack.
Manuel Klimek [Wed, 23 Jan 2013 11:03:04 +0000 (11:03 +0000)]
Fixes incorrect handling of the declaration context stack.

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

11 years agoFix segfaults in the formatter.
Manuel Klimek [Wed, 23 Jan 2013 10:09:28 +0000 (10:09 +0000)]
Fix segfaults in the formatter.

Also: expletive deleted.

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

11 years agoAdd option to allow putting all parameters onto the next line.
Daniel Jasper [Wed, 23 Jan 2013 10:08:28 +0000 (10:08 +0000)]
Add option to allow putting all parameters onto the next line.

This only affects styles where BinPackParameters is false.

With AllowAllParametersOnNextLine:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);

Without it:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaa,
                                         aaaaaaaaaa,
                                         aaaaaaaaaa,
                                         aaaaaaaaaaa,
                                         aaaaaaaaaaa);

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

11 years agoAllow us to better guess the context of an unwrapped line.
Manuel Klimek [Wed, 23 Jan 2013 09:32:48 +0000 (09:32 +0000)]
Allow us to better guess the context of an unwrapped line.

This gives us the ability to guess better defaults for whether a *
between identifiers is a pointer dereference or binary operator.

Now correctly formats:
void f(a *b);
void f() { f(a * b); }

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

11 years agoExplicitly cast away the const-ness instead of doing it implicitly.
Bill Wendling [Wed, 23 Jan 2013 08:58:23 +0000 (08:58 +0000)]
Explicitly cast away the const-ness instead of doing it implicitly.

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

11 years agoExplicitly cast away the const-ness instead of doing it implicitly.
Bill Wendling [Wed, 23 Jan 2013 08:25:41 +0000 (08:25 +0000)]
Explicitly cast away the const-ness instead of doing it implicitly.

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

11 years agoRemove the last of uses that use the Attribute object as a collection of attributes.
Bill Wendling [Wed, 23 Jan 2013 06:15:10 +0000 (06:15 +0000)]
Remove the last of uses that use the Attribute object as a collection of attributes.

Collections of attributes are handled via the AttributeSet class now. This
finally frees us up to make significant changes to how attributes are structured.

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

11 years agoMake __attribute__((nonnull)) use the general expression evaluator to search for
Nick Lewycky [Wed, 23 Jan 2013 05:08:29 +0000 (05:08 +0000)]
Make __attribute__((nonnull)) use the general expression evaluator to search for
nulls instead of limiting itself to the language-defined "null pointer
constant".

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

11 years agoclang/test/Driver/output-file-is-dir.c: This requires shell due to 'cd'.
NAKAMURA Takumi [Wed, 23 Jan 2013 01:25:23 +0000 (01:25 +0000)]
clang/test/Driver/output-file-is-dir.c: This requires shell due to 'cd'.

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

11 years ago[Driver] Don't remove non-regular files that were outputs.
Daniel Dunbar [Wed, 23 Jan 2013 01:08:23 +0000 (01:08 +0000)]
[Driver] Don't remove non-regular files that were outputs.

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

11 years agoDocumentation cleanup: fixing documentation for FrontendAction.
James Dennett [Wed, 23 Jan 2013 00:45:44 +0000 (00:45 +0000)]
Documentation cleanup: fixing documentation for FrontendAction.
* Fix a typo, s/BeginSourceAction/BeginSourceFile/, so that the documentation
  for FrontendAction::BeginSourceFileAction links correctly to BeginSourceFile;
* Add some basic \file documentation for FrontendAction.h;
* More use of "\brief" instead of repeating the name of the entity being
  documented;
* Stop using Doxygen-style "///" comments in FrontendAction.cpp, as they were
  polluting the documentation for BeginSourceFile;
* Drop incorrect "\see" markup that broke Doxygen's formatting;
* Other minor documentation fixes.

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

11 years agoUse the AttributeSet when adding multiple attributes and an Attribute::AttrKind
Bill Wendling [Wed, 23 Jan 2013 00:21:06 +0000 (00:21 +0000)]
Use the AttributeSet when adding multiple attributes and an Attribute::AttrKind
when adding a single attribute to the function.

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

11 years agoFix compilation on Linux, which defines PATH_MAX in a weird place,
Douglas Gregor [Tue, 22 Jan 2013 23:49:45 +0000 (23:49 +0000)]
Fix compilation on Linux, which defines PATH_MAX in a weird place,
from Saleem Abdulrasool!

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

11 years agoAdd a triple, per Ben's suggestion.
Chad Rosier [Tue, 22 Jan 2013 21:39:58 +0000 (21:39 +0000)]
Add a triple, per Ben's suggestion.

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

11 years agoSecond attempt to fix ppc bots.
Chad Rosier [Tue, 22 Jan 2013 20:57:10 +0000 (20:57 +0000)]
Second attempt to fix ppc bots.

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

11 years agoAdd x86 requirement to hopefully fix ppc bots.
Chad Rosier [Tue, 22 Jan 2013 20:16:41 +0000 (20:16 +0000)]
Add x86 requirement to hopefully fix ppc bots.

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

11 years agoPowerPC: fix __builtin_eh_return_data_regno return
Adhemerval Zanella [Tue, 22 Jan 2013 20:02:45 +0000 (20:02 +0000)]
PowerPC: fix __builtin_eh_return_data_regno return

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

11 years ago[ms-inline asm] Remove the -fenable-experimental-ms-inline-asm flag. MS-style
Chad Rosier [Tue, 22 Jan 2013 19:38:32 +0000 (19:38 +0000)]
[ms-inline asm] Remove the -fenable-experimental-ms-inline-asm flag.  MS-style
inline assembly can be enable with -fasm-blocks or -fms-extensions alone.

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

11 years agoSplit "discards qualifiers" warnings of -Wincompatible-pointer-types into subgroup.
Ted Kremenek [Tue, 22 Jan 2013 19:32:27 +0000 (19:32 +0000)]
Split "discards qualifiers" warnings of -Wincompatible-pointer-types into subgroup.

This allows users to promote -Wincompatible-pointer-type warnings to
errors but keep those for "discard qualifiers" as warnings (if they
so desire).

Addresses <rdar://problem/13062738>.

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

11 years agoUpdate docs: nullptr conversion tool landed
Dmitri Gribenko [Tue, 22 Jan 2013 19:22:22 +0000 (19:22 +0000)]
Update docs: nullptr conversion tool landed

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

11 years agoSmall code change to improve performance
Fariborz Jahanian [Tue, 22 Jan 2013 19:05:17 +0000 (19:05 +0000)]
Small code change to improve performance
in my last patch, suggested by Argyrios.

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

11 years agoobjectiveC (take two): don't warn when in -Wselector mode and
Fariborz Jahanian [Tue, 22 Jan 2013 18:35:43 +0000 (18:35 +0000)]
objectiveC (take two): don't warn when in -Wselector mode and
an unimplemented selector is consumed by
"respondsToSelector:". // rdar://12938616

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

11 years ago[ms-inline asm] Remove a warning about ms-style inline assembly not being
Chad Rosier [Tue, 22 Jan 2013 18:18:22 +0000 (18:18 +0000)]
[ms-inline asm] Remove a warning about ms-style inline assembly not being
supported.

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

11 years agoMake getDefinitiveDeclContext() actually return a DeclContext, as one
Douglas Gregor [Tue, 22 Jan 2013 17:08:30 +0000 (17:08 +0000)]
Make getDefinitiveDeclContext() actually return a DeclContext, as one
would expect, and clean up the return/break inconsistencies. Thanks,
Sebastian!

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

11 years agoFix a bug in VarDecl::getSourceRange() for static member arrays with an element
Nico Weber [Tue, 22 Jan 2013 17:00:09 +0000 (17:00 +0000)]
Fix a bug in VarDecl::getSourceRange() for static member arrays with an element
type with an implicit initializer expression.

Patch from Will Wilson <will@indefiant.com>!

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

11 years agoFormatter: Remove a fixme klimek fixed in r173168.
Nico Weber [Tue, 22 Jan 2013 16:53:59 +0000 (16:53 +0000)]
Formatter: Remove a fixme klimek fixed in r173168.

Add a few comments to the ObjC test cases.

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

11 years agoImplements more principled comment parsing.
Manuel Klimek [Tue, 22 Jan 2013 16:31:55 +0000 (16:31 +0000)]
Implements more principled comment parsing.

Changing nextToken() in the UnwrappedLineParser to get the next
non-comment token. This allows us to correctly layout a whole class of
snippets, like:

if /* */(/* */ a /* */) /* */
  f() /* */; /* */
else /* */
  g();

Fixes a bug in the formatter where we would assume there is a previous
non-comment token.
Also adds the indent level of an unwrapped line to the debug output in
the parser.

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

11 years agoLet the formatter be more restrictive for breaking around . and ->
Daniel Jasper [Tue, 22 Jan 2013 14:28:24 +0000 (14:28 +0000)]
Let the formatter be more restrictive for breaking around . and ->

Before:
aaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)
    .aaaaaaaaaaaaaaaaaa();

After:
aaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaa,
                aaaaaaaaaaaaaaaaaaaaaaa).aaaaaaaaaaaaaaaaaa();

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

11 years agoFix "*" formatting when creating arrays of pointers.
Daniel Jasper [Tue, 22 Jan 2013 11:46:26 +0000 (11:46 +0000)]
Fix "*" formatting when creating arrays of pointers.

Before: A = new int * [10]();
After:  A = new int *[10]();

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

11 years agoSwitch to APFloat constructor taking fltSemantics.
Tim Northover [Tue, 22 Jan 2013 09:46:51 +0000 (09:46 +0000)]
Switch to APFloat constructor taking fltSemantics.

This change also makes the serialisation store the required semantics,
fixing an issue where PPC128 was always assumed when re-reading a
128-bit value.

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

11 years ago[ASan] Fixed darwin-sanitizer-ld.c to match the flags after the switch to the dynamic...
Alexander Potapenko [Tue, 22 Jan 2013 09:27:00 +0000 (09:27 +0000)]
[ASan] Fixed darwin-sanitizer-ld.c to match the flags after the switch to the dynamic runtime.

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

11 years ago[ASan] Link with the dynamic runtime on OS X
Alexander Potapenko [Tue, 22 Jan 2013 09:16:03 +0000 (09:16 +0000)]
[ASan] Link with the dynamic runtime on OS X
This patch changes the behavior of the -fsanitize=address flag, making it use the dynamic runtime library (libclang_rt.asan_osx_dynamic.dylib) instead of the static one. It also drops the CoreFoundation dependency, since the dynamic runtime doesn't need it.

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

11 years agolibclang: Update comment about USEDLIBS in c-*-test/Makefile.
NAKAMURA Takumi [Tue, 22 Jan 2013 04:11:33 +0000 (04:11 +0000)]
libclang: Update comment about USEDLIBS in c-*-test/Makefile.

"Note that 'USEDLIBS' must include all of the core clang libraries when -static is given to linker on cygming."

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

11 years agoUse the correct field to copy/dispose a __block variable.
John McCall [Tue, 22 Jan 2013 03:56:22 +0000 (03:56 +0000)]
Use the correct field to copy/dispose a __block variable.

We were previously hard-coding a particular field index.  This was
fine before (because we were obviously guaranteed the presence
of a copy/dispose member) except for (1) alignment padding and
(2) future extensions adding extra members to the header, such
as the extended-layout pointer.

Note that we only introduce the extended-layout pointer in the
presence of structs.  (We also seem to be introducing it even
in the presence of an all-non-object layout, but that's a
different potential issue.)

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

11 years agoclang/test/Index/comment-to-html-xml-conversion.cpp: Mark this as XFAIL:valgrind...
NAKAMURA Takumi [Tue, 22 Jan 2013 03:49:16 +0000 (03:49 +0000)]
clang/test/Index/comment-to-html-xml-conversion.cpp: Mark this as XFAIL:valgrind, for now. Working in progress.

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

11 years agoclang/test: [CMake] check-clang doesn't require llvm-dis any more.
NAKAMURA Takumi [Tue, 22 Jan 2013 01:52:04 +0000 (01:52 +0000)]
clang/test: [CMake] check-clang doesn't require llvm-dis any more.

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

11 years agoclang/test/CodeGen: Nuke llvm's opt and llvm-dis, and FileCheck-ize two tests. -O1...
NAKAMURA Takumi [Tue, 22 Jan 2013 01:51:59 +0000 (01:51 +0000)]
clang/test/CodeGen: Nuke llvm's opt and llvm-dis, and FileCheck-ize two tests. -O1 is sufficient here.

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

11 years agoclang/test/CodeGen/2006-01-13-StackSave.c: Nuke llvm's opt and llvm-dis, and FileChec...
NAKAMURA Takumi [Tue, 22 Jan 2013 01:51:54 +0000 (01:51 +0000)]
clang/test/CodeGen/2006-01-13-StackSave.c: Nuke llvm's opt and llvm-dis, and FileCheck-ize.

@llvm.stacksave is emitted regardless of "opt -std-compile-opts". We have optimizers' tests in llvm/test/Transforms.

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

11 years agoclang/test/CodeGen/blocks-seq.c: FileCheck-ize.
NAKAMURA Takumi [Tue, 22 Jan 2013 01:51:48 +0000 (01:51 +0000)]
clang/test/CodeGen/blocks-seq.c: FileCheck-ize.

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

11 years agoRemove "incorrect" aligning of trailing comments.
Daniel Jasper [Mon, 21 Jan 2013 22:49:20 +0000 (22:49 +0000)]
Remove "incorrect" aligning of trailing comments.

We used to align trailing comments belong to different things.
Before:
void f() { // some function..
}
int a;     // some variable..

After:
void f() { // some function..
}
int a; // some variable..

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

11 years agoHave AttributeSet::getRetAttributes() return an AttributeSet instead of Attribute.
Bill Wendling [Mon, 21 Jan 2013 22:45:00 +0000 (22:45 +0000)]
Have AttributeSet::getRetAttributes() return an AttributeSet instead of Attribute.

This further restricts the use of the Attribute class to the Attribute family of
classes.

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

11 years agoobjectiveC: don't warn when in -Wselector mode and
Fariborz Jahanian [Mon, 21 Jan 2013 22:32:29 +0000 (22:32 +0000)]
objectiveC: don't warn when in -Wselector mode and
an unimplemented selector is consumed by
"respondsToSelector:". // rdar://12938616

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