[HIPIFY][fix][#211] Taking into account include guard controlling macro

...while including HIP main header file, which is inserted now after #indef controlling macro, or after #pragma once, if it's occurred earlier.

+ Add a couple of unit tests.
ToDo: Check backward compatibility on older clang versions.
Tento commit je obsažen v:
Evgeny Mankov
2019-08-02 16:46:45 +03:00
rodič f52245d440
revize 25075729f9
4 změnil soubory, kde provedl 73 přidání a 6 odebrání
+14
Zobrazit soubor
@@ -0,0 +1,14 @@
// RUN: %run_test hipify "%s" "%t" %hipify_args %clang_args
// Checks that HIP header file is included after #pragma once,
// which goes before include guard controlling macro.
// CHECK: #pragma once
// CHECK-NEXT: #include <hip/hip_runtime.h>
#pragma once
#ifndef HEADERS_TEST_10_H
// CHECK: #ifndef HEADERS_TEST_10_H
// CHECK-NOT: #include <hip/hip_runtime.h>
#define HEADERS_TEST_10_H
#include <stdio.h>
static int counter = 0;
#endif // HEADERS_TEST_10_H
+14
Zobrazit soubor
@@ -0,0 +1,14 @@
// RUN: %run_test hipify "%s" "%t" %hipify_args %clang_args
// Checks that HIP header file is included after include guard controlling macro,
// which goes before #pragma once.
// CHECK: #ifndef HEADERS_TEST_10_H
// CHECK-NEXT: #include <hip/hip_runtime.h>
#ifndef HEADERS_TEST_10_H
// CHECK: #pragma once
#pragma once
// CHECK-NOT: #include <hip/hip_runtime.h>
#define HEADERS_TEST_10_H
#include <stdio.h>
static int counter = 0;
#endif // HEADERS_TEST_10_H