[CUDA] [AST] Allow isInlineDefinitionExternallyVisible to be called on functions...
authorJustin Lebar <jlebar@google.com>
Fri, 28 Oct 2016 16:26:26 +0000 (16:26 +0000)
committerJustin Lebar <jlebar@google.com>
Fri, 28 Oct 2016 16:26:26 +0000 (16:26 +0000)
commit2b42ccc78b38e5b11305f7316e108882986f5aa9
tree382e96370484393998b18a4bf5eba976e84ced42
parent87a47be039226436fe0562f21f6858a2d244bf17
[CUDA] [AST] Allow isInlineDefinitionExternallyVisible to be called on functions without bodies.

Summary:
In CUDA compilation, we call isInlineDefinitionExternallyVisible (via
getGVALinkageForFunction) on functions while parsing their definitions.

At the point in time when we call getGVALinkageForFunction, we haven't
yet added the body to the function, so we trip this assert.  But as far
as I can tell, this is harmless.

To work around this, we add a new flag to FunctionDecl, "WillHaveBody".

There was other code that was working around the existing assert with a
really awful hack -- this change lets us get rid of that hack.

Reviewers: rsmith, tra

Subscribers: aemerson, cfe-commits

Differential Revision: https://reviews.llvm.org/D25640

llvm-svn: 285410
clang/include/clang/AST/Decl.h
clang/lib/AST/Decl.cpp
clang/lib/Sema/SemaDecl.cpp
clang/test/SemaCUDA/gnu-inline.cu [new file with mode: 0644]