From 242cc12621eb42daa43c507ff2b929ab79166bd7 Mon Sep 17 00:00:00 2001 From: Justin Lebar Date: Fri, 28 Oct 2016 16:26:26 +0000 Subject: [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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@285410 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/SemaCUDA/gnu-inline.cu | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 test/SemaCUDA/gnu-inline.cu (limited to 'test/SemaCUDA') diff --git a/test/SemaCUDA/gnu-inline.cu b/test/SemaCUDA/gnu-inline.cu new file mode 100644 index 0000000000..0ed543326b --- /dev/null +++ b/test/SemaCUDA/gnu-inline.cu @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +#include "Inputs/cuda.h" + +// expected-no-diagnostics + +// Check that we can handle gnu_inline functions when compiling in CUDA mode. + +void foo(); +inline __attribute__((gnu_inline)) void bar() { foo(); } -- cgit v1.2.3