]> granicus.if.org Git - clang/log
clang
11 years agoAllow the computation of the base priority for a declaration code completion result...
Douglas Gregor [Thu, 31 Jan 2013 04:52:16 +0000 (04:52 +0000)]
Allow the computation of the base priority for a declaration code completion result to consider the completion context

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

11 years agoReplace "failed template argument deduction" diagnostic with something useful
Richard Smith [Thu, 31 Jan 2013 04:03:12 +0000 (04:03 +0000)]
Replace "failed template argument deduction" diagnostic with something useful
in the one case where we've already factored out a reason code.

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

11 years agoRemove elements from Sema.UndefinedInternals as functions are defined. Also
Nick Lewycky [Thu, 31 Jan 2013 03:23:57 +0000 (03:23 +0000)]
Remove elements from Sema.UndefinedInternals as functions are defined. Also
filter the elements before emitting them into a PCH. No user-visible
functionality change, except that PCH files may be smaller?

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

11 years agoFix grammar in comment.
Nick Lewycky [Thu, 31 Jan 2013 03:15:20 +0000 (03:15 +0000)]
Fix grammar in comment.

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

11 years agoClarify the diagnostic for -Wnested-anon-types.
Richard Smith [Thu, 31 Jan 2013 03:11:12 +0000 (03:11 +0000)]
Clarify the diagnostic for -Wnested-anon-types.

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

11 years ago[analyzer] If a lazy binding is undefined, pretend that it's unknown instead.
Jordan Rose [Thu, 31 Jan 2013 02:57:06 +0000 (02:57 +0000)]
[analyzer] If a lazy binding is undefined, pretend that it's unknown instead.

This is a hack to work around the fact that we don't track extents for our
default bindings:

  CGPoint p;
  p.x = 0.0;
  p.y = 0.0;
  rectParam.origin = p;
  use(rectParam.size); // warning: uninitialized value in rectParam.size.width

In this case, the default binding for 'p' gets copied into 'rectParam',
because the 'origin' field is at offset 0 within CGRect. From then on,
rectParam's old default binding (in this case a symbol) is lost.

This patch silences the warning by pretending that lazy bindings are never
made from uninitialized memory, but not only is that not true, the original
default binding is still getting overwritten (see FIXME test cases).
The long-term solution is tracked in <rdar://problem/12701038>

PR14765 and <rdar://problem/12875012>

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

11 years agoWhen comparing two template template arguments in the template differ, consider
Richard Trieu [Thu, 31 Jan 2013 02:47:46 +0000 (02:47 +0000)]
When comparing two template template arguments in the template differ, consider
them the same if they are actually the same; having the same name isn't enough.

Similar to r174013, template template arguments were also mistakenly considered
the same when they had the same name but were in different namespaces.
In addition, when printing template template arguments, use the qualified name
if the regular name is the same.

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

11 years agoFix -Wcovered-switch-default and -Wunused-private-field warnings.
Richard Smith [Thu, 31 Jan 2013 02:04:38 +0000 (02:04 +0000)]
Fix -Wcovered-switch-default and -Wunused-private-field warnings.

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

11 years agoAdd indents to AST dumping and removed parenthesis from AST nodes.
Richard Trieu [Thu, 31 Jan 2013 01:44:26 +0000 (01:44 +0000)]
Add indents to AST dumping and removed parenthesis from AST nodes.
Indents were given the color blue when outputting with color.
AST dumping now looks like this:

Node
|-Node
| `-Node
`-Node
  `-Node

Compared to the previous:

(Node
  (Node
    (Node))
  (Node
    (Node)))

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

11 years agoFix ODR-use of a MemberExpr to check before marking a pure function used. Remove
Nick Lewycky [Thu, 31 Jan 2013 01:34:31 +0000 (01:34 +0000)]
Fix ODR-use of a MemberExpr to check before marking a pure function used. Remove
a workaround for this bug from the -Wundefined-internals warning.

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

11 years ago[analyzer] Fix a bug in region store that lead to undefined value false
Anna Zaks [Thu, 31 Jan 2013 01:19:52 +0000 (01:19 +0000)]
[analyzer] Fix a bug in region store that lead to undefined value false
positives.

The includeSuffix was only set on the first iteration through the
function, resulting in invalid regions being produced by getLazyBinding
(ex: zoomRegion.y).

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

11 years agoSometimes ld is just ld.
Matt Beaumont-Gay [Thu, 31 Jan 2013 01:15:55 +0000 (01:15 +0000)]
Sometimes ld is just ld.

Don't expect a character between the double-quotes and 'ld'.

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

11 years agoWhen comparing two templates in the template differ, consider them the
Douglas Gregor [Thu, 31 Jan 2013 01:08:35 +0000 (01:08 +0000)]
When comparing two templates in the template differ, consider them the
same if they are actually the same; having the same name isn't
enough. Fixes <rdar://problem/12931988>.

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

11 years agoMake sure that the Attribute object represents one attribute only.
Bill Wendling [Thu, 31 Jan 2013 00:30:05 +0000 (00:30 +0000)]
Make sure that the Attribute object represents one attribute only.

Several places were still treating the Attribute object as respresenting
multiple attributes. Those places now use the AttributeSet to represent
multiple attributes.

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

11 years agoFix unused variable warnings in -asserts build
Matt Beaumont-Gay [Thu, 31 Jan 2013 00:08:03 +0000 (00:08 +0000)]
Fix unused variable warnings in -asserts build

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

11 years agoReinstate r173952, this time limiting it to exactly the form
Douglas Gregor [Wed, 30 Jan 2013 23:10:17 +0000 (23:10 +0000)]
Reinstate r173952, this time limiting it to exactly the form

  #define X X

for which there is no point warning, ever.

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

11 years agoDiagnostics: Clarify name of line-length-limiting constant in r173976.
Jordan Rose [Wed, 30 Jan 2013 22:14:15 +0000 (22:14 +0000)]
Diagnostics: Clarify name of line-length-limiting constant in r173976.

Thanks, Sean.

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

11 years agoChanged to static_cast, due to post-commit review.
Filipe Cabecinhas [Wed, 30 Jan 2013 22:03:24 +0000 (22:03 +0000)]
Changed to static_cast, due to post-commit review.

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

11 years agoTableGen backends: use emitSourceFileHeader() to emit the warning about
Dmitri Gribenko [Wed, 30 Jan 2013 21:54:20 +0000 (21:54 +0000)]
TableGen backends: use emitSourceFileHeader() to emit the warning about
file contents being autogenerated

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

11 years agoCast to remove the narrowing conversion error in c++11.
Filipe Cabecinhas [Wed, 30 Jan 2013 21:50:21 +0000 (21:50 +0000)]
Cast to remove the narrowing conversion error in c++11.

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

11 years agoDiagnostics: if a line is longer than 4096 characters, don't print it.
Jordan Rose [Wed, 30 Jan 2013 21:41:07 +0000 (21:41 +0000)]
Diagnostics: if a line is longer than 4096 characters, don't print it.

Specifically, don't print snippets, caret diagnostics, or ranges for
lines over 4096 characters. We copy the line around a few times in our
diagnostics machinery, and we have to print a caret line that's just as
long. This uses a lot of memory just to create a poor user experience as
we print out a line much too long for anyone to read...or spend extra
energy trying to fit it to -fmessage-length.

<rdar://problem/13106850>

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

11 years agoRevert "[preprocessor] Don't warn about "disabled expansion of recursive macro""
Argyrios Kyrtzidis [Wed, 30 Jan 2013 20:42:17 +0000 (20:42 +0000)]
Revert "[preprocessor] Don't warn about "disabled expansion of recursive macro""

This reverts commit r173952

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

11 years agoHandle passing non-Qualtypes to %diff better. Instead of asserting, fall back
Richard Trieu [Wed, 30 Jan 2013 20:04:31 +0000 (20:04 +0000)]
Handle passing non-Qualtypes to %diff better.  Instead of asserting, fall back
to printing the default case.  This is a fix for PR15023.

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

11 years agoAdd OpenCL error that a kernel function must have void return type. Includes a test...
Tanya Lattner [Wed, 30 Jan 2013 19:48:52 +0000 (19:48 +0000)]
Add OpenCL error that a kernel function must have void return type. Includes a test case.

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

11 years agoFix comment in test/Lexer/utf8-invalid.c for updates in r173959.
Jordan Rose [Wed, 30 Jan 2013 19:29:14 +0000 (19:29 +0000)]
Fix comment in test/Lexer/utf8-invalid.c for updates in r173959.

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

11 years agoFix r173881 to properly skip invalid UTF-8 characters in raw lexing and -E.
Jordan Rose [Wed, 30 Jan 2013 19:21:12 +0000 (19:21 +0000)]
Fix r173881 to properly skip invalid UTF-8 characters in raw lexing and -E.

This caused hangs as we processed the same invalid byte over and over.

<rdar://problem/13115651>

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

11 years ago[analyzer] Make shallow mode more shallow.
Anna Zaks [Wed, 30 Jan 2013 19:12:39 +0000 (19:12 +0000)]
[analyzer] Make shallow mode more shallow.

Redefine the shallow mode to inline all functions for which we have a
definite definition (ipa=inlining). However, only inline functions that
are up to 4 basic blocks large and cut the max exploded nodes generated
per top level function in half.

This makes shallow faster and allows us to keep inlining small
functions. For example, we would keep inlining wrapper functions and
constructors/destructors.

With the new shallow, it takes 104s to analyze sqlite3, whereas
the deep mode is 658s and previous shallow is 209s.

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

11 years ago[analyzer] Use analyzer config for max-inlinable-size option.
Anna Zaks [Wed, 30 Jan 2013 19:12:36 +0000 (19:12 +0000)]
[analyzer] Use analyzer config for max-inlinable-size option.

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

11 years ago[analyzer] Move report false positive suppression to report visitors.
Anna Zaks [Wed, 30 Jan 2013 19:12:34 +0000 (19:12 +0000)]
[analyzer] Move report false positive suppression to report visitors.

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

11 years ago[analyzer] Remove further references to analyzer-ipa.
Anna Zaks [Wed, 30 Jan 2013 19:12:26 +0000 (19:12 +0000)]
[analyzer] Remove further references to analyzer-ipa.

Thanks Jordan!

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

11 years agoscan-build: When using Xcode 4.6, use build settings for doing proper build interposi...
Ted Kremenek [Wed, 30 Jan 2013 19:10:24 +0000 (19:10 +0000)]
scan-build: When using Xcode 4.6, use build settings for doing proper build interposition.

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

11 years agoHoist retrieval of Expr* into caller. No functionality change.
Ted Kremenek [Wed, 30 Jan 2013 19:10:21 +0000 (19:10 +0000)]
Hoist retrieval of Expr* into caller.  No functionality change.

Just makes the code a little cleaner, and easier to reason about.

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

11 years ago[preprocessor] Don't warn about "disabled expansion of recursive macro"
Argyrios Kyrtzidis [Wed, 30 Jan 2013 18:55:52 +0000 (18:55 +0000)]
[preprocessor] Don't warn about "disabled expansion of recursive macro"
for "#define X X".

This is a pattern that, for example, stdbool.h uses.
rdar://12435773

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

11 years ago[analyzer] Model trivial copy/move ctors with an aggregate bind.
Jordan Rose [Wed, 30 Jan 2013 18:16:06 +0000 (18:16 +0000)]
[analyzer] Model trivial copy/move ctors with an aggregate bind.

This is faster for the analyzer to process than inlining the constructor
and performing a member-wise copy, and it also solves the problem of
warning when a partially-initialized POD struct is copied.

Before:
  CGPoint p;
  p.x = 0;
  CGPoint p2 = p; <-- assigned value is garbage or undefined

After:
  CGPoint p;
  p.x = 0;
  CGPoint p2 = p; // no-warning

This matches our behavior in C, where we don't see a field-by-field copy.

<rdar://problem/12305288>

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

11 years agoDocumentation: fix escaping in JSON example
Dmitri Gribenko [Wed, 30 Jan 2013 17:58:39 +0000 (17:58 +0000)]
Documentation: fix escaping in JSON example

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

11 years agoDocumentation: add a link to Bear, a tool to help with JSON DB
Dmitri Gribenko [Wed, 30 Jan 2013 17:58:14 +0000 (17:58 +0000)]
Documentation: add a link to Bear, a tool to help with JSON DB

Patch by Laszlo Nagy

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

11 years agoDocumentation: fix link to ExecuteAction(), which was previously typoed as
James Dennett [Wed, 30 Jan 2013 17:53:07 +0000 (17:53 +0000)]
Documentation: fix link to ExecuteAction(), which was previously typoed as
"ExecutionAction()".

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

11 years agoComment parsing: fold named character references test into other HTML tests
Dmitri Gribenko [Wed, 30 Jan 2013 14:44:47 +0000 (14:44 +0000)]
Comment parsing: fold named character references test into other HTML tests

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

11 years agoComment parsing: resolve more named character references
Dmitri Gribenko [Wed, 30 Jan 2013 14:29:28 +0000 (14:29 +0000)]
Comment parsing: resolve more named character references

This reimplements r173850 with a better approach:
(1) use a TableGen-generated matcher instead of doing a linear search;
(2) avoid allocations for new strings by converting code points to string
    iterals with TableGen.

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

11 years agoRevert unintended change
Dmitri Gribenko [Wed, 30 Jan 2013 12:40:40 +0000 (12:40 +0000)]
Revert unintended change

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

11 years agoIndex/special-html-characters.m: mark this as XFAIL for valgrind
Dmitri Gribenko [Wed, 30 Jan 2013 12:17:33 +0000 (12:17 +0000)]
Index/special-html-characters.m: mark this as XFAIL for valgrind

Fix is being discussed on cfe-dev.

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

11 years agoMove UTF conversion routines from clang/lib/Basic to llvm/lib/Support
Dmitri Gribenko [Wed, 30 Jan 2013 12:06:08 +0000 (12:06 +0000)]
Move UTF conversion routines from clang/lib/Basic to llvm/lib/Support

This is required to use them in TableGen.

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

11 years agoAlso promote fp16 types to double when they're anonymous variadic arguments.
Tim Northover [Wed, 30 Jan 2013 09:46:55 +0000 (09:46 +0000)]
Also promote fp16 types to double when they're anonymous variadic arguments.

__fp16 isn't covered by the standard, but this resolves the oddity that float
gets promoted when passed variadically, but not the smaller type. This is
required by the AArch64 ABI, and a sane action elsewhere.

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

11 years agoDon't generate no-op replacements.
Daniel Jasper [Wed, 30 Jan 2013 09:46:12 +0000 (09:46 +0000)]
Don't generate no-op replacements.

No functional changes.

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

11 years agoAdd "instancetype" as a code completion result for the return type of
Douglas Gregor [Wed, 30 Jan 2013 07:11:43 +0000 (07:11 +0000)]
Add "instancetype" as a code completion result for the return type of
an Objective-C method. Fixes <rdar://problem/13069990>.

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

11 years agoThe instance methods of the root class of an Objective-C hieararchy
Douglas Gregor [Wed, 30 Jan 2013 06:58:39 +0000 (06:58 +0000)]
The instance methods of the root class of an Objective-C hieararchy
can be messaged via the metaclass. Provide code completions for this
case. Fixes <rdar://problem/12560296>.

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

11 years agoC11: Provide the missing half of <stdalign.h>
Richard Smith [Wed, 30 Jan 2013 06:33:54 +0000 (06:33 +0000)]
C11: Provide the missing half of <stdalign.h>

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

11 years agoFix test failure from previous change.
Richard Smith [Wed, 30 Jan 2013 06:27:44 +0000 (06:27 +0000)]
Fix test failure from previous change.

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

11 years agoSemantic analysis and CodeGen support for C11's _Noreturn. This is modeled as
Richard Smith [Wed, 30 Jan 2013 05:45:05 +0000 (05:45 +0000)]
Semantic analysis and CodeGen support for C11's _Noreturn. This is modeled as
an attribute for consistency with our other noreturn mechanisms.

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

11 years agoDon't warn on fall-through from unreachable code.
Alexander Kornienko [Wed, 30 Jan 2013 03:49:44 +0000 (03:49 +0000)]
Don't warn on fall-through from unreachable code.

Summary:
A motivating example:
class ClassWithDtor {
public:
  ~ClassWithDtor() {}
};
void fallthrough3(int n) {
  switch (n) {
    case 2:
      do {
        ClassWithDtor temp;
        return;
      } while (0);  // This generates a chain of unreachable CFG blocks.
    case 3:
      break;
  }
}

Reviewers: rsmith, doug.gregor, alexfh

Reviewed By: alexfh

CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D330

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

11 years agoUnresolved lookups can have using declarations that refer to
Douglas Gregor [Wed, 30 Jan 2013 02:10:08 +0000 (02:10 +0000)]
Unresolved lookups can have using declarations that refer to
unresolved using declarations. Fixes PR14768 / <rdar://problem/13030296>.

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

11 years agoDon't warn about Unicode characters in -E mode.
Jordan Rose [Wed, 30 Jan 2013 01:52:57 +0000 (01:52 +0000)]
Don't warn about Unicode characters in -E mode.

People use the C preprocessor for things other than C files. Some of them
have Unicode characters. We shouldn't warn about Unicode characters
appearing outside of identifiers in this case.

There's not currently a way for the preprocessor to tell if it's in -E mode,
so I added a new flag, derived from the PreprocessorOutputOptions. This is
only used by the Unicode warnings for now, but could conceivably be used by
other warnings or even behavioral differences later.

<rdar://problem/13107323>

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

11 years ago[Sema] Constrain test added in r173873 with expected-error-re
David Blaikie [Wed, 30 Jan 2013 01:43:36 +0000 (01:43 +0000)]
[Sema] Constrain test added in r173873 with expected-error-re

Suggested in post-commit review by Richard Smith.

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

11 years agoProvide a fixit for constexpr non-static data members.
David Blaikie [Wed, 30 Jan 2013 01:22:18 +0000 (01:22 +0000)]
Provide a fixit for constexpr non-static data members.

If the member has an initializer, assume it was probably intended to be static
and suggest/recover with that.

If the member doesn't have an initializer, assume it was probably intended to
be const instead of constexpr and suggest that.

(if the attempt to apply these changes fails, don't make any suggestion &
produce the same diagnostic experience as before. The only case where this can
come up that I know of is with a mutable constexpr with an initializer, since
mutable is incompatible with static (but it's already incompatible with
const anyway))

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

11 years agoc: When checking on validity of sizeof passed as size of
Fariborz Jahanian [Wed, 30 Jan 2013 01:12:44 +0000 (01:12 +0000)]
c: When checking on validity of sizeof passed as size of
argument to be memset, check for its type to be complete
before calling Context.getTypeSize(PointeeTy) to prevent
crash. // rdar://13081751.

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

11 years ago[Frontend] Factor AddUnmappedPath() out of AddPath() and simplify.
Daniel Dunbar [Wed, 30 Jan 2013 01:06:03 +0000 (01:06 +0000)]
[Frontend] Factor AddUnmappedPath() out of AddPath() and simplify.

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

11 years ago[Frontend] Remove HeaderSearchOptions::Entry::IsInternal, which is unused.
Daniel Dunbar [Wed, 30 Jan 2013 00:34:26 +0000 (00:34 +0000)]
[Frontend] Remove HeaderSearchOptions::Entry::IsInternal, which is unused.

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

11 years agoclang/test/Driver/asan-ld.c: Try not to mismatch temporary file, like "tmpkcfdld".
NAKAMURA Takumi [Wed, 30 Jan 2013 00:21:41 +0000 (00:21 +0000)]
clang/test/Driver/asan-ld.c: Try not to mismatch temporary file, like "tmpkcfdld".

If we had the regular expression "\b" in FileCheck like Perl...

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

11 years ago[Frontend] Remove actual ImplicitExternC member variable.
Daniel Dunbar [Wed, 30 Jan 2013 00:20:43 +0000 (00:20 +0000)]
[Frontend] Remove actual ImplicitExternC member variable.

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

11 years ago[Frontend] Add an ExternCSystem include entry group.
Daniel Dunbar [Wed, 30 Jan 2013 00:19:24 +0000 (00:19 +0000)]
[Frontend] Add an ExternCSystem include entry group.

 - The only group where it makes sense for the "ExternC" bit is System, so this
   simplifies having to have the extra isCXXAware (or ImplicitExternC, depending
   on what code you talk to) bit caried around.

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

11 years agoRemoved couple of html named character references in
Fariborz Jahanian [Wed, 30 Jan 2013 00:10:09 +0000 (00:10 +0000)]
Removed couple of html named character references in
my last patch.

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

11 years ago[Frontend] Make the include dir group independent from the "use sysroot" bit.
Daniel Dunbar [Tue, 29 Jan 2013 23:59:45 +0000 (23:59 +0000)]
[Frontend] Make the include dir group independent from the "use sysroot" bit.

 - This slightly decouples the path handling, since before the group sometimes
   dominated the "use sysroot" bit, but it was still passed in via the API.

 - No functionality change.

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

11 years ago[Frontend] Rename a member variable to clarify its intent.
Daniel Dunbar [Tue, 29 Jan 2013 23:59:43 +0000 (23:59 +0000)]
[Frontend] Rename a member variable to clarify its intent.

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

11 years ago[Frontend] Factor out helper function, for clarity.
Daniel Dunbar [Tue, 29 Jan 2013 23:59:37 +0000 (23:59 +0000)]
[Frontend] Factor out helper function, for clarity.

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

11 years ago[driver] Clear the FailureResultFiles when initializing clang diagnostics. Also,
Chad Rosier [Tue, 29 Jan 2013 23:57:10 +0000 (23:57 +0000)]
[driver] Clear the FailureResultFiles when initializing clang diagnostics. Also,
minor cleanup.

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

11 years ago[Doc parsing] Patch to parse Doxygen-supported HTML character
Fariborz Jahanian [Tue, 29 Jan 2013 23:42:26 +0000 (23:42 +0000)]
[Doc parsing] Patch to parse Doxygen-supported HTML character
references to their UTIF-8 encoding. Reviewed offline by Doug.
// rdar://12392215

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

11 years ago[ubsan] Implement the -fcatch-undefined-behavior flag using a trapping
Chad Rosier [Tue, 29 Jan 2013 23:31:22 +0000 (23:31 +0000)]
[ubsan] Implement the -fcatch-undefined-behavior flag using a trapping
implementation; this is much more inline with the original implementation
(i.e., pre-ubsan) and does not require run-time library support.

The trapping implementation can be invoked using either '-fcatch-undefined-behavior'
or '-fsanitize=undefined-trap -fsanitize-undefined-trap-on-error', with the latter
being preferred.  Eventually, the -fcatch-undefined-behavior' flag will be removed.

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

11 years agoclang/test/Index/getcursor-preamble.m: Formatting.
NAKAMURA Takumi [Tue, 29 Jan 2013 23:03:22 +0000 (23:03 +0000)]
clang/test/Index/getcursor-preamble.m: Formatting.

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

11 years agoclang/test/Index/getcursor-preamble.m: Tweak for win32. env(1) is required to change...
NAKAMURA Takumi [Tue, 29 Jan 2013 23:03:16 +0000 (23:03 +0000)]
clang/test/Index/getcursor-preamble.m: Tweak for win32. env(1) is required to change variables locally.

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

11 years agoMove -Wstatic-float-init fixit into a note & don't recover as if constexpr
David Blaikie [Tue, 29 Jan 2013 22:26:08 +0000 (22:26 +0000)]
Move -Wstatic-float-init fixit into a note & don't recover as if constexpr

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

11 years agoDon't fixit/recover from -Wstatic-float-init when it's not an error.
David Blaikie [Tue, 29 Jan 2013 21:40:37 +0000 (21:40 +0000)]
Don't fixit/recover from -Wstatic-float-init when it's not an error.

Fix to change r173414 that lead to Clang changing const to constexpr even under
-Wno-static-float-init.

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

11 years agoMove the token annotator into separate files.
Daniel Jasper [Tue, 29 Jan 2013 21:01:14 +0000 (21:01 +0000)]
Move the token annotator into separate files.

No functional changes. Also removed experimental-warning from all of
clang-format's files, as it is no longer accurate.

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

11 years ago[Preprocessor] When checking if we can concatenate two tokens, check
Argyrios Kyrtzidis [Tue, 29 Jan 2013 20:28:24 +0000 (20:28 +0000)]
[Preprocessor] When checking if we can concatenate two tokens, check
if they were already concatenated in source using the spelling locations
even if they came from a macro expansion.

This fixes an issue where a GUID passed as macro argument ends up
malformed after preprocessing because we added spaces inside it.

rdar://13016645

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

11 years ago[driver] Refactor the driver so that a failing commands doesn't prevent
Chad Rosier [Tue, 29 Jan 2013 20:15:05 +0000 (20:15 +0000)]
[driver] Refactor the driver so that a failing commands doesn't prevent
subsequent commands from being executed.

The diagnostics generation isn't designed for this use case, so add a note to
fix this in the very near future.  For now, just generated the diagnostics for
the first failing command.
Part of rdar://12984531

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

11 years agoImprove formatting of code with comments.
Daniel Jasper [Tue, 29 Jan 2013 19:41:55 +0000 (19:41 +0000)]
Improve formatting of code with comments.

Before:
aaaaaaa(aaaaaa( // comment
                aaaaaaa));
<big mess>

After:
aaaaaaa(aaaaaa( // comment
    aaaaaaaa));
function(/* parameter 1 */ aaaaaaa,
         /* parameter 2 */ aaaaaaa,
         /* parameter 3 */ aaaaaaa,
         /* parameter 4 */ aaaaaaa);

(the latter example was only wrong in the one-arg-per-line mode, e.g. in
Google style).

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

11 years agoMark a struct definition in an objc container with the TopLevelDeclInObjCContainer...
Argyrios Kyrtzidis [Tue, 29 Jan 2013 18:00:54 +0000 (18:00 +0000)]
Mark a struct definition in an objc container with the TopLevelDeclInObjCContainer bit.

Fixes accurately getting a cursor inside an objc container containing a struct definition,
from a PCH/preamble file.

rdar://12584613

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

11 years agoAllow all parameters on next line for function calls in Chrome.
Daniel Jasper [Tue, 29 Jan 2013 16:03:49 +0000 (16:03 +0000)]
Allow all parameters on next line for function calls in Chrome.

The style guide only forbids this for function declarations. So,
now

someFunction(
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);

Is allowed in Chromium mode.

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

11 years agoSplit ">>" in "A<B<C> >" in Chromium style.
Daniel Jasper [Tue, 29 Jan 2013 15:19:38 +0000 (15:19 +0000)]
Split ">>" in "A<B<C> >" in Chromium style.

It needs to be compatible with C++03.

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

11 years agoFix uninitialized error caused by r173801.
Daniel Jasper [Tue, 29 Jan 2013 15:15:59 +0000 (15:15 +0000)]
Fix uninitialized error caused by r173801.

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

11 years agoFix a crash in OpenCL code by using the proper (RHS) bit-width.
Joey Gouly [Tue, 29 Jan 2013 15:09:40 +0000 (15:09 +0000)]
Fix a crash in OpenCL code by using the proper (RHS) bit-width.

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

11 years agoCalculate the split penalty upfront.
Daniel Jasper [Tue, 29 Jan 2013 15:03:01 +0000 (15:03 +0000)]
Calculate the split penalty upfront.

This is
a) More efficient.
b) Important as we move forward with further metrics for penalty.

No functional changes intended.

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

11 years agoFix a comment and reformat clang-format with clang-format
Daniel Jasper [Tue, 29 Jan 2013 11:27:30 +0000 (11:27 +0000)]
Fix a comment and reformat clang-format with clang-format

Not all changes might be ideal, but IMO all are acceptable.

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

11 years agoInitial support for multiple variable declarations.
Daniel Jasper [Tue, 29 Jan 2013 11:21:01 +0000 (11:21 +0000)]
Initial support for multiple variable declarations.

Before:
  SomeType aaaaaaaaaaaaaaaaa = aaaaaa->aaaaaaaaaaaaaaaaa(),
      aaaaaaaaaaa = aaaaaa->aaaaaaaaaaa();
After:
  SomeType aaaaaaaaaaaaaaaaa = aaaaaa->aaaaaaaaaaaaaaaaa(),
           aaaaaaaaaaa = aaaaaa->aaaaaaaaaaa();

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

11 years agoAdd a diagnostic for an OpenCL kernel with a pointer pointer argument.
Joey Gouly [Tue, 29 Jan 2013 10:54:06 +0000 (10:54 +0000)]
Add a diagnostic for an OpenCL kernel with a pointer pointer argument.
Also refactor the surrounding code a little.

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

11 years agoTest update missed in r173789.
Richard Smith [Tue, 29 Jan 2013 10:18:33 +0000 (10:18 +0000)]
Test update missed in r173789.

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

11 years agoProduce a diagnostic if alignas is applied to an expression. Neither C11 nor
Richard Smith [Tue, 29 Jan 2013 10:18:18 +0000 (10:18 +0000)]
Produce a diagnostic if alignas is applied to an expression. Neither C11 nor
C++11 allows that.

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

11 years agoDowngrade 'attribute ignored when parsing type' from error to warning, to match
Richard Smith [Tue, 29 Jan 2013 10:02:16 +0000 (10:02 +0000)]
Downgrade 'attribute ignored when parsing type' from error to warning, to match
the diagnostic's warn_ name. Switch some places (notably C++11 attributes)
which really wanted an error over to a different diagnostic. Finally, suppress
the diagnostic entirely for __ptr32, __ptr64 and __w64, to avoid producing
diagnostics in important system headers.

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

11 years agoReverting changes from r173785 (removing empty lines before "}").
Daniel Jasper [Tue, 29 Jan 2013 10:00:16 +0000 (10:00 +0000)]
Reverting changes from r173785 (removing empty lines before "}").

This needs some more thinking, e.g. for namespaces, chains of if-else
if, ...

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

11 years agoRemove empty lines before "}".
Daniel Jasper [Tue, 29 Jan 2013 09:42:11 +0000 (09:42 +0000)]
Remove empty lines before "}".

Those empty lines waste vertical whitespace and almost never
increase readability.

Before:
void f() {
  DoSomething();

}

After:
void f() {
  DoSomething();
}

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

11 years agoImplement C++11 [dcl.align]p1 and C11 6.7.5/2 rules for alignas and _Alignas.
Richard Smith [Tue, 29 Jan 2013 09:02:09 +0000 (09:02 +0000)]
Implement C++11 [dcl.align]p1 and C11 6.7.5/2 rules for alignas and _Alignas.

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

11 years agoC++11 status:
Richard Smith [Tue, 29 Jan 2013 04:55:18 +0000 (04:55 +0000)]
C++11 status:
 * Mark 'sequence points' as done now we have a warning for unsequenced operations
 * Mark 'memory model' as done now we correctly model bitfield operations

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

11 years agoPropagate the spelling list index for an attribute across template instantiation.
Richard Smith [Tue, 29 Jan 2013 04:21:28 +0000 (04:21 +0000)]
Propagate the spelling list index for an attribute across template instantiation.

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

11 years agoPR15017: A '>' can appear after a type-specifier in a template-argument-list.
Richard Smith [Tue, 29 Jan 2013 04:13:32 +0000 (04:13 +0000)]
PR15017: A '>' can appear after a type-specifier in a template-argument-list.
It turns out that there's no correctness bug here (because we can't have a type
definition in this location), but there was a diagnostic bug.

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

11 years agoAdd a test case for attribute print.
Michael Han [Tue, 29 Jan 2013 04:13:20 +0000 (04:13 +0000)]
Add a test case for attribute print.

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

11 years agoModify the tests for the (sorted) order that the attributes come out as now.
Bill Wendling [Tue, 29 Jan 2013 03:21:00 +0000 (03:21 +0000)]
Modify the tests for the (sorted) order that the attributes come out as now.

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

11 years agoPR15100: look through type sugar when determining whether we have one of the
Richard Smith [Tue, 29 Jan 2013 02:49:47 +0000 (02:49 +0000)]
PR15100: look through type sugar when determining whether we have one of the
forms of 'main' which we accept as an extension.

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

11 years agoFold tests for C++ 'main' into a single file.
Richard Smith [Tue, 29 Jan 2013 02:42:09 +0000 (02:42 +0000)]
Fold tests for C++ 'main' into a single file.

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

11 years agoTest that we print MS keyword attributes without a __declspec(...) adornment.
Richard Smith [Tue, 29 Jan 2013 02:31:57 +0000 (02:31 +0000)]
Test that we print MS keyword attributes without a __declspec(...) adornment.

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

11 years agoTreat alignas and _Alignas as keyword attributes. This allows us to
Richard Smith [Tue, 29 Jan 2013 01:48:07 +0000 (01:48 +0000)]
Treat alignas and _Alignas as keyword attributes. This allows us to
pretty-print them properly (modulo the more general badness in alignment
attribute printing).

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

11 years agoActually remove the hack which was blocking the Borland-style attributes from
Richard Smith [Tue, 29 Jan 2013 01:38:41 +0000 (01:38 +0000)]
Actually remove the hack which was blocking the Borland-style attributes from
working, and add the missing attribute spellings. This brings _pascal,
_fastcall, _stdcall and _cdecl to life in -fborland-extensions mode.

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