summaryrefslogtreecommitdiff
path: root/test/SemaCUDA
diff options
context:
space:
mode:
authorJustin Lebar <jlebar@google.com>2016-10-28 16:26:26 +0000
committerJustin Lebar <jlebar@google.com>2016-10-28 16:26:26 +0000
commit242cc12621eb42daa43c507ff2b929ab79166bd7 (patch)
treed731bde914b4330430787f220e1452914eb1ca56 /test/SemaCUDA
parent2344195b4f0d2b4348eb8490e0bde8c8ae424733 (diff)
[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
Diffstat (limited to 'test/SemaCUDA')
-rw-r--r--test/SemaCUDA/gnu-inline.cu10
1 files changed, 10 insertions, 0 deletions
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(); }