Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions flang/lib/Frontend/CompilerInvocation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1566,6 +1566,11 @@ void CompilerInvocation::setDefaultPredefinitions() {
fortranOptions.predefinitions);
}

if (frontendOptions.features.IsEnabled(
Fortran::common::LanguageFeature::CUDA)) {
fortranOptions.predefinitions.emplace_back("_CUDA", "1");
}

llvm::Triple targetTriple{llvm::Triple(this->targetOpts.triple)};
if (targetTriple.isPPC()) {
// '__powerpc__' is a generic macro for any PowerPC cases. e.g. Max integer
Expand Down
1 change: 0 additions & 1 deletion flang/lib/Parser/parsing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ const SourceFile *Parsing::Prescan(const std::string &path, Options options) {
if (options.features.IsEnabled(LanguageFeature::CUDA)) {
prescanner.AddCompilerDirectiveSentinel("$cuf");
prescanner.AddCompilerDirectiveSentinel("@cuf");
preprocessor_.Define("_CUDA", "1");
}
ProvenanceRange range{allSources.AddIncludedFile(
*sourceFile, ProvenanceRange{}, options.isModuleFile)};
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Parser/cuf-sanity-tree.CUF
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
! RUN: %flang_fc1 -fdebug-dump-parse-tree %s 2>&1 | FileCheck %s
! RUN: %flang_fc1 -fdebug-dump-parse-tree -x cuda %s 2>&1 | FileCheck %s
include "cuf-sanity-common"
!CHECK: Program -> ProgramUnit -> SubroutineSubprogram
!CHECK: | SubroutineStmt
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Parser/cuf-sanity-unparse.CUF
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
! RUN: %flang_fc1 -fdebug-unparse %s 2>&1 | FileCheck %s
! RUN: %flang_fc1 -fdebug-unparse -x cuda %s 2>&1 | FileCheck %s
include "cuf-sanity-common"
!CHECK: SUBROUTINE atcuf
!CHECK: END SUBROUTINE
Expand Down