]> granicus.if.org Git - clang/log
clang
14 years agoRemove Diagnostic's get/setNumErrors() and getNumErrorsSuppressed().
Argyrios Kyrtzidis [Fri, 19 Nov 2010 00:19:20 +0000 (00:19 +0000)]
Remove Diagnostic's get/setNumErrors() and getNumErrorsSuppressed().

Anyone wanting to use it should probably use DiagnosticClient's getNumErrors() instead.

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

14 years agogetNumErrors() -> hasErrorOccurred()
Argyrios Kyrtzidis [Fri, 19 Nov 2010 00:19:18 +0000 (00:19 +0000)]
getNumErrors() -> hasErrorOccurred()

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

14 years agoRefactoring. Get FunctionScopeInfo to use DiagnosticErrorTrap.
Argyrios Kyrtzidis [Fri, 19 Nov 2010 00:19:15 +0000 (00:19 +0000)]
Refactoring. Get FunctionScopeInfo to use DiagnosticErrorTrap.

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

14 years agoRefactoring.
Argyrios Kyrtzidis [Fri, 19 Nov 2010 00:19:12 +0000 (00:19 +0000)]
Refactoring.
Move ErrorTrap from clang/Sema to clang/Basic as DiagnosticErrorTrap and use it in Scope.

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

14 years agoFix a bug where write-barriers for assignment through reference
Fariborz Jahanian [Thu, 18 Nov 2010 22:39:16 +0000 (22:39 +0000)]
Fix a bug where write-barriers for assignment through reference
types was not being generated for objc pointers.
// rdar://8681766.

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

14 years agoUse a signed vector type for the shift amount operand of unsigned shifts.
Bob Wilson [Thu, 18 Nov 2010 21:51:10 +0000 (21:51 +0000)]
Use a signed vector type for the shift amount operand of unsigned shifts.
Neon shifts allow a mix of positive and negative shift amounts to shift
left or right, respectively, so the shift amount vector should always be
signed.  PR8482 (Radar 8603521).

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

14 years agoUse hasErrorOccurred() instead of getNumErrors() where it makes sense.
Argyrios Kyrtzidis [Thu, 18 Nov 2010 21:47:07 +0000 (21:47 +0000)]
Use hasErrorOccurred() instead of getNumErrors() where it makes sense.

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

14 years agoGet the number of errors reported from the diagnostic client, in clang_parseTranslati...
Argyrios Kyrtzidis [Thu, 18 Nov 2010 21:47:04 +0000 (21:47 +0000)]
Get the number of errors reported from the diagnostic client, in clang_parseTranslationUnit_Impl.

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

14 years agoUpdate CMake build.
Benjamin Kramer [Thu, 18 Nov 2010 21:19:52 +0000 (21:19 +0000)]
Update CMake build.

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

14 years agoRemove the hack where, to get the return status, we had special case for VerifyDiagno...
Argyrios Kyrtzidis [Thu, 18 Nov 2010 21:13:57 +0000 (21:13 +0000)]
Remove the hack where, to get the return status, we had special case for VerifyDiagnosticsClient
and just check the number of errors from the DiagnosticClient.

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

14 years agoKeep track of errors/warnings in FixItRewriter.
Argyrios Kyrtzidis [Thu, 18 Nov 2010 21:13:54 +0000 (21:13 +0000)]
Keep track of errors/warnings in FixItRewriter.

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

14 years agoSince multiple diagnostics can share one diagnostic client, have the client keeping...
Argyrios Kyrtzidis [Thu, 18 Nov 2010 20:06:46 +0000 (20:06 +0000)]
Since multiple diagnostics can share one diagnostic client, have the client keeping track
of the total number of warnings/errors reported.

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

14 years agoRefactoring of Diagnostic class.
Argyrios Kyrtzidis [Thu, 18 Nov 2010 20:06:41 +0000 (20:06 +0000)]
Refactoring of Diagnostic class.

-Move the stuff of Diagnostic related to creating/querying diagnostic IDs into a new DiagnosticIDs class.
-DiagnosticIDs can be shared among multiple Diagnostics for multiple translation units.
-The rest of the state in Diagnostic object is considered related and tied to one translation unit.
-Have Diagnostic point to the SourceManager that is related with. Diagnostic can now accept just a
   SourceLocation instead of a FullSourceLoc.
-Reflect the changes to various interfaces.

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

14 years agoCopy the LangOptions in PrintingPolicy to avoid pointing to a LangOptions that is...
Argyrios Kyrtzidis [Thu, 18 Nov 2010 20:06:30 +0000 (20:06 +0000)]
Copy the LangOptions in PrintingPolicy to avoid pointing to a LangOptions that is long gone.

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

14 years agoAdd an assertion, fix a whole bunch of bugs, comment the assertion
John McCall [Thu, 18 Nov 2010 19:01:18 +0000 (19:01 +0000)]
Add an assertion, fix a whole bunch of bugs, comment the assertion
out because there are still bugs left.

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

14 years agoRemove the getDiagnosticLevel check since it doesn't buy us much.
Argyrios Kyrtzidis [Thu, 18 Nov 2010 18:51:03 +0000 (18:51 +0000)]
Remove the getDiagnosticLevel check since it doesn't buy us much.

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

14 years agoFix a typo in the UTF-8 BOM (PR8645). Use a StringSwitch while at it.
Benjamin Kramer [Thu, 18 Nov 2010 12:46:39 +0000 (12:46 +0000)]
Fix a typo in the UTF-8 BOM (PR8645). Use a StringSwitch while at it.

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

14 years agoIn some situations, TemplateArgumentLoc wasn't setting TypeSourceLoc (see
Craig Silverstein [Thu, 18 Nov 2010 08:32:02 +0000 (08:32 +0000)]
In some situations, TemplateArgumentLoc wasn't setting TypeSourceLoc (see
http://llvm.org/bugs/show_bug.cgi?id=8558).  This patch fixes it.  Thanks to
rjmccall for all the coaching!

Approved by rjmccall

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

14 years agoCalculate the value kind of an expression when it's created and
John McCall [Thu, 18 Nov 2010 06:31:45 +0000 (06:31 +0000)]
Calculate the value kind of an expression when it's created and
store it on the expression node.  Also store an "object kind",
which distinguishes ordinary "addressed" l-values (like
variable references and pointer dereferences) and bitfield,
@property, and vector-component l-values.

Currently we're not using these for much, but I aim to switch
pretty much everything calculating l-valueness over to them.
For now they shouldn't necessarily be trusted.

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

14 years agoAdded method for handling CXXOperatorCallExpr differently from CallExpr if CXXOperato...
Marcin Swiderski [Thu, 18 Nov 2010 06:29:23 +0000 (06:29 +0000)]
Added method for handling CXXOperatorCallExpr differently from CallExpr if CXXOperatorCallExpr represents method call.
Also fixed returning ExpolodedNodeSet from VisitCXXMethodCallExpr.

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

14 years agocomparison of AltiVec vectors now gives bool result (fix for 7533)
Anton Yartsev [Thu, 18 Nov 2010 03:19:30 +0000 (03:19 +0000)]
comparison of AltiVec vectors now gives bool result (fix for 7533)

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

14 years agoCursorVisitor: switch remaining expressions over
Ted Kremenek [Thu, 18 Nov 2010 00:42:18 +0000 (00:42 +0000)]
CursorVisitor: switch remaining expressions over
to the data-recursion algorithm.  CursorVisitor
now no longer subclasses StmtVisitor.

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

14 years ago-Rename -Wargument-larger-than -> -Wlarge-by-value-copy
Argyrios Kyrtzidis [Thu, 18 Nov 2010 00:20:36 +0000 (00:20 +0000)]
-Rename -Wargument-larger-than -> -Wlarge-by-value-copy
-Improve the diagnostic message
-Add some comments

Suggestions by Chris.

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

14 years agoCursorVisitor: migrate handling of
Ted Kremenek [Thu, 18 Nov 2010 00:02:32 +0000 (00:02 +0000)]
CursorVisitor: migrate handling of
'DependentScopeDeclRefExpr' and
'CXXDependentScopeMemberExpr' to the
data-recursion algorithm.

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

14 years agoMake definition of CXTranslationUnitImpl private
Ted Kremenek [Wed, 17 Nov 2010 23:24:11 +0000 (23:24 +0000)]
Make definition of CXTranslationUnitImpl private
to libclang.

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

14 years agoIntroduce option -Wargument-larger-than[=N] which warns about function definitions...
Argyrios Kyrtzidis [Wed, 17 Nov 2010 23:11:54 +0000 (23:11 +0000)]
Introduce option -Wargument-larger-than[=N] which warns about function definitions if they take by-value
or return by-value any POD that is larger than some threshold (default is 64 bytes).

Implements rdar://8548050.

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

14 years agoImplement -pie.
Rafael Espindola [Wed, 17 Nov 2010 22:26:15 +0000 (22:26 +0000)]
Implement -pie.

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

14 years agoDon't warn about
Rafael Espindola [Wed, 17 Nov 2010 22:13:25 +0000 (22:13 +0000)]
Don't warn about
 clang -w -c foo.s
Helps with the gdb testsuite.

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

14 years agoDo not produce "purely informative" code completion results for
Douglas Gregor [Wed, 17 Nov 2010 21:36:08 +0000 (21:36 +0000)]
Do not produce "purely informative" code completion results for
Objective-C message sends, which have only whitespace in their
TypedText chunk. Such results have no purpose.

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

14 years agoIn EvalArguments allow for evaluation of first argument always as a lvalue. Will...
Marcin Swiderski [Wed, 17 Nov 2010 21:27:36 +0000 (21:27 +0000)]
In EvalArguments allow for evaluation of first argument always as a lvalue. Will be used for CXXOperatorCallExpr that represents method call.

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

14 years agoDon't warn about -w not being used in a link. Necessary to get sane
Rafael Espindola [Wed, 17 Nov 2010 20:37:10 +0000 (20:37 +0000)]
Don't warn about -w not being used in a link. Necessary to get sane
results in the gdb testsuite.

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

14 years agoWarn if direct accessing synthesized ivar backing the property in
Fariborz Jahanian [Wed, 17 Nov 2010 19:41:23 +0000 (19:41 +0000)]
Warn if direct accessing synthesized ivar backing the property in
nonofragile-abi2. Fixes //rdar://8673791

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

14 years agoDon't emit warn_logical_and_in_logical_or for cases like "a && b || 0".
Argyrios Kyrtzidis [Wed, 17 Nov 2010 19:18:19 +0000 (19:18 +0000)]
Don't emit warn_logical_and_in_logical_or for cases like "a && b || 0".

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

14 years agoDon't emit warn_logical_and_in_logical_or for macros. Fixes rdar://8678458
Argyrios Kyrtzidis [Wed, 17 Nov 2010 18:54:22 +0000 (18:54 +0000)]
Don't emit warn_logical_and_in_logical_or for macros. Fixes rdar://8678458

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

14 years agoDon't warn for parentheses for the '&&' inside '||' for cases like:
Argyrios Kyrtzidis [Wed, 17 Nov 2010 18:26:36 +0000 (18:26 +0000)]
Don't warn for parentheses for the '&&' inside '||' for cases like:

assert(a || b && "bad");

since this is safe. This way we avoid a big source of such warnings which in this case are practically useless.

Note that we don't handle *all* cases where precedence wouldn't matter because of constants since
this is a bit costly to check, and IMO clarifying precedence with parentheses is good for
readability in general.

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

14 years agoPut warn_logical_and_in_logical_or warning in new warning group "logical-op-parenthes...
Argyrios Kyrtzidis [Wed, 17 Nov 2010 18:26:33 +0000 (18:26 +0000)]
Put warn_logical_and_in_logical_or warning in new warning group "logical-op-parentheses" member of "parentheses".

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

14 years agoAdd a comment explaining why r117813 was needed.
Dan Gohman [Wed, 17 Nov 2010 17:23:53 +0000 (17:23 +0000)]
Add a comment explaining why r117813 was needed.

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

14 years agoDrop the warning about __attribute__((may_alias)) being used
Dan Gohman [Wed, 17 Nov 2010 17:21:47 +0000 (17:21 +0000)]
Drop the warning about __attribute__((may_alias)) being used
on a non-type declaration, as GCC permits it on variables too.
This fixes PR8635.

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

14 years agoWhen libclang is walking a member access expression, don't walk into
Douglas Gregor [Wed, 17 Nov 2010 17:15:08 +0000 (17:15 +0000)]
When libclang is walking a member access expression, don't walk into
an implicit "this"; it causes clang_getCursor() to find the implicit
"this" expression (which isn't written in the source!) rather than the
actual member.

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

14 years agoWhen comparing the source range of a declaration against the region of
Douglas Gregor [Wed, 17 Nov 2010 17:14:07 +0000 (17:14 +0000)]
When comparing the source range of a declaration against the region of
interest (e.g., as used by clang_getCursor()), count the
decl-specifier-seq as part of the source range, as we do for
clang_annotateTokens(). Makes clang_getCursor() work properly for the
result types of functions, for example.

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

14 years agoSilence warning for "clang -O2 -O0 -c foo.c -o foo.o.
Rafael Espindola [Wed, 17 Nov 2010 15:16:14 +0000 (15:16 +0000)]
Silence warning for "clang -O2 -O0 -c foo.c -o foo.o.
Fixes PR8607.

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

14 years agoAdd skeleton for handling various cfg dtors.
Zhongxing Xu [Wed, 17 Nov 2010 09:16:19 +0000 (09:16 +0000)]
Add skeleton for handling various cfg dtors.

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

14 years agoWhen forming the !srcloc mdnode for an inline asm, add the SourceLocations
Chris Lattner [Wed, 17 Nov 2010 08:25:26 +0000 (08:25 +0000)]
When forming the !srcloc mdnode for an inline asm, add the SourceLocations
of all the lines of the inline asm.  With the refactoring and enhancement
of the backend, we can now reports errors on the correct source line when
an asm contains multiple lines of text.  For something like this:

void foo() {
  asm("push %rax\n"
      ".code32\n");
}

we used to get this: (note that the line 4 in t.c isn't helpful)

t.c:4:7: error: warning: ignoring directive for now
  asm("push %rax\n"
      ^
<inline asm>:2:1: note: instantiated into assembly here
.code32
^

now we get:

t.c:5:8: error: warning: ignoring directive for now
      ".code32\n"
       ^
<inline asm>:2:1: note: instantiated into assembly here
.code32
^

Note that we're pointing to line 5 properly now.  This implements
rdar://7839391 - inline asm errors should point to the right line in the asm
and makes the error message in PR8595 much less confusing.

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

14 years agoadjust for llvm mainline, yay type safety
Chris Lattner [Wed, 17 Nov 2010 08:13:04 +0000 (08:13 +0000)]
adjust for llvm mainline, yay type safety

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

14 years agoa metric ton of refactoring later, Sema::getLocationOfStringLiteralByte
Chris Lattner [Wed, 17 Nov 2010 07:37:15 +0000 (07:37 +0000)]
a metric ton of refactoring later, Sema::getLocationOfStringLiteralByte
no longer depends on Preprocessor, so we can move it out of Sema into
a nice new StringLiteral::getLocationOfByte method that can be used by
any AST client.

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

14 years agodo not do post checks. Because at this point we just enter the call.
Zhongxing Xu [Wed, 17 Nov 2010 07:31:08 +0000 (07:31 +0000)]
do not do post checks. Because at this point we just enter the call.

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

14 years agomove getSpelling from Preprocessor to Lexer, which it is more conceptually related to.
Chris Lattner [Wed, 17 Nov 2010 07:26:20 +0000 (07:26 +0000)]
move getSpelling from Preprocessor to Lexer, which it is more conceptually related to.

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

14 years agoRemove comments. We are already doing actual method call by inlining it.
Zhongxing Xu [Wed, 17 Nov 2010 07:21:49 +0000 (07:21 +0000)]
Remove comments. We are already doing actual method call by inlining it.

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

14 years agopropagate preprocessor out of StringLiteralParser. It is now
Chris Lattner [Wed, 17 Nov 2010 07:21:13 +0000 (07:21 +0000)]
propagate preprocessor out of StringLiteralParser.  It is now
possible to create one without a preprocessor.

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

14 years agopush the preprocessor out of EncodeUCNEscape
Chris Lattner [Wed, 17 Nov 2010 07:12:42 +0000 (07:12 +0000)]
push the preprocessor out of EncodeUCNEscape

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

14 years agomove AdvanceToTokenCharacter and getLocForEndOfToken from
Chris Lattner [Wed, 17 Nov 2010 07:05:50 +0000 (07:05 +0000)]
move AdvanceToTokenCharacter and getLocForEndOfToken from
Preprocessor to Lexer where they make more sense.

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

14 years agoadd a static version of PP::AdvanceToTokenCharacter.
Chris Lattner [Wed, 17 Nov 2010 06:55:10 +0000 (06:55 +0000)]
add a static version of PP::AdvanceToTokenCharacter.

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

14 years agopush use of Preprocessor out farther.
Chris Lattner [Wed, 17 Nov 2010 06:46:14 +0000 (06:46 +0000)]
push use of Preprocessor out farther.

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

14 years agopush use of Preprocessor out of getOffsetOfStringByte
Chris Lattner [Wed, 17 Nov 2010 06:35:43 +0000 (06:35 +0000)]
push use of Preprocessor out of getOffsetOfStringByte

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

14 years agoadd a static form of the efficient PP::getSpelling method.
Chris Lattner [Wed, 17 Nov 2010 06:31:48 +0000 (06:31 +0000)]
add a static form of the efficient PP::getSpelling method.

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

14 years agorefactor the interface to StringLiteralParser::getOffsetOfStringByte,
Chris Lattner [Wed, 17 Nov 2010 06:26:08 +0000 (06:26 +0000)]
refactor the interface to StringLiteralParser::getOffsetOfStringByte,
pushing the dependency on the preprocessor out a bit.

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

14 years agoAdded mapping from 'this' to it's SymbolicRegion in BasicStoreManager::getInitialStore.
Marcin Swiderski [Wed, 17 Nov 2010 06:22:54 +0000 (06:22 +0000)]
Added mapping from 'this' to it's SymbolicRegion in BasicStoreManager::getInitialStore.

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

14 years agofactor some code out to a helper function, no functionality change.
Chris Lattner [Wed, 17 Nov 2010 05:58:54 +0000 (05:58 +0000)]
factor some code out to a helper function, no functionality change.

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

14 years agoCursorVisitor: Migrate handling of
Ted Kremenek [Wed, 17 Nov 2010 02:18:35 +0000 (02:18 +0000)]
CursorVisitor: Migrate handling of
'SizeOfAlignOfExpr' and 'CXXSCalarValueInitExpr'
to data-recursion algorithm.

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

14 years agoFor an Objective-C @synthesize statement, e.g.,
Douglas Gregor [Wed, 17 Nov 2010 01:03:52 +0000 (01:03 +0000)]
For an Objective-C @synthesize statement, e.g.,

  @synthesize foo = _foo;

keep track of the location of the ivar ("_foo"). Teach libclang to
visit the ivar as a member reference.

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

14 years agoCursorVisitor: migrate handling of CXXUuidofExpr to
Ted Kremenek [Wed, 17 Nov 2010 00:50:52 +0000 (00:50 +0000)]
CursorVisitor: migrate handling of CXXUuidofExpr to
data-recursion algorithm.

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

14 years agoCursorVisitor: migrate handling of UnaryTypeTraitExpr
Ted Kremenek [Wed, 17 Nov 2010 00:50:50 +0000 (00:50 +0000)]
CursorVisitor: migrate handling of UnaryTypeTraitExpr
to data-recursion algorithm.

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

14 years agoCursorVisitor: refactor visitation of
Ted Kremenek [Wed, 17 Nov 2010 00:50:47 +0000 (00:50 +0000)]
CursorVisitor: refactor visitation of
explicit template args within data-recursion
algorithm.

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

14 years agoCursorVisitor: migrate handling of
Ted Kremenek [Wed, 17 Nov 2010 00:50:45 +0000 (00:50 +0000)]
CursorVisitor: migrate handling of
AddrLabelExpr to data-recursion algorithm, and
unify that reasoning with GotoStmt.

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

14 years agoCursorVisitor: migrate handling of
Ted Kremenek [Wed, 17 Nov 2010 00:50:43 +0000 (00:50 +0000)]
CursorVisitor: migrate handling of
VAArgExpr to data-recursion algorithm.

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

14 years agoCursorVisitor: migrate handling of
Ted Kremenek [Wed, 17 Nov 2010 00:50:41 +0000 (00:50 +0000)]
CursorVisitor: migrate handling of
CXXTypeidExpr to data-recursion algorithm.

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

14 years agoCursorVisitor: migrate handling of
Ted Kremenek [Wed, 17 Nov 2010 00:50:39 +0000 (00:50 +0000)]
CursorVisitor: migrate handling of
TypesCompatibleExpr to data-recursion algorithm.

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

14 years agoCursorVisitor: Migrate CXXUnresolvedConstructExpr over to data-recursive algorithm.
Ted Kremenek [Wed, 17 Nov 2010 00:50:36 +0000 (00:50 +0000)]
CursorVisitor: Migrate CXXUnresolvedConstructExpr over to data-recursive algorithm.

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

14 years agoAdd comments.
Ted Kremenek [Wed, 17 Nov 2010 00:50:34 +0000 (00:50 +0000)]
Add comments.

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

14 years agoRe-enable test with modifications for Neon vector changes in clang.
Bob Wilson [Wed, 17 Nov 2010 00:44:53 +0000 (00:44 +0000)]
Re-enable test with modifications for Neon vector changes in clang.
I mistakenly thought that this was checking for vector name mangling, but
it is not.  Since we're no longer wrapping Neon vectors in structs, this
test can just return a vector directly.  There are already other tests for
that, so just to make this interesting, change the test to return a struct
of two vectors.

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

14 years agoAdd support for distros that like x86_64-unknown-linux-gnu.
Rafael Espindola [Wed, 17 Nov 2010 00:25:26 +0000 (00:25 +0000)]
Add support for distros that like x86_64-unknown-linux-gnu.

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

14 years agoFixes synthesis of type for the object which holds info.
Fariborz Jahanian [Wed, 17 Nov 2010 00:21:28 +0000 (00:21 +0000)]
Fixes synthesis of type for the object which holds info.
about a __block cxx object.

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

14 years agoFix source-range information for Objective-C properties. Previously,
Douglas Gregor [Wed, 17 Nov 2010 00:13:31 +0000 (00:13 +0000)]
Fix source-range information for Objective-C properties. Previously,
we were just getting a range covering only the property name, which is
certainly not correct (and broke token annotation, among other
things).

Also, teach libclang about the relationship between
@synthesize/@dynamic and @property, so we get property name and
cursor-reference information for @synthesize and @dynamic.

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

14 years agoReset the lifetime-managed flag between emission of the agg conditional
John McCall [Wed, 17 Nov 2010 00:07:33 +0000 (00:07 +0000)]
Reset the lifetime-managed flag between emission of the agg conditional
branches.  Fixes PR8623.

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

14 years agoFront-end support for __attribute__((may_alias)). This is not
Dan Gohman [Wed, 17 Nov 2010 00:03:07 +0000 (00:03 +0000)]
Front-end support for __attribute__((may_alias)). This is not
yet hooked up to anything yet.

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

14 years agoSupport compound complex operations as l-values in C++. Add a test
John McCall [Tue, 16 Nov 2010 23:07:28 +0000 (23:07 +0000)]
Support compound complex operations as l-values in C++.  Add a test
case based on CodeGen/volatile-1.c which tests the current C++
semantics, and note the many, many places we fall short of them.

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

14 years agoWarn about arg1 && arg2 || arg3, as GCC 4.3+ does. Fixes rdar://8659922
Argyrios Kyrtzidis [Tue, 16 Nov 2010 21:00:12 +0000 (21:00 +0000)]
Warn about arg1 && arg2 || arg3, as GCC 4.3+ does. Fixes rdar://8659922

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

14 years agoUse an OwningPtr for the preamble buffer in ASTUnit. This plugs a leak
Douglas Gregor [Tue, 16 Nov 2010 20:45:51 +0000 (20:45 +0000)]
Use an OwningPtr for the preamble buffer in ASTUnit. This plugs a leak
where we failed to free this buffer along one of the paths, and
detangles the code a little.

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

14 years agoturned pointers into pointers to const in function parameters in all functions/builti...
Anton Yartsev [Tue, 16 Nov 2010 20:09:36 +0000 (20:09 +0000)]
turned pointers into pointers to const in function parameters in all functions/builtins accepting pointers to a const-qualified type according to PIM and "Language Extensions for CBEA"

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

14 years agoImplements __block API for c++ objects. There is still
Fariborz Jahanian [Tue, 16 Nov 2010 19:29:39 +0000 (19:29 +0000)]
Implements __block API for c++ objects. There is still
issue with runtime which I am discussing it with Blaine.
This is wip (so no test yet).

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

14 years agoTemporarily disable this check for Neon vector type mangling.
Bob Wilson [Tue, 16 Nov 2010 19:08:19 +0000 (19:08 +0000)]
Temporarily disable this check for Neon vector type mangling.
I'll reenable it soon when I'm done reworking <arm_neon.h>.

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

14 years agoStatic analyzer: Catch calls to malloc() with
Ted Kremenek [Tue, 16 Nov 2010 18:47:04 +0000 (18:47 +0000)]
Static analyzer: Catch calls to malloc() with
allocation sizes of 0 bytes.

Fixes PR 2899.

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

14 years agoEmit a specific diagnostic when typedefing C++ bool, mirroring gcc.
Argyrios Kyrtzidis [Tue, 16 Nov 2010 18:18:13 +0000 (18:18 +0000)]
Emit a specific diagnostic when typedefing C++ bool, mirroring gcc.
Fixes rdar://8365458

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

14 years agoMSVC doesn't like the noinline attribute at the end of a declaration. Try the other...
Benjamin Kramer [Tue, 16 Nov 2010 15:45:46 +0000 (15:45 +0000)]
MSVC doesn't like the noinline attribute at the end of a declaration. Try the other side.

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

14 years agoAdd gcc-4.4.4 headers on Gentoo systems. Patch by Bertjan Broeksema!
Nico Weber [Tue, 16 Nov 2010 12:42:55 +0000 (12:42 +0000)]
Add gcc-4.4.4 headers on Gentoo systems. Patch by Bertjan Broeksema!

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

14 years agoRemove an unintended restriction on sysroots introduced during the Path
Chandler Carruth [Tue, 16 Nov 2010 11:30:11 +0000 (11:30 +0000)]
Remove an unintended restriction on sysroots introduced during the Path
conversion.

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

14 years agoThis really seems like a boring set of fixes to our tests to make them more
Chandler Carruth [Tue, 16 Nov 2010 10:26:08 +0000 (10:26 +0000)]
This really seems like a boring set of fixes to our tests to make them more
independent of the underlying system. Let me know if any of these are too
aggressive.

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

14 years agoSimplify some complex emission and implement correct semantics for
John McCall [Tue, 16 Nov 2010 10:08:07 +0000 (10:08 +0000)]
Simplify some complex emission and implement correct semantics for
assignment to volatiles in C.  This in effect reverts some of mjs's
work in and around r72572.  Basically, the C++ standard is quite
clear, except that it lies about volatile behavior approximating
C's, whereas the C standard is almost actively misleading.

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

14 years agoFuther reduce the includes of our builtin headers, and teach limits.h to avoid
Chandler Carruth [Tue, 16 Nov 2010 10:07:43 +0000 (10:07 +0000)]
Futher reduce the includes of our builtin headers, and teach limits.h to avoid
include_next when not hosted or unavailable. This follows the pattern in
stdint.h and allows these headers to work even in a freestanding configuration
without a standard library.

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

14 years agoReverting r119341: doesn't compile, no obvious fix.
John McCall [Tue, 16 Nov 2010 09:18:38 +0000 (09:18 +0000)]
Reverting r119341:  doesn't compile, no obvious fix.

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

14 years agoRefactored GRExprEngine::getCXXThisRegion to use CXXMethodDecl::getThisType instead...
Marcin Swiderski [Tue, 16 Nov 2010 08:50:38 +0000 (08:50 +0000)]
Refactored GRExprEngine::getCXXThisRegion to use CXXMethodDecl::getThisType instead of calculating it by hand.

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

14 years agoFix PR8625 and correctly interpret member-calls to static members when
Chandler Carruth [Tue, 16 Nov 2010 08:49:43 +0000 (08:49 +0000)]
Fix PR8625 and correctly interpret member-calls to static members when
producing warnings.

This feels really fragile, and I've not audited all other argument index-based
warnings. I suspect we'll grow this bug on another warning eventually. It might
be nice to adjust the argument indices when building up the attribute AST node,
as we already have to remember about the 'this' argument within that code to
produce correct errors.

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

14 years agoRe-work the handling of implicit 'this' arguments and silly GCC-style attribute
Chandler Carruth [Tue, 16 Nov 2010 08:35:43 +0000 (08:35 +0000)]
Re-work the handling of implicit 'this' arguments and silly GCC-style attribute
argument indexes. This handles the offsets in a consistent manner for all of
the attributes which I saw working with these concepts. I've also added tests
for the attribute that motivated this: nonnull.

I consolidated the tests for format attributes into one file, and fleshed them
out a bit to trigger more of the warning cases. Also improved the quality of
some of the diagnostics that occur with invalid argument indices.

The only really questionable change here is supporting the implicit this
argument for the ownership attribute. I'm not sure it's really a sensible
concept there, but implemented the logic for consistency.

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

14 years agoRework USR generation from CXCursors to use CXStringBufs
Ted Kremenek [Tue, 16 Nov 2010 08:15:38 +0000 (08:15 +0000)]
Rework USR generation from CXCursors to use CXStringBufs
for the backing of generated USRs.  This optmizes
for the case when a client generates a sequence
of USRs in sequence, disposing of them soon
after generating them.  By using a string buffer,
we recycle malloc'ed memory instead of constantly
malloc'ing and copying strings.

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

14 years agoChange CXTranslationUnit to not directly cast to an ASTUnit*,
Ted Kremenek [Tue, 16 Nov 2010 08:15:36 +0000 (08:15 +0000)]
Change CXTranslationUnit to not directly cast to an ASTUnit*,
but to wrap both an ASTUnit and a "string pool"
that will be used for fast USR generation.

This requires a bunch of mechanical changes, as
there was a ton of code that assumed that CXTranslationUnit
and ASTUnit* were the same.

Along with this change, introduce CXStringBuf,
which provides an llvm::SmallVector<char> backing
for repeatedly generating CXStrings without a huge
amount of malloc() traffic.  This requires making
some changes to the representation of CXString
by renaming a few fields (but keeping the size
of the object the same).

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

14 years agoImprove diagnostic for calling non-const method on const object. Fixes rdar://7743000
Argyrios Kyrtzidis [Tue, 16 Nov 2010 08:04:45 +0000 (08:04 +0000)]
Improve diagnostic for calling non-const method on const object. Fixes rdar://7743000

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

14 years agoHandle member initializer in C++ ctor.
Zhongxing Xu [Tue, 16 Nov 2010 07:52:17 +0000 (07:52 +0000)]
Handle member initializer in C++ ctor.
 - Add a new Kind of ProgramPoint: PostInitializer.
 - Still use GRStmtNodeBuilder. But special handling PostInitializer in
   GRStmtNodeBuilder::GenerateAutoTransition().
 - Someday we should clean up the interface of GRStmtNodeBuilder.

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

14 years agoHave CXXDeleteExpr::getDestroyedType return the actual destroyed type
Craig Silverstein [Tue, 16 Nov 2010 07:16:25 +0000 (07:16 +0000)]
Have CXXDeleteExpr::getDestroyedType return the actual destroyed type
in more situations.  In particular, for code like

   template<class T> void Fn() { T* x; delete x; }

getDestroyedType() will now return T rather than T*, as it would
before this change.  On the other hand, for code like this:

   template<class T> void Fn() { T x; delete x; }

getDestroyedType() will return an empty QualType(), since it doesn't
know what the actual destroyed type would be.  Previously, it would
return T.

OKed by rjmccall

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

14 years agoBasic support for C++ in BasicStore:
Marcin Swiderski [Tue, 16 Nov 2010 07:15:33 +0000 (07:15 +0000)]
Basic support for C++ in BasicStore:
- CXXThisRegion treated like VarRegion and ObjCIVarRegion in various places,
- Reference treated like pointer in BindDeclInternal.

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

14 years agoNow that we have reliable cast kinds, simplify scalar cast IR gen.
John McCall [Tue, 16 Nov 2010 06:21:14 +0000 (06:21 +0000)]
Now that we have reliable cast kinds, simplify scalar cast IR gen.

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