]> granicus.if.org Git - clang/log
clang
11 years agoChange this to an IR test instead of an assembly test (as per comment in r171134).
David Blaikie [Fri, 28 Dec 2012 01:16:31 +0000 (01:16 +0000)]
Change this to an IR test instead of an assembly test (as per comment in r171134).

This makes the test not dependent on LLVM & won't vary/break based on LLVM
codegen related changes. Appropriately testing at the Clang level what was
fixed at the Clang level originally (in r124210).

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

11 years agoSimplify typeid 'potentially evaluated' check.
Richard Smith [Thu, 27 Dec 2012 15:26:27 +0000 (15:26 +0000)]
Simplify typeid 'potentially evaluated' check.

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

11 years agoImplement dcl.link paragraph 5.
Rafael Espindola [Thu, 27 Dec 2012 03:56:20 +0000 (03:56 +0000)]
Implement dcl.link paragraph 5.

The language linkage of redeclarations must match. GCC was already reporting
an error for this.

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

11 years agoUpdate test for backend change.
Eric Christopher [Thu, 27 Dec 2012 02:20:24 +0000 (02:20 +0000)]
Update test for backend change.

TODO: This test should be moved to the backend.

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

11 years agoFix a regression from the previous commit.
Rafael Espindola [Wed, 26 Dec 2012 04:38:44 +0000 (04:38 +0000)]
Fix a regression from the previous commit.
Template instantiation can set the canonical decl to used after subsequent
decls have been chained, so we have to check that too.

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

11 years agoUse the most recent redecl to decide if it is needed.
Rafael Espindola [Wed, 26 Dec 2012 00:13:29 +0000 (00:13 +0000)]
Use the most recent redecl to decide if it is needed.

This fixes pr14691, which I think is a regression from r168519.

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

11 years agoProduce an actual error before attempting to attach notes to it when bailing out
Richard Smith [Tue, 25 Dec 2012 21:56:27 +0000 (21:56 +0000)]
Produce an actual error before attempting to attach notes to it when bailing out
due to FORCE_CLANG_DIAGNOSTICS_CRASH=1. Also add a test for that env var.

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

11 years agoFix for PR12222.
Erik Verbruggen [Tue, 25 Dec 2012 14:51:39 +0000 (14:51 +0000)]
Fix for PR12222.

Changed getLocStart() and getLocEnd() to be required for Stmts, and make
getSourceRange() optional. The default implementation for getSourceRange()
is build the range by calling getLocStart() and getLocEnd().

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

11 years agoAdd intel_ocl_bicc calling convention as a function attribute to clang. The calling...
Guy Benyei [Tue, 25 Dec 2012 08:53:55 +0000 (08:53 +0000)]
Add intel_ocl_bicc calling convention as a function attribute to clang. The calling convention is already implemented in LLVM.

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

11 years agoAdd 171048 back but invalidate the cache of all redeclarations when setting
Rafael Espindola [Tue, 25 Dec 2012 07:31:49 +0000 (07:31 +0000)]
Add 171048 back but invalidate the cache of all redeclarations when setting
the body of a functions. The problem was that hasBody looks at the entire chain
and causes problems to -fvisibility-inlines-hidden if the cache was not
invalidated.

Original message:

Cache visibility of decls.

This unifies the linkage and visibility caching. I first implemented this when
working on pr13844, but the previous fixes removed the performance advantage of
this one.
This is still a step in the right direction for making linkage and visibility
cheap to use.

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

11 years agoRevert r171048, "Cache visibility of decls."
NAKAMURA Takumi [Tue, 25 Dec 2012 04:47:44 +0000 (04:47 +0000)]
Revert r171048, "Cache visibility of decls."

It broke stage2.

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

11 years agoCache visibility of decls.
Rafael Espindola [Tue, 25 Dec 2012 00:39:58 +0000 (00:39 +0000)]
Cache visibility of decls.

This unifies the linkage and visibility caching. I first implemented this when
working on pr13844, but the previous fixes removed the performance advantage of
this one.

This is still a step in the right direction for making linkage and visibility
cheap to use.

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

11 years agoSimplify RUN lines. No functionality change.
Nick Lewycky [Mon, 24 Dec 2012 21:45:14 +0000 (21:45 +0000)]
Simplify RUN lines. No functionality change.

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

11 years agoLet clang-format format itself.
Daniel Jasper [Mon, 24 Dec 2012 16:51:15 +0000 (16:51 +0000)]
Let clang-format format itself.

Apply all formatting changes that clang-format would apply to its own source
code. All choices seem to improve readability (or at least not make it worse).
No functional changes.

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

11 years agoPenalize tokens with a lower parenthesis level than the start of the line.
Daniel Jasper [Mon, 24 Dec 2012 16:43:00 +0000 (16:43 +0000)]
Penalize tokens with a lower parenthesis level than the start of the line.

This prevents formattings like this (assuming "parameter" doesn't fit the line):
  bool f = someFunction() && someFunctionWithParam(
      parameter) && someOtherFunction();

Here, "parameter" - the start of line 2 - has a parenthesis level of 2, but
there are subsequent tokens ("&&" and "someOtherFunction") with a lower level.
This is bad for readability as "parameter" hides "someOtherFunction". With this
patch, this changes to:
  bool f = someFunction() &&
           someFunctionWithParam(parameter) &&
           someOtherFunction();

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

11 years agoAlign RHS after assignments and return statements.
Daniel Jasper [Mon, 24 Dec 2012 13:43:52 +0000 (13:43 +0000)]
Align RHS after assignments and return statements.

This changes:
  int Result = a +  // force break
      b;
  return Result +  // force break
      5;

To:
  int Result = a +  // force break
               b;
  return Result +  // force break
         5;

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

11 years agoFix formatting over overloaded operators.
Daniel Jasper [Mon, 24 Dec 2012 10:56:04 +0000 (10:56 +0000)]
Fix formatting over overloaded operators.

This fixes llvm.org/pr14686.

We used to add too many spaces for different versions of overloaded operator
function declarations/definitions. This patch changes, e.g.

  operator *() {}
  operator >() {}
  operator () () {}

to

  operator*() {}
  operator>() {}
  operator()() {}

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

11 years agoSupport -fsanitize-memory-track-origins.
Evgeniy Stepanov [Mon, 24 Dec 2012 08:42:34 +0000 (08:42 +0000)]
Support -fsanitize-memory-track-origins.

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

11 years agoCGClass.cpp: [PR14335] Remove comma-separated \param, for now. [-Wdocumentation]
NAKAMURA Takumi [Mon, 24 Dec 2012 02:03:30 +0000 (02:03 +0000)]
CGClass.cpp: [PR14335] Remove comma-separated \param, for now. [-Wdocumentation]

/// \param argBegin,argEnd the arguments to evaluate and pass to the constructor

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

11 years agoclang/AST/VTTBuilder.h: Prune one description in three methods, VTTBuilder::AddVTable...
NAKAMURA Takumi [Mon, 24 Dec 2012 01:49:04 +0000 (01:49 +0000)]
clang/AST/VTTBuilder.h: Prune one description in three methods, VTTBuilder::AddVTablePointer(), VTTBuilder::LayoutSecondaryVirtualPointers(), and VTTBuilder::LayoutSecondaryVirtualPointers(). [-Wdocumentation]

/// \param AddressPoints - If the vtable is a construction vtable, this has the address points for it.

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

11 years agoCGDecl.cpp: Prune three descriptions in two methods, CodeGenFunction::pushIrregularPa...
NAKAMURA Takumi [Mon, 24 Dec 2012 01:48:59 +0000 (01:48 +0000)]
CGDecl.cpp: Prune three descriptions in two methods, CodeGenFunction::pushIrregularPartialArrayCleanup() and CodeGenFunction::pushRegularPartialArrayCleanup(). [-Wdocumentation]

/// \param array - a value of type elementType*
/// \param destructionKind - the kind of destruction required
/// \param initializedElementCount - a value of type size_t* holding the number of successfully-constructed elements

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

11 years agoDiagnosticRenderer.cpp: Prune one description in DiagnosticRenderer::emitMacroExpansi...
NAKAMURA Takumi [Mon, 24 Dec 2012 01:48:53 +0000 (01:48 +0000)]
DiagnosticRenderer.cpp: Prune one description in DiagnosticRenderer::emitMacroExpansions(). [-Wdocumentation]

/// \param MacroSkipEnd The depth to stop skipping macro expansions.

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

11 years agoCGValue.h: Update one \param to Addr in MakeBitfield(). [-Wdocumentation]
NAKAMURA Takumi [Mon, 24 Dec 2012 01:48:48 +0000 (01:48 +0000)]
CGValue.h: Update one \param to Addr in MakeBitfield(). [-Wdocumentation]

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

11 years agotest/Index/preamble_macro_template.cpp: Tweak for win32.
NAKAMURA Takumi [Mon, 24 Dec 2012 01:23:48 +0000 (01:23 +0000)]
test/Index/preamble_macro_template.cpp: Tweak for win32.

Using the file immediately after "> file 2>&1" causes weird behavior on win32.
For example, "foo > %t 2>&1; FileCheck --input-file=%t"

Use "foo 2>&1 | tee %t" instead.

Note, mixing stdout and stderr to the same handle might cause unexpected behavior, due to buffering.

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

11 years agoTake operator precedence into account when splitting lines.
Daniel Jasper [Mon, 24 Dec 2012 00:13:23 +0000 (00:13 +0000)]
Take operator precedence into account when splitting lines.

With this patch, splitting after binary operators has a panelty corresponding
to the operator's precedence. We used to ignore this and eagerly format like:

  if (aaaaaaaaaaaaaaaaaaaaaaaaa || bbbbbbbbbbbbbbbbbbbbbbbbb &&
      ccccccccccccccccccccccccc) { .. }

With this patch, this becomes:

  if (aaaaaaaaaaaaaaaaaaaaaaaaa ||
      bbbbbbbbbbbbbbbbbbbbbbbbb && ccccccccccccccccccccccccc) { .. }

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

11 years agoDocumentation: PTHInternals: use correct adornments and fix typos
Dmitri Gribenko [Sun, 23 Dec 2012 18:39:54 +0000 (18:39 +0000)]
Documentation: PTHInternals: use correct adornments and fix typos

Fixes PR14014

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

11 years agoDocumentation: fix a syntax error: empty line required after code-block::
Dmitri Gribenko [Sun, 23 Dec 2012 18:36:44 +0000 (18:36 +0000)]
Documentation: fix a syntax error: empty line required after code-block::

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

11 years agoDocumentation: add MemorySanitizer to the toctree
Dmitri Gribenko [Sun, 23 Dec 2012 18:35:58 +0000 (18:35 +0000)]
Documentation: add MemorySanitizer to the toctree

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

11 years agodocs: Convert ReleaseNotes to reST.
Sean Silva [Sun, 23 Dec 2012 01:19:35 +0000 (01:19 +0000)]
docs: Convert ReleaseNotes to reST.

This is the last of the "regular" documents to convert to reST, and so
I'm declaring the initial clang reST conversion "done".

However,

- There are some documents in clang/www/ which probably should
  be migrated into clang/docs/, such as www/OpenProjects.html

  The primary thing blocking me from doing this right now is not knowing
  how to set up a redirect so that the old URL's continue to work.

- LibASTMatchersReference.html is not reST. This page is auto-generated
  by clang/docs/tools/dump_ast_matchers.py from the source and has some
  collapse/expand logic that isn't expressible directly with Sphinx, so
  just converting it to reST is not really a good strategy.

  Manuel Klimek and I discussed this and the general agreed-upon
  direction is making that page data-driven so that it, say, pulls in an
  auto-generated blob of JSON which describes the matchers and builds up
  the "matcher reference" part of the page with a small amount of JS.

- There are some rogue .txt files hanging around.

Also, I dropped the little dragon logo at the top because Sphinx was
warning about an external image reference (not sure why, but meh, I
didn't want to fight it). If anything, we would want such a logo
integrated into the site's overall theme, rather than hardcoded here.

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

11 years agolibFormat: Teach the *& usage heuristic that "return" starts a rhs too.
Nico Weber [Sun, 23 Dec 2012 01:07:46 +0000 (01:07 +0000)]
libFormat: Teach the *& usage heuristic that "return" starts a rhs too.

"return a*b;" was formatted as "return a *b;" and is now formatted as "return a * b;".

Fixes PR14687 partially.

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

11 years agoMove a declaration closer to its use. No functionality change.
Nico Weber [Sun, 23 Dec 2012 00:40:46 +0000 (00:40 +0000)]
Move a declaration closer to its use. No functionality change.

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

11 years agoClean out release notes for clang 3.3
Benjamin Kramer [Sat, 22 Dec 2012 16:12:31 +0000 (16:12 +0000)]
Clean out release notes for clang 3.3

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

11 years ago[libclang] Fix crash when code-completing a macro invocation that
Argyrios Kyrtzidis [Sat, 22 Dec 2012 04:48:10 +0000 (04:48 +0000)]
[libclang] Fix crash when code-completing a macro invocation that
reached EOF and did not expand the argument into the source context.

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

11 years ago[libclang] Don't try to translate diagnostics from the precompiled preamble to the
Argyrios Kyrtzidis [Sat, 22 Dec 2012 04:48:08 +0000 (04:48 +0000)]
[libclang] Don't try to translate diagnostics from the precompiled preamble to the
code-completion results, the SourceManager state may be slightly
different when code-completing.

And we don't even care for diagnostics when code-completing, anyway.

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

11 years ago[libclang] Check for the 'LIBCLANG_NOTHREADS' environment variable before creating
Argyrios Kyrtzidis [Sat, 22 Dec 2012 04:48:07 +0000 (04:48 +0000)]
[libclang] Check for the 'LIBCLANG_NOTHREADS' environment variable before creating
a separate thread for code-completion.

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

11 years agoPR14695: Fix assert from bad cast<>. Not every namespace is a NamespaceDecl; it might...
Richard Smith [Sat, 22 Dec 2012 02:46:14 +0000 (02:46 +0000)]
PR14695: Fix assert from bad cast<>. Not every namespace is a NamespaceDecl; it might instead be a TranslationUnitDecl.

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

11 years agoAdd back -Wduplicate-enum which I mistakenly removed.
Ted Kremenek [Sat, 22 Dec 2012 01:34:09 +0000 (01:34 +0000)]
Add back -Wduplicate-enum which I mistakenly removed.

This was removed with -Wunique-enum, which is still removed.  The
corresponding thread on cfe-comments for that warning is here:

  http://lists.cs.uiuc.edu/pipermail/cfe-dev/2012-September/024224.html

If we get specific user feedback for -Wduplicate-enum we can evaluate
whether or not to keep it.

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

11 years agoFix typo: objc_no_direct_instance_variable_assignmemt => objc_no_direct_instance_vari...
Ted Kremenek [Sat, 22 Dec 2012 00:34:48 +0000 (00:34 +0000)]
Fix typo: objc_no_direct_instance_variable_assignmemt => objc_no_direct_instance_variable_assignment.

Fixes <rdar://problem/12927551>.

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

11 years ago[analyzer] Convert SimpleStreamChecker to use the PointerEscape callback
Anna Zaks [Sat, 22 Dec 2012 00:18:39 +0000 (00:18 +0000)]
[analyzer] Convert SimpleStreamChecker to use the PointerEscape callback

The new callback greatly simplifies the checker.

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

11 years agoUse a safe default width for template-diff'ing integral arguments, in
Douglas Gregor [Fri, 21 Dec 2012 23:03:27 +0000 (23:03 +0000)]
Use a safe default width for template-diff'ing integral arguments, in
case we can't find an exact width to use. Fixes crash in
<rdar://problem/12456626>.

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

11 years agoAdding to FormatTest.cpp test for a very long ObjC method
Fariborz Jahanian [Fri, 21 Dec 2012 22:51:18 +0000 (22:51 +0000)]
Adding to FormatTest.cpp test for a very long ObjC method
declaration requiring formatting of wrap-arounds.

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

11 years agoTweak Sema::CheckLiteralKind() to also include block literals
Ted Kremenek [Fri, 21 Dec 2012 22:46:35 +0000 (22:46 +0000)]
Tweak Sema::CheckLiteralKind() to also include block literals

This simplifies some diagnostic logic in checkUnsafeAssignLiteral(),
hopefully making it less error prone.

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

11 years agoInsulate this test from the whims of the random number generator.
Matt Beaumont-Gay [Fri, 21 Dec 2012 22:43:20 +0000 (22:43 +0000)]
Insulate this test from the whims of the random number generator.

Our internal buildbot just failed because the tempfile happened to be named
'nodefaultlib-lcGA7k.o', which contains the substring '-lc'.

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

11 years agoAdd comments back that were accidentally removed in r170933.
Chad Rosier [Fri, 21 Dec 2012 22:38:37 +0000 (22:38 +0000)]
Add comments back that were accidentally removed in r170933.

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

11 years agoFix a warning due to an extraneous comma.
Chad Rosier [Fri, 21 Dec 2012 22:33:20 +0000 (22:33 +0000)]
Fix a warning due to an extraneous comma.

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

11 years agoRemove unused arguments and rename to conform to coding standards.
Chad Rosier [Fri, 21 Dec 2012 22:24:43 +0000 (22:24 +0000)]
Remove unused arguments and rename to conform to coding standards.

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

11 years agoChange checkUnsafeAssignLiteral() to use the new Sema::CheckLiteralKind().
Ted Kremenek [Fri, 21 Dec 2012 21:59:39 +0000 (21:59 +0000)]
Change checkUnsafeAssignLiteral() to use the new Sema::CheckLiteralKind().

Along the way, fix a bug in CheckLiteralKind(), previously in diagnoseObjCLiteralComparison, where we didn't ignore parentheses
in boxed expressions for purpose of classification.

In other words, both @42 and @(42) should be classified as numeric
literals.

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

11 years agoHoist logic for classifying Objective-C literals into Sema (proper) for use with...
Ted Kremenek [Fri, 21 Dec 2012 21:59:36 +0000 (21:59 +0000)]
Hoist logic for classifying Objective-C literals into Sema (proper) for use with other diagnostics.

No immediate (intended) functionality change.

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

11 years agoSwitch FrontendOptions to using an initializer list rather than initializing
Richard Smith [Fri, 21 Dec 2012 21:52:01 +0000 (21:52 +0000)]
Switch FrontendOptions to using an initializer list rather than initializing
the values in the constructor.  The constructor implementation is trivial
beyond the value initialisations. Patch by Saleem Abdulrasool!

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

11 years agoFixes couple of friend declaration -ast-print bug
Fariborz Jahanian [Fri, 21 Dec 2012 21:43:05 +0000 (21:43 +0000)]
Fixes couple of friend declaration -ast-print bug
found by running -ast-print on all-std-headers.cpp
which caused it to go into infinite loop. Now
-ast-print prints all declarations found in
all-std-headers.cpp.

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

11 years agoIndent.
Chad Rosier [Fri, 21 Dec 2012 21:27:13 +0000 (21:27 +0000)]
Indent.

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

11 years agoRemove unnecessary checks.
Chad Rosier [Fri, 21 Dec 2012 21:22:20 +0000 (21:22 +0000)]
Remove unnecessary checks.

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

11 years agoUse descriptive enum instead of raw integers for checkUnsafeAssignLiteral().
Ted Kremenek [Fri, 21 Dec 2012 19:45:33 +0000 (19:45 +0000)]
Use descriptive enum instead of raw integers for checkUnsafeAssignLiteral().

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

11 years agoSink call to checkUnsafeAssignLiteral() into checkUnsafeAssignObject().
Ted Kremenek [Fri, 21 Dec 2012 19:45:30 +0000 (19:45 +0000)]
Sink call to checkUnsafeAssignLiteral() into checkUnsafeAssignObject().

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

11 years agoFix indent.
Chad Rosier [Fri, 21 Dec 2012 19:43:33 +0000 (19:43 +0000)]
Fix indent.

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

11 years ago[analyzer] Don't perform an expensive assertion in release builds.
Jordan Rose [Fri, 21 Dec 2012 18:26:48 +0000 (18:26 +0000)]
[analyzer] Don't perform an expensive assertion in release builds.

Unfortunately, we don't seem to have a standard way to do this. I'm using
the __OPTIMIZE__ GNU extension that Clang also defines, but that doesn't
help MSVC. I suppose we could remove the check entirely, but it's useful
for developing new constraint managers.

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

11 years agoformat: Handle #import as include directive too.
Nico Weber [Fri, 21 Dec 2012 18:21:56 +0000 (18:21 +0000)]
format: Handle #import as include directive too.

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

11 years agoAdd a testcase for ARM cortex-r5 subtarget
Quentin Colombet [Fri, 21 Dec 2012 18:00:32 +0000 (18:00 +0000)]
Add a testcase for ARM cortex-r5 subtarget

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

11 years agoclang-format: No spaces around directory specifiers
Daniel Jasper [Fri, 21 Dec 2012 17:58:39 +0000 (17:58 +0000)]
clang-format: No spaces around directory specifiers

This fixes PR14683. We used to format like this:
  #include <a / b>

And this patch changes this to:
  #include <a/b>

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

11 years agoAdd ARM cortex-r5 subtarget as available mcpu
Quentin Colombet [Fri, 21 Dec 2012 17:57:47 +0000 (17:57 +0000)]
Add ARM cortex-r5 subtarget as available mcpu

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

11 years ago[analyzer] Fix typos.
Anna Zaks [Fri, 21 Dec 2012 17:27:04 +0000 (17:27 +0000)]
[analyzer] Fix typos.

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

11 years ago[analyzer] Re-apply r170826 and make the dumping of the GallGraph
Anna Zaks [Fri, 21 Dec 2012 17:27:01 +0000 (17:27 +0000)]
[analyzer] Re-apply r170826 and make the dumping of the GallGraph
deterministic.

Commit message for r170826:

[analyzer] Traverse the Call Graph in topological order.

Modify the call graph by removing the parentless nodes. Instead all
nodes are children of root to ensure they are all reachable. Remove the
tracking of nodes that are "top level" or global. This information is
not used and can be obtained from the Decls stored inside
CallGraphNodes.

Instead of existing ordering hacks, analyze the functions in topological
order over the Call Graph.

Together with the addition of devirtualizable ObjC message sends and
blocks to the call graph, this gives around 6% performance improvement
on several large ObjC benchmarks.

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

11 years agoSort the includes according to the coding standard.
Roman Divacky [Fri, 21 Dec 2012 17:23:52 +0000 (17:23 +0000)]
Sort the includes according to the coding standard.

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

11 years agoFix typo.
Fariborz Jahanian [Fri, 21 Dec 2012 17:14:23 +0000 (17:14 +0000)]
Fix typo.

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

11 years agoRemove duplicate includes.
Roman Divacky [Fri, 21 Dec 2012 17:07:08 +0000 (17:07 +0000)]
Remove duplicate includes.

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

11 years agoBasic support for formatting for-loops.
Daniel Jasper [Fri, 21 Dec 2012 14:37:20 +0000 (14:37 +0000)]
Basic support for formatting for-loops.

We used to not really format them. Now we do:

  for (MachineBasicBlock::succ_iterator SI = BB->succ_begin(),
                                        SE = BB->succ_end();
       SI != SE; ++SI) {

This is just one example and I am sure we still mess some of them up, but it
is a step forward.

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

11 years agoUpdate comments.
Rafael Espindola [Fri, 21 Dec 2012 13:22:55 +0000 (13:22 +0000)]
Update comments.

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

11 years agoTemporary fix of tests to make buildbots happy.
Daniel Jasper [Fri, 21 Dec 2012 12:10:20 +0000 (12:10 +0000)]
Temporary fix of tests to make buildbots happy.

Permanent solution coming up after checking back with Fariborz/Douglas.

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

11 years agoSlight rewording of -fsanitize=memory docs.
Evgeniy Stepanov [Fri, 21 Dec 2012 10:53:20 +0000 (10:53 +0000)]
Slight rewording of -fsanitize=memory docs.

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

11 years agoUser manual chapter on MemorySanitizer.
Evgeniy Stepanov [Fri, 21 Dec 2012 10:50:00 +0000 (10:50 +0000)]
User manual chapter on MemorySanitizer.

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

11 years agoUse OperatorPrecedence.h in clang-format
Daniel Jasper [Fri, 21 Dec 2012 10:20:02 +0000 (10:20 +0000)]
Use OperatorPrecedence.h in clang-format

No indented functional changes other than handling more operators
correctly.

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

11 years agoFormatting fixes for PR14680
Daniel Jasper [Fri, 21 Dec 2012 09:41:31 +0000 (09:41 +0000)]
Formatting fixes for PR14680

Also, some (automated) formatting fixes and slight cleanups.

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

11 years agoRemove the working that ThreadSanitizer is *experimental*.
Dmitry Vyukov [Fri, 21 Dec 2012 08:21:25 +0000 (08:21 +0000)]
Remove the working that ThreadSanitizer is *experimental*.

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

11 years agoFix regression in r170489: when instantiating a direct initializer which is a
Richard Smith [Fri, 21 Dec 2012 08:13:35 +0000 (08:13 +0000)]
Fix regression in r170489: when instantiating a direct initializer which is a
CXXScalarValueInitExpr (or an ImplicitValueInitExpr), strip it back down to an
empty pair of parentheses so that the initialization code can tell that we're
performing value-initialization.

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

11 years agoExtend checkUnsafeAssigns() to also handle assigning an object literal to a weak...
Ted Kremenek [Fri, 21 Dec 2012 08:04:28 +0000 (08:04 +0000)]
Extend checkUnsafeAssigns() to also handle assigning an object literal to a weak reference.

Thanks to Jordan Rose and John McCall for their sage code review.

Fixes <rdar://problem/12569201>.

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

11 years agoRefactor checkUnsafeAssigns() to avoid code duplication with while loop.
Ted Kremenek [Fri, 21 Dec 2012 08:04:20 +0000 (08:04 +0000)]
Refactor checkUnsafeAssigns() to avoid code duplication with while loop.

This is just a minor bit of refactoring, but it is nice cleanup for
the subsequent patch that adds warning support for assigning literals
to weak variables.

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

11 years agoReinstate r170806, reverted in r170835, with a fix use i1 instead of i8 for a value...
Richard Smith [Fri, 21 Dec 2012 03:17:28 +0000 (03:17 +0000)]
Reinstate r170806, reverted in r170835, with a fix use i1 instead of i8 for a value-initialized bool!

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

11 years agoRevert r170806, "Fix some bugs where we would sometimes use 0, not -1, when emitting...
NAKAMURA Takumi [Fri, 21 Dec 2012 02:50:38 +0000 (02:50 +0000)]
Revert r170806, "Fix some bugs where we would sometimes use 0, not -1, when emitting a null constant of type pointer-to-data-member."

It broke stage2.

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

11 years ago[libclang] Follow-up to r170824, provide the correct number of arguments for
Argyrios Kyrtzidis [Fri, 21 Dec 2012 01:51:12 +0000 (01:51 +0000)]
[libclang] Follow-up to r170824, provide the correct number of arguments for
a not-fully-formed macro invocation during code-completion.

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

11 years ago[analyzer] Address Jordan's nitpicks as per code review of r170625.
Anna Zaks [Fri, 21 Dec 2012 01:50:14 +0000 (01:50 +0000)]
[analyzer] Address Jordan's nitpicks as per code review of r170625.

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

11 years agoRevert r170826. The output of
Rafael Espindola [Fri, 21 Dec 2012 01:30:23 +0000 (01:30 +0000)]
Revert r170826. The output of

./bin/clang -cc1 -internal-isystem /home/espindola/llvm/build/lib/clang/3.3/include/ -analyze -analyzer-checker=debug.DumpCallGraph /home/espindola/llvm/clang/test/Analysis/debug-CallGraph.c -fblocks

changes in each run.

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

11 years agoDon't eagerly emit a global static merged with a local extern.
Rafael Espindola [Fri, 21 Dec 2012 01:21:33 +0000 (01:21 +0000)]
Don't eagerly emit a global static merged with a local extern.

When we are visiting the extern declaration of 'i' in

static int i = 99;
int foo() {
  extern int i;
  return i;
}

We should not try to handle it as if it was an function static. That is, we
must consider the written storage class.

Fixing this then exposes that the assert in EmitGlobalVarDeclLValue and the
if leading to its call are not completely accurate. They were passing before
because the second decl was marked as having external storage. I changed them
to check the linkage, which I find easier to understand.

Last but not least, there is something strange going on with cuda and opencl.
My guess is that the linkage computation for these languages needs to be
audited, but I didn't want to change that in this patch so I just updated
the storage classes to keep the current behavior.

Thanks to Reed Kotler for reporting this.

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

11 years ago[analyzer] Traverse the Call Graph in topological order.
Anna Zaks [Fri, 21 Dec 2012 01:19:22 +0000 (01:19 +0000)]
[analyzer] Traverse the Call Graph in topological order.

Modify the call graph by removing the parentless nodes. Instead all
nodes are children of root to ensure they are all reachable. Remove the
tracking of nodes that are "top level" or global. This information is
not used and can be obtained from the Decls stored inside
CallGraphNodes.

Instead of existing ordering hacks, analyze the functions in topological
order over the Call Graph.

Together with the addition of devirtualizable ObjC message sends and
blocks to the call graph, this gives around 6% performance improvement
on several large ObjC benchmarks.

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

11 years ago[analyzer] Add blocks and ObjC messages to the call graph.
Anna Zaks [Fri, 21 Dec 2012 01:19:15 +0000 (01:19 +0000)]
[analyzer] Add blocks and ObjC messages to the call graph.

This paves the road for constructing a better function dependency graph.
If we analyze a function before the functions it calls and inlines,
there is more opportunity for optimization.

Note, we add call edges to the called methods that correspond to
function definitions (declarations with bodies).

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

11 years ago[libclang] Make sure we can code-complete inside a macro argument even though
Argyrios Kyrtzidis [Fri, 21 Dec 2012 01:17:20 +0000 (01:17 +0000)]
[libclang] Make sure we can code-complete inside a macro argument even though
the macro invocation is not fully formed.

rdar://11290992

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

11 years agoEditedSource.cpp: Appease msvc, to add <cctype>.
NAKAMURA Takumi [Fri, 21 Dec 2012 00:21:02 +0000 (00:21 +0000)]
EditedSource.cpp: Appease msvc, to add <cctype>.

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

11 years agodocs: Convert ObjectiveCLiterals to reST.
Sean Silva [Fri, 21 Dec 2012 00:17:02 +0000 (00:17 +0000)]
docs: Convert ObjectiveCLiterals to reST.

Sphinx's syntax highlighter doesn't recognize the new literals, so the
syntax highlighting is pretty pathetic.

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

11 years agodocs: fix Sphinx toctree warning.
Sean Silva [Fri, 21 Dec 2012 00:16:58 +0000 (00:16 +0000)]
docs: fix Sphinx toctree warning.

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

11 years agodocs: Convert DriverInternals to reST.
Sean Silva [Fri, 21 Dec 2012 00:16:53 +0000 (00:16 +0000)]
docs: Convert DriverInternals to reST.

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

11 years agoFix some bugs where we would sometimes use 0, not -1, when emitting a null constant...
Richard Smith [Thu, 20 Dec 2012 23:49:09 +0000 (23:49 +0000)]
Fix some bugs where we would sometimes use 0, not -1, when emitting a null constant of type pointer-to-data-member.

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

11 years agoRevert r170801, which breaks the mingw build.
Douglas Gregor [Thu, 20 Dec 2012 23:36:52 +0000 (23:36 +0000)]
Revert r170801, which breaks the mingw build.

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

11 years agoEliminate errors when running the 'PrintFunctionNames' plugin, from Li Qun!
Douglas Gregor [Thu, 20 Dec 2012 23:11:42 +0000 (23:11 +0000)]
Eliminate errors when running the 'PrintFunctionNames' plugin, from Li Qun!

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

11 years agoRevert "Warn if a __weak variable is initialized with an Objective-C object literal."
Ted Kremenek [Thu, 20 Dec 2012 22:31:27 +0000 (22:31 +0000)]
Revert "Warn if a __weak variable is initialized with an Objective-C object literal."

Per code feedback, I want to see if there is a more general way to do this.

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

11 years agoUse some heuristics so that when a fixit removes a source range, we try
Argyrios Kyrtzidis [Thu, 20 Dec 2012 21:05:53 +0000 (21:05 +0000)]
Use some heuristics so that when a fixit removes a source range, we try
to also remove a trailing space if possible.

For example, removing '__bridge' from:

i = (__bridge I*)p;

should result in:

i = (I*)p;

not:

i = ( I*)p;

rdar://11314821

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

11 years agoWarn if a __weak variable is initialized with an Objective-C object literal.
Ted Kremenek [Thu, 20 Dec 2012 20:55:03 +0000 (20:55 +0000)]
Warn if a __weak variable is initialized with an Objective-C object literal.

Such variables may immediately become nil or may have unpredictable
behavior.

Fixes <rdar://problem/12569201>.

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

11 years agoDocumentation: use monospaced font in BlockLanguageSpec, and fix a link to this
Dmitri Gribenko [Thu, 20 Dec 2012 20:51:59 +0000 (20:51 +0000)]
Documentation: use monospaced font in BlockLanguageSpec, and fix a link to this
document

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

11 years agoUse the MaybeParseMicrosoftAttributes function.
Chad Rosier [Thu, 20 Dec 2012 20:37:53 +0000 (20:37 +0000)]
Use the MaybeParseMicrosoftAttributes function.

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

11 years agoRemove namespace qualifier that lead to build breakage.
Daniel Jasper [Thu, 20 Dec 2012 20:31:38 +0000 (20:31 +0000)]
Remove namespace qualifier that lead to build breakage.

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

11 years agoMove operator precedence calculation to new header
Daniel Jasper [Thu, 20 Dec 2012 20:25:19 +0000 (20:25 +0000)]
Move operator precedence calculation to new header

Thereby, it can be reused by clang-format and others.
Review: http://llvm-reviews.chandlerc.com/D229

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

11 years agoAdd objective-C style formatting to clang format and
Fariborz Jahanian [Thu, 20 Dec 2012 19:54:13 +0000 (19:54 +0000)]
Add objective-C style formatting to clang format and
use it to format xml declaration tags.
// rdar://12378714

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