aboutsummaryrefslogtreecommitdiff
path: root/lib/AST
AgeCommit message (Collapse)Author
2012-08-30Fix a crash in type merging with enum types.Eli Friedman
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162886 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-29Move TLS check from LValueExprEvaluator::VisitVarDecl toHans Wennborg
CheckLValueConstantExpression. Richard pointed out that using the address of a TLS variable is ok in a core C++11 constant expression, as long as it isn't part of the eventual result of constant expression evaluation. Having the check in CheckLValueConstantExpression accomplishes this. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162850 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-29Fix r162835 as per Richard's comments.Hans Wennborg
VisitVarDecl should return Error(E), and we should test that the address of a TLS var can't be used as a constexpr. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162837 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-29The address of a TLS var is not compile-time constant (PR13720)Hans Wennborg
This makes Clang produce an error for code such as: __thread int x; int *p = &x; The lvalue of a thread-local variable cannot be evaluated at compile time. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162835 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-28[ms-inline asm] Have generateAsmString() return the AsmString computed by Sema.Chad Rosier
We still need to translate the string, but this at least gets us one step closer to using the more general EmitAsmStmt() codegen function. No functional change intended. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162785 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-28[ms-inline asm] Add constraints to MSAsmStmt. We don't currently computeChad Rosier
the constraints, so in the interim we speculatively assume a 'r' constraint. This is expected to work for most cases on x86. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162784 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-28[ms-inline asm] Use dyn_cast<> here to simplify logic.Chad Rosier
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162773 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-28[ms-inline asm] Make the AsmStmt class non-virtual.Chad Rosier
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162768 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-28Fix a -Wdocumentation warning.Dmitri Gribenko
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162730 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-28Merging consecutive comments: be more conservative.Dmitri Gribenko
Should fix part 2 of PR13374. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162723 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-28[ms-inline asm] Hoist more common code into the AsmStmt base class. Add stubsChad Rosier
with FIXMEs for unimplemented features. No functional change intended. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162716 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-27[ms-inline asm] Add virtual function, getClobber, that returns a StringRef.Chad Rosier
More work towards unifying asm stmt codegen. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162712 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-27[ms-inline asm] Rename getClobber to getClobberStringLiteral. No functionalChad Rosier
change intended. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162710 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-27[ms-inline asm] Rename GenerateAsmString to generateAsmString to conform withChad Rosier
coding standards. Also, add stub for MSAsmStmt class as part of unifying codegen logic for AsmStmts. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162696 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-27[ms-inline asm] Hoist common logic into the AsmStmt base class.Chad Rosier
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162692 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-27[ms-inline asm] Add a new base class, AsmStmt, for the GCCAsmStmt and MSAsmStmtChad Rosier
classes. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162691 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-27Use cast<> instead of static_cast. Patch by Timur Iskhodzhanov!John McCall
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162683 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-25Fix the mangling of function pointers in the MS ABI.John McCall
Patch by Timur Iskhodzhanov! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162638 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-25[ms-inline asm] As part of a larger refactoring, rename AsmStmt to GCCAsmStmt.Chad Rosier
No functional change intended. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162632 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-24Comment diagnostics: for unresolved parameters, do not suggest parameter fixitDmitri Gribenko
with parameter that is documented. Fixes PR13670, <rdar://problem/12155840>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162570 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-24[ms-inline asm] Refactor code. No functional change intended.Chad Rosier
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162568 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-24Push ArrayRef through the Expr hierarchy.Benjamin Kramer
No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162552 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-24[ms-inline asm] Add the basic APIs for Exprs to the MSAsmStmt AST. Next we needChad Rosier
generate the Input/Output expressions using Sema::ActOnIdExpression(). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162509 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-24Comment semantic analysis: treat function typedefs as functions so that one canDmitri Gribenko
use \param and \returns in documentation. Fixes PR13533. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162507 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-23Attaching comments to decls: since it was decided that Decl::isImplicit shouldDmitri Gribenko
not be set for implicit instantiations, remove the FIXME. This should be the last bit for PR13634. The actual fix happened in r162238. Motivation: it might be misleading to mark implicit instantiations as Decl::isImplicit = true. Because then, in order to be consistent, we should mark all instantiated members as implicit. But the user did actually type the declaration for the member, but the compiler played with it a little bit. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162488 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-23Change a bunch of cases where we do "getAs<...>->doSomething()" toTed Kremenek
"castAs<...>->doSomething()". The analyzer was flagging these as potential null dereferences, which is technically true. The invariants appear to be that these casts should never fail, so let's use castAs<> instead and avoid a runtime check. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162468 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-23array_pod_sort on the addresses of declaration pointers leads toDouglas Gregor
inconsistent ordering of results; instead, use use SmallPtrSet to eliminate duplicates. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162429 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-22Comment parsing: parse "<blah" as an HTML tag only if "blah" is a known tagDmitri Gribenko
name. This should reduce the amount of warning false positives about bad HTML in comments when the comment author intended to put a reference to a template. This change will also enable us parse the comment as intended in these cases. Fixes part 1 of PR13374. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162407 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-22ASTContext::getCommentForDecl: add comment.Dmitri Gribenko
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162374 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-22Attaching comments to declarations: when documentation is requested for anDmitri Gribenko
implicit instantiation, look for documentation attached to the template. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162371 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-22Fix typo in debug method.Benjamin Kramer
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162352 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-21CommentBriefParser: allow paragraphs to be separated by line of whitespace.Dmitri Gribenko
Skip paragraphs that contain only whitespace. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162315 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-21Switch some realignment calculations over to llvm::RoundUpToAlignment.Richard Smith
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162297 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-21DeclPrinter, terse mode: don't print function bodiesDmitri Gribenko
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162294 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-21Rename PrintingPolicy::DontRecurseInDeclContext to PrintingPolicy::TerseOutputDmitri Gribenko
to reflect the intention, not the implementation. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162293 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-21Fix alignment of array of VarDecl* following array of unsigned in LambdaExpr.Richard Smith
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162255 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-21When performing a trivial copy of a C++ type, we must be careful notJohn McCall
to overwrite objects that might have been allocated into the type's tail padding. This patch is missing some potential optimizations where the destination is provably a complete object, but it's necessary for correctness. Patch by Jonathan Sauer. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162254 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-20DeclPrinter: add terse output mode and lots of testsDmitri Gribenko
Add a flag PrintingPolicy::DontRecurseInDeclContext to provide "terse" output from DeclPrinter. The motivation is to use DeclPrinter to print declarations in user-friendly format, without overwhelming user with inner detail of the declaration being printed. Also add many tests for DeclPrinter. There are quite a few things that we print incorrectly: search for WRONG in DeclPrinterTest.cpp -- and these tests check our output against incorrect output, so that we can fix/refactor/rewrite the DeclPrinter later. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162245 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-20Attaching comments to declarations: ignore implicit decls. Decl::isImplicit()Dmitri Gribenko
does not return true for all implicit decls currently. This should fix PR13634 for now, but Decl::isImplicit() should be fixed, too. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162238 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-20Fix InitListExpr::isStringLiteralInit so it handles various edge cases ↵Eli Friedman
correctly. PR13643. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162226 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-20[ms-inline asm] Remove old cruft now that MS-style asms their own code path.Chad Rosier
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162210 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-18When mangling a negative number, remember that negating it does notJohn McCall
always yield a positive number. Just print the negated result as an unsigned number. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162163 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-16Fix misaligned allocation of TemplateParameterList objects.Richard Smith
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162056 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-16CommentCommandTraits: rename BeginName -> StartName for consistency.Dmitri Gribenko
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162044 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-16Attaching comments to declarations: parse the comment in context of theDmitri Gribenko
declaration it was attached to. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162033 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-16Store SourceManager pointer on PrintingPolicy in the case where we're dumping,Richard Smith
and remove ASTContext reference (which was frequently bound to a dereferenced null pointer) from the recursive lump of printPretty functions. In so doing, fix (at least) one case where we intended to use the 'dump' mode, but that failed because a null ASTContext reference had been passed in. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162011 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-16Don't constant-fold when pretty-printing alignment attribute. This fixes aRichard Smith
potential crasher -- Context is sometimes a null reference (!!) here. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162007 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-16Fix misaligned allocation of QualifiedTempateName and DependentTemplateName.Richard Smith
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162005 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-16[ms-inline asm] Add inputs and outputs to AST. No functional change.Chad Rosier
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162000 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-15[analyzer] Correctly devirtualize virtual method calls in constructors.Jordan Rose
This is the other half of C++11 [class.cdtor]p4 (the destructor side was added in r161915). This also fixes an issue with post-call checks where the 'this' value was already being cleaned out of the state, thus being omitted from a reconstructed CXXConstructorCall. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161981 91177308-0d34-0410-b5e6-96231b3b80d8